diff options
author | Antonioya <blendergit@gmail.com> | 2018-08-07 23:13:02 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-08-07 23:13:23 +0300 |
commit | 3884b86927747a2662d0852d6d57c043c37d8cb4 (patch) | |
tree | 0f875613685ada098d72aeb8a9c73978fa627102 /source/blender | |
parent | 95e490889dda96768e69ec222b91898f13ef0c1d (diff) |
Fix T56266: Second try to fix material problems
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c | 19 | ||||
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c | 19 |
2 files changed, 28 insertions, 10 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c index 155de7305b7..b47987ddbc0 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c @@ -135,8 +135,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); @@ -146,9 +146,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); } } 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); } } } |