1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Rework the TileSet resource and TileMap nodes:

- Move most properties from TileMap to TileSet,
- Make TileSet more flexible, supporting more feature (several
  collision layers, etc...),
- Fusion both the TileMap and TileSet editor,
- Implement TileSetSources, and thus a new way to index tiles in the TileSet,
- Rework the TileSet and TileMap editors completely,
- Implement an editor zoom widget (and use it in several places)
This commit is contained in:
Gilles Roudière
2021-05-07 15:41:39 +02:00
parent d81ea631d9
commit a3dda2df85
48 changed files with 15216 additions and 10546 deletions

View File

@@ -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: {
@@ -2539,25 +2516,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file_export_lib->popup_file_dialog();
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: {
@@ -5902,7 +5860,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);
@@ -6254,7 +6212,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();
@@ -6827,8 +6784,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)));