Allow undoredo actions to not make history unsaved

This commit is contained in:
kobewi
2025-05-06 13:59:56 +02:00
parent 19bb18716e
commit e7e48cd58c
11 changed files with 93 additions and 11 deletions

View File

@ -51,6 +51,7 @@ public:
String action_name;
UndoRedo::MergeMode merge_mode = UndoRedo::MERGE_DISABLE;
bool backward_undo_ops = false;
bool mark_unsaved = true;
};
struct History {
@ -73,6 +74,11 @@ private:
protected:
static void _bind_methods();
#ifndef DISABLE_DEPRECATED
void _create_action_bind_compat_106121(const String &p_name = "", UndoRedo::MergeMode p_mode = UndoRedo::MERGE_DISABLE, Object *p_custom_context = nullptr, bool p_backward_undo_ops = false);
static void _bind_compatibility_methods();
#endif
public:
History &get_or_create_history(int p_idx);
UndoRedo *get_history_undo_redo(int p_idx) const;
@ -80,8 +86,8 @@ public:
History &get_history_for_object(Object *p_object);
void force_fixed_history();
void create_action_for_history(const String &p_name, int p_history_id, UndoRedo::MergeMode p_mode = UndoRedo::MERGE_DISABLE, bool p_backward_undo_ops = false);
void create_action(const String &p_name = "", UndoRedo::MergeMode p_mode = UndoRedo::MERGE_DISABLE, Object *p_custom_context = nullptr, bool p_backward_undo_ops = false);
void create_action_for_history(const String &p_name, int p_history_id, UndoRedo::MergeMode p_mode = UndoRedo::MERGE_DISABLE, bool p_backward_undo_ops = false, bool p_mark_unsaved = true);
void create_action(const String &p_name = "", UndoRedo::MergeMode p_mode = UndoRedo::MERGE_DISABLE, Object *p_custom_context = nullptr, bool p_backward_undo_ops = false, bool p_mark_unsaved = true);
void add_do_methodp(Object *p_object, const StringName &p_method, const Variant **p_args, int p_argcount);
void add_undo_methodp(Object *p_object, const StringName &p_method, const Variant **p_args, int p_argcount);