diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-07-04 14:13:49 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-07-04 14:13:49 +0300 |
commit | f23ed929ee021e11e8d47973d25f9039e9f91c17 (patch) | |
tree | 32cd0f2a4dbb59a639a9523a72e0211fb69bd98b /source/blender/blenkernel/intern/particle.c | |
parent | fc8f6e8f7a3fcc3b17ee7db6291fb9dcb71dc185 (diff) | |
parent | f86b43e130cb0a1d5a460cc72bcd979c479215bc (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/makesdna/DNA_particle_types.h
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 0a7ccc3ce35..dabade56490 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -255,11 +255,16 @@ struct LatticeDeformData *psys_create_lattice_deform_data(ParticleSimulationData if (psys_in_edit_mode(sim->scene, sim->psys) == 0) { Object *lattice = NULL; ModifierData *md = (ModifierData *)psys_get_modifier(sim->ob, sim->psys); + int mode = G.is_rendering ? eModifierMode_Render : eModifierMode_Realtime; for (; md; md = md->next) { if (md->type == eModifierType_Lattice) { - LatticeModifierData *lmd = (LatticeModifierData *)md; - lattice = lmd->object; + if (md->mode & mode) { + LatticeModifierData *lmd = (LatticeModifierData *)md; + lattice = lmd->object; + sim->psys->lattice_strength = lmd->strength; + } + break; } } @@ -2710,7 +2715,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re /* lattices have to be calculated separately to avoid mixups between effector calculations */ if (psys->lattice_deform_data) { for (k = 0, ca = cache[p]; k <= segments; k++, ca++) - calc_latt_deform(psys->lattice_deform_data, ca->co, 1.0f); + calc_latt_deform(psys->lattice_deform_data, ca->co, psys->lattice_strength); } } @@ -3753,7 +3758,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * } if (psys->lattice_deform_data && edit == 0) - calc_latt_deform(psys->lattice_deform_data, state->co, 1.0f); + calc_latt_deform(psys->lattice_deform_data, state->co, psys->lattice_strength); } } } @@ -3992,7 +3997,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta do_child_modifiers(NULL, sim, NULL, key1->co, key1->vel, key1->rot, par_orco, cpa, cpa->fuv, mat, state, t); if (psys->lattice_deform_data) - calc_latt_deform(psys->lattice_deform_data, state->co, 1.0f); + calc_latt_deform(psys->lattice_deform_data, state->co, psys->lattice_strength); } else { if (pa->state.time == cfra || ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) @@ -4051,7 +4056,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta } if (sim->psys->lattice_deform_data) - calc_latt_deform(sim->psys->lattice_deform_data, state->co, 1.0f); + calc_latt_deform(sim->psys->lattice_deform_data, state->co, psys->lattice_strength); } return 1; @@ -4298,7 +4303,7 @@ void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys) hkey = pa->hair; for (h = 0; h < pa->totkey; h++, hkey++) { mul_m4_v3(hairmat, hkey->co); - calc_latt_deform(psys->lattice_deform_data, hkey->co, 1.0f); + calc_latt_deform(psys->lattice_deform_data, hkey->co, psys->lattice_strength); mul_m4_v3(imat, hkey->co); } } |