Viewer Modifier Plug-ins

class Foundry::Katana::ViewerModifier
#include <FnViewerModifier.h>

Class that represents a VMP. Must be be extended in an VMP.

It is responsible for Rendering specific scene graph location types in the viewer. This class accepts arguments that can define how this processing should happen. These arguments are passed to the constructor as a GroupAttribute with children.

Public Functions

ViewerModifier(GroupAttribute args)
virtual ~ViewerModifier()
virtual void deepSetup(ViewerModifierInput &input) = 0

Called per VMP instance before each draw

virtual void setup(ViewerModifierInput &input) = 0

Called once per VMP instance when constructed

virtual void draw(ViewerModifierInput &input) = 0

Performs the render code.

virtual void cleanup(ViewerModifierInput &input) = 0

Called when the GLM’s host location is removed/refreshed.

virtual void deepCleanup(ViewerModifierInput &input) = 0

Called per VMP instance after each draw

virtual DoubleAttribute getWorldSpaceBoundingBox(ViewerModifierInput &input)

WARNING: This is a deprecated function! Please use getLocalSpaceBoundingBox() instead

virtual DoubleAttribute getLocalSpaceBoundingBox(ViewerModifierInput &input)

Returns a DoubleAttribute representing the local space bounding box for the current location to be used with the viewer scenegraph, and useful for culling.

The bounding box is represented by 6 double values, that are the interleaved coordinates of minimum and maximum vertices of the bounding box (xMin, xMax, yMin, yMax, zMin, zMax).

Return
The double attribute representing the bounding box.
Parameters
  • input -

    The input interface to Katana’s scenegraph.

Public Static Functions

static GroupAttribute getArgumentTemplate()
static const char *getLocationType()
class Foundry::Katana::ViewerModifierInput
#include <FnViewerModifierInput.h>

Provides functions that inspect and manipulate the scene graph that contains the Location being processed by the VMP (the current Location).

Contains methods for controlling live attributes in the scene graph. (Live attributes are those linked to parameters in the node graph.)

Public Functions

ViewerModifierInput(FnViewerModifierHostHandle handle)

Constructor. Only used internally by Katana - a VMP always receives an already instantiated object of this type.

std::string getName() const

Returns the name of the current Location. (ex: “pony” in “/root/world/geo/pony”)

std::string getType() const

Returns the type of the current Location. (ex: “subdmesh” or “group”)

std::string getFullName() const

Returns the full path name of the current Location. (ex: “/root/world/geo/pony”)

bool isSelected() const
Attribute getAttribute(const std::string &name, const std::string &atLocation = "") const

Returns an existing Attribute from the specified Location, or from the current Location if no location is specified. If there isn’t any Attribute with the given name on the given Location then an invalid Attribute is returned (which can be checked with the function Attribute::isValid()). Global attributes (inherited from parent Locations) will be ignored.

Parameters
  • name -

    The name of the attribute - can be a child of a GroupAttribute (ex: “geometry.point.P”)

  • atLocation -

    The location from where the attribute will be retrieved (optional - if not specified the current Location will be used)

Attribute getGlobalAttribute(const std::string &name, const std::string &atLocation = "") const

Returns an existing Attribute from the specified Location, or from the current Location if no location is specified. If there isn’t any Attribute with the given name on the given Location then an invalid Attribute is returned (which can be checked with the function Attribute::isValid()). Global attributes (inherited from parent Locations) can be accessed.

Parameters
  • name -

    The name of the attribute - can be a child of a GroupAttribute (ex: “geometry.point.P”)

  • atLocation -

    The location from where the attribute will be retrieved (optional - if not specified the current Location will be used)

DoubleAttribute getWorldSpaceXform(const std::string &atLocation = "") const

Returns a Double Attribute with the worldspace transform matrix of a given Location. Katana stores the transforms in a structured Group Attribute that contains the translate, rotate and scale values on the 3 axis. This function crunches these attributes down into a Matrix.

Parameters
  • atLocation -

    The location from where the tranforms will be retrieved. (optional - if not specified the current Location will be used)

bool isLiveAttribute(const std::string &attribute, const std::string &atLocation = "") const

Returns true if the specified attribute has changed interactively.

Parameters
  • attribute -

    The name of the attribute.

  • atLocation -

    The location of the attribute. (optional - if not specified the current Location will be used)

Attribute getLiveAttribute(const std::string &name, const std::string &atLocation = "") const

Get the value of an attribute including any interactive changes. If there are no interactive changes the result is identical with getAttribute.

Parameters
  • name -

    The name of the attribute.

  • atLocation -

    The location of the attribute. (optional - if not specified the current Location will be used)

bool isGlobalLiveAttribute(const std::string &attribute, const std::string &atLocation = "") const

Returns true if the specified global attribute has changed interactively.

Parameters
  • attribute -

    The name of the attribute.

  • atLocation -

    The location of the attribute. (optional - if not specified the current Location will be used)

Attribute getGlobalLiveAttribute(const std::string &name, const std::string &atLocation = "") const

Get the value of an attribute including any interactive changes. If there are no interactive changes the result is identical to getAttribute.

Parameters
  • name -

    The name of the attribute.

  • atLocation -

    The location of the attribute. (optional - if not specified the current Location will be used)

Attribute getUniversalAttribute(const std::string &name, const std::string &atLocation = "") const

This function is deprecated. getGlobalAttribute() or getAttribute() should be used instead.

bool isLiveWorldSpaceXform(const std::string &atLocation = "") const

Returns true if the world space transform at the current (or specified) location has changed interactively.

DoubleAttribute getLiveWorldSpaceXform(const std::string &atLocation = "") const

Get the world space transform including any interactive changes.

Parameters
  • atLocation -

    The location from where the tranforms will be retrieved. (optional - if not specified the current Location will be used)

void getChildNames(std::vector<std::string> &names, const std::string &atLocation = "") const

Fills a vector with the names of the children of the given Location.

Parameters
  • names -

    A reference to a vector of strings that will be filled with the child names.

  • atLocation -

    The location for which the child names will be retrieved (optional - if not specified the current Location will be used)

void setUseFixedFunctionPipeline(bool)

Allow Katana’s GLSL shaders to run on the geometry created by this GLM

void setTransparent(bool)

Tell Katana to draw this GLM in depth-sorted order so that transparency works correctly

DoubleAttribute getDisplayMatrix(MatrixType type) const

Get access to the various view and projection matrices for the current viewer.

Parameters
  • type -

    The type of display matrix to retrieve.

DoubleAttribute getViewport() const

Return the current GL viewport.

int getDrawOption(const std::string&) const

Query the draw state at the current location. Valid queries are: fillPoints, fillWireframe, fillSolid, shadingFlat, shadingSmooth, lightOff, lightDefault, lightShaded, proxyBBox, proxyGeo proxyBoth, shadows, textures, selected, selectedAncestor, highlight, highlightAncestor, invisible, invisibleAncestor, normals, smoothOff, smoothLines, smoothPoints.

float getDrawOptionFloat(const std::string&) const

Query a float from the draw state at the current location. Valid queries are: pointSize.

const std::string getDrawOptionString(const std::string&) const

Query a string from the draw state at the current location. Reserved for future use.

void overrideHostGeometry()

If this is called at some point during deep setup, the GLM host will bypass its own geometry drawing routine for the location to which the GLM is attached.

bool isLookedThrough(bool includeChildren = false)

Returns true if the current location is currently being looked through.

Parameters
  • includeChildren -

    If true, consider descendants of looked-through locations as also being looked through.