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:
authorGaia Clary <gaia.clary@machinimatrix.org>2012-06-14 14:38:39 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-06-14 14:38:39 +0400
commit05a1a3169336380b51947451ebdabdf5455fe38f (patch)
tree8b5dcfdd1bb0bbee0028d2561f300c631a4e95fe /source/blender/collada/collada_utils.cpp
parent68386ef23a2b48f4a0ece2da1d8e5f66e0ef4bf6 (diff)
Collada: Added export Option 'sort by object name' to fix an issue with Second Life import
Diffstat (limited to 'source/blender/collada/collada_utils.cpp')
-rw-r--r--source/blender/collada/collada_utils.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index f481de994a3..3d9aa8e542d 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -226,3 +226,31 @@ void bc_remove_mark(Object *ob)
{
ob->id.flag &= ~LIB_DOIT;
}
+
+// Use bubble sort algorithm for sorting the export set
+void bc_bubble_sort_by_Object_name(LinkNode *export_set)
+{
+ int i, j; // loop indices
+ bool unsorted = true;
+
+ LinkNode *current;
+ int set_size = BLI_linklist_length(export_set);
+ for(i = 0; (i < set_size) && unsorted; i++) {
+ unsorted = false;
+
+ for (current=export_set; current->next; current = current->next) {
+ Object *a = (Object *)current->link;
+ Object *b = (Object *)current->next->link;
+
+ std::string str_a (a->id.name);
+ std::string str_b (b->id.name);
+
+ if (str_a.compare(str_b) > 0) {
+ current->link = b;
+ current->next->link = a;
+ unsorted = true;
+ }
+
+ }
+ }
+} \ No newline at end of file