Blender
V3.3
|
Go to the source code of this file.
Classes | |
struct | UndoRefID |
struct | UndoStack |
struct | UndoStep |
struct | UndoType |
Macros | |
#define | UNDO_REF_ID_TYPE(ptr_ty) |
#define | BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(ty) ELEM(ty, BKE_UNDOSYS_TYPE_IMAGE) |
#define | BKE_undosys_stack_limit_steps_and_memory_defaults(ustack) BKE_undosys_stack_limit_steps_and_memory(ustack, U.undosteps, (size_t)U.undomemory * 1024 * 1024) |
Typedefs | |
typedef struct UndoRefID | UndoRefID |
typedef struct UndoStack | UndoStack |
typedef struct UndoStep | UndoStep |
typedef enum eUndoStepDir | eUndoStepDir |
typedef enum eUndoPushReturn | eUndoPushReturn |
typedef void(* | UndoTypeForEachIDRefFn) (void *user_data, struct UndoRefID *id_ref) |
typedef struct UndoType | UndoType |
typedef enum eUndoTypeFlags | eUndoTypeFlags |
Enumerations | |
enum | eUndoStepDir { STEP_REDO = 1 , STEP_UNDO = -1 , STEP_INVALID = 0 } |
enum | eUndoPushReturn { UNDO_PUSH_RET_FAILURE = 0 , UNDO_PUSH_RET_SUCCESS = (1 << 0) , UNDO_PUSH_RET_OVERRIDE_CHANGED = (1 << 1) } |
enum | eUndoTypeFlags { UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE = 1 << 0 , UNDOTYPE_FLAG_DECODE_ACTIVE_STEP = 1 << 1 } |
Variables | |
Public Undo Types | |
Expose since we need to perform operations on specific undo types (rarely). | |
const UndoType * | BKE_UNDOSYS_TYPE_IMAGE |
const UndoType * | BKE_UNDOSYS_TYPE_MEMFILE |
const UndoType * | BKE_UNDOSYS_TYPE_PAINTCURVE |
const UndoType * | BKE_UNDOSYS_TYPE_PARTICLE |
const UndoType * | BKE_UNDOSYS_TYPE_SCULPT |
const UndoType * | BKE_UNDOSYS_TYPE_TEXT |
#define BKE_undosys_stack_limit_steps_and_memory_defaults | ( | ustack | ) | BKE_undosys_stack_limit_steps_and_memory(ustack, U.undosteps, (size_t)U.undomemory * 1024 * 1024) |
Definition at line 193 of file BKE_undo_system.h.
#define BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP | ( | ty | ) | ELEM(ty, BKE_UNDOSYS_TYPE_IMAGE) |
Definition at line 175 of file BKE_undo_system.h.
#define UNDO_REF_ID_TYPE | ( | ptr_ty | ) |
Definition at line 31 of file BKE_undo_system.h.
typedef enum eUndoPushReturn eUndoPushReturn |
typedef enum eUndoStepDir eUndoStepDir |
typedef enum eUndoTypeFlags eUndoTypeFlags |
#UndoType.flag bitflags.
Definition at line 97 of file BKE_undo_system.h.
enum eUndoPushReturn |
Enumerator | |
---|---|
UNDO_PUSH_RET_FAILURE | |
UNDO_PUSH_RET_SUCCESS | |
UNDO_PUSH_RET_OVERRIDE_CHANGED |
Definition at line 91 of file BKE_undo_system.h.
enum eUndoStepDir |
Enumerator | |
---|---|
STEP_REDO | |
STEP_UNDO | |
STEP_INVALID |
Definition at line 85 of file BKE_undo_system.h.
enum eUndoTypeFlags |
#UndoType.flag bitflags.
Definition at line 145 of file BKE_undo_system.h.
Definition at line 963 of file undo_system.c.
References BLI_listbase_count(), LISTBASE_FOREACH, UndoStack::step_active, UndoStack::step_active_memfile, and UndoStack::steps.
Referenced by ED_undo_push(), and ed_undo_step_post().
Definition at line 364 of file undo_system.c.
References UndoStep::prev, UndoStack::step_active, and UndoStep::type.
Referenced by BKE_undosys_stack_init_or_active_with_type(), and ED_undosys_stack_memfile_get_active().
Definition at line 262 of file undo_system.c.
References BLI_listbase_clear(), BLI_listbase_count(), CLOG_INFO, ListBase::last, LOG, NULL, UndoStack::step_active, UndoStack::steps, UNDO_NESTED_ASSERT, and undosys_step_free_and_unlink().
Referenced by BKE_undosys_stack_destroy(), and wm_file_read_post().
Definition at line 274 of file undo_system.c.
References ListBase::last, NULL, UndoStep::prev, UndoStack::step_active, UndoStack::steps, undosys_stack_validate(), and undosys_step_free_and_unlink().
Referenced by ED_undo_grouped_push().
Definition at line 250 of file undo_system.c.
References MEM_callocN.
Referenced by ed_undo_push_exec(), and wm_file_read_post().
Definition at line 256 of file undo_system.c.
References BKE_undosys_stack_clear(), and MEM_freeN.
Referenced by ED_editors_exit(), and wm_close_and_free().
Definition at line 919 of file undo_system.c.
References BLI_assert, and UndoStack::group_level.
Referenced by ED_undo_group_begin().
Definition at line 925 of file undo_system.c.
References BLI_assert, UndoStack::group_level, LIKELY, NULL, UndoStep::skip, and UndoStack::step_active.
Referenced by ED_undo_group_end().
Definition at line 354 of file undo_system.c.
References BLI_listbase_is_empty(), BLI_rfindstring(), UndoStep::prev, and UndoStack::steps.
Referenced by ED_undo_is_valid().
Definition at line 346 of file undo_system.c.
References BKE_undosys_step_push_with_type(), BKE_undosys_type_from_context(), BKE_UNDOSYS_TYPE_MEMFILE, C, ELEM, IFACE_, and NULL.
Referenced by wm_file_read_post().
Definition at line 340 of file undo_system.c.
References IFACE_, UNDO_NESTED_ASSERT, and undosys_stack_push_main().
Referenced by wm_file_read_post().
Definition at line 373 of file undo_system.c.
References BKE_undosys_stack_active_with_type(), CLOG_INFO, LOG, UndoType::name, UndoStack::step_init, UndoStep::type, and UNDO_NESTED_ASSERT.
Referenced by ED_image_paint_tile_map_get(), sculpt_undo_get_nodes(), and SCULPT_undo_push_end_ex().
void BKE_undosys_stack_limit_steps_and_memory | ( | UndoStack * | ustack, |
int | steps, | ||
size_t | memory_limit | ||
) |
steps | Limit the number of undo steps. |
memory_limit | Limit the amount of memory used by the undo stack. |
Definition at line 383 of file undo_system.c.
References BKE_UNDOSYS_TYPE_MEMFILE, CLOG_INFO, UndoStep::data_size, ListBase::last, LOG, memory_limit, NULL, UndoStep::prev, UndoStep::skip, steps, UndoStack::steps, UndoStep::type, UNDO_NESTED_ASSERT, and undosys_stack_clear_all_first().
Referenced by ED_undo_push().
eUndoStepDir BKE_undosys_step_calc_direction | ( | const UndoStack * | ustack, |
const UndoStep * | us_target, | ||
const UndoStep * | us_reference | ||
) |
Return direction of the undo/redo from us_reference
(or ustack->step_active
if NULL), and us_target
.
us_reference
and us_target
are the same, we consider this is an undo.Definition at line 659 of file undo_system.c.
References BLI_assert, BLI_assert_msg, ELEM, UndoStep::next, NULL, UndoStep::prev, UndoStack::step_active, STEP_INVALID, STEP_REDO, and STEP_UNDO.
Referenced by BKE_undosys_step_load_data_ex(), BKE_undosys_step_redo_with_data_ex(), BKE_undosys_step_undo_with_data_ex(), and ed_undo_step_by_name().
Definition at line 644 of file undo_system.c.
References BLI_rfindstring(), and UndoStack::steps.
Referenced by ed_undo_step_by_name().
UndoStep* BKE_undosys_step_find_by_name_with_type | ( | UndoStack * | ustack, |
const char * | name, | ||
const UndoType * | ut | ||
) |
Definition at line 630 of file undo_system.c.
References ListBase::last, NULL, UndoStack::steps, and STREQ.
Definition at line 649 of file undo_system.c.
References ListBase::last, NULL, and UndoStack::steps.
Referenced by memfile_undosys_step_encode().
Undo/Redo until the given us_target
step becomes the active (currently loaded) one.
Definition at line 806 of file undo_system.c.
References BKE_undosys_step_load_data_ex(), C, and NULL.
Referenced by BKE_undosys_step_load_from_index().
bool BKE_undosys_step_load_data_ex | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
UndoStep * | us_target, | ||
UndoStep * | us_reference, | ||
bool | use_skip | ||
) |
Undo/Redo until the given us_target
step becomes the active (currently loaded) one.
us_target
is a 'skipped' one and use_skip
is true, us_target
will become the active step.use_skip
is true, the final target will always be beyond the given one (if the given one has to be skipped).us_reference | If NULL, will be set to current active step in the undo stack. Otherwise, it is assumed to match the current state, and will be used as basis for the undo/redo process (i.e. all steps in-between us_reference and us_target will be processed). |
Definition at line 718 of file undo_system.c.
References BKE_undosys_step_calc_direction(), BLI_assert, C, CLOG_ERROR, CLOG_INFO, G_MAIN, LOG, UndoStep::name, UndoType::name, UndoStep::next, NULL, UndoStep::prev, UndoStep::skip, UndoStack::step_active, STEP_INVALID, CLG_LogRef::type, UndoStep::type, UNDO_NESTED_ASSERT, undosys_stack_validate(), undosys_step_decode(), and undosys_step_iter_first().
Referenced by BKE_undosys_step_load_data(), BKE_undosys_step_redo_with_data_ex(), BKE_undosys_step_undo_with_data_ex(), and ed_undo_step_by_name().
Undo/Redo until the step matching given index
in the undo stack becomes the active (currently loaded) one.
Definition at line 812 of file undo_system.c.
References BKE_undosys_step_load_data(), BLI_assert, BLI_findlink(), C, UndoStep::skip, UndoStack::step_active, and UndoStack::steps.
Referenced by ed_undo_step_by_index().
eUndoPushReturn BKE_undosys_step_push | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
const char * | name | ||
) |
Definition at line 593 of file undo_system.c.
References BKE_undosys_step_push_with_type(), BKE_undosys_type_from_context(), C, NULL, UndoStack::step_init, UndoStep::type, and UNDO_NESTED_ASSERT.
Referenced by ED_image_undo_push_end(), ED_paintcurve_undo_push_end(), ED_undo_push(), and SCULPT_undo_push_end_ex().
Definition at line 479 of file undo_system.c.
References BKE_undosys_step_push_init_with_type(), BKE_undosys_type_from_context(), BLI_assert, C, NULL, UndoStack::step_init, and UNDO_NESTED_ASSERT.
UndoStep* BKE_undosys_step_push_init_with_type | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
const char * | name, | ||
const UndoType * | ut | ||
) |
Only some UndoType's require init.
Definition at line 449 of file undo_system.c.
References BLI_assert, BLI_strncpy(), C, CLOG_INFO, LOG, MEM_callocN, UndoStep::name, UndoType::name, UndoStep::next, NULL, UndoStack::step_active, UndoType::step_encode_init, UndoStack::step_init, UndoType::step_size, UndoStep::type, UNDO_NESTED_ASSERT, undosys_stack_clear_all_last(), and undosys_stack_validate().
Referenced by BKE_undosys_step_push_init(), ED_paintcurve_undo_push_begin(), ED_text_undo_push_init(), image_undo_push_begin(), and SCULPT_undo_push_begin().
eUndoPushReturn BKE_undosys_step_push_with_type | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
const char * | name, | ||
const UndoType * | ut | ||
) |
C | Can be NULL from some callers if their encoding function doesn't need it |
Definition at line 491 of file undo_system.c.
References BKE_lib_override_library_main_operations_create(), BLI_addtail(), BLI_assert, BLI_findindex(), BLI_strncpy(), C, CLOG_INFO, UndoType::flags, G_MAIN, UndoStack::group_level, ListBase::last, LOG, MEM_callocN, MEM_freeN, UndoStep::name, UndoType::name, NULL, UndoStep::skip, UndoStack::step_active, UndoStack::step_active_memfile, UndoType::step_foreach_ID_ref, UndoStack::step_init, UndoType::step_size, UndoStack::steps, STREQ, UndoStep::type, UNDO_NESTED_ASSERT, UNDO_PUSH_RET_FAILURE, UNDO_PUSH_RET_OVERRIDE_CHANGED, UNDO_PUSH_RET_SUCCESS, undosys_stack_push_main(), undosys_stack_validate(), undosys_step_encode(), undosys_step_free_and_unlink(), UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE, UndoStep::use_memfile_step, and UndoStep::use_old_bmain_data.
Referenced by BKE_undosys_stack_init_from_context(), BKE_undosys_step_push(), and undosys_stack_push_main().
Redo one step from current active one.
Definition at line 869 of file undo_system.c.
References BKE_undosys_step_redo_with_data(), C, UndoStep::next, NULL, and UndoStack::step_active.
Referenced by ed_undo_step_direction().
bool BKE_undosys_step_redo_with_data | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
UndoStep * | us_target | ||
) |
Redo until us_target
step becomes the active (currently loaded) one.
Definition at line 864 of file undo_system.c.
References BKE_undosys_step_redo_with_data_ex(), and C.
Referenced by BKE_undosys_step_redo().
bool BKE_undosys_step_redo_with_data_ex | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
UndoStep * | us, | ||
bool | use_skip | ||
) |
Redo until us_target
step becomes the active (currently loaded) one.
us_target
is a 'skipped' one and use_skip
is true, us_target
will become the active step.use_skip
is true, the final target will always be after the given one (if the given one has to be skipped). Definition at line 850 of file undo_system.c.
References BKE_undosys_step_calc_direction(), BKE_undosys_step_load_data_ex(), BLI_assert, C, NULL, UndoStep::prev, and UndoStack::step_active.
Referenced by BKE_undosys_step_redo_with_data().
Useful when we want to diff against previous undo data but can't be sure the types match.
Definition at line 604 of file undo_system.c.
References UndoStep::next, and UndoStep::type.
Referenced by memfile_undosys_step_free().
Useful when we want to diff against previous undo data but can't be sure the types match.
Definition at line 617 of file undo_system.c.
References UndoStep::prev, and UndoStep::type.
Undo one step from current active (currently loaded) one.
Definition at line 842 of file undo_system.c.
References BKE_undosys_step_undo_with_data(), C, NULL, UndoStep::prev, and UndoStack::step_active.
Referenced by ed_undo_step_direction().
bool BKE_undosys_step_undo_with_data | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
UndoStep * | us_target | ||
) |
Undo until us_target
step becomes the active (currently loaded) one.
Definition at line 837 of file undo_system.c.
References BKE_undosys_step_undo_with_data_ex(), and C.
Referenced by BKE_undosys_step_undo().
bool BKE_undosys_step_undo_with_data_ex | ( | UndoStack * | ustack, |
struct bContext * | C, | ||
UndoStep * | us, | ||
bool | use_skip | ||
) |
Undo until us_target
step becomes the active (currently loaded) one.
us_target
is a 'skipped' one and use_skip
is true, us_target
will become the active step.use_skip
is true, the final target will always be before the given one (if the given one has to be skipped). Definition at line 822 of file undo_system.c.
References BKE_undosys_step_calc_direction(), BKE_undosys_step_load_data_ex(), BLI_assert, C, NULL, and UndoStack::step_active.
Referenced by BKE_undosys_step_undo_with_data().
Similar to WM_operatortype_append
Definition at line 877 of file undo_system.c.
References BLI_addtail(), g_undo_types, and MEM_callocN.
Referenced by ED_undosys_type_init().
Definition at line 890 of file undo_system.c.
References BLI_pophead(), g_undo_types, and MEM_freeN.
Referenced by ED_undosys_type_free().
UNDO_REF_ID_TYPE | ( | Image | ) |
UNDO_REF_ID_TYPE | ( | Mesh | ) |
UNDO_REF_ID_TYPE | ( | Object | ) |
UNDO_REF_ID_TYPE | ( | PaintCurve | ) |
UNDO_REF_ID_TYPE | ( | Scene | ) |
UNDO_REF_ID_TYPE | ( | Text | ) |
|
extern |
Definition at line 53 of file undo_system.c.
Referenced by ED_image_paint_tile_map_get(), ED_image_undo_push_begin_with_image(), ED_undosys_type_init(), image_undo_push_begin(), and image_undosys_step_encode().
|
extern |
Definition at line 54 of file undo_system.c.
Referenced by BKE_undosys_stack_init_from_context(), BKE_undosys_stack_limit_steps_and_memory(), ED_undosys_stack_memfile_get_active(), ED_undosys_stack_memfile_id_changed_tag(), ED_undosys_type_init(), memfile_undosys_step_encode(), undosys_stack_push_main(), undosys_step_decode(), and undosys_step_encode().
|
extern |
Definition at line 55 of file undo_system.c.
Referenced by ED_paintcurve_undo_push_begin(), and ED_undosys_type_init().
|
extern |
Definition at line 56 of file undo_system.c.
Referenced by ED_undosys_type_init().
|
extern |
Definition at line 57 of file undo_system.c.
Referenced by ED_undosys_type_init(), sculpt_undo_get_nodes(), SCULPT_undo_push_begin(), SCULPT_undo_push_end_ex(), and sculpt_undosys_step_decode_undo().
|
extern |
Definition at line 58 of file undo_system.c.
Referenced by ED_text_undo_push_init(), ED_undosys_type_init(), text_undosys_poll(), and text_undosys_step_encode_init().