Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/undo/ed_undo.c
| Show All 30 Lines | |||||
| #include <string.h> | #include <string.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "CLG_log.h" | #include "CLG_log.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_object_types.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_blender_undo.h" | #include "BKE_blender_undo.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_layer.h" | |||||
| #include "BKE_undo_system.h" | #include "BKE_undo_system.h" | ||||
| #include "ED_gpencil.h" | #include "ED_gpencil.h" | ||||
| #include "ED_render.h" | #include "ED_render.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_undo.h" | #include "ED_undo.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| ▲ Show 20 Lines • Show All 433 Lines • ▼ Show 20 Lines | void ED_OT_undo_history(wmOperatorType *ot) | ||||
| ot->exec = undo_history_exec; | ot->exec = undo_history_exec; | ||||
| ot->poll = ED_operator_screenactive; | ot->poll = ED_operator_screenactive; | ||||
| RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX); | RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Undo Helper Functions | |||||
| * \{ */ | |||||
| void ED_undo_object_set_active_or_warn(ViewLayer *view_layer, Object *ob, const char *info, CLG_LogRef *log) | |||||
| { | |||||
| Object *ob_prev = OBACT(view_layer); | |||||
| if (ob_prev != ob) { | |||||
| Base *base = BKE_view_layer_base_find(view_layer, ob); | |||||
| if (base != NULL) { | |||||
| view_layer->basact = base; | |||||
| } | |||||
| else { | |||||
| /* Should never fail, may not crash but can give odd behavior. */ | |||||
| CLOG_WARN(log, "'%s' failed to restore active object: '%s'", info, ob->id.name + 2); | |||||
| } | |||||
| } | |||||
| } | |||||
| /** \} */ | |||||