Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-05-15 17:15:13 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-05-15 18:20:02 +0300
commitfda05127dbaa6545eaaf4b307769e00cf5ca504a (patch)
treef8eed4f6ed8b8a3a311808a1ca54ee85448f2b47 /source/blender/editors/physics
parent5d879c5d42f3d7e80063ef2fb200342dd0939818 (diff)
Particle edit: Fix generation of KD tree for emitters
Fixes crahs using puff brush with copy-on-write.
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c12
-rw-r--r--source/blender/editors/physics/particle_object.c2
-rw-r--r--source/blender/editors/physics/physics_intern.h2
3 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 7f8f08beaac..3df934a8dca 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1101,10 +1101,12 @@ void recalc_lengths(PTCacheEdit *edit)
}
/* calculate a tree for finding nearest emitter's vertice */
-void recalc_emitter_field(Object *ob, ParticleSystem *psys)
+void recalc_emitter_field(Depsgraph *depsgraph, Object *ob, ParticleSystem *psys)
{
- DerivedMesh *dm=psys_get_modifier(ob, psys)->dm_final;
- PTCacheEdit *edit= psys->edit;
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+ ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys);
+ DerivedMesh *dm = psys_get_modifier(object_eval, psys_eval)->dm_final;
+ PTCacheEdit *edit = psys->edit;
float *vec, *nor;
int i, totface /*, totvert*/;
@@ -4451,7 +4453,7 @@ void PE_create_particle_edit(
recalc_lengths(edit);
if (psys && !cache)
- recalc_emitter_field(ob, psys);
+ recalc_emitter_field(depsgraph, ob, psys);
PE_update_object(depsgraph, scene, ob, 1);
}
@@ -4497,7 +4499,7 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
/* mesh may have changed since last entering editmode.
* note, this may have run before if the edit data was just created, so could avoid this and speed up a little */
if (edit && edit->psys)
- recalc_emitter_field(ob, edit->psys);
+ recalc_emitter_field(depsgraph, ob, edit->psys);
toggle_particle_cursor(C, 1);
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL);
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 76308fe1fd7..79d52abb32d 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -952,7 +952,7 @@ static void copy_particle_edit(
UI_GetThemeColor3ubv(TH_WIRE, edit->nosel_col);
recalc_lengths(edit);
- recalc_emitter_field(ob, psys);
+ recalc_emitter_field(depsgraph, ob, psys);
PE_update_object(depsgraph, scene, ob, true);
}
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index 108c033a87c..e94f582141b 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -74,7 +74,7 @@ void PE_create_particle_edit(
struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, struct PointCache *cache, struct ParticleSystem *psys);
void recalc_lengths(struct PTCacheEdit *edit);
-void recalc_emitter_field(struct Object *ob, struct ParticleSystem *psys);
+void recalc_emitter_field(struct Depsgraph *depsgraph, struct Object *ob, struct ParticleSystem *psys);
void update_world_cos(struct Depsgraph *depsgraph, struct Object *ob, struct PTCacheEdit *edit);
/* particle_object.c */