[Bf-blender-cvs] [b5e1b13fe89] greasepencil-object: Fix inconsistent usercount handling of MaterialGPencilStyle.ima/.sima
Bastien Montagne
noreply at git.blender.org
Tue May 15 10:15:19 CEST 2018
Commit: b5e1b13fe89580bc992ccaea31cd1143552adc15
Author: Bastien Montagne
Date: Tue May 15 10:13:00 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb5e1b13fe89580bc992ccaea31cd1143552adc15
Fix inconsistent usercount handling of MaterialGPencilStyle.ima/.sima
Readfile was treating them as refcounted, RNA as user-one, and libquery
as not refcounted at all!
Full usercount makes more sense here, those images are used as 'real'
data for GP materials, not as temp setting of a brush!
===================================================================
M source/blender/blenkernel/intern/library_query.c
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 5bf48919a02..c6cbe9f4d79 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -632,8 +632,8 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
CALLBACK_INVOKE(material->texpaintslot->ima, IDWALK_CB_NOP);
}
if (material->gp_style != NULL) {
- CALLBACK_INVOKE(material->gp_style->sima, IDWALK_CB_NOP);
- CALLBACK_INVOKE(material->gp_style->ima, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(material->gp_style->sima, IDWALK_CB_USER);
+ CALLBACK_INVOKE(material->gp_style->ima, IDWALK_CB_USER);
}
break;
}
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index dd8f94c61d2..71e0f01844c 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -282,10 +282,7 @@ static void rna_GpencilColorData_stroke_image_set(PointerRNA *ptr, PointerRNA va
MaterialGPencilStyle *pcolor = (MaterialGPencilStyle *)ptr->data;
ID *id = value.data;
- if (id) {
- /* enable fake user */
- id_fake_user_set(id);
- }
+ id_us_plus(id);
pcolor->sima = (struct Image *)id;
}
@@ -294,10 +291,7 @@ static void rna_GpencilColorData_fill_image_set(PointerRNA *ptr, PointerRNA valu
MaterialGPencilStyle *pcolor = (MaterialGPencilStyle *)ptr->data;
ID *id = value.data;
- if (id) {
- /* enable fake user */
- id_fake_user_set(id);
- }
+ id_us_plus(id);
pcolor->ima = (struct Image *)id;
}
More information about the Bf-blender-cvs
mailing list