Manipulator.Manipulator Class Reference


Detailed Description

A Manipulator defines a control that has the ability to perform a set of operations on a given set of targets.

It consists of a set of handles, each of which can perform a specific operation. Typically the operations are just specific variations (ex. constraints) of a general operation (ex. translate, rotate, etc.).

The handles should be created from a geometry file by using the createGeometryFromFile() method, and then overriding the initialize() method to create the handles from the nodes.

Call startInteraction() to signal the start of the manipulation of the targets. The given handle becomes the active handle, and its interaction callback will be called for the remainder of the manipulation. The given point defines the starting point of the manipulation.

Call update() with the starting and ending point over which the manipulation should take place. The active handle's interaction callback will be called with these points.

Call stopInteraction() to signal the end of the manipulation. The active handle's stop interaction callback will be called, and then the handle is made inactive.

startInteraction(), update(), and stopInteraction() should be called in this order. isInteractionInProgress() will return True in between calls to startInteraction() and stopInteraction().

update() can be called at any time, but typically it should be called per frame (or as often as it makes sense with regards to the targets).

#include <class_manipulator_1_1_manipulator.h>

Inheritance diagram for Manipulator.Manipulator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  __init__ ()
  setName ()
  getName ()
  cleanup ()
  Clean-up all our references to complex objects.
  enable ()
  Enables/disables this manipulator.
  isEnabled ()
  Returns True if the manipulator is enabled; False otherwise.
  getDisplay ()
  clearIntersector ()
  getDrawRoot ()
  setDrawRoot ()
  Sets the draw root onto which the manipulator geometry will be attached.
  getManipulatorRoot ()
  Returns the root of the subgraph representing the manipulator geometry; None if this manipulator has no geometry.
  getGeometryRoot ()
  createGeometryFromFile ()
  Creates the manipulator geometry using the data of the given file and returns the root of the subgraph.
  onNodeBoundingBoxValid ()
  NodeBoundingBoxListener callback set on the geometry root.
  setTargetIds ()
  Sets the list or tuple of ids whose corresponding model nodes become the targets to be manipulated.
  setLocatorTargetIds ()
  Sets the list or tuple of locators ids and corresponding model ids whose corresponding nodes become the targets to be manipulated.
  getTargetIds ()
  Returns the tuple of ids of the model nodes that are to be manipulated.
  getLocatorTargetIds ()
  Returns the tuple of locator ids of the nodes that are to be manipulated.
  areLocatorsSelected ()
  getHandles ()
  Returns the handles that define this manipulator.
  getActiveHandle ()
  Returns the active handle, or None if no interaction is in progress.
  getHandle ()
  Given xy coordinates in screen space, returns the hit handle and its the worldspace intersection point.
  setGeometryScaleFactor ()
  Sets a value greater than zero as the scale factor.
  getGeometryScaleFactor ()
  Returns the current scale factor.
  doResize ()
  The policy of resizing manipulators are diffrent in each subclass.
  resize ()
  Resizes the manipulator to the given pixel height multiplied by the current scale factor.
  getXY ()
  Returns the normalized xy screen coordinates of the given event.
  getWindowPosition ()
  Converts from normalized xy screen coordinates to pixel coordinates.
  getViewVector ()
  Returns the current view vector.
  getEyePosition ()
  Returns the worldspace eye position.
  getViewPlaneIntersection ()
  Given xy coordinates in screen space, returns the corresponding worldspace intersection point on the view plane intersecting the current look at point.
  isVisibleOnScreen ()
  Returns true if a given manipulator is visible on the screen.
  createMaterial ()
  Creates and returns a material of type 'Manipulator' with the given color.
  getStartPoint ()
  getEndPoint ()
  startInteraction ()
  Override this in the derived class to perform operations associated with starting an interaction (such as the recording of undo-related data).
  stopInteraction ()
  Override this in the derived class to perform operations associated with stopping an interaction (such as the queuing of undo-related commands).
  isInteractionInProgress ()
  Returns True if an interaction is in progress (ie.
  update ()
  If an interaction is in progress, calls the interaction callback of the current active handle, using the current start point and the given end point.
  initialize ()
  THIS MUST BE OVERRIDDEN IN THE DERIVED CLASS.
  initialized ()
  handleEvent ()
  Override this in the derived class to perform operations such as redrawing per frame.
  refresh ()
  THIS MUST BE OVERRIDDEN IN THE DERIVED CLASS.
  needsRefresh ()
  Override this in the derived class to indicate when a refresh is needed.
  setMode ()
  Override this method in the derived class to enable setting modes.

Member Function Documentation

Manipulator.Manipulator.setName ( )
Manipulator.Manipulator.getName ( )
Manipulator.Manipulator.enable ( )

Enables/disables this manipulator.

The manipulator is made visible and invisible, respectively. If an interaction is in progress, then the interaction is stopped.

Reimplemented in AutoCamManipulator.AutoCamManipulator, MoveManipulator.MoveManipulator, TextureManipulator.CylindricalTextureManipulator, TextureManipulator.TextureManipulator, and TurntableManipulator.TurntableManipulator.

Manipulator.Manipulator.isEnabled ( )

Returns True if the manipulator is enabled; False otherwise.

Manipulator.Manipulator.getDisplay ( )
Manipulator.Manipulator.clearIntersector ( )
Manipulator.Manipulator.getDrawRoot ( )
Manipulator.Manipulator.setDrawRoot ( )

Sets the draw root onto which the manipulator geometry will be attached.

Manipulator.Manipulator.getManipulatorRoot ( )

Returns the root of the subgraph representing the manipulator geometry; None if this manipulator has no geometry.

Manipulator.Manipulator.getGeometryRoot ( )
Manipulator.Manipulator.createGeometryFromFile ( )

Creates the manipulator geometry using the data of the given file and returns the root of the subgraph.

The default structure is: Draw Root | Manipulator root | Import node, aka 'Geometry root'

Manipulator.Manipulator.onNodeBoundingBoxValid ( )

NodeBoundingBoxListener callback set on the geometry root.

When called, this means the geometry has loaded and the manipulator can be initialized.

Reimplemented in TextureManipulator.CylindricalTextureManipulator.

Manipulator.Manipulator.setTargetIds ( )

Sets the list or tuple of ids whose corresponding model nodes become the targets to be manipulated.

Reimplemented in TextureManipulator.TextureManipulator.

Manipulator.Manipulator.setLocatorTargetIds ( )

Sets the list or tuple of locators ids and corresponding model ids whose corresponding nodes become the targets to be manipulated.

Reimplemented in TextureManipulator.TextureManipulator.

Manipulator.Manipulator.getTargetIds ( )

Returns the tuple of ids of the model nodes that are to be manipulated.

Reimplemented in TextureManipulator.TextureManipulator.

Manipulator.Manipulator.getLocatorTargetIds ( )

Returns the tuple of locator ids of the nodes that are to be manipulated.

Manipulator.Manipulator.areLocatorsSelected ( )
Manipulator.Manipulator.getHandles ( )

Returns the handles that define this manipulator.

Manipulator.Manipulator.getActiveHandle ( )

Returns the active handle, or None if no interaction is in progress.

Manipulator.Manipulator.getHandle ( )

Given xy coordinates in screen space, returns the hit handle and its the worldspace intersection point.

Returns ( None, None ) if no handle was hit.

Manipulator.Manipulator.setGeometryScaleFactor ( )

Sets a value greater than zero as the scale factor.

The scale factor should scale the original geometry to fit inside a unit cube; otherwise resize() will not produce accurate results. This should be called once the geometry has been constructed, or loaded from file (ie. in initialize()).

Returns True if set successfully; False otherwise.

Manipulator.Manipulator.getGeometryScaleFactor ( )

Returns the current scale factor.

Manipulator.Manipulator.doResize ( )

The policy of resizing manipulators are diffrent in each subclass.

This function provides the right policy.

Reimplemented in MoveManipulator.MoveManipulator, and TextureManipulator.TextureManipulator.

Manipulator.Manipulator.resize ( )

Resizes the manipulator to the given pixel height multiplied by the current scale factor.

Returns True if the manipulator was resized; False otherwise.

Manipulator.Manipulator.getXY ( )

Returns the normalized xy screen coordinates of the given event.

Manipulator.Manipulator.getWindowPosition ( )

Converts from normalized xy screen coordinates to pixel coordinates.

Manipulator.Manipulator.getViewVector ( )

Returns the current view vector.

Returns None if the display has not been set.

Manipulator.Manipulator.getEyePosition ( )

Returns the worldspace eye position.

Returns None if the display has not been set.

Manipulator.Manipulator.getViewPlaneIntersection ( )

Given xy coordinates in screen space, returns the corresponding worldspace intersection point on the view plane intersecting the current look at point.

Returns None if the display has not been set.

Manipulator.Manipulator.isVisibleOnScreen ( )

Returns true if a given manipulator is visible on the screen.

False, if it is off screen.

Manipulator.Manipulator.createMaterial ( )

Creates and returns a material of type 'Manipulator' with the given color.

Manipulator.Manipulator.getStartPoint ( )
Manipulator.Manipulator.getEndPoint ( )
Manipulator.Manipulator.startInteraction ( )

Override this in the derived class to perform operations associated with starting an interaction (such as the recording of undo-related data).

NOTE: The derived class method must call this base class method.

The handle becomes the active handle, and the point becomes the starting point of the interaction. The active handle's start interaction callback will automatically be called.

Note, isInteractionInProgress() is guaranteed to return True when the start interaction callback is called.

Returns True if the interaction was started successfully; False otherwise.

Manipulator.Manipulator.stopInteraction ( )

Override this in the derived class to perform operations associated with stopping an interaction (such as the queuing of undo-related commands).

NOTE: The derived class method must call this base class method.

The active handle is set to None, and the previous active handle's stop interaction callback will be automatically called.

Note, isInteractionInProgress() is guaranteed to return False when the stop interaction callback is called.

Returns True if the interaction was stopped successfully; False otherwise.

Manipulator.Manipulator.isInteractionInProgress ( )

Returns True if an interaction is in progress (ie.

the manipulator is in between calls to startInteraction() and stopInteraction().

Manipulator.Manipulator.update ( )

If an interaction is in progress, calls the interaction callback of the current active handle, using the current start point and the given end point.

Once processed, the end point becomes the new starting point for the next call to update().

Returns True if the update was done successfully; False otherwise.

Manipulator.Manipulator.initialize ( )

THIS MUST BE OVERRIDDEN IN THE DERIVED CLASS.

This is automatically called when the manipulator geometry has loaded. Perform setup-related operations here, such as the creation of handles from the loaded geometry, and setting of initial states.

Reimplemented in AutoCamManipulator.AutoCamManipulator, MoveManipulator.MoveManipulator, TextureManipulator.TextureManipulator, and TurntableManipulator.TurntableManipulator.

Manipulator.Manipulator.initialized ( )
Manipulator.Manipulator.handleEvent ( )
Manipulator.Manipulator.refresh ( )

THIS MUST BE OVERRIDDEN IN THE DERIVED CLASS.

Call this method whenever the manipulator requires refresh, such as when it needs to be redrawn.

Reimplemented in AutoCamManipulator.AutoCamManipulator, MoveManipulator.MoveManipulator, TextureManipulator.CylindricalTextureManipulator, TextureManipulator.TextureManipulator, and TurntableManipulator.TurntableManipulator.

Manipulator.Manipulator.needsRefresh ( )

Override this in the derived class to indicate when a refresh is needed.

This implementation states that a refresh is needed while the manipulator is enabled, and its geometry has loaded.

Reimplemented in AutoCamManipulator.AutoCamManipulator, MoveManipulator.MoveManipulator, TextureManipulator.TextureManipulator, and TurntableManipulator.TurntableManipulator.

Manipulator.Manipulator.setMode ( )

Override this method in the derived class to enable setting modes.

This implementation returns false to indicate that the mode of the manipulator has not changed / nothing has happened.

Reimplemented in MoveManipulator.MoveManipulator, and TextureManipulator.TextureManipulator.


Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator
Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator Manipulator.Manipulator