|
Blender
V2.93
|
#include <string.h>#include "MEM_guardedalloc.h"#include "CLG_log.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_listbase.h"#include "BLI_utildefines.h"#include "BLT_translation.h"#include "BKE_blender_undo.h"#include "BKE_callbacks.h"#include "BKE_context.h"#include "BKE_global.h"#include "BKE_layer.h"#include "BKE_main.h"#include "BKE_paint.h"#include "BKE_report.h"#include "BKE_scene.h"#include "BKE_screen.h"#include "BKE_undo_system.h"#include "BKE_workspace.h"#include "BLO_blend_validate.h"#include "ED_gpencil.h"#include "ED_object.h"#include "ED_outliner.h"#include "ED_render.h"#include "ED_screen.h"#include "ED_undo.h"#include "WM_api.h"#include "WM_toolsystem.h"#include "WM_types.h"#include "RNA_access.h"#include "RNA_define.h"#include "UI_interface.h"#include "UI_resources.h"Go to the source code of this file.
Variables | |
| static CLG_LogRef | LOG = {"ed.undo"} |
| void ED_OT_redo | ( | wmOperatorType * | ot | ) |
Definition at line 647 of file ed_undo.c.
References wmOperatorType::description, ed_redo_exec(), ed_redo_poll(), wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_edutils().
| void ED_OT_undo | ( | wmOperatorType * | ot | ) |
Definition at line 604 of file ed_undo.c.
References wmOperatorType::description, ed_undo_exec(), ed_undo_poll(), wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_edutils().
| void ED_OT_undo_history | ( | wmOperatorType * | ot | ) |
Definition at line 856 of file ed_undo.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, ot, wmOperatorType::poll, RNA_def_int(), wmOperatorType::srna, undo_history_exec(), undo_history_invoke(), and undo_history_poll().
Referenced by ED_operatortypes_edutils().
| void ED_OT_undo_push | ( | wmOperatorType * | ot | ) |
Definition at line 616 of file ed_undo.c.
References BKE_UNDO_STR_MAX, wmOperatorType::description, ED_operator_screenactive(), ed_undo_push_exec(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_INTERNAL, ot, wmOperatorType::poll, RNA_def_string(), and wmOperatorType::srna.
Referenced by ED_operatortypes_edutils().
| void ED_OT_undo_redo | ( | wmOperatorType * | ot | ) |
Definition at line 659 of file ed_undo.c.
References wmOperatorType::description, ed_undo_redo_exec(), ed_undo_redo_poll(), wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 544 of file ed_undo.c.
References C, CTX_wm_window(), ED_outliner_select_sync_from_all_tag(), ed_undo_step_direction(), OPERATOR_FINISHED, wmOperator::reports, ret, STEP_REDO, and WM_event_add_mousemove().
Referenced by ED_OT_redo().
|
static |
Definition at line 638 of file ed_undo.c.
References C, CTX_wm_manager(), ed_undo_is_init_and_screenactive_poll(), NULL, undo_stack, and wmWindowManager::undo_stack.
Referenced by ED_OT_redo().
Definition at line 997 of file ed_undo.c.
References BASACT, BLI_assert, Object::data, FIRSTBASE, id, len, LIB_TAG_DOIT, MEM_malloc_arrayN, MEM_mallocN, Object::mode, NULL, OB_MODE_EDIT, Base::object, ID::tag, Object::type, and undo_editmode_objects_from_view_layer_prepare().
Referenced by ED_undo_object_editmode_restore_helper().
Definition at line 968 of file ed_undo.c.
References BASACT, BLI_assert, Object::data, FIRSTBASE, id, len, LIB_TAG_DOIT, MEM_malloc_arrayN, MEM_mallocN, Object::mode, NULL, OB_MODE_EDIT, Base::object, Scene::objects, ID::tag, Object::type, and undo_editmode_objects_from_view_layer_prepare().
Referenced by armature_undosys_step_encode(), curve_undosys_step_encode(), lattice_undosys_step_encode(), mball_undosys_step_encode(), and mesh_undosys_step_encode().
|
static |
Definition at line 513 of file ed_undo.c.
References C, CTX_wm_manager(), CTX_wm_window(), ED_outliner_select_sync_from_all_tag(), ed_undo_step_direction(), OPERATOR_FINISHED, wmOperator::reports, ret, STEP_UNDO, WM_event_add_mousemove(), and WM_operator_stack_clear().
Referenced by ED_OT_undo().
| void ED_undo_group_begin | ( | bContext * | C | ) |
Definition at line 105 of file ed_undo.c.
References BKE_undosys_stack_group_begin(), C, CTX_wm_manager(), and wmWindowManager::undo_stack.
Referenced by do_outliner_item_mode_toggle_generic(), and object_transfer_mode_to_base().
| void ED_undo_group_end | ( | bContext * | C | ) |
Definition at line 111 of file ed_undo.c.
References BKE_undosys_stack_group_end(), C, CTX_wm_manager(), and wmWindowManager::undo_stack.
Referenced by do_outliner_item_mode_toggle_generic(), and object_transfer_mode_to_base().
| void ED_undo_grouped_push | ( | bContext * | C, |
| const char * | str | ||
| ) |
Definition at line 394 of file ed_undo.c.
References BKE_undosys_stack_clear_active(), C, CTX_wm_manager(), ED_undo_push(), UndoStep::name, UndoStack::step_active, str, STREQ, and wmWindowManager::undo_stack.
Referenced by ED_undo_grouped_push_op().
| void ED_undo_grouped_push_op | ( | bContext * | C, |
| wmOperator * | op | ||
| ) |
Definition at line 422 of file ed_undo.c.
References C, ED_undo_grouped_push(), wmOperatorType::name, wmOperator::type, and wmOperatorType::undo_group.
Referenced by wm_handler_fileselect_do(), and wm_operator_finished().
|
static |
Definition at line 580 of file ed_undo.c.
References C, ED_operator_screenactive(), and ed_undo_is_init_poll().
Referenced by ed_redo_poll(), ed_undo_poll(), ed_undo_redo_poll(), and undo_history_poll().
|
static |
Definition at line 570 of file ed_undo.c.
References C, CTX_wm_manager(), CTX_wm_operator_poll_msg_set(), NULL, and wmWindowManager::undo_stack.
Referenced by ed_undo_is_init_and_screenactive_poll().
When a property of ID changes, return false.
This is to avoid changes to a property making undo pushes which are ignored by the undo-system. For example, changing a brush property isn't stored by sculpt-mode undo steps. This workaround is needed until the limitation is removed, see: T61948.
Definition at line 469 of file ed_undo.c.
References C, CLOG_INFO, CTX_data_view_layer(), Object::data, GS, id, LOG, Object::mode, ID::name, NULL, OB_MODE_ALL_PAINT, OB_MODE_EDIT, and OBACT.
Referenced by radial_control_modal(), and ui_apply_but_undo().
| bool ED_undo_is_memfile_compatible | ( | const bContext * | C | ) |
Definition at line 445 of file ed_undo.c.
References C, CTX_data_view_layer(), Object::mode, NULL, OB_MODE_EDIT, and OBACT.
| bool ED_undo_is_state_valid | ( | bContext * | C | ) |
Run from the main event loop, basic checks that undo is left in a correct state.
Definition at line 82 of file ed_undo.c.
References C, CTX_wm_manager(), UndoStack::group_level, NULL, UndoStep::skip, UndoStack::step_active, and wmWindowManager::undo_stack.
Referenced by wm_event_do_handlers().
| bool ED_undo_is_valid | ( | const bContext * | C, |
| const char * | undoname | ||
| ) |
Definition at line 439 of file ed_undo.c.
References BKE_undosys_stack_has_undo(), C, CTX_wm_manager(), and wmWindowManager::undo_stack.
| void ED_undo_object_editmode_restore_helper | ( | struct bContext * | C, |
| Object ** | object_array, | ||
| uint | object_array_len, | ||
| uint | object_array_stride | ||
| ) |
Load all our objects from object_array into edit-mode, clear everything else.
Definition at line 897 of file ed_undo.c.
References BA_DESELECT, C, CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), Object::data, ED_object_base_select(), ED_object_editmode_enter_ex(), ED_object_editmode_exit_ex(), ED_undo_editmode_bases_from_view_layer(), EM_FREEDATA, EM_NO_CONTEXT, id, LIB_TAG_DOIT, MEM_freeN, Base::object, POINTER_OFFSET, scene, and ID::tag.
Referenced by armature_undosys_step_decode(), curve_undosys_step_decode(), font_undosys_step_decode(), lattice_undosys_step_decode(), mball_undosys_step_decode(), and mesh_undosys_step_decode().
| void ED_undo_object_set_active_or_warn | ( | Scene * | scene, |
| ViewLayer * | view_layer, | ||
| Object * | ob, | ||
| const char * | info, | ||
| CLG_LogRef * | log | ||
| ) |
Definition at line 877 of file ed_undo.c.
References ViewLayer::basact, BKE_view_layer_base_find(), CLOG_WARN, ED_object_base_active_refresh(), G_MAIN, Object::id, KDL::log(), ID::name, NULL, OBACT, and scene.
Referenced by armature_undosys_step_decode(), curve_undosys_step_decode(), font_undosys_step_decode(), lattice_undosys_step_decode(), mball_undosys_step_decode(), mesh_undosys_step_decode(), and particle_undosys_step_decode().
| int ED_undo_operator_repeat | ( | bContext * | C, |
| wmOperator * | op | ||
| ) |
Definition at line 678 of file ed_undo.c.
References BKE_area_find_region_active_win(), C, wmOperatorType::check, CLOG_INFO, CLOG_WARN, CTX_data_scene(), CTX_wm_area(), CTX_wm_manager(), CTX_wm_menu(), CTX_wm_region(), CTX_wm_region_set(), ED_region_tag_refresh_ui(), ED_undo_pop_op(), ED_undo_redo(), G, G_DEBUG, wmOperatorType::idname, LOG, wmOperatorType::name, OPERATOR_FINISHED, ret, scene, wmOperator::type, WM_JOB_TYPE_ANY, WM_jobs_test(), WM_operator_free_all_after(), WM_operator_poll(), WM_operator_repeat(), and WM_operator_repeat_check().
Referenced by ED_undo_operator_repeat_cb(), ED_undo_operator_repeat_cb_evt(), ed_undo_redo_exec(), file_browse_exec(), gizmo_bisect_exec(), gizmo_placement_exec(), gizmo_spin_exec(), and wm_block_redo_cb().
| void ED_undo_operator_repeat_cb | ( | bContext * | C, |
| void * | arg_op, | ||
| void * | UNUSEDarg_unused | ||
| ) |
Definition at line 749 of file ed_undo.c.
References C, and ED_undo_operator_repeat().
| void ED_undo_operator_repeat_cb_evt | ( | bContext * | C, |
| void * | arg_op, | ||
| int | UNUSEDarg_unused | ||
| ) |
Definition at line 754 of file ed_undo.c.
References C, and ED_undo_operator_repeat().
|
static |
Definition at line 595 of file ed_undo.c.
References C, CTX_wm_manager(), ed_undo_is_init_and_screenactive_poll(), NULL, undo_stack, and wmWindowManager::undo_stack.
Referenced by ED_OT_undo().
| void ED_undo_pop | ( | bContext * | C | ) |
Definition at line 407 of file ed_undo.c.
References C, ed_undo_step_direction(), NULL, and STEP_UNDO.
Referenced by redraw_timer_step().
| void ED_undo_pop_op | ( | bContext * | C, |
| wmOperator * | op | ||
| ) |
Definition at line 432 of file ed_undo.c.
References C, ed_undo_step_by_name(), wmOperatorType::name, wmOperator::reports, and wmOperator::type.
Referenced by ED_undo_operator_repeat(), and gizmo_tweak_start_and_finish().
| void ED_undo_push | ( | bContext * | C, |
| const char * | str | ||
| ) |
Definition at line 117 of file ed_undo.c.
References BKE_undosys_print(), BKE_undosys_stack_limit_steps_and_memory(), BKE_undosys_step_push(), C, CLOG_CHECK, CLOG_INFO, CTX_wm_manager(), G, LOG, memory_limit, NC_WM, ND_LIB_OVERRIDE_CHANGED, UndoStep::next, NULL, UndoStack::step_active, UndoStack::step_init, steps, str, UNDO_PUSH_RET_OVERRIDE_CHANGED, wmWindowManager::undo_stack, WM_file_tag_modified(), and WM_main_add_notifier().
Referenced by attribute_search_exec_fn(), colorband_add_cb(), colorband_del_cb(), colorband_distribute_cb(), colorband_flip_cb(), colorband_tools_dofunc(), curvemap_tools_dofunc(), CurveProfile_presets_dofunc(), CurveProfile_tools_dofunc(), delete_fmodifier_cb(), do_outliner_item_editmode_toggle(), do_outliner_item_mode_toggle_generic(), do_outliner_item_posemode_toggle(), do_view3d_header_buttons(), driver_add_var_cb(), driver_delete_var_cb(), ED_sculpt_undo_push_multires_mesh_end(), ED_undo_grouped_push(), ed_undo_push_exec(), ED_undo_push_op(), eyedropper_add_material(), file_browse_exec(), fmodifier_reorder(), import_endjob(), object_transfer_mode_to_base(), outliner_action_set_exec(), outliner_animdata_operation_exec(), outliner_constraint_operation_exec(), outliner_data_operation_exec(), outliner_id_operation_exec(), outliner_lib_operation_exec(), outliner_modifier_operation_exec(), outliner_object_operation_exec(), outliner_scene_operation_exec(), radial_control_modal(), template_id_cb(), text_autocomplete_invoke(), text_autocomplete_modal(), ui_apply_but_funcs_after(), and ui_node_link().
|
static |
Definition at line 527 of file ed_undo.c.
References BKE_UNDO_STR_MAX, BKE_undosys_stack_create(), C, CTX_wm_manager(), ED_undo_push(), G, NULL, OPERATOR_FINISHED, wmOperator::ptr, RNA_string_get(), str, and wmWindowManager::undo_stack.
Referenced by ED_OT_undo_push().
| void ED_undo_push_op | ( | bContext * | C, |
| wmOperator * | op | ||
| ) |
Definition at line 416 of file ed_undo.c.
References C, ED_undo_push(), wmOperatorType::name, and wmOperator::type.
Referenced by wm_block_redo_cb(), wm_handler_fileselect_do(), and wm_operator_finished().
| void ED_undo_redo | ( | bContext * | C | ) |
Definition at line 411 of file ed_undo.c.
References C, ed_undo_step_direction(), NULL, and STEP_REDO.
Referenced by ED_undo_operator_repeat(), and redraw_timer_step().
|
static |
Definition at line 556 of file ed_undo.c.
References C, CTX_wm_window(), ED_undo_operator_repeat(), OPERATOR_CANCELLED, OPERATOR_FINISHED, ret, WM_event_add_mousemove(), and WM_operator_last_redo().
Referenced by ED_OT_undo_redo().
|
static |
Definition at line 588 of file ed_undo.c.
References C, ed_undo_is_init_and_screenactive_poll(), wmOperatorType::name, wmOperator::type, WM_operator_check_ui_enabled(), and WM_operator_last_redo().
Referenced by ED_OT_undo_redo().
| UndoStack* ED_undo_stack_get | ( | void | ) |
Ideally we wont access the stack directly, this is needed for modes which handle undo themselves (bypassing ED_undo_push).
Using global isn't great, this just avoids doing inline, causing 'BKE_global.h' & 'BKE_main.h' includes.
Definition at line 501 of file ed_undo.c.
References G_MAIN, and wmWindowManager::undo_stack.
Referenced by ED_image_paint_tile_list_get(), ED_image_undo_push_begin_with_image(), ED_image_undo_push_end(), ED_paintcurve_undo_push_begin(), ED_paintcurve_undo_push_end(), ED_text_undo_push_init(), image_undo_push_begin(), image_undosys_step_encode(), memfile_undosys_poll(), memfile_undosys_step_encode(), sculpt_dynamic_topology_disable_with_undo(), sculpt_dynamic_topology_enable_with_undo(), sculpt_undo_get_nodes(), SCULPT_undo_push_begin(), SCULPT_undo_push_end_ex(), text_undosys_poll(), and text_undosys_step_encode_init().
|
static |
Load the step matching given index in the stack. May undo or redo several steps at once. The target step will be the one indicated by the given index.
Definition at line 366 of file ed_undo.c.
References BKE_undosys_step_load_from_index(), BLI_assert, BLI_findindex(), C, CLOG_INFO, CTX_wm_manager(), ED_gpencil_session_active(), ed_undo_step_post(), ed_undo_step_pre(), LOG, OPERATOR_FINISHED, UndoStack::step_active, STEP_REDO, STEP_UNDO, UndoStack::steps, and wmWindowManager::undo_stack.
Referenced by undo_history_exec().
|
static |
Undo the step matching given name. May undo several steps at once. The target step will be the one immediately before given named one.
Definition at line 318 of file ed_undo.c.
References BKE_undosys_step_calc_direction(), BKE_undosys_step_find_by_name(), BKE_undosys_step_load_data_ex(), BLI_assert, C, CLOG_ERROR, CLOG_INFO, CTX_wm_manager(), ED_gpencil_session_active(), ed_undo_step_post(), ed_undo_step_pre(), ELEM, LOG, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, UndoStep::prev, STEP_REDO, STEP_UNDO, and wmWindowManager::undo_stack.
Referenced by ED_undo_pop_op().
|
static |
Undo or redo one step from current active one. May undo or redo several steps at once only if the target step is a 'skipped' one. The target step will be the one immediately before or after the active one.
Definition at line 281 of file ed_undo.c.
References BKE_undosys_step_redo(), BKE_undosys_step_undo(), BLI_assert, C, CLOG_INFO, CTX_wm_manager(), ED_gpencil_session_active(), ED_undo_gpencil_step(), ed_undo_step_post(), ed_undo_step_pre(), ELEM, LOG, OPERATOR_FINISHED, STEP_REDO, STEP_UNDO, and wmWindowManager::undo_stack.
Referenced by ed_redo_exec(), ed_undo_exec(), ED_undo_pop(), and ED_undo_redo().
|
static |
Common post management of undo/redo (calling post handlers, adding notifiers etc.).
Definition at line 218 of file ed_undo.c.
References blender::compositor::area(), BKE_callback_exec_id(), BKE_CB_EVT_REDO_POST, BKE_CB_EVT_UNDO_POST, BKE_report(), BKE_undosys_print(), BLI_assert, BLO_main_validate_libraries(), C, CLOG_CHECK, CTX_data_active_base(), CTX_data_active_object(), CTX_data_main(), CTX_data_scene(), CTX_wm_area(), ED_gpencil_toggle_brush_cursor(), ED_object_base_activate(), ELEM, G, G_DEBUG_IO, Scene::id, Main::lock, LOG, Object::mode, NC_WINDOW, NC_WM, ND_UNDO, NULL, OB_GPENCIL, OB_MODE_PAINT_GPENCIL, OB_MODE_SCULPT_GPENCIL, OB_MODE_VERTEX_GPENCIL, OB_MODE_WEIGHT_GPENCIL, wmWindowManager::op_undo_depth, RPT_INFO, scene, SPACE_VIEW3D, STEP_REDO, STEP_UNDO, Object::type, wmWindowManager::undo_stack, WM_event_add_notifier(), WM_toolsystem_refresh_active(), and WM_toolsystem_refresh_screen_all().
Referenced by ed_undo_step_by_index(), ed_undo_step_by_name(), and ed_undo_step_direction().
|
static |
Common pre management of undo/redo (killing all running jobs, calling pre handlers, etc.).
Definition at line 174 of file ed_undo.c.
References blender::compositor::area(), BKE_callback_exec_id(), BKE_CB_EVT_REDO_PRE, BKE_CB_EVT_UNDO_PRE, BKE_report(), BLI_assert, BLO_main_validate_libraries(), C, CTX_data_active_object(), CTX_data_main(), CTX_data_scene(), CTX_wm_area(), ED_gpencil_toggle_brush_cursor(), ELEM, G, G_DEBUG_IO, Scene::id, Main::lock, NULL, OB_GPENCIL, wmWindowManager::op_undo_depth, RPT_INFO, scene, SPACE_VIEW3D, STEP_REDO, STEP_UNDO, Object::type, and WM_jobs_kill_all().
Referenced by ed_undo_step_by_index(), ed_undo_step_by_name(), and ed_undo_step_direction().
|
static |
Definition at line 766 of file ed_undo.c.
References C, CTX_wm_manager(), ListBase::first, EnumPropertyItem::icon, EnumPropertyItem::identifier, IFACE_, EnumPropertyItem::name, NULL, RNA_enum_item_add(), RNA_enum_item_end(), UndoStack::step_active, UndoStack::steps, wmWindowManager::undo_stack, and EnumPropertyItem::value.
Referenced by undo_history_invoke().
|
static |
Definition at line 942 of file ed_undo.c.
References Object::data, id, len, LIB_TAG_DOIT, LISTBASE_FOREACH, Object::mode, OB_MODE_EDIT, ViewLayer::object_bases, ID::tag, and Object::type.
Referenced by ED_undo_editmode_bases_from_view_layer(), and ED_undo_editmode_objects_from_view_layer().
|
static |
Definition at line 833 of file ed_undo.c.
References C, CTX_wm_manager(), ed_undo_step_by_index(), NC_WINDOW, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, wmOperator::reports, RNA_property_int_get(), RNA_property_is_set(), RNA_struct_find_property(), WM_event_add_notifier(), and WM_operator_stack_clear().
Referenced by ED_OT_undo_history().
|
static |
Definition at line 795 of file ed_undo.c.
References C, Freestyle::c, wmOperatorType::idname, MEM_freeN, Scene::name, NULL, OPERATOR_CANCELLED, wmOperator::ptr, rna_undo_itemf(), blender::io::alembic::split(), wmOperator::type, UI_popup_menu_begin(), UI_popup_menu_end(), UI_popup_menu_layout(), uiItemIntO(), uiLayoutColumn(), uiLayoutSplit(), EnumPropertyItem::value, and WM_operatortype_name().
Referenced by ED_OT_undo_history().
|
static |
Definition at line 846 of file ed_undo.c.
References BLI_listbase_count_at_most(), C, CTX_wm_manager(), ed_undo_is_init_and_screenactive_poll(), undo_stack, and wmWindowManager::undo_stack.
Referenced by ED_OT_undo_history().
|
static |
We only need this locally.
Definition at line 71 of file ed_undo.c.
Referenced by ED_undo_is_legacy_compatible_for_property(), ED_undo_operator_repeat(), ED_undo_push(), ed_undo_step_by_index(), ed_undo_step_by_name(), ed_undo_step_direction(), and ed_undo_step_post().