[Bf-blender-cvs] [f35ef57c8c4] master: Revert "Fix invalid area tool being set from message passing"

Campbell Barton noreply at git.blender.org
Fri Jun 28 11:39:41 CEST 2019


Commit: f35ef57c8c4f218548926b49dbc950b056d8de4e
Author: Campbell Barton
Date:   Fri Jun 28 18:47:47 2019 +1000
Branches: master
https://developer.blender.org/rBf35ef57c8c4f218548926b49dbc950b056d8de4e

Revert "Fix invalid area tool being set from message passing"

This reverts commit 9ec8887599b1c14dac47cca1a073fa50b333d5ee.

Causes assert when selection changes modes.

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

M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/windowmanager/WM_toolsystem.h
M	source/blender/windowmanager/intern/wm_toolsystem.c

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

diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index a90e59745be..c1891865d6d 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -980,7 +980,7 @@ static void view3d_main_region_message_subscribe(const struct bContext *C,
                                                  struct WorkSpace *UNUSED(workspace),
                                                  struct Scene *UNUSED(scene),
                                                  struct bScreen *UNUSED(screen),
-                                                 struct ScrArea *UNUSED(sa),
+                                                 struct ScrArea *sa,
                                                  struct ARegion *ar,
                                                  struct wmMsgBus *mbus)
 {
@@ -1054,6 +1054,16 @@ static void view3d_main_region_message_subscribe(const struct bContext *C,
         break;
     }
   }
+
+  {
+    wmMsgSubscribeValue msg_sub_value_region_tag_refresh = {
+        .owner = ar,
+        .user_data = sa,
+        .notify = WM_toolsystem_do_msg_notify_tag_refresh,
+    };
+    WM_msg_subscribe_rna_anon_prop(mbus, Object, mode, &msg_sub_value_region_tag_refresh);
+    WM_msg_subscribe_rna_anon_prop(mbus, LayerObjects, active, &msg_sub_value_region_tag_refresh);
+  }
 }
 
 /* concept is to retrieve cursor type context-less */
diff --git a/source/blender/windowmanager/WM_toolsystem.h b/source/blender/windowmanager/WM_toolsystem.h
index 4d4cb95ec1c..5afa0a88560 100644
--- a/source/blender/windowmanager/WM_toolsystem.h
+++ b/source/blender/windowmanager/WM_toolsystem.h
@@ -99,6 +99,10 @@ void WM_toolsystem_update_from_context(struct bContext *C,
 
 bool WM_toolsystem_active_tool_is_brush(const struct bContext *C);
 
+void WM_toolsystem_do_msg_notify_tag_refresh(struct bContext *C,
+                                             struct wmMsgSubscribeKey *msg_key,
+                                             struct wmMsgSubscribeValue *msg_val);
+
 struct IDProperty *WM_toolsystem_ref_properties_ensure_idprops(struct bToolRef *tref);
 void WM_toolsystem_ref_properties_ensure_ex(struct bToolRef *tref,
                                             const char *idname,
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index 0ba640fd6cc..9ed1322ec63 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -794,6 +794,23 @@ bool WM_toolsystem_active_tool_is_brush(const bContext *C)
   return tref_rt && (tref_rt->data_block[0] != '\0');
 }
 
+/* Follow wmMsgNotifyFn spec */
+void WM_toolsystem_do_msg_notify_tag_refresh(bContext *C,
+                                             wmMsgSubscribeKey *UNUSED(msg_key),
+                                             wmMsgSubscribeValue *msg_val)
+{
+  WorkSpace *workspace = CTX_wm_workspace(C);
+  ViewLayer *view_layer = CTX_data_view_layer(C);
+  ScrArea *sa = msg_val->user_data;
+  int space_type = sa->spacetype;
+  const bToolKey tkey = {
+      .space_type = space_type,
+      .mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype),
+  };
+  WM_toolsystem_refresh(C, workspace, &tkey);
+  WM_toolsystem_refresh_screen_area(workspace, view_layer, sa);
+}
+
 IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref)
 {
   if (tref->properties == NULL) {



More information about the Bf-blender-cvs mailing list