diff options
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/animation_tree_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 34 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 24 |
9 files changed, 49 insertions, 40 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index e2f35e29d8..af1d266832 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -411,7 +411,7 @@ void AnimationPlayerEditor::_animation_remove() { String current = animation->get_item_text(animation->get_selected()); - delete_dialog->set_text(TTR("Delete Animation '" + current + "'?")); + delete_dialog->set_text(vformat(TTR("Delete Animation '%s'?"), current)); delete_dialog->popup_centered(); } diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index dc813896ff..269c54ba2b 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -79,7 +79,7 @@ void AnimationTreeEditor::_update_path() { group.instance(); Button *b = memnew(Button); - b->set_text("root"); + b->set_text("Root"); b->set_toggle_mode(true); b->set_button_group(group); b->set_pressed(true); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 44913abe8b..f3508cedbd 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2045,10 +2045,10 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) { List<CanvasItem *> selection = _get_edited_canvas_items(); - // Remove not movable nodes + drag_selection.clear(); for (int i = 0; i < selection.size(); i++) { - if (!_is_node_movable(selection[i], true)) { - selection.erase(selection[i]); + if (_is_node_movable(selection[i], true)) { + drag_selection.push_back(selection[i]); } } @@ -2073,7 +2073,6 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { } drag_from = transform.affine_inverse().xform(b->get_position()); - drag_selection = selection; _save_canvas_item_state(drag_selection); } return true; @@ -2395,16 +2394,15 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { // Drag the node(s) if requested List<CanvasItem *> selection2 = _get_edited_canvas_items(); - // Remove not movable nodes + drag_selection.clear(); for (int i = 0; i < selection2.size(); i++) { - if (!_is_node_movable(selection2[i], true)) { - selection2.erase(selection2[i]); + if (_is_node_movable(selection2[i], true)) { + drag_selection.push_back(selection2[i]); } } if (selection2.size() > 0) { drag_type = DRAG_MOVE; - drag_selection = selection2; drag_from = click; _save_canvas_item_state(drag_selection); } @@ -2591,6 +2589,15 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { _gui_input_hover(p_event); // Change the cursor + _update_cursor(); + + // Grab focus + if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) { + viewport->call_deferred("grab_focus"); + } +} + +void CanvasItemEditor::_update_cursor() { CursorShape c = CURSOR_ARROW; switch (drag_type) { case DRAG_NONE: @@ -2644,11 +2651,6 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { } viewport->set_default_cursor_shape(c); - - // Grab focus - if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) { - viewport->call_deferred("grab_focus"); - } } void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string, Margin p_side) { @@ -4466,7 +4468,13 @@ void CanvasItemEditor::_button_tool_select(int p_index) { } tool = (Tool)p_index; + viewport->update(); + _update_cursor(); + + // Request immediate refresh of cursor when using hot-keys to switch between tools + DisplayServer::CursorShape ds_cursor_shape = (DisplayServer::CursorShape)viewport->get_default_cursor_shape(); + DisplayServer::get_singleton()->cursor_set_shape(ds_cursor_shape); } void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, bool p_scale, bool p_on_existing) { diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 12abf05cf9..ea58fb1e36 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -492,6 +492,7 @@ private: bool _gui_input_hover(const Ref<InputEvent> &p_event); void _gui_input_viewport(const Ref<InputEvent> &p_event); + void _update_cursor(); void _selection_changed(); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 6165f39561..6f209c512e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1928,22 +1928,22 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { switch (nav_mode) { case NAVIGATION_PAN: { - _nav_pan(m, pan_gesture->get_delta()); + _nav_pan(pan_gesture, pan_gesture->get_delta()); } break; case NAVIGATION_ZOOM: { - _nav_zoom(m, pan_gesture->get_delta()); + _nav_zoom(pan_gesture, pan_gesture->get_delta()); } break; case NAVIGATION_ORBIT: { - _nav_orbit(m, pan_gesture->get_delta()); + _nav_orbit(pan_gesture, pan_gesture->get_delta()); } break; case NAVIGATION_LOOK: { - _nav_look(m, pan_gesture->get_delta()); + _nav_look(pan_gesture, pan_gesture->get_delta()); } break; @@ -5407,7 +5407,7 @@ void Node3DEditor::_update_gizmos_menu() { } String plugin_name = gizmo_plugins_by_name[i]->get_name(); const int plugin_state = gizmo_plugins_by_name[i]->get_state(); - gizmos_menu->add_multistate_item(TTR(plugin_name), 3, plugin_state, i); + gizmos_menu->add_multistate_item(plugin_name, 3, plugin_state, i); const int idx = gizmos_menu->get_item_index(i); gizmos_menu->set_item_tooltip( idx, diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f1bfd5617c..6b844ec0d0 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -701,7 +701,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { Ref<Script> script = current->get_edited_resource(); if (p_save) { // Do not try to save internal scripts - if (!(script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1)) { + if (!script.is_valid() || !(script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1)) { _menu_option(FILE_SAVE); } } @@ -1583,7 +1583,9 @@ void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) { List<int> bpoints; se->get_breakpoints(&bpoints); String base = script->get_path(); - ERR_CONTINUE(base.begins_with("local://") || base == ""); + if (base.begins_with("local://") || base == "") { + continue; + } for (List<int>::Element *E = bpoints.front(); E; E = E->next()) { p_breakpoints->push_back(base + ":" + itos(E->get() + 1)); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 5409efa954..f728974dd7 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -501,7 +501,7 @@ void ScriptTextEditor::_validate_script() { ScriptLanguage::Warning w = E->get(); Dictionary ignore_meta; - ignore_meta["line"] = w.line; + ignore_meta["line"] = w.start_line; ignore_meta["code"] = w.string_code.to_lower(); warnings_panel->push_cell(); warnings_panel->push_meta(ignore_meta); @@ -513,9 +513,9 @@ void ScriptTextEditor::_validate_script() { warnings_panel->pop(); // Cell. warnings_panel->push_cell(); - warnings_panel->push_meta(w.line - 1); + warnings_panel->push_meta(w.start_line - 1); warnings_panel->push_color(warnings_panel->get_theme_color("warning_color", "Editor")); - warnings_panel->add_text(TTR("Line") + " " + itos(w.line)); + warnings_panel->add_text(TTR("Line") + " " + itos(w.start_line)); warnings_panel->add_text(" (" + w.string_code + "):"); warnings_panel->pop(); // Color. warnings_panel->pop(); // Meta goto. diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 43ace737c0..18a107ff75 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -828,7 +828,7 @@ ThemeEditor::ThemeEditor() { type_hbc->add_child(type_edit); type_menu = memnew(MenuButton); type_menu->set_flat(false); - type_menu->set_text(".."); + type_menu->set_text("..."); type_hbc->add_child(type_menu); type_menu->get_popup()->connect("id_pressed", callable_mp(this, &ThemeEditor::_type_menu_cbk)); @@ -846,7 +846,7 @@ ThemeEditor::ThemeEditor() { name_hbc->add_child(name_edit); name_menu = memnew(MenuButton); type_menu->set_flat(false); - name_menu->set_text(".."); + name_menu->set_text("..."); name_hbc->add_child(name_menu); name_menu->get_popup()->connect("about_to_popup", callable_mp(this, &ThemeEditor::_name_menu_about_to_show)); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index b121a7ae3e..a613174ed9 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -698,7 +698,7 @@ void TileSetEditor::_on_tileset_toolbar_confirm() { List<int> ids; tileset->get_tile_list(&ids); - undo_redo->create_action(TTR(option == TOOL_TILESET_MERGE_SCENE ? "Merge Tileset from Scene" : "Create Tileset from Scene")); + undo_redo->create_action(option == TOOL_TILESET_MERGE_SCENE ? TTR("Merge Tileset from Scene") : TTR("Create Tileset from Scene")); undo_redo->add_do_method(this, "_undo_redo_import_scene", scene, option == TOOL_TILESET_MERGE_SCENE); undo_redo->add_undo_method(tileset.ptr(), "clear"); for (List<int>::Element *E = ids.front(); E; E = E->next()) { @@ -1977,7 +1977,7 @@ void TileSetEditor::_set_edited_shape_points(const Vector<Vector2> &points) { if (convex.is_valid()) { undo_redo->add_do_method(convex.ptr(), "set_points", points); undo_redo->add_undo_method(convex.ptr(), "set_points", _get_edited_shape_points()); - } else if (concave.is_valid()) { + } else if (concave.is_valid() && points.size() > 1) { PackedVector2Array segments; for (int i = 0; i < points.size() - 1; i++) { segments.push_back(points[i]); @@ -2669,7 +2669,7 @@ void TileSetEditor::draw_polygon_shapes() { workspace->draw_polygon(polygon, colors); if (coord == edited_shape_coord || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { - if (!creating_shape) { + if (!creating_shape && polygon.size() > 1) { for (int j = 0; j < polygon.size() - 1; j++) { workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1); } @@ -2706,13 +2706,11 @@ void TileSetEditor::draw_polygon_shapes() { } workspace->draw_polygon(polygon, colors); - if (!creating_shape) { - if (polygon.size() > 1) { - for (int j = 0; j < polygon.size() - 1; j++) { - workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1); - } - workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1); + if (!creating_shape && polygon.size() > 1) { + for (int j = 0; j < polygon.size() - 1; j++) { + workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1); } + workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1); } if (shape == edited_occlusion_shape) { draw_handles = true; @@ -2756,7 +2754,7 @@ void TileSetEditor::draw_polygon_shapes() { workspace->draw_polygon(polygon, colors); if (coord == edited_shape_coord) { - if (!creating_shape) { + if (!creating_shape && polygon.size() > 1) { for (int j = 0; j < polygon.size() - 1; j++) { workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1); } @@ -2796,7 +2794,7 @@ void TileSetEditor::draw_polygon_shapes() { } workspace->draw_polygon(polygon, colors); - if (!creating_shape) { + if (!creating_shape && polygon.size() > 1) { for (int j = 0; j < polygon.size() - 1; j++) { workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1); } @@ -2845,7 +2843,7 @@ void TileSetEditor::draw_polygon_shapes() { workspace->draw_polygon(polygon, colors); if (coord == edited_shape_coord) { - if (!creating_shape) { + if (!creating_shape && polygon.size() > 1) { for (int j = 0; j < polygon.size() - 1; j++) { workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1); } @@ -2863,7 +2861,7 @@ void TileSetEditor::draw_polygon_shapes() { } } - if (creating_shape) { + if (creating_shape && current_shape.size() > 1) { for (int j = 0; j < current_shape.size() - 1; j++) { workspace->draw_line(current_shape[j], current_shape[j + 1], Color(0, 1, 1), 1); } |