| 1 |
NAME SoSearchAction SoSearchAct SO_SEARCH_ACT_ { |
| 2 |
searches for nodes in a scene graph |
| 3 |
} |
| 4 |
|
| 5 |
INCLUDE actions/SoSearchAction.h |
| 6 |
|
| 7 |
DESC { |
| 8 |
This class is used to search scene graphs for specific nodes, nodes of |
| 9 |
a specific type, nodes with a specific name, or any combination of |
| 10 |
these. It can search for just the first or last node satisfying the |
| 11 |
criteria or for all such nodes. The actions return paths to each node |
| 12 |
found. |
| 13 |
\p |
| 14 |
Note that by default nodekits do not search their children when a search |
| 15 |
action is applied. The man page for \cSoBaseKit\. discusses the methods |
| 16 |
\m\+SoBaseKit::isSearchingChildren()\.\-SoKitIsSearchingChildren()\.\. and |
| 17 |
\m\+SoBaseKit::setSearchingChildren()\.\-SoKitSetSearchingChildren()\.\., |
| 18 |
which allow you to query and control this behavior. |
| 19 |
} |
| 20 |
|
| 21 |
ENUM LookFor { |
| 22 |
NODE "Search for a particular node (by pointer)", |
| 23 |
TYPE "Search for a particular type of node", |
| 24 |
NAME "Search for a node with a particular name" |
| 25 |
} |
| 26 |
|
| 27 |
ENUM Interest { |
| 28 |
FIRST "Return only the first path found", |
| 29 |
LAST "Return only the last path found", |
| 30 |
ALL "Return all paths found" |
| 31 |
} |
| 32 |
|
| 33 |
METHOD "" SoSearchAction() { |
| 34 |
Constructor. |
| 35 |
} |
| 36 |
|
| 37 |
METHOD "" void setNode(SoNode *n) {} |
| 38 |
METHOD "" SoNode * getNode() const { |
| 39 |
Sets/returns the node to search for. |
| 40 |
} |
| 41 |
|
| 42 |
METHOD "" void setType(SoType t, SbBool derivedIsOk = TRUE) {} |
| 43 |
METHOD "" SoType getType(SbBool &derivedIsOk) const { |
| 44 |
Sets/returns the node type to search for. If \aderivedIsOk\. is TRUE, |
| 45 |
a node that is of a type that is derived from \at\. will pass this |
| 46 |
search criterion. |
| 47 |
} |
| 48 |
|
| 49 |
METHOD "" void setName(const SbName &n) {} |
| 50 |
METHOD "" const SbName & getName() const { |
| 51 |
Sets/returns the name of the node to search for. |
| 52 |
} |
| 53 |
|
| 54 |
METHOD "" void setFind(int what) {} |
| 55 |
METHOD "" int getFind() { |
| 56 |
Sets/returns what to look for; \awhat\. is a bitmask of \kLookFor\. |
| 57 |
enum values. Default is no flags at all. Note that setting a node, |
| 58 |
type, and/or name to search for activates the relevant flag, so you |
| 59 |
may never need to call this method directly. |
| 60 |
} |
| 61 |
|
| 62 |
METHOD "" void setInterest(Interest interest) {} |
| 63 |
METHOD "" Interest getInterest() const { |
| 64 |
Sets/returns which paths to return. Default is FIRST. |
| 65 |
} |
| 66 |
|
| 67 |
METHOD setSearchAll void setSearchingAll(SbBool flag) {} |
| 68 |
METHOD isSearchAll SbBool isSearchingAll() const { |
| 69 |
Sets/returns whether searching uses regular traversal or whether it |
| 70 |
traverses every single node. For example, if this flag is FALSE, an |
| 71 |
\cSoSwitch\. node will traverse only the child or children it would |
| 72 |
normally traverse for an action. If the flag is TRUE, the switch would |
| 73 |
always traverse all of its children. The default is FALSE. |
| 74 |
} |
| 75 |
|
| 76 |
METHOD "" SoPath * getPath() const { |
| 77 |
Returns resulting path, or NULL if no path was found. This should be |
| 78 |
used if the interest is FIRST or LAST. |
| 79 |
} |
| 80 |
|
| 81 |
METHOD "" SoPathList & getPaths() { |
| 82 |
Returns resulting path list. This should be used if the interest is ALL. |
| 83 |
} |
| 84 |
|
| 85 |
METHOD "" void reset() { |
| 86 |
Resets options back to default values; clears list of returned paths. |
| 87 |
This can be used to apply the action again with a different set of |
| 88 |
search criteria. |
| 89 |
} |
| 90 |
|
| 91 |
ALSO { SoPath, SoBaseKit } |