Viewer Delegates¶
-
group
FnViewerDelegate
Typedefs
-
typedef std::shared_ptr<ViewerDelegateWrapper>
ViewerDelegateWrapperPtr
¶
-
class
ViewerDelegatePluginBase
¶ - #include <FnViewerDelegate.h>
Main data source for a Viewer that feeds the different Viewports.
A ViewerDelegate can serve several Viewports with data from location cooking, deletion, opening and closing events that are delegated to it. It uses a Geolib3 client that listens to a given Op-Tree (see setViewOp()). It can access all the attributes of all the locations cooked so far via getAttributes().
Scene graph locations are made available through one of the following scene views:
- Primary (kFnViewerDelegatePrimary): Observes all Viewer-visible locations (expanded/pinned/included). Location changes are signalled via ViewerDelegate::locationEvent().
- Sources (kFnViewerDelegateSources): Observes all subtrees activated as a ‘source’, e.g. an instance source. Location changes are signalled via ViewerDelegate::sourceLocationEvent().
Scene graph query methods such as ViewerDelegate::getAttributes() and ViewerDelegate::getWorldXform() query the primary scene view unless the ‘sceneView’ parameter stipulates otherwise.
Any data structure that is shared between different Viewports should be maintained by the ViewerDelegate. It can access all of its Viewports by name or by index (see getViewport()).
Since it has access to the cooked attributes for each location it can also get the Manipulators that are compatible with a location (i.e. that can manipulate that location) by looking at its attributes and matching each Manipulator’s requirements (see getCompatibleManipulatorsInfo()).
It can also communicate with the Python layer via callPythonCallback().
An already compiled ViewerDelegate can be extended by the plugin type ViewerDelegateComponent. Several of these can be added to allow new location types and attributes to be processed. ViewerDelegateComponents can inform other ViewerDelegateComponents and the ViewerDelegate that they are handling a location by return ‘true’ from their locationEvent() callback. This may allow existing functionality in the ViewerDelegate to be removed/ignored.
This is a virtual base class to be extended in your plug-in. In addition to implementing all the pure virtual functions in this class, you must also implement this static method in your derived class:
// Returns a new instance of your derived class. static ViewerDelegate* create();
To indicate an error to the caller, your implementation may throw an exception derived from std::exception.
ViewerDelegate is the class that plugins should extend and implement.
ViewerDelegateWrapper is the class that allows other plugin types to access the ViewerDelegate plugin.
ViewerDelegatePluginBase is the base class that provides the common methods between ViewerDelegate and ViewerDelegateWrapper.
Subclassed by Foundry::Katana::ViewerAPI::ViewerDelegate, Foundry::Katana::ViewerAPI::ViewerDelegateWrapper
Public Functions
-
ViewerDelegatePluginBase
()¶ Constructor.
-
virtual
~ViewerDelegatePluginBase
()¶ Destructor.
-
FnAttribute::GroupAttribute
getAttributes
(const std::string &locationPath, FnViewerDelegateSceneView sceneView = kFnViewerDelegatePrimary)¶ Gets cooked attributes for a location.
Gets the cached cooked attributes for the location. Returns an invalid group attribute if the location hasn’t been cooked.
During the manipulation of an attribute by a Manipulator, the last value set by it will be returned instead of the cached cooked attribute. This allows faster interactive representation of the scene graph during the manipulation, since the cooking might not be fast enough to provide an interactive speed.
This function is exposed in the ViewerDelegate Python class.
- Return
- The attributes of the location.
- Parameters
locationPath
-The location path.
sceneView
-Scene view to query.
-
Matrix44d
getLocalXform
(const std::string &locationPath, bool &isAbsolute, FnViewerDelegateSceneView sceneView = kFnViewerDelegatePrimary)¶ Gets the location’s local space transform.
- Return
- Gets the location’s local space transform as a matrix.
- Parameters
locationPath
-The location.
isAbsolute
-Set to true if the local transform is reset to identity using the ‘origin’ attribute convention. If true, the location’s ancestors’ transforms do not contribute to the global transform of this location and its descendants.
sceneView
-Scene view to query.
-
Matrix44d
getWorldXform
(const std::string &locationPath, FnViewerDelegateSceneView sceneView = kFnViewerDelegatePrimary)¶ Gets the location’s world space transform.
- Return
- Gets the location’s world space transform as a matrix.
- Parameters
locationPath
-The location.
sceneView
-Scene view to query.
-
Matrix44d
getParentXform
(const std::string &locationPath, FnViewerDelegateSceneView sceneView = kFnViewerDelegatePrimary)¶ Gets the location parent’s world space transform.
- Return
- Gets the location parent’s world space transform as a matrix.
- Parameters
locationPath
-The location.
sceneView
-Scene view to query.
-
Matrix44d
getPartialXform
(const std::string &locationPath, const std::string &groupName, const std::string &componentName, bool includeComponent, FnViewerDelegateSceneView sceneView = kFnViewerDelegatePrimary, bool includeParentXform = true, bool includeBeforeGroup = true, bool includeAfterGroup = false)¶ Transform from rotate/scale/translate space to world space.
NOTE: in this case a “component” refers to a transformation component (scale, rotate, translate), rather than a ViewerDelegateComponent.
This defines the transformation from a transform component space (scale, translate, rotate) to world space. It is defined by the transform of all the components that are applied before the one specified by componentName concatenated by the location’s parent transform. This transform will be affected by the transform order.
The includeComponent flag defines if the component transformation should be included in the result or not. For example, for a TRS transform order in a Rotate manipulator and the flag includeComponent set to false, this will return the following matrix: Translate * XformGroupBefore * ParentLocation And if includeComponent is set to true, then this is the result: Rotate * Translate * XformGroupBefore * ParentLocation
The componentName argument defines name of the xform component attribute. For example: “translate” for xform.interactive.translate”. In the case of a rotation, in which there are several attributes suffixed with the axis letter, a ”?” should be added instead of the axis name (example: “xform.interactive.rotate?”) This way the whole component, with all its 3 attributes, will be considered. The includeComponent will also define if the components that match this wildcard will all be included or all excluded from the result.
If the location has no xform attribute or if no component attribute is found then an identity matrix is returned.
- Return
- A matrix representing the transform component-to-world transform. It is given by the multiplication of all the components that are applied before the specified component.
- Parameters
locationPath
-The location with the transform.
groupName
-The name of the parent GroupAttribute that contains the transform attributes. Example: “xform.interactive”
componentName
-The name of the attribute of the transform component. The wildcard ”?” at the end of this string will match all the transform components prefixed by componentName that are followed by an axis letter at the end. Examples: “transform”, “rotateX” or “rotate?”.
includeComponent
-Specifies if the component specified by componentName should be included in the resulting matrix.
sceneView
-Scene view to query.
includeParentXform
-Specifies parent locations xform should be included in the resulting matrix.
includeBeforeGroup
-Specifies if the transform groups before the one specified by componentName (example: “xform.group1” before “xform.interactive”) should also be included in the resulting transform.
includeAfterGroup
-Specifies if the transform groups after the one specified by componentName (example: “xform.group1” after “xform.interactive”) should also be included in the resulting transform.
-
void
openLocation
(const std::string &locationPath)¶ Opens a location.
Opens a location, meaning that its potential child locations will be cooked.
- Parameters
locationPath
-The location path.
-
void
openLocations
(const std::vector<std::string> &locationPaths)¶ Opens a list of locations.
Opens a list of locations, meaning that their potential child locations will be cooked.
This function is exposed in the ViewerDelegate Python class.
- Parameters
locationPaths
-The location paths.
-
void
closeLocation
(const std::string &locationPath)¶ Closes a location.
Closes a location, meaning that its child locations will cease to be cooked, and a deleted event (see locationDeleted()) will be issued for these children.
- Parameters
locationPath
-The location path.
-
void
closeLocations
(const std::vector<std::string> &locationPaths)¶ Closes a list of locations.
Closes a list of location, meaning that their child locations will cease to be cooked, and a deleted event (see locationDeleted()) will be issued for these children.
This function is exposed in the ViewerDelegate Python class.
- Parameters
locationPaths
-The location paths.
-
void
activateSourceLocation
(const std::string &locationPath)¶ Activate the source tree rooted at the given location.
While a source location is active, that location and all of its descendants and ancestors are included in the ‘sources’ scene view.
- Parameters
locationPath
-The source tree root location path.
-
void
activateSourceLocations
(const std::vector<std::string> &locationPaths)¶ Activate the source trees rooted at the given locations.
While a source location is active, that location and all of its descendants and ancestors are included in the ‘sources’ scene view.
- Parameters
locationPaths
-The source tree root location paths.
-
void
deactivateSourceLocation
(const std::string &locationPath)¶ Deactivate the source tree rooted at the given location.
- Parameters
locationPath
-The source tree root location path.
-
void
deactivateSourceLocations
(const std::vector<std::string> &locationPaths)¶ Deactivate the source trees rooted at the given locations.
- Parameters
locationPaths
-The source tree root location paths.
-
void
selectLocation
(const std::string &locationPath)¶ Selects a location in Katana.
- Parameters
locationPath
-The location path to be selected.
-
void
selectLocations
(const std::vector<std::string> &locationPaths)¶ Selects a list of location in Katana.
- Parameters
locationPaths
-The location paths to be selected.
-
void
getSelectedLocations
(std::vector<std::string> &locationPaths)¶ Get the list of selected locations.
- Parameters
locationPaths
-Will be filled with the selected location paths.
-
ViewerDelegateComponentWrapperPtr
addComponent
(const std::string &pluginName, const std::string &name)¶ Adds a ViewerDelegateComponent.
Instantiates a ViewerDelegateComponent and adds it to the end of the list of components on this ViewerDelegate.
- Return
- The newly created ViewerDelegateComponent.
- Parameters
pluginName
-The ViewerDelegateComponent plugin name.
name
-The name for the new ViewerDelegateComponent.
-
ViewerDelegateComponentWrapperPtr
insertComponent
(const std::string &pluginName, const std::string &name, unsigned int index)¶ Inserts a ViewerDelegateComponent.
Instantiates a ViewerDelegateComponent and inserts it into the specified index of the list of components on this ViewerDelegate.
- Return
- The newly created ViewerDelegateComponent.
- Parameters
pluginName
-The ViewerDelegateComponent plugin name.
name
-The name for the new ViewerDelegateComponent.
index
-The position for the new ViewerDelegateComponent to be inserted into.
-
ViewerDelegateComponentWrapperPtr
getComponent
(const std::string &name) const¶ Gets a ViewerDelegateComponent by name.
This function is exposed in the ViewerDelegate Python class.
- Return
- The ViewerDelegateComponent in this ViewerDelegate with the given name or 0 if no such component exists.
- Parameters
name
-The name of the ViewerDelegateComponent.
-
ViewerDelegateComponentWrapperPtr
getComponent
(unsigned int index) const¶ Gets a ViewerDelegateComponent by index.
This function is exposed in the ViewerDelegate Python class as ViewerDelegate.getComponentByIndex().
- Return
- The ViewerDelegateComponent in this ViewerDelegate with the given index or 0 if no such component exists.
- Parameters
index
-The position in the list of ViewerDelegateComponents on this ViewerDelegate.
-
void
removeComponent
(const std::string &name)¶ Removes a ViewerDelegateComponent by name.
This function is exposed in the ViewerDelegate Python class.
- Parameters
name
-The name of the ViewerDelegateComponent to be removed.
-
void
removeComponent
(unsigned int index)¶ Removes a ViewerDelegateComponent by name.
This function is exposed in the ViewerDelegate Python class as ViewerDelegate.removeLayerByIndex().
- Parameters
index
-The position in the list of ViewerDelegateComponents on this ViewerDelegate
-
unsigned int
getNumberOfComponents
() const¶ Gets the number of ViewerDelegateComponents.
This function is exposed in the ViewerDelegate Python class.
- Return
- The number of ViewerDelegateComponents added to this ViewerDelegate.
-
std::string
getComponentName
(unsigned int index)¶ Gets the name of the ViewerDelegateComponent on a given index.
- Return
- The name of the ViewerDelegateComponent on the given index or empty string if it doesn’t exist.
- Parameters
index
-The position in the list of ViewerDelegateComponents on this ViewerDelegate.
-
int
getComponentIndex
(const std::string &name)¶ Gets the index of the ViewerDelegateComponent with a given name.
- Return
- The position in the list of ViewerDelegateComponents on this ViewerDelegate or -1 if it doesn’t exist.
- Parameters
name
-The name of the ViewerDelegateComponent.
-
ViewportWrapperPtr
getViewport
(const std::string &name)¶ Gets a Viewport by name.
Gets a Viewport associated with this ViewerDelegate by its name. The Vieweport must have been created via Python using the ViewerDelegate.addViewport() call.
-
ViewportWrapperPtr
getViewport
(unsigned int index)¶ Gets a Viewport by index.
Gets a Viewport associated with this ViewerDelegate by its index. The Vieweport must have been created via Python using the ViewerDelegate.addViewport() call.
This function is exposed in the ViewerDelegate Python class as ViewerDelegate.getViewportByIndex().
-
unsigned int
getNumberOfViewports
()¶ Gets the number of Viewports.
Gets the number of Viewports associated with this ViewerDelegate. The Vieweports must have been created via Python using the ViewerDelegate.addViewport() call.
This function is exposed in the ViewerDelegate Python class.
- Return
- The number of Viewports.
-
std::string
getViewportName
(unsigned int index)¶ Gets the Viewport name for a given index.
Gets the name of the Viewport associated with this ViewerDelegate with the given index. The Vieweports must have been created via Python using the ViewerDelegate.addViewport() call.
-
FnAttribute::GroupAttribute
getCompatibleManipulatorsInfo
(const std::vector<std::string> &locationPaths)¶ Gets the Manipulators compatible with a list of locations.
Returns the information about the Manipulator plugins that are compatible with a given list of locations. This is done by calling Manipulator::match() for the cooked attributes of each of these locations. The Manipulators have to match ALL of the given locations. The information is returned as a GroupAttribute that contains other GroupAttributes with each manipulator’s tags (see Manipulator::getTags()) indexed by the Manipulator plugin name:
GroupAttribute { “manipName1”: GroupAttribute { “tagName1”: “tagValue1”, “tagName2”: “tagValue2”, ... }, “manipName2”: GroupAttribute { ... }, ... }
This function is exposed in the ViewerDelegate Python class.
- Return
- A GroupAttribute with the tags of the compatible manipulators.
- Parameters
locationPaths
-The location paths.
-
FnAttribute::Attribute
callPythonCallback
(const std::string &name, FnAttribute::Attribute message)¶ Calls a Python callback.
Calls a Python callback that has been registered in Python via the method ViewerDelegate.registerCallback() (see also the Python function ViewerDelegate.registerCallback()). This allows the ViewerDelegate to communicate with the Viewer tab and Katana via Python. Both the arguments and return value of the callback are in the form of an Attribute.
-
FnAttribute::GroupAttribute
getLiveAttributes
(const std::string &locationPath, FnViewerDelegateSceneView sceneView = kFnViewerDelegatePrimary)¶ Gets the live attributes for a location.
Gets the cached, manipulated attributes for the location. Returns an invalid group attribute if the location is not being manipulated. Only attributes that are being manipulated will be present in the group.
This function is exposed in the ViewerDelegate Python class.
- Return
- The live attributes of the location.
- Parameters
locationPath
-The location path.
sceneView
-Scene view to query.
-
FnAttribute::GroupAttribute
getCookedAttributes
(const std::string &locationPath, FnViewerDelegateSceneView sceneView = kFnViewerDelegatePrimary)¶ Gets the cooked attributes for a location.
Gets the cooked attributes from the runtime. Unlike getAttributes(), this function does not apply the manipulated attributes on top.
This function is exposed in the ViewerDelegate Python class.
- Return
- The original attributes of the location.
- Parameters
locationPath
-The location path.
sceneView
-Scene view to query.
-
bool
setManipulatedAttribute
(const std::string &locationPath, const std::string &attrName, FnAttribute::Attribute valueAttr, bool isFinal)¶ Sets a manipulated attribute back into Katana.
When the user interacts with a an editable attribute some values will have to be sent back to Katana. Setting these values will typically end up setting some node parameters in Katana. Parameters will not be set explicitly by the Manipulators because the same Manipulator might be able to serve different nodes with different parameters.
Katana will know what parameters to change via the protocol defined by discovering the node via the “attributeEditor.exclusiveTo” attribute convention and then via the setOverride() function on that node. This function will return false if no parameter capable of editing the given attribute is found.
For example in order to change the X position of an object setValue() would be called for the location of that object on its attribute ‘xform.interactive.translate.x’.
Once a value is set the cooked result might take some time to arrive back. During that time, attributes provided by Viewer Location Events and returned by ViewerDelegate::getAttributes() contain the manipulated value, rather than the cooked one, for those attributes.
While a user is scrubbing a UI element that manipulates the attribute, the values might not end up being committed immediately into Geolib3 to be cooked, as this might not perform at an interactive speed (depending on the project complexity). For this the concept of ‘final’ value is used. While the user is scrubbing a Manipulator handle the value will not be sent back to Katana as the final one. That will happen only once the user releases it, which, at that point, Katana will, guaranteedly, be informed that the new scene can be cooked.
- Return
- True if a parameter capable of editing the given attribute was found and was successfully set, false otherwise.
- Parameters
locationPath
-The location of the object being manipulated.
attrName
-The attribute name for the value being manipulated.
valueAttr
-The value being set.
isFinal
-True if this is a final value.
-
void
openManipulationGroup
(const std::string &locationPath)¶ Marks the beginning of a batch of manipulations.
Multiple manipulations can be batched into a group, allowing them to be processed at the same time. Once called any subsequent calls to setManipulatedAttribute() will be deferred until closeManipulationGroup() is called.
- Parameters
locationPath
-The scene graph location that this group is for. Multiple groups can be created for different locations.
-
void
closeManipulationGroup
(const std::string &locationPath)¶ Marks the end of a batch of manipulations.
- Parameters
locationPath
-The scene graph location that this group is for. Multiple groups can be created for different locations.
-
void
setBoundingBoxesEnabled
(bool enabled)¶ Turns the display of bounding boxes on or off.
- Parameters
enabled
-Flag that controls whether to turn the display of bounding boxes on or off.
-
void
setProxyGeometryEnabled
(bool enabled)¶ Turns the display of proxy geometries on or off.
- Parameters
enabled
-Flag that controls whether to turn the display of proxy geometries on or off.
-
FnAttribute::StringAttribute
getDescendantLocations
(const std::string &location)¶ Returns all descendant locations from the specified location.
The descendant locations are those that the viewer delegate has opened. Full scene-graph expansion is not performed by this function.
- Return
- StringAttribute containing zero or more descendant locations.
- Parameters
location
-Parent of all returned locations.
-
FnAttribute::DoubleAttribute
computeMergedExtent
(const std::vector<std::string> &locations, const std::string &excludeLocation)¶ Computes the merged extent of the given locations in world space.
The bounds of every location will be merged. If the location does not have defined bounds, its extent will be computed based on its geometry, as well as the bounds or extent of its descendants.
- Return
- The merged bounds of all the locations in world space, or an invalid attribute if it could not be computed.
- Parameters
locations
-Locations whose bounds (or extent) need to be merged.
excludeLocation
-Location that must be excluded from the merged bounds (typically the viewport’s look-through location).
-
class
ViewerDelegate
¶ - #include <FnViewerDelegate.h>
The ViewerDelegate class to be extended by plugins.
Inherits from Foundry::Katana::ViewerAPI::ViewerDelegatePluginBase
Subclassed by ExampleViewerDelegate
Public Functions
-
ViewerDelegate
()¶ Constructor.
-
virtual
~ViewerDelegate
()¶ Destructor.
-
virtual void
setup
() = 0¶ Initializes the ViewportDelegate’s resources.
-
virtual void
cleanup
() = 0¶ Cleans up the ViewportDelegate’s resources.
-
virtual FnAttribute::DoubleAttribute
getBounds
(const std::string &locationPath)¶ Gets the bounds of the given location, if available.
This function is called only if bounds are not given by the “bound” attribute on the scene graph location. It should not traverse scene graph in order to compute bounds.
- Return
- The bounds of the location in local space, or an invalid attribute if not available.
- Parameters
locationPath
-The location path.
-
virtual FnAttribute::DoubleAttribute
computeExtent
(const std::string &locationPath)¶ Computes the extent of any local geometry representation of this location.
The computed extent returned by this function will be merged with a default extent computed from standard “geometry.point” attribute.
- Return
- The extent of the location in local space, or an invalid attribute if no extent was computed.
- Parameters
locationPath
-The location path.
-
virtual void *
getPrivateData
(void *inputData)¶ Returns some arbitrary data.
This can be used by other plugins to access some data that is specific to this object after it is compiled, allowing built-in parts of existing Viewers to be extendable by other plugins like ViewerDelegateComponents, Viewports and ViewportLayers.
This function should be called by other plugins after getting a ManipulatorWrapperPtr and converting it into a concrete instance via ManipulatorWrapper::getPluginInstance(). These other plugins will have to be built with the same compiler and using the same compiler flags as the ViewerDelegate so that this data can be cast and used without running into C++ name mangling issues.
An example: A ViewerDelegate maintains some renderer specific data structure that contains the expanded scene data in a format that the render can use. A ViewerDelegateComponent could be added to the Viewer and through this function an access this data so that new location types can be interpreted, added to the data structure and rendered.
- Return
- The arbitrary private data. A void pointer that can be cast into specific object types by other plugins.
- Parameters
inputData
-A pointer to some input data that can be used to produce the returned data.
-
virtual void
locationEvent
(const ViewerLocationEvent &event, bool locationHandled) = 0¶ Notification of scene graph location state changes.
- Parameters
event
-Struct containing location event information (see “FnViewerLocationEvent.h” for details).
locationHandled
-True if a ViewerDelegateComponent has, on processing this event, stated that it is handling this location. In this case, the Viewer Delegate should not draw its own representation.
-
virtual void
sourceLocationEvent
(const ViewerLocationEvent &event) = 0¶ Notification of ‘sources’ scene graph location state changes.
- Parameters
event
-Struct containing location event information (see “FnViewerLocationEvent.h” for details).
-
virtual void
locationsSelected
(const std::vector<std::string> &locationPaths) = 0¶ Called when the location selection changes in Katana.
- Parameters
locationPaths
-The selected location paths.
-
virtual bool
isProcessing
() const¶ Queries the processing of the Viewer Delegate plug-in.
- Return
- true if the plug-in is processing anything that may result in a change to the Viewer.
-
virtual void
setOption
(OptionIdGenerator::value_type optionId, FnAttribute::Attribute attr)¶ Sets a generic option.
Optional. Reacts to a generic option being set from Python or called directly by other C++ Viewer plugin classes. This can be used as a message passing mechanism from the outside into the ViewerDelegate.
This function is exposed in the ViewerDelegate Python class.
- Parameters
optionId
-The ID of the option created from OptionIdGenerator or manually defined by users.
attr
-Attribute with the value being set.
-
virtual FnAttribute::Attribute
getOption
(OptionIdGenerator::value_type optionId)¶ Gets the value of a generic option.
Optional. Returns the value of a generic option being requested from Python or from other C++ Viewer plugin classes.
- Return
- Attribute with the value of the option.
- Parameters
optionId
-The ID of the option created from OptionIdGenerator or manually defined by users.
-
void
setOption
(const std::string &name, FnAttribute::Attribute attr)¶ Sets a generic option by generating an option ID from the passed name.
This generates an Option ID from the passed string and passes it to setOption(OptionIdGenerator::value_type optionId, FnAttribute::Attribute attr). Since the ID is generated on every call, it is more efficient to generate the ID once, and store it for future use.
- Parameters
name
-The name of the option whose value to set.
attr
-Attribute with the value to set for the option.
-
FnAttribute::Attribute
getOption
(const std::string &name)¶ Gets a generic option by generating an option ID from the passed name.
This generates an Option ID from the passed string and passes it to getOption(OptionIdGenerator::value_type optionId). Since the ID is generated on every call, it is more efficient to generate the ID once, and store it for future use.
- Return
- The value of the option with the given name.
- Parameters
name
-The name of the option whose value to retrieve.
-
virtual void
freeze
() = 0¶ Freezes the ViewerDelegate when the Viewer is hidden.
Allows the ViewerDelegate to freeze its activities when the Viewer is not visible. This allows the ViewerDelegate to stop any kind of unecessary processing that might happen durging that time.
This function is exposed in the ViewerDelegate Python class and in the ViewerDelegateWrapper wrapper class.
-
virtual void
thaw
() = 0¶ Thaws the ViewerDelegate when the Viewer is shown.
Allows the ViewerDelegate to restart its activities when the Viewer becomes visible. This restarts the activities paused by freeze().
This function is exposed in the ViewerDelegate Python class.
Public Static Functions
-
static void
flush
()¶ Flush plugin Caches.
Allows to discard any cache for this plugin when a Flush Caches event occurs.
-
-
class
ViewerDelegateWrapper
¶ - #include <FnViewerDelegate.h>
The ViewerDelegate class accessed by other plugins.
Inherits from Foundry::Katana::ViewerAPI::ViewerDelegatePluginBase
Public Functions
-
ViewerDelegateWrapper
(FnPluginHost *host, FnViewerDelegateHostHandle hostHandle, FnViewerDelegatePluginHandle pluginHandle, FnViewerDelegatePluginSuite_v3 *pluginSuite)¶
-
~ViewerDelegateWrapper
()¶
- template <class T>
-
T *
getPluginInstance
()¶ Gets a pointer to the real plugin instance.
WARNING: This function purposely breaks the compiler agnostic pattern of the Katana plugin API, so it needs to be used with care. This performs a dynamic cast to the real type so the implications of what that means in different circumstances should be understood. If the caller and plugin instance are not contained in the same shared library the RTTI check may fail.
This function allows a plugin wrapper to return the actual plugin class. The plugin is returned as a pointer to a child class of ViewerDelegate that is a registerd plugin. The type of that child class needs to be specified in the template, so that it can be properly cast. If the specified type doesn’t match the plugin type then NULL is returned.
-
void
setOption
(OptionIdGenerator::value_type optionId, FnAttribute::Attribute attr)¶ Sets a ViewerDelegate option.
-
FnAttribute::Attribute
getOption
(OptionIdGenerator::value_type optionId)¶ Gets a ViewerDelegate option.
-
void
setOption
(const std::string &name, FnAttribute::Attribute attr)¶ Sets a ViewerDelegate option.
-
FnAttribute::Attribute
getOption
(const std::string &name)¶ Gets a ViewerDelegate option.
-
-
typedef std::shared_ptr<ViewerDelegateWrapper>