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:
authorNathan Craddock <nzcraddock@gmail.com>2019-08-08 07:27:07 +0300
committerNathan Craddock <nzcraddock@gmail.com>2019-08-16 21:30:53 +0300
commit71eb65328078d3b3ca440a9a23a7aa08238a6710 (patch)
treeeae7a6c557af86911d867f4644a24a618394dc9a /source/blender/editors/space_outliner/outliner_select.c
parent7ba2720a70c83eb41f577aae4eb5a3403f6bb6b9 (diff)
Outliner: Synced selection and active element highlighting
Adds a toggle to the filter menu for outliner synced selection. Enabled by default, this ensures selection is synced between objects, bones, and sequences. An active outliner element theme color is added to indicate which element is active. Synced selection is controlled on the operator level. Each operator that modifies selection for objects, bones, sequences, or outliner elements needs to call the respective ED_outliner_select_sync_from.. function to tag outliners to be synced. Syncing is done lazily on outliner draw.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index c932766ab93..38dfe439b9c 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -54,6 +54,7 @@
#include "ED_armature.h"
#include "ED_object.h"
+#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_sequencer.h"
@@ -1083,6 +1084,13 @@ eOLDrawState tree_element_type_active(bContext *C,
/* ================================================ */
+/* Activate a tree store element and set the walk navigation start element */
+void outliner_element_activate(SpaceOutliner *soops, TreeStoreElem *tselem)
+{
+ outliner_flag_set(&soops->tree, TSE_ACTIVE, false);
+ tselem->flag |= TSE_ACTIVE;
+}
+
/**
* Action when clicking to activate an item (typically under the mouse cursor),
* but don't do any cursor intersection checks.
@@ -1114,7 +1122,8 @@ static void do_outliner_item_activate_tree_element(bContext *C,
else if (tselem->type == TSE_POSE_BASE) {
/* Support pose mode toggle, keeping the active object as is. */
}
- else {
+ else if (soops->flag & SO_SYNC_SELECT) {
+ /* Only activate when synced selection is enabled */
tree_element_set_active_object(C,
scene,
view_layer,
@@ -1125,6 +1134,9 @@ static void do_outliner_item_activate_tree_element(bContext *C,
recursive && tselem->type == 0);
}
+ /* Mark as active in the outliner */
+ outliner_element_activate(soops, tselem);
+
if (tselem->type == 0) { // the lib blocks
/* editmode? */
if (te->idcode == ID_SCE) {
@@ -1189,7 +1201,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, false);
}
}
- else {
+ else if (soops->flag & SO_SYNC_SELECT) {
tree_element_type_active(C,
scene,
view_layer,
@@ -1211,7 +1223,8 @@ void outliner_item_select(SpaceOutliner *soops,
const bool toggle)
{
TreeStoreElem *tselem = TREESTORE(te);
- const short new_flag = toggle ? (tselem->flag ^ TSE_SELECTED) : (tselem->flag | TSE_SELECTED);
+ const short new_flag = (toggle && (tselem->flag & TSE_ACTIVE)) ? (tselem->flag ^ TSE_SELECTED) :
+ (tselem->flag | TSE_SELECTED);
if (extend == false) {
outliner_flag_set(&soops->tree, TSE_SELECTED, false);
@@ -1318,6 +1331,10 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
ED_region_tag_redraw_no_rebuild(ar);
}
ED_undo_push(C, "Outliner selection change");
+
+ if (soops->flag & SO_SYNC_SELECT) {
+ ED_outliner_select_sync_from_outliner(C, soops);
+ }
}
return OPERATOR_FINISHED;
@@ -1402,6 +1419,10 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_region_tag_redraw(ar);
+ if (soops->flag & SO_SYNC_SELECT) {
+ ED_outliner_select_sync_from_outliner(C, soops);
+ }
+
return OPERATOR_FINISHED;
}