mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Cleanup remaining EditorUndoRedoManager usages
This commit is contained in:
parent
cd3d6e63a6
commit
8a3d2f4e0c
59 changed files with 408 additions and 406 deletions
|
@ -93,7 +93,7 @@ void AnimationLibraryEditor::_add_library_validate(const String &p_name) {
|
|||
void AnimationLibraryEditor::_add_library_confirm() {
|
||||
if (adding_animation) {
|
||||
String anim_name = add_library_name->get_text();
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
Ref<AnimationLibrary> al = player->call("get_animation_library", adding_animation_to_library);
|
||||
ERR_FAIL_COND(!al.is_valid());
|
||||
|
@ -110,7 +110,7 @@ void AnimationLibraryEditor::_add_library_confirm() {
|
|||
|
||||
} else {
|
||||
String lib_name = add_library_name->get_text();
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
Ref<AnimationLibrary> al;
|
||||
al.instantiate();
|
||||
|
@ -210,7 +210,7 @@ void AnimationLibraryEditor::_file_popup_selected(int p_id) {
|
|||
ald->add_animation(animation_name, animation);
|
||||
}
|
||||
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
undo_redo->create_action(vformat(TTR("Make Animation Library Unique: %s"), lib_name));
|
||||
undo_redo->add_do_method(player, "remove_animation_library", lib_name);
|
||||
undo_redo->add_do_method(player, "add_animation_library", lib_name, ald);
|
||||
|
@ -279,7 +279,7 @@ void AnimationLibraryEditor::_file_popup_selected(int p_id) {
|
|||
|
||||
Ref<Animation> animd = anim->duplicate();
|
||||
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
undo_redo->create_action(vformat(TTR("Make Animation Unique: %s"), anim_name));
|
||||
undo_redo->add_do_method(al.ptr(), "remove_animation", anim_name);
|
||||
undo_redo->add_do_method(al.ptr(), "add_animation", anim_name, animd);
|
||||
|
@ -327,7 +327,7 @@ void AnimationLibraryEditor::_load_file(String p_path) {
|
|||
name = p_path.get_file().get_basename() + " " + itos(attempt);
|
||||
}
|
||||
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
undo_redo->create_action(vformat(TTR("Add Animation Library: %s"), name));
|
||||
undo_redo->add_do_method(player, "add_animation_library", name, al);
|
||||
|
@ -365,7 +365,7 @@ void AnimationLibraryEditor::_load_file(String p_path) {
|
|||
name = p_path.get_file().get_basename() + " " + itos(attempt);
|
||||
}
|
||||
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
undo_redo->create_action(vformat(TTR("Load Animation into Library: %s"), name));
|
||||
undo_redo->add_do_method(al.ptr(), "add_animation", name, anim);
|
||||
|
@ -381,7 +381,7 @@ void AnimationLibraryEditor::_load_file(String p_path) {
|
|||
EditorNode::get_singleton()->save_resource_in_path(al, p_path);
|
||||
|
||||
if (al->get_path() != prev_path) { // Save successful.
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
undo_redo->create_action(vformat(TTR("Save Animation library to File: %s"), file_dialog_library));
|
||||
undo_redo->add_do_method(al.ptr(), "set_path", al->get_path());
|
||||
|
@ -402,7 +402,7 @@ void AnimationLibraryEditor::_load_file(String p_path) {
|
|||
String prev_path = anim->get_path();
|
||||
EditorNode::get_singleton()->save_resource_in_path(anim, p_path);
|
||||
if (anim->get_path() != prev_path) { // Save successful.
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
undo_redo->create_action(vformat(TTR("Save Animation to File: %s"), file_dialog_animation));
|
||||
undo_redo->add_do_method(anim.ptr(), "set_path", anim->get_path());
|
||||
|
@ -420,7 +420,7 @@ void AnimationLibraryEditor::_item_renamed() {
|
|||
String text = ti->get_text(0);
|
||||
String old_text = ti->get_metadata(0);
|
||||
bool restore_text = false;
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
if (String(text).contains("/") || String(text).contains(":") || String(text).contains(",") || String(text).contains("[")) {
|
||||
restore_text = true;
|
||||
|
@ -534,7 +534,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int
|
|||
name = base_name + " (" + itos(attempt) + ")";
|
||||
}
|
||||
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
undo_redo->create_action(vformat(TTR("Add Animation to Library: %s"), name));
|
||||
undo_redo->add_do_method(al.ptr(), "add_animation", name, anim);
|
||||
|
@ -560,7 +560,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int
|
|||
file_dialog_library = lib_name;
|
||||
} break;
|
||||
case LIB_BUTTON_DELETE: {
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
undo_redo->create_action(vformat(TTR("Remove Animation Library: %s"), lib_name));
|
||||
undo_redo->add_do_method(player, "remove_animation_library", lib_name);
|
||||
undo_redo->add_undo_method(player, "add_animation_library", lib_name, al);
|
||||
|
@ -601,7 +601,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int
|
|||
|
||||
} break;
|
||||
case ANIM_BUTTON_DELETE: {
|
||||
Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||
undo_redo->create_action(vformat(TTR("Remove Animation from Library: %s"), anim_name));
|
||||
undo_redo->add_do_method(al.ptr(), "remove_animation", anim_name);
|
||||
undo_redo->add_undo_method(al.ptr(), "add_animation", anim_name, anim);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue