[Bf-blender-cvs] [4b90b80] particles_refactor: Fixed the particle attribute state data access functions. These have to use an index as key rather than a particle ID, since the latter is not available in a single attribute state without access to the parent particle state.

Lukas Tönne noreply at git.blender.org
Tue Apr 22 12:05:54 CEST 2014


Commit: 4b90b80c7093c5f553d5c07c24fdf2ef3d00bb0d
Author: Lukas Tönne
Date:   Mon Dec 16 18:42:14 2013 +0100
https://developer.blender.org/rB4b90b80c7093c5f553d5c07c24fdf2ef3d00bb0d

Fixed the particle attribute state data access functions. These have to
use an index as key rather than a particle ID, since the latter is not
available in a single attribute state without access to the parent
particle state.

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

M	source/blender/makesrna/intern/rna_nparticle.c

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

diff --git a/source/blender/makesrna/intern/rna_nparticle.c b/source/blender/makesrna/intern/rna_nparticle.c
index 7caeebf..d15f9fb 100644
--- a/source/blender/makesrna/intern/rna_nparticle.c
+++ b/source/blender/makesrna/intern/rna_nparticle.c
@@ -119,18 +119,19 @@ int rna_NParticleAttributeState_data_lookup_int(PointerRNA *ptr, int key, Pointe
 	NParticleAttributeState *state = ptr->data;
 	void *data = BLI_pbuf_get(&state->data, key);
 	RNA_pointer_create(ptr->id.data, data_srna, data, r_ptr);
-	return true;
+	return data != NULL;
 }
 
 int rna_NParticleAttributeState_data_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr, StructRNA *data_srna)
 {
 	NParticleAttributeState *state = ptr->data;
 	void *data = BLI_pbuf_get(&state->data, key);
-	PointerRNA data_ptr;
-	RNA_pointer_create(ptr->id.data, data_srna, data, &data_ptr);
-	/* XXX TODO */
-	BLI_assert(false);
-	return true;
+	if (data) {
+		memcpy(data, assign_ptr->data, state->data.elem_bytes);
+		return true;
+	}
+	else
+		return false;
 }
 
 #define DEF_ATTR_TYPE_FUNCS(lcase, ucase) \




More information about the Bf-blender-cvs mailing list