[Bf-blender-cvs] [342ceba5bf6] blender-v2.82-release: Fix T64058: GPencil - Ensure object mode if linking from a library

Antonio Vazquez noreply at git.blender.org
Thu Feb 6 11:31:09 CET 2020


Commit: 342ceba5bf6e48ed0200bf13c3c65a5be6c6e1eb
Author: Antonio Vazquez
Date:   Thu Feb 6 11:27:01 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB342ceba5bf6e48ed0200bf13c3c65a5be6c6e1eb

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

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index f6cf68f7daf..4e571b20b15 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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;



More information about the Bf-blender-cvs mailing list