[Bf-blender-cvs] [19d17b217ae] master: Particles: use CD_PROP_FLOAT3 instead of CD_LOCATION

Jacques Lucke noreply at git.blender.org
Wed Jul 15 16:52:01 CEST 2020


Commit: 19d17b217ae0d1a89413e0f3f3b7be16614a535c
Author: Jacques Lucke
Date:   Wed Jul 15 16:48:30 2020 +0200
Branches: master
https://developer.blender.org/rB19d17b217ae0d1a89413e0f3f3b7be16614a535c

Particles: use CD_PROP_FLOAT3 instead of CD_LOCATION

`CD_LOCATION` was only used temporarily due to the lack
of a better alternative. This also removes the name from
`CD_LOCATION` again, because at most one layer of this
type should exist.

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

M	source/blender/blenkernel/intern/customdata.c
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/blenkernel/intern/simulation.cc
M	source/blender/modifiers/intern/MOD_simulation.cc

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

diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index b3f1fb9d789..30b6ce1bee1 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1868,7 +1868,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
     /* 42: CD_SCULPT_FACE_SETS */
     {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
     /* 43: CD_LOCATION */
-    {sizeof(float[3]), "vec3f", 1, "Location", NULL, NULL, NULL, NULL, NULL},
+    {sizeof(float[3]), "vec3f", 1, NULL, NULL, NULL, NULL, NULL, NULL},
     /* 44: CD_RADIUS */
     {sizeof(float), "MFloatProperty", 1, NULL, NULL, NULL, NULL, NULL, NULL},
     /* 45: CD_HAIRCURVE */
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 9a9d8dc215b..aa93c6cb854 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1900,7 +1900,7 @@ static int ptcache_sim_particle_write(int index, void *state_v, void **data, int
   ParticleSimulationState *state = (ParticleSimulationState *)state_v;
 
   const float *positions = (const float *)CustomData_get_layer_named(
-      &state->attributes, CD_LOCATION, "Position");
+      &state->attributes, CD_PROP_FLOAT3, "Position");
 
   PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, positions + (index * 3));
 
@@ -1913,7 +1913,7 @@ static void ptcache_sim_particle_read(
 
   BLI_assert(index < state->tot_particles);
   float *positions = (float *)CustomData_get_layer_named(
-      &state->attributes, CD_LOCATION, "Position");
+      &state->attributes, CD_PROP_FLOAT3, "Position");
 
   PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, 0, positions + (index * 3));
 }
diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc
index e163bb8da8d..e735c30ffae 100644
--- a/source/blender/blenkernel/intern/simulation.cc
+++ b/source/blender/blenkernel/intern/simulation.cc
@@ -168,13 +168,13 @@ namespace blender::bke {
 
 static void ensure_attributes_exist(ParticleSimulationState *state)
 {
-  if (CustomData_get_layer_named(&state->attributes, CD_LOCATION, "Position") == nullptr) {
+  if (CustomData_get_layer_named(&state->attributes, CD_PROP_FLOAT3, "Position") == nullptr) {
     CustomData_add_layer_named(
-        &state->attributes, CD_LOCATION, CD_CALLOC, nullptr, state->tot_particles, "Position");
+        &state->attributes, CD_PROP_FLOAT3, CD_CALLOC, nullptr, state->tot_particles, "Position");
   }
-  if (CustomData_get_layer_named(&state->attributes, CD_LOCATION, "Velocity") == nullptr) {
+  if (CustomData_get_layer_named(&state->attributes, CD_PROP_FLOAT3, "Velocity") == nullptr) {
     CustomData_add_layer_named(
-        &state->attributes, CD_LOCATION, CD_CALLOC, nullptr, state->tot_particles, "Velocity");
+        &state->attributes, CD_PROP_FLOAT3, CD_CALLOC, nullptr, state->tot_particles, "Velocity");
   }
   if (CustomData_get_layer_named(&state->attributes, CD_PROP_INT32, "ID") == nullptr) {
     CustomData_add_layer_named(
@@ -288,7 +288,7 @@ class CustomDataAttributesRef {
           builder.add<int32_t>(layer.name, 0);
           break;
         }
-        case CD_LOCATION: {
+        case CD_PROP_FLOAT3: {
           builder.add<float3>(layer.name, {0, 0, 0});
           break;
         }
diff --git a/source/blender/modifiers/intern/MOD_simulation.cc b/source/blender/modifiers/intern/MOD_simulation.cc
index 69a7bfd91ac..38dc1546763 100644
--- a/source/blender/modifiers/intern/MOD_simulation.cc
+++ b/source/blender/modifiers/intern/MOD_simulation.cc
@@ -125,7 +125,7 @@ static PointCloud *modifyPointCloud(ModifierData *md,
   }
 
   const float3 *positions = (const float3 *)CustomData_get_layer_named(
-      &state->attributes, CD_LOCATION, "Position");
+      &state->attributes, CD_PROP_FLOAT3, "Position");
   memcpy(pointcloud->co, positions, sizeof(float3) * state->tot_particles);
 
   for (int i = 0; i < state->tot_particles; i++) {



More information about the Bf-blender-cvs mailing list