diff --git a/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml b/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml index e6be6dda7..31f67206e 100644 --- a/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml +++ b/modules/layered_tile_map/doc_classes/LayeredTileSetAtlasSource.xml @@ -50,7 +50,7 @@ - + If [member use_texture_padding] is [code]false[/code], returns [member texture]. Otherwise, returns and internal [ImageTexture] created that includes the padding. @@ -146,7 +146,7 @@ - + @@ -266,7 +266,7 @@ Separation, in pixels, between each tile texture region of the grid. - + The atlas texture. diff --git a/modules/layered_tile_map/editor/atlas_merging_dialog.cpp b/modules/layered_tile_map/editor/atlas_merging_dialog.cpp index 2960f2000..d45399ee6 100644 --- a/modules/layered_tile_map/editor/atlas_merging_dialog.cpp +++ b/modules/layered_tile_map/editor/atlas_merging_dialog.cpp @@ -200,7 +200,7 @@ void AtlasMergingDialog::_merge_confirmed(const String &p_path) { ResourceLoader::import(p_path); - Ref new_texture_resource = ResourceLoader::load(p_path, "Texture2D"); + Ref new_texture_resource = ResourceLoader::load(p_path, "Texture"); merged->set_texture(new_texture_resource); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); diff --git a/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp b/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp index a03bd2bc6..8d01de46d 100644 --- a/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp +++ b/modules/layered_tile_map/editor/layered_tile_map_layer_editor.cpp @@ -44,8 +44,10 @@ #include "../layered_tile_map_layer.h" #include "scene/2d/camera_2d.h" #include "scene/gui/center_container.h" +#include "scene/gui/popup_menu.h" #include "scene/gui/split_container.h" +#include "core/containers/hash_set.h" #include "core/input/input.h" #include "core/math/geometry.h" #include "core/os/keyboard.h" @@ -115,33 +117,43 @@ void LayeredTileMapLayerEditorTilesPlugin::_update_transform_buttons() { } bool has_scene_tile = false; - for (const KeyValue &E : selection_pattern->get_pattern()) { - if (Object::cast_to(tile_set->get_source(E.value.source_id).ptr())) { + + for (const HashMap::Element *E = selection_pattern->get_pattern().front(); E; E = E->next) { + if (Object::cast_to(tile_set->get_source(E->value().source_id).ptr())) { has_scene_tile = true; break; } } if (has_scene_tile) { - _set_transform_buttons_state({}, { transform_button_rotate_left, transform_button_rotate_right, transform_button_flip_h, transform_button_flip_v }, - TTR("Can't transform scene tiles.")); + _set_transform_button_state_disabled(transform_button_rotate_left, TTR("Can't transform scene tiles.")); + _set_transform_button_state_disabled(transform_button_rotate_right, TTR("Can't transform scene tiles.")); + _set_transform_button_state_disabled(transform_button_flip_h, TTR("Can't transform scene tiles.")); + _set_transform_button_state_disabled(transform_button_flip_v, TTR("Can't transform scene tiles.")); + } else if (tile_set->get_tile_shape() != LayeredTileSet::TILE_SHAPE_SQUARE && selection_pattern->get_size() != Vector2i(1, 1)) { - _set_transform_buttons_state({ transform_button_flip_h, transform_button_flip_v }, { transform_button_rotate_left, transform_button_rotate_right }, - TTR("Can't rotate patterns when using non-square tile grid.")); + _set_transform_button_state_enabled(transform_button_flip_h); + _set_transform_button_state_enabled(transform_button_flip_v); + + _set_transform_button_state_disabled(transform_button_rotate_left, TTR("Can't rotate patterns when using non-square tile grid.")); + _set_transform_button_state_disabled(transform_button_rotate_right, TTR("Can't rotate patterns when using non-square tile grid.")); + } else { - _set_transform_buttons_state({ transform_button_rotate_left, transform_button_rotate_right, transform_button_flip_h, transform_button_flip_v }, {}, ""); + _set_transform_button_state_enabled(transform_button_rotate_left); + _set_transform_button_state_enabled(transform_button_rotate_right); + _set_transform_button_state_enabled(transform_button_flip_h); + _set_transform_button_state_enabled(transform_button_flip_v); } } -void LayeredTileMapLayerEditorTilesPlugin::_set_transform_buttons_state(const Vector