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>2019-07-04 11:42:35 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-07-04 16:47:41 +0300
commit7ba096e1e72d99c2c43986cf009b14dfbea539a4 (patch)
tree33d2d6bf280cc5269a27f95416bf8aeee71b19d7 /source/blender/editors/physics/particle_edit.c
parent9e8e479a52206be6cd2ce0440730bdb75e05f297 (diff)
Fix T63788: Crash if particle system is turned off in particle editing mode
Make sure particle system edit never points to a modifier or particle system which becomes inactive. This is needed because copy-on-write will change pointers of them and those pointers are supposed to be restored from particle system evaluation. But since the particle system is disabled it never updates pointers. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D5180
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r--source/blender/editors/physics/particle_edit.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index dc634865a0a..4a55cb6c5c6 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -97,23 +97,38 @@ bool PE_poll(bContext *C)
Object *ob = CTX_data_active_object(C);
if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT)) {
- return 0;
+ return false;
+ }
+
+ PTCacheEdit *edit = PE_get_current(scene, ob);
+ if (edit == NULL) {
+ return false;
}
- return (PE_get_current(scene, ob) != NULL);
+ if (edit->psmd_eval == NULL || edit->psmd_eval->mesh_final == NULL) {
+ return false;
+ }
+
+ return true;
}
bool PE_hair_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- PTCacheEdit *edit;
if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT)) {
- return 0;
+ return false;
+ }
+
+ PTCacheEdit *edit = PE_get_current(scene, ob);
+ if (edit == NULL || edit->psys == NULL) {
+ return false;
+ }
+ if (edit->psmd_eval == NULL || edit->psmd_eval->mesh_final == NULL) {
+ return false;
}
- edit = PE_get_current(scene, ob);
- return (edit && edit->psys);
+ return true;
}
bool PE_poll_view3d(bContext *C)
@@ -1085,7 +1100,7 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
edit = psys->edit;
psmd_eval = edit->psmd_eval;
- if (!psmd_eval->mesh_final) {
+ if (psmd_eval == NULL || psmd_eval->mesh_final == NULL) {
return;
}
@@ -1217,7 +1232,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
psys = edit->psys;
- if (!edit->psmd_eval->mesh_final) {
+ if (edit->psmd_eval == NULL || edit->psmd_eval->mesh_final == NULL) {
return;
}
@@ -1489,7 +1504,7 @@ void update_world_cos(Depsgraph *UNUSED(depsgraph), Object *ob, PTCacheEdit *edi
KEY_K;
float hairmat[4][4];
- if (psys == 0 || psys->edit == 0 || psmd_eval->mesh_final == NULL) {
+ if (psys == 0 || psys->edit == 0 || psmd_eval == NULL || psmd_eval->mesh_final == NULL) {
return;
}