diff options
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 44 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 41 |
3 files changed, 18 insertions, 70 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index d9a5cbab16e..d87d63454f0 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -303,9 +303,6 @@ void psys_set_current_num(Object *ob, int index); struct LatticeDeformData *psys_create_lattice_deform_data(struct ParticleSimulationData *sim); struct ParticleSystem *psys_orig_get(struct ParticleSystem *psys); -struct ParticleSystem *psys_eval_get(struct Depsgraph *depsgraph, - struct Object *object, - struct ParticleSystem *psys); bool psys_in_edit_mode(struct Depsgraph *depsgraph, struct ParticleSystem *psys); bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); bool psys_check_edited(struct ParticleSystem *psys); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 2cd3ff1ccf3..8c322f0c853 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -298,24 +298,6 @@ ParticleSystem *psys_orig_get(ParticleSystem *psys) return psys->orig_psys; } -struct ParticleSystem *psys_eval_get(Depsgraph *depsgraph, - Object *object, - ParticleSystem *psys) -{ - Object *object_eval = DEG_get_evaluated_object(depsgraph, object); - if (object_eval == object) { - return psys; - } - ParticleSystem *psys_eval = object_eval->particlesystem.first; - while (psys_eval != NULL) { - if (psys_eval->orig_psys == psys) { - return psys_eval; - } - psys_eval = psys_eval->next; - } - return psys_eval; -} - static PTCacheEdit *psys_orig_edit_get(ParticleSystem *psys) { if (psys->orig_psys == NULL) { @@ -2618,7 +2600,6 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re } void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params) { - Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); ParticleCacheKey *ca, **cache = edit->pathcache; ParticleEditSettings *pset = &scene->toolsettings->particle; @@ -2626,16 +2607,9 @@ void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCac PTCacheEditKey *ekey = NULL; ParticleSystem *psys = edit->psys; - ParticleSystem *psys_eval = NULL; ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); - ParticleSystemModifierData *psmd_eval = NULL; - - if (psmd != NULL) { - psmd_eval = (ParticleSystemModifierData *)modifiers_findByName(ob_eval, psmd->modifier.name); - psys_eval = psmd_eval->psys; - } - ParticleData *pa = psys_eval ? psys_eval->particles : NULL; + ParticleData *pa = psys ? psys->particles : NULL; ParticleInterpolationData pind; ParticleKey result; @@ -2664,7 +2638,7 @@ void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCac /* frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; */ /* UNUSED */ - const bool use_weight = (pset->brushtype == PE_BRUSH_WEIGHT) && (psys_eval != NULL) && (psys_eval->particles != NULL); + const bool use_weight = (pset->brushtype == PE_BRUSH_WEIGHT) && (psys != NULL) && (psys->particles != NULL); if (use_weight) { ; /* use weight painting colors now... */ @@ -2709,10 +2683,10 @@ void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCac cache[i]->segments = segments; /*--get the first data points--*/ - init_particle_interpolation(ob_eval, psys_eval, pa, &pind); + init_particle_interpolation(ob, psys, pa, &pind); - if (psys_eval) { - psys_mat_hair_to_global(ob_eval, psmd_eval->mesh_final, psys->part->from, pa, hairmat); + if (psys) { + psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, pa, hairmat); copy_v3_v3(rotmat[0], hairmat[2]); copy_v3_v3(rotmat[1], hairmat[1]); copy_v3_v3(rotmat[2], hairmat[0]); @@ -2731,7 +2705,7 @@ void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCac time = (float)k / (float)segments; t = birthtime + time * (dietime - birthtime); result.time = -t; - do_particle_interpolation(psys_eval, i, pa, t, &pind, &result); + do_particle_interpolation(psys, i, pa, t, &pind, &result); copy_v3_v3(ca->co, result.co); /* non-hair points are already in global space */ @@ -2828,9 +2802,9 @@ void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCac ParticleSimulationData sim = {0}; sim.depsgraph = depsgraph; sim.scene = scene; - sim.ob = ob_eval; - sim.psys = psys_eval; - sim.psmd = psys_get_modifier(ob_eval, psys_eval); + sim.ob = ob; + sim.psys = psys; + sim.psmd = psys_get_modifier(ob, psys); psys_cache_child_paths(&sim, cfra, true, use_render_params); } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index fcf895fbd3c..359e9365ea7 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -262,8 +262,7 @@ static PTCacheEdit *pe_get_current( } else { if (create && !psys->edit) { - ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys); - if (psys_eval->flag & PSYS_HAIR_DONE) { + if (psys->flag & PSYS_HAIR_DONE) { PE_create_particle_edit(depsgraph, scene, ob, NULL, psys); } } @@ -645,11 +644,9 @@ static void foreach_mouse_hit_point(PEData *data, ForPointFunc func, int selecte static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected) { - Object *ob_eval = DEG_get_evaluated_object(data->depsgraph, data->ob); PTCacheEdit *edit = data->edit; ParticleSystem *psys = edit->psys; ParticleSystemModifierData *psmd = NULL; - ParticleSystemModifierData *psmd_eval = NULL; ParticleEditSettings *pset= PE_settings(data->scene); POINT_P; KEY_K; float mat[4][4], imat[4][4]; @@ -660,10 +657,6 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected if (edit->psys) psmd= psys_get_modifier(data->ob, edit->psys); - if (psmd != NULL) { - psmd_eval = (ParticleSystemModifierData *)modifiers_findByName(ob_eval, psmd->modifier.name); - } - /* all is selected in path mode */ if (pset->selectmode==SCE_SELECT_PATH) selected= 0; @@ -677,7 +670,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected if (selected==0 || key->flag & PEK_SELECT) { if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) { if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) { - psys_mat_hair_to_global(data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat); + psys_mat_hair_to_global(data->ob, psmd->mesh_final, psys->part->from, psys->particles + p, mat); invert_m4_m4(imat, mat); } @@ -692,7 +685,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected if (selected==0 || key->flag & PEK_SELECT) { if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) { if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) { - psys_mat_hair_to_global(data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat); + psys_mat_hair_to_global(data->ob, psmd->mesh_final, psys->part->from, psys->particles + p, mat); invert_m4_m4(imat, mat); } @@ -1111,11 +1104,9 @@ void recalc_lengths(PTCacheEdit *edit) } /* calculate a tree for finding nearest emitter's vertice */ -void recalc_emitter_field(Depsgraph *depsgraph, Object *ob, ParticleSystem *psys) +void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *ob, ParticleSystem *psys) { - Object *object_eval = DEG_get_evaluated_object(depsgraph, ob); - ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys); - Mesh *mesh = psys_get_modifier(object_eval, psys_eval)->mesh_final; + Mesh *mesh = psys_get_modifier(ob, psys)->mesh_final; PTCacheEdit *edit = psys->edit; float *vec, *nor; int i, totface /*, totvert*/; @@ -1203,27 +1194,19 @@ static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob, DEG_id_tag_update(&ob->id, DEG_TAG_SELECT_UPDATE); } -void update_world_cos(Depsgraph *depsgraph, Object *ob, PTCacheEdit *edit) +void update_world_cos(Depsgraph *UNUSED(depsgraph), Object *ob, PTCacheEdit *edit) { - Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); ParticleSystem *psys = edit->psys; - ParticleSystem *psys_eval = NULL; ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); - ParticleSystemModifierData *psmd_eval = NULL; POINT_P; KEY_K; float hairmat[4][4]; - if (psmd != NULL) { - psmd_eval = (ParticleSystemModifierData *)modifiers_findByName(ob_eval, psmd->modifier.name); - psys_eval = psmd_eval->psys; - } - - if (psys == 0 || psys->edit == 0 || psmd_eval->mesh_final == NULL) + if (psys == 0 || psys->edit == 0 || psmd->mesh_final == NULL) return; LOOP_POINTS { if (!(psys->flag & PSYS_GLOBAL_HAIR)) - psys_mat_hair_to_global(ob_eval, psmd_eval->mesh_final, psys->part->from, psys_eval->particles+p, hairmat); + psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, psys->particles+p, hairmat); LOOP_KEYS { copy_v3_v3(key->world_co, key->co); @@ -4364,20 +4347,14 @@ void PE_create_particle_edit( Depsgraph *depsgraph, Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys) { PTCacheEdit *edit; - Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); ParticleSystemModifierData *psmd = (psys) ? psys_get_modifier(ob, psys) : NULL; - ParticleSystemModifierData *psmd_eval = NULL; POINT_P; KEY_K; ParticleData *pa = NULL; HairKey *hkey; int totpoint; - if (psmd != NULL) { - psmd_eval = (ParticleSystemModifierData *)modifiers_findByName(ob_eval, psmd->modifier.name); - } - /* no psmd->dm happens in case particle system modifier is not enabled */ - if (!(psys && psmd_eval && psmd_eval->mesh_final) && !cache) + if (!(psys && psmd && psmd->mesh_final) && !cache) return; if (cache && cache->flag & PTCACHE_DISK_CACHE) |