Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve undo action names #81569

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,22 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
if (name == "position" || name == "rotation" || name == "scale") {
Variant old = animation->track_get_key_value(track, key);
setting = true;
String chan;
String action_name;
switch (animation->track_get_type(track)) {
case Animation::TYPE_POSITION_3D:
chan = "Position3D";
action_name = TTR("Animation Change Position3D");
break;
case Animation::TYPE_ROTATION_3D:
chan = "Rotation3D";
action_name = TTR("Animation Change Rotation3D");
break;
case Animation::TYPE_SCALE_3D:
chan = "Scale3D";
action_name = TTR("Animation Change Scale3D");
break;
default: {
}
}

undo_redo->create_action(vformat(TTR("Animation Change %s"), chan));
undo_redo->create_action(action_name);
undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, p_value);
undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, old);
undo_redo->add_do_method(this, "_update_obj", animation);
Expand Down Expand Up @@ -730,23 +730,23 @@ bool AnimationMultiTrackKeyEdit::_set(const StringName &p_name, const Variant &p
case Animation::TYPE_SCALE_3D: {
Variant old = animation->track_get_key_value(track, key);
if (!setting) {
String chan;
String action_name;
switch (animation->track_get_type(track)) {
case Animation::TYPE_POSITION_3D:
chan = "Position3D";
action_name = TTR("Animation Multi Change Position3D");
break;
case Animation::TYPE_ROTATION_3D:
chan = "Rotation3D";
action_name = TTR("Animation Multi Change Rotation3D");
break;
case Animation::TYPE_SCALE_3D:
chan = "Scale3D";
action_name = TTR("Animation Multi Change Scale3D");
break;
default: {
}
}

setting = true;
undo_redo->create_action(vformat(TTR("Animation Multi Change %s"), chan));
undo_redo->create_action(action_name);
}
undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, p_value);
undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, old);
Expand Down Expand Up @@ -6052,7 +6052,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
} break;
case EDIT_BAKE_ANIMATION_CONFIRM: {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Bake Animation as Linear keys."));
undo_redo->create_action(TTR("Bake Animation as Linear Keys"));

int track_len = animation->get_track_count();
bool b_trs = bake_trs->is_pressed();
Expand Down
7 changes: 4 additions & 3 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ void EditorInspectorArray::_move_element(int p_element_index, int p_to_pos) {

void EditorInspectorArray::_clear_array() {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(vformat(TTR("Clear property array with prefix %s."), array_element_prefix));
undo_redo->create_action(vformat(TTR("Clear Property Array with Prefix %s"), array_element_prefix));
if (mode == MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION) {
for (int i = count - 1; i >= 0; i--) {
// Call the function.
Expand Down Expand Up @@ -1950,7 +1950,7 @@ void EditorInspectorArray::_resize_array(int p_size) {
}

EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(vformat(TTR("Resize property array with prefix %s."), array_element_prefix));
undo_redo->create_action(vformat(TTR("Resize Property Array with Prefix %s"), array_element_prefix));
if (p_size > count) {
if (mode == MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION) {
for (int i = count; i < p_size; i++) {
Expand Down Expand Up @@ -3856,7 +3856,8 @@ void EditorInspector::_multiple_properties_changed(Vector<String> p_paths, Array
names += p_paths[i];
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Set Multiple:") + " " + names, UndoRedo::MERGE_ENDS);
// TRANSLATORS: This is describing a change to multiple properties at once. The parameter is a list of property names.
undo_redo->create_action(vformat(TTR("Set Multiple: %s"), names), UndoRedo::MERGE_ENDS);
for (int i = 0; i < p_paths.size(); i++) {
_edit_set(p_paths[i], p_values[i], false, "");
if (restart_request_props.has(p_paths[i])) {
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Ar
Array old_input_array = EditorSettings::get_singleton()->get_builtin_action_overrides(p_name);

EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Edit Built-in Action") + " '" + p_name + "'");
undo_redo->create_action(vformat(TTR("Edit Built-in Action: %s"), p_name));
undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
undo_redo->add_undo_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
undo_redo->add_do_method(EditorSettings::get_singleton(), "set_builtin_action_override", p_name, p_events);
Expand All @@ -250,7 +250,7 @@ void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const A
Ref<Shortcut> current_sc = EditorSettings::get_singleton()->get_shortcut(p_path);

EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Edit Shortcut") + " '" + p_path + "'");
undo_redo->create_action(vformat(TTR("Edit Shortcut: %s"), p_path));
undo_redo->add_do_method(current_sc.ptr(), "set_events", p_events);
undo_redo->add_undo_method(current_sc.ptr(), "set_events", current_sc->get_events());
undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "shortcuts");
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_blend_tree_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void AnimationNodeBlendTreeEditor::_property_changed(const StringName &p_propert
}
updating = true;
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Parameter Changed:") + " " + String(p_property), UndoRedo::MERGE_ENDS);
undo_redo->create_action(vformat(TTR("Parameter Changed: %s"), p_property), UndoRedo::MERGE_ENDS);
undo_redo->add_do_property(tree, p_property, p_value);
undo_redo->add_undo_property(tree, p_property, tree->get(p_property));
undo_redo->add_do_method(this, "update_graph");
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/visual_shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6370,7 +6370,7 @@ class VisualShaderNodePluginDefaultEditor : public VBoxContainer {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();

updating = true;
undo_redo->create_action(TTR("Edit Visual Property:") + " " + p_property, UndoRedo::MERGE_ENDS);
undo_redo->create_action(vformat(TTR("Edit Visual Property: %s"), p_property), UndoRedo::MERGE_ENDS);
undo_redo->add_do_property(node.ptr(), p_property, p_value);
undo_redo->add_undo_property(node.ptr(), p_property, node->get(p_property));

Expand Down