Viewer Delegate Components

group FnViewerDelegateComponent

Typedefs

typedef FnPlatform::internal::SharedPtr<ViewerDelegateComponentWrapper>::type ViewerDelegateComponentWrapperPtr
class ViewerDelegateComponentPluginBase
#include <FnViewerDelegateComponent.h>

Extends the functionality of an existing ViewerDelegate.

A ViewerDelegateComponent allows to extend the support for more location types or attribute conventions that are not supported by the ViewerDelegate. Together with the ViewportLayer plugin type, an already compiled Viewer can be extended. This can also be used to modularize the features of a ViewerDelegate. For example each location type can have its own ViewerDelegateComponent, which can be added/removed to the Viewer at runtime.

Whenever a ViewerDelegateComponent has to access some private data that is kept in the ViewerDelegate the method ViewerDelegate::getPrivateData() can be used to access that data. In this case the compiler used to build the ViewerDelegate and the ViewerDelegateComponent have to be the same.

A ViewerDelegateComponent ‘locationEvent’ callback function can return true in order to inform other ViewerDelegateComponents and the ViewerDelegate that it is handling the location. This may allow existing functionality in the ViewerDelegate to be removed/ignored. For example, if the ViewerDelegate has 2 ViewerDelegateComponent (A and B) and a new one (C) is added, then if C::locationEvent() returns true, then the locationEvent() callback of A, B, and the ViewerDelegate will be called with locationHandled=true.

ViewerDelegateComponent is the class that plugins should extend and implement.

ViewerDelegateComponentWrapper is the class that allows other plugin types to access the ViewerDelegateComponent plugin.

ViewerDelegateComponentPluginBase is the base class that provides the common methods between ViewerDelegateComponent and ViewerDelegateComponentWrapper.

Subclassed by Foundry::Katana::ViewerAPI::ViewerDelegateComponent, Foundry::Katana::ViewerAPI::ViewerDelegateComponentWrapper

Public Functions

ViewerDelegateComponentPluginBase()

Constructor.

virtual ~ViewerDelegateComponentPluginBase()

Destructor.

ViewerDelegateWrapperPtr getViewerDelegate()

Returns the viewer delegate that this component is associated with.

Return
A pointer to the ViewerDelegate.

FnAttribute::GroupAttribute getAttributes(const std::string &locationPath)

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.

Return
The attributes of the location.
Parameters
  • locationPath -

    The location path.

class ViewerDelegateComponent
#include <FnViewerDelegateComponent.h>

The ViewerDelegateComponent class to be extended by plugins.

Inherits from Foundry::Katana::ViewerAPI::ViewerDelegateComponentPluginBase

Subclassed by Foundry::Katana::ViewerUtils::FnBaseLocatorVDC

Public Functions

ViewerDelegateComponent()
virtual ~ViewerDelegateComponent()
virtual void setup() = 0

Initializes the ViewportDelegateComponent’s resources.

virtual void cleanup() = 0

Cleans up the ViewportDelegateComponent’s resources.

virtual bool locationEvent(const ViewerLocationEvent &event, bool locationHandled) = 0

Notification of scene graph location state changes.

Return
true if the other ViewerDelegateComponents added to the ViewerDelegate before this one should receive locationHandled=true, false otherwise.
Parameters
  • event -

    Struct containing location event information (see “FnViewerLocationEvent.h” for details).

  • locationHandled -

    True if an already processed (later added) ViewerDelegateComponent has stated that it is handling this location by returning true. In this case, the ViewerDelegateComponent should not draw its own representation.

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 Component plug-in.

Return
true if the plug-in is processing anything that may result in a change to the Viewer.

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.

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 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 ViewerDelegateComponent.

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 FnAttribute::DoubleAttribute getBounds(const std::string &locationPath)

Gets the bounds of the given location.

Return
The bounds of the location (or an invalid attribute if not found).
Parameters
  • locationPath -

    The location path.

virtual FnAttribute::DoubleAttribute computeExtent(const std::string &locationPath)

Calculates the extent of the given location.

It calculates the extent of the location based on its geometry.

Return
The extent of the location (or an invalid attribute if no extent was computed).
Parameters
  • locationPath -

    The location path.

void setHostHandle(FnViewerDelegateComponentHostHandle m_hostHandle)
FnViewerDelegateComponentHostHandle getHostHandle()

Public Static Functions

static void flush()

Flush plugin Caches.

Allows to discard any cache for this plugin when a Flush Caches event occurs.

static FnViewerDelegateComponentPluginSuite_v2 Foundry::Katana::ViewerAPI::ViewerDelegateComponent::createSuite(FnViewerDelegateComponentPluginHandle(*create)(FnViewerDelegateComponentHostHandle hostHandle))
static FnViewerDelegateComponentPluginHandle newViewerDelegateComponentHandle(ViewerDelegateComponent *viewerDelegateComponent)

Public Static Attributes

unsigned int _apiVersion
const char *_apiName
class ViewerDelegateComponentWrapper
#include <FnViewerDelegateComponent.h>

The ViewerDelegateComponent class accessed by other plugins.

Inherits from Foundry::Katana::ViewerAPI::ViewerDelegateComponentPluginBase

Public Functions

ViewerDelegateComponentWrapper(FnPluginHost *host, FnViewerDelegateComponentHostHandle hostHandle, FnViewerDelegateComponentPluginHandle pluginHandle, FnViewerDelegateComponentPluginSuite_v2 *pluginSuite)
~ViewerDelegateComponentWrapper()
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 ViewerDelegateComponent 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 generic option.

FnAttribute::Attribute getOption(OptionIdGenerator::value_type optionId)

Gets a generic option.

void setOption(const std::string &name, FnAttribute::Attribute attr)

Sets a generic option.

FnAttribute::Attribute getOption(const std::string &name)

Gets a generic option.

FnAttribute::DoubleAttribute getBounds(const std::string &location)

Gets the bounds of the given location.

FnAttribute::DoubleAttribute computeExtent(const std::string &location)

Calculates the extent of the given location.