diff options
author | Luca Rood <dev@lucarood.com> | 2017-07-05 16:50:01 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-07-05 16:50:01 +0300 |
commit | bdeeb29482af2ab44e03e4681eb079bdcff82b21 (patch) | |
tree | 1bd0efa9a5e81fd93ef8af737605eb383fb6bf5d /source/blender/makesrna/intern | |
parent | f3764d51bd79a5b1eb7ea512817820da9d5150c5 (diff) | |
parent | fed853ea782211298c902759ec8cd8e455d8b41d (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 29f33907d39..b40519386cc 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -448,10 +448,12 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys int totpart; int totchild = 0; int totface; + int totvert; int num = -1; DM_ensure_tessface(modifier->dm_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ totface = modifier->dm_final->getNumTessFaces(modifier->dm_final); + totvert = modifier->dm_final->getNumVerts(modifier->dm_final); /* 1. check that everything is ok & updated */ if (!particlesystem || !totface) { @@ -486,13 +488,26 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys return num; } } + else if (part->from == PART_FROM_VERT) { + if (num != DMCACHE_NOTFOUND && num < totvert) { + MFace *mface = modifier->dm_final->getTessFaceDataArray(modifier->dm_final, CD_MFACE); + + *r_fuv = &particle->fuv; + + for (int i = 0; i < totface; i++, mface++) { + if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) { + return i; + } + } + } + } } else { ChildParticle *cpa = particlesystem->child + particle_no - totpart; num = cpa->num; if (part->childtype == PART_CHILD_FACES) { - if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { + if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME, PART_FROM_VERT)) { if (num != DMCACHE_NOTFOUND && num < totface) { *r_fuv = &cpa->fuv; return num; @@ -512,6 +527,19 @@ static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesys return num; } } + else if (part->from == PART_FROM_VERT) { + if (num != DMCACHE_NOTFOUND && num < totvert) { + MFace *mface = modifier->dm_final->getTessFaceDataArray(modifier->dm_final, CD_MFACE); + + *r_fuv = &parent->fuv; + + for (int i = 0; i < totface; i++, mface++) { + if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) { + return i; + } + } + } + } } } |