diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 1 | ||||
-rw-r--r-- | editor/editor_node.cpp | 22 | ||||
-rw-r--r-- | editor/editor_node.h | 1 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 6 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 3 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 32 | ||||
-rw-r--r-- | editor/filesystem_dock.h | 1 | ||||
-rw-r--r-- | editor/icons/icon_GUI_space.svg | 71 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 27 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 47 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 2 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 20 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 1 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 6 |
17 files changed, 198 insertions, 49 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index ec984e480a..7fd7b8dac3 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -755,6 +755,7 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size")); text_editor->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent")); text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); + text_editor->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/indent/draw_spaces")); text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded")); text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_length_guideline")); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 23d1f25641..907d43b26f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1015,8 +1015,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { y = (img->get_height() - size) / 2; img->crop_from_point(x, y, size, size); - // We could get better pictures with better filters - img->resize(preview_size, preview_size, Image::INTERPOLATE_CUBIC); + img->resize(preview_size, preview_size, Image::INTERPOLATE_LANCZOS); } img->convert(Image::FORMAT_RGB8); @@ -1956,6 +1955,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { _scene_tab_closed(editor_data.get_edited_scene()); } + if (p_confirmed) + _menu_option_confirm(SCENE_TAB_CLOSE, true); + } break; case FILE_CLOSE_ALL_AND_QUIT: case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER: @@ -2288,10 +2290,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { project_settings->popup_project_settings(); } break; - case RUN_PROJECT_DATA_FOLDER: { - - OS::get_singleton()->shell_open(String("file://") + OS::get_singleton()->get_user_data_dir()); - } break; case FILE_INSTALL_ANDROID_SOURCE: { if (p_confirmed) { @@ -2528,6 +2526,9 @@ void EditorNode::_tool_menu_option(int p_idx) { case TOOLS_ORPHAN_RESOURCES: { orphan_resources->show(); } break; + case RUN_PROJECT_DATA_FOLDER: { + OS::get_singleton()->shell_open(String("file://") + OS::get_singleton()->get_user_data_dir()); + } break; case TOOLS_CUSTOM: { if (tool_menu->get_item_submenu(p_idx) == "") { Array params = tool_menu->get_item_metadata(p_idx); @@ -3250,6 +3251,12 @@ InspectorDock *EditorNode::get_inspector_dock() { return inspector_dock; } +void EditorNode::_inherit_request(String p_file) { + + current_option = FILE_NEW_INHERITED_SCENE; + _dialog_action(p_file); +} + void EditorNode::_instance_request(const Vector<String> &p_files) { request_instance_scenes(p_files); @@ -5023,6 +5030,7 @@ void EditorNode::_bind_methods() { ClassDB::bind_method("_get_scene_metadata", &EditorNode::_get_scene_metadata); ClassDB::bind_method("set_edited_scene", &EditorNode::set_edited_scene); ClassDB::bind_method("open_request", &EditorNode::open_request); + ClassDB::bind_method("_inherit_request", &EditorNode::_inherit_request); ClassDB::bind_method("_instance_request", &EditorNode::_instance_request); ClassDB::bind_method("_close_messages", &EditorNode::_close_messages); ClassDB::bind_method("_show_messages", &EditorNode::_show_messages); @@ -5990,7 +5998,7 @@ EditorNode::EditorNode() { node_dock = memnew(NodeDock); filesystem_dock = memnew(FileSystemDock(this)); - filesystem_dock->connect("open", this, "open_request"); + filesystem_dock->connect("inherit", this, "_inherit_request"); filesystem_dock->connect("instance", this, "_instance_request"); filesystem_dock->connect("display_mode_changed", this, "_save_docks"); diff --git a/editor/editor_node.h b/editor/editor_node.h index 0084d421f9..cfe8bf9ec4 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -474,6 +474,7 @@ private: int _next_unsaved_scene(bool p_valid_filename, int p_start = 0); void _discard_changes(const String &p_str = String()); + void _inherit_request(String p_file); void _instance_request(const Vector<String> &p_files); void _display_top_editors(bool p_display); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index e80d3e1b37..193b2b7a88 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -425,6 +425,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("text_editor/indent/auto_indent", true); _initial_set("text_editor/indent/convert_indent_on_save", false); _initial_set("text_editor/indent/draw_tabs", true); + _initial_set("text_editor/indent/draw_spaces", false); // Line numbers _initial_set("text_editor/line_numbers/show_line_numbers", true); @@ -651,7 +652,7 @@ void EditorSettings::_load_default_text_editor_theme() { _initial_set("text_editor/highlighting/executing_line_color", Color(0.2, 0.8, 0.2, 0.4)); _initial_set("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8)); _initial_set("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)); - _initial_set("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1)); + _initial_set("text_editor/highlighting/search_result_border_color", Color(0.41, 0.61, 0.91, 0.38)); } bool EditorSettings::_save_text_editor_theme(String p_file) { @@ -973,6 +974,9 @@ void EditorSettings::setup_network() { // link-local IPv6 addresses don't work, skipping them if (ip.begins_with("fe80:0:0:0:")) // fe80::/64 continue; + // Same goes for IPv4 link-local (APIPA) addresses. + if (ip.begins_with("169.254.")) // 169.254.0.0/16 + continue; if (ip == current) lip = current; //so it saves if (hint != "") diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index f74e913208..ba4dd9d7e2 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -833,6 +833,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("read_only", "TextEdit", style_widget_disabled); theme->set_constant("side_margin", "TabContainer", 0); theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons")); + theme->set_icon("space", "TextEdit", theme->get_icon("GuiSpace", "EditorIcons")); theme->set_icon("folded", "TextEdit", theme->get_icon("GuiTreeArrowRight", "EditorIcons")); theme->set_icon("fold", "TextEdit", theme->get_icon("GuiTreeArrowDown", "EditorIcons")); theme->set_color("font_color", "TextEdit", font_color); @@ -1121,7 +1122,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color executing_line_color = Color(0.2, 0.8, 0.2, 0.4); const Color code_folding_color = alpha3; const Color search_result_color = alpha1; - const Color search_result_border_color = alpha3; + const Color search_result_border_color = Color(0.41, 0.61, 0.91, 0.38); EditorSettings *setting = EditorSettings::get_singleton(); String text_editor_color_theme = setting->get("text_editor/theme/color_theme"); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 6248680a52..5ce22154e0 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -462,6 +462,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa _update_tree(_compute_uncollapsed_paths(), false, p_select_in_favorites); if (display_mode == DISPLAY_MODE_SPLIT) { _update_file_list(false); + files->get_v_scroll()->set_value(0); } String file_name = p_path.get_file(); @@ -1489,12 +1490,28 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> p_selected) } break; case FILE_OPEN: { + // Open folders + TreeItem *selected = tree->get_root(); + selected = tree->get_next_selected(selected); + while (selected) { + if (p_selected.find(selected->get_metadata(0)) >= 0) { + selected->set_collapsed(false); + } + selected = tree->get_next_selected(selected); + } // Open the file for (int i = 0; i < p_selected.size(); i++) { _select_file(p_selected[i]); } } break; + case FILE_INHERIT: { + // Create a new scene inherited from the selected one + if (p_selected.size() == 1) { + emit_signal("inherit", p_selected[0]); + } + } break; + case FILE_INSTANCE: { // Instance all selected scenes Vector<String> paths; @@ -2061,13 +2078,16 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str if (all_files) { - if (all_files_scenes && filenames.size() >= 1) { - p_popup->add_item(TTR("Open Scene(s)"), FILE_OPEN); + if (all_files_scenes) { + if (filenames.size() == 1) { + p_popup->add_item(TTR("Open Scene"), FILE_OPEN); + p_popup->add_item(TTR("New Inherited Scene"), FILE_INHERIT); + } else { + p_popup->add_item(TTR("Open Scenes"), FILE_OPEN); + } p_popup->add_item(TTR("Instance"), FILE_INSTANCE); p_popup->add_separator(); - } - - if (!all_files_scenes && filenames.size() == 1) { + } else if (filenames.size() == 1) { p_popup->add_item(TTR("Open"), FILE_OPEN); p_popup->add_separator(); } @@ -2368,8 +2388,8 @@ void FileSystemDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &FileSystemDock::_feature_profile_changed); + ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file"))); ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"))); - ADD_SIGNAL(MethodInfo("open")); ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file"))); ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder"))); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 8b27938c8a..9d20544ac2 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -73,6 +73,7 @@ public: private: enum FileMenu { FILE_OPEN, + FILE_INHERIT, FILE_INSTANCE, FILE_ADD_FAVORITE, FILE_REMOVE_FAVORITE, diff --git a/editor/icons/icon_GUI_space.svg b/editor/icons/icon_GUI_space.svg new file mode 100644 index 0000000000..caa4565f4a --- /dev/null +++ b/editor/icons/icon_GUI_space.svg @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="8" + height="8" + version="1.1" + viewBox="0 0 8 7.9999993" + id="svg98" + sodipodi:docname="icon_GUI_space.svg" + inkscape:version="0.92.4 (unknown)"> + <metadata + id="metadata104"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs102"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 3.9999996 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="8 : 3.9999996 : 1" + inkscape:persp3d-origin="4 : 2.6666664 : 1" + id="perspective992" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1853" + inkscape:window-height="1025" + id="namedview100" + showgrid="false" + inkscape:zoom="70.333333" + inkscape:cx="3.4905213" + inkscape:cy="6" + inkscape:window-x="67" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="svg98" + inkscape:pagecheckerboard="true" /> + <g + transform="matrix(0.5,0,0,-0.5,1,527.20001)" + id="g96" + style="fill:#ffffff;fill-opacity:0.19607843"> + <circle + cx="6" + cy="1046.4" + r="3" + id="circle94" + style="fill:#ffffff;fill-opacity:0.19607843" /> + </g> +</svg> diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 7c075b5635..0a9436952b 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -129,8 +129,10 @@ void AnimationPlayerEditor::_notification(int p_what) { autoplay_icon = get_icon("AutoPlay", "EditorIcons"); stop->set_icon(get_icon("Stop", "EditorIcons")); + onion_toggle->set_icon(get_icon("Onion", "EditorIcons")); + onion_skinning->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); + pin->set_icon(get_icon("Pin", "EditorIcons")); - onion_skinning->set_icon(get_icon("Onion", "EditorIcons")); tool_anim->add_style_override("normal", get_stylebox("normal", "Button")); track_editor->get_edit_menu()->add_style_override("normal", get_stylebox("normal", "Button")); @@ -1229,7 +1231,6 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) { case ONION_SKINNING_ENABLE: { onion.enabled = !onion.enabled; - menu->set_item_checked(idx, onion.enabled); if (onion.enabled) _start_onion_skinning(); @@ -1708,19 +1709,21 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay hb->add_child(track_editor->get_edit_menu()); + hb->add_child(memnew(VSeparator)); + + onion_toggle = memnew(ToolButton); + onion_toggle->set_toggle_mode(true); + onion_toggle->set_tooltip(TTR("Enable Onion Skinning")); + onion_toggle->connect("pressed", this, "_onion_skinning_menu", varray(ONION_SKINNING_ENABLE)); + hb->add_child(onion_toggle); + onion_skinning = memnew(MenuButton); - //onion_skinning->set_flat(false); - onion_skinning->set_tooltip(TTR("Onion Skinning")); - onion_skinning->get_popup()->add_check_shortcut(ED_SHORTCUT("animation_player_editor/onion_skinning", TTR("Enable Onion Skinning")), ONION_SKINNING_ENABLE); - onion_skinning->get_popup()->add_separator(); - onion_skinning->get_popup()->add_item(TTR("Directions"), -1); - onion_skinning->get_popup()->set_item_disabled(onion_skinning->get_popup()->get_item_count() - 1, true); + onion_skinning->set_tooltip(TTR("Onion Skinning Options")); + onion_skinning->get_popup()->add_separator(TTR("Directions")); onion_skinning->get_popup()->add_check_item(TTR("Past"), ONION_SKINNING_PAST); onion_skinning->get_popup()->set_item_checked(onion_skinning->get_popup()->get_item_count() - 1, true); onion_skinning->get_popup()->add_check_item(TTR("Future"), ONION_SKINNING_FUTURE); - onion_skinning->get_popup()->add_separator(); - onion_skinning->get_popup()->add_item(TTR("Depth"), -1); - onion_skinning->get_popup()->set_item_disabled(onion_skinning->get_popup()->get_item_count() - 1, true); + onion_skinning->get_popup()->add_separator(TTR("Depth")); onion_skinning->get_popup()->add_radio_check_item(TTR("1 step"), ONION_SKINNING_1_STEP); onion_skinning->get_popup()->set_item_checked(onion_skinning->get_popup()->get_item_count() - 1, true); onion_skinning->get_popup()->add_radio_check_item(TTR("2 steps"), ONION_SKINNING_2_STEPS); @@ -1731,6 +1734,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay onion_skinning->get_popup()->add_check_item(TTR("Include Gizmos (3D)"), ONION_SKINNING_INCLUDE_GIZMOS); hb->add_child(onion_skinning); + hb->add_child(memnew(VSeparator)); + pin = memnew(ToolButton); pin->set_toggle_mode(true); pin->set_tooltip(TTR("Pin AnimationPlayer")); diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index 9085c70410..c6ab6c5e30 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -102,6 +102,7 @@ class AnimationPlayerEditor : public VBoxContainer { Button *autoplay; MenuButton *tool_anim; + ToolButton *onion_toggle; MenuButton *onion_skinning; ToolButton *pin; SpinBox *frame; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index d40e67cc8c..eaba48fa05 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1266,7 +1266,8 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_ Dictionary d = p_data; if (d.has("type") && (String(d["type"]) == "resource" || String(d["type"]) == "files" || - String(d["type"]) == "nodes")) { + String(d["type"]) == "nodes" || + String(d["type"]) == "files_and_dirs")) { return true; } @@ -1328,7 +1329,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data te->insert_text_at_cursor(res->get_path()); } - if (d.has("type") && String(d["type"]) == "files") { + if (d.has("type") && (String(d["type"]) == "files" || String(d["type"]) == "files_and_dirs")) { Array files = d["files"]; diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 6edd19901b..c509202a88 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -51,32 +51,42 @@ void SpriteFramesEditor::_open_sprite_sheet() { } void SpriteFramesEditor::_sheet_preview_draw() { + Size2i size = split_sheet_preview->get_size(); int h = split_sheet_h->get_value(); int v = split_sheet_v->get_value(); + int width = size.width / h; + int height = size.height / v; const float a = 0.3; for (int i = 1; i < h; i++) { - for (int j = 1; j < v; j++) { - int x = i * size.width / h; - int y = j * size.height / v; + int x = i * width; + split_sheet_preview->draw_line(Point2(x, 0), Point2(x, size.height), Color(1, 1, 1, a)); + split_sheet_preview->draw_line(Point2(x + 1, 0), Point2(x + 1, size.height), Color(0, 0, 0, a)); - split_sheet_preview->draw_line(Point2(x, 0), Point2(x, size.height), Color(1, 1, 1, a)); - split_sheet_preview->draw_line(Point2(x + 1, 0), Point2(x + 1, size.height), Color(0, 0, 0, a)); + for (int j = 1; j < v; j++) { + + int y = j * height; split_sheet_preview->draw_line(Point2(0, y), Point2(size.width, y), Color(1, 1, 1, a)); split_sheet_preview->draw_line(Point2(0, y + 1), Point2(size.width, y + 1), Color(0, 0, 0, a)); } } + if (frames_selected.size() == 0) { + split_sheet_dialog->get_ok()->set_disabled(true); + split_sheet_dialog->get_ok()->set_text(TTR("No Frames Selected")); + return; + } + Color accent = get_color("accent_color", "Editor"); for (Set<int>::Element *E = frames_selected.front(); E; E = E->next()) { int idx = E->get(); - int x = (idx % h) * size.width / h; - int y = (idx / v) * size.height / v; - int width = size.width / h; - int height = size.height / v; + int xp = idx % h; + int yp = (idx - xp) / h; + int x = xp * width; + int y = yp * height; split_sheet_preview->draw_rect(Rect2(x + 5, y + 5, width - 10, height - 10), Color(0, 0, 0, 0.35), true); split_sheet_preview->draw_rect(Rect2(x + 0, y + 0, width - 0, height - 0), Color(0, 0, 0, 1), false); @@ -87,13 +97,8 @@ void SpriteFramesEditor::_sheet_preview_draw() { split_sheet_preview->draw_rect(Rect2(x + 5, y + 5, width - 10, height - 10), Color(0, 0, 0, 1), false); } - if (frames_selected.size() == 0) { - split_sheet_dialog->get_ok()->set_disabled(true); - split_sheet_dialog->get_ok()->set_text(TTR("No Frames Selected")); - } else { - split_sheet_dialog->get_ok()->set_disabled(false); - split_sheet_dialog->get_ok()->set_text(vformat(TTR("Add %d Frame(s)"), frames_selected.size())); - } + split_sheet_dialog->get_ok()->set_disabled(false); + split_sheet_dialog->get_ok()->set_text(vformat(TTR("Add %d Frame(s)"), frames_selected.size())); } void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) { @@ -149,10 +154,12 @@ void SpriteFramesEditor::_sheet_add_frames() { for (Set<int>::Element *E = frames_selected.front(); E; E = E->next()) { int idx = E->get(); - int x = (idx % h) * size.width / h; - int y = (idx / v) * size.height / v; int width = size.width / h; int height = size.height / v; + int xp = idx % h; + int yp = (idx - xp) / h; + int x = xp * width; + int y = yp * height; Ref<AtlasTexture> at; at.instance(); @@ -456,6 +463,10 @@ void SpriteFramesEditor::_animation_select() { if (updating) return; + double value = anim_speed->get_line_edit()->get_text().to_double(); + if (!Math::is_equal_approx(value, frames->get_animation_speed(edited_anim))) + _animation_fps_changed(value); + TreeItem *selected = animations->get_selected(); ERR_FAIL_COND(!selected); edited_anim = selected->get_text(0); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 80e2e99685..85743c96d6 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -683,7 +683,6 @@ ThemeEditor::ThemeEditor() { CheckButton *cb = memnew(CheckButton); cb->set_text("CheckButton"); first_vb->add_child(cb); - cb = memnew(CheckButton); CheckBox *cbx = memnew(CheckBox); cbx->set_text("CheckBox"); first_vb->add_child(cbx); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index a41f10607b..1f5300e351 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1602,6 +1602,8 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) { Ref<Script> existing = E->get()->get_script(); editor_data->get_undo_redo().add_do_method(E->get(), "set_script", p_script.get_ref_ptr()); editor_data->get_undo_redo().add_undo_method(E->get(), "set_script", existing); + editor_data->get_undo_redo().add_do_method(this, "_update_script_button"); + editor_data->get_undo_redo().add_undo_method(this, "_update_script_button"); } editor_data->get_undo_redo().commit_action(); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 1da8bf874c..a661c2cfc3 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -299,6 +299,7 @@ void ScriptEditorDebugger::_scene_tree_rmb_selected(const Vector2 &p_position) { item_menu->clear(); item_menu->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE); + item_menu->add_icon_item(get_icon("CopyNodePath", "EditorIcons"), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH); item_menu->set_global_position(get_global_mouse_position()); item_menu->popup(); } @@ -396,6 +397,7 @@ Size2 ScriptEditorDebugger::get_minimum_size() const { ms.y = MAX(ms.y, 250 * EDSCALE); return ms; } + void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_data) { if (p_msg == "debug_enter") { @@ -1930,6 +1932,24 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { file_dialog->popup_centered_ratio(); } break; + case ITEM_MENU_COPY_NODE_PATH: { + + TreeItem *ti = inspect_scene_tree->get_selected(); + String text = ti->get_text(0); + + if (ti->get_parent() == NULL) { + text = "."; + } else if (ti->get_parent()->get_parent() == NULL) { + text = "."; + } else { + while (ti->get_parent()->get_parent() != inspect_scene_tree->get_root()) { + ti = ti->get_parent(); + text = ti->get_text(0) + "/" + text; + } + } + + OS::get_singleton()->set_clipboard(text); + } break; } } diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index f7afe6bf72..05dcab0f80 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -66,6 +66,7 @@ class ScriptEditorDebugger : public Control { enum ItemMenu { ITEM_MENU_COPY_ERROR, ITEM_MENU_SAVE_REMOTE_NODE, + ITEM_MENU_COPY_NODE_PATH, }; AcceptDialog *msgdialog; diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index f540b386aa..104bac190e 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -571,9 +571,11 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point, Transform orig_camera_transform = p_camera->get_camera_transform(); - if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01) { + if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01 && + ABS(orig_camera_transform.basis.get_axis(Vector3::AXIS_Z).dot(Vector3(0, 1, 0))) < 0.99) { p_camera->look_at(t.origin, Vector3(0, 1, 0)); } + Vector3 c0 = t.xform(Vector3(selectable_icon_size, selectable_icon_size, 0) * scale); Vector3 c1 = t.xform(Vector3(-selectable_icon_size, -selectable_icon_size, 0) * scale); @@ -582,7 +584,7 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point, p_camera->set_global_transform(orig_camera_transform); - Rect2 rect(p0, p1 - p0); + Rect2 rect(p0, (p1 - p0).abs()); rect.set_position(center - rect.get_size() / 2.0); |