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.
This commit is contained in:
2018-09-20 13:47:59 +02:00
parent 5bfcd6f303
commit de994d6b7b
3 changed files with 21 additions and 6 deletions

View File

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