diff options
Diffstat (limited to 'source/blender/collada/collada_internal.cpp')
-rw-r--r-- | source/blender/collada/collada_internal.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index a0b9f8d4e38..64de0596ac5 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -30,6 +30,7 @@ #include "collada_utils.h" #include "BLI_linklist.h" +#include "ED_armature.h" UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) { @@ -310,6 +311,33 @@ std::string id_name(void *id) return ((ID *)id)->name + 2; } +std::string encode_xml(std::string xml) +{ + const std::map<char, std::string> escape { + {'<' , "<" }, + {'>' , ">" }, + {'"' , """}, + {'\'', "'"}, + {'&' , "&" } + }; + + std::map<char, std::string>::const_iterator it; + std::string encoded_xml = ""; + + for (unsigned int i = 0; i < xml.size(); i++) { + char c = xml.at(i); + it = escape.find(c); + + if (it == escape.end()) { + encoded_xml += c; + } + else { + encoded_xml += it->second; + } + } + return encoded_xml; +} + std::string get_geometry_id(Object *ob) { return translate_id(id_name(ob->data)) + "-mesh"; @@ -327,12 +355,11 @@ std::string get_light_id(Object *ob) return translate_id(id_name(ob)) + "-light"; } -std::string get_joint_id(Object *ob, Bone *bone) +std::string get_joint_sid(Bone *bone) { - return translate_id(id_name(ob) + "_" + bone->name); + return translate_id(bone->name); } - -std::string get_joint_sid(Bone *bone) +std::string get_joint_sid(EditBone *bone) { return translate_id(bone->name); } @@ -342,6 +369,11 @@ std::string get_camera_id(Object *ob) return translate_id(id_name(ob)) + "-camera"; } +std::string get_effect_id(Material *mat) +{ + return translate_id(id_name(mat)) + "-effect"; +} + std::string get_material_id(Material *mat) { return translate_id(id_name(mat)) + "-material"; |