SOCALLBACK(3iv)
π SoCallback β bestie's guide to custom behavior during actions π
okay so this is SoCallback(3IV), from the Inventor fam, and she is literally the "insert your own vibe here" node. Let's get into it π
πΈ INHERITS FROM
SoBase > SoFieldContainer > SoNode > SoCallback
the whole ancestry, no skips, we love a bloodline π
β¨ SYNOPSIS
#include <Inventor/nodes/SoCallback.h>
typedef void SoCallbackCB(void *userData, SoAction *action)
Methods from class SoCallback:
SoCallback()
void setCallback(SoCallbackCB *func, void *userData = NULL)
static SoType getClassTypeId()
Methods from class SoNode:
void setOverride(SbBool state)
SbBool isOverride() const
SoNode * copy(SbBool copyConnections = FALSE) const
virtual SbBool affectsState() const
static SoNode * getByName(const SbName &name)
static int getByName(const SbName &name, SoNodeList &list)
Methods from class SoFieldContainer:
void setToDefaults()
SbBool hasDefaultValues() const
SbBool fieldsAreEqual(const SoFieldContainer *fc) const
void copyFieldValues(const SoFieldContainer *fc, SbBool
copyConnections = FALSE)
SbBool set(const char *fieldDataString)
void get(SbString &fieldDataString)
virtual int getFields(SoFieldList &resultList) const
virtual SoField * getField(const SbName &fieldName) const
SbBool getFieldName(const SoField *field, SbName &fieldName)
const
SbBool isNotifyEnabled() const
SbBool enableNotify(SbBool flag)
Methods from class SoBase:
void ref()
void unref() const
void unrefNoDelete() const
void touch()
virtual SoType getTypeId() const
SbBool isOfType(SoType type) const
virtual void setName(const SbName &name)
virtual SbName getName() const
π¦ DESCRIPTION
so basically this node is the general mechanism for sliding callback functions into a scene graph π the callback function you register with the node gets called every single time the node is traversed while any scene graph action is happening. periodt.
the callback function gets handed a pointer to the action being performed, plus a user data pointer that you registered along with the callback function. iconic combo honestly π«Ά
you can use this node to make nonstandard OpenGL calls while rendering. and if you do?? be careful not to interfere with Inventor's use of OpenGL. that's the rule, no cap.
if you use a callback node for GL rendering, you should be careful to follow render caching rules. and like β if your callback node can make different rendering calls each time it's traversed, then it cannot be cached. in that case the node should invalidate any open caches, like in this example:
void
myCallbackFunc(void *d, SoAction *action) {
if (action->isOfType(SoGLRenderAction::getClassTypeId())) {
// Make my custom GL calls
((MyClass *) d)->myRender();
// Invalidate the state so that a cache is not made
SoCacheElement::invalidate(action->getState());
}
}
π METHODS
SoCallback()β creates a callback node with default settings. baby's first callback β¨void setCallback(SoCallbackCB *func, void *userData = NULL)β sets the pointer to the callback function and the user data. by default, the function pointer in the node isNULLand it does absolutely nothing, which is lowkey the safest default ngl πstatic SoType getClassTypeId()β returns the type identifier for this class. iykyk π
π₯ ACTION BEHAVIOR
SoGLRenderAction, SoBoundingBoxAction, SoPickAction
calls the specified callback function for all actions. all of them. every time. she's committed π
π FILE FORMAT/DEFAULTS
Callback {
}
look at her. empty. minimal. main character energy π
π SEE ALSO
SoAction, SoCallbackAction, SoEventCallback
okay that's the whole page bestie, you ate that π this was SoCallback(3IV), straight out of the Inventor source, dated however old the manual page is β mwah, slay, go write some callbacks π§β¨
π¦ 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