diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_audio_buses.cpp | 7 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 20 | ||||
-rw-r--r-- | editor/editor_inspector.h | 4 | ||||
-rw-r--r-- | editor/editor_node.cpp | 14 | ||||
-rw-r--r-- | editor/editor_node.h | 3 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 2 | ||||
-rw-r--r-- | editor/import_dock.cpp | 73 | ||||
-rw-r--r-- | editor/import_dock.h | 5 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/project_manager.cpp | 57 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 3 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 4 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 3 |
13 files changed, 175 insertions, 22 deletions
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 5d0abef4b8..6593eb8f03 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -75,9 +75,16 @@ void EditorAudioBus::_notification(int p_what) { disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); + Color solo_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#ffe337" : "#ffeb70"); + Color mute_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#ff2929" : "#ff7070"); + Color bypass_color = Color::html(EditorSettings::get_singleton()->is_dark_theme() ? "#22ccff" : "#70deff"); + solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); + solo->add_color_override("icon_color_pressed", solo_color); mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); + mute->add_color_override("icon_color_pressed", mute_color); bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); + bypass->add_color_override("icon_color_pressed", bypass_color); bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index e660bb2daf..d7e0302478 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1899,13 +1899,13 @@ int EditorInspector::get_scroll_offset() const { return get_v_scroll(); } -void EditorInspector::set_use_sub_inspector_bg(bool p_enable) { +void EditorInspector::set_sub_inspector(bool p_enable) { - use_sub_inspector_bg = p_enable; + sub_inspector = p_enable; if (!is_inside_tree()) return; - if (use_sub_inspector_bg) { + if (sub_inspector) { add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor")); } else { add_style_override("bg", get_stylebox("bg", "Tree")); @@ -2126,16 +2126,18 @@ void EditorInspector::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - get_tree()->connect("node_removed", this, "_node_removed"); - if (use_sub_inspector_bg) { + if (sub_inspector) { add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor")); - } else if (is_inside_tree()) { + } else { add_style_override("bg", get_stylebox("bg", "Tree")); + get_tree()->connect("node_removed", this, "_node_removed"); } } if (p_what == NOTIFICATION_EXIT_TREE) { - get_tree()->disconnect("node_removed", this, "_node_removed"); + if (!sub_inspector) { + get_tree()->disconnect("node_removed", this, "_node_removed"); + } edit(NULL); } @@ -2184,7 +2186,7 @@ void EditorInspector::_notification(int p_what) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - if (use_sub_inspector_bg) { + if (sub_inspector) { add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor")); } else if (is_inside_tree()) { add_style_override("bg", get_stylebox("bg", "Tree")); @@ -2280,7 +2282,7 @@ EditorInspector::EditorInspector() { _prop_edited = "property_edited"; set_process(true); property_focusable = -1; - use_sub_inspector_bg = false; + sub_inspector = false; get_v_scrollbar()->connect("value_changed", this, "_vscroll_changed"); update_scroll_request = -1; diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index d64a78be57..4fb3198e87 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -281,7 +281,7 @@ class EditorInspector : public ScrollContainer { bool update_all_pending; bool read_only; bool keying; - bool use_sub_inspector_bg; + bool sub_inspector; float refresh_countdown; bool update_tree_pending; @@ -375,7 +375,7 @@ public: void set_object_class(const String &p_class); String get_object_class() const; - void set_use_sub_inspector_bg(bool p_enable); + void set_sub_inspector(bool p_enable); EditorInspector(); }; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 719130621e..0ff0bca7ee 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1108,12 +1108,15 @@ void EditorNode::_save_scene(String p_file, int idx) { } } -void EditorNode::save_all_scenes_and_restart() { +void EditorNode::save_all_scenes() { _menu_option_confirm(RUN_STOP, true); - exiting = true; - _save_all_scenes(); +} + +void EditorNode::restart_editor() { + + exiting = true; String to_reopen; if (get_tree()->get_edited_scene_root()) { @@ -2305,7 +2308,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { ProjectSettings::get_singleton()->set("rendering/quality/driver/driver_name", video_driver_request); ProjectSettings::get_singleton()->save(); - save_all_scenes_and_restart(); + save_all_scenes(); + restart_editor(); } break; default: { if (p_option >= IMPORT_PLUGIN_BASE) { @@ -4760,6 +4764,8 @@ EditorNode::EditorNode() { ResourceLoader::clear_translation_remaps(); //no remaps using during editor ResourceLoader::clear_path_remaps(); + ImageTexture::set_keep_images_cached(true); + InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton()); if (id) { diff --git a/editor/editor_node.h b/editor/editor_node.h index 13bebea5f0..a45ea54186 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -782,7 +782,8 @@ public: void add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu); void remove_tool_menu_item(const String &p_name); - void save_all_scenes_and_restart(); + void save_all_scenes(); + void restart_editor(); void dim_editor(bool p_dimming); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c5d0f13c60..f19eac6878 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2448,7 +2448,7 @@ void EditorPropertyResource::update_property() { sub_inspector->set_enable_v_scroll(false); sub_inspector->set_use_doc_hints(true); - sub_inspector->set_use_sub_inspector_bg(true); + sub_inspector->set_sub_inspector(true); sub_inspector->set_enable_capitalize_paths(true); sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed"); diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index e59df7c932..40cf02ac9d 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -372,6 +372,63 @@ void ImportDock::clear() { preset->get_popup()->clear(); } +static bool _find_owners(EditorFileSystemDirectory *efsd, const String &p_path) { + + if (!efsd) + return false; + + for (int i = 0; i < efsd->get_subdir_count(); i++) { + + if (_find_owners(efsd->get_subdir(i), p_path)) { + return true; + } + } + + for (int i = 0; i < efsd->get_file_count(); i++) { + + Vector<String> deps = efsd->get_file_deps(i); + if (deps.find(p_path) != -1) + return true; + } + + return false; +} +void ImportDock::_reimport_attempt() { + + bool need_restart = false; + bool used_in_resources = false; + for (int i = 0; i < params->paths.size(); i++) { + Ref<ConfigFile> config; + config.instance(); + Error err = config->load(params->paths[i] + ".import"); + ERR_CONTINUE(err != OK); + + String imported_with = config->get_value("remap", "importer"); + if (imported_with != params->importer->get_importer_name()) { + need_restart = true; + if (_find_owners(EditorFileSystem::get_singleton()->get_filesystem(), params->paths[i])) { + used_in_resources = true; + } + } + } + + if (need_restart) { + label_warning->set_visible(used_in_resources); + reimport_confirm->popup_centered_minsize(); + return; + } + + _reimport(); +} + +void ImportDock::_reimport_and_restart() { + + EditorNode::get_singleton()->save_all_scenes(); + EditorResourcePreview::get_singleton()->stop(); //dont try to re-create previews after import + _reimport(); + EditorNode::get_singleton()->restart_editor(); +} + void ImportDock::_reimport() { for (int i = 0; i < params->paths.size(); i++) { @@ -416,6 +473,7 @@ void ImportDock::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { import_opts->edit(params); + label_warning->add_color_override("font_color", get_color("warning_color", "Editor")); } break; } } @@ -433,6 +491,8 @@ void ImportDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_preset_selected"), &ImportDock::_preset_selected); ClassDB::bind_method(D_METHOD("_importer_selected"), &ImportDock::_importer_selected); ClassDB::bind_method(D_METHOD("_property_toggled"), &ImportDock::_property_toggled); + ClassDB::bind_method(D_METHOD("_reimport_and_restart"), &ImportDock::_reimport_and_restart); + ClassDB::bind_method(D_METHOD("_reimport_attempt"), &ImportDock::_reimport_attempt); } void ImportDock::initialize_import_options() const { @@ -469,11 +529,22 @@ ImportDock::ImportDock() { add_child(hb); import = memnew(Button); import->set_text(TTR("Reimport")); - import->connect("pressed", this, "_reimport"); + import->connect("pressed", this, "_reimport_attempt"); hb->add_spacer(); hb->add_child(import); hb->add_spacer(); + reimport_confirm = memnew(ConfirmationDialog); + reimport_confirm->get_ok()->set_text(TTR("Save scenes, re-import and restart")); + add_child(reimport_confirm); + reimport_confirm->connect("confirmed", this, "_reimport_and_restart"); + + VBoxContainer *vbc_confirm = memnew(VBoxContainer()); + vbc_confirm->add_child(memnew(Label(TTR("Changing the type of an imported file requires editor restart.")))); + label_warning = memnew(Label(TTR("WARNING: Assets exist that use this resource, they may stop loading properly."))); + vbc_confirm->add_child(label_warning); + reimport_confirm->add_child(vbc_confirm); + params = memnew(ImportDockParameters); } diff --git a/editor/import_dock.h b/editor/import_dock.h index bc992b2f7e..1d43e00b63 100644 --- a/editor/import_dock.h +++ b/editor/import_dock.h @@ -36,6 +36,7 @@ #include "editor/editor_file_system.h" #include "editor/editor_inspector.h" #include "scene/gui/box_container.h" +#include "scene/gui/dialogs.h" #include "scene/gui/menu_button.h" #include "scene/gui/option_button.h" #include "scene/gui/popup_menu.h" @@ -52,6 +53,8 @@ class ImportDock : public VBoxContainer { List<PropertyInfo> properties; Map<StringName, Variant> property_values; + ConfirmationDialog *reimport_confirm; + Label *label_warning; Button *import; ImportDockParameters *params; @@ -61,6 +64,8 @@ class ImportDock : public VBoxContainer { void _update_options(const Ref<ConfigFile> &p_config = Ref<ConfigFile>()); void _property_toggled(const StringName &p_prop, bool p_checked); + void _reimport_attempt(); + void _reimport_and_restart(); void _reimport(); enum { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 02f6263887..2913c4ce56 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -474,7 +474,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no if (canvas_item && canvas_item->is_visible_in_tree()) { Transform2D xform = (p_parent_xform * p_canvas_xform * canvas_item->get_transform()).affine_inverse(); - const real_t local_grab_distance = xform.basis_xform(Vector2(grab_distance, 0)).length(); + const real_t local_grab_distance = xform.basis_xform(Vector2(grab_distance, 0)).length() / zoom; if (canvas_item->_edit_is_selected_on_click(xform.xform(p_pos), local_grab_distance)) { Node2D *node = Object::cast_to<Node2D>(canvas_item); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index b8fb9d4ab0..7ce4029476 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -83,6 +83,8 @@ private: Container *name_container; Container *path_container; Container *install_path_container; + Container *rasterizer_container; + Ref<ButtonGroup> rasterizer_button_group; Label *msg; LineEdit *project_path; LineEdit *project_name; @@ -471,6 +473,13 @@ private: if (mode == MODE_NEW) { ProjectSettings::CustomMap initial_settings; + if (rasterizer_button_group->get_pressed_button()->get_meta("driver_name") == "GLES3") { + initial_settings["rendering/quality/driver/driver_name"] = "GLES3"; + } else { + initial_settings["rendering/quality/driver/driver_name"] = "GLES2"; + initial_settings["rendering/vram_compression/import_etc2"] = false; + initial_settings["rendering/vram_compression/import_etc"] = true; + } initial_settings["application/config/name"] = project_name->get_text(); initial_settings["application/config/icon"] = "res://icon.png"; initial_settings["rendering/environment/default_environment"] = "res://default_env.tres"; @@ -687,6 +696,7 @@ public: msg->hide(); install_path_container->hide(); install_status_rect->hide(); + rasterizer_container->hide(); get_ok()->set_disabled(false); ProjectSettings *current = memnew(ProjectSettings); @@ -738,6 +748,7 @@ public: get_ok()->set_text(TTR("Import & Edit")); name_container->hide(); install_path_container->hide(); + rasterizer_container->hide(); project_path->grab_focus(); } else if (mode == MODE_NEW) { @@ -746,6 +757,7 @@ public: get_ok()->set_text(TTR("Create & Edit")); name_container->show(); install_path_container->hide(); + rasterizer_container->show(); project_name->call_deferred("grab_focus"); project_name->call_deferred("select_all"); @@ -755,13 +767,14 @@ public: get_ok()->set_text(TTR("Install & Edit")); name_container->hide(); install_path_container->hide(); + rasterizer_container->hide(); project_path->grab_focus(); } _test_path(); } - popup_centered(Size2(500, 0) * EDSCALE); + popup_centered_minsize(Size2(500, 0) * EDSCALE); } ProjectDialog() { @@ -840,6 +853,48 @@ public: msg->set_align(Label::ALIGN_CENTER); vb->add_child(msg); + // rasterizer selection + rasterizer_container = memnew(VBoxContainer); + vb->add_child(rasterizer_container); + l = memnew(Label); + l->set_text(TTR("Renderer:")); + rasterizer_container->add_child(l); + Container *rshb = memnew(HBoxContainer); + rasterizer_container->add_child(rshb); + rasterizer_button_group.instance(); + + Container *rvb = memnew(VBoxContainer); + rvb->set_h_size_flags(SIZE_EXPAND_FILL); + rshb->add_child(rvb); + Button *rs_button = memnew(CheckBox); + rs_button->set_button_group(rasterizer_button_group); + rs_button->set_text(TTR("OpenGL ES 3.0")); + rs_button->set_meta("driver_name", "GLES3"); + rs_button->set_pressed(true); + rvb->add_child(rs_button); + l = memnew(Label); + l->set_text(TTR("Higher visual quality\nAll features available\nIncompatible with older hardware\nNot recommended for web games")); + rvb->add_child(l); + + rshb->add_child(memnew(VSeparator)); + + rvb = memnew(VBoxContainer); + rvb->set_h_size_flags(SIZE_EXPAND_FILL); + rshb->add_child(rvb); + rs_button = memnew(CheckBox); + rs_button->set_button_group(rasterizer_button_group); + rs_button->set_text(TTR("OpenGL ES 2.0")); + rs_button->set_meta("driver_name", "GLES2"); + rvb->add_child(rs_button); + l = memnew(Label); + l->set_text(TTR("Lower visual quality\nSome features not available\nWorks on most hardware\nRecommended for web games")); + rvb->add_child(l); + + l = memnew(Label); + l->set_text(TTR("Renderer can be changed later, but scenes may need to be adjusted.")); + l->set_align(Label::ALIGN_CENTER); + rasterizer_container->add_child(l); + fdialog = memnew(FileDialog); fdialog->set_access(FileDialog::ACCESS_FILESYSTEM); fdialog_install = memnew(FileDialog); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index dd31853e73..cc33550ac9 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1606,7 +1606,8 @@ TabContainer *ProjectSettingsEditor::get_tabs() { } void ProjectSettingsEditor::_editor_restart() { - EditorNode::get_singleton()->save_all_scenes_and_restart(); + EditorNode::get_singleton()->save_all_scenes(); + EditorNode::get_singleton()->restart_editor(); } void ProjectSettingsEditor::_editor_restart_request() { diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index acc735d571..5f6459045a 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -898,6 +898,10 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da item.name = strings[2]; item.script = strings[0]; item.line = strings[1].to_int(); + } else if (strings.size() == 4) { //Built-in scripts have an :: in their name + item.name = strings[3]; + item.script = strings[0] + "::" + strings[1]; + item.line = strings[2].to_int(); } } else { diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index e4d5573a9a..ecd35cb930 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -375,7 +375,8 @@ void EditorSettingsDialog::_focus_current_search_box() { } void EditorSettingsDialog::_editor_restart() { - EditorNode::get_singleton()->save_all_scenes_and_restart(); + EditorNode::get_singleton()->save_all_scenes(); + EditorNode::get_singleton()->restart_editor(); } void EditorSettingsDialog::_editor_restart_request() { |