[Bf-blender-cvs] [21f17cc959f] blender-v2.80-release: GPencil: Fix wrong material when apply Opacity, Hue or Tint modifier

Antonioya noreply at git.blender.org
Wed Jul 24 16:29:01 CEST 2019


Commit: 21f17cc959f1d552122e01933cb9bfeeacc43bfd
Author: Antonioya
Date:   Thu Jul 18 18:07:56 2019 +0200
Branches: blender-v2.80-release
https://developer.blender.org/rB21f17cc959f1d552122e01933cb9bfeeacc43bfd

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.

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index bdab4c083e9..5b5290dc0ff 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -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) */



More information about the Bf-blender-cvs mailing list