Explicit handling of an FBXExportNode edge-case.

pull/1858/head
Tommy 2018-03-28 16:09:07 +02:00
parent 00277d93f2
commit aadb413fc0
3 changed files with 9 additions and 11 deletions

View File

@ -168,7 +168,7 @@ void FBX::Node::Dump(Assimp::StreamWriterLE &s)
DumpChildren(s);
// finish, filling in end offset placeholder
End(s, !children.empty());
End(s, force_has_children || !children.empty());
}
void FBX::Node::Begin(Assimp::StreamWriterLE &s)

View File

@ -66,6 +66,9 @@ public: // public data members
std::vector<FBX::Property> properties; // node properties
std::vector<FBX::Node> children; // child nodes
// some nodes always pretend they have children...
bool force_has_children = false;
public: // constructors
Node() = default;
Node(const std::string& n) : name(n) {}

View File

@ -419,6 +419,7 @@ void FBXExporter::WriteReferences ()
// always empty for now.
// not really sure what this is for.
FBX::Node n("References");
n.force_has_children = true;
n.Dump(outfile);
}
@ -1914,11 +1915,8 @@ void FBXExporter::WriteObjects ()
// this node absurdly always pretends it has children
// (in this case it does, but just in case...)
asnode.Begin(outstream);
asnode.DumpProperties(outstream);
asnode.EndProperties(outstream);
asnode.DumpChildren(outstream);
asnode.End(outstream, true);
asnode.force_has_children = true;
asnode.Dump(outstream);
// note: animation stacks are not connected to anything
}
@ -1932,11 +1930,8 @@ void FBXExporter::WriteObjects ()
alnode.AddProperties(animlayer_uid, FBX::SEPARATOR + "AnimLayer", "");
// this node absurdly always pretends it has children
alnode.Begin(outstream);
alnode.DumpProperties(outstream);
alnode.EndProperties(outstream);
alnode.DumpChildren(outstream);
alnode.End(outstream, true);
alnode.force_has_children = true;
alnode.Dump(outstream);
// connect to the relevant animstack
connections.emplace_back(