139 if (
U.undomemory != 0) {
140 const size_t memory_limit = size_t(
U.undomemory) * 1024 * 1024;
171 if (bmain->
lock !=
nullptr) {
173 reports,
RPT_DEBUG,
"Checking validity of current .blend file *BEFORE* undo step");
213 if (bmain->
lock !=
nullptr) {
272 if (undo_step_from_name ==
nullptr) {
273 CLOG_ERROR(&
LOG,
"Step name='%s' not found in current undo stack", undo_name);
279 if (undo_step_target ==
nullptr) {
280 CLOG_ERROR(&
LOG,
"Step name='%s' cannot be undone", undo_name);
286 wm->undo_stack, undo_step_target,
nullptr);
292 "name='%s', found direction=%s",
294 (undo_dir ==
STEP_UNDO) ?
"STEP_UNDO" :
"STEP_REDO");
315 const int active_step_index =
BLI_findindex(&
wm->undo_stack->steps,
wm->undo_stack->step_active);
316 if (undo_index == active_step_index) {
323 "index='%d', found direction=%s",
325 (undo_dir ==
STEP_UNDO) ?
"STEP_UNDO" :
"STEP_REDO");
340 const UndoStep *us =
wm->undo_stack->step_active;
392 if (view_layer !=
nullptr) {
395 if (obact !=
nullptr) {
416 if (view_layer !=
nullptr) {
419 if (obact !=
nullptr) {
428 if ((
id ==
nullptr) || (obact->
data ==
nullptr) ||
444 return wm->undo_stack;
485 if (
wm->undo_stack ==
nullptr) {
521 if (
wm->undo_stack ==
nullptr) {
526 "Undo disabled at startup in background-mode "
527 "(call `ed.undo_push()` to explicitly initialize the undo-system)");
561 ot->description =
"Undo previous action";
562 ot->idname =
"ED_OT_undo";
572 ot->name =
"Undo Push";
573 ot->description =
"Add an undo state (internal use only)";
574 ot->idname =
"ED_OT_undo_push";
585 "Add an undo step *function may be moved*",
604 ot->description =
"Redo previous action";
605 ot->idname =
"ED_OT_redo";
615 ot->name =
"Undo and Redo";
616 ot->description =
"Undo and redo previous action";
617 ot->idname =
"ED_OT_undo_redo";
632 bool success =
false;
647 ARegion *region_repeat = redo_region_from_hud ? redo_region_from_hud :
683 printf(
"redo_cb: operator redo failed: %s, return %d\n", op->
type->
name, retval);
693 printf(
"redo_cb: WM_operator_repeat_check returned false %s\n", op->
type->
name);
756 ot->name =
"Undo History";
757 ot->description =
"Redo specific action in history";
758 ot->idname =
"ED_OT_undo_history";
765 RNA_def_int(
ot->srna,
"item", 0, 0, INT_MAX,
"Item",
"", 0, INT_MAX);
782 if (base !=
nullptr) {
783 view_layer->
basact = base;
794 const Scene *scene_ref,
798 if (*scene_p == scene_ref) {
802 if (win->scene == scene_ref) {
803 *scene_p = win->scene;
813 uint object_array_len,
814 uint object_array_stride)
821 for (
Base *base : bases) {
824 Object **ob_p = object_array;
825 for (
uint i = 0;
i < object_array_len;
832 for (
Base *base : bases) {
833 const ID *
id =
static_cast<ID *
>(base->object->data);
864 const short object_type = baseact->
object->
type;
868 for (
Base *base = baseact,
871 base = base_next, base_next = base_next ? base_next->
next :
nullptr)
873 Object *ob = base->object;
875 if (object_data.
add(
static_cast<const ID *
>(ob->
data))) {
893 const short object_type = baseact->
object->
type;
900 base = base_next, base_next = base_next ? base_next->
next :
nullptr)
902 Object *ob = base->object;
904 if (object_data.
add(
static_cast<const ID *
>(ob->
data))) {
void BKE_callback_exec_id(Main *bmain, ID *id, eCbEvent evt)
ARegion * CTX_wm_region_popup(const bContext *C)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
void CTX_wm_region_set(bContext *C, ARegion *region)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
ListBase * BKE_view_layer_object_bases_get(ViewLayer *view_layer)
void BKE_report(ReportList *reports, eReportType type, const char *message)
ARegion * BKE_area_find_region_active_win(const ScrArea *area)
void BKE_undosys_step_load_from_index(UndoStack *ustack, bContext *C, int index)
bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name)
bool BKE_undosys_step_redo(UndoStack *ustack, bContext *C)
bool BKE_undosys_step_undo(UndoStack *ustack, bContext *C)
void BKE_undosys_stack_clear_active(UndoStack *ustack)
eUndoPushReturn BKE_undosys_step_push(UndoStack *ustack, bContext *C, const char *name)
eUndoStepDir BKE_undosys_step_calc_direction(const UndoStack *ustack, const UndoStep *us_target, const UndoStep *us_reference)
void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size_t memory_limit)
UndoStep * BKE_undosys_step_find_by_name(UndoStack *ustack, const char *name)
bool BKE_undosys_step_load_data_ex(UndoStack *ustack, bContext *C, UndoStep *us_target, UndoStep *us_reference, bool use_skip)
@ UNDO_PUSH_RET_OVERRIDE_CHANGED
void BKE_undosys_stack_group_end(UndoStack *ustack)
UndoStack * BKE_undosys_stack_create()
void BKE_undosys_print(UndoStack *ustack)
void BKE_undosys_stack_group_begin(UndoStack *ustack)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
#define POINTER_OFFSET(v, ofs)
Utilities ensuring .blend file (i.e. Main) is in valid state during write and/or read process.
bool BLO_main_validate_libraries(Main *bmain, ReportList *reports)
#define CLOG_ERROR(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
#define CLOG_CHECK(clg_ref, verbose_level,...)
#define CLOG_INFO(clg_ref, level,...)
#define OB_MODE_ALL_PAINT
Object is a sort of wrapper for general info.
void ED_outliner_select_sync_from_all_tag(bContext *C)
void ED_region_tag_refresh_ui(ARegion *region)
ARegion * ED_area_type_hud_redo_region_find(const ScrArea *area, const ARegion *hud_region)
bool ED_operator_screenactive(bContext *C)
#define ND_LIB_OVERRIDE_CHANGED
void append(const T &value)
void ED_undo_object_set_active_or_warn(Scene *scene, ViewLayer *view_layer, Object *ob, const char *info, CLG_LogRef *log)
void ED_undo_push(bContext *C, const char *str)
bool ED_undo_is_legacy_compatible_for_property(bContext *C, ID *id, PointerRNA &ptr)
void ED_OT_redo(wmOperatorType *ot)
UndoStack * ED_undo_stack_get()
static wmOperatorStatus undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void ed_undo_step_pre(bContext *C, wmWindowManager *wm, const enum eUndoStepDir undo_dir, ReportList *reports)
void ED_undo_push_op(bContext *C, wmOperator *op)
void ED_undo_pop_op(bContext *C, wmOperator *op)
void ED_undo_group_begin(bContext *C)
bool ED_undo_is_valid(const bContext *C, const char *undoname)
void ED_OT_undo_redo(wmOperatorType *ot)
void ED_undo_operator_repeat_cb_evt(bContext *C, void *arg_op, int)
static int ed_undo_step_by_index(bContext *C, const int undo_index, ReportList *reports)
void ED_undo_operator_repeat_cb(bContext *C, void *arg_op, void *)
void ED_OT_undo_push(wmOperatorType *ot)
static wmOperatorStatus ed_undo_step_direction(bContext *C, enum eUndoStepDir step, ReportList *reports)
static void ed_undo_step_post(bContext *C, wmWindowManager *wm, const enum eUndoStepDir undo_dir, ReportList *reports)
static void ed_undo_refresh_for_op(bContext *C)
static wmOperatorStatus ed_undo_push_exec(bContext *C, wmOperator *op)
static wmOperatorStatus ed_undo_exec(bContext *C, wmOperator *op)
Vector< Object * > ED_undo_editmode_objects_from_view_layer(const Scene *scene, ViewLayer *view_layer)
static bool ed_redo_poll(bContext *C)
static bool ed_undo_is_init_poll(bContext *C)
static bool ed_undo_is_init_and_screenactive_poll(bContext *C)
static wmOperatorStatus ed_redo_exec(bContext *C, wmOperator *op)
static int ed_undo_step_by_name(bContext *C, const char *undo_name, ReportList *reports)
void ED_undo_redo(bContext *C)
static wmOperatorStatus ed_undo_redo_exec(bContext *C, wmOperator *)
bool ED_undo_is_state_valid(bContext *C)
static wmOperatorStatus undo_history_exec(bContext *C, wmOperator *op)
void ED_OT_undo(wmOperatorType *ot)
bool ED_undo_operator_repeat(bContext *C, wmOperator *op)
void ED_OT_undo_history(wmOperatorType *ot)
static bool ed_undo_poll(bContext *C)
void ED_undo_object_editmode_restore_helper(Scene *scene, ViewLayer *view_layer, Object **object_array, uint object_array_len, uint object_array_stride)
void ED_undo_grouped_push_op(bContext *C, wmOperator *op)
static bool ed_undo_redo_poll(bContext *C)
bool ED_undo_is_memfile_compatible(const bContext *C)
void ED_undo_pop(bContext *C)
void ED_undo_object_editmode_validate_scene_from_windows(wmWindowManager *wm, const Scene *scene_ref, Scene **scene_p, ViewLayer **view_layer_p)
void ED_undo_group_end(bContext *C)
void ED_undo_grouped_push(bContext *C, const char *str)
Vector< Base * > ED_undo_editmode_bases_from_view_layer(const Scene *scene, ViewLayer *view_layer)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define ID_CHECK_UNDO(id)
void storage_tag_main_data_dirty()
void base_select(Base *base, eObjectSelect_Mode mode)
bool editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag)
void base_active_refresh(Main *bmain, Scene *scene, ViewLayer *view_layer)
bool editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
bool RNA_struct_undo_check(const StructRNA *type)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
bool(* check)(bContext *C, wmOperator *op)
struct ReportList * reports
struct wmOperatorType * type
struct UndoStack * undo_stack
void WM_operator_stack_clear(wmWindowManager *wm)
void WM_operator_free_all_after(wmWindowManager *wm, wmOperator *op)
void WM_menu_name_call(bContext *C, const char *menu_name, short context)
bool WM_operator_poll(bContext *C, wmOperatorType *ot)
bool WM_operator_repeat_check(const bContext *, wmOperator *op)
void WM_main_add_notifier(uint type, void *reference)
wmOperatorStatus WM_operator_repeat(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_event_add_mousemove(wmWindow *win)
void WM_file_tag_modified()
void WM_jobs_kill_all(wmWindowManager *wm)
bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type)
bool WM_operator_check_ui_enabled(const bContext *C, const char *idname)
wmOperator * WM_operator_last_redo(const bContext *C)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)