further work on http://sourceforge.net/tracker/index.php?func=detail&aid=3054873&group_id=226462&atid=1067632 - first try the old node resolving algorithm (which checks for node IDs), if this fails switch to a workaround which takes both node names and IDs into account.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@815 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
e440fb2769
commit
bd4a4fd608
|
@ -185,7 +185,7 @@ aiNode* ColladaLoader::BuildHierarchy( const ColladaParser& pParser, const Colla
|
|||
node->mTransformation = pParser.CalculateResultTransform( pNode->mTransforms);
|
||||
|
||||
// now resolve node instances
|
||||
std::vector<Collada::Node*> instances;
|
||||
std::vector<const Collada::Node*> instances;
|
||||
ResolveNodeInstances(pParser,pNode,instances);
|
||||
|
||||
// add children. first the *real* ones
|
||||
|
@ -219,7 +219,7 @@ aiNode* ColladaLoader::BuildHierarchy( const ColladaParser& pParser, const Colla
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Resolve node instances
|
||||
void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Collada::Node* pNode,
|
||||
std::vector<Collada::Node*>& resolved)
|
||||
std::vector<const Collada::Node*>& resolved)
|
||||
{
|
||||
// reserve enough storage
|
||||
resolved.reserve(pNode->mNodeInstances.size());
|
||||
|
@ -229,12 +229,15 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
|
|||
end = pNode->mNodeInstances.end(); it != end; ++it)
|
||||
{
|
||||
// find the corresponding node in the library
|
||||
const ColladaParser::NodeLibrary::const_iterator itt = pParser.mNodeLibrary.find((*it).mNode);
|
||||
Collada::Node* nd = itt == pParser.mNodeLibrary.end() ? NULL : (*itt).second;
|
||||
|
||||
// FIX for http://sourceforge.net/tracker/?func=detail&aid=3054873&group_id=226462&atid=1067632
|
||||
// need to check for both name and ID to catch all. The const_cast is legal
|
||||
// because we won't attempt to modify the instanced node although it is kept
|
||||
// non-const.
|
||||
Collada::Node* nd = const_cast<Collada::Node*>(FindNode(pParser.mRootNode,(*it).mNode));
|
||||
// need to check for both name and ID to catch all. To avoid breaking valid files,
|
||||
// the workaround is only enabled when the first attempt to resolve the node has failed.
|
||||
if (!nd) {
|
||||
nd = const_cast<Collada::Node*>(FindNode(pParser.mRootNode,(*it).mNode));
|
||||
}
|
||||
if (!nd)
|
||||
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ protected:
|
|||
|
||||
/** Resolve node instances */
|
||||
void ResolveNodeInstances( const ColladaParser& pParser, const Collada::Node* pNode,
|
||||
std::vector<Collada::Node*>& resolved);
|
||||
std::vector<const Collada::Node*>& resolved);
|
||||
|
||||
/** Builds meshes for the given node and references them */
|
||||
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
|
||||
|
|
|
@ -1,38 +1,13 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpview", "assimp_view.vcproj", "{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
|
||||
EndProjectSection
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpview", "assimp_view.vcxproj", "{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp", "assimp.vcproj", "{5691E159-2D9B-407F-971F-EA5C592DC524}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp", "assimp.vcxproj", "{5691E159-2D9B-407F-971F-EA5C592DC524}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "UnitTest.vcproj", "{9B9D1C90-8A03-409A-B547-AE7B48B90F1A}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
|
||||
EndProjectSection
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "UnitTest.vcxproj", "{9B9D1C90-8A03-409A-B547-AE7B48B90F1A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp_cmd", "assimp_cmd.vcproj", "{7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524}
|
||||
EndProjectSection
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpcmd", "assimp_cmd.vcxproj", "{7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
Loading…
Reference in New Issue