diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index a3516f9c4..959a905ae 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -131,6 +131,7 @@ void ColladaLoader::SetupProperties(const Importer* pImp) { noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0; ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION,0) != 0; + useColladaName = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES,0) != 0; } // ------------------------------------------------------------------------------------------------ @@ -1913,6 +1914,11 @@ const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, c // The name must be unique for proper node-bone association. std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode) { + // If explicitly requested, just use the collada name. + if (useColladaName) { + return pNode->mName; + } + // Now setup the name of the assimp node. The collada name might not be // unique, so we use the collada ID. if (!pNode->mID.empty()) diff --git a/code/ColladaLoader.h b/code/ColladaLoader.h index c63bf2945..d61845b24 100644 --- a/code/ColladaLoader.h +++ b/code/ColladaLoader.h @@ -248,6 +248,7 @@ protected: bool noSkeletonMesh; bool ignoreUpDirection; + bool useColladaName; /** Used by FindNameForNode() to generate unique node names */ unsigned int mNodeNameCounter; diff --git a/include/assimp/config.h.in b/include/assimp/config.h.in index 071d58cd2..c9555fb38 100644 --- a/include/assimp/config.h.in +++ b/include/assimp/config.h.in @@ -934,6 +934,16 @@ enum aiComponent */ #define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION" +// --------------------------------------------------------------------------- +/** @brief Specifies whether the Collada loader should use Collada names as node names. + * + * If this property is set to true, the Collada names will be used as the + * node name. The default is to use the id tag (resp. sid tag, if no id tag is present) + * instead. + * Property type: Bool. Default value: false. + */ +#define AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES "IMPORT_COLLADA_USE_COLLADA_NAMES" + // ---------- All the Export defines ------------ /** @brief Specifies the xfile use double for real values of float