From 9054b834028fc5c0e67f5225ad09dd7107484951 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 15 Oct 2019 12:22:43 +0200 Subject: Cleanup depsgraph access in particle_edit.c 'PE_set_data' / 'PE_set_view3d_data' would give us a depsgraph already, so use it. Also fix access to PEData->depsgraph without calling 'PE_set_data' prior. Addresses concern raised in rBcf2c09002fae. Reviewed By: sergey Differential Revision: https://developer.blender.org/D6067 --- source/blender/editors/physics/particle_edit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/physics') diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 3978f7ba3b5..f16a372cb3c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -470,8 +470,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data) { PE_set_data(C, data); - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - ED_view3d_viewcontext_init(C, &data->vc, depsgraph); + ED_view3d_viewcontext_init(C, &data->vc, data->depsgraph); if (!XRAY_ENABLED(data->vc.v3d)) { if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) { @@ -1811,10 +1810,13 @@ bool PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool desele PEData data; Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - PTCacheEdit *edit = PE_get_current(data.depsgraph, scene, ob); POINT_P; KEY_K; + PE_set_view3d_data(C, &data); + + PTCacheEdit *edit = PE_get_current(data.depsgraph, scene, ob); + if (!PE_start_edit(edit)) { return false; } @@ -1828,7 +1830,6 @@ bool PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool desele } } - PE_set_view3d_data(C, &data); data.mval = mval; data.rad = ED_view3d_select_dist_px(); @@ -1997,7 +1998,6 @@ static const EnumPropertyItem select_random_type_items[] = { static int select_random_exec(bContext *C, wmOperator *op) { - Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); PEData data; int type; @@ -2017,7 +2017,7 @@ static int select_random_exec(bContext *C, wmOperator *op) PE_set_data(C, &data); data.select_action = SEL_SELECT; - edit = PE_get_current(depsgraph, data.scene, data.ob); + edit = PE_get_current(data.depsgraph, data.scene, data.ob); rng = BLI_rng_new_srandom(seed); @@ -4940,7 +4940,7 @@ static void shape_cut(PEData *data, int pa_index) static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op)) { - Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); ParticleEditSettings *pset = PE_settings(scene); -- cgit v1.2.3