diff options
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_blend_space_1d_editor.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 18 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 37 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/skeleton_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/style_box_editor_plugin.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 33 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.h | 2 |
14 files changed, 81 insertions, 46 deletions
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index e07f041eb1..475e4c8d67 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -702,13 +702,13 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { bottom_hb->set_h_size_flags(SIZE_EXPAND_FILL); min_value = memnew(SpinBox); - min_value->set_max(0); min_value->set_min(-10000); + min_value->set_max(0); min_value->set_step(0.01); max_value = memnew(SpinBox); - max_value->set_max(10000); max_value->set_min(0.01); + max_value->set_max(10000); max_value->set_step(0.01); label_value = memnew(LineEdit); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 80353bab01..718156f12a 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -85,6 +85,9 @@ void AnimationPlayerEditor::_notification(int p_what) { track_editor->set_anim_pos(player->get_current_animation_position()); EditorNode::get_singleton()->get_inspector()->refresh(); + } else if (!player->is_valid()) { + // Reset timeline when the player has been stopped externally + frame->set_value(0); } else if (last_active) { // Need the last frame after it stopped. frame->set_value(player->get_current_animation_position()); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 20b4cf43bf..9894c8c562 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2238,6 +2238,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { // Clear the selection if not additive editor_selection->clear(); viewport->update(); + selected_from_canvas = true; }; drag_from = click; diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 007ce58bd7..204562ac38 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -827,19 +827,23 @@ void EditorFontPreviewPlugin::_bind_methods() { bool EditorFontPreviewPlugin::handles(const String &p_type) const { - return ClassDB::is_parent_class(p_type, "DynamicFontData"); + return ClassDB::is_parent_class(p_type, "DynamicFontData") || ClassDB::is_parent_class(p_type, "DynamicFont"); } Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path, const Size2 &p_size) const { - Ref<DynamicFontData> SampledFont; - SampledFont.instance(); - SampledFont->set_font_path(p_path); - + RES res = ResourceLoader::load(p_path); Ref<DynamicFont> sampled_font; - sampled_font.instance(); + if (res->is_class("DynamicFont")) { + sampled_font = res->duplicate(); + if (sampled_font->get_outline_color() == Color(1, 1, 1, 1)) { + sampled_font->set_outline_color(Color(0, 0, 0, 1)); + } + } else if (res->is_class("DynamicFontData")) { + sampled_font.instance(); + sampled_font->set_font_data(res); + } sampled_font->set_size(50); - sampled_font->set_font_data(SampledFont); String sampled_text = "Abg"; Vector2 size = sampled_font->get_string_size(sampled_text); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f7e997a269..54bf8ce5a2 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2497,7 +2497,10 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int new_index = 0; + if (script_list->get_item_count() > 0) { + new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + } tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2514,7 +2517,10 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int new_index = 0; + if (script_list->get_item_count() > 0) { + new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + } tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2525,7 +2531,10 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co Vector<String> files = d["files"]; - int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int new_index = 0; + if (script_list->get_item_count() > 0) { + new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + } int num_tabs_before = tab_container->get_child_count(); for (int i = 0; i < files.size(); i++) { String file = files[i]; @@ -2551,16 +2560,20 @@ void ScriptEditor::_unhandled_input(const Ref<InputEvent> &p_event) { if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) return; if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { - int next_tab = script_list->get_current() + 1; - next_tab %= script_list->get_item_count(); - _go_to_tab(script_list->get_item_metadata(next_tab)); - _update_script_names(); + if (script_list->get_item_count() > 1) { + int next_tab = script_list->get_current() + 1; + next_tab %= script_list->get_item_count(); + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } } if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) { - int next_tab = script_list->get_current() - 1; - next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; - _go_to_tab(script_list->get_item_metadata(next_tab)); - _update_script_names(); + if (script_list->get_item_count() > 1) { + int next_tab = script_list->get_current() - 1; + next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } } if (ED_IS_SHORTCUT("script_editor/window_move_up", p_event)) { _menu_option(WINDOW_MOVE_UP); @@ -3238,7 +3251,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { ED_SHORTCUT("script_editor/window_move_up", TTR("Move Up"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_UP); ED_SHORTCUT("script_editor/window_move_down", TTR("Move Down"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_DOWN); ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_PERIOD); // these should be KEY_GREATER and KEY_LESS but those don't work - ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COLON); + ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COMMA); set_process_unhandled_input(true); file_menu = memnew(MenuButton); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f63445dab8..2e41801637 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -707,6 +707,7 @@ void ScriptTextEditor::_bookmark_item_pressed(int p_idx) { _edit_option(bookmarks_menu->get_item_id(p_idx)); } else { code_editor->goto_line(bookmarks_menu->get_item_metadata(p_idx)); + code_editor->get_text_edit()->call_deferred("center_viewport_to_cursor"); //Need to be deferred, because goto uses call_deferred(). } } @@ -856,6 +857,7 @@ void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) { _edit_option(breakpoints_menu->get_item_id(p_idx)); } else { code_editor->goto_line(breakpoints_menu->get_item_metadata(p_idx)); + code_editor->get_text_edit()->call_deferred("center_viewport_to_cursor"); //Need to be deferred, because goto uses call_deferred(). } } @@ -1307,6 +1309,7 @@ void ScriptTextEditor::_edit_option(int p_op) { if (bline > line) { tx->unfold_line(bline); tx->cursor_set_line(bline); + tx->center_viewport_to_cursor(); return; } } @@ -1332,6 +1335,7 @@ void ScriptTextEditor::_edit_option(int p_op) { if (bline < line) { tx->unfold_line(bline); tx->cursor_set_line(bline); + tx->center_viewport_to_cursor(); return; } } diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index cd360d4caf..1adf0be108 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -65,7 +65,6 @@ void SkeletonEditor::create_physical_skeleton() { for (int bone_id = 0; bc > bone_id; ++bone_id) { const int parent = skeleton->get_bone_parent(bone_id); - const int parent_parent = skeleton->get_bone_parent(parent); if (parent < 0) { @@ -73,6 +72,8 @@ void SkeletonEditor::create_physical_skeleton() { } else { + const int parent_parent = skeleton->get_bone_parent(parent); + bones_infos.write[bone_id].relative_rest = bones_infos[parent].relative_rest * skeleton->get_bone_rest(bone_id); /// create physical bone on parent diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index d187e4ff4a..10e4559805 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -521,7 +521,7 @@ void SpatialEditorViewport::_select_region() { if (selected.find(item) != -1) continue; - if (_is_node_locked(Object::cast_to<Spatial>(item))) continue; + if (_is_node_locked(item)) continue; Ref<EditorSpatialGizmo> seg = sp->get_gizmo(); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 394122d91d..34780af59e 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -757,7 +757,7 @@ Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f return Variant(); Dictionary drag_data = EditorNode::get_singleton()->drag_resource(frame, p_from); - drag_data["frame"] = idx; // store the frame, incase we want to reorder frames inside 'drop_data_fw' + drag_data["frame"] = idx; // store the frame, in case we want to reorder frames inside 'drop_data_fw' return drag_data; } diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index c4a9803ff4..7e5e278689 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -68,7 +68,14 @@ void StyleBoxPreview::_sb_changed() { void StyleBoxPreview::_redraw() { if (stylebox.is_valid()) { - preview->draw_style_box(stylebox, preview->get_rect()); + Rect2 preview_rect = preview->get_rect(); + + // Re-adjust preview panel to fit all drawn content + Rect2 draw_rect = stylebox->get_draw_rect(preview_rect); + preview_rect.size -= draw_rect.size - preview_rect.size; + preview_rect.position -= draw_rect.position - preview_rect.position; + + preview->draw_style_box(stylebox, preview_rect); } } @@ -81,6 +88,7 @@ void StyleBoxPreview::_bind_methods() { StyleBoxPreview::StyleBoxPreview() { preview = memnew(Control); preview->set_custom_minimum_size(Size2(0, 150 * EDSCALE)); + preview->set_clip_contents(true); preview->connect("draw", this, "_redraw"); add_margin_child(TTR("Preview:"), preview); } diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 0cef5a8b6f..7651ab8526 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -713,7 +713,7 @@ TextEditor::TextEditor() { goto_menu->get_popup()->add_separator(); bookmarks_menu = memnew(PopupMenu); - bookmarks_menu->set_name(TTR("Bookmarks")); + bookmarks_menu->set_name("Bookmarks"); goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index bda3d142fa..a2f4040152 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -430,9 +430,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) { if (mm->get_button_mask() & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { - Vector2 draged(mm->get_relative().x / draw_zoom, mm->get_relative().y / draw_zoom); - hscroll->set_value(hscroll->get_value() - draged.x); - vscroll->set_value(vscroll->get_value() - draged.y); + Vector2 dragged(mm->get_relative().x / draw_zoom, mm->get_relative().y / draw_zoom); + hscroll->set_value(hscroll->get_value() - dragged.x); + vscroll->set_value(vscroll->get_value() - dragged.y); } else if (drag) { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 385ba4cfda..a8e81b612b 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -52,12 +52,6 @@ void TileMapEditor::_notification(int p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - bool new_show_tile_info = EditorSettings::get_singleton()->get("editors/tile_map/show_tile_info_on_hover"); - if (new_show_tile_info != show_tile_info) { - show_tile_info = new_show_tile_info; - tile_info->set_visible(show_tile_info); - } - if (is_visible_in_tree()) { _update_palette(); } @@ -1250,14 +1244,13 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { CanvasItemEditor::get_singleton()->update_viewport(); } - if (show_tile_info) { - int tile_under = node->get_cell(over_tile.x, over_tile.y); - String tile_name = "none"; + int tile_under = node->get_cell(over_tile.x, over_tile.y); + String tile_name = "none"; - if (node->get_tileset()->has_tile(tile_under)) - tile_name = node->get_tileset()->tile_get_name(tile_under); - tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]"); - } + if (node->get_tileset()->has_tile(tile_under)) + tile_name = node->get_tileset()->tile_get_name(tile_under); + tile_info->show(); + tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]"); if (tool == TOOL_PAINTING) { @@ -1925,7 +1918,6 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { tool = TOOL_NONE; selection_active = false; mouse_over = false; - show_tile_info = true; flip_h = false; flip_v = false; @@ -2055,7 +2047,12 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { // Tile position. tile_info = memnew(Label); - toolbar_right->add_child(tile_info); + tile_info->set_modulate(Color(1, 1, 1, 0.8)); + tile_info->set_mouse_filter(MOUSE_FILTER_IGNORE); + tile_info->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("main", "EditorFonts")); + // The tile info is only displayed after a tile has been hovered. + tile_info->hide(); + CanvasItemEditor::get_singleton()->add_control_to_info_overlay(tile_info); // Menu. options = memnew(MenuButton); @@ -2151,6 +2148,10 @@ void TileMapEditorPlugin::make_visible(bool p_visible) { tile_map_editor->show(); tile_map_editor->get_toolbar()->show(); tile_map_editor->get_toolbar_right()->show(); + // `tile_info` isn't shown here, as it's displayed after a tile has been hovered. + // Otherwise, a translucent black rectangle would be visible as there would be an + // empty Label in the CanvasItemEditor's info overlay. + // Change to TOOL_SELECT when TileMap node is selected, to prevent accidental movement. CanvasItemEditor::get_singleton()->set_current_tool(CanvasItemEditor::TOOL_SELECT); } else { @@ -2158,6 +2159,7 @@ void TileMapEditorPlugin::make_visible(bool p_visible) { tile_map_editor->hide(); tile_map_editor->get_toolbar()->hide(); tile_map_editor->get_toolbar_right()->hide(); + tile_map_editor->get_tile_info()->hide(); tile_map_editor->edit(NULL); } } @@ -2170,7 +2172,6 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { EDITOR_DEF("editors/tile_map/show_tile_ids", false); EDITOR_DEF("editors/tile_map/sort_tiles_by_name", true); EDITOR_DEF("editors/tile_map/bucket_fill_preview", true); - EDITOR_DEF("editors/tile_map/show_tile_info_on_hover", true); EDITOR_DEF("editors/tile_map/editor_side", 1); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/tile_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right")); diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index e3d678c2fd..6400431bd1 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -109,7 +109,6 @@ class TileMapEditor : public VBoxContainer { bool selection_active; bool mouse_over; - bool show_tile_info; bool flip_h; bool flip_v; @@ -218,6 +217,7 @@ protected: public: HBoxContainer *get_toolbar() const { return toolbar; } HBoxContainer *get_toolbar_right() const { return toolbar_right; } + Label *get_tile_info() const { return tile_info; } bool forward_gui_input(const Ref<InputEvent> &p_event); void forward_canvas_draw_over_viewport(Control *p_overlay); |