SoSearchAction — searches for nodes in a scene graph
Contents
Description
This class is used to search scene graphs for specific nodes, nodes of a specific type, nodes with a
specific name, or any combination of these. It can search for just the first or last node satisfying the
criteria or for all such nodes. The actions return paths to each node found.
Note that by default nodekits do not search their children when a search action is applied. The man page
for SoBaseKit discusses the methods SoBaseKit::isSearchingChildren() and
SoBaseKit::setSearchingChildren(), which allow you to query and control this behavior.
Inherits From
SoAction > SoSearchAction
Methods
SoSearchAction()
Constructor.
voidsetNode(SoNode*n)SoNode*getNode()const
Sets/returns the node to search for.
voidsetType(SoTypet,SbBoolderivedIsOk=TRUE)SoTypegetType(SbBool&derivedIsOk)const
Sets/returns the node type to search for. If derivedIsOk is TRUE, a node that is of a type that is
derived from t will pass this search criterion.
voidsetName(constSbName&n)constSbName&getName()const
Sets/returns the name of the node to search for.
voidsetFind(intwhat)intgetFind()
Sets/returns what to look for; what is a bitmask of LookFor enum values. Default is no flags at all.
Note that setting a node, type, and/or name to search for activates the relevant flag, so you may
never need to call this method directly.
voidsetInterest(Interestinterest)InterestgetInterest()const
Sets/returns which paths to return. Default is FIRST.
voidsetSearchingAll(SbBoolflag)SbBoolisSearchingAll()const
Sets/returns whether searching uses regular traversal or whether it traverses every single node. For
example, if this flag is FALSE, an SoSwitch node will traverse only the child or children it would
normally traverse for an action. If the flag is TRUE, the switch would always traverse all of its
children. The default is FALSE.
SoPath*getPath()const
Returns resulting path, or NULL if no path was found. This should be used if the interest is FIRST or
LAST.
SoPathList&getPaths()
Returns resulting path list. This should be used if the interest is ALL.
voidreset()
Resets options back to default values; clears list of returned paths. This can be used to apply the
action again with a different set of search criteria.
Name
SoSearchAction — searches for nodes in a scene graph
See Also
SoPath,SoBaseKitSoSearchAction(3IV)()
Synopsis
#include<Inventor/actions/SoSearchAction.h>enumLookFor{SoSearchAction::NODE Search for a particular node (by pointer)
SoSearchAction::TYPE Search for a particular type of node
SoSearchAction::NAME Search for a node with a particular name
}enumInterest{SoSearchAction::FIRST Return only the first path found
SoSearchAction::LAST Return only the last path found
SoSearchAction::ALL Return all paths found
}
Methods from class SoSearchAction:
SoSearchAction()voidsetNode(SoNode*n)SoNode*getNode()constvoidsetType(SoTypet,SbBoolderivedIsOk=TRUE)SoTypegetType(SbBool&derivedIsOk)constvoidsetName(constSbName&n)constSbName&getName()constvoidsetFind(intwhat)intgetFind()voidsetInterest(Interestinterest)InterestgetInterest()constvoidsetSearchingAll(SbBoolflag)SbBoolisSearchingAll()constSoPath*getPath()constSoPathList&getPaths()voidreset()
Methods from class SoAction:
virtualvoidapply(SoNode*node)virtualvoidapply(SoPath*path)virtualvoidapply(constSoPathList&pathList,SbBoolobeysRules=FALSE)staticSoTypegetClassTypeId()virtualSoTypegetTypeId()virtualSbBoolisOfType(SoTypetype)virtualvoidinvalidateState()