Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / How to read MotionBuilder Groups with FBX SDK
  RSS 2.0 ATOM  

How to read MotionBuilder Groups with FBX SDK
Rate this thread
 
35345
 
Permlink of this thread   Subscribe to this thread
avatar
  • Total Posts: 7
  • Joined: 17 July 2008 01:19 PM

Hello,

I need to be able to read the groups defined in MotionBuilder from a .fbx file (see attached screenshot). I cannot find that information in the FBX SDK documentation.

I tried looping trough all the member in the scene like:

for(int i 0pFbxScene->GetMemberCount() i++)
{
  KFbxObject
member pFbxScene->GetMember(i)
  if(namedLike(
"xxx"member))
  { 
//its a group
  
}
}

and it looks like the groups nodes are defined as KFbxTakeNodeContainer but I cannot find ways to recursively access its children.

Any idea how to solve this?

Cheers



Replies: 0
avatar

Hi nazcaspider,
Sorry, currently, FBX SDK doesn’t support the group of Motion builder:(
Thank you for your info, and we’ll follow up the issue.



Zhihao, Data Platform - Autodesk

Replies: 0
avatar

Hi nazcaspider, if you are using FBX SDK 2010.2, then there is a workaround for you.
Since 2010.2, we introduced the concept of “Selection Set”, which is equivalent to “Group” in MotionBuilder.
So basically, if you can make sure the KFbxObject is a “Group”, then you can cast it and call KFbxSelectionSet::GetSelectionNodesAndDirectObjects to get the members of this group.
Something like this:

for(int i 0pFbxScene->GetMemberCount() i++)
{
    KFbxObject
member pFbxScene->GetMember(i)
    if(namedLike(
"xxx"member))
    { 
//its a group
        
KArrayTemplate<KFbxSelectionNode*> lSelectionNodeList;
        
KArrayTemplate<KFbxObject*> lDirectObjectList;
        
((KFbxSelectionSet)lObject)->GetSelectionNodesAndDirectObjects(lSelectionNodeListlDirectObjectList)

        int lCount 
lDirectObjectList.GetCount()
        for(int j 
0lCountj++)
        {
            KFbxObject
lChildObject lDirectObjectList[j];
        
}
    }
}

“Group” in MotionBuilder is only object-level, so you only need to take care of lDirectObjectList.
You do not need to consider lSelectionNodeList, which is only useful when there are component-level (vertex, edge of face) selection.



Jiayang Xu
Maya Data Platform
Autodesk

Replies: 1
/img/forum/dark/default_avatar.png

Great that’s exactly what I need.

I found a way to discover if a KFbxObject is a Group by using the runtime type name; if so I then cast to KFbxSelectionSet as you explained:

void ProcessGroups(const KFbxScenepScene)
{
  for(int i 
0pScene->GetMemberCount() i++)
  {
    KFbxObject
pMember =  pScene->GetMember(i)
    if(IsGroup(pMember))
    {
      KArrayTemplate
<KFbxSelectionNode*> selectionNodeList;
      
KArrayTemplate<KFbxObject*> directObjectList;
      
((KFbxSelectionSet)pMember)->GetSelectionNodesAndDirectObjects(selectionNodeListdirectObjectList)
      ProcessChildren(directObjectList)
    }
  }
}


bool IsGroup(const KFbxObject
pObject)
{
  kFbxClassId runClassId 
pObject->GetRuntimeClassId()
  
const charrunClassName runClassId.GetName()
  if(
!strcmp(runClassName"GroupSelection_Default"))
    
return true;

  return 
false;
}

Thanks a lot

Author: nazcaspider

Replied: 13 October 2009 02:27 AM  




   
  Settings Choose Theme color: