[Bf-blender-cvs] [0e47e57eb77] master: Outliner: Properties editor sync on selection

Nathan Craddock noreply at git.blender.org
Wed Oct 28 18:54:51 CET 2020


Commit: 0e47e57eb77d0c84ce3b9aa6b9c502a50f0ea6f2
Author: Nathan Craddock
Date:   Wed Oct 28 11:43:10 2020 -0600
Branches: master
https://developer.blender.org/rB0e47e57eb77d0c84ce3b9aa6b9c502a50f0ea6f2

Outliner: Properties editor sync on selection

When outliner datablocks are selected, switch to the corresponding tab
for that datablock in properties editors. Only properties editors
that share an edge with the outliner will change tabs.

Additionally, when modifiers, constraints, and shader effects are
selected from the outliner, the panel will be expanded in all properties
editors.

Part of T77408

Manifest Task: https://developer.blender.org/T63991

Differential Revision: https://developer.blender.org/D8638

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

M	source/blender/blenkernel/BKE_constraint.h
M	source/blender/blenkernel/BKE_gpencil_modifier.h
M	source/blender/blenkernel/BKE_modifier.h
M	source/blender/blenkernel/BKE_shader_fx.h
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/blenkernel/intern/modifier.c
M	source/blender/blenkernel/intern/shader_fx.c
M	source/blender/editors/include/ED_buttons.h
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/screen/area.c
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_outliner/outliner_select.c

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

diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index ecb891760b7..5ff0e7597e9 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -183,6 +183,8 @@ bool BKE_constraint_remove_ex(ListBase *list,
                               bool clear_dep);
 bool BKE_constraint_remove(ListBase *list, struct bConstraint *con);
 
+void BKE_constraint_panel_expand(struct bConstraint *con);
+
 /* Constraints + Proxies function prototypes */
 void BKE_constraints_proxylocal_extract(struct ListBase *dst, struct ListBase *src);
 bool BKE_constraints_proxylocked_owner(struct Object *ob, struct bPoseChannel *pchan);
diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h
index e003144047b..78a17e3568d 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -249,6 +249,7 @@ typedef struct GpencilModifierTypeInfo {
 void BKE_gpencil_modifier_init(void);
 
 void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname);
+void BKE_gpencil_modifier_panel_expand(struct GpencilModifierData *md);
 const GpencilModifierTypeInfo *BKE_gpencil_modifier_get_info(GpencilModifierType type);
 struct GpencilModifierData *BKE_gpencil_modifier_new(int type);
 void BKE_gpencil_modifier_free_ex(struct GpencilModifierData *md, const int flag);
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 10528a651e5..4909fe012b5 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -396,6 +396,7 @@ const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type);
 
 /* For modifier UI panels. */
 void BKE_modifier_type_panel_id(ModifierType type, char *r_idname);
+void BKE_modifier_panel_expand(struct ModifierData *md);
 
 /* Modifier utility calls, do call through type pointer and return
  * default values if pointer is optional.
diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h
index da14487c1f4..4b9688f9515 100644
--- a/source/blender/blenkernel/BKE_shader_fx.h
+++ b/source/blender/blenkernel/BKE_shader_fx.h
@@ -151,6 +151,7 @@ typedef struct ShaderFxTypeInfo {
 void BKE_shaderfx_init(void);
 
 void BKE_shaderfxType_panel_id(ShaderFxType type, char *r_idname);
+void BKE_shaderfx_panel_expand(struct ShaderFxData *fx);
 const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType type);
 struct ShaderFxData *BKE_shaderfx_new(int type);
 void BKE_shaderfx_free_ex(struct ShaderFxData *fx, const int flag);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 274546132fb..2301267cd21 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -5406,6 +5406,11 @@ bool BKE_constraint_remove_ex(ListBase *list, Object *ob, bConstraint *con, bool
   return false;
 }
 
+void BKE_constraint_panel_expand(bConstraint *con)
+{
+  con->ui_expand_flag |= (1 << 0);
+}
+
 /* ......... */
 
 /* Creates a new constraint, initializes its data, and returns it */
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index d12e445fe99..f4041fae047 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -411,6 +411,11 @@ void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname)
   strcat(r_idname, mti->name);
 }
 
+void BKE_gpencil_modifier_panel_expand(GpencilModifierData *md)
+{
+  md->ui_expand_flag |= (1 << 0);
+}
+
 /**
  * Generic grease pencil modifier copy data.
  * \param md_src: Source modifier data
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index d79a03dce6e..1ac63e653c0 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -130,6 +130,11 @@ void BKE_modifier_type_panel_id(ModifierType type, char *r_idname)
   strcat(r_idname, mti->name);
 }
 
+void BKE_modifier_panel_expand(ModifierData *md)
+{
+  md->ui_expand_flag |= (1 << 0);
+}
+
 /***/
 
 ModifierData *BKE_modifier_new(int type)
diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c
index f2cdf08b415..29cb574c7bc 100644
--- a/source/blender/blenkernel/intern/shader_fx.c
+++ b/source/blender/blenkernel/intern/shader_fx.c
@@ -175,6 +175,11 @@ void BKE_shaderfxType_panel_id(ShaderFxType type, char *r_idname)
   strcat(r_idname, fxi->name);
 }
 
+void BKE_shaderfx_panel_expand(ShaderFxData *fx)
+{
+  fx->ui_expand_flag |= (1 << 0);
+}
+
 void BKE_shaderfx_copydata_generic(const ShaderFxData *fx_src, ShaderFxData *fx_dst)
 {
   const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx_src->type);
diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h
index 5d153757900..90d3a527b0c 100644
--- a/source/blender/editors/include/ED_buttons.h
+++ b/source/blender/editors/include/ED_buttons.h
@@ -26,6 +26,7 @@
 extern "C" {
 #endif
 
+struct bContext;
 struct SpaceProperties;
 
 int ED_buttons_tabs_list(struct SpaceProperties *sbuts, short *context_tabs_array);
@@ -35,6 +36,8 @@ void ED_buttons_search_string_set(struct SpaceProperties *sbuts, const char *val
 int ED_buttons_search_string_length(struct SpaceProperties *sbuts);
 const char *ED_buttons_search_string_get(struct SpaceProperties *sbuts);
 
+void ED_buttons_set_context(const struct bContext *C, PointerRNA *ptr, const int context);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index b8500ba0c37..dc1c43c0337 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -199,6 +199,7 @@ int ED_region_global_size_y(void);
 void ED_area_update_region_sizes(struct wmWindowManager *wm,
                                  struct wmWindow *win,
                                  struct ScrArea *area);
+bool ED_area_has_shared_border(struct ScrArea *a, struct ScrArea *b);
 
 ScrArea *ED_screen_areas_iter_first(const struct wmWindow *win, const bScreen *screen);
 ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index f5962f36412..cffcb1cb4dc 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1871,6 +1871,11 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
   area->flag &= ~AREA_FLAG_REGION_SIZE_UPDATE;
 }
 
+bool ED_area_has_shared_border(struct ScrArea *a, struct ScrArea *b)
+{
+  return area_getorientation(a, b) != -1;
+}
+
 /* called in screen_refresh, or screens_init, also area size changes */
 void ED_area_init(wmWindowManager *wm, wmWindow *win, ScrArea *area)
 {
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 60ce86740cd..8fc16e66466 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -56,6 +56,7 @@
 
 #include "RNA_access.h"
 
+#include "ED_buttons.h"
 #include "ED_physics.h"
 #include "ED_screen.h"
 
@@ -512,11 +513,11 @@ static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *vie
 }
 #endif
 
-static bool buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag)
+static bool buttons_context_path(
+    const bContext *C, SpaceProperties *sbuts, ButsContextPath *path, int mainb, int flag)
 {
   /* Note we don't use CTX_data here, instead we get it from the window.
    * Otherwise there is a loop reading the context that we are setting. */
-  SpaceProperties *sbuts = CTX_wm_space_properties(C);
   wmWindow *window = CTX_wm_window(C);
   Scene *scene = WM_window_get_active_scene(window);
   ViewLayer *view_layer = WM_window_get_active_view_layer(window);
@@ -660,14 +661,14 @@ void buttons_context_compute(const bContext *C, SpaceProperties *sbuts)
   int flag = 0;
 
   /* Set scene path. */
-  buttons_context_path(C, path, BCONTEXT_SCENE, pflag);
+  buttons_context_path(C, sbuts, path, BCONTEXT_SCENE, pflag);
 
   buttons_texture_context_compute(C, sbuts);
 
   /* for each context, see if we can compute a valid path to it, if
    * this is the case, we know we have to display the button */
   for (int i = 0; i < BCONTEXT_TOT; i++) {
-    if (buttons_context_path(C, path, i, pflag)) {
+    if (buttons_context_path(C, sbuts, path, i, pflag)) {
       flag |= (1 << i);
 
       /* setting icon for data context */
@@ -713,7 +714,7 @@ void buttons_context_compute(const bContext *C, SpaceProperties *sbuts)
     }
   }
 
-  buttons_context_path(C, path, sbuts->mainb, pflag);
+  buttons_context_path(C, sbuts, path, sbuts->mainb, pflag);
 
   if (!(flag & (1 << sbuts->mainb))) {
     if (flag & (1 << BCONTEXT_OBJECT)) {
@@ -734,6 +735,39 @@ void buttons_context_compute(const bContext *C, SpaceProperties *sbuts)
   sbuts->pathflag = flag;
 }
 
+static bool is_pointer_in_path(ButsContextPath *path, PointerRNA *ptr)
+{
+  for (int i = 0; i < path->len; ++i) {
+    if (ptr->owner_id == path->ptr[i].owner_id) {
+      return true;
+    }
+  }
+  return false;
+}
+
+void ED_buttons_set_context(const bContext *C, PointerRNA *ptr, const int context)
+{
+  ScrArea *active_area = CTX_wm_area(C);
+  bScreen *screen = CTX_wm_screen(C);
+
+  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+    /* Only update for properties editors that are visible and share a border. */
+    if (area->spacetype != SPACE_PROPERTIES) {
+      continue;
+    }
+    if (!ED_area_has_shared_border(active_area, area)) {
+      continue;
+    }
+
+    SpaceProperties *sbuts = (SpaceProperties *)area->spacedata.first;
+    ButsContextPath path;
+    if (buttons_context_path(C, sbuts, &path, context, 0) && is_pointer_in_path(&path, ptr)) {
+      sbuts->mainbus

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list