Katana Plug-in APIs 0.1
Public Member Functions | Protected Member Functions

Foundry::Katana::ViewerUtils::GLTransformManipulator Class Reference

A base class for a GL based Transform Manipulator. More...

#include <FnGLTransformManipulator.h>

Inheritance diagram for Foundry::Katana::ViewerUtils::GLTransformManipulator:
Foundry::Katana::ViewerUtils::GLManipulator Foundry::Katana::ViewerAPI::Manipulator Foundry::Katana::ViewerAPI::ManipulatorPluginBase GLCoiManipulator GLRotateManipulator GLScaleManipulator GLTranslateManipulator

List of all members.

Public Member Functions

 GLTransformManipulator ()
 Constructor.
virtual ~GLTransformManipulator ()
 Destructor.
IMATH_NAMESPACE::Eulerd::Order getRotationOrder (const std::string &locationPath)
std::string getLastLocationPath ()
 Gets the location path where the manipulator is placed.
virtual void setOption (Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type optionId, FnAttribute::Attribute attr)
 Sets the option for the Manipulator.
FnAttribute::Attribute getOption (Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type optionId) override
 Gets the value of a generic option.
double getFixedSizeScale (IMATH_NAMESPACE::V3d point)
 Calculates a scale that will compensate for the perspective.
IMATH_NAMESPACE::M44d getInitialTranslateXformFromLocation (const std::string &locationPath)
 These functions get the specific transform for the given location.
IMATH_NAMESPACE::V3d getInitialPositionFromLocation (const std::string &locationPath)
IMATH_NAMESPACE::V3d getInitialDirectionFromLocation (const std::string &locationPath)
IMATH_NAMESPACE::V3d getInitialCoiFromLocation (const std::string &locationPath)
IMATH_NAMESPACE::V3d getInitialShadowFallPositionFromLocation (const std::string &locationPath)
IMATH_NAMESPACE::M44d getInitialOrientationXform (const std::string &locationPath, Orientation orientation)
IMATH_NAMESPACE::M44d getOrientationXform (const std::string &locationPath, Orientation orientation)
void applyRotationAroundCoiToAllLocations (double angle, const IMATH_NAMESPACE::V3d &axis, Orientation orientation, bool isFinal)
void applyCoiTranslationToAllLocations (const IMATH_NAMESPACE::V3d &delta, double distance, Orientation orientation, bool isFinal)
void applyTranslationAroundCoiToAllLocations (bool isFinal)
void applyOrientationToLocation (const std::string &locationPath, const IMATH_NAMESPACE::M44d &rotateMatrix, bool isFinal)
void setLocationOrientation (const std::string &locationPath, const IMATH_NAMESPACE::M44d &rotateMatrix, bool isFinal)
void setInteractiveRotation (const std::string &locationPath, const IMATH_NAMESPACE::M44d &rotateMatrix, bool isFinal)
void applyTranslationToLocation (const std::string &locationPath, const IMATH_NAMESPACE::V3d &deltaWorldSpace, bool isFinal)
unsigned int getSnappingHitAreaSize () const

Protected Member Functions

ViewerDelegateWrapperPtr getViewerDelegate ()
 Utility function: Get the ViewerDelegate.

Detailed Description

A base class for a GL based Transform Manipulator.

This is a base class implementation of GLManipulator for transforms (example: Rotate, Translate and Scale manipulators).

A transform manipulator can be applied to several manipulated locations.

It calculates and caches a transformation for the manipulator as a whole (see Manipulator::setXform() and Manipulator::getXform()).

The manipulator's origin is placed at the pivot of the last of these locations (see getLastLocationPath()) and it is scaled in order to maintain its relative size to the Viewport, no matter what projection and view are used to render it. The pivot can be the location's origin (if alwaysAtLocationOrigin constructor argument is set to true) or it can be defined by the transform component being manipulated. For example, in a location in which the transform order dictates that the translation is applied before the rotation, the pivot will be off the location's origin, since a rotation will imply an orbit around this pivot, rather than around the object's origin.

The orientation (rotation) of the manipulator is left to each of its Manipulator Handle to decide, as each one of them can specify a different orientation (see GLTransformManipulatorHandle).

The calculation and caching of the manipulator's transform happens in draw() and pickerDraw() because the transform of the location where the manipulator is positioned can change when it is cooked, hence the need to poll for it when drawing.

See GLTransformManipulatorHandle for information on how a local manipulation can be applied to the different locations.

The handles of a GLTransformManipulator must extend the base class GLTransformManipulatorHandle.


Member Function Documentation

void Foundry::Katana::ViewerUtils::GLTransformManipulator::applyCoiTranslationToAllLocations ( const IMATH_NAMESPACE::V3d &  delta,
double  distance,
Orientation  orientation,
bool  isFinal 
)

Applies a "Translate COI" action to all locations.

It calculates the new center of interests' positions give the delta, and adjusts the objects' rotations and center of interest distances, so that the objects are oriented towards their respective center of interest.

void Foundry::Katana::ViewerUtils::GLTransformManipulator::applyOrientationToLocation ( const std::string &  locationPath,
const IMATH_NAMESPACE::M44d &  rotateMatrix,
bool  isFinal 
)

Applies a rotation matrix to the location to change its look-at direction.

void Foundry::Katana::ViewerUtils::GLTransformManipulator::applyRotationAroundCoiToAllLocations ( double  angle,
const IMATH_NAMESPACE::V3d &  axis,
Orientation  orientation,
bool  isFinal 
)

Rotates all the selected locations around their center of interest given the rotation angle and the axis.

void Foundry::Katana::ViewerUtils::GLTransformManipulator::applyTranslationAroundCoiToAllLocations ( bool  isFinal)

Applies a "Translate around COI" action to all locations.

This function assumes that the objects have already been translated to their final position. Then, it calculates the new center of interests' positions, and adjusts the objects' rotations and center of interest distances, so that the objects are oriented towards their respective center of interest.

void Foundry::Katana::ViewerUtils::GLTransformManipulator::applyTranslationToLocation ( const std::string &  locationPath,
const IMATH_NAMESPACE::V3d &  deltaWorldSpace,
bool  isFinal 
)

Applies a translation matrix to the location.

double Foundry::Katana::ViewerUtils::GLTransformManipulator::getFixedSizeScale ( IMATH_NAMESPACE::V3d  point)

Calculates a scale that will compensate for the perspective.

This guarantees that the size of an object at the given point will be constant from any camera position, fov, etc. by compensating the effect of the projection and view matrices.

IMATH_NAMESPACE::V3d Foundry::Katana::ViewerUtils::GLTransformManipulator::getInitialCoiFromLocation ( const std::string &  locationPath)

Gets the initial center of interest in world space of the given location. The value is cached on startDrag().

IMATH_NAMESPACE::V3d Foundry::Katana::ViewerUtils::GLTransformManipulator::getInitialDirectionFromLocation ( const std::string &  locationPath)

Gets the initial direction in world space of the given location. The value is cached on startDrag().

IMATH_NAMESPACE::M44d Foundry::Katana::ViewerUtils::GLTransformManipulator::getInitialOrientationXform ( const std::string &  locationPath,
Orientation  orientation 
)

Gets the orientation xform in world space of the given location. If the given orientation is WORLD, it uses the initial world xform. The value is cached on startDrag().

IMATH_NAMESPACE::V3d Foundry::Katana::ViewerUtils::GLTransformManipulator::getInitialPositionFromLocation ( const std::string &  locationPath)

Gets the initial position in world space of the given location. The value is cached on startDrag().

IMATH_NAMESPACE::V3d Foundry::Katana::ViewerUtils::GLTransformManipulator::getInitialShadowFallPositionFromLocation ( const std::string &  locationPath)

Gets the initial shadow fall position in world space of the given location. The value is cached on startDrag().

IMATH_NAMESPACE::M44d Foundry::Katana::ViewerUtils::GLTransformManipulator::getInitialTranslateXformFromLocation ( const std::string &  locationPath)

These functions get the specific transform for the given location.

The initial values are stored on startDrag(), whereas the current values come directly from the viewer delegate.

std::string Foundry::Katana::ViewerUtils::GLTransformManipulator::getLastLocationPath ( )

Gets the location path where the manipulator is placed.

This is the last location returned by Manipulator::getLocationPaths(), or empty string if Manipulator::getLocationPaths returns an empty vector.

FnAttribute::Attribute Foundry::Katana::ViewerUtils::GLTransformManipulator::getOption ( Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type  optionId) [override, virtual]

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.

Parameters:
optionIdThe ID of the option created from OptionIdGenerator or manually defined by users.
Returns:
Attribute with the value of the option.

Reimplemented from Foundry::Katana::ViewerAPI::Manipulator.

IMATH_NAMESPACE::M44d Foundry::Katana::ViewerUtils::GLTransformManipulator::getOrientationXform ( const std::string &  locationPath,
Orientation  orientation 
)

Gets the orientation xform in world space of the given location. If the given orientation is WORLD, it uses the identity matrix.

IMATH_NAMESPACE::Eulerd::Order Foundry::Katana::ViewerUtils::GLTransformManipulator::getRotationOrder ( const std::string &  locationPath)

Returns the order of the axis in which the rotation is applied. This is defined by the order of the xform.interactive.rotate? attributes in the passed location.

unsigned int Foundry::Katana::ViewerUtils::GLTransformManipulator::getSnappingHitAreaSize ( ) const [inline]

Getter for m_snapingHitAreaSize;

void Foundry::Katana::ViewerUtils::GLTransformManipulator::setInteractiveRotation ( const std::string &  locationPath,
const IMATH_NAMESPACE::M44d &  rotateMatrix,
bool  isFinal 
)

Sets a location's interactive rotation to the given rotation.

void Foundry::Katana::ViewerUtils::GLTransformManipulator::setLocationOrientation ( const std::string &  locationPath,
const IMATH_NAMESPACE::M44d &  rotateMatrix,
bool  isFinal 
)

Sets a location's orientation to the given rotation.

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

Sets the option for the Manipulator.

This has been overwritten to capture and store manipulator preferences such as scale.

Reimplemented from Foundry::Katana::ViewerAPI::Manipulator.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator