diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-09-22 18:19:42 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-09-23 21:11:45 +0300 |
commit | fc2255135e31679d51edf0652caca1462f75c3d4 (patch) | |
tree | fcb08290c1ccac85792907516ab955c557b5e72f /source/blender/blenloader | |
parent | b8a30c7664a1871fb3dae8805c21b7f24ca413d3 (diff) |
Paint: prevent RenderResults and Viewers where unappropriate
Using a RenderResult (or a Viewer) was never really working (think you
cant get a real ImBuff from these) -- cannot use it as a clone, stencil
or canvas [Single Image paint texture slot].
In the case of using it as a 2D paint clone image this would also crash
[due to the Image Editor drawing refactor in 2.91].
Now [in the spirit of T73182 / D11179], prevent using these where
unappropriate by using rna pointer polling functions.
Also add a security check for the 2D paint clone image crash in case a
stencil ImBuff cannot be provided for some reason, but generally old
files are now patched in do_versions_after_linking_300 (thx @brecht!).
Fixes T91625.
Maniphest Tasks: T91625
Differential Revision: https://developer.blender.org/D12609
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 9908e231452..0d333ac2edc 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -518,6 +518,28 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) { /* Keep this block, even when empty. */ do_versions_idproperty_ui_data(bmain); + + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + ToolSettings *tool_settings = scene->toolsettings; + ImagePaintSettings *imapaint = &tool_settings->imapaint; + if (imapaint->canvas != NULL && + ELEM(imapaint->canvas->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { + imapaint->canvas = NULL; + } + if (imapaint->stencil != NULL && + ELEM(imapaint->stencil->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { + imapaint->stencil = NULL; + } + if (imapaint->clone != NULL && + ELEM(imapaint->clone->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { + imapaint->clone = NULL; + } + } + LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { + if (brush->clone.image != NULL && ELEM(brush->clone.image->type, IMA_TYPE_R_RESULT, + IMA_TYPE_COMPOSITE)) { brush->clone.image = NULL; + } + } } } |