Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-07 23:13:02 +0300
committerAntonioya <blendergit@gmail.com>2018-08-07 23:13:23 +0300
commit3884b86927747a2662d0852d6d57c043c37d8cb4 (patch)
tree0f875613685ada098d72aeb8a9c73978fa627102 /source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
parent95e490889dda96768e69ec222b91898f13ef0c1d (diff)
Fix T56266: Second try to fix material problems
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
index e937f6454c2..8e2e97abf84 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
@@ -143,8 +143,8 @@ static void bakeModifier(
assign_material(bmain, ob, newmat, ob->totcol, BKE_MAT_ASSIGN_USERPREF);
- copy_v3_v3(newmat->gp_style->stroke_rgba, gps->runtime.tmp_stroke_rgba);
- copy_v3_v3(newmat->gp_style->fill_rgba, gps->runtime.tmp_fill_rgba);
+ copy_v4_v4(newmat->gp_style->stroke_rgba, gps->runtime.tmp_stroke_rgba);
+ copy_v4_v4(newmat->gp_style->fill_rgba, gps->runtime.tmp_fill_rgba);
BLI_ghash_insert(gh_color, mat->id.name, newmat);
DEG_id_tag_update(&newmat->id, DEG_TAG_COPY_ON_WRITE);
@@ -154,9 +154,18 @@ static void bakeModifier(
gps->mat_nr = idx - 1;
}
else {
- /* reuse existing color */
- copy_v3_v3(gp_style->stroke_rgba, gps->runtime.tmp_stroke_rgba);
- copy_v3_v3(gp_style->fill_rgba, gps->runtime.tmp_fill_rgba);
+ /* reuse existing color (but update only first time) */
+ if (BLI_ghash_lookup(gh_color, mat->id.name) == NULL) {
+ copy_v4_v4(gp_style->stroke_rgba, gps->runtime.tmp_stroke_rgba);
+ copy_v4_v4(gp_style->fill_rgba, gps->runtime.tmp_fill_rgba);
+ BLI_ghash_insert(gh_color, mat->id.name, mat);
+ }
+ /* update previews (icon and thumbnail) */
+ if (mat->preview != NULL) {
+ mat->preview->flag[ICON_SIZE_ICON] |= PRV_CHANGED;
+ mat->preview->flag[ICON_SIZE_PREVIEW] |= PRV_CHANGED;
+ }
+ DEG_id_tag_update(&mat->id, DEG_TAG_COPY_ON_WRITE);
}
}
}