[Bf-blender-cvs] [c76d7f7bde3] blender-v3.3-release: Fix T99493: better syncing between Node Editor and Image Editor

Philipp Oeser noreply at git.blender.org
Tue Aug 23 11:18:25 CEST 2022


Commit: c76d7f7bde351b030863cbb999ad9e6cefd35fbe
Author: Philipp Oeser
Date:   Mon Aug 22 10:07:03 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBc76d7f7bde351b030863cbb999ad9e6cefd35fbe

Fix T99493: better syncing between Node Editor and Image Editor

Since {rBb0cb0a785475}, changing the active texture in the Node Editor
would also change the current image in the Image Editor.
While this was an overall improvement, this was not desired when the
image currently looked at was a `Render Result` or a `Viewer Node`
(artists usually want to keep focus on these).

With this patch, syncing the active texture change from the Node Editor
to the Image Editor will now only happen if the Image Editor's current
image is not a Render Result or a Viewer Node.

NOTE: Syncing the active paint slot to the Image Editor still happens
(even if the Image Editor's current image is not a Render Result or a
Viewer Node), behavior was not changed since this is a much more
explicit action while texture painting and probably desired in that
case.

Maniphest Tasks: T99493

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

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

M	source/blender/editors/space_node/node_edit.cc

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

diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc
index 1e01373029d..35ff8468a14 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -729,19 +729,26 @@ void ED_node_set_active(
           }
         }
 
-        /* Sync to Image Editor. */
+        /* Sync to Image Editor under the following conditions:
+         * - current image is not pinned
+         * - current image is not a Render Result or ViewerNode (want to keep looking at these) */
         Image *image = (Image *)node->id;
         wmWindowManager *wm = (wmWindowManager *)bmain->wm.first;
         LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
           const bScreen *screen = WM_window_get_active_screen(win);
           LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
             LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
-              if (sl->spacetype == SPACE_IMAGE) {
-                SpaceImage *sima = (SpaceImage *)sl;
-                if (!sima->pin) {
-                  ED_space_image_set(bmain, sima, image, true);
-                }
+              if (sl->spacetype != SPACE_IMAGE) {
+                continue;
+              }
+              SpaceImage *sima = (SpaceImage *)sl;
+              if (sima->pin) {
+                continue;
+              }
+              if (ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+                continue;
               }
+              ED_space_image_set(bmain, sima, image, true);
             }
           }
         }



More information about the Bf-blender-cvs mailing list