diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 75 |
1 files changed, 20 insertions, 55 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6390755656..7aed5b2b7f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -170,8 +170,7 @@ #include "editor/plugins/texture_layered_editor_plugin.h" #include "editor/plugins/texture_region_editor_plugin.h" #include "editor/plugins/theme_editor_plugin.h" -#include "editor/plugins/tile_map_editor_plugin.h" -#include "editor/plugins/tile_set_editor_plugin.h" +#include "editor/plugins/tiles/tiles_editor_plugin.h" #include "editor/plugins/version_control_editor_plugin.h" #include "editor/plugins/visual_shader_editor_plugin.h" #include "editor/progress_dialog.h" @@ -1804,28 +1803,6 @@ void EditorNode::_dialog_action(String p_file) { } } break; - case FILE_EXPORT_TILESET: { - Ref<TileSet> tileset; - if (FileAccess::exists(p_file) && file_export_lib_merge->is_pressed()) { - tileset = ResourceLoader::load(p_file, "TileSet"); - - if (tileset.is_null()) { - show_accept(TTR("Can't load TileSet for merging!"), TTR("OK")); - return; - } - - } else { - tileset = Ref<TileSet>(memnew(TileSet)); - } - - TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), tileset, true); - - Error err = ResourceSaver::save(p_file, tileset); - if (err) { - show_accept(TTR("Error saving TileSet!"), TTR("OK")); - return; - } - } break; case RESOURCE_SAVE: case RESOURCE_SAVE_AS: { @@ -2470,15 +2447,24 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { Node *scene = editor_data.get_edited_scene_root(scene_idx); if (!scene) { - int saved = _save_external_resources(); - String err_text; + if (p_option == FILE_SAVE_SCENE) { + // Pressing Ctrl + S saves the current script if a scene is currently open, but it won't if the scene has no root node. + // Work around this by explicitly saving the script in this case (similar to pressing Ctrl + Alt + S). + ScriptEditor::get_singleton()->save_current_script(); + } + + const int saved = _save_external_resources(); if (saved > 0) { - err_text = vformat(TTR("Saved %s modified resource(s)."), itos(saved)); - } else { - err_text = TTR("A root node is required to save the scene."); + show_accept( + vformat(TTR("The current scene has no root node, but %d modified external resource(s) were saved anyway."), saved), + TTR("OK")); + } else if (p_option == FILE_SAVE_AS_SCENE) { + // Don't show this dialog when pressing Ctrl + S to avoid interfering with script saving. + show_accept( + TTR("A root node is required to save the scene. You can add a root node using the Scene tree dock."), + TTR("OK")); } - show_accept(err_text, TTR("OK")); break; } @@ -2540,25 +2526,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file_export_lib->set_title(TTR("Export Mesh Library")); } break; - case FILE_EXPORT_TILESET: { - //Make sure that the scene has a root before trying to convert to tileset - if (!editor_data.get_edited_scene_root()) { - show_accept(TTR("This operation can't be done without a root node."), TTR("OK")); - break; - } - - List<String> extensions; - Ref<TileSet> ml(memnew(TileSet)); - ResourceSaver::get_recognized_extensions(ml, &extensions); - file_export_lib->clear_filters(); - for (List<String>::Element *E = extensions.front(); E; E = E->next()) { - file_export_lib->add_filter("*." + E->get()); - } - - file_export_lib->popup_file_dialog(); - file_export_lib->set_title(TTR("Export Tile Set")); - - } break; case FILE_EXTERNAL_OPEN_SCENE: { if (unsaved_cache && !p_confirmed) { @@ -5902,7 +5869,7 @@ EditorNode::EditorNode() { EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false); EDITOR_DEF("interface/inspector/horizontal_vector_types_editing", true); EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true); - EDITOR_DEF("interface/inspector/resources_to_open_in_new_inspector", "Script,MeshLibrary,TileSet"); + EDITOR_DEF("interface/inspector/resources_to_open_in_new_inspector", "Script,MeshLibrary"); EDITOR_DEF("interface/inspector/default_color_picker_mode", 0); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_color_picker_mode", PROPERTY_HINT_ENUM, "RGB,HSV,RAW", PROPERTY_USAGE_DEFAULT)); EDITOR_DEF("interface/inspector/default_color_picker_shape", (int32_t)ColorPicker::SHAPE_VHS_CIRCLE); @@ -6231,8 +6198,8 @@ EditorNode::EditorNode() { p = file_menu->get_popup(); - p->add_shortcut(ED_SHORTCUT("editor/new_scene", TTR("New Scene")), FILE_NEW_SCENE); - p->add_shortcut(ED_SHORTCUT("editor/new_inherited_scene", TTR("New Inherited Scene...")), FILE_NEW_INHERITED_SCENE); + p->add_shortcut(ED_SHORTCUT("editor/new_scene", TTR("New Scene"), KEY_MASK_CMD + KEY_N), FILE_NEW_SCENE); + p->add_shortcut(ED_SHORTCUT("editor/new_inherited_scene", TTR("New Inherited Scene..."), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_N), FILE_NEW_INHERITED_SCENE); p->add_shortcut(ED_SHORTCUT("editor/open_scene", TTR("Open Scene..."), KEY_MASK_CMD + KEY_O), FILE_OPEN_SCENE); p->add_shortcut(ED_SHORTCUT("editor/reopen_closed_scene", TTR("Reopen Closed Scene"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_T), FILE_OPEN_PREV); p->add_submenu_item(TTR("Open Recent"), "RecentScenes", FILE_OPEN_RECENT); @@ -6254,7 +6221,6 @@ EditorNode::EditorNode() { p->add_child(pm_export); p->add_submenu_item(TTR("Convert To..."), "Export"); pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary...")), FILE_EXPORT_MESH_LIBRARY); - pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet...")), FILE_EXPORT_TILESET); pm_export->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); p->add_separator(); @@ -6826,8 +6792,7 @@ EditorNode::EditorNode() { add_editor_plugin(memnew(ItemListEditorPlugin(this))); add_editor_plugin(memnew(Polygon3DEditorPlugin(this))); add_editor_plugin(memnew(CollisionPolygon2DEditorPlugin(this))); - add_editor_plugin(memnew(TileSetEditorPlugin(this))); - add_editor_plugin(memnew(TileMapEditorPlugin(this))); + add_editor_plugin(memnew(TilesEditorPlugin(this))); add_editor_plugin(memnew(SpriteFramesEditorPlugin(this))); add_editor_plugin(memnew(TextureRegionEditorPlugin(this))); add_editor_plugin(memnew(GIProbeEditorPlugin(this))); |