Commit: b643f3235454beacaf0415b6a0a0af542c572ab1
Author: Joshua Leung
Date:   Fri Jul 6 00:37:33 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBb643f3235454beacaf0415b6a0a0af542c572ab1

Fixes for incorrect version patching code introduced in b6776304e76a

* newlibadr() shouldn't be called from direct_link_* functions
  Besides, the pointers in question get corrected in
  lib_link_material() already

* Added expand_doit() calls for the sima and ima pointers.
  Following what's done for tex->ima, these also get expand_doit() calls,
  since they increase the usercount of images when used.

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

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

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

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index c3ef3a1f5fa..d9aa6b0ccbc 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4159,16 +4159,6 @@ 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 ***************** */
@@ -9477,6 +9467,11 @@ static void expand_material(FileData *fd, Main *mainvar, 
Material *ma)
        if (ma->nodetree)
                expand_nodetree(fd, mainvar, ma->nodetree);
 
+       if (ma->gp_style) {
+               MaterialGPencilStyle *gp_style = ma->gp_style;
+               expand_doit(fd, mainvar, gp_style->sima);
+               expand_doit(fd, mainvar, gp_style->ima);
+       }
 }
 
 static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)

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

Reply via email to