Getting the attribute type and contents of a node
 
 
 

FBX node objects store the generic properties for a point in space.

The data for the “contents” of a given node—e.g., the data particular to a camera, light, mesh, or NURBS—is stored in another object. That object must be an instance of the appropriate class: KFbxCamera, KFbxLight, KFbxMesh, KFbxNURBS, etc.

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

Each node has a node attribute (KFbxNode::GetNodeAttribute()), whose value is either:

If the node attribute is not null, 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 applications that need to represent a null node in its scene graph. A pointer to a KFbxNull object is not the same as null.

Here is how SceneTreeView creates the string that contains the name of the node and the attribute type:

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::eBOUNDARY:              s += " (Boundary)";             break;
        case KFbxNodeAttribute::eTRIM_NURBS_SURFACE:    s += " (Trim nurbs surface)";   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 the methods for that class:

        ...
        case KFbxNodeAttribute::eNURB:
        DisplayNurb(pNode);
        break;
 
...
void DisplayNurb(KFbxNode* pNode)
{
    KFbxNurb* lNurb = (KFbxNurb*) pNode->GetNodeAttribute ();
    ...
    int lControlPointsCount = lNurb->GetControlPointsCount();
    KFbxVector4* lControlPoints = lNurb->GetControlPoints();