diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-06-04 11:37:00 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-08-31 13:45:39 +0300 |
commit | b0cb0a78547582848f5f18f5d5cc85c69f3dbe30 (patch) | |
tree | 20299ce9ba8ed87f105eb1e3623004a59a10b7f8 /source | |
parent | 3b2a01edf698fb27d9984fe12eb210df5246f16c (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_node/node_edit.cc | 18 |
1 files changed, 18 insertions, 0 deletions
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; } |