Commit: b6776304e76a3fd1413accbc15f0d374de50e034
Author: Antonio Vazquez
Date:   Wed Jul 4 12:51:07 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb6776304e76a3fd1413accbc15f0d374de50e034

Fix missed materials after append GP object

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

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

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

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index ac6afedea39..d86c9b5824c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4175,6 +4175,16 @@ static void direct_link_material(FileData *fd, Material 
*ma)
        BLI_listbase_clear(&ma->gpumaterial);
 
        ma->gp_style = newdataadr(fd, ma->gp_style);
+       /* relink grease pencil settings */
+       if (ma->gp_style != NULL) {
+               MaterialGPencilStyle *gp_style = ma->gp_style;
+               if (gp_style->sima != NULL) {
+                       gp_style->sima = newlibadr_us(fd, ma->id.lib, 
gp_style->sima);
+               }
+               if (gp_style->ima != NULL) {
+                       gp_style->ima = newlibadr_us(fd, ma->id.lib, 
gp_style->ima);
+               }
+       }
 }
 
 /* ************ READ PARTICLE SETTINGS ***************** */
@@ -9954,6 +9964,10 @@ static void expand_gpencil(FileData *fd, Main *mainvar, 
bGPdata *gpd)
                expand_doit(fd, mainvar, gpl->parent);
        }
 
+       for (int a = 0; a < gpd->totcol; a++) {
+               expand_doit(fd, mainvar, gpd->mat[a]);
+       }
+
 }
 
 static void expand_workspace(FileData *fd, Main *mainvar, WorkSpace *workspace)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to