diff options
author | Antonioya <blendergit@gmail.com> | 2018-09-20 14:47:59 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-09-20 14:47:59 +0300 |
commit | de994d6b7b1c8789ee2797b8138c2fb115370b9c (patch) | |
tree | 552789f8a352bdb1ec28dbf321849a2d232aeeda /source/blender | |
parent | 5bfcd6f303b458567870ab64fabf89713d679a78 (diff) |
GP: Fix problem with mode opening 2D Animation template
The grease pencil does not need a toggle of mode.
This fix also the problem when open grease pencil files that did not keep the mode saved.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 11 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 14 |
3 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8864a613761..c09630f5f75 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1296,7 +1296,7 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con BKE_object_facemap_copy_list(&ob_dst->fmaps, &ob_src->fmaps); BKE_constraints_copy_ex(&ob_dst->constraints, &ob_src->constraints, flag_subdata, true); - ob_dst->mode = OB_MODE_OBJECT; + ob_dst->mode = ob_dst->type != OB_GPENCIL ? OB_MODE_OBJECT : ob_dst->mode; ob_dst->sculpt = NULL; if (ob_src->pd) { diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index e6a5d20f017..8972e7ef56f 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -32,6 +32,7 @@ #include "BLI_math.h" #include "BLI_string.h" +#include "DNA_gpencil_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -102,6 +103,16 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) workspace->object_mode = OB_MODE_GPENCIL_PAINT; } } + /* set object in drawing mode */ + for (Object *object = bmain->object.first; object; object = object->id.next) { + if (object->type == OB_GPENCIL) { + bGPdata *gpd = (bGPdata *)object->data; + object->mode = OB_MODE_GPENCIL_PAINT; + gpd->flag |= GP_DATA_STROKE_PAINTMODE; + break; + } + } + /* Be sure curfalloff is initializated */ for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) { ToolSettings *ts = scene->toolsettings; diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 30c1606e3d8..10698b9ebab 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -115,11 +115,15 @@ void ED_editors_init(bContext *C) /* pass */ } else if (!BKE_object_has_mode_data(ob, mode)) { - /* For multi-edit mode we may already have mode data. */ - ID *data = ob->data; - ob->mode = OB_MODE_OBJECT; - if ((ob == obact) && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data))) { - ED_object_mode_toggle(C, mode); + /* For multi-edit mode we may already have mode data. + * (grease pencil does not need it) + */ + if (ob->type != OB_GPENCIL) { + ID *data = ob->data; + ob->mode = OB_MODE_OBJECT; + if ((ob == obact) && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data))) { + ED_object_mode_toggle(C, mode); + } } } } |