SoCallbackAction Class |
Performs a generic traversal of a scene graph or path.
Namespace: OIV.Inventor.Actions
The SoCallbackAction type exposes the following members.
Name | Description | |
---|---|---|
![]() | SoCallbackAction | The constructor. |
Name | Description | |
---|---|---|
![]() | AddLineSegmentCallback(Type, SoCallbackActionLineSegmentCB) | Routine to add callbacks for generated primitives (line segments) for all shapes of the given type. |
![]() | AddLineSegmentCallback(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.
|
![]() | AddPointCallback(Type, SoCallbackActionPointCB) | Routine to add callbacks for generated primitives (points) for all shapes of the given type. |
![]() | AddPointCallback(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.
|
![]() | AddPostCallback(Type, SoCallbackActionCallbackActionCB) | Adds a callback function to call when a node of the given type is encountered during traversal. |
![]() | AddPostCallback(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.
|
![]() | AddPostTailCallback(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.
|
![]() | AddPostTailCallback(SoCallbackActionCallbackActionUserDataCB, Object) | Obsolete.
Use PostTailTraversal event instead.
|
![]() | AddPreCallback(Type, SoCallbackActionCallbackActionCB) | Adds a callback function to call when a node of the given type is encountered during traversal. |
![]() | AddPreCallback(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.
|
![]() | AddPreTailCallback(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.
|
![]() | AddPreTailCallback(SoCallbackActionCallbackActionUserDataCB, Object) | Obsolete.
Use PreTailTraversal event instead.
|
![]() | AddTriangleCallback(Type, SoCallbackActionTriangleCB) | Routine to add callbacks for generated primitives (triangles) for all shapes of the given type. |
![]() | AddTriangleCallback(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.
|
![]() | Apply(SoNode) | Initiates an action on the graph defined by a node. |
![]() | Apply(SoPath) | Initiates an action on the graph defined by a path. |
![]() | Apply(SoPathList) | Calls Apply(pathList, false). (Inherited from SoAction.) |
![]() | Apply(SoPathList, Boolean) | Initiates an action on the graph defined by a list of paths. |
![]() | ClearApplyResult | When applied, an action may reference nodes or create objects (e.g. |
![]() ![]() | EnableElement | |
![]() | EnableElements | (Overrides SoActionEnableElements.) |
![]() | Equals | (Inherited from Object.) |
![]() | ForwardTraversal | Traverse a node that is not part of the current scenegraph. |
![]() | GetComplexity | Returns complexity information from the state. |
![]() | GetComplexityType | Returns complexity information from the state. |
![]() | GetContinueActionInBranchFlag | This function indicates if the action must stop in the current branch. |
![]() | GetCoordinate3 | Returns the current coordinates from the state. |
![]() | GetCoordinate4 | Returns the current coordinates from the state. |
![]() | GetCreaseAngle | Returns the current shape hints from the state. |
![]() | GetCurPath | (Inherited from SoAction.) |
![]() | GetCurrentResponse | |
![]() | GetDecimationPercentage | Returns the current decimation percentage from the state. |
![]() | GetDecimationType | Returns the current decimation type from the state. |
![]() | GetDrawStyle | Returns the current drawing style information from the state. |
![]() | GetFaceType | Returns the current shape hints from the state. |
![]() | GetFocalDistance | Returns the current camera and viewing information from the state. |
![]() | GetFontName | Returns the current font information from the state. |
![]() | GetFontRenderStyle | Returns the current font information from the state. |
![]() | GetFontSize | Returns the current font information from the state. |
![]() | GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) |
![]() | GetLightAttenuation | Returns the current lighting model information from the state. |
![]() | GetLightModel | Returns the current lighting model information from the state. |
![]() | GetLinePattern | Returns the current drawing style information from the state. |
![]() | GetLinePatternScaleFactor | Returns the current drawing style information from the state. |
![]() | GetLineWidth | Returns the current drawing style information from the state. |
![]() | GetMaterial(SbColor, SbColor, SbColor, SbColor, Single, Single) | Calls GetMaterial(ambient, diffuse, specular, emission, shininess, transparency, System.Int32(0)). |
![]() | GetMaterial(SbColor, SbColor, SbColor, SbColor, Single, Single, Int32) | Returns the current material information from the state. |
![]() | GetMaterialBinding | Returns the current material information from the state. |
![]() | GetModelMatrix | Returns the current modeling transformation from the state. |
![]() | GetNodeAppliedTo | (Inherited from SoAction.) |
![]() | GetNormal | Returns the current normal information from the state. |
![]() | GetNormalBinding | Returns the current normal information from the state. |
![]() | GetNumCoordinates | Returns the current coordinates from the state. |
![]() | GetNumNormals | Returns the current normal information from the state. |
![]() | GetNumProfileCoordinates | Returns the current profiles and their coordinates from the state. |
![]() | GetNumTextureCoordinates | Returns texture information from the state. |
![]() | GetOriginalPathListAppliedTo | (Inherited from SoAction.) |
![]() | GetPathAppliedTo | (Inherited from SoAction.) |
![]() | GetPathCode(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. |
![]() | GetPathCode(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. |
![]() | GetPathListAppliedTo | (Inherited from SoAction.) |
![]() | GetPickStyle | Returns the current picking style. |
![]() | GetPipeId | Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration. |
![]() | GetPointSize | Returns the current drawing style information from the state. |
![]() | GetProfile | Returns the current profiles and their coordinates from the state. |
![]() | GetProfileCoordinate2 | Returns the current profiles and their coordinates from the state. |
![]() | GetProfileCoordinate3 | Returns the current profiles and their coordinates from the state. |
![]() | GetProjectionMatrix | Returns the current camera and viewing information from the state. |
![]() | GetSceneManager | Return the SoSceneManager associated with this action. |
![]() | GetShapeType | Returns the current shape hints from the state. |
![]() | GetState | (Inherited from SoAction.) |
![]() | GetSwitch | Returns the current switch value. |
![]() | GetTextureBlendColor | Returns texture information from the state. |
![]() | GetTextureCoordinate2 | Returns texture information from the state. |
![]() | GetTextureCoordinate4 | Returns texture information from the state. |
![]() | GetTextureCoordinateBinding | Returns texture information from the state. |
![]() | GetTextureFileName | Returns texture information from the state. |
![]() | GetTextureImage(SbVec2i32, Int32) | Returns texture information from the state. |
![]() | GetTextureImage(SbVec2s, Int32) | Obsolete. Returns texture information from the state. |
![]() | GetTextureMatrix | Returns the current texture mapping information from the state. |
![]() | GetTextureModel | Returns the current texture mapping information from the state. |
![]() | GetTextureTransformNode | Returns the current texture mapping information from the state. |
![]() | GetTextureWrapS | Returns the current texture mapping information from the state. |
![]() | GetTextureWrapT | Returns the current texture mapping information from the state. |
![]() | GetTransparencyType | Obsolete. Returns the current Transparency Type information from the state. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetUnits | Returns the current units from the state. |
![]() | GetVertexOrdering | Returns the current shape hints from the state. |
![]() | GetViewingMatrix | Returns the current camera and viewing information from the state. |
![]() | GetViewVolume | Returns the current camera and viewing information from the state. |
![]() | GetWhatAppliedTo | (Inherited from SoAction.) |
![]() | HasTerminated | (Inherited from SoAction.) |
![]() | InvalidateState | Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied. |
![]() | InvokePostCallbacks | |
![]() | InvokePreCallbacks | |
![]() | IsBeingApplied | Returns true if this action is currently being applied. |
![]() | IsCallbackAll | Returns whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node. |
![]() | IsLastPathListAppliedTo | (Inherited from SoAction.) |
![]() | IsUsingAlternateRep | Returns true if current action is using alternate representations. |
![]() | PostDelayedTraversal | Method called by SoMultiPassManager after delayed pass traversals. |
![]() | PreDelayedTraversal | Method called by SoMultiPassManager before delayed pass traversals. |
![]() | ResetContinueActionInBranchFlag | This function resets the continue action flag. |
![]() | SetCallbackAll | Sets whether the callback uses normal traversal (switches, etc.) or whether it traverses every single node. |
![]() | SetPipeId | Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration. |
![]() | SetSceneManager | Set the scene manager associated with this action (if any ). |
![]() | SetUpState | (Inherited from SoAction.) |
![]() | ShouldGeneratePrimitives | |
![]() | StopActionInBranch | This function stops the action in the current Scene Graph branch. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | Traverse | (Inherited from SoAction.) |
![]() | UseAlternateRep | Tell the action to use alternate representations during traversal when available. |
Name | Description | |
---|---|---|
![]() | postTailCallback | Obsolete.
Use PostTailTraversal event instead.
PostTail delegate invocation list
|
![]() | PostTailTraversal | |
![]() | preTailCallback | Obsolete.
Use PreTailTraversal event instead.
PreTail delegate invocation list
|
![]() | PreTailTraversal |
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.
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 );
SoCallbackAction.Responses NodeCallback(SoCallbackAction action, SoNode node) { Console.WriteLine("Shape \"" + node.GetName() + "\": " + node.GetType()); return SoCallbackAction.Responses.CONTINUE; }
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:
SoScreenQuad
SoTVizRender