3DS, COB, SMD: Empty mChildren should be null
Leave as null when no childrenpull/5749/head
parent
335adbcf1a
commit
b273332f01
|
@ -643,11 +643,17 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene *pcSOut, aiNode *pcOut,
|
|||
}
|
||||
|
||||
// Allocate storage for children
|
||||
pcOut->mNumChildren = (unsigned int)pcIn->mChildren.size();
|
||||
const unsigned int size = static_cast<unsigned int>(pcIn->mChildren.size());
|
||||
|
||||
pcOut->mNumChildren = size;
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
pcOut->mChildren = new aiNode *[pcIn->mChildren.size()];
|
||||
|
||||
// Recursively process all children
|
||||
const unsigned int size = static_cast<unsigned int>(pcIn->mChildren.size());
|
||||
|
||||
for (unsigned int i = 0; i < size; ++i) {
|
||||
pcOut->mChildren[i] = new aiNode();
|
||||
pcOut->mChildren[i]->mParent = pcOut;
|
||||
|
|
|
@ -372,9 +372,11 @@ aiNode *COBImporter::BuildNodes(const Node &root, const Scene &scin, aiScene *fi
|
|||
}
|
||||
|
||||
// add children recursively
|
||||
nd->mChildren = new aiNode *[root.temp_children.size()]();
|
||||
for (const Node *n : root.temp_children) {
|
||||
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n, scin, fill))->mParent = nd;
|
||||
if (!root.temp_children.empty()) {
|
||||
nd->mChildren = new aiNode *[root.temp_children.size()]();
|
||||
for (const Node *n : root.temp_children) {
|
||||
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n, scin, fill))->mParent = nd;
|
||||
}
|
||||
}
|
||||
|
||||
return nd;
|
||||
|
|
|
@ -400,8 +400,12 @@ void SMDImporter::AddBoneChildren(aiNode* pcNode, uint32_t iParent) {
|
|||
}
|
||||
}
|
||||
|
||||
// nothing to do
|
||||
if (pcNode->mNumChildren == 0)
|
||||
return;
|
||||
|
||||
// now allocate the output array
|
||||
pcNode->mChildren = new aiNode*[pcNode->mNumChildren];
|
||||
pcNode->mChildren = new aiNode *[pcNode->mNumChildren];
|
||||
|
||||
// and fill all subnodes
|
||||
unsigned int qq( 0 );
|
||||
|
|
Loading…
Reference in New Issue