Fix T64058: GPencil - Ensure object mode if linking from a library

If the linked or append grease pencil object was added to the scene, the original file could have the datablock status in a different mode, so it's necessary to be sure is in object mode.

Differential Revision: https://developer.blender.org/D6759
This commit is contained in:
Antonio Vazquez 2020-02-06 11:27:01 +01:00
parent 10705807fe
commit 342ceba5bf
Notes: blender-bot 2023-02-14 08:06:33 +01:00
Referenced by issue #64058, Grease Pencil Object saved in editmode is not appended in objectmode correctly [cannot be moved and causes assert]
1 changed files with 8 additions and 0 deletions

View File

@ -7227,6 +7227,14 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
gpd->adt = newdataadr(fd, gpd->adt);
direct_link_animdata(fd, gpd->adt);
/* If linking from a library ensure full objectmode. */
if (gpd->id.lib != NULL) {
gpd->flag &= ~GP_DATA_STROKE_PAINTMODE;
gpd->flag &= ~GP_DATA_STROKE_EDITMODE;
gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE;
gpd->flag &= ~GP_DATA_STROKE_WEIGHTMODE;
}
/* init stroke buffer */
gpd->runtime.sbuffer = NULL;
gpd->runtime.sbuffer_used = 0;