MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ProcessNodes

Function ProcessNodes

Source/Engine/Tools/ModelTool/ModelTool.OpenFBX.cpp:377–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375};
376
377void ProcessNodes(OpenFbxImporterData& data, const ofbx::Object* aNode, int32 parentIndex)
378{
379 const int32 nodeIndex = data.Nodes.Count();
380
381 // Create node
382 FbxNode node;
383 node.ParentIndex = parentIndex;
384 node.Name = aNode->name;
385 node.FbxObj = aNode;
386
387 // Pick node LOD index
388 if (parentIndex == -1 || !data.Options.ImportLODs)
389 {
390 node.LodIndex = 0;
391 }
392 else
393 {
394 node.LodIndex = data.Nodes[parentIndex].LodIndex;
395 if (node.LodIndex == 0)
396 node.LodIndex = ModelTool::DetectLodIndex(node.Name);
397 ASSERT(Math::IsInRange(node.LodIndex, 0, MODEL_MAX_LODS - 1));
398 }
399
400 auto transform = ToMatrix(aNode->evalLocal(aNode->getLocalTranslation(), aNode->getLocalRotation()));
401#if OPEN_FBX_CONVERT_SPACE
402 if (data.ConvertRH)
403 {
404 // Mirror all base vectors at the local Z axis
405 transform.M31 = -transform.M31;
406 transform.M32 = -transform.M32;
407 transform.M33 = -transform.M33;
408 transform.M34 = -transform.M34;
409
410 // Now invert the Z axis again to keep the matrix determinant positive
411 // The local meshes will be inverted accordingly so that the result should look just fine again
412 transform.M13 = -transform.M13;
413 transform.M23 = -transform.M23;
414 transform.M33 = -transform.M33;
415 transform.M43 = -transform.M43;
416 }
417#endif
418 transform.Decompose(node.LocalTransform);
419 if (data.Options.IgnoreNodesScale)
420 node.LocalTransform.Scale = Float3::One;
421 data.Nodes.Add(node);
422
423 // Process the children
424 int i = 0;
425 while (ofbx::Object* child = aNode->resolveObjectLink(i))
426 {
427 if (child->isNode())
428 ProcessNodes(data, child, nodeIndex);
429 i++;
430 }
431}
432
433Matrix GetOffsetMatrix(OpenFbxImporterData& data, const ofbx::Mesh* mesh, const ofbx::Object* node)
434{

Callers 1

ImportDataOpenFBXMethod · 0.70

Calls 10

IsInRangeFunction · 0.85
evalLocalMethod · 0.80
getLocalTranslationMethod · 0.80
getLocalRotationMethod · 0.80
isNodeMethod · 0.80
ToMatrixFunction · 0.70
CountMethod · 0.45
DecomposeMethod · 0.45
AddMethod · 0.45
resolveObjectLinkMethod · 0.45

Tested by

no test coverage detected