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: 10.12.3.0 (10.12.3.0)
Syntax
public class SoCallbackAction : SoAction

The SoCallbackAction type exposes the following members.

Constructors
  NameDescription
Public methodSoCallbackAction

The constructor.

Top
Methods
  NameDescription
Public methodAddLineSegmentCallback

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

Public methodAddPointCallback

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

Public methodAddPostCallback

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

Public methodAddPreCallback

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

Public methodAddTriangleCallback

Routine to add callbacks for generated primitives (triangles) for all shapes of the given 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(SoNode)

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

(Overrides SoActionForwardTraversal(SoNode).)
Public methodForwardTraversal(SoPath)

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

(Overrides SoActionForwardTraversal(SoPath).)
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

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.

(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 methodGetDistribMode

Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).

(Inherited from SoAction.)
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

Returns the node the action is being applied to.

(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

Returns the original path list the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathAppliedTo

Returns the path the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathCode

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

Returns the path list the action is being applied to.

(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 OIV.Inventor.SoSceneManager associated with this action.

(Inherited from SoAction.)
Public methodGetShapeType

Returns the current shape hints from the state.

Public methodGetState

Gets the state from the action.

(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

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

Returns code indicating what action is being applied to.

(Inherited from SoAction.)
Public methodHasTerminated

Returns true if the traversal has reached a termination condition.

(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

Returns true if the current list is the last one from the original.

(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

Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.

(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

Does traversal of a graph rooted by a node.

(Inherited from SoAction.)
Public methodUseAlternateRep

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

(Inherited from SoAction.)
Top
Events
Remarks

Performs a generic traversal of a scene graph or path. In many cases a "custom" action can be implemented using OIV.Inventor.Actions.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 OIV.Inventor.Nodes.SoCone class will only be called for OIV.Inventor.Nodes.SoCone nodes, but a callback for the OIV.Inventor.Nodes.SoShape class will be called for any type of shape node.

This makes OIV.Inventor.Actions.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 OIV.Inventor.Actions.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
 . . .
* 

See Also