diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_file_system.cpp | 8 | ||||
-rw-r--r-- | editor/editor_node.cpp | 20 | ||||
-rw-r--r-- | editor/editor_node.h | 6 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 30 | ||||
-rw-r--r-- | editor/editor_plugin.h | 3 | ||||
-rw-r--r-- | editor/editor_plugin_settings.cpp | 2 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 3 | ||||
-rw-r--r-- | editor/editor_spin_slider.cpp | 4 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 16 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space_1d_editor.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space_2d_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 35 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/animation_tree_editor_plugin.cpp | 34 | ||||
-rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 15 | ||||
-rw-r--r-- | editor/project_manager.cpp | 22 | ||||
-rw-r--r-- | editor/project_manager.h | 1 | ||||
-rw-r--r-- | editor/scene_tree_editor.cpp | 2 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 2 |
21 files changed, 145 insertions, 77 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 94eb1a3399..37e2079b64 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1401,6 +1401,14 @@ void EditorFileSystem::update_script_classes() { ScriptServer::save_global_classes(); EditorNode::get_editor_data().script_class_save_icon_paths(); + + // Rescan custom loaders and savers. + // Doing the following here because the `filesystem_changed` signal fires multiple times and isn't always followed by script classes update. + // So I thought it's better to do this when script classes really get updated + ResourceLoader::remove_custom_loaders(); + ResourceLoader::add_custom_loaders(); + ResourceSaver::remove_custom_savers(); + ResourceSaver::add_custom_savers(); } void EditorFileSystem::_queue_update_script_classes() { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d100d7f618..3bd7678746 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2471,7 +2471,7 @@ void EditorNode::_editor_select(int p_which) { } } -void EditorNode::add_editor_plugin(EditorPlugin *p_editor) { +void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed) { if (p_editor->has_main_screen()) { @@ -2496,9 +2496,11 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor) { } singleton->editor_data.add_editor_plugin(p_editor); singleton->add_child(p_editor); + if (p_config_changed) + p_editor->enable_plugin(); } -void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { +void EditorNode::remove_editor_plugin(EditorPlugin *p_editor, bool p_config_changed) { if (p_editor->has_main_screen()) { @@ -2521,6 +2523,8 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { } p_editor->make_visible(false); p_editor->clear(); + if (p_config_changed) + p_editor->disable_plugin(); singleton->editor_plugins_over->get_plugins_list().erase(p_editor); singleton->remove_child(p_editor); singleton->editor_data.remove_editor_plugin(p_editor); @@ -2546,7 +2550,7 @@ void EditorNode::_update_addon_config() { project_settings->queue_save(); } -void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled) { +void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled, bool p_config_changed) { ERR_FAIL_COND(p_enabled && plugin_addons.has(p_addon)); ERR_FAIL_COND(!p_enabled && !plugin_addons.has(p_addon)); @@ -2554,7 +2558,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled) if (!p_enabled) { EditorPlugin *addon = plugin_addons[p_addon]; - remove_editor_plugin(addon); + remove_editor_plugin(addon, p_config_changed); memdelete(addon); //bye plugin_addons.erase(p_addon); _update_addon_config(); @@ -2606,7 +2610,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled) ep->set_script(script.get_ref_ptr()); ep->set_dir_cache(p_addon); plugin_addons[p_addon] = ep; - add_editor_plugin(ep); + add_editor_plugin(ep, p_config_changed); _update_addon_config(); } @@ -3131,6 +3135,9 @@ bool EditorNode::is_scene_in_use(const String &p_path) { void EditorNode::register_editor_types() { + ResourceLoader::set_timestamp_on_load(true); + ResourceSaver::set_timestamp_on_save(true); + ClassDB::register_class<EditorPlugin>(); ClassDB::register_class<EditorImportPlugin>(); ClassDB::register_class<EditorScript>(); @@ -4822,9 +4829,6 @@ EditorNode::EditorNode() { ResourceLoader::set_error_notify_func(this, _load_error_notify); ResourceLoader::set_dependency_error_notify_func(this, _dependency_error_report); - ResourceLoader::set_timestamp_on_load(true); - ResourceSaver::set_timestamp_on_save(true); - { //register importers at the beginning, so dialogs are created with the right extensions Ref<ResourceImporterTexture> import_texture; import_texture.instance(); diff --git a/editor/editor_node.h b/editor/editor_node.h index e5670e5e7c..f4c0375c2e 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -637,8 +637,8 @@ public: ProjectSettingsEditor *get_project_settings() { return project_settings; } - static void add_editor_plugin(EditorPlugin *p_editor); - static void remove_editor_plugin(EditorPlugin *p_editor); + static void add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed = false); + static void remove_editor_plugin(EditorPlugin *p_editor, bool p_config_changed = false); void new_inherited_scene() { _menu_option_confirm(FILE_NEW_INHERITED_SCENE, false); } @@ -651,7 +651,7 @@ public: void add_control_to_dock(DockSlot p_slot, Control *p_control); void remove_control_from_dock(Control *p_control); - void set_addon_plugin_enabled(const String &p_addon, bool p_enabled); + void set_addon_plugin_enabled(const String &p_addon, bool p_enabled, bool p_config_changed = false); bool is_addon_plugin_enabled(const String &p_addon) const; void edit_node(Node *p_node); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index cd024ff870..403db4b8ba 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -698,6 +698,34 @@ void EditorPlugin::remove_scene_import_plugin(const Ref<EditorSceneImporter> &p_ ResourceImporterScene::get_singleton()->remove_importer(p_importer); } +int find(const PoolStringArray &a, const String &v) { + PoolStringArray::Read r = a.read(); + for (int j = 0; j < a.size(); ++j) { + if (r[j] == v) { + return j; + } + } + return -1; +} + +void EditorPlugin::enable_plugin() { + // Called when the plugin gets enabled in project settings, after it's added to the tree. + // You can implement it to register autoloads. + + if (get_script_instance() && get_script_instance()->has_method("enable_plugin")) { + get_script_instance()->call("enable_plugin"); + } +} + +void EditorPlugin::disable_plugin() { + // Last function called when the plugin gets disabled in project settings. + // Implement it to cleanup things from the project, such as unregister autoloads. + + if (get_script_instance() && get_script_instance()->has_method("disable_plugin")) { + get_script_instance()->call("disable_plugin"); + } +} + void EditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) { if (get_script_instance() && get_script_instance()->has_method("set_window_layout")) { @@ -801,6 +829,8 @@ void EditorPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "build")); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("enable_plugin")); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("disable_plugin")); ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath"))); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index e03aeb5d30..5f060a4e96 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -232,6 +232,9 @@ public: String get_dir_cache() { return _dir_cache; } Ref<ConfigFile> get_config(); + void enable_plugin(); + void disable_plugin(); + EditorPlugin(); virtual ~EditorPlugin(); }; diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 30027c0c34..a4d543c567 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -152,7 +152,7 @@ void EditorPluginSettings::_plugin_activity_changed() { bool active = ti->get_range(3); String name = ti->get_metadata(0); - EditorNode::get_singleton()->set_addon_plugin_enabled(name, active); + EditorNode::get_singleton()->set_addon_plugin_enabled(name, active, true); bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(name); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 039ba22a77..fbcab3cbb6 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -581,6 +581,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { /* Extra config */ + _initial_set("project_manager/sorting_order", 0); + hints["project_manager/sorting_order"] = PropertyInfo(Variant::INT, "project_manager/sorting_order", PROPERTY_HINT_ENUM, "Name,Last Modified"); + if (p_extra_config.is_valid()) { if (p_extra_config->has_section("init_projects") && p_extra_config->has_section_key("init_projects", "list")) { diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 1b7322fd13..3d4cf41b80 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -155,7 +155,9 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) { void EditorSpinSlider::_notification(int p_what) { - if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT || p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) { + if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT || + p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN || + p_what == NOTIFICATION_EXIT_TREE) { if (grabbing_spinner) { Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); grabbing_spinner = false; diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 36053d7534..eacf2ee1b4 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -351,18 +351,18 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("mono_color", "Editor", mono_color); - Color success_color = accent_color.linear_interpolate(Color(0.2, 1, 0.2), 0.6) * 1.2; - Color warning_color = accent_color.linear_interpolate(Color(1, 1, 0), 0.7) * 1.0; - Color error_color = accent_color.linear_interpolate(Color(1, 0, 0), 0.8) * 1.7; + Color success_color = Color(0.45, 0.95, 0.5); + Color warning_color = Color(1, 0.87, 0.4); + Color error_color = Color(1, 0.47, 0.42); Color property_color = font_color.linear_interpolate(Color(0.5, 0.5, 0.5), 0.5); if (!dark_theme) { - // yellow on white themes is a P.I.T.A. - warning_color = accent_color.linear_interpolate(Color(0.9, 0.7, 0), 0.9); - warning_color = warning_color.linear_interpolate(mono_color, 0.2); - success_color = success_color.linear_interpolate(mono_color, 0.2); - error_color = error_color.linear_interpolate(mono_color, 0.2); + // Darken some colors to be readable on a light background + success_color = success_color.linear_interpolate(mono_color, 0.35); + warning_color = warning_color.linear_interpolate(mono_color, 0.35); + error_color = error_color.linear_interpolate(mono_color, 0.25); } + theme->set_color("success_color", "Editor", success_color); theme->set_color("warning_color", "Editor", warning_color); theme->set_color("error_color", "Editor", error_color); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index b2368fff6b..4cc0b67b8d 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1180,7 +1180,7 @@ void FileSystemDock::_make_dir_confirm() { String dir_name = make_dir_dialog_text->get_text().strip_edges(); if (dir_name.length() == 0) { - EditorNode::get_singleton()->show_warning(TTR("No name provided")); + EditorNode::get_singleton()->show_warning(TTR("No name provided.")); return; } else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.find("*") != -1 || dir_name.find("|") != -1 || dir_name.find(">") != -1 || dir_name.ends_with(".") || dir_name.ends_with(" ")) { diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 4b1e710705..cb18832641 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -72,7 +72,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven ap->get_animation_list(&names); for (List<StringName>::Element *E = names.front(); E; E = E->next()) { - animations_menu->add_icon_item(get_icon("Animation", "Editoricons"), E->get()); + animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get()); animations_to_add.push_back(E->get()); } } @@ -650,6 +650,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { snap->set_toggle_mode(true); top_hb->add_child(snap); snap->set_pressed(true); + snap->set_tooltip(TTR("Enable snap and show grid.")); snap->connect("pressed", this, "_snap_toggled"); snap_value = memnew(SpinBox); diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index e2fe9a91d8..0b7b4910da 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -904,8 +904,8 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { snap = memnew(ToolButton); snap->set_toggle_mode(true); top_hb->add_child(snap); - //snap->set_text(TTR("Snap")); snap->set_pressed(true); + snap->set_tooltip(TTR("Enable snap and show grid.")); snap->connect("pressed", this, "_snap_toggled"); snap_x = memnew(SpinBox); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index eb3c432ee7..06c2db74af 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -237,23 +237,17 @@ void AnimationNodeBlendTreeEditor::_update_graph() { mb->get_popup()->connect("index_pressed", this, "_anim_selected", varray(options, E->get()), CONNECT_DEFERRED); } - /* should be no longer necessary, as the boolean works - Ref<AnimationNodeOneShot> oneshot = agnode; - if (oneshot.is_valid()) { - - HBoxContainer *play_stop = memnew(HBoxContainer); - play_stop->add_spacer(); - Button *play = memnew(Button); - play->set_icon(get_icon("Play", "EditorIcons")); - play->connect("pressed", this, "_oneshot_start", varray(E->get()), CONNECT_DEFERRED); - play_stop->add_child(play); - Button *stop = memnew(Button); - stop->set_icon(get_icon("Stop", "EditorIcons")); - stop->connect("pressed", this, "_oneshot_stop", varray(E->get()), CONNECT_DEFERRED); - play_stop->add_child(stop); - play_stop->add_spacer(); - node->add_child(play_stop); - } */ + if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { + Ref<StyleBoxFlat> sb = node->get_stylebox("frame", "GraphNode"); + Color c = sb->get_border_color(MARGIN_TOP); + Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0); + mono_color.a = 0.85; + c = mono_color; + + node->add_color_override("title_color", c); + c.a = 0.7; + node->add_color_override("close_color", c); + } } List<AnimationNodeBlendTree::NodeConnection> connections; @@ -401,7 +395,7 @@ void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) { undo_redo->create_action("Delete Node"); undo_redo->add_do_method(blend_tree.ptr(), "remove_node", p_which); - undo_redo->add_undo_method(blend_tree.ptr(), "add_node", p_which, blend_tree->get_node(p_which)); + undo_redo->add_undo_method(blend_tree.ptr(), "add_node", p_which, blend_tree->get_node(p_which), blend_tree.ptr()->get_node_position(p_which)); List<AnimationNodeBlendTree::NodeConnection> conns; blend_tree->get_node_connections(&conns); @@ -646,6 +640,9 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); error_label->add_color_override("font_color", get_color("error_color", "Editor")); + + if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree()) + _update_graph(); } if (p_what == NOTIFICATION_PROCESS) { @@ -816,6 +813,8 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima break; } } + + _update_graph(); // Needed to update the signal connections with the new name. } void AnimationNodeBlendTreeEditor::_node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node) { diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 990c77430f..8efd12ecf9 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -118,7 +118,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv menu->add_item(TTR("Paste"), MENU_PASTE); } menu->add_separator(); - menu->add_item(TTR("Load.."), MENU_LOAD_FILE); + menu->add_item(TTR("Load..."), MENU_LOAD_FILE); menu->set_global_position(state_machine_draw->get_global_transform().xform(mb->get_position())); menu->popup(); @@ -1073,7 +1073,9 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) { ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1) - ERR_FAIL_COND(new_name == prev_name); + if (new_name == prev_name) { + return; // Nothing to do. + } String base_name = new_name; int base = 1; @@ -1111,7 +1113,7 @@ void AnimationNodeStateMachineEditor::_erase_selected() { updating = true; undo_redo->create_action("Node Removed"); undo_redo->add_do_method(state_machine.ptr(), "remove_node", selected_node); - undo_redo->add_undo_method(state_machine.ptr(), "add_node", selected_node, state_machine->get_node(selected_node)); + undo_redo->add_undo_method(state_machine.ptr(), "add_node", selected_node, state_machine->get_node(selected_node), state_machine->get_node_position(selected_node)); for (int i = 0; i < state_machine->get_transition_count(); i++) { String from = state_machine->get_transition_from(i); String to = state_machine->get_transition_to(i); @@ -1267,7 +1269,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { top_hb->add_child(tool_erase_hb); tool_erase_hb->add_child(memnew(VSeparator)); tool_erase = memnew(ToolButton); - tool_erase->set_tooltip(TTR("Remove selected node or transition")); + tool_erase->set_tooltip(TTR("Remove selected node or transition.")); tool_erase_hb->add_child(tool_erase); tool_erase->connect("pressed", this, "_erase_selected"); tool_erase->set_disabled(true); diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 24787a78e9..387a254c4f 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -64,34 +64,15 @@ void AnimationTreeEditor::edit(AnimationTree *p_tree) { void AnimationTreeEditor::_path_button_pressed(int p_path) { - Ref<AnimationNode> node = tree->get_tree_root(); - if (node.is_null()) - return; - edited_path.clear(); - if (p_path >= 0) { - for (int i = 0; i <= p_path; i++) { - Ref<AnimationNode> child = node->get_child_by_name(button_path[i]); - ERR_BREAK(child.is_null()); - node = child; - edited_path.push_back(button_path[i]); - } - } - - for (int i = 0; i < editors.size(); i++) { - if (editors[i]->can_edit(node)) { - editors[i]->edit(node); - editors[i]->show(); - } else { - editors[i]->edit(Ref<AnimationNode>()); - editors[i]->hide(); - } + for (int i = 0; i <= p_path; i++) { + edited_path.push_back(button_path[i]); } } void AnimationTreeEditor::_update_path() { - while (path_hb->get_child_count()) { - memdelete(path_hb->get_child(0)); + while (path_hb->get_child_count() > 1) { + memdelete(path_hb->get_child(1)); } Ref<ButtonGroup> group; @@ -176,6 +157,10 @@ void AnimationTreeEditor::_notification(int p_what) { if (root != current_root) { edit_path(Vector<String>()); } + + if (button_path.size() != edited_path.size()) { + edit_path(edited_path); + } } } @@ -251,6 +236,9 @@ AnimationTreeEditor::AnimationTreeEditor() { path_edit->set_enable_v_scroll(false); path_hb = memnew(HBoxContainer); path_edit->add_child(path_hb); + path_hb->add_child(memnew(Label(TTR("Path:")))); + + add_child(memnew(HSeparator)); current_root = 0; singleton = this; diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 97448f3f88..91639a40f9 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -91,7 +91,7 @@ void Polygon2DEditor::_notification(int p_what) { void Polygon2DEditor::_sync_bones() { - Skeleton2D *skeleton; + Skeleton2D *skeleton = NULL; if (!node->has_node(node->get_skeleton())) { error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node")); error->popup_centered_minsize(); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index d3295c0f51..aff465728b 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -341,6 +341,18 @@ void VisualShaderEditor::_update_graph() { node->add_child(hb); node->set_slot(i + port_offset, valid_left, port_left, type_color[port_left], valid_right, port_right, type_color[port_right]); + + if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { + Ref<StyleBoxFlat> sb = node->get_stylebox("frame", "GraphNode"); + Color c = sb->get_border_color(MARGIN_TOP); + Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0); + mono_color.a = 0.85; + c = mono_color; + + node->add_color_override("title_color", c); + c.a = 0.7; + node->add_color_override("close_color", c); + } } if (vsnode->get_output_port_for_preview() >= 0) { @@ -605,6 +617,9 @@ void VisualShaderEditor::_notification(int p_what) { error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); error_label->add_color_override("font_color", get_color("error_color", "Editor")); + + if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree()) + _update_graph(); } if (p_what == NOTIFICATION_PROCESS) { diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 0e2e957333..ac728e8d7c 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1165,10 +1165,12 @@ void ProjectManager::_load_recent_projects() { bool set_ordered_latest_modification; ProjectListFilter::FilterOption filter_order_option = project_order_filter->get_filter_option(); - if (filter_order_option == ProjectListFilter::FILTER_NAME) + if (filter_order_option == ProjectListFilter::FILTER_NAME) { set_ordered_latest_modification = false; - else + } else { set_ordered_latest_modification = true; + } + EditorSettings::get_singleton()->set("project_manager/sorting_order", (int)filter_order_option); List<ProjectItem> projects; List<ProjectItem> favorite_projects; @@ -1838,16 +1840,19 @@ ProjectManager::ProjectManager() { Label *sort_label = memnew(Label); sort_label->set_text(TTR("Sort:")); sort_filters->add_child(sort_label); - Vector<String> vec1; - vec1.push_back("Name"); - vec1.push_back("Last Modified"); + Vector<String> sort_filter_titles; + sort_filter_titles.push_back("Name"); + sort_filter_titles.push_back("Last Modified"); project_order_filter = memnew(ProjectListFilter); - project_order_filter->_setup_filters(vec1); + project_order_filter->_setup_filters(sort_filter_titles); project_order_filter->set_filter_size(150); sort_filters->add_child(project_order_filter); project_order_filter->connect("filter_changed", this, "_load_recent_projects"); project_order_filter->set_custom_minimum_size(Size2(180, 10) * EDSCALE); + int projects_sorting_order = (int)EditorSettings::get_singleton()->get("project_manager/sorting_order"); + project_order_filter->set_filter_option((ProjectListFilter::FilterOption)projects_sorting_order); + sort_filters->add_spacer(true); Label *search_label = memnew(Label); search_label->set_text(TTR("Search:")); @@ -2074,6 +2079,11 @@ ProjectListFilter::FilterOption ProjectListFilter::get_filter_option() { return _current_filter; } +void ProjectListFilter::set_filter_option(FilterOption option) { + filter_option->select((int)option); + _filter_option_selected(0); +} + void ProjectListFilter::_filter_option_selected(int p_idx) { FilterOption selected = (FilterOption)(filter_option->get_selected()); if (_current_filter != selected) { diff --git a/editor/project_manager.h b/editor/project_manager.h index 88fc081272..e0a0932cf8 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -152,6 +152,7 @@ public: void set_filter_size(int h_size); String get_search_term(); FilterOption get_filter_option(); + void set_filter_option(FilterOption); ProjectListFilter(); }; diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 7205f34343..657293ea7f 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -668,7 +668,7 @@ void SceneTreeEditor::_renamed() { // Empty node names are not allowed, so resets it to previous text and show warning if (which->get_text(0).strip_edges().empty()) { which->set_text(0, n->get_name()); - EditorNode::get_singleton()->show_warning(TTR("No name provided")); + EditorNode::get_singleton()->show_warning(TTR("No name provided.")); return; } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index df704706af..e0c95e3bbc 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -308,8 +308,10 @@ void ScriptCreateDialog::_built_in_pressed() { if (internal->is_pressed()) { is_built_in = true; + is_new_script_created = true; } else { is_built_in = false; + _path_changed(file_path->get_text()); } _update_dialog(); } |