Fix T57994: Particle Instance modifiers 'Index Layer' off by one
authorPhilipp Oeser <info@graphics-engineer.com>
Thu, 22 Nov 2018 10:52:38 +0000 (11:52 +0100)
committerPhilipp Oeser <info@graphics-engineer.com>
Fri, 7 Dec 2018 15:33:25 +0000 (16:33 +0100)
better have this vertex color layer cover the whole 0-1 range

thx @sergey for checking

Maniphest Tasks: T57994

Differential Revision: https://developer.blender.org/D3976

source/blender/modifiers/intern/MOD_particleinstance.c

index d88526e2845441b6a6d0243927fc6cf0fb726ad1..b6163056fe37d425b169f4d0a417d6f6f2e472b0 100644 (file)
@@ -511,7 +511,7 @@ static DerivedMesh *applyModifier(
                                        const int ml_index = (ml - mloop);
                                        if (mloopcols_index != NULL) {
                                                const int part_index = vert_part_index[ml->v];
-                                               store_float_in_vcol(&mloopcols_index[ml_index], (float)part_index / psys->totpart);
+                                               store_float_in_vcol(&mloopcols_index[ml_index], (float)part_index / (float)(psys->totpart-1));
                                        }
                                        if (mloopcols_value != NULL) {
                                                const float part_value = vert_part_value[ml->v];