diff options
author | Arystanbek Dyussenov <arystan.d@gmail.com> | 2010-03-30 22:21:47 +0400 |
---|---|---|
committer | Arystanbek Dyussenov <arystan.d@gmail.com> | 2010-03-30 22:21:47 +0400 |
commit | 80f2eb9d2b3e7e034e4cfc0089d1c66ee283c688 (patch) | |
tree | 74ee7aa64f68b7e25a53a273325bc2807d602b2c /source/blender/collada/DocumentExporter.cpp | |
parent | 0d19b4167c7369cdf760a9d94298cbd08afdb558 (diff) |
Merge -c 27876 from COLLADA branch into trunk.
Diffstat (limited to 'source/blender/collada/DocumentExporter.cpp')
-rw-r--r-- | source/blender/collada/DocumentExporter.cpp | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index f90a494fd8d..03d372977de 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -1948,7 +1948,7 @@ protected: addSampler(sampler); std::string target = translate_id(ob_name) - + "/" + get_transform_sid(fcu->rna_path, -1, axis_name); + + "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true); addChannel(COLLADABU::URI(empty, sampler_id), target); closeAnimation(); @@ -2096,7 +2096,7 @@ protected: if (axis > -1) axis_name = axis_names[axis]; - std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name); + std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name, false); BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), (char*)translate_id(bone_name).c_str(), (char*)transform_sid.c_str()); @@ -2367,24 +2367,47 @@ protected: return source_id; } - std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name) + // for rotation, axis name is always appended and the value of append_axis is ignored + std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) { + std::string tm_name; + + // when given rna_path, determine tm_type from it if (rna_path) { char *name = extract_transform_name(rna_path); if (strstr(name, "rotation")) - return std::string("rotation") + std::string(axis_name) + ".ANGLE"; - else if (!strcmp(name, "location") || !strcmp(name, "scale")) - return std::string(name); + tm_type = 0; + else if (!strcmp(name, "scale")) + tm_type = 1; + else if (!strcmp(name, "location")) + tm_type = 2; + else + tm_type = -1; } - else { - if (tm_type == 0) - return std::string("rotation") + std::string(axis_name) + ".ANGLE"; + + switch (tm_type) { + case 0: + return std::string("rotation") + std::string(axis_name) + ".ANGLE"; + case 1: + tm_name = "scale"; + break; + case 2: + tm_name = "location"; + break; + default: + tm_name = ""; + break; + } + + if (tm_name.size()) { + if (append_axis) + return tm_name + std::string(".") + std::string(axis_name); else - return tm_type == 1 ? "scale" : "location"; + return tm_name; } - return NULL; + return std::string(""); } char *extract_transform_name(char *rna_path) |