diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-06-08 22:37:29 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-06-08 22:37:29 +0300 |
commit | 371fc68678d51576809e4a2e4e70906ef32be69e (patch) | |
tree | 56ebed6b3a696dc79bf23fae39e81ceb90b3909f /source/blender/editors/sculpt_paint/paint_image.cc | |
parent | 285a68b7bbf2fa40e41d507991467387f5dd5264 (diff) |
Paint: Fix Image Editor Cursor Disappearing (T90120)
This patch fixes T90120. The fundamental problem is that 2d and the old 3d paint modes share a single Paint struct, ToolSettings->imapaint. This patch is a temporary fix until the new 3d paint mode (which has its own Paint struct) is released.
The patch works by listening for `NC_SCENE|ND_MODE` inside `image_listener` in `space_image.c`. It does not use `ED_space_image_paint_update` since that requires a `bMain.` Instead it calls `paint_cursor_start` (which is promoted to `ED_paint_cursor_start`). `image_paint_poll` is also promoted to an `ED_` function.
Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D14946
Ref D14946
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.cc b/source/blender/editors/sculpt_paint/paint_image.cc index e726fd3f338..e326d385593 100644 --- a/source/blender/editors/sculpt_paint/paint_image.cc +++ b/source/blender/editors/sculpt_paint/paint_image.cc @@ -272,7 +272,7 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) SpaceImage *sima = CTX_wm_space_image(C); if (sima) { - if (sima->image != nullptr && + if (sima->image != NULL && (ID_IS_LINKED(sima->image) || ID_IS_OVERRIDE_LIBRARY(sima->image))) { return false; } @@ -287,7 +287,7 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) return false; } -bool image_paint_poll(bContext *C) +bool ED_image_tools_paint_poll(bContext *C) { return image_paint_poll_ex(C, true); } @@ -301,7 +301,7 @@ static bool image_paint_2d_clone_poll(bContext *C) { Brush *brush = image_paint_brush(C); - if (!CTX_wm_region_view3d(C) && image_paint_poll(C)) { + if (!CTX_wm_region_view3d(C) && ED_image_tools_paint_poll(C)) { if (brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE)) { if (brush->clone.image) { return true; @@ -430,7 +430,7 @@ static void toggle_paint_cursor(Scene *scene, bool enable) paint_cursor_delete_textures(); } else if (enable) { - paint_cursor_start(p, image_paint_poll); + ED_paint_cursor_start(p, ED_image_tools_paint_poll); } } @@ -455,7 +455,7 @@ void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene) if (enabled) { BKE_paint_init(bmain, scene, PAINT_MODE_TEXTURE_2D, PAINT_CURSOR_TEXTURE_PAINT); - paint_cursor_start(&imapaint->paint, image_paint_poll); + ED_paint_cursor_start(&imapaint->paint, ED_image_tools_paint_poll); } else { paint_cursor_delete_textures(); @@ -925,7 +925,7 @@ static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op)) static bool brush_colors_flip_poll(bContext *C) { - if (image_paint_poll(C)) { + if (ED_image_tools_paint_poll(C)) { Brush *br = image_paint_brush(C); if (ELEM(br->imagepaint_tool, PAINT_TOOL_DRAW, PAINT_TOOL_FILL)) { return true; @@ -991,7 +991,7 @@ static bool texture_paint_poll(bContext *C) bool image_texture_paint_poll(bContext *C) { - return (texture_paint_poll(C) || image_paint_poll(C)); + return (texture_paint_poll(C) || ED_image_tools_paint_poll(C)); } bool facemask_paint_poll(bContext *C) |