Locators

group FnBaseLocator

Typedefs

typedef LocatorCreateCallback

A callback function pointer type for FnBaseLocator::create() with the following signature: FnBaseLocator* (*LocatorCreateCallback)().

typedef LocatorMatchesCallback

A callback function pointer type for FnBaseLocator::matches() with the following signature: bool (*LocatorMatchesCallback)(const Foundry::Katana::ViewerAPI::ViewerLocationEvent& event).

typedef LocatorGetBoundsCallback

A callback function pointer type for FnBaseLocator::getBounds() with the following signature: FnAttribute::DoubleAttribute (*LocatorGetBoundsCallback)(const Foundry::Katana::ViewerAPI::ViewerLocationEvent& event).

typedef LocatorComputeExtentCallback

A callback function pointer type for FnBaseLocator::computeExtent() with the following signature: FnAttribute::DoubleAttribute (*LocatorComputeExtentCallback)(const Foundry::Katana::ViewerAPI::ViewerLocationEvent& event).

typedef OverridesBaseGeometryCallback

A callback function pointer type for FnBaseLocator::overridesBaseGeometry() with the following signature: bool (*OverridesBaseGeometryCallback)(const Foundry::Katana::ViewerAPI::ViewerLocationEvent& event).

class FnBaseLocator
#include <FnBaseLocator.h>

Base class implementing a locator plug-in that is used to customize how an object that’s represented by a scene graph location is drawn. Each locator plug-in will be instantiated once per viewport, and is used to draw the geometry for multiple matching locations.

Subclassed by ExampleSpotlightLocator

Public Types

typedef std::shared_ptr<FnBaseLocator> Ptr

Shared pointer type.

typedef std::weak_ptr<FnBaseLocator> WeakPtr

Weak pointer type.

Public Functions

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

Called after the object has been created to initialize resources (called with a valid OpenGL context).

virtual void cleanup() = 0

Allows the object to clean up resources (called with a valid OpenGL context).

virtual void locationSetup(const std::string &locationPath, bool isPicking)

Called immediately before a location is drawn.

virtual void locationCleanup(const std::string &locationPath, bool isPicking)

Called immediately after a location is drawn.

virtual void draw(const std::string &locationPath) = 0

Draws the object that’s represented by the scene graph location with the given path using the given shader program.

virtual void pickerDraw(const std::string &locationPath) = 0

Draws the object that’s represented by the scene graph location with the given path using the given shader program as part of a picking pass.

virtual void onFrameBegin(bool isPicking)

Called at the beginning of each frame to allow batching of draws.

virtual void onFrameEnd(bool isPicking)

Called at the end of each frame to allow batching of draws.

FnBaseLocatorVDC *getViewerDelegateComponent() const

Returns the ViewerDelegateComponent for querying scene data.

void setViewerDelegateComponent(FnBaseLocatorVDC *vdc)

Sets the ViewerDelegateComponent for querying scene data.

FnBaseLocatorViewportLayer *getViewportLayer() const

Returns the ViewportLayer that owns this object.

void setViewportLayer(FnBaseLocatorViewportLayer *vdc)

Sets the ViewportLayer that owns this object.

FnAttribute::Attribute getAttribute(const std::string &locationPath, const std::string &attrName = "")

Returns the named attribute of the scene graph location with the given path, or all attributes if an attribute name is not specified.

bool isLocationSelected(const std::string &locationPath)

Returns true if the scene graph location with the given path is currently selected.

GLShaderProgram *getDefaultShaderProgram() const

Returns the default shading shader program.

void setDefaultShaderProgram(GLShaderProgram *shaderProgram)

Sets the default shading shader program.

class FnBaseLocatorVDC
#include <FnBaseLocator.h>

A base implementation of a ViewerDelegateComponent which tracks/maintains a tree of SceneNode objects and locator plug-ins associated with each location represented by a SceneNode.

Inherits from Foundry::Katana::ViewerAPI::ViewerDelegateComponent

Subclassed by ExampleSpotlightLocatorVDC

Public Functions

FnBaseLocatorVDC()
virtual ~FnBaseLocatorVDC()
virtual void setup()

Initializes this ViewerDelegateComponent.

virtual void cleanup()

Cleans up this ViewerDelegateComponent.

virtual bool locationEvent(const Foundry::Katana::ViewerAPI::ViewerLocationEvent &event, bool locationHandled)

Handles viewer location events and maintains the SceneNode tree.

virtual void locationsSelected(const std::vector<std::string> &locationPaths)

Tracks the selection state of the scene graph.

virtual void *getPrivateData(void *inputData)

Returns private data.

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

Gets the bounds of the given location.

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

Computes the extent of the given location.

void removeLocation(const std::string &locationPath)

Handles the removal of scene nodes from the selected path.

virtual SceneNode::Ptr createSceneNode(const FnKat::ViewerAPI::ViewerLocationEvent &event)

Creates a new SceneNode instance based on the given viewer location event. Can be overridden if a custom SceneNode type is desired.

void dirtyAllViewports()

Marks all viewports attached to the ViewerDelegate as dirty.

SceneNode::Ptr getRootSceneNode() const

Returns the top-level SceneNode.

std::weak_ptr<LocatorLocationsMap> getLocatorLocations()

Returns a map of locator plug-ins and the scene graph locations associated with them.

bool isLocationSelected(const std::string &locationPath)

Returns true if the scene graph location with the given path is currently selected.

bool isLocationHidden(const std::string &locationPath)

Returns true if the passed location is hidden.

Public Static Functions

static void flush()

Flush plugin Caches.

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

static FnKat::ViewerAPI::ViewerDelegateComponent *create()
static void registerLocator(const std::string &name, LocatorCreateCallback create, LocatorMatchesCallback matches, OverridesBaseGeometryCallback overridesBaseGeometry, LocatorGetBoundsCallback getBounds, LocatorComputeExtentCallback computeExtent)

Registers a locator class and its callbacks with this VDC.

static LocatorContainerVector getRegisteredLocators()

Returns the list of registered locator plug-in classes.

class FnBaseLocatorViewportLayer
#include <FnBaseLocator.h>

Class implementing a ViewportLayer that owns instances of locator plug-ins and is responsible for drawing them.

Inherits from Foundry::Katana::ViewerAPI::ViewportLayer

Subclassed by ExampleSpotlightLocatorViewportLayer

Public Functions

FnBaseLocatorViewportLayer()
virtual ~FnBaseLocatorViewportLayer()
virtual void freeze()

Freezes the ViewportLayer when the viewport widget is hidden.

Allows the ViewportLayer to freeze its activities when the viewport is not visible. This allows the ViewerDelegate to stop any kind of unecessary processing that might happen during that time.

virtual void thaw()

Thaws the ViewportLayer when the viewport widget is shown.

Allows the ViewportLayer to restart its activities when the viewport becomes visible. This restarts the activities paused by freeze().

This function is exposed in the Viewport Python class.

virtual void setup()

Initializes the GL components of the ViewportLayer.

virtual void cleanup()

Cleans up the ViewportLayer resources.

virtual void draw()

Draws the viewport layer’s contents.

virtual void pickerDraw(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const Foundry::Katana::ViewerAPI::PickedAttrsMap &ignoreAttrs)

Draws the viewport layer’s contents for a selection picker pass.

virtual bool usesPickingOnHover()

Returns true if the viewport layer picks objects when the pointer is hovering over them.

virtual void resize(unsigned int width, unsigned int height)

Processes viewport resizing.

virtual void setOption(Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type optionId, FnAttribute::Attribute attr)

Sets a generic option.

virtual void initializeLocators()

Creates all needed local instances of locator plug-ins.

virtual void drawLocators(bool isPicking, std::set<std::string> &ignoreLocations)

Draws locator plug-ins for their associated locations, optionally ignoring locations with the given scene graph location paths.

Public Static Functions

static Foundry::Katana::ViewerAPI::ViewportLayer *create()