[Bf-blender-cvs] [037ce662e58] master: Outliner: Switch properties tabs only on icon click

Nathan Craddock noreply at git.blender.org
Tue Nov 24 06:27:17 CET 2020


Commit: 037ce662e58a7343d3a1e305b33f91e39154d42d
Author: Nathan Craddock
Date:   Mon Nov 23 15:58:56 2020 -0700
Branches: master
https://developer.blender.org/rB037ce662e58a7343d3a1e305b33f91e39154d42d

Outliner: Switch properties tabs only on icon click

According to feedback the outliner to properties editor tab switching
was annoying when it always changed tabs on selection, especially for
selecting individual objects. This limits the tab switching behavior to
only when the icons in the outliner are selected.

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

M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_select.c
M	source/blender/editors/space_outliner/outliner_utils.c

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

diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 23a92903d66..5bcb7af1a17 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -299,6 +299,7 @@ void outliner_item_select(struct bContext *C,
                           const short select_flag);
 
 bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x);
+bool outliner_item_is_co_over_icon(const TreeElement *te, float view_co_x);
 bool outliner_item_is_co_over_name(const TreeElement *te, float view_co_x);
 bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x);
 bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const float view_mval[2]);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 064d6531bf4..0cd5e62e6f6 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1387,8 +1387,6 @@ static void do_outliner_item_activate_tree_element(bContext *C,
                              extend ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
                              recursive);
   }
-
-  outliner_set_properties_tab(C, te, tselem);
 }
 
 /* Select the item using the set flags */
@@ -1568,6 +1566,9 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
     TreeElement *activate_te = outliner_find_item_at_x_in_row(
         space_outliner, te, view_mval[0], &merged_elements);
 
+    /* If `outliner_find_item_at_x_in_row` returned a different element a row icon was selected. */
+    const bool is_row_icon = te != activate_te;
+
     /* If the selected icon was an aggregate of multiple elements, run the search popup */
     if (merged_elements) {
       merged_element_search_menu_invoke(C, te, activate_te);
@@ -1591,6 +1592,11 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
                                 (extend ? OL_ITEM_EXTEND : 0);
 
       outliner_item_select(C, space_outliner, activate_te, select_flag);
+
+      /* Only switch properties editor tabs when icons are selected. */
+      if (is_row_icon || outliner_item_is_co_over_icon(activate_te, view_mval[0])) {
+        outliner_set_properties_tab(C, activate_te, activate_tselem);
+      }
     }
 
     changed = true;
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c
index 1a0ab3e00d0..79f696e1511 100644
--- a/source/blender/editors/space_outliner/outliner_utils.c
+++ b/source/blender/editors/space_outliner/outliner_utils.c
@@ -429,6 +429,11 @@ bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x)
   return outside_left && (view_co_x < te->xend);
 }
 
+bool outliner_item_is_co_over_icon(const TreeElement *te, float view_co_x)
+{
+  return (view_co_x > (te->xs + UI_UNIT_X)) && (view_co_x < (te->xs + UI_UNIT_X * 2));
+}
+
 /* Find if x coordinate is over element name. */
 bool outliner_item_is_co_over_name(const TreeElement *te, float view_co_x)
 {



More information about the Bf-blender-cvs mailing list