[Bf-blender-cvs] [9ebd65b3f12] temp-soc-2019-outliner-sync: Outliner: Synced selection and active element highlighting

Nathan Craddock noreply at git.blender.org
Thu Aug 8 06:29:25 CEST 2019


Commit: 9ebd65b3f12d64cee5167343ea815a01cb3035c6
Author: Nathan Craddock
Date:   Wed Aug 7 22:27:07 2019 -0600
Branches: temp-soc-2019-outliner-sync
https://developer.blender.org/rB9ebd65b3f12d64cee5167343ea815a01cb3035c6

Outliner: Synced selection and active element highlighting

Adds a toggle to the filter menu for outliner synced selection. Enabled
by default, this esures selection is synced between objects, bones, and
sequences. An active outliner element theme color is added to indicate
which element is active.

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

M	release/datafiles/userdef/userdef_default_theme.c
M	release/scripts/presets/interface_theme/blender_light.xml
M	release/scripts/startup/bl_ui/space_outliner.py
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/armature/armature_select.c
M	source/blender/editors/armature/pose_select.c
M	source/blender/editors/include/ED_outliner.h
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_select.c
M	source/blender/editors/space_outliner/CMakeLists.txt
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_edit.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_select.c
A	source/blender/editors/space_outliner/outliner_sync.c
M	source/blender/editors/space_outliner/space_outliner.c
M	source/blender/editors/space_sequencer/sequencer_select.c
M	source/blender/editors/space_view3d/view3d_select.c
M	source/blender/makesdna/DNA_outliner_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 8611a9ae881..fa3f865b5b9 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -749,6 +749,7 @@ const bTheme U_theme_default = {
     .facedot_size = 4,
     .match = RGBA(0x337f334c),
     .selected_highlight = RGBA(0x314e784c),
+    .active = RGBA(0x59749d4c),
     .selected_object = RGBA(0xe96a00ff),
     .active_object = RGBA(0xffaf29ff),
     .edited_object = RGBA(0x00806266),
diff --git a/release/scripts/presets/interface_theme/blender_light.xml b/release/scripts/presets/interface_theme/blender_light.xml
index dc0bb6b629e..49b01ec3309 100644
--- a/release/scripts/presets/interface_theme/blender_light.xml
+++ b/release/scripts/presets/interface_theme/blender_light.xml
@@ -974,6 +974,7 @@
       <ThemeOutliner
         match="#337f33"
         selected_highlight="#7a8e99"
+        active="#92aab7"
         selected_object="#ffddb3"
         active_object="#ffffff"
         edited_object="#0080624d"
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index 6832e3d463b..f3e8d322a7b 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -46,6 +46,10 @@ class OUTLINER_HT_header(Header):
 
         layout.separator_spacer()
 
+        if display_mode == 'SEQUENCE':
+            row = layout.row(align=True)
+            row.prop(space, "use_sync_select", text="")
+
         row = layout.row(align=True)
         if display_mode in {'SCENES', 'VIEW_LAYER'}:
             row.popover(
@@ -303,6 +307,10 @@ class OUTLINER_PT_filter(Panel):
         space = context.space_data
         display_mode = space.display_mode
 
+        row = layout.row(align=True)
+        row.prop(space, "use_sync_select", text="Sync Selection")
+        layout.separator()
+
         if display_mode == 'VIEW_LAYER':
             layout.label(text="Restriction Toggles:")
             row = layout.row(align=True)
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 15b4f513050..1ab2e684fd9 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3531,6 +3531,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
     LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
       arm->flag &= ~(ARM_FLAG_UNUSED_6);
     }
+
+    /* Marks each outliner as dirty so a sync will occur as an outliner draws. */
+    for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+      for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+        for (SpaceLink *space = sa->spacedata.first; space; space = space->next) {
+          if (space->spacetype == SPACE_OUTLINER) {
+            SpaceOutliner *soutliner = (SpaceOutliner *)space;
+            soutliner->sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL;
+            soutliner->flag |= SO_SYNC_SELECT;
+          }
+        }
+      }
+    }
   }
 
   if (!MAIN_VERSION_ATLEAST(bmain, 281, 1)) {
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index e987a623d0b..ce2fa1b7852 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -141,6 +141,8 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
     FROM_DEFAULT_V4_UCHAR(space_outliner.row_alternate);
   }
 
+  FROM_DEFAULT_V4_UCHAR(space_outliner.active);
+
   /**
    * Include next version bump.
    */
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 23ddf77e63d..eff621d7b71 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -46,6 +46,7 @@
 
 #include "ED_armature.h"
 #include "ED_object.h"
+#include "ED_outliner.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
 #include "ED_view3d.h"
@@ -356,6 +357,8 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv
     }
   }
 
+  ED_outliner_select_sync_from_edit_bone_tag(C);
+
   ED_armature_edit_sync_selection(arm->edbo);
 
   WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, base->object);
@@ -1027,6 +1030,8 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
   }
   CTX_DATA_END;
 
+  ED_outliner_select_sync_from_edit_bone_tag(C);
+
   WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL);
 
   return OPERATOR_FINISHED;
@@ -1148,6 +1153,8 @@ static int armature_de_select_more_exec(bContext *C, wmOperator *UNUSED(op))
     WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
   }
   MEM_freeN(objects);
+
+  ED_outliner_select_sync_from_edit_bone_tag(C);
   return OPERATOR_FINISHED;
 }
 
@@ -1178,6 +1185,8 @@ static int armature_de_select_less_exec(bContext *C, wmOperator *UNUSED(op))
     WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
   }
   MEM_freeN(objects);
+
+  ED_outliner_select_sync_from_edit_bone_tag(C);
   return OPERATOR_FINISHED;
 }
 
@@ -1569,6 +1578,8 @@ static int armature_select_similar_exec(bContext *C, wmOperator *op)
 
 #undef STRUCT_SIZE_AND_OFFSET
 
+  ED_outliner_select_sync_from_edit_bone_tag(C);
+
   return OPERATOR_FINISHED;
 }
 
@@ -1663,6 +1674,8 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
+  ED_outliner_select_sync_from_edit_bone_tag(C);
+
   ED_armature_edit_sync_selection(arm->edbo);
 
   WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
@@ -1748,6 +1761,8 @@ static int armature_select_mirror_exec(bContext *C, wmOperator *op)
       arm->act_edbone = ebone_mirror_act;
     }
 
+    ED_outliner_select_sync_from_edit_bone_tag(C);
+
     ED_armature_edit_sync_selection(arm->edbo);
 
     WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
@@ -1876,6 +1891,7 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const
 
   if (changed) {
     arm->act_edbone = ebone_dst;
+    ED_outliner_select_sync_from_edit_bone_tag(C);
     ED_armature_edit_sync_selection(arm->edbo);
     WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
 
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 8434fee6e78..beec2f8358f 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -54,6 +54,7 @@
 #include "ED_keyframing.h"
 #include "ED_mesh.h"
 #include "ED_object.h"
+#include "ED_outliner.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
 #include "ED_view3d.h"
@@ -449,6 +450,8 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, const wmEve
     selectconnected_posebonechildren(base->object, curBone, extend);
   }
 
+  ED_outliner_select_sync_from_pose_bone_tag(C);
+
   ED_pose_bone_select_tag_update(base->object);
 
   return OPERATOR_FINISHED;
@@ -514,6 +517,8 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
   }
   CTX_DATA_END;
 
+  ED_outliner_select_sync_from_pose_bone_tag(C);
+
   WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL);
 
   return OPERATOR_FINISHED;
@@ -560,6 +565,8 @@ static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
     return OPERATOR_CANCELLED;
   }
 
+  ED_outliner_select_sync_from_pose_bone_tag(C);
+
   ED_pose_bone_select_tag_update(ob);
   return OPERATOR_FINISHED;
 }
@@ -624,6 +631,8 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
     return OPERATOR_CANCELLED;
   }
 
+  ED_outliner_select_sync_from_pose_bone_tag(C);
+
   return OPERATOR_FINISHED;
 }
 
@@ -712,6 +721,8 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
+  ED_outliner_select_sync_from_pose_bone_tag(C);
+
   ED_pose_bone_select_tag_update(ob);
 
   return OPERATOR_FINISHED;
@@ -1061,6 +1072,8 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op)
 
   /* report done status */
   if (changed) {
+    ED_outliner_select_sync_from_pose_bone_tag(C);
+
     return OPERATOR_FINISHED;
   }
   else {
@@ -1172,6 +1185,8 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op)
   }
   MEM_freeN(objects);
 
+  ED_outliner_select_sync_from_pose_bone_tag(C);
+
   return OPERATOR_FINISHED;
 }
 
diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h
index e94aedc2b2b..a28b1b8483a 100644
--- a/source/blender/editors/include/ED_outliner.h
+++ b/source/blender/editors/include/ED_outliner.h
@@ -30,4 +30,15 @@ bool ED_outliner_collections_editor_poll(struct bContext *C);
 
 void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects);
 
+void ED_outliner_select_sync_from_object_tag(struct bContext *C);
+void ED_outliner_select_sync_from_edit_bone_tag(struct bContext *C);
+void ED_outliner_select_sync_from_pose_bone_tag(struct bContext *C);
+void ED_outliner_select_sync_from_sequence_tag(struct bContext *C);
+
+bool ED_outliner_select_sync_is_dirty(const struct bContext *C);
+
+void ED_outliner_select_sync_from_outliner(struct bContext *C, struct SpaceOutliner *soops);
+
+void ED_outliner_select_sync_flag_outliners(const struct bContext *C);
+
 #endif /*  __ED_OUTLINER_H__ */
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 3b080b6df95..29022adac6c 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -255,6 +255,7 @@ typedef enum ThemeColorID {
 
   TH_MATCH,            /* highlight color for search matches */
   TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
+  TH_SELECT_ACTIVE,    /* highlight color for active outliner item */
   TH_SELECTED_OBJECT,  /* selected object color for outliner */
   TH_ACTIVE_OBJECT,    /* active object color f

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list