diff options
| author | Mariano Suligoy | 2017-10-21 22:42:23 -0300 |
|---|---|---|
| committer | Mariano Suligoy | 2017-11-20 06:27:47 -0300 |
| commit | bcfb0a09f89f6734e2404acd68505dc45b402ee6 (patch) | |
| tree | 2ec0c8b9b127fab1b6cc1e0956ecec7c6bf243a8 /editor/plugins/tile_map_editor_plugin.cpp | |
| parent | a0f49396d6393219fed338f9a7f1e2df879b8ad7 (diff) | |
| download | godot-bcfb0a09f89f6734e2404acd68505dc45b402ee6.tar.gz godot-bcfb0a09f89f6734e2404acd68505dc45b402ee6.tar.zst godot-bcfb0a09f89f6734e2404acd68505dc45b402ee6.zip | |
Diffstat (limited to 'editor/plugins/tile_map_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index ffddd8a3a..4092fd399 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -187,10 +187,13 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, if (p_with_undo) { undo_redo->add_do_method(node, "set_cellv", Point2(p_pos), p_value, p_flip_h, p_flip_v, p_transpose); + undo_redo->add_do_method(node, "make_bitmask_area_dirty", Point2(p_pos)); undo_redo->add_undo_method(node, "set_cellv", Point2(p_pos), prev_val, prev_flip_h, prev_flip_v, prev_transpose); + undo_redo->add_undo_method(node, "make_bitmask_area_dirty", Point2(p_pos)); } else { node->set_cell(p_pos.x, p_pos.y, p_value, p_flip_h, p_flip_v, p_transpose); + node->update_bitmask_area(Point2(p_pos)); } } @@ -306,6 +309,12 @@ void TileMapEditor::_update_palette() { if (tex.is_valid()) { Rect2 region = tileset->tile_get_region(entries[i].id); + if (tileset->tile_get_is_autotile(entries[i].id)) { + int spacing = tileset->autotile_get_spacing(entries[i].id); + region.size = tileset->autotile_get_size(entries[i].id); + region.position += (region.size + Vector2(spacing, spacing)) * tileset->autotile_get_icon_coordinate(entries[i].id); + } + if (!region.has_no_area()) palette->set_item_icon_region(palette->get_item_count() - 1, region); @@ -499,6 +508,11 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h Vector2 tile_ofs = node->get_tileset()->tile_get_texture_offset(p_cell); Rect2 r = node->get_tileset()->tile_get_region(p_cell); + if (node->get_tileset()->tile_get_is_autotile(p_cell)) { + int spacing = node->get_tileset()->autotile_get_spacing(p_cell); + r.size = node->get_tileset()->autotile_get_size(p_cell); + r.position += (r.size + Vector2(spacing, spacing)) * node->get_tileset()->autotile_get_icon_coordinate(p_cell); + } Size2 sc = p_xform.get_scale(); Rect2 rect = Rect2(); |
