[Bf-blender-cvs] [488134c80ef] soc-2020-outliner: Cleanup: Outliner UIstack reorder

Nathan Craddock noreply at git.blender.org
Sat Jul 25 22:03:51 CEST 2020


Commit: 488134c80efaf8ded4d97a805a2f0360e50a0699
Author: Nathan Craddock
Date:   Sat Jul 25 11:37:35 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB488134c80efaf8ded4d97a805a2f0360e50a0699

Cleanup: Outliner UIstack reorder

===================================================================

M	source/blender/editors/space_outliner/outliner_dragdrop.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index ca19bcd2b2b..327485f0355 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -307,9 +307,6 @@ static int outliner_get_insert_index(TreeElement *te,
   if (insert_type == TE_INSERT_BEFORE) {
     te = te->prev;
   }
-  else if (insert_type == TE_INSERT_AFTER) {
-    te = te->next;
-  }
 
   if (te == NULL) {
     return 0;
@@ -952,20 +949,21 @@ static void uistack_drop_copy(bContext *C, OutlinerDropData *drop_data)
 
 static void uistack_drop_reorder(bContext *C, ReportList *reports, OutlinerDropData *drop_data)
 {
+  TreeElement *drop_te = drop_data->drop_te;
   TreeStoreElem *tselem = TREESTORE(drop_data->drop_te);
+  TreeElementInsertType insert_type = drop_data->insert_type;
+
   Object *ob_dst = (Object *)tselem->id;
   Object *ob = drop_data->ob_parent;
 
   int index = 0;
   if (drop_data->drag_tselem->type == TSE_MODIFIER) {
     if (ob->type == OB_GPENCIL && ob_dst->type == OB_GPENCIL) {
-      index = outliner_get_insert_index(
-          drop_data->drop_te, drop_data->insert_type, &ob->greasepencil_modifiers);
+      index = outliner_get_insert_index(drop_te, insert_type, &ob->greasepencil_modifiers);
       ED_object_gpencil_modifier_move_to_index(reports, ob, drop_data->drag_directdata, index);
     }
     else if (ob->type != OB_GPENCIL && ob_dst->type != OB_GPENCIL) {
-      index = outliner_get_insert_index(
-          drop_data->drop_te, drop_data->insert_type, &ob->modifiers);
+      index = outliner_get_insert_index(drop_te, insert_type, &ob->modifiers);
       ED_object_modifier_move_to_index(reports, ob, drop_data->drag_directdata, index);
     }
 
@@ -975,17 +973,16 @@ static void uistack_drop_reorder(bContext *C, ReportList *reports, OutlinerDropD
   else if (drop_data->drag_tselem->type == TSE_CONSTRAINT) {
     if (drop_data->bone_parent) {
       index = outliner_get_insert_index(
-          drop_data->drop_te, drop_data->insert_type, &drop_data->bone_parent->constraints);
+          drop_te, insert_type, &drop_data->bone_parent->constraints);
     }
     else {
-      index = outliner_get_insert_index(
-          drop_data->drop_te, drop_data->insert_type, &ob->constraints);
+      index = outliner_get_insert_index(drop_te, insert_type, &ob->constraints);
     }
     ED_object_constraint_move_to_index(reports, ob, drop_data->drag_directdata, index);
     WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
   }
   else if (drop_data->drag_tselem->type == TSE_EFFECT) {
-    index = outliner_get_insert_index(drop_data->drop_te, drop_data->insert_type, &ob->shader_fx);
+    index = outliner_get_insert_index(drop_te, insert_type, &ob->shader_fx);
     ED_object_shaderfx_move_to_index(reports, ob, drop_data->drag_directdata, index);
     DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
     WM_event_add_notifier(C, NC_OBJECT | ND_SHADERFX, ob);



More information about the Bf-blender-cvs mailing list