diff options
author | Falk David <filedescriptor> | 2022-02-01 17:58:12 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-02-01 18:02:03 +0300 |
commit | e9150ac3176eb46e90afa8fd62b33818e59b8de7 (patch) | |
tree | a067c29cbe6ea7c99f638535b749359dd26988de | |
parent | b03fb70eff33d380ebc0e7a70b91f856b080d2ff (diff) |
Fix T89514: GP draw mode not saved when scene is not the active one
This patch fixes the error that pops up
(`Error: Unable to execute '... Mode Toggle', error changing modes`)
when trying to switch to e.g. draw mode from a grease pencil object
that was saved in draw mode in an inactive scene when the file was loaded.
Note that this does not fix the bigger issue described in T91243.
The fix makes sure that we reset all the mode flags on the grease pencil
data when we set the mode to object mode.
Reviewed By: antoniov
Maniphest Tasks: T89514
Differential Revision: https://developer.blender.org/D12419
-rw-r--r-- | source/blender/editors/util/ed_util.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 0320a2a9a1a..e86392e47ab 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -47,6 +47,8 @@ #include "DEG_depsgraph.h" +#include "DNA_gpencil_types.h" + #include "ED_armature.h" #include "ED_asset.h" #include "ED_image.h" @@ -117,6 +119,10 @@ void ED_editors_init(bContext *C) /* For multi-edit mode we may already have mode data (grease pencil does not need it). * However we may have a non-active object stuck in a grease-pencil edit mode. */ if (ob != obact) { + bGPdata *gpd = (bGPdata *)ob->data; + gpd->flag &= ~(GP_DATA_STROKE_PAINTMODE | GP_DATA_STROKE_EDITMODE | + GP_DATA_STROKE_SCULPTMODE | GP_DATA_STROKE_WEIGHTMODE | + GP_DATA_STROKE_VERTEXMODE); ob->mode = OB_MODE_OBJECT; DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE); } |