[Bf-blender-cvs] [1fc322125da] soc-2020-outliner: Cleanup: Remove unused tree sort code
Nathan Craddock
noreply at git.blender.org
Tue Aug 18 23:51:42 CEST 2020
Commit: 1fc322125da623a205e077b3d00eaf6a9ba12915
Author: Nathan Craddock
Date: Tue Aug 18 15:01:04 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB1fc322125da623a205e077b3d00eaf6a9ba12915
Cleanup: Remove unused tree sort code
No functional changes
===================================================================
M source/blender/editors/space_outliner/outliner_tree.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 08da7d920c4..d21be1413e1 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1872,118 +1872,6 @@ static int treesort_type(const void *v1, const void *v2)
}
}
-/* this is nice option for later? doesn't look too useful... */
-#if 0
-static int treesort_obtype_alpha(const void *v1, const void *v2)
-{
- const tTreeSort *x1 = v1, *x2 = v2;
-
- /* first put objects last (hierarchy) */
- if (x1->idcode == ID_OB && x2->idcode != ID_OB) {
- return 1;
- }
- else if (x2->idcode == ID_OB && x1->idcode != ID_OB) {
- return -1;
- }
- else {
- /* 2nd we check ob type */
- if (x1->idcode == ID_OB && x2->idcode == ID_OB) {
- if (((Object *)x1->id)->type > ((Object *)x2->id)->type) {
- return 1;
- }
- else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) {
- return -1;
- }
- else {
- return 0;
- }
- }
- else {
- int comp = BLI_strcasecmp_natural(x1->name, x2->name);
-
- if (comp > 0) {
- return 1;
- }
- else if (comp < 0) {
- return -1;
- }
- return 0;
- }
- }
-}
-#endif
-
-/* TODO (Nathan): Why have I kept this around? */
-/* sort happens on each subtree individual */
-static void outliner_sort(ListBase *lb)
-{
- TreeElement *te;
- TreeStoreElem *tselem;
-
- te = lb->last;
- if (te == NULL) {
- return;
- }
- tselem = TREESTORE(te);
-
- /* sorting rules; only object lists, ID lists, or deformgroups */
- if (ELEM(tselem->type, TSE_DEFGROUP, TSE_ID_BASE) ||
- (tselem->type == 0 && te->idcode == ID_OB)) {
- int totelem = BLI_listbase_count(lb);
-
- if (totelem > 1) {
- tTreeSort *tear = MEM_mallocN(totelem * sizeof(tTreeSort), "tree sort array");
- tTreeSort *tp = tear;
- int skip = 0;
-
- for (te = lb->first; te; te = te->next, tp++) {
- tselem = TREESTORE(te);
- tp->te = te;
- tp->name = te->name;
- tp->idcode = te->idcode;
-
- if (tselem->type && tselem->type != TSE_DEFGROUP) {
- tp->idcode = 0; /* Don't sort this. */
- }
- if (tselem->type == TSE_ID_BASE) {
- tp->idcode = 1; /* Do sort this. */
- }
-
- tp->id = tselem->id;
- }
-
- /* just sort alphabetically */
- if (tear->idcode == 1) {
- qsort(tear, totelem, sizeof(tTreeSort), treesort_alpha);
- }
- else {
- /* keep beginning of list */
- for (tp = tear, skip = 0; skip < totelem; skip++, tp++) {
- if (tp->idcode) {
- break;
- }
- }
-
- if (skip < totelem) {
- qsort(tear + skip, totelem - skip, sizeof(tTreeSort), treesort_alpha_ob);
- }
- }
-
- BLI_listbase_clear(lb);
- tp = tear;
- while (totelem--) {
- BLI_addtail(lb, tp->te);
- tp++;
- }
- MEM_freeN(tear);
- }
- }
-
- for (te = lb->first; te; te = te->next) {
- outliner_sort(&te->subtree);
- }
-}
-
/* TODO (Nathan): Should children still be sorted? */
static void outliner_collections_children_sort(ListBase *lb)
{
More information about the Bf-blender-cvs
mailing list