[Bf-blender-cvs] [10d17ae] particles_refactor: bpy particle objects are still valid if the particle id does not yet exist. This allows a create-on-write feature, where a particle is automatically added to the state if the pid does not yet exist.

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


Commit: 10d17ae2b16bc88a6e9551fe99b884eadfa46211
Author: Lukas Tönne
Date:   Sat Dec 21 09:40:16 2013 +0100
https://developer.blender.org/rB10d17ae2b16bc88a6e9551fe99b884eadfa46211

bpy particle objects are still valid if the particle id does not yet
exist. This allows a create-on-write feature, where a particle is
automatically added to the state if the pid does not yet exist.

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

M	source/blender/python/bparticles/bparticles_py_types.c

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

diff --git a/source/blender/python/bparticles/bparticles_py_types.c b/source/blender/python/bparticles/bparticles_py_types.c
index 1b517de..34f1cc1 100644
--- a/source/blender/python/bparticles/bparticles_py_types.c
+++ b/source/blender/python/bparticles/bparticles_py_types.c
@@ -325,12 +325,7 @@ static PyObject *bpy_bpar_particleseq_subscript_int(BPy_NParticleAttributeStateS
 	NParticleID id = (NParticleID)keynum;
 	
 	BKE_nparticle_iter_from_id(self->state, &iter, id);
-	if (BKE_nparticle_iter_valid(&iter))
-		return BPy_NParticleParticle_CreatePyObject(self->state, id, iter);
-	
-	PyErr_Format(PyExc_IndexError,
-	             "NParticleParticleSeq[id]: id %d not found", keynum);
-	return NULL;
+	return BPy_NParticleParticle_CreatePyObject(self->state, id, iter);
 }
 
 static int bpy_bpar_particleseq_contains(BPy_NParticleParticleSeq *self, PyObject *value)




More information about the Bf-blender-cvs mailing list