[Bf-blender-cvs] [934fd07a060] tracking_tools: Fix default tool not set when changing clip editor modes

Julian Eisel noreply at git.blender.org
Tue Jul 20 19:06:38 CEST 2021


Commit: 934fd07a0604bef46ac380530b2b990c805cbf46
Author: Julian Eisel
Date:   Tue Jul 20 19:06:03 2021 +0200
Branches: tracking_tools
https://developer.blender.org/rB934fd07a0604bef46ac380530b2b990c805cbf46

Fix default tool not set when changing clip editor modes

Also see D11977.

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

M	source/blender/editors/screen/area.c
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/windowmanager/intern/wm_toolsystem.c

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

diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c351ade9954..9325b1b116d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1979,7 +1979,6 @@ void ED_area_init(wmWindowManager *wm, wmWindow *win, ScrArea *area)
   if ((G.moving & G_TRANSFORM_WM) == 0) {
     if ((1 << area->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) {
       WM_toolsystem_refresh_screen_area(workspace, view_layer, area);
-      area->flag |= AREA_FLAG_ACTIVE_TOOL_UPDATE;
     }
     else {
       area->runtime.tool = NULL;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index f5e4c4d55d9..e51c8925aa7 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -76,6 +76,8 @@
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
 
+#include "WM_message.h"
+
 #include "clip_intern.h" /* own include */
 
 /* -------------------------------------------------------------------- */
@@ -1604,6 +1606,9 @@ static int mode_set_exec(bContext *C, wmOperator *op)
 
   WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL);
 
+  struct wmMsgBus *mbus = CTX_wm_message_bus(C);
+  WM_msg_publish_rna_prop(mbus, (ID *)CTX_wm_screen(C), sc, SpaceClipEditor, mode);
+
   return OPERATOR_FINISHED;
 }
 
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 20a8bbc10c1..b16559e3a45 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -56,6 +56,8 @@
 #include "GPU_matrix.h"
 
 #include "WM_api.h"
+#include "WM_message.h"
+#include "WM_toolsystem.h"
 #include "WM_types.h"
 
 #include "UI_interface.h"
@@ -1036,6 +1038,20 @@ static void clip_main_region_listener(const wmRegionListenerParams *params)
   }
 }
 
+static void clip_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
+{
+  struct wmMsgBus *mbus = params->message_bus;
+  ScrArea *area = params->area;
+  ARegion *region = params->region;
+
+  wmMsgSubscribeValue msg_sub_value_region_tag_refresh = {
+      .owner = region,
+      .user_data = area,
+      .notify = WM_toolsystem_do_msg_notify_tag_refresh,
+  };
+  WM_msg_subscribe_rna_anon_prop(mbus, SpaceClipEditor, mode, &msg_sub_value_region_tag_refresh);
+}
+
 /****************** preview region ******************/
 
 static void clip_preview_region_init(wmWindowManager *wm, ARegion *region)
@@ -1347,6 +1363,7 @@ void ED_spacetype_clip(void)
   art->init = clip_main_region_init;
   art->draw = clip_main_region_draw;
   art->listener = clip_main_region_listener;
+  art->message_subscribe = clip_main_region_message_subscribe;
   art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_GPENCIL |
                     ED_KEYMAP_TOOL;
 
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index 0fa563b5560..cfd1d256222 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -577,6 +577,8 @@ void WM_toolsystem_refresh_screen_area(WorkSpace *workspace, ViewLayer *view_lay
       }
     }
   }
+
+  area->flag |= AREA_FLAG_ACTIVE_TOOL_UPDATE;
 }
 
 void WM_toolsystem_refresh_screen_all(Main *bmain)



More information about the Bf-blender-cvs mailing list