Getting a node’s attribute type and contents
 
 
 

Most nodes have a pointer to a scene element, e.g., a camera, light, mesh, or NURBS, which is the “contents” of the node. The data for these scene elements are stored as objects of the appropriate class, KFbxCamera, KFbxLight, etc.

These classes are called node attributes, and are subclasses of Class KFbxNodeAttribute:

Each node has a attribute type (pNode->GetNodeAttribute()), whose value is either:

If the node attribute is notnull, then you can get from the node attribute object its attribute type(enum eAttributeType).

NoteClass KFbxNull is used to create node attribute objects representing a “null” node in the tree. These objects are used by software that need to represent a null node. A pointer to a null object is not the same asnull.

Here is how SceneTreeView creates the string that contains the name of the node and the attribute type (two of the properties that belong to all node attributes):

KString GetNodeNameAndAttributeTypeName(const KFbxNode* pNode)
{
 KString s = pNode->GetName();
 KFbxNodeAttribute::EAttributeType lAttributeType;
 if(pNode->GetNodeAttribute() == NULL)
 {
 s += " (No node attribute type)";
 }
 else
 {
 lAttributeType = (pNode->GetNodeAttribute()->GetAttributeType());
 switch (lAttributeType)
 {
 case KFbxNodeAttribute::eMARKER:
 s += " (Marker)";
 break;
 case KFbxNodeAttribute::eSKELETON:
 s += " (Skeleton)";
 break;
 case KFbxNodeAttribute::eMESH:
 s += " (Mesh)";
 break;
 case KFbxNodeAttribute::eCAMERA:
 s += " (Camera)";
 break;
 case KFbxNodeAttribute::eLIGHT:
 s += " (Light)";
 break;
 ...
 case KFbxNodeAttribute::eTRIM_NURBS_SURFACE:
 s += " (Trim nurbs surface)";
 break;
 case KFbxNodeAttribute::eUNIDENTIFIED:
 s += " (Unidentified)";
 break;
 }
 }
 return s;
}

To access properties of a node attribute object that are specific to it being a camera, a NURBS, a light, etc., you can write similar code to cast the object to its appropriate class. This allows you to call all the get and set methods for that class.