[Bf-blender-cvs] [ddb44cefbdc] functions: figure out how to add vertex colors to a new mesh

Jacques Lucke noreply at git.blender.org
Wed Jun 26 18:19:20 CEST 2019


Commit: ddb44cefbdc5a3e4884def03937a4439b3ff1fe4
Author: Jacques Lucke
Date:   Wed Jun 26 15:58:32 2019 +0200
Branches: functions
https://developer.blender.org/rBddb44cefbdc5a3e4884def03937a4439b3ff1fe4

figure out how to add vertex colors to a new mesh

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

M	source/blender/modifiers/intern/MOD_nodeparticles.c

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

diff --git a/source/blender/modifiers/intern/MOD_nodeparticles.c b/source/blender/modifiers/intern/MOD_nodeparticles.c
index c33660be62b..d616dc5b57a 100644
--- a/source/blender/modifiers/intern/MOD_nodeparticles.c
+++ b/source/blender/modifiers/intern/MOD_nodeparticles.c
@@ -104,6 +104,14 @@ static Mesh *tetrahedon_mesh_from_particle_state(BParticlesState state, float sc
   float(*positions)[3] = MEM_malloc_arrayN(point_amount, sizeof(float[3]), __func__);
   BParticles_state_get_positions(state, positions);
 
+  MLoopCol *loop_colors = CustomData_add_layer_named(
+      &mesh->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, mesh->totloop, "test");
+
+  for (uint i = 0; i < mesh->totloop; i++) {
+    MLoopCol color = {255, 255, 0, 255};
+    memcpy(loop_colors + i, &color, sizeof(MLoopCol));
+  }
+
   for (uint i = 0; i < point_amount; i++) {
     float offset0[3] = {1, -1, -1};
     float offset1[3] = {1, 1, 1};



More information about the Bf-blender-cvs mailing list