SOCALLBACKACTION(3iv)
π SoCallbackAction β the SoCallbackAction(3IV) era π
okay bestie, sit down, hydrate, because we're about to talk about the action that just... walks the whole scene graph and lets you vibe-check every node on the way. no cap. π¦
β¨ NAME β¨
SoCallbackAction β performs a generic traversal of the scene graph. literally that's her whole job and she ATE. π
πΈ INHERITS FROM πΈ
SoAction > SoCallbackAction
so she's an SoAction girlie at heart, she just has extra tricks. iykyk. β¨
π SYNOPSIS π
first things first, the include, because obviously:
#include <Inventor/actions/SoCallbackAction.h>
now the callback typedefs β these are the lil function shapes you gotta match when you register your own callbacks. copy them EXACTLY, do not freestyle, i'm begging:
typedef void SoTriangleCB(void *userData,
SoCallbackAction *action,
const SoPrimitiveVertex *v1,
const SoPrimitiveVertex *v2,
const SoPrimitiveVertex *v3)
typedef void SoLineSegmentCB(void *userData,
SoCallbackAction *action,
const SoPrimitiveVertex *v1,
const SoPrimitiveVertex *v2)
typedef void SoPointCB(void *userData,
SoCallbackAction *action,
const SoPrimitiveVertex *v)
typedef SoCallbackAction::Response
SoCallbackActionCB(void *userData,
SoCallbackAction *action,
const SoNode *node)
and here's the Response enum β this is what you return to tell the traversal what to do next. choose wisely bestie, this is main character energy right here:
enum Response {
SoCallbackAction::CONTINUE Continue traversal as if nothing happened
SoCallbackAction::ABORT Abort traversal
SoCallbackAction::PRUNE Do not traverse node's children, but
continue traversal
}
so like β CONTINUE is "keep going girl", ABORT is "we're DONE here", and PRUNE is "skip the kids but keep the party moving". iconic trio honestly. π
π«Ά Methods from class SoCallbackAction:
every single one of them, in order, no skipping, because we do not gatekeep:
SoCallbackAction()
void addPreCallback(SoType type, SoCallbackActionCB
*cb, void *data)
void addPostCallback(SoType type,
SoCallbackActionCB *cb, void *data)
void addPreTailCallback(SoCallbackActionCB *cb,
void *data)
void addPostTailCallback(SoCallbackActionCB *cb,
void *data)
void addTriangleCallback(SoType type, SoTriangleCB
*cb, void *data)
void addLineSegmentCallback(SoType type,
SoLineSegmentCB *cb, void *data)
void addPointCallback(SoType type, SoPointCB *cb,
void *data)
float getComplexity() const
SoComplexity::Type getComplexityType() const
int32_t getNumCoordinates() const
const SbVec3f & getCoordinate3(int index) const
const SbVec4f & getCoordinate4(int index) const
SoDrawStyle::Style getDrawStyle() const
unsigned short getLinePattern() const
float getLineWidth() const
float getPointSize() const
const SbName & getFontName() const
float getFontSize() const
SoLightModel::Model getLightModel() const
const SbVec3f & getLightAttenuation() const
void getMaterial(SbColor &ambient, SbColor
&diffuse, SbColor &specular, SbColor
&emission, float &shininess, float
&transparency, int mtlIndex = 0) const
SoMaterialBinding::Binding getMaterialBinding() const
long getNumNormals() const
const SbVec3f & getNormal(int index) const
SoNormalBinding::Binding getNormalBinding() const
int32_t getNumProfileCoordinates() const
const SbVec2f & getProfileCoordinate2(int index) const
const SbVec3f & getProfileCoordinate3(int index) const
const SoNodeList & getProfile() const
SoShapeHints::VertexOrdering
getVertexOrdering() const
SoShapeHints::ShapeType getShapeType() const
SoShapeHints::FaceType getFaceType() const
float getCreaseAngle() const
int32_t getNumTextureCoordinates() const
const SbVec2f & getTextureCoordinate2(int index) const
const SbVec4f & getTextureCoordinate4(int index) const
SoTextureCoordinateBinding::Binding
getTextureCoordinateBinding() const
const SbColor & getTextureBlendColor() const
const unsigned char * getTextureImage(SbVec2s &size, int &numComps)
const
const SbMatrix & getTextureMatrix() const
SoTexture2::Model getTextureModel() const
SoTexture2::Wrap getTextureWrapS() const
SoTexture2::Wrap getTextureWrapT() const
const SbMatrix & getModelMatrix() const
SoUnits::Units getUnits() const
float getFocalDistance() const
const SbMatrix & getProjectionMatrix() const
const SbMatrix & getViewingMatrix() const
const SbViewVolume & getViewVolume() const
SoPickStyle::Style getPickStyle() const
int32_t getSwitch() const
look at all those getters, she's got range fr fr π
π§ Methods from class SoAction:
the inherited ones, still here, still slaying:
virtual void apply(SoNode *node)
virtual void apply(SoPath *path)
virtual void apply(const SoPathList &pathList, SbBool obeysRules =
FALSE)
static SoType getClassTypeId()
virtual SoType getTypeId()
virtual SbBool isOfType(SoType type)
virtual void invalidateState()
π DESCRIPTION π
okay so here's the whole tea. β
this action defines a generic traversal of the scene graph. the user can specify callback functions for node types or paths β and when those node types or paths get encountered during the traversal, your callback function gets called. that's it, that's the mechanic. it's giving personal tour guide for your scene graph. π«Ά
on top of that, you can also register callback functions for primitives generated by shapes in the scene graph. most shape types can generate primitives that represent or approximate their geometries:
- triangle primitives are used for all surfaces β think cubes, face sets, or 3D text. πΊ
- line segment primitives are used for line shapes. π
- point primitives are used for point shapes. β¬
note bestie: the type of primitives generated for a shape is the same, regardless of drawing style or other properties. don't come for me, that's just how she works. π
and then β the important part, the part that'll save you a debugging meltdown β
most of the methods on this class access information from the traversal state. so they should be called only by callback functions that are invoked during traversal, so there's a valid state to work with.
π¨ like, seriously. call a get* method outside of a callback mid-traversal and you're working with a state that isn't valid. no state, no data, no slay. she will simply not have it. π
okay that's part one bestie β there's more coming, don't go anywhere π
β¨ METHODS β¨
okay bestie, deep breath π this is the part where you actually do stuff with your SoCallbackAction. It's giving "toolkit era" and I'm obsessed. Every method, every signature, every little default β all here, no skips, periodt. π
SoCallbackAction()β the constructor. That's the origin story, the main character entrance, the "hello world" but make it iconic. β¨void addPreCallback(SoType type, SoCallbackActionCB *cb, void *data)andvoid addPostCallback(SoType type, SoCallbackActionCB *cb, void *data)β these add 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. π«Άvoid addPreTailCallback(SoCallbackActionCB *cb, void *data)andvoid addPostTailCallback(SoCallbackActionCB *cb, void *data)β these can be used to set up callback functions to call when the action is applied to a path. The functions are called just before or after the node at the tail of the path is traversed. π¦void addTriangleCallback(SoType type, SoTriangleCB *cb, void *data),void addLineSegmentCallback(SoType type, SoLineSegmentCB *cb, void *data), andvoid addPointCallback(SoType type, SoPointCB *cb, void *data)β routines to add callbacks for generated primitives (triangles, line segments, and points) for all shapes of the given type. The callback function will be called for each primitive generated for all shapes of or derived from that type. π₯float getComplexity() constandSoComplexity::Type getComplexityType() constβ returns complexity information from the state. Lowkey the vibe check of your scene. πint32_t getNumCoordinates() const,const SbVec3f & getCoordinate3(int index) const, andconst SbVec4f & getCoordinate4(int index) constβ returns the current coordinates from the state.SoDrawStyle::Style getDrawStyle() const,unsigned short getLinePattern() const,float getLineWidth() const, andfloat getPointSize() constβ returns the current drawing style information from the state.const SbName & getFontName() constandfloat getFontSize() constβ returns the current font information from the state. Aesthetic matters, bestie. πSoLightModel::Model getLightModel() constandconst SbVec3f & getLightAttenuation() 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) constandSoMaterialBinding::Binding getMaterialBinding() constβ returns the current material information from the state. Providing amtlIndexwill return the material defined for that index. πlong getNumNormals() const,const SbVec3f & getNormal(int index) const, andSoNormalBinding::Binding getNormalBinding() constβ returns the current normal information from the state.int32_t getNumProfileCoordinates() const,const SbVec2f & getProfileCoordinate2(int index) const,const SbVec3f & getProfileCoordinate3(int index) const, andconst SoNodeList & getProfile() constβ returns the current profiles and their coordinates from the state.SoShapeHints::VertexOrdering getVertexOrdering() const,SoShapeHints::ShapeType getShapeType() const,SoShapeHints::FaceType getFaceType() const, andfloat getCreaseAngle() constβ returns the current shape hints from the state.int32_t getNumTextureCoordinates() const,const SbVec2f & getTextureCoordinate2(int index) const,const SbVec4f & getTextureCoordinate4(int index) const,SoTextureCoordinateBinding::Binding getTextureCoordinateBinding() const,const SbColor & getTextureBlendColor() const, andconst unsigned char * getTextureImage(SbVec2s &size, int &numComps) constβ returns texture information from the state.getNumTextureCoordinates()returns0if texture coordinates are generated by a function.getTextureImage()returnsNULLif no texture is enabled. πΈconst SbMatrix & getTextureMatrix() const,SoTexture2::Model getTextureModel() const,SoTexture2::Wrap getTextureWrapS() const, andSoTexture2::Wrap getTextureWrapT() constβ returns the current texture mapping information from the state.const SbMatrix & getModelMatrix() constandSoUnits::Units getUnits() constβ returns the current modeling transformation and the current units from the state.float getFocalDistance() const,const SbMatrix & getProjectionMatrix() const,const SbMatrix & getViewingMatrix() const, andconst SbViewVolume & getViewVolume() 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.
π SEE ALSO π
go touch some other manpages, bestie, they're all linked in the group chat:
SoCallbackSoEventCallbackSoShape
and that's the whole page, no cap. this iconic little doc is stamped SoCallbackAction(3IV)() β that's the source/version/date footer energy, and yes it ate. periodt. πβ¨
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms