diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2013-03-07 14:26:04 +0400 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2013-03-07 14:26:04 +0400 |
commit | 172d624598b93590125594c84f5c97351474f3f4 (patch) | |
tree | 47888941e3805ecb416d7218778f2d860463178a | |
parent | a816b0b3d2708e9b064447cc3618ad9999be16c6 (diff) |
Collada fixed Collada ID name for exported animation curves
-rw-r--r-- | source/blender/collada/AnimationExporter.cpp | 25 | ||||
-rw-r--r-- | source/blender/collada/AnimationExporter.h | 1 | ||||
-rw-r--r-- | source/blender/collada/collada_internal.cpp | 6 | ||||
-rw-r--r-- | source/blender/collada/collada_internal.h | 1 |
4 files changed, 29 insertions, 4 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 983e0fece5f..eb125d90635 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -259,6 +259,12 @@ std::string AnimationExporter::getObjectBoneName(Object *ob, const FCurve *fcu) return id_name(ob); } +std::string AnimationExporter::getAnimationPathId(const FCurve *fcu) +{ + std::string rna_path = std::string(fcu->rna_path); + return translate_id(rna_path); +} + //convert f-curves to animation curves and write void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformName, bool is_param, Material *ma) { @@ -305,16 +311,27 @@ void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformNa //Create anim Id if (ob->type == OB_ARMATURE) { ob_name = getObjectBoneName(ob, fcu); - BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char *)translate_id(ob_name).c_str(), - transformName, axis_name); + BLI_snprintf( + anim_id, + sizeof(anim_id), + "%s_%s.%s", + (char *)translate_id(ob_name).c_str(), + (char *)translate_id(transformName).c_str(), + axis_name); } else { if (ma) ob_name = id_name(ob) + "_material"; else ob_name = id_name(ob); - BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char *)translate_id(ob_name).c_str(), - fcu->rna_path, axis_name); + + BLI_snprintf( + anim_id, + sizeof(anim_id), + "%s_%s_%s", + (char *)translate_id(ob_name).c_str(), + (char *)getAnimationPathId(fcu).c_str(), + axis_name); } openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 59c338b6b64..870814ccefd 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -184,6 +184,7 @@ protected: char *extract_transform_name(char *rna_path); std::string getObjectBoneName(Object *ob, const FCurve * fcu); + std::string getAnimationPathId(const FCurve *fcu); void getBakedPoseData(Object *obarm, int startFrame, int endFrame, bool ActionBake, bool ActionBakeFirstFrame); diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index 85f98dad437..c3df2f0dc2f 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -224,6 +224,12 @@ void clear_global_id_map() } /** Look at documentation of translate_map */ +std::string translate_id(const char *idString) +{ + std::string id = std::string(idString); + return translate_id(id); +} + std::string translate_id(const std::string &id) { if (id.size() == 0) { diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h index 7d59932bac9..2e855764f4b 100644 --- a/source/blender/collada/collada_internal.h +++ b/source/blender/collada/collada_internal.h @@ -92,6 +92,7 @@ public: extern void clear_global_id_map(); /** Look at documentation of translate_map */ extern std::string translate_id(const std::string &id); +extern std::string translate_id(const char *idString); extern std::string id_name(void *id); |