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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-31 03:34:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-31 04:07:13 +0300
commit51bba03b319319d59f739673c3fafb71bc308e0d (patch)
tree239eaf352608f35d924061002d4fcb8adb4f3749
parentd16e4d077dfe4ac887b51075784170911d3adca5 (diff)
Undo System: add Main argument to encode/decode
Needed since we don't always have the context, and avoids adding G_MAIN into undo callbacks.
-rw-r--r--source/blender/blenkernel/BKE_undo_system.h5
-rw-r--r--source/blender/blenkernel/intern/undo_system.c27
-rw-r--r--source/blender/editors/armature/editarmature_undo.c4
-rw-r--r--source/blender/editors/curve/editcurve_undo.c4
-rw-r--r--source/blender/editors/curve/editfont_undo.c4
-rw-r--r--source/blender/editors/lattice/editlattice_undo.c4
-rw-r--r--source/blender/editors/mesh/editmesh_undo.c4
-rw-r--r--source/blender/editors/metaball/editmball_undo.c4
-rw-r--r--source/blender/editors/physics/particle_edit_undo.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve_undo.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_undo.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c4
-rw-r--r--source/blender/editors/space_text/text_undo.c4
-rw-r--r--source/blender/editors/undo/memfile_undo.c6
14 files changed, 40 insertions, 42 deletions
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h
index 2863642a3e0..33eefcf6085 100644
--- a/source/blender/blenkernel/BKE_undo_system.h
+++ b/source/blender/blenkernel/BKE_undo_system.h
@@ -29,6 +29,7 @@ struct UndoStep;
struct bContext;
/* ID's */
+struct Main;
struct Mesh;
struct Object;
struct Scene;
@@ -115,8 +116,8 @@ typedef struct UndoType {
*/
void (*step_encode_init)(struct bContext *C, UndoStep *us);
- bool (*step_encode)(struct bContext *C, UndoStep *us);
- void (*step_decode)(struct bContext *C, UndoStep *us, int dir);
+ bool (*step_encode)(struct bContext *C, struct Main *bmain, UndoStep *us);
+ void (*step_decode)(struct bContext *C, struct Main *bmain, UndoStep *us, int dir);
/**
* \note When freeing all steps,
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index d16f0569a57..ab375da0925 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -146,16 +146,15 @@ static void undosys_id_ref_resolve(void *user_data, UndoRefID *id_ref)
}
}
-static bool undosys_step_encode(bContext *C, UndoStack *ustack, UndoStep *us)
+static bool undosys_step_encode(bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us)
{
CLOG_INFO(&LOG, 2, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
UNDO_NESTED_CHECK_BEGIN;
- bool ok = us->type->step_encode(C, us);
+ bool ok = us->type->step_encode(C, bmain, us);
UNDO_NESTED_CHECK_END;
if (ok) {
if (us->type->step_foreach_ID_ref != NULL) {
/* Don't use from context yet because sometimes context is fake and not all members are filled in. */
- Main *bmain = G.main;
us->type->step_foreach_ID_ref(us, undosys_id_ref_store, bmain);
}
#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
@@ -170,7 +169,7 @@ static bool undosys_step_encode(bContext *C, UndoStack *ustack, UndoStep *us)
return ok;
}
-static void undosys_step_decode(bContext *C, UndoStack *ustack, UndoStep *us, int dir)
+static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us, int dir)
{
CLOG_INFO(&LOG, 2, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
@@ -185,7 +184,7 @@ static void undosys_step_decode(bContext *C, UndoStack *ustack, UndoStep *us, in
else {
/* Load the previous memfile state so any ID's referenced in this
* undo step will be correctly resolved, see: T56163. */
- undosys_step_decode(C, ustack, us_iter, dir);
+ undosys_step_decode(C, bmain, ustack, us_iter, dir);
}
break;
}
@@ -193,12 +192,11 @@ static void undosys_step_decode(bContext *C, UndoStack *ustack, UndoStep *us, in
}
#endif
/* Don't use from context yet because sometimes context is fake and not all members are filled in. */
- Main *bmain = G.main;
us->type->step_foreach_ID_ref(us, undosys_id_ref_resolve, bmain);
}
UNDO_NESTED_CHECK_BEGIN;
- us->type->step_decode(C, us, dir);
+ us->type->step_decode(C, bmain, us, dir);
UNDO_NESTED_CHECK_END;
#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
@@ -487,6 +485,7 @@ UndoStep *BKE_undosys_step_push_init(UndoStack *ustack, bContext *C, const char
*/
bool BKE_undosys_step_push_with_type(UndoStack *ustack, bContext *C, const char *name, const UndoType *ut)
{
+ Main *bmain = G.main;
UNDO_NESTED_ASSERT(false);
undosys_stack_validate(ustack, false);
bool is_not_empty = ustack->step_active != NULL;
@@ -510,7 +509,6 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, bContext *C, const char
#ifdef WITH_GLOBAL_UNDO_ENSURE_UPDATED
if (ut->step_foreach_ID_ref != NULL) {
- Main *bmain = G.main;
if (bmain->is_memfile_undo_written == false) {
const char *name_internal = "MemFile Internal (pre)";
/* Don't let 'step_init' cause issues when adding memfile undo step. */
@@ -541,7 +539,7 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, bContext *C, const char
us->type = ut;
/* initialized, not added yet. */
- if (!undosys_step_encode(C, ustack, us)) {
+ if (!undosys_step_encode(C, bmain, ustack, us)) {
MEM_freeN(us);
undosys_stack_validate(ustack, true);
return false;
@@ -552,7 +550,6 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, bContext *C, const char
}
if (use_memfile_step) {
- Main *bmain = G.main;
const char *name_internal = "MemFile Internal (post)";
const bool ok = undosys_stack_push_main(ustack, name_internal, bmain);
if (ok) {
@@ -647,6 +644,7 @@ bool BKE_undosys_step_undo_with_data_ex(
bool use_skip)
{
UNDO_NESTED_ASSERT(false);
+ Main *bmain = G.main;
if (us) {
undosys_stack_validate(ustack, true);
}
@@ -664,14 +662,14 @@ bool BKE_undosys_step_undo_with_data_ex(
UndoStep *us_iter = ustack->step_active;
while (us_iter != us) {
if (us_iter->type->mode == BKE_UNDOTYPE_MODE_ACCUMULATE) {
- undosys_step_decode(C, ustack, us_iter, -1);
+ undosys_step_decode(C, bmain, ustack, us_iter, -1);
}
us_iter = us_iter->prev;
}
}
if (us->type->mode != BKE_UNDOTYPE_MODE_ACCUMULATE) {
- undosys_step_decode(C, ustack, us, -1);
+ undosys_step_decode(C, bmain, ustack, us, -1);
}
ustack->step_active = us_prev;
undosys_stack_validate(ustack, true);
@@ -706,6 +704,7 @@ bool BKE_undosys_step_redo_with_data_ex(
UndoStack *ustack, bContext *C, UndoStep *us,
bool use_skip)
{
+ Main *bmain = G.main;
UNDO_NESTED_ASSERT(false);
UndoStep *us_next = us ? us->next : NULL;
/* Unlike undo accumulate, we always use the next. */
@@ -719,14 +718,14 @@ bool BKE_undosys_step_redo_with_data_ex(
UndoStep *us_iter = ustack->step_active->next;
while (us_iter != us) {
if (us_iter->type->mode == BKE_UNDOTYPE_MODE_ACCUMULATE) {
- undosys_step_decode(C, ustack, us_iter, 1);
+ undosys_step_decode(C, bmain, ustack, us_iter, 1);
}
us_iter = us_iter->next;
}
}
/* Unlike undo, always redo accumulation state. */
- undosys_step_decode(C, ustack, us, 1);
+ undosys_step_decode(C, bmain, ustack, us, 1);
ustack->step_active = us_next;
if (use_skip) {
if (ustack->step_active && ustack->step_active->skip) {
diff --git a/source/blender/editors/armature/editarmature_undo.c b/source/blender/editors/armature/editarmature_undo.c
index 3119c303801..9cd96db7bdf 100644
--- a/source/blender/editors/armature/editarmature_undo.c
+++ b/source/blender/editors/armature/editarmature_undo.c
@@ -149,7 +149,7 @@ static bool armature_undosys_poll(bContext *C)
return editarm_object_from_context(C) != NULL;
}
-static bool armature_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool armature_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
@@ -173,7 +173,7 @@ static bool armature_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void armature_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void armature_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c
index 9163272fbf2..282b3722d3b 100644
--- a/source/blender/editors/curve/editcurve_undo.c
+++ b/source/blender/editors/curve/editcurve_undo.c
@@ -214,7 +214,7 @@ static bool curve_undosys_poll(bContext *C)
return (obedit != NULL);
}
-static bool curve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool curve_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
CurveUndoStep *us = (CurveUndoStep *)us_p;
@@ -237,7 +237,7 @@ static bool curve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void curve_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void curve_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c
index 85e361b495f..ab6ef4b4728 100644
--- a/source/blender/editors/curve/editfont_undo.c
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -339,7 +339,7 @@ static bool font_undosys_poll(bContext *C)
return editfont_object_from_context(C) != NULL;
}
-static bool font_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool font_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
FontUndoStep *us = (FontUndoStep *)us_p;
us->obedit_ref.ptr = editfont_object_from_context(C);
@@ -349,7 +349,7 @@ static bool font_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void font_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void font_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
diff --git a/source/blender/editors/lattice/editlattice_undo.c b/source/blender/editors/lattice/editlattice_undo.c
index 744f353f129..7ca28906861 100644
--- a/source/blender/editors/lattice/editlattice_undo.c
+++ b/source/blender/editors/lattice/editlattice_undo.c
@@ -151,7 +151,7 @@ static bool lattice_undosys_poll(bContext *C)
return editlatt_object_from_context(C) != NULL;
}
-static bool lattice_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool lattice_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
LatticeUndoStep *us = (LatticeUndoStep *)us_p;
@@ -175,7 +175,7 @@ static bool lattice_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void lattice_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void lattice_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 235878fed53..97a411cba54 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -699,7 +699,7 @@ static bool mesh_undosys_poll(bContext *C)
return editmesh_object_from_context(C) != NULL;
}
-static bool mesh_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool mesh_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
MeshUndoStep *us = (MeshUndoStep *)us_p;
@@ -723,7 +723,7 @@ static bool mesh_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void mesh_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void mesh_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c
index ebf056f71db..7616fb63256 100644
--- a/source/blender/editors/metaball/editmball_undo.c
+++ b/source/blender/editors/metaball/editmball_undo.c
@@ -157,7 +157,7 @@ static bool mball_undosys_poll(bContext *C)
return editmball_object_from_context(C) != NULL;
}
-static bool mball_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool mball_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
MBallUndoStep *us = (MBallUndoStep *)us_p;
@@ -181,7 +181,7 @@ static bool mball_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void mball_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void mball_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c
index 9839248a4cf..ea48d0b70b9 100644
--- a/source/blender/editors/physics/particle_edit_undo.c
+++ b/source/blender/editors/physics/particle_edit_undo.c
@@ -236,7 +236,7 @@ static bool particle_undosys_poll(struct bContext *C)
return (edit != NULL);
}
-static bool particle_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool particle_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
ParticleUndoStep *us = (ParticleUndoStep *)us_p;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -247,7 +247,7 @@ static bool particle_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void particle_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void particle_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_PARTICLE_EDIT);
diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c
index 59f424a9f31..9e116a5a3aa 100644
--- a/source/blender/editors/sculpt_paint/paint_curve_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c
@@ -98,7 +98,7 @@ static void paintcurve_undosys_step_encode_init(struct bContext *C, UndoStep *us
UNUSED_VARS(C, us_p);
}
-static bool paintcurve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool paintcurve_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
Paint *p = BKE_paint_get_active_from_context(C);
PaintCurve *pc = p ? (p->brush ? p->brush->paint_curve : NULL) : NULL;
@@ -115,7 +115,7 @@ static bool paintcurve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), UndoStep *us_p, int UNUSED(dir))
+static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p;
undocurve_to_paintcurve(&us->data, us->pc);
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c
index 7a4641008a4..b049e613b86 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -436,7 +436,7 @@ static void image_undosys_step_encode_init(struct bContext *UNUSED(C), UndoStep
BLI_listbase_clear(&us->tiles);
}
-static bool image_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p)
+static bool image_undosys_step_encode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p)
{
/* dummy, encoding is done along the way by adding tiles
* to the current 'ImageUndoStep' added by encode_init. */
@@ -466,7 +466,7 @@ static bool image_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p
return true;
}
-static void image_undosys_step_decode(struct bContext *UNUSED(C), UndoStep *us_p, int UNUSED(dir))
+static void image_undosys_step_decode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
ImageUndoStep *us = (ImageUndoStep *)us_p;
#if 0
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 0355f8e933b..8b8493aa415 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1049,7 +1049,7 @@ static void sculpt_undosys_step_encode_init(struct bContext *UNUSED(C), UndoStep
BLI_listbase_clear(&us->data.nodes);
}
-static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p)
+static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p)
{
/* dummy, encoding is done along the way by adding tiles
* to the current 'SculptUndoStep' added by encode_init. */
@@ -1063,7 +1063,7 @@ static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_
return true;
}
-static void sculpt_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void sculpt_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_SCULPT);
diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c
index f2bbcddcc27..566100f0034 100644
--- a/source/blender/editors/space_text/text_undo.c
+++ b/source/blender/editors/space_text/text_undo.c
@@ -94,7 +94,7 @@ static void text_undosys_step_encode_init(struct bContext *C, UndoStep *us_p)
us->data.pos = -1;
}
-static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool text_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
TextUndoStep *us = (TextUndoStep *)us_p;
@@ -112,7 +112,7 @@ static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void text_undosys_step_decode(struct bContext *C, UndoStep *us_p, int dir)
+static void text_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir)
{
TextUndoStep *us = (TextUndoStep *)us_p;
Text *text = us->text_ref.ptr;
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index 1b0fe9a0c3d..dc1870c2d19 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -71,12 +71,11 @@ static bool memfile_undosys_poll(bContext *C)
return true;
}
-static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool memfile_undosys_step_encode(struct bContext *UNUSED(C), struct Main *bmain, UndoStep *us_p)
{
MemFileUndoStep *us = (MemFileUndoStep *)us_p;
/* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */
- struct Main *bmain = CTX_data_main(C);
UndoStack *ustack = ED_undo_stack_get();
/* can be NULL, use when set. */
@@ -87,9 +86,8 @@ static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void memfile_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void memfile_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir))
{
- struct Main *bmain = CTX_data_main(C);
ED_editors_exit(bmain, false);
MemFileUndoStep *us = (MemFileUndoStep *)us_p;