[Bf-blender-cvs] [5dd5c88] particles_refactor: Initialize the "id" attribute when adding particles to the state.
Lukas Tönne
noreply at git.blender.org
Tue Apr 22 12:06:04 CEST 2014
Commit: 5dd5c883fa17504a659fb79312489bc84bd472df
Author: Lukas Tönne
Date: Tue Dec 17 15:34:07 2013 +0100
https://developer.blender.org/rB5dd5c883fa17504a659fb79312489bc84bd472df
Initialize the "id" attribute when adding particles to the state.
===================================================================
M source/blender/blenkernel/intern/nparticle.c
===================================================================
diff --git a/source/blender/blenkernel/intern/nparticle.c b/source/blender/blenkernel/intern/nparticle.c
index a5b1785..df5fe85 100644
--- a/source/blender/blenkernel/intern/nparticle.c
+++ b/source/blender/blenkernel/intern/nparticle.c
@@ -330,6 +330,11 @@ bool BKE_nparticle_exists(NParticleState *state, NParticleID id)
return BKE_nparticle_find_index(state, id) >= 0;
}
+static bool nparticle_attribute_is_id(NParticleAttributeDescription *desc)
+{
+ return STREQ(desc->name, "id");
+}
+
int BKE_nparticle_add(NParticleState *state, NParticleID id)
{
int index = BKE_nparticle_find_index(state, id);
@@ -339,8 +344,13 @@ int BKE_nparticle_add(NParticleState *state, NParticleID id)
BLI_pbuf_add_elements(&attrstate->data, 1);
index = attrstate->data.totelem - 1;
- /* XXX default value? */
- memset(BLI_pbuf_get(&attrstate->data, index), 0, attrstate->data.elem_bytes);
+ if (nparticle_attribute_is_id(&attrstate->desc)) {
+ *(int*)BLI_pbuf_get(&attrstate->data, index) = (int)id;
+ }
+ else {
+ /* XXX default value? */
+ memset(BLI_pbuf_get(&attrstate->data, index), 0, attrstate->data.elem_bytes);
+ }
}
}
More information about the Bf-blender-cvs
mailing list