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
This commit is contained in:
Philipp Oeser 2021-06-04 10:37:00 +02:00
parent 3b2a01edf6
commit b0cb0a7854
Notes: blender-bot 2023-02-13 18:30:49 +01:00
Referenced by commit 22b69ed08f, Fix T101001: crash setting texture node active in certain cases
Referenced by commit c76d7f7bde, Fix T99493: better syncing between Node Editor and Image Editor
Referenced by issue #101001, Regression: Crash when left click on Point Density node
Referenced by issue #100707, Image Editor don't change to active texture if there is one texture node in material
Referenced by issue #88788, When selected a texture in the Properties panel shows another texture in the 3D Viewport.
1 changed files with 18 additions and 0 deletions

View File

@ -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;
}