Click or drag to resize
SoCallbackAction Class

Performs a generic traversal of a scene graph or path.

Inheritance Hierarchy

Namespace: OIV.Inventor.Actions
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 9.9.12.0 (9.9.12.0)
Syntax
public class SoCallbackAction : SoAction

The SoCallbackAction type exposes the following members.

Constructors
  NameDescription
Public methodSoCallbackAction

The constructor.

Top
Methods
  NameDescription
Public methodAddLineSegmentCallback(Type, SoCallbackActionLineSegmentCB)

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

Public methodAddLineSegmentCallback(Type, SoCallbackActionLineSegmentUserDataCB, Object) Obsolete.
Routine to add delegates for generated primitives (line segments) for all shapes of the given type. The delegate will be called for each line segment generated for all shapes of or derived from that type.
Public methodAddPointCallback(Type, SoCallbackActionPointCB)

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

Public methodAddPointCallback(Type, SoCallbackActionPointUserDataCB, Object) Obsolete.
Routine to add delegates for generated primitives (points) for all shapes of the given type. The will be called for each point generated for all shapes of or derived from that type.
Public methodAddPostCallback(Type, SoCallbackActionCallbackActionCB)

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

Public methodAddPostCallback(Type, SoCallbackActionCallbackActionUserDataCB, Object) Obsolete.
Adds a delegate 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 delegate indicates whether the action should continue with the traversal.
Public methodAddPostTailCallback(SoCallbackActionCallbackActionCB) Obsolete.
Use PostTailTraversal event instead. Sets up a delegate 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.
Public methodAddPostTailCallback(SoCallbackActionCallbackActionUserDataCB, Object) Obsolete.
Use PostTailTraversal event instead.
Public methodAddPreCallback(Type, SoCallbackActionCallbackActionCB)

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

Public methodAddPreCallback(Type, SoCallbackActionCallbackActionUserDataCB, Object) Obsolete.
Adds a delegate 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 delegate indicates whether the action should continue with the traversal.
Public methodAddPreTailCallback(SoCallbackActionCallbackActionCB) Obsolete.
Use PreTailTraversal event instead. Sets up a delegate 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.
Public methodAddPreTailCallback(SoCallbackActionCallbackActionUserDataCB, Object) Obsolete.
Use PreTailTraversal event instead.
Public methodAddTriangleCallback(Type, SoCallbackActionTriangleCB)

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

Public methodAddTriangleCallback(Type, SoCallbackActionTriangleUserDataCB, Object) Obsolete.
Routine to add delegates for generated primitives (triangles) for all shapes of the given type. The delegate will be called for each triangle generated for all shapes of or derived from that type.
Public methodApply(SoNode)

Initiates an action on the graph defined by a node.

(Inherited from SoAction.)
Public methodApply(SoPath)

Initiates an action on the graph defined by a path.

(Inherited from SoAction.)
Public methodApply(SoPathList)
Calls Apply(pathList, false).
(Inherited from SoAction.)
Public methodApply(SoPathList, Boolean)

Initiates an action on the graph defined by a list of paths.

(Inherited from SoAction.)
Public methodClearApplyResult

When applied, an action may reference nodes or create objects (e.g.

(Inherited from SoAction.)
Public methodStatic memberEnableElement
Public methodEnableElements

(Overrides SoActionEnableElements.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodForwardTraversal

Traverse a node that is not part of the current scenegraph.

(Overrides SoActionForwardTraversal(SoNode).)
Public methodGetComplexity

Returns complexity information from the state.

Public methodGetComplexityType

Returns complexity information from the state.

Public methodGetContinueActionInBranchFlag

This function indicates if the action must stop in the current branch.

(Inherited from SoAction.)
Public methodGetCoordinate3

Returns the current coordinates from the state.

Public methodGetCoordinate4

Returns the current coordinates from the state.

Public methodGetCreaseAngle

Returns the current shape hints from the state.

Public methodGetCurPath
(Inherited from SoAction.)
Public methodGetCurrentResponse
Public methodGetDecimationPercentage

Returns the current decimation percentage from the state.

Public methodGetDecimationType

Returns the current decimation type from the state.

Public methodGetDrawStyle

Returns the current drawing style information from the state.

Public methodGetFaceType

Returns the current shape hints from the state.

Public methodGetFocalDistance

Returns the current camera and viewing information from the state.

Public methodGetFontName

Returns the current font information from the state.

Public methodGetFontRenderStyle

Returns the current font information from the state.

Public methodGetFontSize

Returns the current font information from the state.

Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetLightAttenuation

Returns the current lighting model information from the state.

Public methodGetLightModel

Returns the current lighting model information from the state.

Public methodGetLinePattern

Returns the current drawing style information from the state.

Public methodGetLinePatternScaleFactor

Returns the current drawing style information from the state.

Public methodGetLineWidth

Returns the current drawing style information from the state.

Public methodGetMaterial(SbColor, SbColor, SbColor, SbColor, Single, Single)
Calls GetMaterial(ambient, diffuse, specular, emission, shininess, transparency, System.Int32(0)).
Public methodGetMaterial(SbColor, SbColor, SbColor, SbColor, Single, Single, Int32)

Returns the current material information from the state.

Public methodGetMaterialBinding

Returns the current material information from the state.

Public methodGetModelMatrix

Returns the current modeling transformation from the state.

Public methodGetNodeAppliedTo
(Inherited from SoAction.)
Public methodGetNormal

Returns the current normal information from the state.

Public methodGetNormalBinding

Returns the current normal information from the state.

Public methodGetNumCoordinates

Returns the current coordinates from the state.

Public methodGetNumNormals

Returns the current normal information from the state.

Public methodGetNumProfileCoordinates

Returns the current profiles and their coordinates from the state.

Public methodGetNumTextureCoordinates

Returns texture information from the state.

Public methodGetOriginalPathListAppliedTo
(Inherited from SoAction.)
Public methodGetPathAppliedTo
(Inherited from SoAction.)
Public methodGetPathCode(SbNativeArrayInt32)

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.

(Inherited from SoAction.)
Public methodGetPathCode(SbNativeInt32Array) Obsolete.

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.

(Inherited from SoAction.)
Public methodGetPathListAppliedTo
(Inherited from SoAction.)
Public methodGetPickStyle

Returns the current picking style.

Public methodGetPipeId

Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.

(Inherited from SoAction.)
Public methodGetPointSize

Returns the current drawing style information from the state.

Public methodGetProfile

Returns the current profiles and their coordinates from the state.

Public methodGetProfileCoordinate2

Returns the current profiles and their coordinates from the state.

Public methodGetProfileCoordinate3

Returns the current profiles and their coordinates from the state.

Public methodGetProjectionMatrix

Returns the current camera and viewing information from the state.

Public methodGetSceneManager

Return the SoSceneManager associated with this action.

(Inherited from SoAction.)
Public methodGetShapeType

Returns the current shape hints from the state.

Public methodGetState
(Inherited from SoAction.)
Public methodGetSwitch

Returns the current switch value.

Public methodGetTextureBlendColor

Returns texture information from the state.

Public methodGetTextureCoordinate2

Returns texture information from the state.

Public methodGetTextureCoordinate4

Returns texture information from the state.

Public methodGetTextureCoordinateBinding

Returns texture information from the state.

Public methodGetTextureFileName

Returns texture information from the state.

Public methodGetTextureImage(SbVec2i32, Int32)

Returns texture information from the state.

Public methodGetTextureImage(SbVec2s, Int32) Obsolete.

Returns texture information from the state.

Public methodGetTextureMatrix

Returns the current texture mapping information from the state.

Public methodGetTextureModel

Returns the current texture mapping information from the state.

Public methodGetTextureTransformNode

Returns the current texture mapping information from the state.

Public methodGetTextureWrapS

Returns the current texture mapping information from the state.

Public methodGetTextureWrapT

Returns the current texture mapping information from the state.

Public methodGetTransparencyType Obsolete.

Returns the current Transparency Type information from the state.

Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUnits

Returns the current units from the state.

Public methodGetVertexOrdering

Returns the current shape hints from the state.

Public methodGetViewingMatrix

Returns the current camera and viewing information from the state.

Public methodGetViewVolume

Returns the current camera and viewing information from the state.

Public methodGetWhatAppliedTo
(Inherited from SoAction.)
Public methodHasTerminated
(Inherited from SoAction.)
Public methodInvalidateState

Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.

(Inherited from SoAction.)
Public methodInvokePostCallbacks
Public methodInvokePreCallbacks
Public methodIsBeingApplied

Returns true if this action is currently being applied.

(Inherited from SoAction.)
Public methodIsCallbackAll

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

Public methodIsLastPathListAppliedTo
(Inherited from SoAction.)
Public methodIsUsingAlternateRep

Returns true if current action is using alternate representations.

(Inherited from SoAction.)
Public methodPostDelayedTraversal

Method called by SoMultiPassManager after delayed pass traversals.

(Inherited from SoAction.)
Public methodPreDelayedTraversal

Method called by SoMultiPassManager before delayed pass traversals.

(Inherited from SoAction.)
Public methodResetContinueActionInBranchFlag

This function resets the continue action flag.

(Inherited from SoAction.)
Public methodSetCallbackAll

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

Public methodSetPipeId

Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.

(Inherited from SoAction.)
Public methodSetSceneManager

Set the scene manager associated with this action (if any ).

(Inherited from SoAction.)
Public methodSetUpState
(Inherited from SoAction.)
Public methodShouldGeneratePrimitives
Public methodStopActionInBranch

This function stops the action in the current Scene Graph branch.

(Inherited from SoAction.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTraverse
(Inherited from SoAction.)
Public methodUseAlternateRep

Tell the action to use alternate representations during traversal when available.

(Inherited from SoAction.)
Top
Events
  NameDescription
Public eventpostTailCallback Obsolete.
Use PostTailTraversal event instead. PostTail delegate invocation list
Public eventPostTailTraversal
Public eventpreTailCallback Obsolete.
Use PreTailTraversal event instead. PreTail delegate invocation list
Public eventPreTailTraversal
Top
Remarks

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 delegate 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, delegatemethods 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 delegatefunctions that are invoked during traversal, so there is a valid state to work with.

EXAMPLE

Apply a callback action to visit all shape nodes.

SoCallbackAction action = new SoCallbackAction();
action.AddPreCallback     ( typeof(SoShape), new SoCallbackAction.CallbackActionCB(NodeCallback) );
action.AddTriangleCallback( typeof(SoShape), new SoCallbackAction.TriangleCB(TriangleCallback) );
action.Apply( root );
This method will be called for each shape node in the scene graph.
SoCallbackAction.Responses NodeCallback(SoCallbackAction action, SoNode node)
{
   Console.WriteLine("Shape \"" + node.GetName() + "\": " + node.GetType());
   return SoCallbackAction.Responses.CONTINUE;
}
This method will be called for each triangle in the shape node.
void TriangleCallback( SoCallbackAction action,
             ref SoPrimitiveVertex vertex1,
             ref SoPrimitiveVertex vertex2,
             ref SoPrimitiveVertex vertex3)
{
   Console.WriteLine("  Triangle:");
   printVertex( vertex1, "1" );
   printVertex( vertex2, "2" );
   printVertex( vertex3, "3" );
}
void printVertex( SoPrimitiveVertex vertex, String label )
{
   SbVec3f point = vertex.Point;
   Console.WriteLine("    Vert{0} = ({1}, {2}, {3})", label, point[0], point[1], point[2]);
}

Example output:

Shape "": SoCone
 Triangle:
   Vert1 = 0.0, -1.0, -1.0
   Vert2 = 0.0, 1.0, -0.0
   Vert3 = 0.38268346, -1.0, -0.9238795
 Triangle:
   Vert1 = 0.38268346, -1.0, -0.9238795
   Vert2 = 0.0, 1.0, -0.0
   Vert3 = 0.0, 1.0, -0.0
 . . .
* 

List of shapes supporting primitive generation:

See Also