GPencil: Fix wrong material when apply Opacity, Hue or Tint modifier

When apply the modifier a new material is created, but it was assigned wrongly. The problem was the index was base 0 already, so subtract 1, got a wrong value.
This commit is contained in:
Antonio Vazquez 2019-07-18 18:07:56 +02:00
parent 23ea4b56ad
commit 65aac86d5a
1 changed files with 2 additions and 3 deletions

View File

@ -192,9 +192,8 @@ void gpencil_apply_modifier_material(
BLI_ghash_insert(gh_color, mat->id.name, newmat);
DEG_id_tag_update(&newmat->id, ID_RECALC_COPY_ON_WRITE);
}
/* Reaasign color index. */
int idx = BKE_gpencil_object_material_get_index(ob, newmat);
gps->mat_nr = idx - 1;
/* Reassign color index. */
gps->mat_nr = BKE_gpencil_object_material_get_index(ob, newmat);
}
else {
/* reuse existing color (but update only first time) */