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);
|
node->mTransformation = pParser.CalculateResultTransform( pNode->mTransforms);
|
||||||
|
|
||||||
// now resolve node instances
|
// now resolve node instances
|
||||||
std::vector<Collada::Node*> instances;
|
std::vector<const Collada::Node*> instances;
|
||||||
ResolveNodeInstances(pParser,pNode,instances);
|
ResolveNodeInstances(pParser,pNode,instances);
|
||||||
|
|
||||||
// add children. first the *real* ones
|
// add children. first the *real* ones
|
||||||
|
@ -219,7 +219,7 @@ aiNode* ColladaLoader::BuildHierarchy( const ColladaParser& pParser, const Colla
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Resolve node instances
|
// Resolve node instances
|
||||||
void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Collada::Node* pNode,
|
void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Collada::Node* pNode,
|
||||||
std::vector<Collada::Node*>& resolved)
|
std::vector<const Collada::Node*>& resolved)
|
||||||
{
|
{
|
||||||
// reserve enough storage
|
// reserve enough storage
|
||||||
resolved.reserve(pNode->mNodeInstances.size());
|
resolved.reserve(pNode->mNodeInstances.size());
|
||||||
|
@ -229,12 +229,15 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
|
||||||
end = pNode->mNodeInstances.end(); it != end; ++it)
|
end = pNode->mNodeInstances.end(); it != end; ++it)
|
||||||
{
|
{
|
||||||
// find the corresponding node in the library
|
// 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
|
// 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
|
// need to check for both name and ID to catch all. To avoid breaking valid files,
|
||||||
// because we won't attempt to modify the instanced node although it is kept
|
// the workaround is only enabled when the first attempt to resolve the node has failed.
|
||||||
// non-const.
|
if (!nd) {
|
||||||
Collada::Node* nd = const_cast<Collada::Node*>(FindNode(pParser.mRootNode,(*it).mNode));
|
nd = const_cast<Collada::Node*>(FindNode(pParser.mRootNode,(*it).mNode));
|
||||||
|
}
|
||||||
if (!nd)
|
if (!nd)
|
||||||
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode);
|
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode);
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ protected:
|
||||||
|
|
||||||
/** Resolve node instances */
|
/** Resolve node instances */
|
||||||
void ResolveNodeInstances( const ColladaParser& pParser, const Collada::Node* pNode,
|
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 */
|
/** Builds meshes for the given node and references them */
|
||||||
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
|
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
|
||||||
|
|
|
@ -1,38 +1,13 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
# Visual Studio 2005
|
# Visual Studio 2010
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpview", "assimp_view.vcproj", "{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpview", "assimp_view.vcxproj", "{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
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp", "assimp.vcproj", "{5691E159-2D9B-407F-971F-EA5C592DC524}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp", "assimp.vcxproj", "{5691E159-2D9B-407F-971F-EA5C592DC524}"
|
||||||
ProjectSection(WebsiteProperties) = preProject
|
|
||||||
Debug.AspNetCompiler.Debug = "True"
|
|
||||||
Release.AspNetCompiler.Debug = "False"
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "UnitTest.vcproj", "{9B9D1C90-8A03-409A-B547-AE7B48B90F1A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "UnitTest.vcxproj", "{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
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimp_cmd", "assimp_cmd.vcproj", "{7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpcmd", "assimp_cmd.vcxproj", "{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
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
Loading…
Reference in New Issue