Q100229: Extending Katana’s ViewerModifier plug-ins to add icon scalability



This article explains how to modify, recompile and register the ViewerModifier plug-ins so that a "viewer.default.drawOptions.locatorScale” attribute can be used to scale camera and light icons in the Viewer, without scaling the objects’ xform.



This set of steps is for Katana 2.5v4 on Linux (RHEL 6) using the Viewer Modifier Plug-in API version 2.0. For previous versions, please compile against the appropriate versions accordingly.

  1. Find the ViewerModifiers directory in your Katana installation directory, for example:


    and copy the content of the folder into a convenient location, for example:


  2. Modify the source code for the CameraViewerModifier and LightViewerModifier in your local copies, which is located under the ViewerModifiers/CameraViewerModifier/src and ViewerModifiers/LightViewerModifier/src directory structure respectively.

    Specifically, add these lines in the
    void draw(FnKat::ViewerModifierInput& input) function in both files as demonstrated in the attached example files and code below:


    FnKat::FloatAttribute locatorScaleAttr = input.getGlobalAttribute( 
    if (locatorScaleAttr.isValid())
    GLfloat locatorScale;
    locatorScale = locatorScaleAttr.getNearestSample(0)[0];
  3. Also modify the FnKat::DoubleAttribute getLocalSpaceBoundingBox(FnKat::ViewerModifierInput& input) function in both files as demonstrated in the attached example files CameraViewerModifier.cpp and LightViewerModifier.cpp.

    In both files, change the plug-in name in the REGISTER_PLUGIN call to start with a letter after L and C, for example use Z like:

    REGISTER_PLUGIN(LightViewerModifier, "ZLightViewerModifier", 0, 1);
    REGISTER_PLUGIN(CameraViewerModifier, "ZCameraViewerModifier", 0, 1);
    This is because the internal plug-in names will be ordered alphabetically and per the plug-in loading order Katana uses, the last alphabetical entry will win. 

  4. Save the files and prepare to compile the files against the right Viewer Modifier Plug-in API version.

  5. To compile the plug-ins, make sure you have cmake version 3.2 or higher installed.

  6. In a terminal, set the KATANA_HOME environment variable to point to your Katana installation directory, for example:

    export KATANA_HOME=/opt/Foundry/Katana2.5v4

  7. Set the CMAKE_PREFIX_PATH to point to where the file katana-config.cmake is located, for example:

    export CMAKE_PREFIX_PATH = $KATANA_HOME/plugin_apis/cmake

  8. Navigate to the your local ViewerModifiers directory in the terminal and run the following command:

    cmake CMakeLists.txt

    This should create a Makefile in the ViewerModifiers directory. The file may be hidden, so you might have to enable the “Show hidden files” option in your file browser to see it.

  9. Run the command make to build the plug-ins. This should give you a LightViewerModifier.so file and a CameraViewerModifier.so file in their respective directories.

  10. These .so files need to be placed in a directory called Libs inside a KATANA_RESOURCES directory. For example, place the .so files into


    and add the path

    /home/users/yourUsername/katana   to KATANA_RESOURCES.


To use the new plug-ins created, open Katana and in your scene use an AttributeSet node and add a float attribute called  "viewer.default.drawOptions.locatorScale" on the camera or light location you'd like to scale. This will allow scaling the camera or light icon in the Viewer without altering the object’s attribute values.

Was this article helpful?
1 out of 1 found this helpful