[Bf-blender-cvs] [b1bdfb6e32b] master: Fix T79275: Missing redraw for pinned active tool settings panels

David Friedli noreply at git.blender.org
Mon Sep 28 06:29:28 CEST 2020


Commit: b1bdfb6e32b9371048677196ac256290cfd35d0b
Author: David Friedli
Date:   Sun Sep 27 23:24:29 2020 -0500
Branches: master
https://developer.blender.org/rBb1bdfb6e32b9371048677196ac256290cfd35d0b

Fix T79275: Missing redraw for pinned active tool settings panels

In the 3D view sidebar, the active tool settings panel can be pinned to other
categories, and in those other categories it doesn't redraw when the active
tool changes. This commit checks for pinned panels from the "Tool" category
when checking whether to redraw.

Note that the relatively expensive string comparison is only done for
currently visible pinned panels.

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

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/screen/area.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 376dcb6d811..4f656420b06 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1685,6 +1685,7 @@ struct Panel *UI_panel_begin(struct ARegion *region,
                              bool *r_open);
 void UI_panel_end(const struct ARegion *region, uiBlock *block, int width, int height, bool open);
 
+bool UI_panel_is_active(const struct Panel *panel);
 void UI_panel_label_offset(struct uiBlock *block, int *r_x, int *r_y);
 int UI_panel_size_y(const struct Panel *panel);
 bool UI_panel_is_dragging(const struct Panel *panel);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index b9ed1688e80..65415a750bb 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -877,6 +877,11 @@ void UI_panels_set_expansion_from_seach_filter(const bContext *C, ARegion *regio
   }
 }
 
+bool UI_panel_is_active(const Panel *panel)
+{
+  return panel->runtime_flag & PANEL_ACTIVE;
+}
+
 /** \} */
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 2e9f297b705..7b41b1df0ab 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -450,8 +450,25 @@ void ED_area_do_mgs_subscribe_for_tool_ui(
     struct wmMsgBus *mbus)
 {
   BLI_assert(region->regiontype == RGN_TYPE_UI);
+  const char *panel_category_tool = "Tool";
   const char *category = UI_panel_category_active_get(region, false);
-  if (category && STREQ(category, "Tool")) {
+
+  bool update_region = false;
+  if (category && STREQ(category, panel_category_tool)) {
+    update_region = true;
+  }
+  else {
+    /* Check if a tool category panel is pinned and visible in another category. */
+    LISTBASE_FOREACH (Panel *, panel, &region->panels) {
+      if (UI_panel_is_active(panel) && panel->flag & PNL_PIN &&
+          STREQ(panel->type->category, panel_category_tool)) {
+        update_region = true;
+        break;
+      }
+    }
+  }
+
+  if (update_region) {
     wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
         .owner = region,
         .user_data = region,



More information about the Bf-blender-cvs mailing list