Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArystanbek Dyussenov <arystan.d@gmail.com>2010-09-09 12:14:36 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2010-09-09 12:14:36 +0400
commitad48fd1db981ca9f9e9e02a5f1f4c136740ae877 (patch)
tree5f5be96df4e423e5d31e09740450806e719d7d49 /source/blender/collada/DocumentExporter.cpp
parenta755f9f7ede2e60afa964460e00f613790bf064e (diff)
Patch by Jan Diederich, fixes bug #23715 in the COLLADA exporter.
Allow IDs to start only with an alphabetic character replacing digits with an '_'.
Diffstat (limited to 'source/blender/collada/DocumentExporter.cpp')
-rw-r--r--source/blender/collada/DocumentExporter.cpp107
1 files changed, 72 insertions, 35 deletions
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 72f280d7ce2..ae00942b89d 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -162,47 +162,84 @@ like special chars (e.g. micro sign), umlauts and so on.
The COLLADA spec also allows additional chars for member access ('.'), these
must obviously be removed too, otherwise they would be heavily misinterpreted.
*/
-const unsigned char translate_map[256] = {
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 45, 95, 95,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 95, 95, 95, 95, 95, 95,
- 95, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 95, 95, 95, 95, 95,
- 95, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 183,
- 95, 95, 95, 95, 95, 95, 95, 95,
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 95,
- 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 95,
- 248, 249, 250, 251, 252, 253, 254, 255};
+const unsigned char translate_start_name_map[256] = {
+95, 95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+65, 66, 67, 68, 69, 70, 71, 72,
+73, 74, 75, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88,
+89, 90, 95, 95, 95, 95, 95, 95,
+97, 98, 99, 100, 101, 102, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112,
+113, 114, 115, 116, 117, 118, 119, 120,
+121, 122, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 192,
+193, 194, 195, 196, 197, 198, 199, 200,
+201, 202, 203, 204, 205, 206, 207, 208,
+209, 210, 211, 212, 213, 214, 95, 216,
+217, 218, 219, 220, 221, 222, 223, 224,
+225, 226, 227, 228, 229, 230, 231, 232,
+233, 234, 235, 236, 237, 238, 239, 240,
+241, 242, 243, 244, 245, 246, 95, 248,
+249, 250, 251, 252, 253, 254, 255};
+
+const unsigned char translate_name_map[256] = {
+95, 95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 45, 95, 95, 48,
+49, 50, 51, 52, 53, 54, 55, 56,
+57, 95, 95, 95, 95, 95, 95, 95,
+65, 66, 67, 68, 69, 70, 71, 72,
+73, 74, 75, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88,
+89, 90, 95, 95, 95, 95, 95, 95,
+97, 98, 99, 100, 101, 102, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112,
+113, 114, 115, 116, 117, 118, 119, 120,
+121, 122, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 183, 95,
+95, 95, 95, 95, 95, 95, 95, 192,
+193, 194, 195, 196, 197, 198, 199, 200,
+201, 202, 203, 204, 205, 206, 207, 208,
+209, 210, 211, 212, 213, 214, 95, 216,
+217, 218, 219, 220, 221, 222, 223, 224,
+225, 226, 227, 228, 229, 230, 231, 232,
+233, 234, 235, 236, 237, 238, 239, 240,
+241, 242, 243, 244, 245, 246, 95, 248,
+249, 250, 251, 252, 253, 254, 255};
/** Look at documentation of translate_map */
static std::string translate_id(const std::string &id)
{
+ if (id.size() == 0)
+ { return id; }
std::string id_translated = id;
- for (unsigned int i=0; i < id_translated.size(); i++)
+ id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]];
+ for (unsigned int i=1; i < id_translated.size(); i++)
{
- id_translated[i] = translate_map[(unsigned int)id_translated[i]];
+ id_translated[i] = translate_name_map[(unsigned int)id_translated[i]];
}
return id_translated;
}