diff options
Diffstat (limited to 'editor')
30 files changed, 317 insertions, 107 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index def55d6057..4dff7d5b69 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -2547,6 +2547,15 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim) { step->set_read_only(false); snap->set_disabled(false); snap_mode->set_disabled(false); + + imported_anim_warning->hide(); + for (int i = 0; i < animation->get_track_count(); i++) { + if (animation->track_is_imported(i)) { + imported_anim_warning->show(); + break; + } + } + } else { hscroll->hide(); edit->set_disabled(true); @@ -3616,6 +3625,7 @@ void AnimationTrackEditor::_notification(int p_what) { snap->set_icon(get_icon("Snap", "EditorIcons")); view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); selected_filter->set_icon(get_icon("AnimationFilter", "EditorIcons")); + imported_anim_warning->set_icon(get_icon("NodeWarning", "EditorIcons")); main_panel->add_style_override("panel", get_stylebox("bg", "Tree")); } @@ -4909,6 +4919,15 @@ float AnimationTrackEditor::snap_time(float p_value) { return p_value; } +void AnimationTrackEditor::_show_imported_anim_warning() const { + + EditorNode::get_singleton()->show_warning(TTR("This animation belongs to an imported scene, so changes to imported tracks will not be saved.\n\n" + "To enable the ability to add custom tracks, navigate to the scene's import settings and set\n" + "\"Animation > Storage\" to \"Files\", enable \"Animation > Keep Custom Tracks\", then re-import.\n" + "Alternatively, use an import preset that imports animations to separate files."), + TTR("Warning: Editing imported animation")); +} + void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_animation_changed", &AnimationTrackEditor::_animation_changed); @@ -4947,6 +4966,7 @@ void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_view_group_toggle", &AnimationTrackEditor::_view_group_toggle); ClassDB::bind_method("_selection_changed", &AnimationTrackEditor::_selection_changed); ClassDB::bind_method("_snap_mode_changed", &AnimationTrackEditor::_snap_mode_changed); + ClassDB::bind_method("_show_imported_anim_warning", &AnimationTrackEditor::_show_imported_anim_warning); ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag"))); ADD_SIGNAL(MethodInfo("keying_changed")); @@ -5017,6 +5037,13 @@ AnimationTrackEditor::AnimationTrackEditor() { //timeline_vbox->add_child(memnew(HSeparator)); HBoxContainer *bottom_hb = memnew(HBoxContainer); add_child(bottom_hb); + + imported_anim_warning = memnew(Button); + imported_anim_warning->hide(); + imported_anim_warning->set_tooltip(TTR("Warning: Editing imported animation")); + imported_anim_warning->connect("pressed", this, "_show_imported_anim_warning"); + bottom_hb->add_child(imported_anim_warning); + bottom_hb->add_spacer(); selected_filter = memnew(ToolButton); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 5ac5999b68..a69659642c 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -309,6 +309,9 @@ class AnimationTrackEditor : public VBoxContainer { ToolButton *snap; OptionButton *snap_mode; + Button *imported_anim_warning; + void _show_imported_anim_warning() const; + void _snap_mode_changed(int p_mode); Vector<AnimationTrackEdit *> track_edits; Vector<AnimationTrackEditGroup *> groups; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index d655f52f5d..ec984e480a 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1297,6 +1297,8 @@ void CodeTextEditor::_on_settings_change() { text_editor->set_callhint_settings( EDITOR_DEF("text_editor/completion/put_callhint_tooltip_below_current_line", true), EDITOR_DEF("text_editor/completion/callhint_tooltip_offset", Vector2())); + + idle->set_wait_time(EDITOR_DEF("text_editor/completion/idle_parse_delay", 2.0)); } void CodeTextEditor::_text_changed_idle_timeout() { @@ -1411,7 +1413,7 @@ CodeTextEditor::CodeTextEditor() { idle = memnew(Timer); add_child(idle); idle->set_one_shot(true); - idle->set_wait_time(EDITOR_DEF("text_editor/completion/idle_parse_delay", 2)); + idle->set_wait_time(EDITOR_DEF("text_editor/completion/idle_parse_delay", 2.0)); code_complete_timer = memnew(Timer); add_child(code_complete_timer); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 26bd651c2b..ac42f15f7f 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -721,6 +721,7 @@ CreateDialog::CreateDialog() { favorites->connect("cell_selected", this, "_favorite_selected"); favorites->connect("item_activated", this, "_favorite_activated"); favorites->set_drag_forwarding(this); + favorites->add_constant_override("draw_guides", 1); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); @@ -733,6 +734,7 @@ CreateDialog::CreateDialog() { recent->set_hide_folding(true); recent->connect("cell_selected", this, "_history_selected"); recent->connect("item_activated", this, "_history_activated"); + recent->add_constant_override("draw_guides", 1); VBoxContainer *vbc = memnew(VBoxContainer); hsc->add_child(vbc); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 5df2b687cc..bde73e9268 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -225,9 +225,9 @@ void DependencyEditor::edit(const String &p_path) { popup_centered_ratio(); if (EditorNode::get_singleton()->is_scene_open(p_path)) { - EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will not take effect unless reloaded."), p_path.get_file())); + EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will only take effect when reloaded."), p_path.get_file())); } else if (ResourceCache::has(p_path)) { - EditorNode::get_singleton()->show_warning(vformat(TTR("Resource '%s' is in use.\nChanges will take effect when reloaded."), p_path.get_file())); + EditorNode::get_singleton()->show_warning(vformat(TTR("Resource '%s' is in use.\nChanges will only take effect when reloaded."), p_path.get_file())); } } diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 2f2b0d2cba..e0c90808a0 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -638,12 +638,12 @@ void EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_ String path = p_path; if (!FileAccess::exists(path)) { - EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n" + TTR("File does not exist.")); + EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist.")); return; } if (!path.begins_with("res://")) { - EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n" + TTR("Not in resource path.")); + EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("Not in resource path.")); return; } diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp index e8cf730796..e04bca2a9e 100644 --- a/editor/editor_dir_dialog.cpp +++ b/editor/editor_dir_dialog.cpp @@ -133,7 +133,7 @@ void EditorDirDialog::_make_dir() { TreeItem *ti = tree->get_selected(); if (!ti) { - mkdirerr->set_text(TTR("Please select a base directory first")); + mkdirerr->set_text(TTR("Please select a base directory first.")); mkdirerr->popup_centered_minsize(); return; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index df653d6d03..8703076a57 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1631,7 +1631,7 @@ void EditorNode::_edit_current() { editable_warning = TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); } else { if ((!get_edited_scene() || get_edited_scene()->get_filename() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") { - editable_warning = TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it will not be kept when saving the current scene."); + editable_warning = TTR("This resource belongs to a scene that was instanced or inherited.\nChanges to it won't be kept when saving the current scene."); } } } else if (current_res->get_path().is_resource_file()) { @@ -1656,14 +1656,14 @@ void EditorNode::_edit_current() { if (get_edited_scene() && get_edited_scene()->get_filename() != String()) { String source_scene = get_edited_scene()->get_filename(); if (FileAccess::exists(source_scene + ".import")) { - editable_warning = TTR("This scene was imported, so changes to it will not be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); + editable_warning = TTR("This scene was imported, so changes to it won't be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); } } } else { if (current_obj->is_class("ScriptEditorDebuggerInspectedObject")) { - editable_warning = TTR("This is a remote object so changes to it will not be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); + editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); capitalize = false; disable_folding = true; } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index b725bb1d96..e80d3e1b37 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -460,12 +460,14 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("text_editor/cursor/right_click_moves_caret", true); // Completion - _initial_set("text_editor/completion/idle_parse_delay", 2); + _initial_set("text_editor/completion/idle_parse_delay", 2.0); + hints["text_editor/completion/idle_parse_delay"] = PropertyInfo(Variant::REAL, "text_editor/completion/idle_parse_delay", PROPERTY_HINT_RANGE, "0.1, 10, 0.01"); _initial_set("text_editor/completion/auto_brace_complete", false); _initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true); _initial_set("text_editor/completion/callhint_tooltip_offset", Vector2()); _initial_set("text_editor/completion/complete_file_paths", true); _initial_set("text_editor/completion/add_type_hints", false); + _initial_set("text_editor/completion/use_single_quotes", false); // Help _initial_set("text_editor/help/show_help_index", true); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index aa2a03510d..ed6d6578ad 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -690,7 +690,7 @@ ExportTemplateManager::ExportTemplateManager() { remove_confirm->connect("confirmed", this, "_uninstall_template_confirm"); template_open = memnew(FileDialog); - template_open->set_title(TTR("Select template file")); + template_open->set_title(TTR("Select Template File")); template_open->add_filter("*.tpz ; Godot Export Templates"); template_open->set_access(FileDialog::ACCESS_FILESYSTEM); template_open->set_mode(FileDialog::MODE_OPEN_FILE); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index aade606412..6248680a52 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1208,7 +1208,7 @@ void FileSystemDock::_make_dir_confirm() { return; } else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.find("*") != -1 || dir_name.find("|") != -1 || dir_name.find(">") != -1 || dir_name.ends_with(".") || dir_name.ends_with(" ")) { - EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters")); + EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters.")); return; } diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 8f66cce39a..1de276b940 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1290,7 +1290,10 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale)); } - scene->set_name(p_options["nodes/root_name"]); + if (p_options["nodes/root_name"] != "Scene Root") + scene->set_name(p_options["nodes/root_name"]); + else + scene->set_name(p_save_path.get_file().get_basename()); err = OK; diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 52dec47343..fdf1103258 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -409,12 +409,12 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s float amp = Math::abs(ampChannelSum / (float)format_channels); if (!found && amp > limit) { - first = i / format_channels; + first = i; found = true; } if (found && amp > limit) { - last = i / format_channels; + last = i; } } diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 918f3a2149..5e8fb8e059 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -195,7 +195,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven //add triangle! if (blend_space->has_triangle(making_triangle[0], making_triangle[1], making_triangle[2])) { making_triangle.clear(); - EditorNode::get_singleton()->show_warning(TTR("Triangle already exists")); + EditorNode::get_singleton()->show_warning(TTR("Triangle already exists.")); return; } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index f13c2170ea..bfee76492b 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -949,7 +949,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { filter_dialog->add_child(filter_vbox); filter_enabled = memnew(CheckBox); - filter_enabled->set_text(TTR("Enable filtering")); + filter_enabled->set_text(TTR("Enable Filtering")); filter_enabled->connect("pressed", this, "_filter_toggled"); filter_vbox->add_child(filter_enabled); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index ab5ff7dee4..88bb8e38fe 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3433,7 +3433,7 @@ void CanvasItemEditor::_notification(int p_what) { p->add_separator(); p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHORS_AND_MARGINS_PRESET_WIDE); p->add_separator(); - p->add_submenu_item(TTR("Anchors only"), "Anchors"); + p->add_submenu_item(TTR("Anchors Only"), "Anchors"); p->set_item_icon(20, get_icon("Anchor", "EditorIcons")); anchors_popup->clear(); @@ -4811,24 +4811,24 @@ 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/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_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap...")), SNAP_CONFIGURE); 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); - p->add_submenu_item(TTR("Smart snapping"), "SmartSnapping"); + p->add_submenu_item(TTR("Smart Snapping"), "SmartSnapping"); smartsnap_config_popup = memnew(PopupMenu); p->add_child(smartsnap_config_popup); smartsnap_config_popup->set_name("SmartSnapping"); smartsnap_config_popup->connect("id_pressed", this, "_popup_callback"); smartsnap_config_popup->set_hide_on_checkable_item_selection(false); - smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_parent", TTR("Snap to parent")), SNAP_USE_NODE_PARENT); - smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_anchors", TTR("Snap to node anchor")), SNAP_USE_NODE_ANCHORS); - smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_sides", TTR("Snap to node sides")), SNAP_USE_NODE_SIDES); - smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_center", TTR("Snap to node center")), SNAP_USE_NODE_CENTER); - smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_other_nodes", TTR("Snap to other nodes")), SNAP_USE_OTHER_NODES); - smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_guides", TTR("Snap to guides")), SNAP_USE_GUIDES); + smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_parent", TTR("Snap to Parent")), SNAP_USE_NODE_PARENT); + smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_anchors", TTR("Snap to Node Anchor")), SNAP_USE_NODE_ANCHORS); + smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_sides", TTR("Snap to Node Sides")), SNAP_USE_NODE_SIDES); + smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_center", TTR("Snap to Node Center")), SNAP_USE_NODE_CENTER); + smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_other_nodes", TTR("Snap to Other Nodes")), SNAP_USE_OTHER_NODES); + smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_guides", TTR("Snap to Guides")), SNAP_USE_GUIDES); hb->add_child(memnew(VSeparator)); @@ -5466,7 +5466,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte selector = memnew(AcceptDialog); editor->get_gui_base()->add_child(selector); - selector->set_title(TTR("Change default type")); + selector->set_title(TTR("Change Default Type")); selector->connect("confirmed", this, "_on_change_type_confirmed"); selector->connect("popup_hide", this, "_on_change_type_closed"); diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 2c0dd5f1db..55feb40c2c 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -53,11 +53,11 @@ CurveEditor::CurveEditor() { _presets_menu = memnew(PopupMenu); _presets_menu->set_name("_presets_menu"); - _presets_menu->add_item(TTR("Flat0"), PRESET_FLAT0); - _presets_menu->add_item(TTR("Flat1"), PRESET_FLAT1); + _presets_menu->add_item(TTR("Flat 0"), PRESET_FLAT0); + _presets_menu->add_item(TTR("Flat 1"), PRESET_FLAT1); _presets_menu->add_item(TTR("Linear"), PRESET_LINEAR); - _presets_menu->add_item(TTR("Ease in"), PRESET_EASE_IN); - _presets_menu->add_item(TTR("Ease out"), PRESET_EASE_OUT); + _presets_menu->add_item(TTR("Ease In"), PRESET_EASE_IN); + _presets_menu->add_item(TTR("Ease Out"), PRESET_EASE_OUT); _presets_menu->add_item(TTR("Smoothstep"), PRESET_SMOOTHSTEP); _presets_menu->connect("id_pressed", this, "_on_preset_item_selected"); _context_menu->add_child(_presets_menu); @@ -330,10 +330,10 @@ void CurveEditor::open_context_menu(Vector2 pos) { _context_menu->clear(); if (_curve_ref.is_valid()) { - _context_menu->add_item(TTR("Add point"), CONTEXT_ADD_POINT); + _context_menu->add_item(TTR("Add Point"), CONTEXT_ADD_POINT); if (_selected_point >= 0) { - _context_menu->add_item(TTR("Remove point"), CONTEXT_REMOVE_POINT); + _context_menu->add_item(TTR("Remove Point"), CONTEXT_REMOVE_POINT); if (_selected_tangent != TANGENT_NONE) { _context_menu->add_separator(); @@ -351,12 +351,12 @@ void CurveEditor::open_context_menu(Vector2 pos) { _context_menu->add_separator(); if (_selected_point > 0) { - _context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR); + _context_menu->add_check_item(TTR("Left Linear"), CONTEXT_LEFT_LINEAR); _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LEFT_LINEAR), _curve_ref->get_point_left_mode(_selected_point) == Curve::TANGENT_LINEAR); } if (_selected_point + 1 < _curve_ref->get_point_count()) { - _context_menu->add_check_item(TTR("Right linear"), CONTEXT_RIGHT_LINEAR); + _context_menu->add_check_item(TTR("Right Linear"), CONTEXT_RIGHT_LINEAR); _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_RIGHT_LINEAR), _curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR); } @@ -366,7 +366,7 @@ void CurveEditor::open_context_menu(Vector2 pos) { _context_menu->add_separator(); } - _context_menu->add_submenu_item(TTR("Load preset"), _presets_menu->get_name()); + _context_menu->add_submenu_item(TTR("Load Preset"), _presets_menu->get_name()); _context_menu->set_size(Size2(0, 0)); _context_menu->popup(); diff --git a/editor/plugins/physical_bone_plugin.cpp b/editor/plugins/physical_bone_plugin.cpp index 9ea37aceb9..96681a105f 100644 --- a/editor/plugins/physical_bone_plugin.cpp +++ b/editor/plugins/physical_bone_plugin.cpp @@ -61,7 +61,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) : button_transform_joint = memnew(ToolButton); spatial_editor_hb->add_child(button_transform_joint); - button_transform_joint->set_text(TTR("Move joint")); + button_transform_joint->set_text(TTR("Move Joint")); button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_icon("PhysicalBone", "EditorIcons")); button_transform_joint->set_toggle_mode(true); button_transform_joint->connect("toggled", this, "_on_toggle_button_transform_joint"); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d84a5a1e48..0982da784f 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2950,6 +2950,7 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw); ClassDB::bind_method(D_METHOD("drop_data_fw", "point", "data", "from"), &ScriptEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("goto_line", "line_number"), &ScriptEditor::_goto_script_line2); ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script); ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts); ClassDB::bind_method(D_METHOD("open_script_create_dialog", "base_name", "base_path"), &ScriptEditor::open_script_create_dialog); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index abb52f8359..29a54f815d 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -115,6 +115,9 @@ void TileMapEditor::_update_button_tool() { default: break; } + + if (tool != TOOL_PICKING) + last_tool = tool; } void TileMapEditor::_button_tool_select(int p_tool) { @@ -237,22 +240,23 @@ void TileMapEditor::set_selected_tiles(Vector<int> p_tiles) { palette->ensure_current_is_visible(); } -void TileMapEditor::_create_set_cell_undo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) { +Dictionary TileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord) { + + Dictionary cell; - Dictionary cell_old; - Dictionary cell_new; + cell["id"] = tile; + cell["flip_h"] = flip_x; + cell["flip_y"] = flip_y; + cell["transpose"] = transpose; + cell["auto_coord"] = autotile_coord; - cell_old["id"] = p_cell_old.idx; - cell_old["flip_h"] = p_cell_old.xf; - cell_old["flip_y"] = p_cell_old.yf; - cell_old["transpose"] = p_cell_old.tr; - cell_old["auto_coord"] = p_cell_old.ac; + return cell; +} - cell_new["id"] = p_cell_new.idx; - cell_new["flip_h"] = p_cell_new.xf; - cell_new["flip_y"] = p_cell_new.yf; - cell_new["transpose"] = p_cell_new.tr; - cell_new["auto_coord"] = p_cell_new.ac; +void TileMapEditor::_create_set_cell_undo_redo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) { + + Dictionary cell_old = _create_cell_dictionary(p_cell_old.idx, p_cell_old.xf, p_cell_old.yf, p_cell_old.tr, p_cell_old.ac); + Dictionary cell_new = _create_cell_dictionary(p_cell_new.idx, p_cell_new.xf, p_cell_new.yf, p_cell_new.tr, p_cell_new.ac); undo_redo->add_undo_method(node, "_set_celld", p_vec, cell_old); undo_redo->add_do_method(node, "_set_celld", p_vec, cell_new); @@ -268,7 +272,7 @@ void TileMapEditor::_finish_undo() { if (undo_data.size()) { for (Map<Point2i, CellOp>::Element *E = undo_data.front(); E; E = E->next()) { - _create_set_cell_undo(E->key(), E->get(), _get_op_from_cell(E->key())); + _create_set_cell_undo_redo(E->key(), E->get(), _get_op_from_cell(E->key())); } undo_data.clear(); @@ -316,10 +320,7 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p } } - Variant v_pos_x = p_pos.x, v_pos_y = p_pos.y, v_tile = p_value, v_flip_h = p_flip_h, v_flip_v = p_flip_v, v_transpose = p_transpose, v_autotile_coord = Vector2(p_autotile_coord.x, p_autotile_coord.y); - const Variant *args[7] = { &v_pos_x, &v_pos_y, &v_tile, &v_flip_h, &v_flip_v, &v_transpose, &v_autotile_coord }; - Variant::CallError ce; - node->call("set_cell", args, 7, ce); + node->_set_celld(p_pos, _create_cell_dictionary(p_value, p_flip_h, p_flip_v, p_transpose, p_autotile_coord)); if (manual_autotile || (p_value != -1 && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE)) { if (current != -1) { @@ -949,11 +950,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (mb->get_shift()) { -#ifdef APPLE_STYLE_KEYS if (mb->get_command()) -#else - if (mb->get_control()) -#endif tool = TOOL_RECTANGLE_PAINT; else tool = TOOL_LINE_PAINT; @@ -964,11 +961,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { _update_button_tool(); return true; } -#ifdef APPLE_STYLE_KEYS + if (mb->get_command()) { -#else - if (mb->get_control()) { -#endif tool = TOOL_PICKING; _pick_tile(over_tile); _update_button_tool(); @@ -1136,11 +1130,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { _start_undo(TTR("Erase TileMap")); if (mb->get_shift()) { -#ifdef APPLE_STYLE_KEYS if (mb->get_command()) -#else - if (mb->get_control()) -#endif tool = TOOL_RECTANGLE_ERASE; else tool = TOOL_LINE_ERASE; @@ -1344,6 +1334,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { if (k.is_valid() && k->is_pressed()) { + if (last_tool == TOOL_NONE && tool == TOOL_PICKING && k->get_scancode() == KEY_SHIFT && k->get_command()) { + // trying to draw a rectangle with the painting tool, so change to the correct tool + tool = last_tool; + + CanvasItemEditor::get_singleton()->update_viewport(); + _update_button_tool(); + } + if (k->get_scancode() == KEY_ESCAPE) { if (tool == TOOL_PASTING) @@ -1448,8 +1446,30 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { CanvasItemEditor::get_singleton()->update_viewport(); return true; } - } + } else if (k.is_valid()) { // release event + + if (tool == TOOL_NONE) { + + if (k->get_scancode() == KEY_SHIFT && k->get_command()) { + tool = TOOL_PICKING; + _update_button_tool(); + } + } else if (tool == TOOL_PICKING) { + +#ifdef APPLE_STYLE_KEYS + if (k->get_scancode() == KEY_META) { +#else + if (k->get_scancode() == KEY_CONTROL) { +#endif + // go back to that last tool if KEY_CONTROL was released + tool = last_tool; + + CanvasItemEditor::get_singleton()->update_viewport(); + _update_button_tool(); + } + } + } return false; } @@ -1923,6 +1943,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { // Tools paint_button = memnew(ToolButton); paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P)); + paint_button->set_tooltip(TTR("Shift+RMB: Line Draw\nShift+Ctrl+RMB: Rectangle Paint")); paint_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_NONE)); paint_button->set_toggle_mode(true); toolbar->add_child(paint_button); diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 3bc10861f0..fcdada1111 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -105,6 +105,7 @@ class TileMapEditor : public VBoxContainer { CheckBox *manual_button; Tool tool; + Tool last_tool; bool selection_active; bool mouse_over; @@ -192,9 +193,10 @@ class TileMapEditor : public VBoxContainer { void _palette_selected(int index); void _palette_multi_selected(int index, bool selected); + Dictionary _create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord); void _start_undo(const String &p_action); void _finish_undo(); - void _create_set_cell_undo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new); + void _create_set_cell_undo_redo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new); void _set_cell(const Point2i &p_pos, Vector<int> p_values, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false, const Point2i p_autotile_coord = Point2()); void _canvas_mouse_enter(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 095ec891cd..66766f7ccf 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -798,7 +798,7 @@ public: create_dir = memnew(Button); pnhb->add_child(create_dir); - create_dir->set_text(TTR("Create folder")); + create_dir->set_text(TTR("Create Folder")); create_dir->connect("pressed", this, "_create_folder"); path_container = memnew(VBoxContainer); @@ -987,6 +987,24 @@ void ProjectManager::_update_project_buttons() { open_btn->set_disabled(empty_selection); rename_btn->set_disabled(empty_selection); run_btn->set_disabled(empty_selection); + + bool missing_projects = false; + Map<String, String> list_all_projects; + for (int i = 0; i < scroll_children->get_child_count(); i++) { + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_children->get_child(i)); + if (hb) { + list_all_projects.insert(hb->get_meta("name"), hb->get_meta("main_scene")); + } + } + for (Map<String, String>::Element *E = list_all_projects.front(); E; E = E->next()) { + String project_name = E->key().replace("::", "/") + "/project.godot"; + if (!FileAccess::exists(project_name)) { + missing_projects = true; + break; + } + } + + erase_missing_btn->set_visible(missing_projects); } void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { @@ -1530,13 +1548,13 @@ void ProjectManager::_open_selected_projects_ask() { // Check if the config_version property was empty or 0 if (config_version == 0) { - ask_update_settings->set_text(vformat(TTR("The following project settings file does not specify the version of Godot through which it was created.\n\n%s\n\nIf you proceed with opening it, it will be converted to Godot's current configuration file format.\nWarning: You will not be able to open the project with previous versions of the engine anymore."), conf)); + ask_update_settings->set_text(vformat(TTR("The following project settings file does not specify the version of Godot through which it was created.\n\n%s\n\nIf you proceed with opening it, it will be converted to Godot's current configuration file format.\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf)); ask_update_settings->popup_centered_minsize(); return; } // Check if we need to convert project settings from an earlier engine version if (config_version < ProjectSettings::CONFIG_VERSION) { - ask_update_settings->set_text(vformat(TTR("The following project settings file was generated by an older engine version, and needs to be converted for this version:\n\n%s\n\nDo you want to convert it?\nWarning: You will not be able to open the project with previous versions of the engine anymore."), conf)); + ask_update_settings->set_text(vformat(TTR("The following project settings file was generated by an older engine version, and needs to be converted for this version:\n\n%s\n\nDo you want to convert it?\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf)); ask_update_settings->popup_centered_minsize(); return; } @@ -1557,7 +1575,7 @@ void ProjectManager::_run_project_confirm() { const String &selected_main = E->get(); if (selected_main == "") { - run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in \"Project Settings\" under the \"Application\" category.")); + run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in the Project Settings under the \"Application\" category.")); run_error_diag->popup_centered(); return; } @@ -1597,7 +1615,7 @@ void ProjectManager::_run_project() { } if (selected_list.size() > 1) { - multi_run_ask->set_text(TTR("Are you sure to run more than one project?")); + multi_run_ask->set_text(vformat(TTR("Are you sure to run %d projects at once?"), selected_list.size())); multi_run_ask->popup_centered_minsize(); } else { _run_project_confirm(); @@ -1700,15 +1718,61 @@ void ProjectManager::_erase_project_confirm() { _load_recent_projects(); } +void ProjectManager::_erase_missing_projects_confirm() { + + Map<String, String> list_all_projects; + for (int i = 0; i < scroll_children->get_child_count(); i++) { + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_children->get_child(i)); + if (hb) { + list_all_projects.insert(hb->get_meta("name"), hb->get_meta("main_scene")); + } + } + + if (list_all_projects.size() == 0) { + return; + } + + int deleted_projects = 0; + int remaining_projects = 0; + for (Map<String, String>::Element *E = list_all_projects.front(); E; E = E->next()) { + String project_name = E->key().replace("::", "/") + "/project.godot"; + if (!FileAccess::exists(project_name)) { + deleted_projects++; + EditorSettings::get_singleton()->erase("projects/" + E->key()); + EditorSettings::get_singleton()->erase("favorite_projects/" + E->key()); + } else { + remaining_projects++; + } + } + print_line("Deleted " + itos(deleted_projects) + " projects, remaining " + itos(remaining_projects) + " projects"); + EditorSettings::get_singleton()->save(); + selected_list.clear(); + last_clicked = ""; + _load_recent_projects(); +} + void ProjectManager::_erase_project() { if (selected_list.size() == 0) return; - erase_ask->set_text(TTR("Remove project from the list? (Folder contents will not be modified)")); + String confirm_message; + if (selected_list.size() >= 2) { + confirm_message = vformat(TTR("Remove %d projects from the list?\nThe project folders' contents won't be modified."), selected_list.size()); + } else { + confirm_message = TTR("Remove this project from the list?\nThe project folder's contents won't be modified."); + } + + erase_ask->set_text(confirm_message); erase_ask->popup_centered_minsize(); } +void ProjectManager::_erase_missing_projects() { + + erase_missing_ask->set_text(TTR("Remove all missing projects from the list? (Folders contents will not be modified)")); + erase_missing_ask->popup_centered_minsize(); +} + void ProjectManager::_language_selected(int p_id) { String lang = language_btn->get_item_metadata(p_id); @@ -1716,7 +1780,7 @@ void ProjectManager::_language_selected(int p_id) { language_btn->set_text(lang); language_btn->set_icon(get_icon("Environment", "EditorIcons")); - language_restart_ask->set_text(TTR("Language changed.\nThe UI will update next time the editor or project manager starts.")); + language_restart_ask->set_text(TTR("Language changed.\nThe interface will update after restarting the editor or project manager.")); language_restart_ask->popup_centered(); } @@ -1777,7 +1841,8 @@ void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) { if (confirm) { multi_scan_ask->get_ok()->disconnect("pressed", this, "_scan_multiple_folders"); multi_scan_ask->get_ok()->connect("pressed", this, "_scan_multiple_folders", varray(folders)); - multi_scan_ask->set_text(vformat(TTR("You are about the scan %s folders for existing Godot projects. Do you confirm?"), folders.size())); + multi_scan_ask->set_text( + vformat(TTR("Are you sure to scan %s folders for existing Godot projects?\nThis could take a while."), folders.size())); multi_scan_ask->popup_centered_minsize(); } else { _scan_multiple_folders(folders); @@ -1804,7 +1869,9 @@ void ProjectManager::_bind_methods() { ClassDB::bind_method("_new_project", &ProjectManager::_new_project); ClassDB::bind_method("_rename_project", &ProjectManager::_rename_project); ClassDB::bind_method("_erase_project", &ProjectManager::_erase_project); + ClassDB::bind_method("_erase_missing_projects", &ProjectManager::_erase_missing_projects); ClassDB::bind_method("_erase_project_confirm", &ProjectManager::_erase_project_confirm); + ClassDB::bind_method("_erase_missing_projects_confirm", &ProjectManager::_erase_missing_projects_confirm); ClassDB::bind_method("_language_selected", &ProjectManager::_language_selected); ClassDB::bind_method("_restart_confirm", &ProjectManager::_restart_confirm); ClassDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog); @@ -2042,6 +2109,12 @@ ProjectManager::ProjectManager() { erase->connect("pressed", this, "_erase_project"); erase_btn = erase; + Button *erase_missing = memnew(Button); + erase_missing->set_text(TTR("Remove Missing")); + tree_vb->add_child(erase_missing); + erase_missing->connect("pressed", this, "_erase_missing_projects"); + erase_missing_btn = erase_missing; + tree_vb->add_spacer(); if (StreamPeerSSL::is_available()) { @@ -2105,6 +2178,11 @@ ProjectManager::ProjectManager() { language_restart_ask->get_cancel()->set_text(TTR("Continue")); gui_base->add_child(language_restart_ask); + erase_missing_ask = memnew(ConfirmationDialog); + erase_missing_ask->get_ok()->set_text(TTR("Remove All")); + erase_missing_ask->get_ok()->connect("pressed", this, "_erase_missing_projects_confirm"); + gui_base->add_child(erase_missing_ask); + erase_ask = memnew(ConfirmationDialog); erase_ask->get_ok()->set_text(TTR("Remove")); erase_ask->get_ok()->connect("pressed", this, "_erase_project_confirm"); @@ -2153,7 +2231,7 @@ ProjectManager::ProjectManager() { gui_base->add_child(dialog_error); open_templates = memnew(ConfirmationDialog); - open_templates->set_text(TTR("You don't currently have any projects.\nWould you like to explore the official example projects in the Asset Library?")); + open_templates->set_text(TTR("You currently don't have any projects.\nWould you like to explore official example projects in the Asset Library?")); open_templates->get_ok()->set_text(TTR("Open Asset Library")); open_templates->connect("confirmed", this, "_open_asset_library"); add_child(open_templates); diff --git a/editor/project_manager.h b/editor/project_manager.h index 1fdd7dbe06..382e9fc8fb 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -45,6 +45,7 @@ class ProjectManager : public Control { GDCLASS(ProjectManager, Control); Button *erase_btn; + Button *erase_missing_btn; Button *open_btn; Button *rename_btn; Button *run_btn; @@ -57,6 +58,7 @@ class ProjectManager : public Control { FileDialog *scan_dir; ConfirmationDialog *language_restart_ask; ConfirmationDialog *erase_ask; + ConfirmationDialog *erase_missing_ask; ConfirmationDialog *multi_open_ask; ConfirmationDialog *multi_run_ask; ConfirmationDialog *multi_scan_ask; @@ -89,7 +91,9 @@ class ProjectManager : public Control { void _new_project(); void _rename_project(); void _erase_project(); + void _erase_missing_projects(); void _erase_project_confirm(); + void _erase_missing_projects_confirm(); void _update_project_buttons(); void _language_selected(int p_id); void _restart_confirm(); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 2d7ad8bc04..71bddebcf5 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -181,7 +181,7 @@ void ProjectSettingsEditor::_action_edited() { ti->set_text(0, old_name); add_at = "input/" + old_name; - message->set_text(vformat(TTR("Action '%s' already exists!"), new_name)); + message->set_text(vformat(TTR("An action with the name '%s' already exists."), new_name)); message->popup_centered(Size2(300, 100) * EDSCALE); return; } @@ -927,7 +927,7 @@ void ProjectSettingsEditor::_action_check(String p_action) { } if (ProjectSettings::get_singleton()->has_setting("input/" + p_action)) { - action_add_error->set_text(TTR("Already existing")); + action_add_error->set_text(vformat(TTR("An action with the name '%s' already exists."), p_action)); action_add_error->show(); action_add->set_disabled(true); return; @@ -1592,6 +1592,7 @@ void ProjectSettingsEditor::_toggle_search_bar(bool p_pressed) { search_box->select_all(); } else { + search_box->clear(); search_bar->hide(); add_prop_bar->show(); } @@ -1785,7 +1786,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER); restart_hb->add_child(restart_icon); restart_label = memnew(Label); - restart_label->set_text(TTR("Editor must be restarted for changes to take effect")); + restart_label->set_text(TTR("The editor must be restarted for changes to take effect.")); restart_hb->add_child(restart_label); restart_hb->add_spacer(); Button *restart_button = memnew(Button); @@ -2003,8 +2004,8 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { tvb->add_child(tmc); translation_locale_filter_mode = memnew(OptionButton); - translation_locale_filter_mode->add_item(TTR("Show all locales"), SHOW_ALL_LOCALES); - translation_locale_filter_mode->add_item(TTR("Show only selected locales"), SHOW_ONLY_SELECTED_LOCALES); + translation_locale_filter_mode->add_item(TTR("Show All Locales"), SHOW_ALL_LOCALES); + translation_locale_filter_mode->add_item(TTR("Show Selected Locales Only"), SHOW_ONLY_SELECTED_LOCALES); translation_locale_filter_mode->select(0); tmc->add_margin_child(TTR("Filter mode:"), translation_locale_filter_mode); translation_locale_filter_mode->connect("item_selected", this, "_translation_filter_mode_changed"); diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index c197248c35..dc2f098333 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -255,14 +255,19 @@ void EditorQuickOpen::_confirmed() { void EditorQuickOpen::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { + switch (p_what) { - connect("confirmed", this, "_confirmed"); + case NOTIFICATION_ENTER_TREE: { - search_box->set_right_icon(get_icon("Search", "EditorIcons")); - search_box->set_clear_button_enabled(true); - } else if (p_what == NOTIFICATION_EXIT_TREE) { - disconnect("confirmed", this, "_confirmed"); + connect("confirmed", this, "_confirmed"); + + search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_box->set_clear_button_enabled(true); + } break; + case NOTIFICATION_EXIT_TREE: { + + disconnect("confirmed", this, "_confirmed"); + } break; } } @@ -297,6 +302,7 @@ EditorQuickOpen::EditorQuickOpen() { set_hide_on_ok(false); search_options->connect("item_activated", this, "_confirmed"); search_options->set_hide_root(true); + search_options->add_constant_override("draw_guides", 1); ei = "EditorIcons"; ot = "Object"; add_directories = false; diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index ed1eec95dc..858b14a733 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -113,7 +113,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und collapse_theme->set_icon("unchecked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowRight", "EditorIcons")); CheckBox *chk_collapse_features = memnew(CheckBox); - chk_collapse_features->set_text(TTR("Advanced options")); + chk_collapse_features->set_text(TTR("Advanced Options")); chk_collapse_features->set_theme(collapse_theme); chk_collapse_features->set_focus_mode(FOCUS_NONE); vbc->add_child(chk_collapse_features); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 1dca542138..a41f10607b 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2625,6 +2625,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel add_child(rename_dialog); script_create_dialog = memnew(ScriptCreateDialog); + script_create_dialog->set_inheritance_base_type("Node"); add_child(script_create_dialog); script_create_dialog->connect("script_created", this, "_script_created"); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 5ab0efaee3..292cb8ddc3 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -34,6 +34,7 @@ #include "core/os/file_access.h" #include "core/project_settings.h" #include "core/script_language.h" +#include "editor/create_dialog.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor_file_system.h" @@ -45,11 +46,28 @@ void ScriptCreateDialog::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { path_button->set_icon(get_icon("Folder", "EditorIcons")); parent_browse_button->set_icon(get_icon("Folder", "EditorIcons")); + parent_search_button->set_icon(get_icon("ClassList", "EditorIcons")); status_panel->add_style_override("panel", get_stylebox("bg", "Tree")); } break; } } +void ScriptCreateDialog::_path_hbox_sorted() { + if (is_visible()) { + int filename_start_pos = initial_bp.find_last("/") + 1; + int filename_end_pos = initial_bp.length(); + + file_path->select(filename_start_pos, filename_end_pos); + + // First set cursor to the end of line to scroll LineEdit view + // to the right and then set the actual cursor position. + file_path->set_cursor_position(file_path->get_text().length()); + file_path->set_cursor_position(filename_start_pos); + + file_path->grab_focus(); + } +} + bool ScriptCreateDialog::_can_be_built_in() { return (supports_built_in && built_in_enabled); } @@ -77,6 +95,11 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_ _path_changed(file_path->get_text()); } +void ScriptCreateDialog::set_inheritance_base_type(const String &p_base) { + + base_type = p_base; +} + bool ScriptCreateDialog::_validate(const String &p_string) { if (p_string.length() == 0) @@ -322,7 +345,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) { if (p_save) { file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE); - file_browse->set_title(TTR("Open Script/Choose Location")); + file_browse->set_title(TTR("Open Script / Choose Location")); file_browse->get_ok()->set_text(TTR("Open")); } else { file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE); @@ -362,6 +385,17 @@ void ScriptCreateDialog::_file_selected(const String &p_file) { } } +void ScriptCreateDialog::_create() { + + parent_name->set_text(select_class->get_selected_type()); +} + +void ScriptCreateDialog::_browse_class_in_tree() { + + select_class->set_base_type(base_type); + select_class->popup_create(true); +} + void ScriptCreateDialog::_path_changed(const String &p_path) { is_path_valid = false; @@ -369,27 +403,27 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { String p = p_path.strip_edges(); if (p == "") { - _msg_path_valid(false, TTR("Path is empty")); + _msg_path_valid(false, TTR("Path is empty.")); _update_dialog(); return; } if (p.get_file().get_basename() == "") { - _msg_path_valid(false, TTR("Filename is empty")); + _msg_path_valid(false, TTR("Filename is empty.")); _update_dialog(); return; } p = ProjectSettings::get_singleton()->localize_path(p); if (!p.begins_with("res://")) { - _msg_path_valid(false, TTR("Path is not local")); + _msg_path_valid(false, TTR("Path is not local.")); _update_dialog(); return; } DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); if (d->change_dir(p.get_base_dir()) != OK) { - _msg_path_valid(false, TTR("Invalid base path")); + _msg_path_valid(false, TTR("Invalid base path.")); memdelete(d); _update_dialog(); return; @@ -402,11 +436,11 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { if (f->dir_exists(p)) { is_new_script_created = false; is_path_valid = false; - _msg_path_valid(false, TTR("Directory of the same name exists")); + _msg_path_valid(false, TTR("A directory with the same name exists.")); } else if (f->file_exists(p)) { is_new_script_created = false; is_path_valid = true; - _msg_path_valid(true, TTR("File exists, will be reused")); + _msg_path_valid(true, TTR("File exists, it will be reused.")); } memdelete(f); _update_dialog(); @@ -438,13 +472,13 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { } if (!found) { - _msg_path_valid(false, TTR("Invalid extension")); + _msg_path_valid(false, TTR("Invalid extension.")); _update_dialog(); return; } if (!match) { - _msg_path_valid(false, TTR("Wrong extension chosen")); + _msg_path_valid(false, TTR("Wrong extension chosen.")); _update_dialog(); return; } @@ -496,20 +530,20 @@ void ScriptCreateDialog::_update_dialog() { get_ok()->set_disabled(true); if (!is_built_in) { if (!is_path_valid) { - _msg_script_valid(false, TTR("Invalid Path")); + _msg_script_valid(false, TTR("Invalid path.")); script_ok = false; } } if (has_named_classes && (is_new_script_created && !is_class_name_valid)) { - _msg_script_valid(false, TTR("Invalid class name")); + _msg_script_valid(false, TTR("Invalid class name.")); script_ok = false; } if (!is_parent_name_valid) { - _msg_script_valid(false, TTR("Invalid inherited parent name or path")); + _msg_script_valid(false, TTR("Invalid inherited parent name or path.")); script_ok = false; } if (script_ok) { - _msg_script_valid(true, TTR("Script valid")); + _msg_script_valid(true, TTR("Script is valid.")); get_ok()->set_disabled(false); } @@ -562,7 +596,7 @@ void ScriptCreateDialog::_update_dialog() { parent_name->set_editable(true); parent_browse_button->set_disabled(false); internal->set_disabled(!_can_be_built_in()); - _msg_path_valid(true, TTR("Built-in script (into scene file)")); + _msg_path_valid(true, TTR("Built-in script (into scene file).")); } else if (is_new_script_created) { // New Script Created get_ok()->set_text(TTR("Create")); @@ -570,7 +604,7 @@ void ScriptCreateDialog::_update_dialog() { parent_browse_button->set_disabled(false); internal->set_disabled(!_can_be_built_in()); if (is_path_valid) { - _msg_path_valid(true, TTR("Create new script file")); + _msg_path_valid(true, TTR("Will create a new script file.")); } } else { // Script Loaded @@ -579,13 +613,14 @@ void ScriptCreateDialog::_update_dialog() { parent_browse_button->set_disabled(true); internal->set_disabled(!_can_be_built_in()); if (is_path_valid) { - _msg_path_valid(true, TTR("Load existing script file")); + _msg_path_valid(true, TTR("Will load an existing script file.")); } } } void ScriptCreateDialog::_bind_methods() { + ClassDB::bind_method("_path_hbox_sorted", &ScriptCreateDialog::_path_hbox_sorted); ClassDB::bind_method("_class_name_changed", &ScriptCreateDialog::_class_name_changed); ClassDB::bind_method("_parent_name_changed", &ScriptCreateDialog::_parent_name_changed); ClassDB::bind_method("_lang_changed", &ScriptCreateDialog::_lang_changed); @@ -595,6 +630,8 @@ void ScriptCreateDialog::_bind_methods() { ClassDB::bind_method("_path_changed", &ScriptCreateDialog::_path_changed); ClassDB::bind_method("_path_entered", &ScriptCreateDialog::_path_entered); ClassDB::bind_method("_template_changed", &ScriptCreateDialog::_template_changed); + ClassDB::bind_method("_create", &ScriptCreateDialog::_create); + ClassDB::bind_method("_browse_class_in_tree", &ScriptCreateDialog::_browse_class_in_tree); ClassDB::bind_method(D_METHOD("config", "inherits", "path", "built_in_enabled"), &ScriptCreateDialog::config, DEFVAL(true)); @@ -707,12 +744,18 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Inherits */ + base_type = "Object"; + hb = memnew(HBoxContainer); hb->set_h_size_flags(SIZE_EXPAND_FILL); parent_name = memnew(LineEdit); parent_name->connect("text_changed", this, "_parent_name_changed"); parent_name->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(parent_name); + parent_search_button = memnew(Button); + parent_search_button->set_flat(true); + parent_search_button->connect("pressed", this, "_browse_class_in_tree"); + hb->add_child(parent_search_button); parent_browse_button = memnew(Button); parent_browse_button->set_flat(true); parent_browse_button->connect("pressed", this, "_browse_path", varray(true, false)); @@ -760,6 +803,7 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Path */ hb = memnew(HBoxContainer); + hb->connect("sort_children", this, "_path_hbox_sorted"); file_path = memnew(LineEdit); file_path->connect("text_changed", this, "_path_changed"); file_path->connect("text_entered", this, "_path_entered"); @@ -777,6 +821,10 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Dialog Setup */ + select_class = memnew(CreateDialog); + select_class->connect("create", this, "_create"); + add_child(select_class); + file_browse = memnew(EditorFileDialog); file_browse->connect("file_selected", this, "_file_selected"); file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE); diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index 15e838d69f..f5c335c00a 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -40,6 +40,8 @@ #include "scene/gui/option_button.h" #include "scene/gui/panel_container.h" +class CreateDialog; + class ScriptCreateDialog : public ConfirmationDialog { GDCLASS(ScriptCreateDialog, ConfirmationDialog); @@ -49,6 +51,7 @@ class ScriptCreateDialog : public ConfirmationDialog { PanelContainer *status_panel; LineEdit *parent_name; Button *parent_browse_button; + Button *parent_search_button; OptionButton *language_menu; OptionButton *template_menu; LineEdit *file_path; @@ -57,6 +60,7 @@ class ScriptCreateDialog : public ConfirmationDialog { CheckButton *internal; VBoxContainer *path_vb; AcceptDialog *alert; + CreateDialog *select_class; bool path_valid; bool create_new; bool is_browsing_parent; @@ -74,7 +78,9 @@ class ScriptCreateDialog : public ConfirmationDialog { bool re_check_path; String script_template; Vector<String> template_list; + String base_type; + void _path_hbox_sorted(); bool _can_be_built_in(); void _path_changed(const String &p_path = String()); void _path_entered(const String &p_path = String()); @@ -86,6 +92,8 @@ class ScriptCreateDialog : public ConfirmationDialog { void _template_changed(int p_template = 0); void _browse_path(bool browse_parent, bool p_save); void _file_selected(const String &p_file); + void _create(); + void _browse_class_in_tree(); virtual void ok_pressed(); void _create_new(); void _load_exist(); @@ -99,6 +107,7 @@ protected: public: void config(const String &p_base_name, const String &p_base_path, bool p_built_in_enabled = true); + void set_inheritance_base_type(const String &p_base); ScriptCreateDialog(); }; diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index d6756b2bb3..68a1117364 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -449,7 +449,7 @@ EditorSettingsDialog::EditorSettingsDialog() { restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER); restart_hb->add_child(restart_icon); restart_label = memnew(Label); - restart_label->set_text(TTR("Editor must be restarted for changes to take effect")); + restart_label->set_text(TTR("The editor must be restarted for changes to take effect.")); restart_hb->add_child(restart_label); restart_hb->add_spacer(); Button *restart_button = memnew(Button); |