diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_export.cpp | 7 | ||||
-rw-r--r-- | editor/editor_export.h | 1 | ||||
-rw-r--r-- | editor/editor_help.cpp | 11 | ||||
-rw-r--r-- | editor/editor_help.h | 4 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 4 | ||||
-rw-r--r-- | editor/editor_sub_scene.cpp | 15 | ||||
-rw-r--r-- | editor/import/resource_importer_obj.h | 2 | ||||
-rw-r--r-- | editor/output_strings.cpp | 208 | ||||
-rw-r--r-- | editor/output_strings.h | 87 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.h | 14 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 96 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 11 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 41 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/sprite_editor_plugin.cpp | 77 | ||||
-rw-r--r-- | editor/plugins/sprite_editor_plugin.h | 3 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/project_manager.cpp | 6 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 19 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 1 |
22 files changed, 198 insertions, 420 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 90f54df485..9510092a86 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1606,6 +1606,9 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); for (int i = 0; i < so_files.size() && err == OK; i++) { err = da->copy(so_files[i].path, p_path.get_base_dir().plus_file(so_files[i].path.get_file())); + if (err == OK) { + err = sign_shared_object(p_preset, p_debug, p_path.get_base_dir().plus_file(so_files[i].path.get_file())); + } } memdelete(da); } @@ -1614,6 +1617,10 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr return err; } +Error EditorExportPlatformPC::sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path) { + return OK; +} + void EditorExportPlatformPC::set_extension(const String &p_extension, const String &p_feature_key) { extensions[p_feature_key] = p_extension; } diff --git a/editor/editor_export.h b/editor/editor_export.h index 3152e249bd..11dc464b5a 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -423,6 +423,7 @@ public: virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const; virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0); + virtual Error sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path); void set_extension(const String &p_extension, const String &p_feature_key = "default"); void set_name(const String &p_name); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 83434a6d9f..4a1e93eaad 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -72,9 +72,12 @@ void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) { } } -void EditorHelp::_search(const String &) { +void EditorHelp::_search(bool p_search_previous) { - find_bar->search_next(); + if (p_search_previous) + find_bar->search_prev(); + else + find_bar->search_next(); } void EditorHelp::_class_list_select(const String &p_select) { @@ -1502,8 +1505,8 @@ String EditorHelp::get_class() { return edited_class; } -void EditorHelp::search_again() { - _search(prev_search); +void EditorHelp::search_again(bool p_search_previous) { + _search(p_search_previous); } int EditorHelp::get_scroll() const { diff --git a/editor/editor_help.h b/editor/editor_help.h index 1019cafffc..23a6e005a0 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -158,7 +158,7 @@ class EditorHelp : public VBoxContainer { void _update_doc(); void _request_help(const String &p_string); - void _search(const String &p_str); + void _search(bool p_search_previous = false); void _unhandled_key_input(const Ref<InputEvent> &p_ev); @@ -179,7 +179,7 @@ public: void scroll_to_section(int p_section_index); void popup_search(); - void search_again(); + void search_again(bool p_search_previous = false); String get_class(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index b29417b4c3..78e058eeaa 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1566,11 +1566,11 @@ void EditorInspector::update_tree() { if (dot != -1) { String ov = name.right(dot); name = name.substr(0, dot); - name = name.camelcase_to_underscore().capitalize(); + name = name.capitalize(); name += ov; } else { - name = name.camelcase_to_underscore().capitalize(); + name = name.capitalize(); } } diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp index 987033b123..a77051c80b 100644 --- a/editor/editor_sub_scene.cpp +++ b/editor/editor_sub_scene.cpp @@ -97,8 +97,14 @@ void EditorSubScene::_fill_tree(Node *p_node, TreeItem *p_parent) { } void EditorSubScene::_selected_changed() { - selection.clear(); - is_root = false; + TreeItem *item = tree->get_selected(); + ERR_FAIL_COND(!item); + Node *n = item->get_metadata(0); + + if (!n || !selection.find(n)) { + selection.clear(); + is_root = false; + } } void EditorSubScene::_item_multi_selected(Object *p_object, int p_cell, bool p_selected) { @@ -116,6 +122,11 @@ void EditorSubScene::_item_multi_selected(Object *p_object, int p_cell, bool p_s selection.clear(); } selection.push_back(n); + } else { + List<Node *>::Element *E = selection.find(n); + + if (E) + selection.erase(E); } } } diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index b96bc1b656..adad21da61 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -31,7 +31,7 @@ #ifndef RESOURCEIMPORTEROBJ_H #define RESOURCEIMPORTEROBJ_H -#include "import/resource_importer_scene.h" +#include "resource_importer_scene.h" class EditorOBJImporter : public EditorSceneImporter { diff --git a/editor/output_strings.cpp b/editor/output_strings.cpp deleted file mode 100644 index baabaff9a8..0000000000 --- a/editor/output_strings.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/*************************************************************************/ -/* output_strings.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "output_strings.h" - -void OutputStrings::update_scrollbars() { - - Size2 hmin = h_scroll->get_combined_minimum_size(); - Size2 vmin = v_scroll->get_combined_minimum_size(); - - v_scroll->set_anchor(MARGIN_LEFT, ANCHOR_END); - v_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END); - v_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END); - - v_scroll->set_begin(Point2(-vmin.width, 0)); - v_scroll->set_end(Point2(0, 0)); - - h_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END); - h_scroll->set_anchor(MARGIN_TOP, ANCHOR_END); - h_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END); - - h_scroll->set_begin(Point2(0, -hmin.y)); - h_scroll->set_end(Point2(-vmin.x, 0)); - - margin.y = hmin.y; - margin.x = vmin.x; - - Ref<StyleBox> tree_st = get_stylebox("bg", "Tree"); - int page = ((size_height - (int)margin.y - tree_st->get_margin(MARGIN_TOP)) / font_height); - v_scroll->set_page(page); -} - -void OutputStrings::_notification(int p_what) { - - switch (p_what) { - - case NOTIFICATION_DRAW: { - - if (following) { - - updating = true; - v_scroll->set_value(v_scroll->get_max() - v_scroll->get_page()); - updating = false; - } - - RID ci = get_canvas_item(); - Size2 size = get_size(); - - Ref<Font> font = get_font("font", "Tree"); - Ref<StyleBox> tree_st = get_stylebox("bg", "Tree"); - tree_st->draw(ci, Rect2(Point2(), size)); - Color color = get_color("font_color", "Tree"); - Ref<Texture> icon_error = get_icon("Error", "EditorIcons"); - Ref<Texture> icon_warning = get_icon("Warning", "EditorIcons"); - - //int lines = (size_height-(int)margin.y) / font_height; - Point2 ofs = tree_st->get_offset(); - - LineMap::Element *E = line_map.find(v_scroll->get_value()); - float h_ofs = (int)h_scroll->get_value(); - Point2 icon_ofs = Point2(0, (font_height - (int)icon_error->get_height()) / 2); - - FontDrawer drawer(font, Color(1, 1, 1)); - while (E && ofs.y < (size_height - (int)margin.y)) { - - String str = E->get().text; - Point2 line_ofs = ofs; - - switch (E->get().type) { - - case LINE_WARNING: { - icon_warning->draw(ci, line_ofs + icon_ofs); - - } break; - case LINE_ERROR: { - icon_error->draw(ci, line_ofs + icon_ofs); - } break; - case LINE_LINK: { - - } break; - default: { - } - } - - line_ofs.y += font->get_ascent(); - line_ofs.x += icon_error->get_width() + 4; - - for (int i = 0; i < str.length(); i++) { - if (line_ofs.x - h_ofs < 0) { - line_ofs.x += font->get_char_size(str[i], str[i + 1]).width; - } else if (line_ofs.x - h_ofs > size.width - margin.width) { - break; - } else { - line_ofs.x += font->draw_char(ci, Point2(line_ofs.x - h_ofs, line_ofs.y), str[i], str[i + 1], color); - } - } - - ofs.y += font_height; - E = E->next(); - } - - } break; - - case NOTIFICATION_ENTER_TREE: - case NOTIFICATION_RESIZED: { - - font_height = get_font("font", "Tree")->get_height(); - size_height = get_size().height; - update_scrollbars(); - } break; - } -} - -void OutputStrings::_hscroll_changed(float p_value) { - - if (updating) - return; - - update(); -} -void OutputStrings::_vscroll_changed(float p_value) { - - if (updating) - return; - //user changed scroll - following = (p_value + v_scroll->get_page()) >= v_scroll->get_max(); - update(); -} - -void OutputStrings::add_line(const String &p_text, const Variant &p_meta, const LineType p_type) { - - Vector<String> strings = p_text.split("\n"); - - for (int i = 0; i < strings.size(); i++) { - - if (strings[i].length() == 0) - continue; - - int last = line_map.empty() ? 0 : (line_map.back()->key() + 1); - - Line l; - l.text = strings[i]; - l.meta = p_meta; - l.type = p_type; - line_map.insert(last, l); - - updating = true; - v_scroll->set_max(last + 1); - v_scroll->set_min(line_map.front()->key()); - updating = false; - } - - while (line_map.size() > line_max_count) { - - line_map.erase(line_map.front()); - } - - update(); -} - -void OutputStrings::_bind_methods() { - - ClassDB::bind_method("_vscroll_changed", &OutputStrings::_vscroll_changed); - ClassDB::bind_method("_hscroll_changed", &OutputStrings::_hscroll_changed); -} - -OutputStrings::OutputStrings() { - - following = true; - updating = false; - line_max_count = 4096; - h_scroll = memnew(HScrollBar); - v_scroll = memnew(VScrollBar); - add_child(h_scroll); - add_child(v_scroll); - size_height = 1; - font_height = 1; - update_scrollbars(); - h_scroll->connect("value_changed", this, "_hscroll_changed"); - v_scroll->connect("value_changed", this, "_vscroll_changed"); -} diff --git a/editor/output_strings.h b/editor/output_strings.h deleted file mode 100644 index 4fd3f7d836..0000000000 --- a/editor/output_strings.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************/ -/* output_strings.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef OUTPUT_STRINGS_H -#define OUTPUT_STRINGS_H - -#include "core/map.h" -#include "scene/gui/control.h" -#include "scene/gui/scroll_bar.h" - -class OutputStrings : public Control { - - GDCLASS(OutputStrings, Control); - -public: - enum LineType { - - LINE_NORMAL, - LINE_WARNING, - LINE_ERROR, - LINE_LINK - }; - -private: - struct Line { - - LineType type; - Variant meta; - String text; - }; - - int font_height; - int size_height; - - Size2 margin; - typedef Map<int, Line> LineMap; - Map<int, Line> line_map; - - VScrollBar *v_scroll; - HScrollBar *h_scroll; - - bool following; - int line_max_count; - bool updating; - - void _vscroll_changed(float p_value); - void _hscroll_changed(float p_value); - void update_scrollbars(); - -protected: - static void _bind_methods(); - void _notification(int p_what); - -public: - void add_line(const String &p_text, const Variant &p_meta = Variant(), const LineType p_type = LINE_NORMAL); - - OutputStrings(); -}; - -#endif // OUTPUT_STRINGS_H diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 3d161dc5b9..d5b1f46333 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -32,8 +32,8 @@ #include "core/io/json.h" #include "core/version.h" -#include "editor_node.h" -#include "editor_settings.h" +#include "editor/editor_node.h" +#include "editor/editor_settings.h" void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost) { diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index 7e934ac6cb..94289f3b49 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -31,24 +31,22 @@ #ifndef ASSET_LIBRARY_EDITOR_PLUGIN_H #define ASSET_LIBRARY_EDITOR_PLUGIN_H -#include "editor_plugin.h" +#include "editor/editor_asset_installer.h" +#include "editor/editor_plugin.h" +#include "editor/editor_plugin_settings.h" #include "scene/gui/box_container.h" #include "scene/gui/check_box.h" +#include "scene/gui/grid_container.h" #include "scene/gui/line_edit.h" #include "scene/gui/link_button.h" #include "scene/gui/option_button.h" #include "scene/gui/panel_container.h" #include "scene/gui/progress_bar.h" -#include "scene/gui/separator.h" -#include "scene/gui/tab_container.h" - -#include "editor_plugin_settings.h" -#include "scene/gui/grid_container.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/scroll_container.h" +#include "scene/gui/separator.h" +#include "scene/gui/tab_container.h" #include "scene/gui/texture_button.h" - -#include "editor_asset_installer.h" #include "scene/main/http_request.h" class EditorAssetLibraryItem : public PanelContainer { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 7055abd643..117b88bc7e 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -72,7 +72,7 @@ class SnapDialog : public ConfirmationDialog { public: SnapDialog() { - const int SPIN_BOX_GRID_RANGE = 256; + const int SPIN_BOX_GRID_RANGE = 16384; const int SPIN_BOX_ROTATION_RANGE = 360; Label *label; VBoxContainer *container; @@ -96,6 +96,8 @@ public: grid_offset_x = memnew(SpinBox); grid_offset_x->set_min(-SPIN_BOX_GRID_RANGE); grid_offset_x->set_max(SPIN_BOX_GRID_RANGE); + grid_offset_x->set_allow_lesser(true); + grid_offset_x->set_allow_greater(true); grid_offset_x->set_suffix("px"); grid_offset_x->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(grid_offset_x); @@ -103,6 +105,8 @@ public: grid_offset_y = memnew(SpinBox); grid_offset_y->set_min(-SPIN_BOX_GRID_RANGE); grid_offset_y->set_max(SPIN_BOX_GRID_RANGE); + grid_offset_y->set_allow_lesser(true); + grid_offset_y->set_allow_greater(true); grid_offset_y->set_suffix("px"); grid_offset_y->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(grid_offset_y); @@ -115,6 +119,7 @@ public: grid_step_x = memnew(SpinBox); grid_step_x->set_min(0.01); grid_step_x->set_max(SPIN_BOX_GRID_RANGE); + grid_step_x->set_allow_greater(true); grid_step_x->set_suffix("px"); grid_step_x->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(grid_step_x); @@ -122,6 +127,7 @@ public: grid_step_y = memnew(SpinBox); grid_step_y->set_min(0.01); grid_step_y->set_max(SPIN_BOX_GRID_RANGE); + grid_step_y->set_allow_greater(true); grid_step_y->set_suffix("px"); grid_step_y->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(grid_step_y); @@ -278,7 +284,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig snap_target[0] = SNAP_TARGET_NONE; snap_target[1] = SNAP_TARGET_NONE; - bool is_snap_active = snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); + bool is_snap_active = smart_snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); // Smart snap using the canvas position Vector2 output = p_target; @@ -378,7 +384,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig } } - if (((is_snap_active && snap_grid && (p_modes & SNAP_GRID)) || (p_forced_modes & SNAP_GRID)) && fmod(rotation, (real_t)360.0) == 0.0) { + if (((grid_snap_active && (p_modes & SNAP_GRID)) || (p_forced_modes & SNAP_GRID)) && fmod(rotation, (real_t)360.0) == 0.0) { // Grid Point2 offset = grid_offset; if (snap_relative) { @@ -406,7 +412,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig } float CanvasItemEditor::snap_angle(float p_target, float p_start) const { - return (((snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) && snap_rotation_step != 0) ? Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset : p_target; + return (((smart_snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) && snap_rotation_step != 0) ? Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset : p_target; } void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { @@ -421,11 +427,11 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { } if (k->is_pressed() && !k->get_control() && !k->is_echo()) { - if ((snap_grid || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) { + if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) { // Multiply the grid size grid_step_multiplier = MIN(grid_step_multiplier + 1, 12); viewport->update(); - } else if ((snap_grid || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) { + } else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) { // Divide the grid size Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1); if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) @@ -2281,7 +2287,7 @@ bool CanvasItemEditor::_gui_input_ruler_tool(const Ref<InputEvent> &p_event) { return true; } - bool is_snap_active = snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); + bool is_snap_active = smart_snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); if (m.is_valid() && (ruler_tool_active || (is_snap_active && previous_origin != ruler_tool_origin))) { @@ -2552,11 +2558,10 @@ void CanvasItemEditor::_draw_rulers() { Color font_color = get_color("font_color", "Editor"); font_color.a = 0.8; Ref<Font> font = get_font("rulers", "EditorFonts"); - bool is_snap_active = snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); // The rule transform Transform2D ruler_transform = Transform2D(); - if (show_grid || (is_snap_active && snap_grid)) { + if (show_grid || grid_snap_active) { List<CanvasItem *> selection = _get_edited_canvas_items(); if (snap_relative && selection.size() > 0) { ruler_transform.translate(_get_encompassing_rect_from_list(selection).position); @@ -2636,7 +2641,7 @@ void CanvasItemEditor::_draw_rulers() { } void CanvasItemEditor::_draw_grid() { - if (show_grid) { + if (show_grid || grid_snap_active) { //Draw the grid Size2 s = viewport->get_size(); int last_cell = 0; @@ -2682,7 +2687,7 @@ void CanvasItemEditor::_draw_ruler_tool() { if (tool != TOOL_RULER) return; - bool is_snap_active = snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); + bool is_snap_active = smart_snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); if (ruler_tool_active) { Color ruler_primary_color = get_color("accent_color", "Editor"); @@ -3691,7 +3696,8 @@ void CanvasItemEditor::_notification(int p_what) { move_button->set_icon(get_icon("ToolMove", "EditorIcons")); scale_button->set_icon(get_icon("ToolScale", "EditorIcons")); rotate_button->set_icon(get_icon("ToolRotate", "EditorIcons")); - snap_button->set_icon(get_icon("Snap", "EditorIcons")); + smart_snap_button->set_icon(get_icon("Snap", "EditorIcons")); + grid_snap_button->set_icon(get_icon("SnapGrid", "EditorIcons")); snap_config_menu->set_icon(get_icon("GuiTabMenu", "EditorIcons")); skeleton_menu->set_icon(get_icon("Bone", "EditorIcons")); pan_button->set_icon(get_icon("ToolPan", "EditorIcons")); @@ -4095,8 +4101,13 @@ void CanvasItemEditor::_button_zoom_plus() { _zoom_on_position(zoom * Math_SQRT2, viewport_scrollable->get_size() / 2.0); } -void CanvasItemEditor::_button_toggle_snap(bool p_status) { - snap_active = p_status; +void CanvasItemEditor::_button_toggle_smart_snap(bool p_status) { + smart_snap_active = p_status; + viewport->update(); +} + +void CanvasItemEditor::_button_toggle_grid_snap(bool p_status) { + grid_snap_active = p_status; viewport->update(); } @@ -4255,11 +4266,6 @@ void CanvasItemEditor::_popup_callback(int p_op) { int idx = smartsnap_config_popup->get_item_index(SNAP_USE_GUIDES); smartsnap_config_popup->set_item_checked(idx, snap_guides); } break; - case SNAP_USE_GRID: { - snap_grid = !snap_grid; - int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_GRID); - snap_config_menu->get_popup()->set_item_checked(idx, snap_grid); - } break; case SNAP_USE_ROTATION: { snap_rotation = !snap_rotation; int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_ROTATION); @@ -4791,7 +4797,8 @@ void CanvasItemEditor::_bind_methods() { ClassDB::bind_method("_button_zoom_minus", &CanvasItemEditor::_button_zoom_minus); ClassDB::bind_method("_button_zoom_reset", &CanvasItemEditor::_button_zoom_reset); ClassDB::bind_method("_button_zoom_plus", &CanvasItemEditor::_button_zoom_plus); - ClassDB::bind_method("_button_toggle_snap", &CanvasItemEditor::_button_toggle_snap); + ClassDB::bind_method("_button_toggle_smart_snap", &CanvasItemEditor::_button_toggle_smart_snap); + ClassDB::bind_method("_button_toggle_grid_snap", &CanvasItemEditor::_button_toggle_grid_snap); ClassDB::bind_method("_button_toggle_anchor_mode", &CanvasItemEditor::_button_toggle_anchor_mode); ClassDB::bind_method("_update_scroll", &CanvasItemEditor::_update_scroll); ClassDB::bind_method("_update_scrollbars", &CanvasItemEditor::_update_scrollbars); @@ -4826,13 +4833,13 @@ Dictionary CanvasItemEditor::get_state() const { state["grid_step"] = grid_step; state["snap_rotation_offset"] = snap_rotation_offset; state["snap_rotation_step"] = snap_rotation_step; - state["snap_active"] = snap_active; + state["smart_snap_active"] = smart_snap_active; + state["grid_snap_active"] = grid_snap_active; state["snap_node_parent"] = snap_node_parent; state["snap_node_anchors"] = snap_node_anchors; state["snap_node_sides"] = snap_node_sides; state["snap_node_center"] = snap_node_center; state["snap_other_nodes"] = snap_other_nodes; - state["snap_grid"] = snap_grid; state["snap_guides"] = snap_guides; state["show_grid"] = show_grid; state["show_origin"] = show_origin; @@ -4880,9 +4887,14 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) { snap_rotation_offset = state["snap_rotation_offset"]; } - if (state.has("snap_active")) { - snap_active = state["snap_active"]; - snap_button->set_pressed(snap_active); + if (state.has("smart_snap_active")) { + smart_snap_active = state["smart_snap_active"]; + smart_snap_button->set_pressed(smart_snap_active); + } + + if (state.has("grid_snap_active")) { + grid_snap_active = state["grid_snap_active"]; + grid_snap_button->set_pressed(smart_snap_active); } if (state.has("snap_node_parent")) { @@ -4921,12 +4933,6 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) { smartsnap_config_popup->set_item_checked(idx, snap_guides); } - if (state.has("snap_grid")) { - snap_grid = state["snap_grid"]; - int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_GRID); - snap_config_menu->get_popup()->set_item_checked(idx, snap_grid); - } - if (state.has("show_grid")) { show_grid = state["show_grid"]; int idx = view_menu->get_popup()->get_item_index(SHOW_GRID); @@ -5065,13 +5071,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { grid_step_multiplier = 0; snap_rotation_offset = 0; snap_rotation_step = 15 / (180 / Math_PI); - snap_active = false; + smart_snap_active = false; + grid_snap_active = false; snap_node_parent = true; snap_node_anchors = true; snap_node_sides = true; snap_node_center = true; snap_other_nodes = true; - snap_grid = true; snap_guides = true; snap_rotation = false; snap_relative = false; @@ -5263,12 +5269,19 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(memnew(VSeparator)); - snap_button = memnew(ToolButton); - hb->add_child(snap_button); - snap_button->set_toggle_mode(true); - snap_button->connect("toggled", this, "_button_toggle_snap"); - snap_button->set_tooltip(TTR("Toggle snapping.")); - snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_snap", TTR("Use Snap"), KEY_MASK_SHIFT | KEY_S)); + smart_snap_button = memnew(ToolButton); + hb->add_child(smart_snap_button); + smart_snap_button->set_toggle_mode(true); + smart_snap_button->connect("toggled", this, "_button_toggle_smart_snap"); + smart_snap_button->set_tooltip(TTR("Toggle smart snapping.")); + smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S)); + + grid_snap_button = memnew(ToolButton); + hb->add_child(grid_snap_button); + grid_snap_button->set_toggle_mode(true); + grid_snap_button->connect("toggled", this, "_button_toggle_grid_snap"); + grid_snap_button->set_tooltip(TTR("Toggle grid snapping.")); + grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G)); snap_config_menu = memnew(MenuButton); hb->add_child(snap_config_menu); @@ -5279,7 +5292,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { PopupMenu *p = snap_config_menu->get_popup(); p->connect("id_pressed", this, "_popup_callback"); p->set_hide_on_checkable_item_selection(false); - p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_grid", TTR("Snap to Grid")), SNAP_USE_GRID); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL); @@ -5351,9 +5363,9 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p = view_menu->get_popup(); p->set_hide_on_checkable_item_selection(false); - p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Show Grid"), KEY_G), SHOW_GRID); + p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Always Show Grid"), KEY_G), SHOW_GRID); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show Helpers"), KEY_H), SHOW_HELPERS); - p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show Rulers"), KEY_MASK_CMD | KEY_R), SHOW_RULERS); + p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show Rulers")), SHOW_RULERS); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), KEY_Y), SHOW_GUIDES); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_origin", TTR("Show Origin")), SHOW_ORIGIN); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_viewport", TTR("Show Viewport")), SHOW_VIEWPORT); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 6cce1ca10e..480fb89621 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -259,13 +259,14 @@ private: float snap_rotation_step; float snap_rotation_offset; - bool snap_active; + bool smart_snap_active; + bool grid_snap_active; + bool snap_node_parent; bool snap_node_anchors; bool snap_node_sides; bool snap_node_center; bool snap_other_nodes; - bool snap_grid; bool snap_guides; bool snap_rotation; bool snap_relative; @@ -347,7 +348,8 @@ private: ToolButton *ruler_button; - ToolButton *snap_button; + ToolButton *smart_snap_button; + ToolButton *grid_snap_button; MenuButton *snap_config_menu; PopupMenu *smartsnap_config_popup; @@ -529,7 +531,8 @@ private: void _button_zoom_minus(); void _button_zoom_reset(); void _button_zoom_plus(); - void _button_toggle_snap(bool p_status); + void _button_toggle_smart_snap(bool p_status); + void _button_toggle_grid_snap(bool p_status); void _button_tool_select(int p_index); HSplitContainer *palette_split; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 80b0f0738a..f7e997a269 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -43,6 +43,7 @@ #include "editor/plugins/shader_editor_plugin.h" #include "editor/script_editor_debugger.h" #include "scene/main/viewport.h" +#include "scene/scene_string_names.h" #include "script_text_editor.h" #include "text_editor.h" @@ -1325,6 +1326,9 @@ void ScriptEditor::_menu_option(int p_option) { case HELP_SEARCH_FIND_NEXT: { help->search_again(); } break; + case HELP_SEARCH_FIND_PREVIOUS: { + help->search_again(true); + } break; case FILE_CLOSE: { _close_current_tab(); } break; @@ -1417,16 +1421,6 @@ void ScriptEditor::_notification(int p_what) { members_overview->connect("item_selected", this, "_members_overview_selected"); help_overview->connect("item_selected", this, "_help_overview_selected"); script_split->connect("dragged", this, "_script_split_dragged"); - autosave_timer->connect("timeout", this, "_autosave_scripts"); - { - float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); - if (autosave_time > 0) { - autosave_timer->set_wait_time(autosave_time); - autosave_timer->start(); - } else { - autosave_timer->stop(); - } - } EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed"); FALLTHROUGH; @@ -2332,13 +2326,7 @@ void ScriptEditor::_editor_settings_changed() { _update_members_overview_visibility(); _update_help_overview_visibility(); - float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); - if (autosave_time > 0) { - autosave_timer->set_wait_time(autosave_time); - autosave_timer->start(); - } else { - autosave_timer->stop(); - } + _update_autosave_timer(); if (current_theme == "") { current_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme"); @@ -2366,6 +2354,21 @@ void ScriptEditor::_autosave_scripts() { save_all_scripts(); } +void ScriptEditor::_update_autosave_timer() { + + if (!autosave_timer->is_inside_tree()) { + return; + } + + float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); + if (autosave_time > 0) { + autosave_timer->set_wait_time(autosave_time); + autosave_timer->start(); + } else { + autosave_timer->stop(); + } +} + void ScriptEditor::_tree_changed() { if (waiting_update_names) @@ -2827,6 +2830,7 @@ void ScriptEditor::_update_selected_editor_menu() { script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND); script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT); + script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3), HELP_SEARCH_FIND_PREVIOUS); script_search_menu->get_popup()->add_separator(); script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES); script_search_menu->show(); @@ -3088,6 +3092,7 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_show_debugger", &ScriptEditor::_show_debugger); ClassDB::bind_method("_get_debug_tooltip", &ScriptEditor::_get_debug_tooltip); ClassDB::bind_method("_autosave_scripts", &ScriptEditor::_autosave_scripts); + ClassDB::bind_method("_update_autosave_timer", &ScriptEditor::_update_autosave_timer); ClassDB::bind_method("_editor_settings_changed", &ScriptEditor::_editor_settings_changed); ClassDB::bind_method("_update_script_names", &ScriptEditor::_update_script_names); ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections); @@ -3424,6 +3429,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { autosave_timer = memnew(Timer); autosave_timer->set_one_shot(false); + autosave_timer->connect(SceneStringNames::get_singleton()->tree_entered, this, "_update_autosave_timer"); + autosave_timer->connect("timeout", this, "_autosave_scripts"); add_child(autosave_timer); grab_focus_block = false; diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 0c876108a5..294294fc56 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -168,6 +168,7 @@ class ScriptEditor : public PanelContainer { REQUEST_DOCS, HELP_SEARCH_FIND, HELP_SEARCH_FIND_NEXT, + HELP_SEARCH_FIND_PREVIOUS, WINDOW_MOVE_UP, WINDOW_MOVE_DOWN, WINDOW_NEXT, @@ -342,6 +343,7 @@ class ScriptEditor : public PanelContainer { void _save_layout(); void _editor_settings_changed(); void _autosave_scripts(); + void _update_autosave_timer(); void _update_members_overview_visibility(); void _update_members_overview(); diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 69fd592652..40734cffc4 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -178,6 +178,7 @@ void SpriteEditor::_update_mesh_data() { err_dialog->popup_centered_minsize(); return; } + Ref<Image> image = texture->get_data(); ERR_FAIL_COND(image.is_null()); Rect2 rect; @@ -190,7 +191,12 @@ void SpriteEditor::_update_mesh_data() { bm.instance(); bm->create_from_image_alpha(image); - int grow = island_merging->get_value(); + int shrink = shrink_pixels->get_value(); + if (shrink > 0) { + bm->shrink_mask(shrink, rect); + } + + int grow = grow_pixels->get_value(); if (grow > 0) { bm->grow_mask(grow, rect); } @@ -338,6 +344,13 @@ void SpriteEditor::_convert_to_mesh_2d_node() { } void SpriteEditor::_convert_to_polygon_2d_node() { + + if (computed_outline_lines.empty()) { + err_dialog->set_text(TTR("Invalid geometry, can't create polygon.")); + err_dialog->popup_centered_minsize(); + return; + } + Polygon2D *polygon_2d_instance = memnew(Polygon2D); int total_point_count = 0; @@ -362,12 +375,6 @@ void SpriteEditor::_convert_to_polygon_2d_node() { Vector<Vector2> outline = computed_outline_lines[i]; Vector<Vector2> uv_outline = outline_lines[i]; - if (outline.size() < 3) { - err_dialog->set_text(TTR("Invalid geometry, can't create polygon.")); - err_dialog->popup_centered_minsize(); - return; - } - PoolIntArray pia; pia.resize(outline.size()); PoolIntArray::Write pia_write = pia.write(); @@ -396,16 +403,17 @@ void SpriteEditor::_convert_to_polygon_2d_node() { } void SpriteEditor::_create_collision_polygon_2d_node() { + + if (computed_outline_lines.empty()) { + err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon.")); + err_dialog->popup_centered_minsize(); + return; + } + for (int i = 0; i < computed_outline_lines.size(); i++) { Vector<Vector2> outline = computed_outline_lines[i]; - if (outline.size() < 3) { - err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon.")); - err_dialog->popup_centered_minsize(); - continue; - } - CollisionPolygon2D *collision_polygon_2d_instance = memnew(CollisionPolygon2D); collision_polygon_2d_instance->set_polygon(outline); @@ -419,16 +427,17 @@ void SpriteEditor::_create_collision_polygon_2d_node() { } void SpriteEditor::_create_light_occluder_2d_node() { + + if (computed_outline_lines.empty()) { + err_dialog->set_text(TTR("Invalid geometry, can't create light occluder.")); + err_dialog->popup_centered_minsize(); + return; + } + for (int i = 0; i < computed_outline_lines.size(); i++) { Vector<Vector2> outline = computed_outline_lines[i]; - if (outline.size() < 3) { - err_dialog->set_text(TTR("Invalid geometry, can't create light occluder.")); - err_dialog->popup_centered_minsize(); - continue; - } - Ref<OccluderPolygon2D> polygon; polygon.instance(); @@ -531,10 +540,14 @@ void SpriteEditor::_debug_uv_draw() { Ref<Texture> tex = node->get_texture(); ERR_FAIL_COND(!tex.is_valid()); + + Point2 draw_pos_offset = Point2(1.0, 1.0); + Size2 draw_size_offset = Size2(2.0, 2.0); + debug_uv->set_clip_contents(true); - debug_uv->draw_texture(tex, Point2()); - debug_uv->set_custom_minimum_size(tex->get_size()); - //debug_uv->draw_set_transform(Vector2(), 0, debug_uv->get_size()); + debug_uv->draw_texture(tex, draw_pos_offset); + debug_uv->set_custom_minimum_size(tex->get_size() + draw_size_offset); + debug_uv->draw_set_transform(draw_pos_offset, 0, Size2(1.0, 1.0)); Color color = Color(1.0, 0.8, 0.7); @@ -604,13 +617,21 @@ SpriteEditor::SpriteEditor() { simplification->set_value(2); hb->add_child(simplification); hb->add_spacer(); + hb->add_child(memnew(Label(TTR("Shrink (Pixels): ")))); + shrink_pixels = memnew(SpinBox); + shrink_pixels->set_min(0); + shrink_pixels->set_max(10); + shrink_pixels->set_step(1); + shrink_pixels->set_value(0); + hb->add_child(shrink_pixels); + hb->add_spacer(); hb->add_child(memnew(Label(TTR("Grow (Pixels): ")))); - island_merging = memnew(SpinBox); - island_merging->set_min(0); - island_merging->set_max(10); - island_merging->set_step(1); - island_merging->set_value(2); - hb->add_child(island_merging); + grow_pixels = memnew(SpinBox); + grow_pixels->set_min(0); + grow_pixels->set_max(10); + grow_pixels->set_step(1); + grow_pixels->set_value(2); + hb->add_child(grow_pixels); hb->add_spacer(); update_preview = memnew(Button); update_preview->set_text(TTR("Update Preview")); diff --git a/editor/plugins/sprite_editor_plugin.h b/editor/plugins/sprite_editor_plugin.h index 81be4a19e9..4ca7bca1a8 100644 --- a/editor/plugins/sprite_editor_plugin.h +++ b/editor/plugins/sprite_editor_plugin.h @@ -67,7 +67,8 @@ class SpriteEditor : public Control { Vector<int> computed_indices; SpinBox *simplification; - SpinBox *island_merging; + SpinBox *grow_pixels; + SpinBox *shrink_pixels; Button *update_preview; void _menu_option(int p_option); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index d0320bcd8b..0cef5a8b6f 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -31,7 +31,7 @@ #include "text_editor.h" #include "core/os/keyboard.h" -#include "editor_node.h" +#include "editor/editor_node.h" void TextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) { highlighters[p_highlighter->get_name()] = p_highlighter; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index c962751c7a..3a9e48cfdb 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -178,6 +178,9 @@ bool VisualShaderEditor::_is_available(int p_mode) { } void VisualShaderEditor::update_custom_nodes() { + if (members_dialog->is_visible()) { + return; + } clear_custom_types(); List<StringName> class_list; ScriptServer::get_global_class_list(&class_list); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index f70dcab931..d903e153a7 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1753,6 +1753,12 @@ void ProjectManager::_notification(int p_what) { Engine::get_singleton()->set_editor_hint(false); } break; + case NOTIFICATION_RESIZED: { + + if (open_templates->is_visible()) { + open_templates->popup_centered_minsize(); + } + } break; case NOTIFICATION_READY: { if (_project_list->get_project_count() == 0 && StreamPeerSSL::is_available()) diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index f177e634a6..35187214a6 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -845,13 +845,9 @@ void ProjectSettingsEditor::_item_adds(String) { void ProjectSettingsEditor::_item_add() { - Variant value; - switch (type->get_selected()) { - case 0: value = false; break; - case 1: value = 0; break; - case 2: value = 0.0; break; - case 3: value = ""; break; - } + // Initialize the property with the default value for the given type + Variant::CallError ce; + const Variant value = Variant::construct(Variant::Type(type->get_selected()), NULL, 0, ce); String catname = category->get_text().strip_edges(); String propname = property->get_text().strip_edges(); @@ -1834,10 +1830,11 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { type = memnew(OptionButton); type->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_prop_bar->add_child(type); - type->add_item("bool"); - type->add_item("int"); - type->add_item("float"); - type->add_item("string"); + + // Start at 1 to avoid adding "Nil" as an option + for (int i = 1; i < Variant::VARIANT_MAX; i++) { + type->add_item(Variant::get_type_name(Variant::Type(i)), i); + } Button *add = memnew(Button); add_prop_bar->add_child(add); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 489049c543..16da2771b9 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -3730,6 +3730,7 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { Ref<ConcavePolygonShape> cs2 = s; Ref<ArrayMesh> mesh = cs2->get_debug_mesh(); p_gizmo->add_mesh(mesh, false, Ref<SkinReference>(), material); + p_gizmo->add_collision_segments(cs2->get_debug_mesh_lines()); } if (Object::cast_to<RayShape>(*s)) { |