|
Hello,
I’m currently using the FBX SDK for import/export in a Software, and I’m having two issues. I joined my questions, but I can make two different post if you want.
The first one is caused by instance in a FBX file. I’m parsing recursively each nodes, but when a bones match an instantiated mesh the function GetNodeAttribute() always return NULL. I tried my file with the Scene Tree View Sample, and everything work as intended, the nodes have an attribute, eMESH, and everything is show. I’m trying to find out why my nodes are empty, but for now I still didn’t get it. Maybe you’ll have a clue ? Is there any special initialization, or parameter to set in order to view instance ?
I was using FBX SDK 2010.2, I update it to 2011.3.1 when I noticed this issue, but the result was the same on older versions.
Here is some examples of my code:
private : CModelBone ^ ProcessNode(Matrix ^ pParentAbsoluteTransform,
CModelBone ^ pPotentialParent,
KFbxNode * pFbxNode)
{
CModelBone ^ aNode = this->ProcessInformationInNode(pFbxNode,
pPotentialParent,
aNameForFbxObject);
if (aNode == nullptr)
{
return nullptr;
}
int aNum = 0;
if( 0 < pFbxNode->GetChildCount(false))
{
do
{
KFbxNode * aNodePtr = pFbxNode->GetChild(aNum);
CModelBone ^ aItem = this->ProcessNode(aResult->get_AbsoluteTransform(),
aNode,
aNodePtr);
aNum++;
}
while (aNum < pFbxNode->GetChildCount(false));
}
return aNode;
}
private: CModelBone ^ ProcessInformationInNode(KFbxNode * pFbxNode,
CModelBone ^ pParent,
String ^ pName)
{
CModelBone ^ aContent = nullptr;
if (pFbxNode->GetNodeAttribute() == NULL)
{
return gcnew CModelBone(m_GraphicEngine,Nullable<unsigned int>(),pParent);
}
KFbxNodeAttribute* aNodeAttribute = pFbxNode->GetNodeAttribute();
switch (aNodeAttribute->GetAttributeType())
{
case KFbxNodeAttribute::eCAMERA:
return CreateCamera(pFbxNode, pParent);
break;
case KFbxNodeAttribute::eNURBS_CURVE:
return aContent;
break;
case KFbxNodeAttribute::eNULL:
return gcnew CModelBone(m_GraphicEngine,Nullable<unsigned int>(),pParent);
break;
case KFbxNodeAttribute::eMESH:
return this->m_MeshConverter->FillNodeWithInfoFromMesh(pFbxNode,
pName,
this->m_pFBXGeometryConverter);
break;
default:
{
return aContent;
}
}
return nullptr;
}
pFbxNode->GetNodeAttribute() is always null when the mesh is an instance. I’ll join my test file as an attachment. It was made with the cube creator sample, modified to create new cubes as instance.
My second issue happen when importing FBX files from revit, with family. For example, for a wall with windows, each window will be a single object, without material, and without distinctions between wood and glasses for example. Whereas other materials works fine when coming from other software, even multi materials from 3DSMAX. You’ll find a FBX File from Revit attached to this post.
Is there anything special to do for Revit’s files ? How can I get materials informations from Revit ?
Thanks for any help, and sorry for my poor english.
|