Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoCallbackAction Class Reference

Performs a generic traversal of a scene graph or path. More...

#include <Inventor/actions/SoCallbackAction.h>

+ Inheritance diagram for SoCallbackAction:

Public Types

enum  Response {
  CONTINUE ,
  ABORT ,
  PRUNE
}
 Possible responses from a pre or post callback. More...
 
typedef Response SoCallbackActionCB(void *userData, SoCallbackAction *action, const SoNode *node)
 The SoCallbackActionCB typedef is defined within the class, since it needs to refer to the Response enumerated type.
 
- Public Types inherited from SoAction
enum  DistribMode {
  LOCAL_ONLY ,
  CLUSTER_ONLY ,
  ALL
}
 This is used to define the way an action is distributed across a cluster. More...
 
enum  AppliedCode {
  NODE ,
  PATH ,
  PATH_LIST
}
 This enum is used to determine what the action is being applied to. More...
 
enum  PathCode {
  NO_PATH ,
  IN_PATH ,
  BELOW_PATH ,
  OFF_PATH
}
 This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoCallbackAction ()
 The constructor.
 
void addPreCallback (SoType type, SoCallbackActionCB *cb, void *data)
 Adds a callback function to call when a node of the given type is encountered during traversal.
 
void addPostCallback (SoType type, SoCallbackActionCB *cb, void *data)
 Adds a callback function to call when a node of the given type is encountered during traversal.
 
void addPreTailCallback (SoCallbackActionCB *cb, void *data)
 Sets up a callback function to call when the action is applied to a path.
 
void addPostTailCallback (SoCallbackActionCB *cb, void *data)
 Sets up a callback function to call when the action is applied to a path.
 
void addTriangleCallback (SoType type, SoTriangleCB *cb, void *data)
 Routine to add callbacks for generated primitives (triangles) for all shapes of the given type.
 
void addLineSegmentCallback (SoType type, SoLineSegmentCB *cb, void *data)
 Routine to add callbacks for generated primitives (line segments) for all shapes of the given type.
 
void addPointCallback (SoType type, SoPointCB *cb, void *data)
 Routine to add callbacks for generated primitives (points) for all shapes of the given type.
 
float getComplexity () const
 Returns complexity information from the state.
 
SoComplexity::Type getComplexityType () const
 Returns complexity information from the state.
 
int32_t getNumCoordinates () const
 Returns the current coordinates from the state.
 
const SbVec3fgetCoordinate3 (int index) const
 Returns the current coordinates from the state.
 
const SbVec4fgetCoordinate4 (int index) const
 Returns the current coordinates from the state.
 
SoDecimationTypeElement::Type getDecimationType () const
 Returns the current decimation type from the state.
 
float getDecimationPercentage () const
 Returns the current decimation percentage from the state.
 
SoDrawStyle::Style getDrawStyle () const
 Returns the current drawing style information from the state.
 
u_short getLinePattern () const
 Returns the current drawing style information from the state.
 
int getLinePatternScaleFactor () const
 Returns the current drawing style information from the state.
 
float getLineWidth () const
 Returns the current drawing style information from the state.
 
float getPointSize () const
 Returns the current drawing style information from the state.
 
const SbStringgetFontName () const
 Returns the current font information from the state.
 
float getFontSize () const
 Returns the current font information from the state.
 
SoFont::RenderStyle getFontRenderStyle () const
 Returns the current font information from the state.
 
SoLightModel::Model getLightModel () const
 Returns the current lighting model information from the state.
 
const SbVec3fgetLightAttenuation () const
 Returns the current lighting model information from the state.
 
void getMaterial (SbColor &ambient, SbColor &diffuse, SbColor &specular, SbColor &emission, float &shininess, float &transparency, int mtlIndex=0) const
 Returns the current material information from the state.
 
SoMaterialBinding::Binding getMaterialBinding () const
 Returns the current material information from the state.
 
SoGLRenderAction::TransparencyType getTransparencyType () const
 Returns the current Transparency Type information from the state.
 
int32_t getNumNormals () const
 Returns the current normal information from the state.
 
const SbVec3fgetNormal (int index) const
 Returns the current normal information from the state.
 
SoNormalBinding::Binding getNormalBinding () const
 Returns the current normal information from the state.
 
int32_t getNumProfileCoordinates () const
 Returns the current profiles and their coordinates from the state.
 
const SbVec2fgetProfileCoordinate2 (int index) const
 Returns the current profiles and their coordinates from the state.
 
const SbVec3fgetProfileCoordinate3 (int index) const
 Returns the current profiles and their coordinates from the state.
 
const SoNodeListgetProfile () const
 Returns the current profiles and their coordinates from the state.
 
SoShapeHints::VertexOrdering getVertexOrdering () const
 Returns the current shape hints from the state.
 
SoShapeHints::ShapeType getShapeType () const
 Returns the current shape hints from the state.
 
SoShapeHints::FaceType getFaceType () const
 Returns the current shape hints from the state.
 
float getCreaseAngle () const
 Returns the current shape hints from the state.
 
int32_t getNumTextureCoordinates () const
 Returns texture information from the state.
 
const SbVec2fgetTextureCoordinate2 (int index) const
 Returns texture information from the state.
 
const SbVec4fgetTextureCoordinate4 (int index) const
 Returns texture information from the state.
 
SoTextureCoordinateBinding::Binding getTextureCoordinateBinding () const
 Returns texture information from the state.
 
const SbColorgetTextureBlendColor () const
 
const unsigned char * getTextureImage (SbVec2i32 &size, int &numComps) const
 Returns texture information from the state.
 
const SbNamegetTextureFileName () const
 Returns texture information from the state.
 
const SbMatrixgetTextureMatrix () const
 Returns the current texture mapping information from the state.
 
const SoTexture2TransformgetTextureTransformNode () const
 Returns the current texture mapping information from the state.
 
SoTexture::Model getTextureModel () const
 Returns the current texture mapping information from the state.
 
SoTexture::Wrap getTextureWrapS () const
 Returns the current texture mapping information from the state.
 
SoTexture::Wrap getTextureWrapT () const
 Returns the current texture mapping information from the state.
 
const SbMatrixgetModelMatrix () const
 Returns the current modeling transformation from the state.
 
SoUnits::Units getUnits () const
 Returns the current units from the state.
 
float getFocalDistance () const
 Returns the current camera and viewing information from the state.
 
const SbMatrixgetProjectionMatrix () const
 Returns the current camera and viewing information from the state.
 
const SbMatrixgetViewingMatrix () const
 Returns the current camera and viewing information from the state.
 
const SbViewVolumegetViewVolume () const
 Returns the current camera and viewing information from the state.
 
SoPickStyle::Style getPickStyle () const
 Returns the current picking style.
 
int32_t getSwitch () const
 Returns the current switch value.
 
void setCallbackAll (SbBool flag)
 Sets whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node.
 
SbBool isCallbackAll () const
 Returns whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node.
 
Deprecated
SoDEPRECATED const unsigned char * getTextureImage (SbVec2s &size, int &numComps) const
 Returns texture information from the state.
 
- Public Member Functions inherited from SoAction
virtual ~SoAction ()
 Destructor.
 
virtual void apply (SoNode *node)
 Initiates an action on the graph defined by a node.
 
virtual void apply (SoPath *path)
 Initiates an action on the graph defined by a path.
 
virtual void apply (const SoPathList &pathList, SbBool obeysRules=FALSE)
 Initiates an action on the graph defined by a list of paths.
 
virtual void clearApplyResult ()
 When applied, an action may reference nodes or create objects (e.g.
 
virtual void invalidateState ()
 Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.
 
void stopActionInBranch ()
 This function stops the action in the current Scene Graph branch.
 
SbBool getContinueActionInBranchFlag () const
 This function indicates if the action must stop in the current branch.
 
void resetContinueActionInBranchFlag ()
 This function resets the continue action flag.
 
void useAlternateRep (const SbBool enable)
 Tell the action to use alternate representations during traversal when available.
 
SbBool isUsingAlternateRep () const
 Returns TRUE if current action is using alternate representations.
 
void setSceneManager (SoSceneManager *mgr)
 Set the scene manager associated with this action (if any ).
 
SoSceneManagergetSceneManager () const
 Return the SoSceneManager associated with this action.
 
virtual void forwardTraversal (SoNode *node)
 Traverse a node that is not part of the current scenegraph.
 
virtual void forwardTraversal (SoPath *path)
 Traverse a path that is not part of the current scenegraph.
 
DistribMode getDistribMode () const
 Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).
 
AppliedCode getWhatAppliedTo () const
 Returns code indicating what action is being applied to.
 
SoNodegetNodeAppliedTo () const
 Returns the node the action is being applied to.
 
SoPathgetPathAppliedTo () const
 Returns the path the action is being applied to.
 
const SoPathListgetPathListAppliedTo () const
 Returns the path list the action is being applied to.
 
const SoPathListgetOriginalPathListAppliedTo () const
 Returns the original path list the action is being applied to.
 
SbBool isLastPathListAppliedTo () const
 Returns TRUE if the current list is the last one from the original.
 
PathCode getPathCode (int &numIndices, const int *&indices)
 Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to.
 
PathCode getPathCodeMI (int &numIndices, const int *&indices, const int *&instanceIndices)
 Extender API: available to programmers who wish to extend the toolkit
 
void traverse (SoNode *node)
 Does traversal of a graph rooted by a node.
 
SbBool hasTerminated () const
 Returns TRUE if the traversal has reached a termination condition.
 
const SoPathgetCurPath ()
 Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.
 
SoStategetState () const
 Gets the state from the action.
 
virtual void setUpState ()
 Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.
 
void setPipeId (int id)
 Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.
 
int getPipeId () const
 Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.
 
bool isBeingApplied ()
 Returns TRUE if this action is currently being applied.
 
virtual bool preDelayedTraversal ()
 Method called by SoMultiPassManager before delayed pass traversals.
 
virtual void postDelayedTraversal ()
 Method called by SoMultiPassManager after delayed pass traversals.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoAction
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static void nullAction (SoAction *, SoNode *)
 Null action method that can be stored in lookup table when desired.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

Performs a generic traversal of a scene graph or path.

Performs a generic traversal of a scene graph or path. In many cases a "custom" action can be implemented using SoCallbackAction with much less complexity than deriving a completely new action class.

The application can specify callback methods that will be called when the action traverses a node of the specified class or a derived class. For example a callback for the SoCone class will only be called for SoCone nodes, but a callback for the SoShape class will be called for any type of shape node.

This makes SoCallbackAction flexible and very convenient for "visiting" a set of nodes, especially when you only need the node itself and not a path to the node. For example, to count all the shapes in the scene graph. It is possible to get the path to the node being visited (see getCurPath() ), but SoSearchAction may be more convenient for getting a path to one or a small number of nodes.

In addition, callback methods can be registered to collect the primitives (trangles, lines and points) generated by shapes in the scene graph. These primitives are the actual geometry if the shape contains triangles, lines or points, else they represent or approximate the actual geometry. NOTE: Most, but not all, shapes can generate primitives. See below for a complete list. Triangle primitives are used for all surfaces (such as cubes, face sets, or 3D text), line segment primitives are used for line shapes, and point primitives are used for point shapes. Note that the type of primitives generated for a shape is the same, regardless of drawing style or other properties.

Most of the methods on this class access information from the traversal state. They should be called only by callback functions that are invoked during traversal, so there is a valid state to work with.

EXAMPLE

SEE ALSO

SoCallback, SoEventCallback, SoShape

Definition at line 297 of file SoCallbackAction.h.

Member Typedef Documentation

◆ SoCallbackActionCB

typedef Response SoCallbackAction::SoCallbackActionCB(void *userData, SoCallbackAction *action, const SoNode *node)

The SoCallbackActionCB typedef is defined within the class, since it needs to refer to the Response enumerated type.

The first argument is the data pointer that the user supplied when the callback was registered. The second argument is the action, from which the state can be extracted. The third argument is the node that the callback is called from.

Definition at line 327 of file SoCallbackAction.h.

Member Enumeration Documentation

◆ Response

Possible responses from a pre or post callback.

Enumerator
CONTINUE 

Continue traversal as if nothing happened.

ABORT 

Abort traversal.

PRUNE 

Do not traverse node's children, but continue traversal.

Definition at line 304 of file SoCallbackAction.h.

Constructor & Destructor Documentation

◆ SoCallbackAction()

SoCallbackAction::SoCallbackAction ( )

The constructor.

Member Function Documentation

◆ addLineSegmentCallback()

void SoCallbackAction::addLineSegmentCallback ( SoType  type,
SoLineSegmentCB cb,
void *  data 
)

Routine to add callbacks for generated primitives (line segments) for all shapes of the given type.

The callback function will be called for each line segment generated for all shapes of or derived from that type.

◆ addPointCallback()

void SoCallbackAction::addPointCallback ( SoType  type,
SoPointCB cb,
void *  data 
)

Routine to add callbacks for generated primitives (points) for all shapes of the given type.

The callback function will be called for each point generated for all shapes of or derived from that type.

◆ addPostCallback()

void SoCallbackAction::addPostCallback ( SoType  type,
SoCallbackActionCB cb,
void *  data 
)

Adds a callback function to call when a node of the given type is encountered during traversal.

The PreCallback is called just before the node is traversed, and the PostCallback is called just after. The value returned by a callback function indicates whether the action should continue with the traversal.

◆ addPostTailCallback()

void SoCallbackAction::addPostTailCallback ( SoCallbackActionCB cb,
void *  data 
)

Sets up a callback function to call when the action is applied to a path.

This function is called just after the node at the tail of the path is traversed.

◆ addPreCallback()

void SoCallbackAction::addPreCallback ( SoType  type,
SoCallbackActionCB cb,
void *  data 
)

Adds a callback function to call when a node of the given type is encountered during traversal.

The PreCallback is called just before the node is traversed, and the PostCallback is called just after. The value returned by a callback function indicates whether the action should continue with the traversal.

◆ addPreTailCallback()

void SoCallbackAction::addPreTailCallback ( SoCallbackActionCB cb,
void *  data 
)

Sets up a callback function to call when the action is applied to a path.

This function is called just before the node at the tail of the path is traversed.

◆ addTriangleCallback()

void SoCallbackAction::addTriangleCallback ( SoType  type,
SoTriangleCB cb,
void *  data 
)

Routine to add callbacks for generated primitives (triangles) for all shapes of the given type.

The callback function will be called for each triangle generated for all shapes of or derived from that type.

◆ getClassTypeId()

static SoType SoCallbackAction::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getComplexity()

float SoCallbackAction::getComplexity ( ) const

Returns complexity information from the state.

◆ getComplexityType()

SoComplexity::Type SoCallbackAction::getComplexityType ( ) const

Returns complexity information from the state.

◆ getCoordinate3()

const SbVec3f & SoCallbackAction::getCoordinate3 ( int  index) const

Returns the current coordinates from the state.

◆ getCoordinate4()

const SbVec4f & SoCallbackAction::getCoordinate4 ( int  index) const

Returns the current coordinates from the state.

◆ getCreaseAngle()

float SoCallbackAction::getCreaseAngle ( ) const

Returns the current shape hints from the state.

◆ getDecimationPercentage()

float SoCallbackAction::getDecimationPercentage ( ) const

Returns the current decimation percentage from the state.

◆ getDecimationType()

SoDecimationTypeElement::Type SoCallbackAction::getDecimationType ( ) const

Returns the current decimation type from the state.

◆ getDrawStyle()

SoDrawStyle::Style SoCallbackAction::getDrawStyle ( ) const

Returns the current drawing style information from the state.

◆ getFaceType()

SoShapeHints::FaceType SoCallbackAction::getFaceType ( ) const

Returns the current shape hints from the state.

◆ getFocalDistance()

float SoCallbackAction::getFocalDistance ( ) const

Returns the current camera and viewing information from the state.

◆ getFontName()

const SbString & SoCallbackAction::getFontName ( ) const

Returns the current font information from the state.

◆ getFontRenderStyle()

SoFont::RenderStyle SoCallbackAction::getFontRenderStyle ( ) const

Returns the current font information from the state.

◆ getFontSize()

float SoCallbackAction::getFontSize ( ) const

Returns the current font information from the state.

◆ getLightAttenuation()

const SbVec3f & SoCallbackAction::getLightAttenuation ( ) const

Returns the current lighting model information from the state.

◆ getLightModel()

SoLightModel::Model SoCallbackAction::getLightModel ( ) const

Returns the current lighting model information from the state.

◆ getLinePattern()

u_short SoCallbackAction::getLinePattern ( ) const

Returns the current drawing style information from the state.

◆ getLinePatternScaleFactor()

int SoCallbackAction::getLinePatternScaleFactor ( ) const

Returns the current drawing style information from the state.

◆ getLineWidth()

float SoCallbackAction::getLineWidth ( ) const

Returns the current drawing style information from the state.

◆ getMaterial()

void SoCallbackAction::getMaterial ( SbColor ambient,
SbColor diffuse,
SbColor specular,
SbColor emission,
float &  shininess,
float &  transparency,
int  mtlIndex = 0 
) const

Returns the current material information from the state.

Providing a mtlIndex will return the material defined for that index.

◆ getMaterialBinding()

SoMaterialBinding::Binding SoCallbackAction::getMaterialBinding ( ) const

Returns the current material information from the state.

◆ getModelMatrix()

const SbMatrix & SoCallbackAction::getModelMatrix ( ) const

Returns the current modeling transformation from the state.

◆ getNormal()

const SbVec3f & SoCallbackAction::getNormal ( int  index) const

Returns the current normal information from the state.

◆ getNormalBinding()

SoNormalBinding::Binding SoCallbackAction::getNormalBinding ( ) const

Returns the current normal information from the state.

◆ getNumCoordinates()

int32_t SoCallbackAction::getNumCoordinates ( ) const

Returns the current coordinates from the state.

◆ getNumNormals()

int32_t SoCallbackAction::getNumNormals ( ) const

Returns the current normal information from the state.

◆ getNumProfileCoordinates()

int32_t SoCallbackAction::getNumProfileCoordinates ( ) const

Returns the current profiles and their coordinates from the state.

◆ getNumTextureCoordinates()

int32_t SoCallbackAction::getNumTextureCoordinates ( ) const

Returns texture information from the state.

getNumTextureCoordinates() returns 0 if texture coordinates are generated by a function.

◆ getPickStyle()

SoPickStyle::Style SoCallbackAction::getPickStyle ( ) const

Returns the current picking style.

◆ getPointSize()

float SoCallbackAction::getPointSize ( ) const

Returns the current drawing style information from the state.

◆ getProfile()

const SoNodeList & SoCallbackAction::getProfile ( ) const

Returns the current profiles and their coordinates from the state.

◆ getProfileCoordinate2()

const SbVec2f & SoCallbackAction::getProfileCoordinate2 ( int  index) const

Returns the current profiles and their coordinates from the state.

◆ getProfileCoordinate3()

const SbVec3f & SoCallbackAction::getProfileCoordinate3 ( int  index) const

Returns the current profiles and their coordinates from the state.

◆ getProjectionMatrix()

const SbMatrix & SoCallbackAction::getProjectionMatrix ( ) const

Returns the current camera and viewing information from the state.

◆ getShapeType()

SoShapeHints::ShapeType SoCallbackAction::getShapeType ( ) const

Returns the current shape hints from the state.

◆ getSwitch()

int32_t SoCallbackAction::getSwitch ( ) const

Returns the current switch value.

◆ getTextureBlendColor()

const SbColor & SoCallbackAction::getTextureBlendColor ( ) const

◆ getTextureCoordinate2()

const SbVec2f & SoCallbackAction::getTextureCoordinate2 ( int  index) const

Returns texture information from the state.

◆ getTextureCoordinate4()

const SbVec4f & SoCallbackAction::getTextureCoordinate4 ( int  index) const

Returns texture information from the state.

◆ getTextureCoordinateBinding()

SoTextureCoordinateBinding::Binding SoCallbackAction::getTextureCoordinateBinding ( ) const

Returns texture information from the state.

◆ getTextureFileName()

const SbName & SoCallbackAction::getTextureFileName ( ) const

Returns texture information from the state.

◆ getTextureImage() [1/2]

const unsigned char * SoCallbackAction::getTextureImage ( SbVec2i32 size,
int &  numComps 
) const

Returns texture information from the state.

getTextureImage() returns NULL if no texture is enabled.

◆ getTextureImage() [2/2]

SoDEPRECATED const unsigned char * SoCallbackAction::getTextureImage ( SbVec2s size,
int &  numComps 
) const

Returns texture information from the state.

getTextureImage() returns NULL if no texture is enabled.

◆ getTextureMatrix()

const SbMatrix & SoCallbackAction::getTextureMatrix ( ) const

Returns the current texture mapping information from the state.

◆ getTextureModel()

SoTexture::Model SoCallbackAction::getTextureModel ( ) const

Returns the current texture mapping information from the state.

◆ getTextureTransformNode()

const SoTexture2Transform * SoCallbackAction::getTextureTransformNode ( ) const

Returns the current texture mapping information from the state.

◆ getTextureWrapS()

SoTexture::Wrap SoCallbackAction::getTextureWrapS ( ) const

Returns the current texture mapping information from the state.

◆ getTextureWrapT()

SoTexture::Wrap SoCallbackAction::getTextureWrapT ( ) const

Returns the current texture mapping information from the state.

◆ getTransparencyType()

SoGLRenderAction::TransparencyType SoCallbackAction::getTransparencyType ( ) const

Returns the current Transparency Type information from the state.

◆ getTypeId()

virtual SoType SoCallbackAction::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Implements SoTypedObject.

Reimplemented in SoToPDFAction, SoToU3DAction, and SoSTLWriteAction.

◆ getUnits()

SoUnits::Units SoCallbackAction::getUnits ( ) const

Returns the current units from the state.

◆ getVertexOrdering()

SoShapeHints::VertexOrdering SoCallbackAction::getVertexOrdering ( ) const

Returns the current shape hints from the state.

◆ getViewingMatrix()

const SbMatrix & SoCallbackAction::getViewingMatrix ( ) const

Returns the current camera and viewing information from the state.

◆ getViewVolume()

const SbViewVolume & SoCallbackAction::getViewVolume ( ) const

Returns the current camera and viewing information from the state.

◆ isCallbackAll()

SbBool SoCallbackAction::isCallbackAll ( ) const
inline

Returns whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node.

Definition at line 702 of file SoCallbackAction.h.

◆ setCallbackAll()

void SoCallbackAction::setCallbackAll ( SbBool  flag)
inline

Sets whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node.

Default is FALSE.

Definition at line 696 of file SoCallbackAction.h.


The documentation for this class was generated from the following file: