[Bf-blender-cvs] [3e825005091] blender-v2.90-release: Fix T79355: switch to texture paint workspace changes image in other workspaces

Brecht Van Lommel noreply at git.blender.org
Wed Jul 29 09:10:14 CEST 2020


Commit: 3e8250050918ffb44cbe62963222d10127a97329
Author: Brecht Van Lommel
Date:   Wed Jul 29 07:35:29 2020 +0200
Branches: blender-v2.90-release
https://developer.blender.org/rB3e8250050918ffb44cbe62963222d10127a97329

Fix T79355: switch to texture paint workspace changes image in other workspaces

Only automatically change image in editor to follow texture paint editors and
workspaces that are visible.

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

M	source/blender/editors/sculpt_paint/paint_image.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 7f64fdf3501..7ee3d991eb7 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1118,7 +1118,6 @@ void PAINT_OT_sample_color(wmOperatorType *ot)
 
 void ED_object_texture_paint_mode_enter_ex(Main *bmain, Scene *scene, Object *ob)
 {
-  bScreen *screen;
   Image *ima = NULL;
   ImagePaintSettings *imapaint = &scene->toolsettings->imapaint;
 
@@ -1142,17 +1141,16 @@ void ED_object_texture_paint_mode_enter_ex(Main *bmain, Scene *scene, Object *ob
   }
 
   if (ima) {
-    for (screen = bmain->screens.first; screen; screen = screen->id.next) {
-      ScrArea *area;
-      for (area = screen->areabase.first; area; area = area->next) {
-        SpaceLink *sl;
-        for (sl = area->spacedata.first; sl; sl = sl->next) {
-          if (sl->spacetype == SPACE_IMAGE) {
-            SpaceImage *sima = (SpaceImage *)sl;
-
-            if (!sima->pin) {
-              ED_space_image_set(bmain, sima, NULL, ima, true);
-            }
+    wmWindowManager *wm = bmain->wm.first;
+    for (wmWindow *win = wm->windows.first; win; win = win->next) {
+      const bScreen *screen = WM_window_get_active_screen(win);
+      for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+        SpaceLink *sl = area->spacedata.first;
+        if (sl->spacetype == SPACE_IMAGE) {
+          SpaceImage *sima = (SpaceImage *)sl;
+
+          if (!sima->pin) {
+            ED_space_image_set(bmain, sima, NULL, ima, true);
           }
         }
       }



More information about the Bf-blender-cvs mailing list