SoSearchAction(3)
β¨ NAME β¨
SoSearchAction β the SoSearchAction class provides methods for searching through scene graphs. Thatβs the whole iconic vibe. Also folding in the manual-name realness: this is SoSearchAction(3) from the Library Functions Manual, bestie. π
Part 1 of the glow-up, bestie β more parts incoming. β¨
π¦ SYNOPSIS π¦
#include <Inventor/actions/SoSearchAction.h>
Inherits SoAction.
π« Public Types π«
enum LookFor { NODE = 1, TYPE = 2, NAME = 4 }enum Interest { FIRST, LAST, ALL }
π Public Types inherited from SoAction π
enum AppliedCode { NODE = 0, PATH = 1, PATH_LIST = 2 }enum PathCode { NO_PATH = 0, IN_PATH = 1, BELOW_PATH = 2, OFF_PATH = 3 }
π Public Member Functions π
Hereβs the full lineup, untouched and iconic:
virtual SoType getTypeId (void) constSoSearchAction (void)virtual ~SoSearchAction ()void setNode (SoNode *const node)SoNode * getNode (void) constvoid setType (const SoType type, const SbBool chkderived=1)SoType getType (SbBool &chkderived) constvoid setName (const SbName name)SbName getName (void) constvoid setFind (const int what)int getFind (void) constvoid setInterest (const Interest interest)Interest getInterest (void) constvoid setSearchingAll (const SbBool searchall)SbBool isSearchingAll (void) constSoPath * getPath (void) constSoPathList & getPaths (void)void reset (void)void setFound (void)SbBool isFound (void) constvoid addPath (SoPath *const path)
π«Ά Public Member Functions inherited from SoAction π«Ά
virtual ~SoAction ()virtual SbBool isOfType (SoType type) constvirtual void apply (SoNode *root)virtual void apply (SoPath *path)virtual void apply (const SoPathList &pathlist, SbBool obeysrules=0)void apply (SoAction *beingApplied)virtual void invalidateState (void)AppliedCode getWhatAppliedTo (void) constSoNode * getNodeAppliedTo (void) constSoPath * getPathAppliedTo (void) constconst SoPathList * getPathListAppliedTo (void) constconst SoPathList * getOriginalPathListAppliedTo (void) constSbBool isLastPathListAppliedTo (void) constPathCode getPathCode (int &numindices, const int *&indices)void traverse (SoNode *const node)SbBool hasTerminated (void) constconst SoPath * getCurPath (void)SoState * getState (void) constPathCode getCurPathCode (void) constvirtual SoNode * getCurPathTail (void)void usePathCode (int &numindices, const int *&indices)void pushCurPath (const int childindex, SoNode *node=NULL)void popCurPath (const PathCode prevpathcode)void pushCurPath (void)void popPushCurPath (const int childindex, SoNode *node=NULL)void popCurPath (void)void switchToPathTraversal (SoPath *path)void switchToNodeTraversal (SoNode *node)
β Static Public Member Functions β
static SoType getClassTypeId (void)static void addMethod (const SoType type, SoActionMethod method)static void enableElement (const SoType type, const int stackindex)static void initClass (void)
π Static Public Member Functions inherited from SoAction π
static void initClass (void)static void initClasses (void)static SoType getClassTypeId (void)static void nullAction (SoAction *action, SoNode *node)
π Static Public Attributes π
static SbBool duringSearchAll = 0
π§ Protected Member Functions π§
virtual const SoEnabledElementsList & getEnabledElements (void) constvirtual void beginTraversal (SoNode *node)
πΈ Protected Member Functions inherited from SoAction πΈ
SoAction (void)virtual void endTraversal (SoNode *node)void setTerminated (const SbBool flag)virtual SbBool shouldCompactPathList (void) const
π Static Protected Member Functions π
static SoEnabledElementsList * getClassEnabledElements (void)static SoActionMethodList * getClassActionMethods (void)
π¦ Static Protected Member Functions inherited from SoAction π¦
static SoEnabledElementsList * getClassEnabledElements (void)static SoActionMethodList * getClassActionMethods (void)
π Additional Inherited Members π
π Protected Attributes inherited from SoAction π
SoState * stateSoActionMethodList * traversalMethods
πΈ Detailed Description πΈ
The SoSearchAction class provides methods for searching through scene graphs. Thatβs the main character energy right there. π
You can search for nodes by pointer, by type, and by name β or a combo of those criteria. Types can be interpreted as exact types, or the type can match nodes derived from it. Every single node can be searched, or normal traversal rules can be followed when searching. This is especially important to note with regard to switch nodes. π
When you use more than one of the setNode(), setType() and setName() calls, note that the action will search for node(s) with an "AND" combination of the given search criteria. So itβs not a "match any" vibe, itβs a "match all" vibe. π
One of the most common pitfalls when using the SoSearchAction class is to call the function isFound() after doing a search. It does not return what you would expect it to return if you havenβt read the documentation for that function. So bestie, read the docs first, fr fr. π
Be aware that if you do search operations on anSoSearchActioncreated on the stack, you can get some unfortunate side effects if youβre not careful. SinceSoSearchActionkeeps a list of the path(s) found in the latest search, the nodes in these paths will be unrefβed when theSoSearchActionstack instance is destructed at the end of your function. If the root of your scene-graph then has ref-count zero (it is often useful to do aunrefNoDelete()before returning a node from a function to leave the referencing to the caller), the root node will be destructed! It might be better to create a heap instance of the search action in those cases, since youβll then be able to destruct the search action before callingunrefNoDelete(). Another solution would be to callreset()before callingunrefNoDelete()on your object, sincereset()truncates the path list.
See the documentation of SoTexture2 for a full usage example of SoSearchAction. Itβs giving tutorial realness. π
π Member Enumeration Documentation π
enum SoSearchAction::LookFor
Specify the search criterion. This can be a bitwise combination of the available values. So like, mix and match, iykyk. π
enum SoSearchAction::Interest
Values used when specifying what node(s) we are interested in: the first one found, the last one or all of them. Choose your fighter. π
π Constructor & Destructor Documentation π
SoSearchAction::SoSearchAction (void )
Initializes internal settings with default values. With the default settings, the SoSearchAction will ignore all nodes. So itβs lowkey doing nothing until you give it a mission. π
- References
SoSearchAction(). - Referenced by
addMethod(), andSoSearchAction().
SoSearchAction::~SoSearchAction () [virtual]
Destructor. The cleanup era. π§Ήβ¨
- References
reset().
πΈ MEMBER FUNCTION DOCUMENTATION πΈ
SoType SoSearchAction::getTypeId (void ) const [virtual]
Okay so this returns the type identification of an action that's derived from a class inheriting SoAction. It's used for run-time type checking and "downward" casting. Like, it's giving type safety realness. π
Usage example:
void bar(SoAction * action)
{
if (action->getTypeId() == SoGLRenderAction::getClassTypeId()) {
// safe downward cast, know the type
SoGLRenderAction * glrender = (SoGLRenderAction *)action;
}
return; // ignore if not renderaction
}
For application programmers wanting to extend the library with new actions: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through Inventor/nodes/SoSubAction.h: SO_ACTION_SOURCE, SO_ACTION_INIT_CLASS and SO_ACTION_CONSTRUCTOR.
For more information on writing Coin extensions, see the SoAction class documentation.
Returns the actual type id of an object derived from a class inheriting SoAction. Needs to be overridden in all subclasses.
Implements SoAction.
void SoSearchAction::addMethod (const SoType type, SoActionMethod method) [static]
Bestie, this API member is considered internal to the library, as it is not likely to be of interest to the application programmer. So don't stress about it unless you're deep in the code. π
π References:duringSearchAll,SoAction::SoAction(), andSoSearchAction().
void SoSearchAction::enableElement (const SoType type, const int stackindex) [static]
Again, this API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Internal vibes only. π«Ά
const SoEnabledElementsList & SoSearchAction::getEnabledElements (void ) const [protected], [virtual]
Returns a list of the elements used by action instances of this class upon traversal operations. So like, all the elements that get used when the action does its traversal thing. Periodt. β¨
Reimplemented from SoAction.
void SoSearchAction::setNode (SoNode *const nodeptr)
Sets the node pointer to search for. The action will be configured to set the search "interest" to LookFor NODE, so there is no need to call SoSearchAction::setFind(). Slay, it does it for you. π
π Referenced by: SoNodeKitPath::append().
SoNode * SoSearchAction::getNode (void ) const
Returns the node the SoSearchAction instance is configured to search for.
Note that this method does not return what was found when you applied the action β it only returns what was specifically set by the user with setNode(). What the action actually found is returned by getPath() and getPaths(). Iykyk. π¦
π Referenced by: SoNode::search().
void SoSearchAction::setType (const SoType typearg, const SbBool chkderivedarg = 1)
Configures the SoSearchAction instance to search for nodes of the given type, and nodes of classes derived from the given type if chkderived is TRUE.
The action will be configured to set the search "interest" to LookFor TYPE, so there is no need to call SoSearchAction::setFind(). No cap. π₯
π Referenced by:SoLineHighlightRenderAction::apply(), andSoInteractionKit::isPathSurrogateInMySubgraph().
SoType SoSearchAction::getType (SbBool & chkderivedref) const
Returns the node type which is searched for, and whether derived classes of that type also returns a match. So it's like, "what type are we looking for, and do we care about its descendants?" π
π Referenced by: SoNode::search().
void SoSearchAction::setName (const SbName namearg)
Configures the SoSearchAction instance to search for nodes with the given name.
The action will be configured to set the search "interest" to LookFor NAME, so there is no need to call SoSearchAction::setFind(). Easy peasy. π
β¨ See also: SoNode::getByName()
SbName SoSearchAction::getName (void ) const
Returns the name the SoSearchAction instance is configured to search for. Just the name, nothing else. π
π Referenced by: SoNode::search().
void SoSearchAction::setFind (const int what)
Configures what to search for in the scene graph. what is a bitmask of LookFor flags.
Default find configuration is to ignore all nodes, but the setFind() configuration is updated automatically when any one of SoSearchAction::setNode(), SoSearchAction::setType() or SoSearchAction::setName() is called. So you don't have to manually set it if you use those. π
π Referenced by: SoInteractionKit::isPathSurrogateInMySubgraph().
int SoSearchAction::getFind (void ) const
Returns the search configuration of the action instance. It's giving "what are we looking for?" energy. π
π Referenced by: SoNode::search().
void SoSearchAction::setInterest (const Interest interestarg)
Configures whether only the first, the last, or all the searching matches are of interest. Default configuration is FIRST. So by default, it's all about that first match. π
SoSearchAction::Interest SoSearchAction::getInterest (void ) const
Returns whether only the first, the last, or all the searching matches will be saved. So you know what's up. πΈ
void SoSearchAction::setSearchingAll (const SbBool searchallarg)
Specifies whether normal graph traversal should be done (searchall is FALSE, which is the default setting), or if every single node should be searched (searchall is TRUE).
If the searchall flag is TRUE, even nodes considered "hidden" by other actions are searched (like for instance the disabled children of SoSwitch nodes).
SoBaseKit::setSearchingChildren() must be used to search for nodes under node kits. Important! π¨
π Referenced by: SoInteractionKit::isPathSurrogateInMySubgraph().
SbBool SoSearchAction::isSearchingAll (void ) const
Returns the traversal method configuration of the action. So like, "are we searching all the things or not?" π€
π Referenced by:beginTraversal(),SoPathSwitch::search(),SoSwitch::search(), andSoVRMLSwitch::search().
SoPath * SoSearchAction::getPath (void ) const
Returns the path to the node of interest that matched the search criterions. If no match was found, NULL is returned.
Note that if ALL matches are of interest, the result of a search action must be fetched through SoSearchAction::getPaths().
There is one frequently asked question about the paths that are returned from either this method or the getPaths() method below: "why am I not getting the complete path as expected?"
Well, then you probably have to cast the path to a SoFullPath, since certain nodes (nodekits, many VRML97 nodes) have hidden children. SoPath::getTail() will return the first node that has hidden children, or the tail if none of the nodes have hidden children. SoFullPath::getTail() will always return the actual tail. Just do like this:
SoFullPath * path = (SoFullPath *) searchaction->getPath();
SoVRMLCoordinate * vrmlcord = (SoVRMLCoordinate *) path->getTail();
π Referenced by: SoNodeKitPath::append().
SoPathList & SoSearchAction::getPaths (void )
Returns a pathlist of all nodes that matched the search criterions.
Note that if interest were only FIRST or LAST, SoSearchAction::getPath() should be used instead of this method.
β¨ See also: getPath()
π Referenced by: SoInteractionKit::isPathSurrogateInMySubgraph().
void SoSearchAction::reset (void )
Resets all the SoSearchAction internals back to their default values. Like a factory reset but for the action. π
π References: SoType::badType().
π Referenced by: ~SoSearchAction().
void SoSearchAction::setFound (void )
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Marks the SoSearchAction instance as terminated. So it's like, "we're done here." π
π References: SoAction::setTerminated().
π Referenced by: addPath().
SbBool SoSearchAction::isFound (void ) const
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Returns whether the search action was terminated.
Note that this value does not reflect whether the node(s) that was searched for was found or not. Use the result of getPath() / getPaths() if that is what you really are looking for. So don't get it twisted. π
ββοΈ
π References: SoAction::hasTerminated().
π Referenced by:addPath(),SoBaseKit::search(),SoClipPlaneManip::search(),SoDirectionalLightManip::search(),SoGroup::search(),SoNode::search(),SoNodeKitListPart::search(),SoPathSwitch::search(),SoPointLightManip::search(),SoSeparator::search(),SoShaderObject::search(),SoShaderProgram::search(),SoSpotLightManip::search(),SoSwitch::search(),SoTransformManip::search(),SoVRMLAppearance::search(),SoVRMLBillboard::search(),SoVRMLGeometry::search(),SoVRMLGroup::search(),SoVRMLInline::search(),SoVRMLShape::search(),SoVRMLSwitch::search(), andSoWWWInline::search().
void SoSearchAction::addPath (SoPath *const pathptr)
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Sets the path, or adds the path to the path list, depending on the interest configuration. The path is not copied, so it can not be modified after being added without side effects. So like, don't touch it after you add it. π«
π References:isFound(),SoBase::ref(), andsetFound().
π Referenced by: SoNode::search().
void SoSearchAction::beginTraversal (SoNode * node) [protected], [virtual]
This virtual method is called from SoAction::apply(), and is the entry point for the actual scenegraph traversal.
It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction.
Default method just calls traverse(), which any overridden implementation of the method must do too (or call SoAction::beginTraversal()) to trigger the scenegraph traversal. So don't forget to call it, bestie. π
Reimplemented from SoAction.
π References:duringSearchAll,isSearchingAll(), andSoAction::traverse().
π MEMBER DATA DOCUMENTATION π
SbBool SoSearchAction::duringSearchAll = 0 [static]
Obsoleted global flag, only present for compatibility reasons with old SGI / TGS Inventor application code.
It's set to TRUE when an SoSearchAction traversal with SoSearchAction::isSearchingAll() equal to TRUE is started, and is reset to FALSE again after traversal has finished.
(The flag is used by SGI / TGS Inventor in SoSwitch::affectsState() to know when SoSwitch::whichChild should behave as SoSwitch::SO_SWITCH_ALL. We have a better solution for this problem in Coin.) So yeah, it's a legacy thing. π
π Referenced by:addMethod(), andbeginTraversal().
π AUTHOR π
Generated automatically by Doxygen for Coin from the source code.
That's a wrap, bestie! This page is from Coin version 2.5.0, and it's the SoSearchAction(3) manpage. Stay slay, and may your searches always find what you're looking for. π
β¨π¦
π¦ where this page comes from
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms