From b0cb0a78547582848f5f18f5d5cc85c69f3dbe30 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 4 Jun 2021 10:37:00 +0200 Subject: Texture Paint: sync changing active texture in the Node Editor to the Image Editor When changing to another texture paint slot, the texture displayed in the viewport changes accordingly (as well as the image displayed in the Image Editor). When changing the active texture in the Node Editor though, only the texture displayed in the viewport changes. This was mentioned in T88788 and I am not 100% sure this is desired in all scenarios (or at all), it should be seen in tandem of D11497. This change makes it so that the Image Editor changes to the image we changed to in the Node Editor (keeping them in sync). If this is not desired in all cases, this could be made an option. ref T88788 ref D11496 ref D11497 Maniphest Tasks: T88788 Differential Revision: https://developer.blender.org/D11498 --- source/blender/editors/space_node/node_edit.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index fd907d41a62..030d1672a08 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -52,6 +52,7 @@ #include "RE_engine.h" #include "RE_pipeline.h" +#include "ED_image.h" #include "ED_node.h" /* own include */ #include "ED_render.h" #include "ED_screen.h" @@ -744,6 +745,23 @@ void ED_node_set_active( } } + /* Sync to Image Editor. */ + 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 (r_active_texture_changed) { *r_active_texture_changed = true; } -- cgit v1.2.3