Repository: godotengine/godot
Pull request #106121: Allow undoredo actions to not make history unsaved
Author: login: KoBeWi
Labels: name: enhancement
name: topic:editor
name: usability
Created: 2025-05-06T12:04:12Z | Merged: 2025-05-14T14:49:37Z

Changing settings or changing TileMapLayer selection will no longer mark the history as unsaved.

Fixes #103335 and similar issues.
Naming up to discussion probably.

Linked issue #103335: Restart prompt for unsaved resources shows even in an empty project with no open scenes
### Tested versions

- Reproducible in: 4.4.rc2
- Not reproducible in: 4.3.stable

### System information

Godot v4.4.rc (3ef055fec) - Fedora Linux 41 (KDE Plasma) on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (nvidia; 565.77) - 13th Gen Intel(R) Core(TM) i9-13900K (32 threads)

### Issue description

The restart prompt for unsaved resources shows even in an empty project with no open scenes:

![Image](https://github.com/user-attachments/assets/8b43d457-b4e8-4cd6-8678-bc4d89df5d24)

This is a regression from https://github.com/godotengine/godot/pull/102017, as this dialog wasn't present before. It can be confusing to see this dialog if there's nothing that can be saved, since the user might think they have unsaved resources when they don't.

### Steps to reproduce

- Create a new project and open it in the editor.
- Do not create or open any scenes/resources.
- Change a setting that requires a restart, then click the **Save & Restart** button.
- A restart dialog shows up, but choosing **Don't save** or **Save & Reload** will do the same thing as there is nothing to save.

### Minimal reproduction project (MRP)

N/A
Linked issue comments: user: login: KoBeWi
created_at: 2025-02-26T23:31:29Z
body: Changing project/editor settings marks global history as unsaved. There is no way to differentiate that from actual resource modifiactions and the dialog is somewhat expected in this case.

![Image](https://github.com/user-attachments/assets/bd1e7d0b-d8dd-4bd7-88bb-867c8e2225a5)
author_association: MEMBER
user: login: Calinou
created_at: 2025-02-27T15:51:14Z
body: > There is no way to differentiate that from actual resource modifiactions and the dialog is somewhat expected in this case.

Can we get a list of modified resources and skip the dialog if the only modified resource is of type EditorSettings?
author_association: MEMBER
user: login: KoBeWi
created_at: 2025-02-27T16:04:43Z
body: Not sure if such list is even available. Also the editor only checks whether the undo history is "unsaved" (i.e. it has actions performed since the last save), so they'd need to be checked too.
author_association: MEMBER

Diff:
diff --git a/doc/classes/EditorUndoRedoManager.xml b/doc/classes/EditorUndoRedoManager.xml
index 6a66a35ce87b..092933028177 100644
--- a/doc/classes/EditorUndoRedoManager.xml
+++ b/doc/classes/EditorUndoRedoManager.xml
@@ -96,11 +96,13 @@
 			<param index="1" name="merge_mode" type="int" enum="UndoRedo.MergeMode" default="0" />
 			<param index="2" name="custom_context" type="Object" default="null" />
 			<param index="3" name="backward_undo_ops" type="bool" default="false" />
+			<param index="4" name="mark_unsaved" type="bool" default="true" />
 			<description>
 				Create a new action. After this is called, do all your calls to [method add_do_method], [method add_undo_method], [method add_do_property], and [method add_undo_property], then commit the action with [method commit_action].
 				The way actions are merged is dictated by the [param merge_mode] argument. See [enum UndoRedo.MergeMode] for details.
 				If [param custom_context] object is provided, it will be used for deducing target history (instead of using the first operation).
 				The way undo operation are ordered in actions is dictated by [param backward_undo_ops]. When [param backward_undo_ops] is [code]false[/code] undo option are ordered in the same order they were added. Which means the first operation to be added will be the first to be undone.
+				If [param mark_unsaved] is [code]false[/code], the action will not mark the history as unsaved. This is useful for example for actions that change a selection, or a setting that will be saved automatically. Otherwise, this should be left to [code]true[/code] if the action requires saving by the user or if it can cause data loss when left unsaved.
 			</description>
 		</method>
 		<method name="force_fixed_history">
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index a55fe2098e80..0b2d02808999 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -4661,7 +4661,7 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
 		_edit_request_change(object, p_name);
 		emit_signal(_prop_edited, p_name);
 	} else {
-		undo_redo->create_action(vformat(TTR("Set %s"), p_name), UndoRedo::MERGE_ENDS);
+		undo_redo->create_action(vformat(TTR("Set %s"), p_name), UndoRedo::MERGE_ENDS, nullptr, false, mark_unsaved);
 		undo_redo->add_do_property(object, p_name, p_value);
 		bool valid = false;
 		Variant value = object->get(p_name, &valid);
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 183c18c3afb5..a0da16593a37 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -603,6 +603,7 @@ class EditorInspector : public ScrollContainer {
 	bool keying = false;
 	bool wide_editors = false;
 	bool deletable_properties = false;
+	bool mark_unsaved = true;
 
 	float refresh_countdown;
 	bool update_tree_pending = false;
@@ -703,6 +704,7 @@ class EditorInspector : public ScrollContainer {
 
 	void set_keying(bool p_active);
 	void set_read_only(bool p_read_only);
+	void set_mark_unsaved(bool p_mark) { mark_unsaved = p_mark; }
 
 	EditorPropertyNameProcessor::Style get_property_name_style() const;
 	void set_property_name_style(EditorPropertyNameProcessor::Style p_style);
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index 016d2d5b314f..01c0e2b56890 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -915,6 +915,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
 
 	inspector = memnew(SectionedInspector);
 	inspector->get_inspector()->set_use_filter(true);
+	inspector->get_inspector()->set_mark_unsaved(false);
 	inspector->register_search_box(search_box);
 	inspector->register_advanced_toggle(advanced_switch);
 	inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/editor_undo_redo_manager.compat.inc b/editor/editor_undo_redo_manager.compat.inc
new file mode 100644
index 000000000000..b44762e31112
--- /dev/null
+++ b/editor/editor_undo_redo_manager.compat.inc
@@ -0,0 +1,41 @@
+/**************************************************************************/
+/*  editor_undo_redo_manager.compat.inc                                   */
+/**************************************************************************/
+/*                         This file is part of:                          */
+/*                             GODOT ENGINE                               */
+/*                        https://godotengine.org                         */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
+/*                                                                        */
+/* Permission is hereby granted, free of charge, to any person obtaining  */
+/* a copy of this software and associated documentation files (the        */
+/* "Software"), to deal in the Software without restriction, including    */
+/* without limitation the rights to use, copy, modify, merge, publish,    */
+/* distribute, sublicense, and/or sell copies of the Software, and to     */
+/* permit persons to whom the Software is furnished to do so, subject to  */
+/* the following conditions:                                              */
+/*                                                                        */
+/* The above copyright notice and this permission notice shall be         */
+/* included in all copies or substantial portions of the Software.        */
+/*                                                                        */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
+/**************************************************************************/
+
+#ifndef DISABLE_DEPRECATED
+
+void EditorUndoRedoManager::_create_action_bind_compat_106121(const String &p_name, UndoRedo::MergeMode p_mode, Object *p_custom_context, bool p_backward_undo_ops) {
+	create_action(p_name, p_mode, p_custom_context, p_backward_undo_ops, true);
+}
+
+void EditorUndoRedoManager::_bind_compatibility_methods() {
+	ClassDB::bind_compatibility_method(D_METHOD("create_action", "name", "merge_mode", "custom_context", "backward_undo_ops"), &EditorUndoRedoManager::_create_action_bind_compat_106121, DEFVAL(UndoRedo::MERGE_DISABLE), DEFVAL((Object *)nullptr), DEFVAL(false));
+}
+
+#endif
diff --git a/editor/editor_undo_redo_manager.cpp b/editor/editor_undo_redo_manager.cpp
index a278de0884b8..2737d4d4b2e5 100644
--- a/editor/editor_undo_redo_manager.cpp
+++ b/editor/editor_undo_redo_manager.cpp
@@ -29,6 +29,7 @@
 /**************************************************************************/
 
 #include "editor_undo_redo_manager.h"
+#include "editor_undo_redo_manager.compat.inc"
 
 #include "core/io/resource.h"
 #include "core/os/os.h"
@@ -125,7 +126,7 @@ void EditorUndoRedoManager::force_fixed_history() {
 	forced_history = true;
 }
 
-void EditorUndoRedoManager::create_action_for_history(const String &p_name, int p_history_id, UndoRedo::MergeMode p_mode, bool p_backward_undo_ops) {
+void EditorUndoRedoManager::create_action_for_history(const String &p_name, int p_history_id, UndoRedo::MergeMode p_mode, bool p_backward_undo_ops, bool p_mark_unsaved) {
 	if (pending_action.history_id != INVALID_HISTORY) {
 		// Nested action.
 		p_history_id = pending_action.history_id;
@@ -134,6 +135,7 @@ void EditorUndoRedoManager::create_action_for_history(const String &p_name, int
 		pending_action.timestamp = OS::get_singleton()->get_unix_time();
 		pending_action.merge_mode = p_mode;
 		pending_action.backward_undo_ops = p_backward_undo_ops;
+		pending_action.mark_unsaved = p_mark_unsaved;
 	}
 
 	if (p_history_id != INVALID_HISTORY) {
@@ -143,8 +145,8 @@ void EditorUndoRedoManager::create_action_for_history(const String &p_name, int
 	}
 }
 
-void EditorUndoRedoManager::create_action(const String &p_name, UndoRedo::MergeMode p_mode, Object *p_custom_context, bool p_backward_undo_ops) {
-	create_action_for_history(p_name, INVALID_HISTORY, p_mode, p_backward_undo_ops);
+void EditorUndoRedoManager::create_action(const String &p_name, UndoRedo::MergeMode p_mode, Object *p_custom_context, bool p_backward_undo_ops, bool p_mark_unsaved) {
+	create_action_for_history(p_name, INVALID_HISTORY, p_mode, p_backward_undo_ops, p_mark_unsaved);
 
 	if (p_custom_context) {
 		// This assigns history to pending action.
@@ -380,7 +382,26 @@ void EditorUndoRedoManager::set_history_as_unsaved(int p_id) {
 
 bool EditorUndoRedoManager::is_history_unsaved(int p_id) {
 	History &history = get_or_create_history(p_id);
-	return history.undo_redo->get_version() != history.saved_version;
+
+	int version_difference = history.undo_redo->get_version() - history.saved_version;
+	if (version_difference > 0) {
+		List<Action>::Element *E = history.undo_stack.back();
+		for (int i = 0; i < version_difference; i++) {
+			if (E->get().mark_unsaved) {
+				return true;
+			}
+			E = E->prev();
+		}
+	} else if (version_difference < 0) {
+		List<Action>::Element *E = history.redo_stack.back();
+		for (int i = 0; i > version_difference; i--) {
+			if (E->get().mark_unsaved) {
+				return true;
+			}
+			E = E->prev();
+		}
+	}
+	return false;
 }
 
 bool EditorUndoRedoManager::has_undo() {
@@ -492,7 +513,7 @@ EditorUndoRedoManager::History *EditorUndoRedoManager::_get_newest_undo() {
 }
 
 void EditorUndoRedoManager::_bind_methods() {
-	ClassDB::bind_method(D_METHOD("create_action", "name", "merge_mode", "custom_context", "backward_undo_ops"), &EditorUndoRedoManager::create_action, DEFVAL(UndoRedo::MERGE_DISABLE), DEFVAL((Object *)nullptr), DEFVAL(false));
+	ClassDB::bind_method(D_METHOD("create_action", "name", "merge_mode", "custom_context", "backward_undo_ops", "mark_unsaved"), &EditorUndoRedoManager::create_action, DEFVAL(UndoRedo::MERGE_DISABLE), DEFVAL((Object *)nullptr), DEFVAL(false), DEFVAL(true));
 	ClassDB::bind_method(D_METHOD("commit_action", "execute"), &EditorUndoRedoManager::commit_action, DEFVAL(true));
 	ClassDB::bind_method(D_METHOD("is_committing_action"), &EditorUndoRedoManager::is_committing_action);
 	ClassDB::bind_method(D_METHOD("force_fixed_history"), &EditorUndoRedoManager::force_fixed_history);
diff --git a/editor/editor_undo_redo_manager.h b/editor/editor_undo_redo_manager.h
index 4b90a65e1b62..a67b900a0416 100644
--- a/editor/editor_undo_redo_manager.h
+++ b/editor/editor_undo_redo_manager.h
@@ -51,6 +51,7 @@ class EditorUndoRedoManager : public Object {
 		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 @@ class EditorUndoRedoManager : public Object {
 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 @@ class EditorUndoRedoManager : public Object {
 	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);
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 5846fe7ee66f..09c321aa9d98 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -1521,10 +1521,11 @@ ProjectExportDialog::ProjectExportDialog() {
 	// Main preset parameters.
 
 	parameters = memnew(EditorInspector);
-	sections->add_child(parameters);
-	parameters->set_name(TTR("Options"));
+	parameters->set_name(TTRC("Options"));
+	parameters->set_mark_unsaved(false);
 	parameters->set_v_size_flags(Control::SIZE_EXPAND_FILL);
 	parameters->set_use_doc_hints(true);
+	sections->add_child(parameters);
 	parameters->connect("property_edited", callable_mp(this, &ProjectExportDialog::_update_parameters));
 	EditorExport::get_singleton()->connect("export_presets_updated", callable_mp(this, &ProjectExportDialog::_force_update_current_preset_parameters));
 
diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp
index 972bf5aaa185..4fd11c2966df 100644
--- a/editor/plugins/tiles/tile_map_layer_editor.cpp
+++ b/editor/plugins/tiles/tile_map_layer_editor.cpp
@@ -1313,7 +1313,7 @@ void TileMapLayerEditorTilesPlugin::_stop_dragging() {
 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
 	switch (drag_type) {
 		case DRAG_TYPE_SELECT: {
-			undo_redo->create_action_for_history(TTR("Change selection"), EditorNode::get_editor_data().get_current_edited_scene_history_id());
+			undo_redo->create_action_for_history(TTR("Change selection"), EditorNode::get_editor_data().get_current_edited_scene_history_id(), UndoRedo::MERGE_DISABLE, false, false);
 			undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection());
 
 			if (!Input::get_singleton()->is_key_pressed(Key::SHIFT) && !Input::get_singleton()->is_key_pressed(Key::CMD_OR_CTRL)) {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 0671684e0ecc..6f0976e140fa 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -718,6 +718,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
 	general_settings_inspector->register_search_box(search_box);
 	general_settings_inspector->register_advanced_toggle(advanced);
 	general_settings_inspector->get_inspector()->set_use_filter(true);
+	general_settings_inspector->get_inspector()->set_mark_unsaved(false);
 	general_settings_inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected));
 	general_settings_inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited));
 	general_settings_inspector->get_inspector()->connect("restart_requested", callable_mp(this, &ProjectSettingsEditor::_editor_restart_request));
diff --git a/misc/extension_api_validation/4.4-stable.expected b/misc/extension_api_validation/4.4-stable.expected
index 3265e1b8c731..33e335ff502d 100644
--- a/misc/extension_api_validation/4.4-stable.expected
+++ b/misc/extension_api_validation/4.4-stable.expected
@@ -104,3 +104,10 @@ GH-105570
 Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/texture_create_from_extension/arguments': size changed value in new API, from 9 to 10.
 
 Argument added; p_mipmaps. Compatibility method registered.
+
+GH-106121
+--------
+Validate extension JSON: Error: Field 'classes/EditorUndoRedoManager/methods/create_action/arguments': size changed value in new API, from 4 to 5.
+Validate extension JSON: Error: Field 'classes/EditorUndoRedoManager/methods/create_action/arguments': size changed value in new API, from 3 to 5.
+
+New argument added. Compatibility method registered.


Reviews:
user: login: Mickeon
body: Thank you for putting food on my plate

I can trust KoBeWi's judgement on this, but a second look at the new code in `is_history_unsaved` is warranted in my opinion.
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-12T15:47:54Z
user: login: akien-mga
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-12T20:33:26Z
user: login: KoBeWi
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-12T21:33:32Z
user: login: akien-mga
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-12T22:08:32Z
user: login: akien-mga
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-12T22:19:44Z
user: login: akien-mga
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-12T23:05:48Z
user: login: akien-mga
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-13T05:54:53Z

Review comments:
diff_hunk: @@ -96,11 +96,13 @@
 			<param index="1" name="merge_mode" type="int" enum="UndoRedo.MergeMode" default="0" />
 			<param index="2" name="custom_context" type="Object" default="null" />
 			<param index="3" name="backward_undo_ops" type="bool" default="false" />
+			<param index="4" name="ignore_for_unsaved" type="bool" default="false" />
 			<description>
 				Create a new action. After this is called, do all your calls to [method add_do_method], [method add_undo_method], [method add_do_property], and [method add_undo_property], then commit the action with [method commit_action].
 				The way actions are merged is dictated by the [param merge_mode] argument. See [enum UndoRedo.MergeMode] for details.
 				If [param custom_context] object is provided, it will be used for deducing target history (instead of using the first operation).
 				The way undo operation are ordered in actions is dictated by [param backward_undo_ops]. When [param backward_undo_ops] is [code]false[/code] undo option are ordered in the same order they were added. Which means the first operation to be added will be the first to be undone.
+				If [param ignore_for_unsaved] is [code]true[/code], the action will not mark the history as unsaved. It should be used only if the action does not require saving by the user and won't cause data loss if left unsaved. It can be for example a selection change, or change to a setting that will be saved automatically.
path: doc/classes/EditorUndoRedoManager.xml
user: login: Mickeon
body: ```suggestion
				If [param ignore_for_unsaved] is [code]true[/code], the action will not mark the history as unsaved. This is useful for actions that change a selection, or a setting that will be saved automatically. Otherwise, this should be left to [code]false[/code] if the action requires saving by the user or if it can cause data loss when left unsaved.
```
Too verbose perhaps?
created_at: 2025-05-12T15:47:50Z
author_association: MEMBER
diff_hunk: @@ -96,11 +96,13 @@
 			<param index="1" name="merge_mode" type="int" enum="UndoRedo.MergeMode" default="0" />
 			<param index="2" name="custom_context" type="Object" default="null" />
 			<param index="3" name="backward_undo_ops" type="bool" default="false" />
+			<param index="4" name="ignore_for_unsaved" type="bool" default="false" />
path: doc/classes/EditorUndoRedoManager.xml
user: login: akien-mga
body: Maybe `mark_unsaved` (flipping the bool) like used in the inspector sounds better?
created_at: 2025-05-12T20:33:26Z
author_association: MEMBER
diff_hunk: @@ -96,11 +96,13 @@
 			<param index="1" name="merge_mode" type="int" enum="UndoRedo.MergeMode" default="0" />
 			<param index="2" name="custom_context" type="Object" default="null" />
 			<param index="3" name="backward_undo_ops" type="bool" default="false" />
+			<param index="4" name="ignore_for_unsaved" type="bool" default="false" />
 			<description>
 				Create a new action. After this is called, do all your calls to [method add_do_method], [method add_undo_method], [method add_do_property], and [method add_undo_property], then commit the action with [method commit_action].
 				The way actions are merged is dictated by the [param merge_mode] argument. See [enum UndoRedo.MergeMode] for details.
 				If [param custom_context] object is provided, it will be used for deducing target history (instead of using the first operation).
 				The way undo operation are ordered in actions is dictated by [param backward_undo_ops]. When [param backward_undo_ops] is [code]false[/code] undo option are ordered in the same order they were added. Which means the first operation to be added will be the first to be undone.
+				If [param ignore_for_unsaved] is [code]true[/code], the action will not mark the history as unsaved. It should be used only if the action does not require saving by the user and won't cause data loss if left unsaved. It can be for example a selection change, or change to a setting that will be saved automatically.
path: doc/classes/EditorUndoRedoManager.xml
user: login: KoBeWi
body: > This is useful for actions that change a selection, or a setting that will be saved automatically.

There might be more cases where this is useful, hence I emphasized more that it's an example. Your suggestion sounds like it's only 2 cases.
created_at: 2025-05-12T21:33:32Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,41 @@
+/**************************************************************************/
+/*  editor_undo_redo_manager.compat.inc                                   */
+/**************************************************************************/
+/*                         This file is part of:                          */
+/*                             GODOT ENGINE                               */
+/*                        https://godotengine.org                         */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
+/*                                                                        */
+/* Permission is hereby granted, free of charge, to any person obtaining  */
+/* a copy of this software and associated documentation files (the        */
+/* "Software"), to deal in the Software without restriction, including    */
+/* without limitation the rights to use, copy, modify, merge, publish,    */
+/* distribute, sublicense, and/or sell copies of the Software, and to     */
+/* permit persons to whom the Software is furnished to do so, subject to  */
+/* the following conditions:                                              */
+/*                                                                        */
+/* The above copyright notice and this permission notice shall be         */
+/* included in all copies or substantial portions of the Software.        */
+/*                                                                        */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
+/**************************************************************************/
+
+#ifndef DISABLE_DEPRECATED
+
+void EditorUndoRedoManager::_create_action_bind_compat_106121(const String &p_name, UndoRedo::MergeMode p_mode, Object *p_custom_context, bool p_backward_undo_ops) {
+	create_action(p_name, p_mode, p_custom_context, p_backward_undo_ops, true);
+}
+
+void EditorUndoRedoManager::_bind_compatibility_methods() {
+	ClassDB::bind_compatibility_method(D_METHOD("create_action", "name", "merge_mode", "custom_context", "backward_undo_ops"), &EditorUndoRedoManager::_create_action_bind_compat_106121);
path: editor/editor_undo_redo_manager.compat.inc
user: login: akien-mga
body: The `DEFVAL`s are also part of the hash so they're important here.
```suggestion
	ClassDB::bind_compatibility_method(D_METHOD("create_action", "name", "merge_mode", "custom_context", "backward_undo_ops"), &EditorUndoRedoManager::_create_action_bind_compat_106121, 
DEFVAL(UndoRedo::MERGE_DISABLE), DEFVAL((Object *)nullptr), DEFVAL(false));
```

This should fix:
```
Validate extension JSON: Error: Hash changed for 'classes/EditorUndoRedoManager/methods/create_action', from D543BA91 to 09864999. This means that the function has changed and no compatibility function was provided.
```

Then you also need to add this to the `4.4-stable.expected` file:
```
Error: Field 'classes/EditorUndoRedoManager/methods/create_action/arguments': size changed value in new API, from 4 to 5.
```

And we already changed this API in 4.0 -> 4.1 so there's a quirk of the validation system to deal with. I think you might need to add
```
Error: Field 'classes/EditorUndoRedoManager/methods/create_action/arguments': size changed value in new API, from 3 to 5.
```
to the `4.4-stable.expected` file even though it's about 4.1 -> 4.5, but IIRC that should do the trick.
created_at: 2025-05-12T22:19:44Z
author_association: MEMBER
diff_hunk: @@ -104,3 +104,9 @@ GH-105570
 Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/texture_create_from_extension/arguments': size changed value in new API, from 9 to 10.
 
 Argument added; p_mipmaps. Compatibility method registered.
+
+GH-106121
+--------
+Validate extension JSON: Error: Field 'classes/EditorUndoRedoManager/methods/create_action/arguments': size changed value in new API, from 3 to 5.
path: misc/extension_api_validation/4.4-stable.expected
user: login: akien-mga
body: You need both as I mentioned in the other comment:
```
Validate extension JSON: Error: Field 'classes/EditorUndoRedoManager/methods/create_action/arguments': size changed value in new API, from 4 to 5.
Validate extension JSON: Error: Field 'classes/EditorUndoRedoManager/methods/create_action/arguments': size changed value in new API, from 3 to 5.
```

The "3 to 5" one being required is a bug, but for now that's how we work it around.
created_at: 2025-05-12T23:05:48Z
author_association: MEMBER

PR comments:
user: login: Mickeon
created_at: 2025-05-08T20:54:17Z
body: It sounds like not using this new parameter wisely would lead to annoying issues to debug, so that could be slightly reflected in the documentation
author_association: MEMBER
user: login: KoBeWi
created_at: 2025-05-11T18:51:43Z
body: I already documented the parameter, what else should be added?
author_association: MEMBER
user: login: Mickeon
created_at: 2025-05-11T22:29:38Z
body: Possibly an use-case or a general recommendation because (I think?) not considering the history to be "dirty" may be generally undesirable
author_association: MEMBER
user: login: KoBeWi
created_at: 2025-05-12T22:15:10Z
body: Not sure how to handle extension API update. I tried following the instructions, but it didn't do anything 🤷‍♂️
author_association: MEMBER
user: login: Repiteo
created_at: 2025-05-14T14:50:20Z
body: Thanks!
author_association: CONTRIBUTOR