diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_spin_slider.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 16 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/scene_tree_editor.cpp | 8 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 38 | ||||
-rw-r--r-- | editor/script_create_dialog.h | 1 |
6 files changed, 29 insertions, 40 deletions
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 9bf3c4c590..32d28cd3a7 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -81,7 +81,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) { if (grabbing_spinner_attempt) { if (grabbing_spinner) { Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); - Input::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos); + Input::get_singleton()->warp_mouse(grabbing_spinner_mouse_pos); update(); } else { _focus_entered(); @@ -414,7 +414,7 @@ void EditorSpinSlider::_draw_spin_slider() { grabber->set_position(get_global_position() + (grabber_rect.get_center() - grabber->get_size() * 0.5) * scale); if (mousewheel_over_grabber) { - Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size); + Input::get_singleton()->warp_mouse(grabber->get_position() + grabber_rect.size); } grabber_range = width; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d713e70251..764f467192 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4324,8 +4324,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; case UNLOCK_SELECTED: { @@ -4346,8 +4346,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; case GROUP_SELECTED: { @@ -4368,8 +4368,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; case UNGROUP_SELECTED: { @@ -4390,8 +4390,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 52e60b606c..ea119a33fa 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -205,7 +205,7 @@ void ViewportRotationControl::gui_input(const Ref<InputEvent> &p_event) { orbiting = false; if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); - Input::get_singleton()->warp_mouse_position(orbiting_mouse_start); + Input::get_singleton()->warp_mouse(orbiting_mouse_start); } } } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 3b8c540592..44eb5c670d 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -96,8 +96,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i if (n->is_class("CanvasItem") || n->is_class("Node3D")) { undo_redo->add_do_method(n, "remove_meta", "_edit_lock_"); undo_redo->add_undo_method(n, "set_meta", "_edit_lock_", true); - undo_redo->add_do_method(this, "_update_tree", Variant()); - undo_redo->add_undo_method(this, "_update_tree", Variant()); + undo_redo->add_do_method(this, "_update_tree"); + undo_redo->add_undo_method(this, "_update_tree"); undo_redo->add_do_method(this, "emit_signal", "node_changed"); undo_redo->add_undo_method(this, "emit_signal", "node_changed"); } @@ -114,8 +114,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i if (n->is_class("CanvasItem") || n->is_class("Node3D")) { undo_redo->add_do_method(n, "remove_meta", "_edit_group_"); undo_redo->add_undo_method(n, "set_meta", "_edit_group_", true); - undo_redo->add_do_method(this, "_update_tree", Variant()); - undo_redo->add_undo_method(this, "_update_tree", Variant()); + undo_redo->add_do_method(this, "_update_tree"); + undo_redo->add_undo_method(this, "_update_tree"); undo_redo->add_do_method(this, "emit_signal", "node_changed"); undo_redo->add_undo_method(this, "emit_signal", "node_changed"); } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index baafef8639..72f77c859b 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -106,15 +106,7 @@ static Vector<String> _get_hierarchy(String p_class_name) { void ScriptCreateDialog::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: - case NOTIFICATION_THEME_CHANGED: { - for (int i = 0; i < ScriptServer::get_language_count(); i++) { - Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons")); - if (language_icon.is_valid()) { - language_menu->set_item_icon(i, language_icon); - } - } - + case NOTIFICATION_ENTER_TREE: { String last_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); if (!last_language.is_empty()) { for (int i = 0; i < language_menu->get_item_count(); i++) { @@ -127,9 +119,15 @@ void ScriptCreateDialog::_notification(int p_what) { } else { language_menu->select(default_language); } - if (EditorSettings::get_singleton()->has_meta("script_setup/use_script_templates")) { - is_using_templates = bool(EditorSettings::get_singleton()->get_meta("script_setup/use_script_templates")); - use_templates->set_pressed(is_using_templates); + + [[fallthrough]]; + } + case NOTIFICATION_THEME_CHANGED: { + for (int i = 0; i < ScriptServer::get_language_count(); i++) { + Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons")); + if (language_icon.is_valid()) { + language_menu->set_item_icon(i, language_icon); + } } path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); @@ -332,13 +330,8 @@ void ScriptCreateDialog::_template_changed(int p_template) { dic_templates_project[parent_name->get_text()] = sinfo.get_hash(); EditorSettings::get_singleton()->set_project_metadata("script_setup", "templates_dictionary", dic_templates_project); } else { - // Save template into to editor dictionary (not a project template). - Dictionary dic_templates; - if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) { - dic_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary"); - } - dic_templates[parent_name->get_text()] = sinfo.get_hash(); - EditorSettings::get_singleton()->set_meta("script_setup/templates_dictionary", dic_templates); + // Save template info to editor dictionary (not a project template). + templates_dictionary[parent_name->get_text()] = sinfo.get_hash(); // Remove template from project dictionary as we last used an editor level template. Dictionary dic_templates_project = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary()); if (dic_templates_project.has(parent_name->get_text())) { @@ -479,7 +472,6 @@ void ScriptCreateDialog::_built_in_pressed() { void ScriptCreateDialog::_use_template_pressed() { is_using_templates = use_templates->is_pressed(); - EditorSettings::get_singleton()->set_meta("script_setup/use_script_templates", is_using_templates); _update_dialog(); } @@ -597,10 +589,6 @@ void ScriptCreateDialog::_update_template_menu() { if (is_language_using_templates) { // Get the latest templates used for each type of node from project settings then global settings. Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary()); - Dictionary last_global_templates; - if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) { - last_global_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary"); - } String inherits_base_type = parent_name->get_text(); // If it inherits from a script, get its parent class first. @@ -655,7 +643,7 @@ void ScriptCreateDialog::_update_template_menu() { // Check for last used template for this node in project settings then in global settings. if (last_local_templates.has(parent_name->get_text()) && t.get_hash() == String(last_local_templates[parent_name->get_text()])) { last_used_template = id; - } else if (last_used_template == -1 && last_global_templates.has(parent_name->get_text()) && t.get_hash() == String(last_global_templates[parent_name->get_text()])) { + } else if (last_used_template == -1 && templates_dictionary.has(parent_name->get_text()) && t.get_hash() == String(templates_dictionary[parent_name->get_text()])) { last_used_template = id; } t.id = id; diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index d7c43f322c..e9f634e2c0 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -83,6 +83,7 @@ class ScriptCreateDialog : public ConfirmationDialog { int current_language; int default_language; bool re_check_path = false; + Dictionary templates_dictionary; Control *path_controls[2]; Control *name_controls[2]; |