Merge branch 'master' into fix-5738

pull/5743/head
Kim Kulling 2024-09-03 23:54:07 +02:00 committed by GitHub
commit cedd857a7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 31 additions and 13 deletions

View File

@ -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;

View File

@ -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;

View File

@ -357,12 +357,12 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
if (nodes.empty()) {
parent->mNumChildren = 0;
parent->mChildren = nullptr;
}
parent->mChildren = new aiNode *[nodes.size()]();
parent->mNumChildren = static_cast<unsigned int>(nodes.size());
for (unsigned int i = 0; i < nodes.size(); ++i) {
parent->mChildren[i] = nodes[i].mOwnership.release();
} else {
parent->mChildren = new aiNode *[nodes.size()]();
parent->mNumChildren = static_cast<unsigned int>(nodes.size());
for (unsigned int i = 0; i < nodes.size(); ++i) {
parent->mChildren[i] = nodes[i].mOwnership.release();
}
}
}

View File

@ -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 );

View File

@ -1053,7 +1053,7 @@ ENDIF() # IF (ASSIMP_BUILD_USD_IMPORTER)
IF(ASSIMP_HUNTER_ENABLED)
hunter_add_package(pugixml)
find_package(pugixml CONFIG REQUIRED)
ELSE()
ELSEIF(NOT TARGET pugixml::pugixml)
SET( Pugixml_SRCS
../contrib/pugixml/src/pugiconfig.hpp
../contrib/pugixml/src/pugixml.hpp
@ -1439,6 +1439,9 @@ ELSE()
if (ASSIMP_BUILD_DRACO)
target_link_libraries(assimp ${draco_LIBRARIES})
endif()
if(TARGET pugixml::pugixml)
target_link_libraries(assimp pugixml::pugixml)
endif()
ENDIF()
if(ASSIMP_ANDROID_JNIIOSYSTEM)

View File

@ -891,6 +891,9 @@ void ValidateDSProcess::Validate(const aiNode *pNode) {
ReportError("aiNode \"%s\" child %i \"%s\" parent is someone else: \"%s\"", pNode->mName.C_Str(), i, pChild->mName.C_Str(), parentName);
}
}
} else if (pNode->mChildren) {
ReportError("aiNode::mChildren is not nullptr for empty node %s (aiNode::mNumChildren is %i)",
nodeName, pNode->mNumChildren);
}
}