144 if (
U.undomemory != 0) {
145 const size_t memory_limit = size_t(
U.undomemory) * 1024 * 1024;
176 if (bmain->
lock !=
nullptr) {
178 reports,
RPT_DEBUG,
"Checking validity of current .blend file *BEFORE* undo step");
218 if (bmain->
lock !=
nullptr) {
219 BKE_report(reports,
RPT_INFO,
"Checking validity of current .blend file *AFTER* undo step");
230 asset::list::storage_tag_main_data_dirty();
290 if (undo_step_from_name ==
nullptr) {
291 CLOG_ERROR(&
LOG,
"Step name='%s' not found in current undo stack", undo_name);
297 if (undo_step_target ==
nullptr) {
298 CLOG_ERROR(&
LOG,
"Step name='%s' cannot be undone", undo_name);
310 "name='%s', found direction=%s",
312 (undo_dir ==
STEP_UNDO) ?
"STEP_UNDO" :
"STEP_REDO");
339 if (undo_index == active_step_index) {
346 "index='%d', found direction=%s",
348 (undo_dir ==
STEP_UNDO) ?
"STEP_UNDO" :
"STEP_REDO");
415 if (view_layer !=
nullptr) {
418 if (obact !=
nullptr) {
431 if (view_layer !=
nullptr) {
434 if (obact !=
nullptr) {
442 if ((
id ==
nullptr) || (obact->
data ==
nullptr) ||
443 (
GS(id->name) !=
GS(((
ID *)obact->
data)->name)))
540 "Undo disabled at startup in background-mode "
541 "(call `ed.undo_push()` to explicitly initialize the undo-system)");
599 "Add an undo step *function may be moved*",
629 ot->
name =
"Undo and Redo";
661 ARegion *region_repeat = redo_region_from_hud ? redo_region_from_hud :
699 printf(
"redo_cb: operator redo failed: %s, return %d\n", op->
type->
name, retval);
709 printf(
"redo_cb: WM_operator_repeat_check returned false %s\n", op->
type->
name);
772 ot->
name =
"Undo History";
798 if (base !=
nullptr) {
799 view_layer->
basact = base;
800 object::base_active_refresh(
G_MAIN, scene, view_layer);
810 const Scene *scene_ref,
814 if (*scene_p == scene_ref) {
818 if (win->scene == scene_ref) {
819 *scene_p = win->scene;
829 uint object_array_len,
830 uint object_array_stride)
837 for (
Base *base : bases) {
840 Object **ob_p = object_array;
841 for (
uint i = 0; i < object_array_len;
845 object::editmode_enter_ex(bmain, scene, obedit, object::EM_NO_CONTEXT);
846 ((
ID *)obedit->
data)->tag &= ~ID_TAG_DOIT;
848 for (
Base *base : bases) {
849 const ID *
id =
static_cast<ID *
>(base->object->data);
851 object::editmode_exit_ex(bmain, scene, base->object, object::EM_FREEDATA);
854 object::base_select(base, object::BA_DESELECT);
880 const short object_type = baseact->
object->
type;
884 for (
Base *base = baseact,
887 base = base_next, base_next = base_next ? base_next->
next :
nullptr)
889 Object *ob = base->object;
891 if (object_data.
add(
static_cast<const ID *
>(ob->
data))) {
909 const short object_type = baseact->
object->
type;
916 base = base_next, base_next = base_next ? base_next->
next :
nullptr)
918 Object *ob = base->object;
920 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)
#define BLI_assert_msg(a, msg)
#define LISTBASE_FOREACH(type, var, list)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#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)
Read Guarded memory(de)allocation.
#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)
void ED_OT_redo(wmOperatorType *ot)
UndoStack * ED_undo_stack_get()
static int ed_undo_push_exec(bContext *C, wmOperator *op)
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)
bool ED_undo_is_legacy_compatible_for_property(bContext *C, ID *id)
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)
int ED_undo_operator_repeat(bContext *C, wmOperator *op)
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 int ed_undo_exec(bContext *C, wmOperator *op)
Vector< Object * > ED_undo_editmode_objects_from_view_layer(const Scene *scene, ViewLayer *view_layer)
static int undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int undo_history_exec(bContext *C, wmOperator *op)
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 int 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)
bool ED_undo_is_state_valid(bContext *C)
void ED_OT_undo(wmOperatorType *ot)
static int ed_undo_step_direction(bContext *C, enum eUndoStepDir step, ReportList *reports)
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)
static int ed_undo_redo_exec(bContext *C, wmOperator *)
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)
int ED_undo_gpencil_step(bContext *C, const int step)
int ED_gpencil_session_active()
ccl_device_inline float3 log(float3 v)
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)
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(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
bool(* check)(bContext *C, wmOperator *op)
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
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)
int 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)