From e375685e06d0b4c52a0aacb8982684e45b490d5c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Jan 2019 21:25:22 +1100 Subject: Cleanup: pass main instead of context w/ ED_editors_exit/flush_edits Useful for calling from lower level code. --- source/blender/editors/util/ed_util.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/util') diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 188d06cec55..30021d6a0c9 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -157,12 +157,11 @@ void ED_editors_init(bContext *C) } /* frees all editmode stuff */ -void ED_editors_exit(bContext *C) +void ED_editors_exit(Main *bmain) { - Main *bmain = CTX_data_main(C); - - if (!bmain) + if (!bmain) { return; + } /* frees all editmode undos */ if (G_MAIN->wm.first) { @@ -198,11 +197,10 @@ void ED_editors_exit(bContext *C) /* flush any temp data from object editing to DNA before writing files, * rendering, copying, etc. */ -bool ED_editors_flush_edits(const bContext *C, bool for_render) +bool ED_editors_flush_edits(Main *bmain, bool for_render) { bool has_edited = false; Object *ob; - Main *bmain = CTX_data_main(C); /* loop through all data to find edit mode or object mode, because during * exiting we might not have a context for edit object and multiple sculpt @@ -400,7 +398,8 @@ void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, ID *old_id, static int ed_flush_edits_exec(bContext *C, wmOperator *UNUSED(op)) { - ED_editors_flush_edits(C, false); + Main *bmain = CTX_data_main(C); + ED_editors_flush_edits(bmain, false); return OPERATOR_FINISHED; } -- cgit v1.2.3