[Bf-blender-cvs] [35a9a85b270] master: Fix T68542: ParticleSystem.uv_on_emitter returns always 0, 0 while Particle.uv_on_emitter returns a value.

Bastien Montagne noreply at git.blender.org
Mon Aug 12 11:47:14 CEST 2019


Commit: 35a9a85b27087f253100e7c66e8878a3ab015449
Author: Bastien Montagne
Date:   Mon Aug 12 11:44:44 2019 +0200
Branches: master
https://developer.blender.org/rB35a9a85b27087f253100e7c66e8878a3ab015449

Fix T68542: ParticleSystem.uv_on_emitter returns always 0,0 while Particle.uv_on_emitter returns a value.

'cached' particles (for paths actually) are only generated for some kind
(hair, keyed, and baked system afaik), not for all.

Note that we could probably just use directly `totpart` and `totchild`,
but keeping code as close to what it was as possible, for now...

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

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

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

diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 4c50e0c19ae..86ce0ade96b 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -449,8 +449,10 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys
   }
 
   part = particlesystem->part;
-  totpart = particlesystem->totcached;
-  totchild = particlesystem->totchildcache;
+  /* Note: only hair, keyed and baked particles may have cached items... */
+  totpart = particlesystem->totcached != 0 ? particlesystem->totcached : particlesystem->totpart;
+  totchild = particlesystem->totchildcache != 0 ? particlesystem->totchildcache :
+                                                  particlesystem->totchild;
 
   /* can happen for disconnected/global hair */
   if (part->type == PART_HAIR && !particlesystem->childcache) {



More information about the Bf-blender-cvs mailing list