diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 26d41862d..95c41042a 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -73,7 +73,7 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer ColladaLoader::ColladaLoader() -: noSkeletonMesh(), ignoreUpDirection(false) +: noSkeletonMesh(), ignoreUpDirection(false), mNodeNameCounter() {} // ------------------------------------------------------------------------------------------------ @@ -1543,7 +1543,7 @@ const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, c // ------------------------------------------------------------------------------------------------ // Finds a proper name for a node derived from the collada-node's properties -std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode) const +std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode) { // now setup the name of the node. We take the name if not empty, otherwise the collada ID // FIX: Workaround for XSI calling the instanced visual scene 'untitled' by default. @@ -1557,7 +1557,7 @@ std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode) const { // No need to worry. Unnamed nodes are no problem at all, except // if cameras or lights need to be assigned to them. - return boost::str( boost::format( "$ColladaAutoName$_%d") % clock()); + return boost::str( boost::format( "$ColladaAutoName$_%d") % mNodeNameCounter++); } } diff --git a/code/ColladaLoader.h b/code/ColladaLoader.h index 953bd20b8..392c8f359 100644 --- a/code/ColladaLoader.h +++ b/code/ColladaLoader.h @@ -203,7 +203,7 @@ protected: const Collada::Node* FindNodeBySID( const Collada::Node* pNode, const std::string& pSID) const; /** Finds a proper name for a node derived from the collada-node's properties */ - std::string FindNameForNode( const Collada::Node* pNode) const; + std::string FindNameForNode( const Collada::Node* pNode); protected: /** Filename, for a verbose error message */ @@ -235,6 +235,9 @@ protected: bool noSkeletonMesh; bool ignoreUpDirection; + + /** Used by FindNameForNode() to generate unique node names */ + unsigned int mNodeNameCounter; }; } // end of namespace Assimp