table of contents
other sections
SoBaseKit(3IV)() | SoBaseKit(3IV)() |
NAME¶
SoBaseKit — base class for all node kitsINHERITS FROM¶
SoBase > SoFieldContainer > SoNode > SoBaseKitSYNOPSIS¶
#include <Inventor/nodekits/SoBaseKit.h>Parts from class SoBaseKit:
(SoNodeKitListPart) callbackList
Methods from class SoBaseKit:
SoBaseKit()
static const SoNodekitCatalog * getClassNodekitCatalog () const
virtual const SoNodekitCatalog * getNodekitCatalog() const
virtual SoNode * getPart(const SbName &partName, SbBool makeIfNeeded)
SbString getPartString(const SoBase *part)
virtual SoNodeKitPath * createPathToPart(const SbName &partName, SbBool makeIfNeeded, const SoPath *pathToExtend = NULL)
virtual SbBool setPart(const SbName &partName, SoNode *newPart)
SbBool set(char *partName, char *parameters)
SbBool set(char *nameValuePairs)
static SbBool isSearchingChildren()
static void setSearchingChildren(SbBool newVal)
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)
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
Macros from class SoBaseKit:
DESCRIPTION¶
This is the base class from which all nodekit nodes are derived. Nodekits provide a convenient mechanism for creating groups of scene graph nodes with some larger meaning. When you create a shape node such as an indexed face set, for example, you almost always precede it with a coordinate node. You may also want to add a transform node or specify properties with material, drawing style, material binding, etc. Instead of creating each of these nodes individually and then arranging them into a subgraph, you can use a nodekit of the appropriate type (in this case, SoShapeKit).PARTS¶
(SoNodeKitListPart) callbackList
This is the only part that the base class SoBaseKit creates. It is a public part that is inherited by all nodekits. It provides an easy way to add callbacks for a nodekit to use during action traversal (e.g. SoHandleEventAction). It is a list part and may contain numerous SoCallback and/or SoEventCallback nodes.
METHODS¶
SoBaseKit()
Constructor.
static const SoNodekitCatalog * getClassNodekitCatalog () const
Returns the SoNodekitCatalog for the class SoBaseKit.
virtual const SoNodekitCatalog * getNodekitCatalog() const
Returns the SoNodekitCatalog for this instance of SoBaseKit. While each instance of a given class creates its own distinct set of parts (which are actual nodes), all instances share the same catalog (which describes the parts but contains no actual node pointers).
virtual SoNode * getPart(const SbName &partName, SbBool makeIfNeeded)
Searches the nodekit catalog (and those of all nested nodekits) for the part named partName. Returns a pointer to the part if a match is found, the part is public, and the part has already been built. If no match is found, or if the part is private, NULL is returned. If partName is in the catalog (or that of one of its nested nodekit parts), but the part has not been built yet, the argument makeIfNeeded determines the course of action. When makeIfNeeded is FALSE, NULL is returned; when makeIfNeeded is TRUE, getPart() will create the part (as well as any necessary intermediary parts), put it in the correct place, and return a pointer to the newly created part.
SbString getPartString(const SoBase *part)
Given a node or a path to a node, checks if the part exists in the nodekit, in a nested nodekit, or an element of a list part. If so, returns a string describing the part name; otherwise, returns an empty string ("").
virtual SoNodeKitPath * createPathToPart(const SbName &partName, SbBool makeIfNeeded, const SoPath *pathToExtend = NULL)
Returns a path that begins at this nodekit and ends at partName. Searching for the part is the same as in getPart(). NULL is returned if partName cannot be found, or if makeIfNeeded is FALSE and the part is not yet built. If the the part is retrieved and the argument pathToExtend is NULL, the path returned begins at this and ends at partName. If pathToExtend is not NULL, the path created is a copy of pathToExtend with entries appended all the way down to partName. It is okay for pathToExtend to go beyond the nodekit; extra nodes will be popped off the tail before continuing from this down to partName.
virtual SbBool setPart(const SbName &partName, SoNode *newPart)
Inserts the given node (not a copy) as the new part specified by partName. See getPart() for the syntax of partName. This method adds any extra nodes needed to fit the part into the nodekit's catalog. For example, if you call:
mySepKit->setPart("childList[0]", myNewChild);
the kit may need to create the part childList before it can install myNewChild. Run-time type checking verifies that the node type of newPart matches the type called for by partName. For example, if partName was a material for an SoSeparatorKit, but newPart was an SoTransform node, then the node would not be installed, and FALSE would be returned.
SbBool set(char *partName, char *parameters)
SbBool set(char *nameValuePairs)
These functions allow field values of parts (nodes) to be set. If partName and parameters are used, then a single part is specified by partName; the field values are specified in parameters. The format of paramaters is the Inventor File Format syntax. For example,
mySepKit->set("material", "diffuseColor 1 0 0 shininess 0.6");
sets the part material to the values "diffuseColor 1 0 0 shininess 0.6". The values used in parameters must of course be appropriate for the node-type to which partName belongs. In this case, the nodekit SoSeparatorKit has a part named material which is of type SoMaterial.
mySepKit->set("material { diffuseColor 1 1 1 } transform { translation 4 3 .6 }"); mySepKit->set("childList[0].material { ambientColor .5 .5 .5 }");
static SbBool isSearchingChildren()
static void setSearchingChildren(SbBool newVal)
Sets and queries if nodekit children are searched during SoSearchAction traversal. By default, they are not.
static SoType getClassTypeId()
Returns type identifier for this class.
MACROS¶
SO_GET_PART(kit, partName, partClass)Calls getPart() with makeIfNeeded set to TRUE, then casts the result to the type partClass. Note that in the debug library, this macro checks to see if the part is of type partClass, while the regular library does no type checking.
SO_CHECK_PART(kit, partName, partClass)
Calls getPart(), but with makeIfNeeded set to FALSE, then casts the result to the type partClass. Note that in the debug library, this macro checks to see if the part is of type partClass, while the regular library does no type checking.
ACTION BEHAVIOR¶
SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoHandleEventActionBehaves like an SoGroup. Traverses each child in order.
SoRayPickAction
Traverses each child in order. Then, for any pick containing the kit on its path, makes an SoNodeKitDetail as follows: Sets the "detailNodeKit" (retrievable with SoNodeKitDetail::getNodeKit()) to be a pointer to itself. Sets the "detailPart" (retrievable with SoNodeKitDetail::getPart()) to be a pointer to the kit's leaf-most part that lies on the pickPath. Sets the "detailPartName" (retrievable with SoNodeKitDetail::getPartName()) to be the partName of that part, as found in the catalog.
SoGetMatrixAction
Behaves like an SoGroup. Does nothing unless the kit is in the middle of the path chain the action is being applied to. If so, the children up to and including the next node in the chain are traversed.
SoSearchAction
First, searches itself like an SoNode. Then, checks the value of isSearchingChildren(). If TRUE, traverses the children in order. If FALSE, returns.
SoWriteAction
Begins by writing out regular fields, then writes out the parts. A nodekit does not write out its parts the way an SoGroup writes out its children. Instead, it writes each part as an SoSFNode field. First the partName is written, then the node being used for that part.
CATALOG PARTS¶
All parts | |||
NULL by | |||
Part Name | Part Type | Default Type | Default |
callbackList | NodeKitListPart | -- | yes |
Extra information for list parts from above table | ||
Part Name | Container Type | Permissible Types |
callbackList | Separator | Callback, EventCallback |
FILE FORMAT/DEFAULTS¶
BaseKit {
callbackList NULL
}