Blender V5.3
BKE_undo_system.hh File Reference
#include "BLI_enum_flags.hh"
#include "BLI_function_ref.hh"
#include "BLI_path_utils.hh"
#include "DNA_ID.h"
#include "DNA_listBase.h"
#include "DNA_userdef_types.h"

Go to the source code of this file.

Classes

struct  blender::UndoRefID
struct  blender::UndoStack
struct  blender::UndoStep
struct  blender::UndoType

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define UNDO_REF_ID_TYPE(ptr_ty)
#define BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(ty)
#define BKE_undosys_stack_limit_steps_and_memory_defaults(ustack)

Typedefs

using blender::UndoTypeForEachIDRefFn = void (*)(void *user_data, UndoRefID *id_ref)

Enumerations

enum class  blender::UndoEncodeHints { blender::None = 0 , blender::PreMemFileChanges = 1 << 1 , blender::HasMemFileChangesOnly = 1 << 2 }
enum  blender::eUndoStepDir { blender::STEP_REDO = 1 , blender::STEP_UNDO = -1 , blender::STEP_INVALID = 0 }
enum  blender::eUndoPushReturn { blender::UNDO_PUSH_RET_FAILURE = 0 , blender::UNDO_PUSH_RET_SUCCESS = (1 << 0) , blender::UNDO_PUSH_RET_OVERRIDE_CHANGED = (1 << 1) }
enum  blender::eUndoTypeFlags { blender::UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE = 1 << 0 , blender::UNDOTYPE_FLAG_DECODE_ACTIVE_STEP = 1 << 1 , blender::UNDOTYPE_FLAG_ENCODE_PRE_MEMFILE_SUPPORTED = 1 << 2 }

Functions

 blender::ENUM_OPERATORS (UndoEncodeHints)
 blender::UNDO_REF_ID_TYPE (GreasePencil)
 blender::UNDO_REF_ID_TYPE (Mesh)
 blender::UNDO_REF_ID_TYPE (Object)
 blender::UNDO_REF_ID_TYPE (Scene)
 blender::UNDO_REF_ID_TYPE (Text)
 blender::UNDO_REF_ID_TYPE (Image)
 blender::UNDO_REF_ID_TYPE (PaintCurve)
Undo Stack
UndoStack * blender::BKE_undosys_stack_create ()
void blender::BKE_undosys_stack_destroy (UndoStack *ustack)
void blender::BKE_undosys_stack_clear (UndoStack *ustack)
void blender::BKE_undosys_stack_clear_active (UndoStack *ustack)
bool blender::BKE_undosys_stack_has_undo (const UndoStack *ustack, const char *name)
bool blender::BKE_undosys_stack_has_redo (const UndoStack *ustack)
void blender::BKE_undosys_stack_init_from_main (UndoStack *ustack, Main *bmain)
void blender::BKE_undosys_stack_init_from_context (UndoStack *ustack, bContext *C)
UndoStep * blender::BKE_undosys_stack_active_with_type (UndoStack *ustack, const UndoType *ut)
UndoStep * blender::BKE_undosys_stack_init_or_active_with_type (UndoStack *ustack, const UndoType *ut)
void blender::BKE_undosys_stack_limit_steps_and_memory (UndoStack *ustack, int steps, size_t memory_limit)
Undo Stack Grouping

This enables skip while group-level is set. In general it's not allowed that #UndoStack.step_active have 'skip' enabled.

This rule is relaxed for grouping, however it's important each call to BKE_undosys_stack_group_begin has a matching BKE_undosys_stack_group_end.

  • Levels are used so nesting is supported, where the last call to BKE_undosys_stack_group_end will set the active undo step that should not be skipped.
  • Correct begin/end is checked by an assert since any errors here will cause undo to consider all steps part of one large group.
  • Calls to begin/end with no undo steps being pushed is supported and does nothing.
void blender::BKE_undosys_stack_group_begin (UndoStack *ustack)
void blender::BKE_undosys_stack_group_end (UndoStack *ustack)
Undo Step
UndoStep * blender::BKE_undosys_step_push_init_with_type (UndoStack *ustack, bContext *C, const char *name, const UndoType *ut)
UndoStep * blender::BKE_undosys_step_push_init (UndoStack *ustack, bContext *C, const char *name)
eUndoPushReturn blender::BKE_undosys_step_push_with_type (UndoStack *ustack, bContext *C, const char *name, UndoEncodeHints hints, const UndoType *ut)
eUndoPushReturn blender::BKE_undosys_step_push (UndoStack *ustack, bContext *C, const char *name, UndoEncodeHints hints)
UndoStep * blender::BKE_undosys_step_find_by_name_with_type (UndoStack *ustack, const char *name, const UndoType *ut)
UndoStep * blender::BKE_undosys_step_find_by_type (UndoStack *ustack, const UndoType *ut)
UndoStep * blender::BKE_undosys_step_find_by_name (UndoStack *ustack, const char *name)
eUndoStepDir blender::BKE_undosys_step_calc_direction (const UndoStack *ustack, const UndoStep *us_target, const UndoStep *us_reference)
bool blender::BKE_undosys_step_load_data_ex (UndoStack *ustack, bContext *C, UndoStep *us_target, UndoStep *us_reference, bool use_skip)
bool blender::BKE_undosys_step_load_data (UndoStack *ustack, bContext *C, UndoStep *us_target)
void blender::BKE_undosys_step_load_from_index (UndoStack *ustack, bContext *C, int index)
bool blender::BKE_undosys_step_undo_with_data_ex (UndoStack *ustack, bContext *C, UndoStep *us_target, bool use_skip)
bool blender::BKE_undosys_step_undo_with_data (UndoStack *ustack, bContext *C, UndoStep *us_target)
bool blender::BKE_undosys_step_undo (UndoStack *ustack, bContext *C)
bool blender::BKE_undosys_step_redo_with_data_ex (UndoStack *ustack, bContext *C, UndoStep *us_target, bool use_skip)
bool blender::BKE_undosys_step_redo_with_data (UndoStack *ustack, bContext *C, UndoStep *us_target)
bool blender::BKE_undosys_step_redo (UndoStack *ustack, bContext *C)
UndoStep * blender::BKE_undosys_step_same_type_next (UndoStep *us)
UndoStep * blender::BKE_undosys_step_same_type_prev (UndoStep *us)
bool blender::BKE_undosys_type_foreach (FunctionRef< bool(const UndoType *ut)> fn)
UndoType * blender::BKE_undosys_type_append (void(*undosys_fn)(UndoType *))
void blender::BKE_undosys_type_free_all ()
Undo Types
const UndoType * blender::BKE_undosys_type_from_context (bContext *C)
Debug Helpers
void blender::BKE_undosys_print (UndoStack *ustack)

Variables

Public Undo Types

Expose since we need to perform operations on specific undo types (rarely).

const UndoType * blender::BKE_UNDOSYS_TYPE_IMAGE = nullptr
const UndoType * blender::BKE_UNDOSYS_TYPE_MEMFILE = nullptr
const UndoType * blender::BKE_UNDOSYS_TYPE_PAINTCURVE = nullptr
const UndoType * blender::BKE_UNDOSYS_TYPE_PARTICLE = nullptr
const UndoType * blender::BKE_UNDOSYS_TYPE_SCULPT = nullptr
const UndoType * blender::BKE_UNDOSYS_TYPE_TEXT = nullptr

Macro Definition Documentation

◆ BKE_undosys_stack_limit_steps_and_memory_defaults

#define BKE_undosys_stack_limit_steps_and_memory_defaults ( ustack)
Value:
BKE_undosys_stack_limit_steps_and_memory(ustack, U.undosteps, size_t(U.undomemory) * 1024 * 1024)
#define U

Definition at line 261 of file BKE_undo_system.hh.

Referenced by blender::ED_image_undo_push_end(), blender::ED_paintcurve_undo_push_end(), and blender::ed::sculpt_paint::undo::geometry_end().

◆ BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP

#define BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP ( ty)
Value:
ELEM(ty, BKE_UNDOSYS_TYPE_IMAGE)
#define ELEM(...)

Definition at line 239 of file BKE_undo_system.hh.

Referenced by blender::memfile_undosys_step_decode().

◆ UNDO_REF_ID_TYPE

#define UNDO_REF_ID_TYPE ( ptr_ty)
Value:
struct UndoRefID_##ptr_ty { \
struct ptr_ty *ptr; \
char name[MAX_ID_NAME]; \
char library_filepath_abs[FILE_MAX]; \
}
#define FILE_MAX
#define MAX_ID_NAME
Definition DNA_ID.h:367

Definition at line 65 of file BKE_undo_system.hh.