diff --git a/doc/classes/RTileMap.xml b/doc/classes/TileMap.xml similarity index 96% rename from doc/classes/RTileMap.xml rename to doc/classes/TileMap.xml index 1046aa616..b531cf753 100644 --- a/doc/classes/RTileMap.xml +++ b/doc/classes/TileMap.xml @@ -1,5 +1,5 @@ - + @@ -161,13 +161,13 @@ - + - + @@ -187,7 +187,7 @@ - + @@ -195,7 +195,7 @@ - + diff --git a/doc/classes/RTileSet.xml b/doc/classes/TileSet.xml similarity index 98% rename from doc/classes/RTileSet.xml rename to doc/classes/TileSet.xml index f8775aa3b..85ba284b1 100644 --- a/doc/classes/RTileSet.xml +++ b/doc/classes/TileSet.xml @@ -1,5 +1,5 @@ - + @@ -45,7 +45,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -327,7 +327,7 @@ - + @@ -465,7 +465,7 @@ - + diff --git a/doc/engine/rtile_map.md b/doc/engine/rtile_map.md index bf29abc78..d4d870433 100644 --- a/doc/engine/rtile_map.md +++ b/doc/engine/rtile_map.md @@ -1,4 +1,4 @@ -# RTileMap +# TileMap Godot's TileMap but as an engine module, with a few smaller features added. diff --git a/modules/rtile_map/register_types.cpp b/modules/rtile_map/register_types.cpp index ab98ef8ff..ad13165c9 100644 --- a/modules/rtile_map/register_types.cpp +++ b/modules/rtile_map/register_types.cpp @@ -32,12 +32,12 @@ SOFTWARE. void register_rtile_map_types() { #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); - EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); #endif - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); } void unregister_rtile_map_types() { diff --git a/modules/rtile_map/tile_map.cpp b/modules/rtile_map/tile_map.cpp index ed4dae863..988316720 100644 --- a/modules/rtile_map/tile_map.cpp +++ b/modules/rtile_map/tile_map.cpp @@ -40,7 +40,7 @@ #include "servers/navigation_2d_server.h" -void RTileMap::Quadrant::clear_navpoly() { +void TileMap::Quadrant::clear_navpoly() { for (Map::Element *E = navpoly_ids.front(); E; E = E->next()) { RID region = E->get().region; Navigation2DServer::get_singleton()->region_set_map(region, RID()); @@ -49,7 +49,7 @@ void RTileMap::Quadrant::clear_navpoly() { navpoly_ids.clear(); } -int RTileMap::_get_quadrant_size() const { +int TileMap::_get_quadrant_size() const { if (y_sort_mode) { return 1; } else { @@ -57,7 +57,7 @@ int RTileMap::_get_quadrant_size() const { } } -void RTileMap::_notification(int p_what) { +void TileMap::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { Node2D *c = this; @@ -136,7 +136,7 @@ void RTileMap::_notification(int p_what) { } } -void RTileMap::_update_quadrant_space(const RID &p_space) { +void TileMap::_update_quadrant_space(const RID &p_space) { if (!use_parent) { for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); @@ -145,7 +145,7 @@ void RTileMap::_update_quadrant_space(const RID &p_space) { } } -void RTileMap::_update_quadrant_transform() { +void TileMap::_update_quadrant_transform() { if (!is_inside_tree()) { return; } @@ -188,7 +188,7 @@ void RTileMap::_update_quadrant_transform() { } } -void RTileMap::set_tileset(const Ref &p_tileset) { +void TileMap::set_tileset(const Ref &p_tileset) { if (tile_set.is_valid()) { tile_set->disconnect("changed", this, "_recreate_quadrants"); tile_set->remove_change_receptor(this); @@ -209,11 +209,11 @@ void RTileMap::set_tileset(const Ref &p_tileset) { emit_signal("settings_changed"); } -Ref RTileMap::get_tileset() const { +Ref TileMap::get_tileset() const { return tile_set; } -void RTileMap::set_cell_size(const Size2 &p_size) { +void TileMap::set_cell_size(const Size2 &p_size) { ERR_FAIL_COND(p_size.x < 1 || p_size.y < 1); _clear_quadrants(); @@ -222,11 +222,11 @@ void RTileMap::set_cell_size(const Size2 &p_size) { emit_signal("settings_changed"); } -Size2 RTileMap::get_cell_size() const { +Size2 TileMap::get_cell_size() const { return cell_size; } -void RTileMap::set_quadrant_size(int p_size) { +void TileMap::set_quadrant_size(int p_size) { ERR_FAIL_COND_MSG(p_size < 1, "Quadrant size cannot be smaller than 1."); _clear_quadrants(); @@ -235,11 +235,11 @@ void RTileMap::set_quadrant_size(int p_size) { emit_signal("settings_changed"); } -int RTileMap::get_quadrant_size() const { +int TileMap::get_quadrant_size() const { return quadrant_size; } -void RTileMap::set_use_rao(bool p_rao) { +void TileMap::set_use_rao(bool p_rao) { bool recreate = _use_rao != p_rao; _use_rao = p_rao; @@ -248,11 +248,11 @@ void RTileMap::set_use_rao(bool p_rao) { _recreate_quadrants(); } } -bool RTileMap::get_use_rao() const { +bool TileMap::get_use_rao() const { return _use_rao; } -void RTileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const Vector2 &p_offset, const Size2 &p_sc) { +void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const Vector2 &p_offset, const Size2 &p_sc) { Size2 s = p_sc; Vector2 offset = p_offset; @@ -317,7 +317,7 @@ void RTileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const xform.columns[2] += offset; } -void RTileMap::_add_shape(int &shape_idx, const Quadrant &p_q, const Ref &p_shape, const RTileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata) { +void TileMap::_add_shape(int &shape_idx, const Quadrant &p_q, const Ref &p_shape, const TileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata) { Physics2DServer *ps = Physics2DServer::get_singleton(); if (!use_parent) { @@ -345,7 +345,7 @@ void RTileMap::_add_shape(int &shape_idx, const Quadrant &p_q, const Ref mat = tile_set->tile_get_material(c.id); int z_index = tile_set->tile_get_z_index(c.id); - if (tile_set->tile_get_tile_mode(c.id) == RTileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == RTileSet::ATLAS_TILE) { + if (tile_set->tile_get_tile_mode(c.id) == TileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == TileSet::ATLAS_TILE) { z_index += tile_set->autotile_get_z_index(c.id, Vector2(c.autotile_coord_x, c.autotile_coord_y)); } @@ -485,7 +485,7 @@ void RTileMap::update_dirty_quadrants() { } Rect2 r = tile_set->tile_get_region(c.id); - if (tile_set->tile_get_tile_mode(c.id) == RTileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == RTileSet::ATLAS_TILE) { + if (tile_set->tile_get_tile_mode(c.id) == TileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == TileSet::ATLAS_TILE) { int spacing = tile_set->autotile_get_spacing(c.id); r.size = tile_set->autotile_get_size(c.id); r.position += (r.size + Vector2(spacing, spacing)) * Vector2(c.autotile_coord_x, c.autotile_coord_y); @@ -594,12 +594,12 @@ void RTileMap::update_dirty_quadrants() { tex->draw_rect_region(canvas_item, rect, r, modulate, c.transpose, normal_map, clip_uv); } - Vector shapes = tile_set->tile_get_shapes(c.id); + Vector shapes = tile_set->tile_get_shapes(c.id); for (int j = 0; j < shapes.size(); j++) { Ref shape = shapes[j].shape; if (shape.is_valid()) { - if (tile_set->tile_get_tile_mode(c.id) == RTileSet::SINGLE_TILE || (shapes[j].autotile_coord.x == c.autotile_coord_x && shapes[j].autotile_coord.y == c.autotile_coord_y)) { + if (tile_set->tile_get_tile_mode(c.id) == TileSet::SINGLE_TILE || (shapes[j].autotile_coord.x == c.autotile_coord_x && shapes[j].autotile_coord.y == c.autotile_coord_y)) { Transform2D xform; xform.set_origin(offset.floor() + tile_ofs); @@ -622,7 +622,7 @@ void RTileMap::update_dirty_quadrants() { _add_shape(shape_idx, q, convex, shapes[j], xform, Vector2(E->key().x, E->key().y)); #ifdef DEBUG_ENABLED } else { - print_error("The TileSet assigned to the RTileMap " + get_name() + " has an invalid convex shape."); + print_error("The TileSet assigned to the TileMap " + get_name() + " has an invalid convex shape."); #endif } } @@ -640,7 +640,7 @@ void RTileMap::update_dirty_quadrants() { if (bake_navigation) { Ref navpoly; Vector2 npoly_ofs; - if (tile_set->tile_get_tile_mode(c.id) == RTileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == RTileSet::ATLAS_TILE) { + if (tile_set->tile_get_tile_mode(c.id) == TileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == TileSet::ATLAS_TILE) { navpoly = tile_set->autotile_get_navigation_polygon(c.id, Vector2(c.autotile_coord_x, c.autotile_coord_y)); npoly_ofs = Vector2(); } else { @@ -717,7 +717,7 @@ void RTileMap::update_dirty_quadrants() { } Ref occluder; - if (tile_set->tile_get_tile_mode(c.id) == RTileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == RTileSet::ATLAS_TILE) { + if (tile_set->tile_get_tile_mode(c.id) == TileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == TileSet::ATLAS_TILE) { occluder = tile_set->autotile_get_light_occluder(c.id, Vector2(c.autotile_coord_x, c.autotile_coord_y)); } else { occluder = tile_set->tile_get_light_occluder(c.id); @@ -762,7 +762,7 @@ void RTileMap::update_dirty_quadrants() { _recompute_rect_cache(); } -void RTileMap::_recompute_rect_cache() { +void TileMap::_recompute_rect_cache() { #ifdef DEBUG_ENABLED if (!rect_cache_dirty) { @@ -791,7 +791,7 @@ void RTileMap::_recompute_rect_cache() { #endif } -Map::Element *RTileMap::_create_quadrant(const PosKey &p_qk) { +Map::Element *TileMap::_create_quadrant(const PosKey &p_qk) { Transform2D xform; //xform.set_origin(Point2(p_qk.x,p_qk.y)*cell_size*quadrant_size); Quadrant q; @@ -834,7 +834,7 @@ Map::Element *RTileMap::_create_quadrant(c return quadrant_map.insert(p_qk, q); } -void RTileMap::_erase_quadrant(Map::Element *Q) { +void TileMap::_erase_quadrant(Map::Element *Q) { Quadrant &q = Q->get(); if (!use_parent) { if (q.body.is_valid()) { @@ -870,7 +870,7 @@ void RTileMap::_erase_quadrant(Map::Element *Q) { rect_cache_dirty = true; } -void RTileMap::_make_quadrant_dirty(Map::Element *Q, bool update) { +void TileMap::_make_quadrant_dirty(Map::Element *Q, bool update) { Quadrant &q = Q->get(); if (!q.dirty_list.in_list()) { dirty_quadrant_list.add(&q.dirty_list); @@ -889,18 +889,18 @@ void RTileMap::_make_quadrant_dirty(Map::Element *Q, bool upda } } -void RTileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose) { +void TileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose) { set_cell(p_pos.x, p_pos.y, p_tile, p_flip_x, p_flip_y, p_transpose); } -void RTileMap::_set_celld(const Vector2 &p_pos, const Dictionary &p_data) { +void TileMap::_set_celld(const Vector2 &p_pos, const Dictionary &p_data) { Variant v_pos_x = p_pos.x, v_pos_y = p_pos.y, v_tile = p_data["id"], v_flip_h = p_data["flip_h"], v_flip_v = p_data["flip_y"], v_transpose = p_data["transpose"], v_autotile_coord = p_data["auto_coord"]; 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; call("set_cell", args, 7, ce); } -void RTileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose, const Vector2 &p_autotile_coord) { +void TileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose, const Vector2 &p_autotile_coord) { PosKey pk(p_x, p_y); Map::Element *E = tile_map.find(pk); @@ -957,11 +957,11 @@ void RTileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip used_size_cache_dirty = true; } -int RTileMap::get_cellv(const Vector2 &p_pos) const { +int TileMap::get_cellv(const Vector2 &p_pos) const { return get_cell(p_pos.x, p_pos.y); } -void RTileMap::make_bitmask_area_dirty(const Vector2 &p_pos) { +void TileMap::make_bitmask_area_dirty(const Vector2 &p_pos) { for (int x = p_pos.x - 1; x <= p_pos.x + 1; x++) { for (int y = p_pos.y - 1; y <= p_pos.y + 1; y++) { PosKey p(x, y); @@ -972,7 +972,7 @@ void RTileMap::make_bitmask_area_dirty(const Vector2 &p_pos) { } } -void RTileMap::update_bitmask_area(const Vector2 &p_pos) { +void TileMap::update_bitmask_area(const Vector2 &p_pos) { for (int x = p_pos.x - 1; x <= p_pos.x + 1; x++) { for (int y = p_pos.y - 1; y <= p_pos.y + 1; y++) { update_cell_bitmask(x, y); @@ -980,7 +980,7 @@ void RTileMap::update_bitmask_area(const Vector2 &p_pos) { } } -void RTileMap::update_bitmask_region(const Vector2 &p_start, const Vector2 &p_end) { +void TileMap::update_bitmask_region(const Vector2 &p_start, const Vector2 &p_end) { if ((p_end.x < p_start.x || p_end.y < p_start.y) || (p_end.x == p_start.x && p_end.y == p_start.y)) { Array a = get_used_cells(); for (int i = 0; i < a.size(); i++) { @@ -996,7 +996,7 @@ void RTileMap::update_bitmask_region(const Vector2 &p_start, const Vector2 &p_en } } -void RTileMap::update_cell_bitmask(int p_x, int p_y) { +void TileMap::update_cell_bitmask(int p_x, int p_y) { ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot update cell bitmask if Tileset is not open."); PosKey p(p_x, p_y); Map::Element *E = tile_map.find(p); @@ -1005,61 +1005,61 @@ void RTileMap::update_cell_bitmask(int p_x, int p_y) { if (!tile_set->has_tile(id)) { return; } - if (tile_set->tile_get_tile_mode(id) == RTileSet::AUTO_TILE) { + if (tile_set->tile_get_tile_mode(id) == TileSet::AUTO_TILE) { uint16_t mask = 0; - if (tile_set->autotile_get_bitmask_mode(id) == RTileSet::BITMASK_2X2) { + if (tile_set->autotile_get_bitmask_mode(id) == TileSet::BITMASK_2X2) { if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) { - mask |= RTileSet::BIND_TOPLEFT; + mask |= TileSet::BIND_TOPLEFT; } if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) { - mask |= RTileSet::BIND_TOPRIGHT; + mask |= TileSet::BIND_TOPRIGHT; } if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) { - mask |= RTileSet::BIND_BOTTOMLEFT; + mask |= TileSet::BIND_BOTTOMLEFT; } if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) { - mask |= RTileSet::BIND_BOTTOMRIGHT; + mask |= TileSet::BIND_BOTTOMRIGHT; } } else { - if (tile_set->autotile_get_bitmask_mode(id) == RTileSet::BITMASK_3X3_MINIMAL) { + if (tile_set->autotile_get_bitmask_mode(id) == TileSet::BITMASK_3X3_MINIMAL) { if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) { - mask |= RTileSet::BIND_TOPLEFT; + mask |= TileSet::BIND_TOPLEFT; } if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) { - mask |= RTileSet::BIND_TOPRIGHT; + mask |= TileSet::BIND_TOPRIGHT; } if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) { - mask |= RTileSet::BIND_BOTTOMLEFT; + mask |= TileSet::BIND_BOTTOMLEFT; } if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) { - mask |= RTileSet::BIND_BOTTOMRIGHT; + mask |= TileSet::BIND_BOTTOMRIGHT; } } else { if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1))) { - mask |= RTileSet::BIND_TOPLEFT; + mask |= TileSet::BIND_TOPLEFT; } if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1))) { - mask |= RTileSet::BIND_TOPRIGHT; + mask |= TileSet::BIND_TOPRIGHT; } if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1))) { - mask |= RTileSet::BIND_BOTTOMLEFT; + mask |= TileSet::BIND_BOTTOMLEFT; } if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1))) { - mask |= RTileSet::BIND_BOTTOMRIGHT; + mask |= TileSet::BIND_BOTTOMRIGHT; } } if (tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1))) { - mask |= RTileSet::BIND_TOP; + mask |= TileSet::BIND_TOP; } if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) { - mask |= RTileSet::BIND_LEFT; + mask |= TileSet::BIND_LEFT; } - mask |= RTileSet::BIND_CENTER; + mask |= TileSet::BIND_CENTER; if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) { - mask |= RTileSet::BIND_RIGHT; + mask |= TileSet::BIND_RIGHT; } if (tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1))) { - mask |= RTileSet::BIND_BOTTOM; + mask |= TileSet::BIND_BOTTOM; } } Vector2 coord = tile_set->autotile_get_subtile_for_bitmask(id, mask, this, Vector2(p_x, p_y)); @@ -1070,11 +1070,11 @@ void RTileMap::update_cell_bitmask(int p_x, int p_y) { Map::Element *Q = quadrant_map.find(qk); _make_quadrant_dirty(Q); - } else if (tile_set->tile_get_tile_mode(id) == RTileSet::SINGLE_TILE) { + } else if (tile_set->tile_get_tile_mode(id) == TileSet::SINGLE_TILE) { E->get().autotile_coord_x = 0; E->get().autotile_coord_y = 0; - } else if (tile_set->tile_get_tile_mode(id) == RTileSet::ATLAS_TILE) { - if (tile_set->autotile_get_bitmask(id, Vector2(p_x, p_y)) == RTileSet::BIND_CENTER) { + } else if (tile_set->tile_get_tile_mode(id) == TileSet::ATLAS_TILE) { + if (tile_set->autotile_get_bitmask(id, Vector2(p_x, p_y)) == TileSet::BIND_CENTER) { Vector2 coord = tile_set->atlastile_get_subtile_by_priority(id, this, Vector2(p_x, p_y)); E->get().autotile_coord_x = (int)coord.x; @@ -1084,14 +1084,14 @@ void RTileMap::update_cell_bitmask(int p_x, int p_y) { } } -void RTileMap::update_dirty_bitmask() { +void TileMap::update_dirty_bitmask() { while (dirty_bitmask.size() > 0) { update_cell_bitmask(dirty_bitmask[0].x, dirty_bitmask[0].y); dirty_bitmask.pop_front(); } } -void RTileMap::fix_invalid_tiles() { +void TileMap::fix_invalid_tiles() { ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot fix invalid tiles if Tileset is not open."); Map temp_tile_map = tile_map; @@ -1102,7 +1102,7 @@ void RTileMap::fix_invalid_tiles() { } } -int RTileMap::get_cell(int p_x, int p_y) const { +int TileMap::get_cell(int p_x, int p_y) const { PosKey pk(p_x, p_y); const Map::Element *E = tile_map.find(pk); @@ -1113,7 +1113,7 @@ int RTileMap::get_cell(int p_x, int p_y) const { return E->get().id; } -bool RTileMap::is_cell_x_flipped(int p_x, int p_y) const { +bool TileMap::is_cell_x_flipped(int p_x, int p_y) const { PosKey pk(p_x, p_y); const Map::Element *E = tile_map.find(pk); @@ -1124,7 +1124,7 @@ bool RTileMap::is_cell_x_flipped(int p_x, int p_y) const { return E->get().flip_h; } -bool RTileMap::is_cell_y_flipped(int p_x, int p_y) const { +bool TileMap::is_cell_y_flipped(int p_x, int p_y) const { PosKey pk(p_x, p_y); const Map::Element *E = tile_map.find(pk); @@ -1135,7 +1135,7 @@ bool RTileMap::is_cell_y_flipped(int p_x, int p_y) const { return E->get().flip_v; } -bool RTileMap::is_cell_transposed(int p_x, int p_y) const { +bool TileMap::is_cell_transposed(int p_x, int p_y) const { PosKey pk(p_x, p_y); const Map::Element *E = tile_map.find(pk); @@ -1147,7 +1147,7 @@ bool RTileMap::is_cell_transposed(int p_x, int p_y) const { return E->get().transpose; } -void RTileMap::set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord) { +void TileMap::set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord) { PosKey pk(p_x, p_y); const Map::Element *E = tile_map.find(pk); @@ -1171,7 +1171,7 @@ void RTileMap::set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord) _make_quadrant_dirty(Q); } -Vector2 RTileMap::get_cell_autotile_coord(int p_x, int p_y) const { +Vector2 TileMap::get_cell_autotile_coord(int p_x, int p_y) const { PosKey pk(p_x, p_y); const Map::Element *E = tile_map.find(pk); @@ -1183,7 +1183,7 @@ Vector2 RTileMap::get_cell_autotile_coord(int p_x, int p_y) const { return Vector2(E->get().autotile_coord_x, E->get().autotile_coord_y); } -void RTileMap::_recreate_quadrants() { +void TileMap::_recreate_quadrants() { _clear_quadrants(); for (Map::Element *E = tile_map.front(); E; E = E->next()) { @@ -1201,23 +1201,23 @@ void RTileMap::_recreate_quadrants() { update_dirty_quadrants(); } -void RTileMap::_clear_quadrants() { +void TileMap::_clear_quadrants() { while (quadrant_map.size()) { _erase_quadrant(quadrant_map.front()); } } -void RTileMap::set_material(const Ref &p_material) { +void TileMap::set_material(const Ref &p_material) { CanvasItem::set_material(p_material); _update_all_items_material_state(); } -void RTileMap::set_use_parent_material(bool p_use_parent_material) { +void TileMap::set_use_parent_material(bool p_use_parent_material) { CanvasItem::set_use_parent_material(p_use_parent_material); _update_all_items_material_state(); } -void RTileMap::_update_all_items_material_state() { +void TileMap::_update_all_items_material_state() { for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); for (List::Element *F = q.canvas_items.front(); F; F = F->next()) { @@ -1226,17 +1226,17 @@ void RTileMap::_update_all_items_material_state() { } } -void RTileMap::_update_item_material_state(const RID &p_canvas_item) { +void TileMap::_update_item_material_state(const RID &p_canvas_item) { RS::get_singleton()->canvas_item_set_use_parent_material(p_canvas_item, get_use_parent_material() || get_material().is_valid()); } -void RTileMap::clear() { +void TileMap::clear() { _clear_quadrants(); tile_map.clear(); used_size_cache_dirty = true; } -void RTileMap::_set_tile_data(const PoolVector &p_data) { +void TileMap::_set_tile_data(const PoolVector &p_data) { ERR_FAIL_COND(format > FORMAT_2); int c = p_data.size(); @@ -1284,7 +1284,7 @@ void RTileMap::_set_tile_data(const PoolVector &p_data) { } } -PoolVector RTileMap::_get_tile_data() const { +PoolVector TileMap::_get_tile_data() const { PoolVector data; data.resize(tile_map.size() * 3); PoolVector::Write w = data.write(); @@ -1319,17 +1319,17 @@ PoolVector RTileMap::_get_tile_data() const { } #ifdef TOOLS_ENABLED -Rect2 RTileMap::_edit_get_rect() const { +Rect2 TileMap::_edit_get_rect() const { if (pending_update) { - const_cast(this)->update_dirty_quadrants(); + const_cast(this)->update_dirty_quadrants(); } else { - const_cast(this)->_recompute_rect_cache(); + const_cast(this)->_recompute_rect_cache(); } return rect_cache; } #endif -void RTileMap::set_collision_layer(uint32_t p_layer) { +void TileMap::set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; if (!use_parent) { for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { @@ -1339,7 +1339,7 @@ void RTileMap::set_collision_layer(uint32_t p_layer) { } } -void RTileMap::set_collision_mask(uint32_t p_mask) { +void TileMap::set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; if (!use_parent) { for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { @@ -1349,7 +1349,7 @@ void RTileMap::set_collision_mask(uint32_t p_mask) { } } -void RTileMap::set_collision_layer_bit(int p_bit, bool p_value) { +void TileMap::set_collision_layer_bit(int p_bit, bool p_value) { ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision layer bit must be between 0 and 31 inclusive."); uint32_t layer = get_collision_layer(); if (p_value) { @@ -1360,7 +1360,7 @@ void RTileMap::set_collision_layer_bit(int p_bit, bool p_value) { set_collision_layer(layer); } -void RTileMap::set_collision_mask_bit(int p_bit, bool p_value) { +void TileMap::set_collision_mask_bit(int p_bit, bool p_value) { ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision mask bit must be between 0 and 31 inclusive."); uint32_t mask = get_collision_mask(); if (p_value) { @@ -1371,21 +1371,21 @@ void RTileMap::set_collision_mask_bit(int p_bit, bool p_value) { set_collision_mask(mask); } -bool RTileMap::get_collision_use_kinematic() const { +bool TileMap::get_collision_use_kinematic() const { return use_kinematic; } -void RTileMap::set_collision_use_kinematic(bool p_use_kinematic) { +void TileMap::set_collision_use_kinematic(bool p_use_kinematic) { _clear_quadrants(); use_kinematic = p_use_kinematic; _recreate_quadrants(); } -bool RTileMap::get_collision_use_parent() const { +bool TileMap::get_collision_use_parent() const { return use_parent; } -void RTileMap::set_collision_use_parent(bool p_use_parent) { +void TileMap::set_collision_use_parent(bool p_use_parent) { if (use_parent == p_use_parent) { return; } @@ -1406,7 +1406,7 @@ void RTileMap::set_collision_use_parent(bool p_use_parent) { update_configuration_warning(); } -void RTileMap::set_collision_friction(float p_friction) { +void TileMap::set_collision_friction(float p_friction) { friction = p_friction; if (!use_parent) { for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { @@ -1416,11 +1416,11 @@ void RTileMap::set_collision_friction(float p_friction) { } } -float RTileMap::get_collision_friction() const { +float TileMap::get_collision_friction() const { return friction; } -void RTileMap::set_collision_bounce(float p_bounce) { +void TileMap::set_collision_bounce(float p_bounce) { bounce = p_bounce; if (!use_parent) { for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { @@ -1429,80 +1429,80 @@ void RTileMap::set_collision_bounce(float p_bounce) { } } } -float RTileMap::get_collision_bounce() const { +float TileMap::get_collision_bounce() const { return bounce; } -void RTileMap::set_bake_navigation(bool p_bake_navigation) { +void TileMap::set_bake_navigation(bool p_bake_navigation) { bake_navigation = p_bake_navigation; for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { _make_quadrant_dirty(E); } } -bool RTileMap::is_baking_navigation() { +bool TileMap::is_baking_navigation() { return bake_navigation; } -void RTileMap::set_navigation_layers(uint32_t p_navigation_layers) { +void TileMap::set_navigation_layers(uint32_t p_navigation_layers) { navigation_layers = p_navigation_layers; for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { _make_quadrant_dirty(E); } } -uint32_t RTileMap::get_navigation_layers() { +uint32_t TileMap::get_navigation_layers() { return navigation_layers; } -uint32_t RTileMap::get_collision_layer() const { +uint32_t TileMap::get_collision_layer() const { return collision_layer; } -uint32_t RTileMap::get_collision_mask() const { +uint32_t TileMap::get_collision_mask() const { return collision_mask; } -bool RTileMap::get_collision_layer_bit(int p_bit) const { +bool TileMap::get_collision_layer_bit(int p_bit) const { ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision layer bit must be between 0 and 31 inclusive."); return get_collision_layer() & (1 << p_bit); } -bool RTileMap::get_collision_mask_bit(int p_bit) const { +bool TileMap::get_collision_mask_bit(int p_bit) const { ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision mask bit must be between 0 and 31 inclusive."); return get_collision_mask() & (1 << p_bit); } -void RTileMap::set_mode(Mode p_mode) { +void TileMap::set_mode(Mode p_mode) { _clear_quadrants(); mode = p_mode; _recreate_quadrants(); emit_signal("settings_changed"); } -RTileMap::Mode RTileMap::get_mode() const { +TileMap::Mode TileMap::get_mode() const { return mode; } -void RTileMap::set_half_offset(HalfOffset p_half_offset) { +void TileMap::set_half_offset(HalfOffset p_half_offset) { _clear_quadrants(); half_offset = p_half_offset; _recreate_quadrants(); emit_signal("settings_changed"); } -void RTileMap::set_tile_origin(TileOrigin p_tile_origin) { +void TileMap::set_tile_origin(TileOrigin p_tile_origin) { _clear_quadrants(); tile_origin = p_tile_origin; _recreate_quadrants(); emit_signal("settings_changed"); } -RTileMap::TileOrigin RTileMap::get_tile_origin() const { +TileMap::TileOrigin TileMap::get_tile_origin() const { return tile_origin; } -Vector2 RTileMap::get_cell_draw_offset() const { +Vector2 TileMap::get_cell_draw_offset() const { switch (mode) { case MODE_SQUARE: { return Vector2(); @@ -1524,11 +1524,11 @@ Vector2 RTileMap::get_cell_draw_offset() const { return Vector2(); } -RTileMap::HalfOffset RTileMap::get_half_offset() const { +TileMap::HalfOffset TileMap::get_half_offset() const { return half_offset; } -Transform2D RTileMap::get_cell_transform() const { +Transform2D TileMap::get_cell_transform() const { switch (mode) { case MODE_SQUARE: { Transform2D m; @@ -1553,18 +1553,18 @@ Transform2D RTileMap::get_cell_transform() const { return Transform2D(); } -void RTileMap::set_custom_transform(const Transform2D &p_xform) { +void TileMap::set_custom_transform(const Transform2D &p_xform) { _clear_quadrants(); custom_transform = p_xform; _recreate_quadrants(); emit_signal("settings_changed"); } -Transform2D RTileMap::get_custom_transform() const { +Transform2D TileMap::get_custom_transform() const { return custom_transform; } -Vector2 RTileMap::_map_to_world(int p_x, int p_y, bool p_ignore_ofs) const { +Vector2 TileMap::_map_to_world(int p_x, int p_y, bool p_ignore_ofs) const { Vector2 ret = get_cell_transform().xform(Vector2(p_x, p_y)); if (!p_ignore_ofs) { switch (half_offset) { @@ -1588,7 +1588,7 @@ Vector2 RTileMap::_map_to_world(int p_x, int p_y, bool p_ignore_ofs) const { return ret; } -bool RTileMap::_set(const StringName &p_name, const Variant &p_value) { +bool TileMap::_set(const StringName &p_name, const Variant &p_value) { if (p_name == "format") { if (p_value.get_type() == Variant::INT) { format = (DataFormat)(p_value.operator int64_t()); // Set format used for loading @@ -1604,7 +1604,7 @@ bool RTileMap::_set(const StringName &p_name, const Variant &p_value) { return false; } -bool RTileMap::_get(const StringName &p_name, Variant &r_ret) const { +bool TileMap::_get(const StringName &p_name, Variant &r_ret) const { if (p_name == "format") { r_ret = FORMAT_2; // When saving, always save highest format return true; @@ -1615,7 +1615,7 @@ bool RTileMap::_get(const StringName &p_name, Variant &r_ret) const { return false; } -void RTileMap::_get_property_list(List *p_list) const { +void TileMap::_get_property_list(List *p_list) const { PropertyInfo p(Variant::INT, "format", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL); p_list->push_back(p); @@ -1623,17 +1623,17 @@ void RTileMap::_get_property_list(List *p_list) const { p_list->push_back(p); } -void RTileMap::_validate_property(PropertyInfo &property) const { +void TileMap::_validate_property(PropertyInfo &property) const { if (use_parent && property.name != "collision_use_parent" && property.name.begins_with("collision_")) { property.usage = PROPERTY_USAGE_NOEDITOR; } } -Vector2 RTileMap::map_to_world(const Vector2 &p_pos, bool p_ignore_ofs) const { +Vector2 TileMap::map_to_world(const Vector2 &p_pos, bool p_ignore_ofs) const { return _map_to_world(p_pos.x, p_pos.y, p_ignore_ofs); } -Vector2 RTileMap::world_to_map(const Vector2 &p_pos) const { +Vector2 TileMap::world_to_map(const Vector2 &p_pos) const { Vector2 ret = get_cell_transform().affine_inverse().xform(p_pos); // Account for precision errors on the border (GH-23250). @@ -1671,7 +1671,7 @@ Vector2 RTileMap::world_to_map(const Vector2 &p_pos) const { return ret.floor(); } -void RTileMap::set_y_sort_mode(bool p_enable) { +void TileMap::set_y_sort_mode(bool p_enable) { _clear_quadrants(); y_sort_mode = p_enable; RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), y_sort_mode); @@ -1679,33 +1679,33 @@ void RTileMap::set_y_sort_mode(bool p_enable) { emit_signal("settings_changed"); } -bool RTileMap::is_y_sort_mode_enabled() const { +bool TileMap::is_y_sort_mode_enabled() const { return y_sort_mode; } -void RTileMap::set_compatibility_mode(bool p_enable) { +void TileMap::set_compatibility_mode(bool p_enable) { _clear_quadrants(); compatibility_mode = p_enable; _recreate_quadrants(); emit_signal("settings_changed"); } -bool RTileMap::is_compatibility_mode_enabled() const { +bool TileMap::is_compatibility_mode_enabled() const { return compatibility_mode; } -void RTileMap::set_centered_textures(bool p_enable) { +void TileMap::set_centered_textures(bool p_enable) { _clear_quadrants(); centered_textures = p_enable; _recreate_quadrants(); emit_signal("settings_changed"); } -bool RTileMap::is_centered_textures_enabled() const { +bool TileMap::is_centered_textures_enabled() const { return centered_textures; } -Array RTileMap::get_used_cells() const { +Array TileMap::get_used_cells() const { Array a; a.resize(tile_map.size()); int i = 0; @@ -1717,7 +1717,7 @@ Array RTileMap::get_used_cells() const { return a; } -Array RTileMap::get_used_cells_by_id(int p_id) const { +Array TileMap::get_used_cells_by_id(int p_id) const { Array a; for (Map::Element *E = tile_map.front(); E; E = E->next()) { if (E->value().id == p_id) { @@ -1729,7 +1729,7 @@ Array RTileMap::get_used_cells_by_id(int p_id) const { return a; } -Rect2 RTileMap::get_used_rect() { // Not const because of cache +Rect2 TileMap::get_used_rect() { // Not const because of cache if (used_size_cache_dirty) { if (tile_map.size() > 0) { @@ -1750,7 +1750,7 @@ Rect2 RTileMap::get_used_rect() { // Not const because of cache return used_size_cache; } -void RTileMap::set_occluder_light_mask(int p_mask) { +void TileMap::set_occluder_light_mask(int p_mask) { occluder_light_mask = p_mask; for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { for (Map::Element *F = E->get().occluder_instances.front(); F; F = F->next()) { @@ -1759,11 +1759,11 @@ void RTileMap::set_occluder_light_mask(int p_mask) { } } -int RTileMap::get_occluder_light_mask() const { +int TileMap::get_occluder_light_mask() const { return occluder_light_mask; } -void RTileMap::set_light_mask(int p_light_mask) { +void TileMap::set_light_mask(int p_light_mask) { CanvasItem::set_light_mask(p_light_mask); for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { for (List::Element *F = E->get().canvas_items.front(); F; F = F->next()) { @@ -1772,7 +1772,7 @@ void RTileMap::set_light_mask(int p_light_mask) { } } -void RTileMap::set_clip_uv(bool p_enable) { +void TileMap::set_clip_uv(bool p_enable) { if (clip_uv == p_enable) { return; } @@ -1782,142 +1782,142 @@ void RTileMap::set_clip_uv(bool p_enable) { _recreate_quadrants(); } -bool RTileMap::get_clip_uv() const { +bool TileMap::get_clip_uv() const { return clip_uv; } -String RTileMap::get_configuration_warning() const { +String TileMap::get_configuration_warning() const { String warning = Node2D::get_configuration_warning(); if (use_parent && !collision_parent) { if (!warning.empty()) { warning += "\n\n"; } - return TTR("RTileMap with Use Parent on needs a parent CollisionObject2D to give shapes to. Please use it as a child of Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."); + return TTR("TileMap with Use Parent on needs a parent CollisionObject2D to give shapes to. Please use it as a child of Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."); } return warning; } -void RTileMap::set_show_collision(bool p_value) { +void TileMap::set_show_collision(bool p_value) { show_collision = p_value; _recreate_quadrants(); } -bool RTileMap::is_show_collision_enabled() const { +bool TileMap::is_show_collision_enabled() const { return show_collision; } -void RTileMap::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_tileset", "tileset"), &RTileMap::set_tileset); - ClassDB::bind_method(D_METHOD("get_tileset"), &RTileMap::get_tileset); +void TileMap::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_tileset", "tileset"), &TileMap::set_tileset); + ClassDB::bind_method(D_METHOD("get_tileset"), &TileMap::get_tileset); - ClassDB::bind_method(D_METHOD("set_mode", "mode"), &RTileMap::set_mode); - ClassDB::bind_method(D_METHOD("get_mode"), &RTileMap::get_mode); + ClassDB::bind_method(D_METHOD("set_mode", "mode"), &TileMap::set_mode); + ClassDB::bind_method(D_METHOD("get_mode"), &TileMap::get_mode); - ClassDB::bind_method(D_METHOD("set_half_offset", "half_offset"), &RTileMap::set_half_offset); - ClassDB::bind_method(D_METHOD("get_half_offset"), &RTileMap::get_half_offset); + ClassDB::bind_method(D_METHOD("set_half_offset", "half_offset"), &TileMap::set_half_offset); + ClassDB::bind_method(D_METHOD("get_half_offset"), &TileMap::get_half_offset); - ClassDB::bind_method(D_METHOD("set_custom_transform", "custom_transform"), &RTileMap::set_custom_transform); - ClassDB::bind_method(D_METHOD("get_custom_transform"), &RTileMap::get_custom_transform); + ClassDB::bind_method(D_METHOD("set_custom_transform", "custom_transform"), &TileMap::set_custom_transform); + ClassDB::bind_method(D_METHOD("get_custom_transform"), &TileMap::get_custom_transform); - ClassDB::bind_method(D_METHOD("set_cell_size", "size"), &RTileMap::set_cell_size); - ClassDB::bind_method(D_METHOD("get_cell_size"), &RTileMap::get_cell_size); + ClassDB::bind_method(D_METHOD("set_cell_size", "size"), &TileMap::set_cell_size); + ClassDB::bind_method(D_METHOD("get_cell_size"), &TileMap::get_cell_size); - ClassDB::bind_method(D_METHOD("_set_old_cell_size", "size"), &RTileMap::_set_old_cell_size); - ClassDB::bind_method(D_METHOD("_get_old_cell_size"), &RTileMap::_get_old_cell_size); + ClassDB::bind_method(D_METHOD("_set_old_cell_size", "size"), &TileMap::_set_old_cell_size); + ClassDB::bind_method(D_METHOD("_get_old_cell_size"), &TileMap::_get_old_cell_size); - ClassDB::bind_method(D_METHOD("set_quadrant_size", "size"), &RTileMap::set_quadrant_size); - ClassDB::bind_method(D_METHOD("get_quadrant_size"), &RTileMap::get_quadrant_size); + ClassDB::bind_method(D_METHOD("set_quadrant_size", "size"), &TileMap::set_quadrant_size); + ClassDB::bind_method(D_METHOD("get_quadrant_size"), &TileMap::get_quadrant_size); - ClassDB::bind_method(D_METHOD("set_tile_origin", "origin"), &RTileMap::set_tile_origin); - ClassDB::bind_method(D_METHOD("get_tile_origin"), &RTileMap::get_tile_origin); + ClassDB::bind_method(D_METHOD("set_tile_origin", "origin"), &TileMap::set_tile_origin); + ClassDB::bind_method(D_METHOD("get_tile_origin"), &TileMap::get_tile_origin); - ClassDB::bind_method(D_METHOD("set_clip_uv", "enable"), &RTileMap::set_clip_uv); - ClassDB::bind_method(D_METHOD("get_clip_uv"), &RTileMap::get_clip_uv); + ClassDB::bind_method(D_METHOD("set_clip_uv", "enable"), &TileMap::set_clip_uv); + ClassDB::bind_method(D_METHOD("get_clip_uv"), &TileMap::get_clip_uv); - ClassDB::bind_method(D_METHOD("set_y_sort_mode", "enable"), &RTileMap::set_y_sort_mode); - ClassDB::bind_method(D_METHOD("is_y_sort_mode_enabled"), &RTileMap::is_y_sort_mode_enabled); + ClassDB::bind_method(D_METHOD("set_y_sort_mode", "enable"), &TileMap::set_y_sort_mode); + ClassDB::bind_method(D_METHOD("is_y_sort_mode_enabled"), &TileMap::is_y_sort_mode_enabled); - ClassDB::bind_method(D_METHOD("set_compatibility_mode", "enable"), &RTileMap::set_compatibility_mode); - ClassDB::bind_method(D_METHOD("is_compatibility_mode_enabled"), &RTileMap::is_compatibility_mode_enabled); + ClassDB::bind_method(D_METHOD("set_compatibility_mode", "enable"), &TileMap::set_compatibility_mode); + ClassDB::bind_method(D_METHOD("is_compatibility_mode_enabled"), &TileMap::is_compatibility_mode_enabled); - ClassDB::bind_method(D_METHOD("set_show_collision", "enable"), &RTileMap::set_show_collision); - ClassDB::bind_method(D_METHOD("is_show_collision_enabled"), &RTileMap::is_show_collision_enabled); + ClassDB::bind_method(D_METHOD("set_show_collision", "enable"), &TileMap::set_show_collision); + ClassDB::bind_method(D_METHOD("is_show_collision_enabled"), &TileMap::is_show_collision_enabled); - ClassDB::bind_method(D_METHOD("set_centered_textures", "enable"), &RTileMap::set_centered_textures); - ClassDB::bind_method(D_METHOD("is_centered_textures_enabled"), &RTileMap::is_centered_textures_enabled); + ClassDB::bind_method(D_METHOD("set_centered_textures", "enable"), &TileMap::set_centered_textures); + ClassDB::bind_method(D_METHOD("is_centered_textures_enabled"), &TileMap::is_centered_textures_enabled); - ClassDB::bind_method(D_METHOD("set_collision_use_kinematic", "use_kinematic"), &RTileMap::set_collision_use_kinematic); - ClassDB::bind_method(D_METHOD("get_collision_use_kinematic"), &RTileMap::get_collision_use_kinematic); + ClassDB::bind_method(D_METHOD("set_collision_use_kinematic", "use_kinematic"), &TileMap::set_collision_use_kinematic); + ClassDB::bind_method(D_METHOD("get_collision_use_kinematic"), &TileMap::get_collision_use_kinematic); - ClassDB::bind_method(D_METHOD("set_collision_use_parent", "use_parent"), &RTileMap::set_collision_use_parent); - ClassDB::bind_method(D_METHOD("get_collision_use_parent"), &RTileMap::get_collision_use_parent); + ClassDB::bind_method(D_METHOD("set_collision_use_parent", "use_parent"), &TileMap::set_collision_use_parent); + ClassDB::bind_method(D_METHOD("get_collision_use_parent"), &TileMap::get_collision_use_parent); - ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &RTileMap::set_collision_layer); - ClassDB::bind_method(D_METHOD("get_collision_layer"), &RTileMap::get_collision_layer); + ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &TileMap::set_collision_layer); + ClassDB::bind_method(D_METHOD("get_collision_layer"), &TileMap::get_collision_layer); - ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &RTileMap::set_collision_mask); - ClassDB::bind_method(D_METHOD("get_collision_mask"), &RTileMap::get_collision_mask); + ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &TileMap::set_collision_mask); + ClassDB::bind_method(D_METHOD("get_collision_mask"), &TileMap::get_collision_mask); - ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &RTileMap::set_collision_layer_bit); - ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &RTileMap::get_collision_layer_bit); + ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &TileMap::set_collision_layer_bit); + ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &TileMap::get_collision_layer_bit); - ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &RTileMap::set_collision_mask_bit); - ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &RTileMap::get_collision_mask_bit); + ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &TileMap::set_collision_mask_bit); + ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &TileMap::get_collision_mask_bit); - ClassDB::bind_method(D_METHOD("set_collision_friction", "value"), &RTileMap::set_collision_friction); - ClassDB::bind_method(D_METHOD("get_collision_friction"), &RTileMap::get_collision_friction); + ClassDB::bind_method(D_METHOD("set_collision_friction", "value"), &TileMap::set_collision_friction); + ClassDB::bind_method(D_METHOD("get_collision_friction"), &TileMap::get_collision_friction); - ClassDB::bind_method(D_METHOD("set_collision_bounce", "value"), &RTileMap::set_collision_bounce); - ClassDB::bind_method(D_METHOD("get_collision_bounce"), &RTileMap::get_collision_bounce); + ClassDB::bind_method(D_METHOD("set_collision_bounce", "value"), &TileMap::set_collision_bounce); + ClassDB::bind_method(D_METHOD("get_collision_bounce"), &TileMap::get_collision_bounce); - ClassDB::bind_method(D_METHOD("set_bake_navigation", "bake_navigation"), &RTileMap::set_bake_navigation); - ClassDB::bind_method(D_METHOD("is_baking_navigation"), &RTileMap::is_baking_navigation); + ClassDB::bind_method(D_METHOD("set_bake_navigation", "bake_navigation"), &TileMap::set_bake_navigation); + ClassDB::bind_method(D_METHOD("is_baking_navigation"), &TileMap::is_baking_navigation); - ClassDB::bind_method(D_METHOD("set_navigation_layers", "navigation_layers"), &RTileMap::set_navigation_layers); - ClassDB::bind_method(D_METHOD("get_navigation_layers"), &RTileMap::get_navigation_layers); + ClassDB::bind_method(D_METHOD("set_navigation_layers", "navigation_layers"), &TileMap::set_navigation_layers); + ClassDB::bind_method(D_METHOD("get_navigation_layers"), &TileMap::get_navigation_layers); - ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &RTileMap::set_occluder_light_mask); - ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &RTileMap::get_occluder_light_mask); + ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &TileMap::set_occluder_light_mask); + ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &TileMap::get_occluder_light_mask); - ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose", "autotile_coord"), &RTileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false), DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose"), &RTileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("_set_celld", "position", "data"), &RTileMap::_set_celld); - ClassDB::bind_method(D_METHOD("get_cell", "x", "y"), &RTileMap::get_cell); - ClassDB::bind_method(D_METHOD("get_cellv", "position"), &RTileMap::get_cellv); - ClassDB::bind_method(D_METHOD("is_cell_x_flipped", "x", "y"), &RTileMap::is_cell_x_flipped); - ClassDB::bind_method(D_METHOD("is_cell_y_flipped", "x", "y"), &RTileMap::is_cell_y_flipped); - ClassDB::bind_method(D_METHOD("is_cell_transposed", "x", "y"), &RTileMap::is_cell_transposed); + ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose", "autotile_coord"), &TileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false), DEFVAL(Vector2())); + ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("_set_celld", "position", "data"), &TileMap::_set_celld); + ClassDB::bind_method(D_METHOD("get_cell", "x", "y"), &TileMap::get_cell); + ClassDB::bind_method(D_METHOD("get_cellv", "position"), &TileMap::get_cellv); + ClassDB::bind_method(D_METHOD("is_cell_x_flipped", "x", "y"), &TileMap::is_cell_x_flipped); + ClassDB::bind_method(D_METHOD("is_cell_y_flipped", "x", "y"), &TileMap::is_cell_y_flipped); + ClassDB::bind_method(D_METHOD("is_cell_transposed", "x", "y"), &TileMap::is_cell_transposed); - ClassDB::bind_method(D_METHOD("get_cell_autotile_coord", "x", "y"), &RTileMap::get_cell_autotile_coord); + ClassDB::bind_method(D_METHOD("get_cell_autotile_coord", "x", "y"), &TileMap::get_cell_autotile_coord); - ClassDB::bind_method(D_METHOD("fix_invalid_tiles"), &RTileMap::fix_invalid_tiles); - ClassDB::bind_method(D_METHOD("clear"), &RTileMap::clear); + ClassDB::bind_method(D_METHOD("fix_invalid_tiles"), &TileMap::fix_invalid_tiles); + ClassDB::bind_method(D_METHOD("clear"), &TileMap::clear); - ClassDB::bind_method(D_METHOD("get_used_cells"), &RTileMap::get_used_cells); - ClassDB::bind_method(D_METHOD("get_used_cells_by_id", "id"), &RTileMap::get_used_cells_by_id); - ClassDB::bind_method(D_METHOD("get_used_rect"), &RTileMap::get_used_rect); + ClassDB::bind_method(D_METHOD("get_used_cells"), &TileMap::get_used_cells); + ClassDB::bind_method(D_METHOD("get_used_cells_by_id", "id"), &TileMap::get_used_cells_by_id); + ClassDB::bind_method(D_METHOD("get_used_rect"), &TileMap::get_used_rect); - ClassDB::bind_method(D_METHOD("map_to_world", "map_position", "ignore_half_ofs"), &RTileMap::map_to_world, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("world_to_map", "world_position"), &RTileMap::world_to_map); + ClassDB::bind_method(D_METHOD("map_to_world", "map_position", "ignore_half_ofs"), &TileMap::map_to_world, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("world_to_map", "world_position"), &TileMap::world_to_map); - ClassDB::bind_method(D_METHOD("_clear_quadrants"), &RTileMap::_clear_quadrants); - ClassDB::bind_method(D_METHOD("_recreate_quadrants"), &RTileMap::_recreate_quadrants); - ClassDB::bind_method(D_METHOD("update_dirty_quadrants"), &RTileMap::update_dirty_quadrants); + ClassDB::bind_method(D_METHOD("_clear_quadrants"), &TileMap::_clear_quadrants); + ClassDB::bind_method(D_METHOD("_recreate_quadrants"), &TileMap::_recreate_quadrants); + ClassDB::bind_method(D_METHOD("update_dirty_quadrants"), &TileMap::update_dirty_quadrants); - ClassDB::bind_method(D_METHOD("update_bitmask_area", "position"), &RTileMap::update_bitmask_area); - ClassDB::bind_method(D_METHOD("update_bitmask_region", "start", "end"), &RTileMap::update_bitmask_region, DEFVAL(Vector2()), DEFVAL(Vector2())); + ClassDB::bind_method(D_METHOD("update_bitmask_area", "position"), &TileMap::update_bitmask_area); + ClassDB::bind_method(D_METHOD("update_bitmask_region", "start", "end"), &TileMap::update_bitmask_region, DEFVAL(Vector2()), DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("_set_tile_data"), &RTileMap::_set_tile_data); - ClassDB::bind_method(D_METHOD("_get_tile_data"), &RTileMap::_get_tile_data); + ClassDB::bind_method(D_METHOD("_set_tile_data"), &TileMap::_set_tile_data); + ClassDB::bind_method(D_METHOD("_get_tile_data"), &TileMap::_get_tile_data); - ClassDB::bind_method(D_METHOD("set_use_rao", "value"), &RTileMap::set_use_rao); - ClassDB::bind_method(D_METHOD("get_use_rao"), &RTileMap::get_use_rao); + ClassDB::bind_method(D_METHOD("set_use_rao", "value"), &TileMap::set_use_rao); + ClassDB::bind_method(D_METHOD("get_use_rao"), &TileMap::get_use_rao); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_rao"), "set_use_rao", "get_use_rao"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Square,Isometric,Custom"), "set_mode", "get_mode"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tile_set", PROPERTY_HINT_RESOURCE_TYPE, "RTileSet"), "set_tileset", "get_tileset"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tile_set", PROPERTY_HINT_RESOURCE_TYPE, "TileSet"), "set_tileset", "get_tileset"); ADD_GROUP("Cell", "cell_"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "cell_size", PROPERTY_HINT_RANGE, "1,8192,1"), "set_cell_size", "get_cell_size"); @@ -1967,13 +1967,13 @@ void RTileMap::_bind_methods() { BIND_ENUM_CONSTANT(TILE_ORIGIN_BOTTOM_LEFT); } -void RTileMap::_changed_callback(Object *p_changed, const char *p_prop) { +void TileMap::_changed_callback(Object *p_changed, const char *p_prop) { if (tile_set.is_valid() && tile_set.ptr() == p_changed) { emit_signal("settings_changed"); } } -RTileMap::RTileMap() { +TileMap::TileMap() { _use_rao = true; noise.instance(); @@ -2010,7 +2010,7 @@ RTileMap::RTileMap() { set_notify_local_transform(false); } -RTileMap::~RTileMap() { +TileMap::~TileMap() { if (tile_set.is_valid()) { tile_set->remove_change_receptor(this); } diff --git a/modules/rtile_map/tile_map.h b/modules/rtile_map/tile_map.h index 9eb833d1d..77d2447ba 100644 --- a/modules/rtile_map/tile_map.h +++ b/modules/rtile_map/tile_map.h @@ -40,8 +40,8 @@ class CollisionObject2D; -class RTileMap : public Node2D { - GDCLASS(RTileMap, Node2D); +class TileMap : public Node2D { + GDCLASS(TileMap, Node2D); public: enum Mode { @@ -70,7 +70,7 @@ private: FORMAT_2 }; - Ref tile_set; + Ref tile_set; Size2i cell_size; int quadrant_size; Mode mode; @@ -214,7 +214,7 @@ private: void _fix_cell_transform(Transform2D &xform, const Cell &p_cell, const Vector2 &p_offset, const Size2 &p_sc); - void _add_shape(int &shape_idx, const Quadrant &p_q, const Ref &p_shape, const RTileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata); + void _add_shape(int &shape_idx, const Quadrant &p_q, const Ref &p_shape, const TileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata); Map::Element *_create_quadrant(const PosKey &p_qk); void _erase_quadrant(Map::Element *Q); @@ -258,8 +258,8 @@ public: virtual Rect2 _edit_get_rect() const; #endif - void set_tileset(const Ref &p_tileset); - Ref get_tileset() const; + void set_tileset(const Ref &p_tileset); + Ref get_tileset() const; void set_cell_size(const Size2 &p_size); Size2 get_cell_size() const; @@ -371,12 +371,12 @@ public: void fix_invalid_tiles(); void clear(); - RTileMap(); - ~RTileMap(); + TileMap(); + ~TileMap(); }; -VARIANT_ENUM_CAST(RTileMap::Mode); -VARIANT_ENUM_CAST(RTileMap::HalfOffset); -VARIANT_ENUM_CAST(RTileMap::TileOrigin); +VARIANT_ENUM_CAST(TileMap::Mode); +VARIANT_ENUM_CAST(TileMap::HalfOffset); +VARIANT_ENUM_CAST(TileMap::TileOrigin); #endif // TILE_MAP_H diff --git a/modules/rtile_map/tile_map_editor_plugin.cpp b/modules/rtile_map/tile_map_editor_plugin.cpp index 32b4f0b10..ecc881316 100644 --- a/modules/rtile_map/tile_map_editor_plugin.cpp +++ b/modules/rtile_map/tile_map_editor_plugin.cpp @@ -42,13 +42,13 @@ #include "scene/gui/slider.h" #include "scene/gui/split_container.h" -void RTileMapEditor::_node_removed(Node *p_node) { +void TileMapEditor::_node_removed(Node *p_node) { if (p_node == node) { node = nullptr; } } -void RTileMapEditor::_notification(int p_what) { +void TileMapEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_PROCESS: { if (bucket_queue.size()) { @@ -96,7 +96,7 @@ void RTileMapEditor::_notification(int p_what) { if (tool == TOOL_PAINTING) { Vector ids = get_selected_tiles(); - if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) { + if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) { _set_cell(over_tile, ids, flip_h, flip_v, transpose); _finish_undo(); @@ -113,7 +113,7 @@ void RTileMapEditor::_notification(int p_what) { } } -void RTileMapEditor::_update_button_tool() { +void TileMapEditor::_update_button_tool() { ToolButton *tb[4] = { paint_button, bucket_fill_button, picker_button, select_button }; // Unpress all buttons for (int i = 0; i < 4; i++) { @@ -144,7 +144,7 @@ void RTileMapEditor::_update_button_tool() { } } -void RTileMapEditor::_button_tool_select(int p_tool) { +void TileMapEditor::_button_tool_select(int p_tool) { tool = (Tool)p_tool; _update_button_tool(); switch (tool) { @@ -157,7 +157,7 @@ void RTileMapEditor::_button_tool_select(int p_tool) { CanvasItemEditor::get_singleton()->update_viewport(); } -void RTileMapEditor::_menu_option(int p_option) { +void TileMapEditor::_menu_option(int p_option) { switch (p_option) { case OPTION_COPY: { _update_copydata(); @@ -209,15 +209,15 @@ void RTileMapEditor::_menu_option(int p_option) { _update_button_tool(); } -void RTileMapEditor::_palette_selected(int index) { +void TileMapEditor::_palette_selected(int index) { _update_palette(); } -void RTileMapEditor::_palette_multi_selected(int index, bool selected) { +void TileMapEditor::_palette_multi_selected(int index, bool selected) { _update_palette(); } -void RTileMapEditor::_palette_input(const Ref &p_event) { +void TileMapEditor::_palette_input(const Ref &p_event) { const Ref mb = p_event; // Zoom in/out using Ctrl + mouse wheel. @@ -232,21 +232,21 @@ void RTileMapEditor::_palette_input(const Ref &p_event) { } } -void RTileMapEditor::_canvas_mouse_enter() { +void TileMapEditor::_canvas_mouse_enter() { mouse_over = true; CanvasItemEditor::get_singleton()->update_viewport(); } -void RTileMapEditor::_canvas_mouse_exit() { +void TileMapEditor::_canvas_mouse_exit() { mouse_over = false; CanvasItemEditor::get_singleton()->update_viewport(); } -Vector RTileMapEditor::get_selected_tiles() const { +Vector TileMapEditor::get_selected_tiles() const { Vector items = palette->get_selected_items(); if (items.size() == 0) { - items.push_back(RTileMap::INVALID_CELL); + items.push_back(TileMap::INVALID_CELL); return items; } @@ -256,7 +256,7 @@ Vector RTileMapEditor::get_selected_tiles() const { return items; } -void RTileMapEditor::set_selected_tiles(Vector p_tiles) { +void TileMapEditor::set_selected_tiles(Vector p_tiles) { palette->unselect_all(); for (int i = p_tiles.size() - 1; i >= 0; i--) { @@ -270,7 +270,7 @@ void RTileMapEditor::set_selected_tiles(Vector p_tiles) { palette->ensure_current_is_visible(); } -Dictionary RTileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord) { +Dictionary TileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord) { Dictionary cell; cell["id"] = tile; @@ -282,7 +282,7 @@ Dictionary RTileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool f return cell; } -void RTileMapEditor::_create_set_cell_undo_redo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) { +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); @@ -290,12 +290,12 @@ void RTileMapEditor::_create_set_cell_undo_redo(const Vector2 &p_vec, const Cell undo_redo->add_do_method(node, "_set_celld", p_vec, cell_new); } -void RTileMapEditor::_start_undo(const String &p_action) { +void TileMapEditor::_start_undo(const String &p_action) { undo_data.clear(); undo_redo->create_action(p_action); } -void RTileMapEditor::_finish_undo() { +void TileMapEditor::_finish_undo() { if (undo_data.size()) { for (Map::Element *E = undo_data.front(); E; E = E->next()) { _create_set_cell_undo_redo(E->key(), E->get(), _get_op_from_cell(E->key())); @@ -307,7 +307,7 @@ void RTileMapEditor::_finish_undo() { undo_redo->commit_action(); } -void RTileMapEditor::_set_cell(const Point2i &p_pos, Vector p_values, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord) { +void TileMapEditor::_set_cell(const Point2i &p_pos, Vector p_values, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord) { ERR_FAIL_COND(!node); if (p_values.size() == 0) { @@ -357,12 +357,12 @@ void RTileMapEditor::_set_cell(const Point2i &p_pos, Vector p_values, bool return; } - if (manual_autotile || (p_value != -1 && node->get_tileset()->has_tile(p_value) && node->get_tileset()->tile_get_tile_mode(p_value) == RTileSet::ATLAS_TILE)) { + if (manual_autotile || (p_value != -1 && node->get_tileset()->has_tile(p_value) && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE)) { if (current != -1) { node->set_cell_autotile_coord(p_pos.x, p_pos.y, position); - } else if (node->get_tileset()->tile_get_tile_mode(p_value) == RTileSet::ATLAS_TILE && priority_atlastile) { + } else if (node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE && priority_atlastile) { // BIND_CENTER is used to indicate that bitmask should not update for this tile cell. - node->get_tileset()->autotile_set_bitmask(p_value, Vector2(p_pos.x, p_pos.y), RTileSet::BIND_CENTER); + node->get_tileset()->autotile_set_bitmask(p_value, Vector2(p_pos.x, p_pos.y), TileSet::BIND_CENTER); node->update_cell_bitmask(p_pos.x, p_pos.y); } } else { @@ -370,25 +370,25 @@ void RTileMapEditor::_set_cell(const Point2i &p_pos, Vector p_values, bool } } -void RTileMapEditor::_manual_toggled(bool p_enabled) { +void TileMapEditor::_manual_toggled(bool p_enabled) { manual_autotile = p_enabled; _update_palette(); } -void RTileMapEditor::_priority_toggled(bool p_enabled) { +void TileMapEditor::_priority_toggled(bool p_enabled) { priority_atlastile = p_enabled; _update_palette(); } -void RTileMapEditor::_text_entered(const String &p_text) { +void TileMapEditor::_text_entered(const String &p_text) { canvas_item_editor_viewport->grab_focus(); } -void RTileMapEditor::_text_changed(const String &p_text) { +void TileMapEditor::_text_changed(const String &p_text) { _update_palette(); } -void RTileMapEditor::_sbox_input(const Ref &p_ie) { +void TileMapEditor::_sbox_input(const Ref &p_ie) { Ref k = p_ie; if (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_PAGEUP || k->get_scancode() == KEY_PAGEDOWN)) { @@ -397,7 +397,7 @@ void RTileMapEditor::_sbox_input(const Ref &p_ie) { } } -// Implementation detail of RTileMapEditor::_update_palette(); +// Implementation detail of TileMapEditor::_update_palette(); // In modern C++ this could have been inside its body. namespace { struct _PaletteEntry { @@ -412,7 +412,7 @@ struct _PaletteEntry { }; } // namespace -void RTileMapEditor::_update_palette() { +void TileMapEditor::_update_palette() { if (!node) { return; } @@ -428,7 +428,7 @@ void RTileMapEditor::_update_palette() { manual_palette->clear(); manual_palette->hide(); - Ref tileset = node->get_tileset(); + Ref tileset = node->get_tileset(); if (tileset.is_null()) { search_box->set_text(""); search_box->set_editable(false); @@ -503,7 +503,7 @@ void RTileMapEditor::_update_palette() { if (tex.is_valid()) { Rect2 region = tileset->tile_get_region(entries[i].id); - if (tileset->tile_get_tile_mode(entries[i].id) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(entries[i].id) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(entries[i].id) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(entries[i].id) == TileSet::ATLAS_TILE) { 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); @@ -535,7 +535,7 @@ void RTileMapEditor::_update_palette() { } int sel_tile = selected.get(0); - if (selected.get(0) != RTileMap::INVALID_CELL) { + if (selected.get(0) != TileMap::INVALID_CELL) { set_selected_tiles(selected); sel_tile = selected.get(Math::rand() % selected.size()); } else if (palette->get_item_count() > 0) { @@ -543,7 +543,7 @@ void RTileMapEditor::_update_palette() { sel_tile = palette->get_selected_items().get(0); } - if (sel_tile != RTileMap::INVALID_CELL && tileset->has_tile(sel_tile) && ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == RTileSet::AUTO_TILE) || (!priority_atlastile && tileset->tile_get_tile_mode(sel_tile) == RTileSet::ATLAS_TILE))) { + if (sel_tile != TileMap::INVALID_CELL && tileset->has_tile(sel_tile) && ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) || (!priority_atlastile && tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE))) { const Map &tiles2 = tileset->autotile_get_bitmask_map(sel_tile); Vector entries2; @@ -593,7 +593,7 @@ void RTileMapEditor::_update_palette() { manual_palette->show(); } - if (sel_tile != RTileMap::INVALID_CELL && tileset->has_tile(sel_tile) && tileset->tile_get_tile_mode(sel_tile) == RTileSet::AUTO_TILE) { + if (sel_tile != TileMap::INVALID_CELL && tileset->has_tile(sel_tile) && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) { manual_button->show(); priority_button->hide(); } else { @@ -602,10 +602,10 @@ void RTileMapEditor::_update_palette() { } } -void RTileMapEditor::_pick_tile(const Point2 &p_pos) { +void TileMapEditor::_pick_tile(const Point2 &p_pos) { int id = node->get_cell(p_pos.x, p_pos.y); - if (id == RTileMap::INVALID_CELL || !node->get_tileset()->has_tile(id)) { + if (id == TileMap::INVALID_CELL || !node->get_tileset()->has_tile(id)) { return; } @@ -624,24 +624,24 @@ void RTileMapEditor::_pick_tile(const Point2 &p_pos) { set_selected_tiles(selected); _update_palette(); - if ((manual_autotile && node->get_tileset()->tile_get_tile_mode(id) == RTileSet::AUTO_TILE) || (!priority_atlastile && node->get_tileset()->tile_get_tile_mode(id) == RTileSet::ATLAS_TILE)) { + if ((manual_autotile && node->get_tileset()->tile_get_tile_mode(id) == TileSet::AUTO_TILE) || (!priority_atlastile && node->get_tileset()->tile_get_tile_mode(id) == TileSet::ATLAS_TILE)) { manual_palette->select(manual_palette->find_metadata((Point2)autotile_coord)); } CanvasItemEditor::get_singleton()->update_viewport(); } -PoolVector RTileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) { +PoolVector TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) { int prev_id = node->get_cell(p_start.x, p_start.y); Vector ids; - ids.push_back(RTileMap::INVALID_CELL); + ids.push_back(TileMap::INVALID_CELL); if (!erase) { ids = get_selected_tiles(); - if (ids.size() == 0 || ids[0] == RTileMap::INVALID_CELL) { + if (ids.size() == 0 || ids[0] == TileMap::INVALID_CELL) { return PoolVector(); } - } else if (prev_id == RTileMap::INVALID_CELL) { + } else if (prev_id == TileMap::INVALID_CELL) { return PoolVector(); } @@ -744,7 +744,7 @@ PoolVector RTileMapEditor::_bucket_fill(const Point2i &p_start, bool er return preview ? bucket_cache : points; } -void RTileMapEditor::_fill_points(const PoolVector &p_points, const Dictionary &p_op) { +void TileMapEditor::_fill_points(const PoolVector &p_points, const Dictionary &p_op) { int len = p_points.size(); PoolVector::Read pr = p_points.read(); @@ -762,7 +762,7 @@ void RTileMapEditor::_fill_points(const PoolVector &p_points, const Dic } } -void RTileMapEditor::_erase_points(const PoolVector &p_points) { +void TileMapEditor::_erase_points(const PoolVector &p_points) { int len = p_points.size(); PoolVector::Read pr = p_points.read(); @@ -771,7 +771,7 @@ void RTileMapEditor::_erase_points(const PoolVector &p_points) { } } -void RTileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) { +void TileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) { Point2i begin = p_from; Point2i end = p_to; @@ -788,7 +788,7 @@ void RTileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) { CanvasItemEditor::get_singleton()->update_viewport(); } -void RTileMapEditor::_erase_selection() { +void TileMapEditor::_erase_selection() { if (!selection_active) { return; } @@ -800,7 +800,7 @@ void RTileMapEditor::_erase_selection() { } } -void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) { +void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) { if (!node->get_tileset()->has_tile(p_cell)) { return; } @@ -813,11 +813,11 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i & 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_tile_mode(p_cell) == RTileSet::AUTO_TILE || node->get_tileset()->tile_get_tile_mode(p_cell) == RTileSet::ATLAS_TILE) { + if (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::AUTO_TILE || node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE) { Vector2 offset; if (tool != TOOL_PASTING) { int selected = manual_palette->get_current(); - if ((manual_autotile || (node->get_tileset()->tile_get_tile_mode(p_cell) == RTileSet::ATLAS_TILE && !priority_atlastile)) && selected != -1) { + if ((manual_autotile || (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE && !priority_atlastile)) && selected != -1) { offset = manual_palette->get_item_metadata(selected); } else { offset = node->get_tileset()->autotile_get_icon_coordinate(p_cell); @@ -875,9 +875,9 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i & } if (compatibility_mode_enabled && !centered_texture) { - if (node->get_tile_origin() == RTileMap::TILE_ORIGIN_TOP_LEFT) { + if (node->get_tile_origin() == TileMap::TILE_ORIGIN_TOP_LEFT) { rect.position += tile_ofs; - } else if (node->get_tile_origin() == RTileMap::TILE_ORIGIN_BOTTOM_LEFT) { + } else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_BOTTOM_LEFT) { rect.position += tile_ofs; if (p_transpose) { @@ -894,7 +894,7 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i & } } - } else if (node->get_tile_origin() == RTileMap::TILE_ORIGIN_CENTER) { + } else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_CENTER) { rect.position += tile_ofs; if (p_flip_h) { @@ -926,7 +926,7 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i & p_viewport->draw_set_transform_matrix(old_transform); } -void RTileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) { +void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) { PoolVector points = _bucket_fill(p_point, false, true); PoolVector::Read pr = points.read(); int len = points.size(); @@ -936,14 +936,14 @@ void RTileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const P } } -void RTileMapEditor::_clear_bucket_cache() { +void TileMapEditor::_clear_bucket_cache() { if (bucket_cache_visited) { delete[] bucket_cache_visited; bucket_cache_visited = nullptr; } } -void RTileMapEditor::_update_copydata() { +void TileMapEditor::_update_copydata() { copydata.clear(); if (!selection_active) { @@ -955,7 +955,7 @@ void RTileMapEditor::_update_copydata() { TileData tcd; tcd.cell = node->get_cell(j, i); - if (tcd.cell != RTileMap::INVALID_CELL) { + if (tcd.cell != TileMap::INVALID_CELL) { tcd.pos = Point2i(j, i); tcd.flip_h = node->is_cell_x_flipped(j, i); tcd.flip_v = node->is_cell_y_flipped(j, i); @@ -1011,7 +1011,7 @@ static inline Vector line(int x0, int x1, int y0, int y1) { return points; } -bool RTileMapEditor::forward_gui_input(const Ref &p_event) { +bool TileMapEditor::forward_gui_input(const Ref &p_event) { if (!node || !node->get_tileset().is_valid() || !node->is_visible_in_tree() || CanvasItemEditor::get_singleton()->get_current_tool() != CanvasItemEditor::TOOL_SELECT) { return false; } @@ -1069,7 +1069,7 @@ bool RTileMapEditor::forward_gui_input(const Ref &p_event) { if (tool == TOOL_PAINTING) { Vector ids = get_selected_tiles(); - if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) { + if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) { tool = TOOL_PAINTING; _start_undo(TTR("Paint TileMap")); @@ -1090,7 +1090,7 @@ bool RTileMapEditor::forward_gui_input(const Ref &p_event) { if (tool == TOOL_PAINTING) { Vector ids = get_selected_tiles(); - if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) { + if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) { _set_cell(over_tile, ids, flip_h, flip_v, transpose); _finish_undo(); @@ -1099,7 +1099,7 @@ bool RTileMapEditor::forward_gui_input(const Ref &p_event) { } else if (tool == TOOL_LINE_PAINT) { Vector ids = get_selected_tiles(); - if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) { + if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) { _start_undo(TTR("Line Draw")); for (Map::Element *E = paint_undo.front(); E; E = E->next()) { _set_cell(E->key(), ids, flip_h, flip_v, transpose); @@ -1113,7 +1113,7 @@ bool RTileMapEditor::forward_gui_input(const Ref &p_event) { } else if (tool == TOOL_RECTANGLE_PAINT) { Vector ids = get_selected_tiles(); - if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) { + if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) { _start_undo(TTR("Rectangle Paint")); for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) { for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) { @@ -1341,7 +1341,7 @@ bool RTileMapEditor::forward_gui_input(const Ref &p_event) { paint_undo.clear(); - if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) { + if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) { Vector points = line(rectangle_begin.x, over_tile.x, rectangle_begin.y, over_tile.y); for (int i = 0; i < points.size(); i++) { @@ -1544,7 +1544,7 @@ bool RTileMapEditor::forward_gui_input(const Ref &p_event) { return false; } -void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { +void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { if (!node || CanvasItemEditor::get_singleton()->get_current_tool() != CanvasItemEditor::TOOL_SELECT) { return; } @@ -1562,7 +1562,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { aabb.expand_to(node->world_to_map(xform_inv.xform(screen_size))); Rect2i si = aabb.grow(1.0); - if (node->get_half_offset() != RTileMap::HALF_OFFSET_X && node->get_half_offset() != RTileMap::HALF_OFFSET_NEGATIVE_X) { + if (node->get_half_offset() != TileMap::HALF_OFFSET_X && node->get_half_offset() != TileMap::HALF_OFFSET_NEGATIVE_X) { int max_lines = 2000; //avoid crash if size too small for (int i = (si.position.x) - 1; i <= (si.position.x + si.size.x); i++) { @@ -1582,7 +1582,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { for (int j = (si.position.y) - 1; j <= (si.position.y + si.size.y); j++) { Vector2 ofs; if (ABS(j) & 1) { - ofs = cell_xf[0] * (node->get_half_offset() == RTileMap::HALF_OFFSET_X ? 0.5 : -0.5); + ofs = cell_xf[0] * (node->get_half_offset() == TileMap::HALF_OFFSET_X ? 0.5 : -0.5); } Vector2 from = xform.xform(node->map_to_world(Vector2(i, j), true) + ofs); @@ -1603,7 +1603,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { int max_lines = 10000; //avoid crash if size too small - if (node->get_half_offset() != RTileMap::HALF_OFFSET_Y && node->get_half_offset() != RTileMap::HALF_OFFSET_NEGATIVE_Y) { + if (node->get_half_offset() != TileMap::HALF_OFFSET_Y && node->get_half_offset() != TileMap::HALF_OFFSET_NEGATIVE_Y) { for (int i = (si.position.y) - 1; i <= (si.position.y + si.size.y); i++) { Vector2 from = xform.xform(node->map_to_world(Vector2(si.position.x, i))); Vector2 to = xform.xform(node->map_to_world(Vector2(si.position.x + si.size.x + 1, i))); @@ -1620,7 +1620,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { for (int j = (si.position.x) - 1; j <= (si.position.x + si.size.x); j++) { Vector2 ofs; if (ABS(j) & 1) { - ofs = cell_xf[1] * (node->get_half_offset() == RTileMap::HALF_OFFSET_Y ? 0.5 : -0.5); + ofs = cell_xf[1] * (node->get_half_offset() == TileMap::HALF_OFFSET_Y ? 0.5 : -0.5); } Vector2 from = xform.xform(node->map_to_world(Vector2(j, i), true) + ofs); @@ -1659,22 +1659,22 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { }; for (int i = 0; i < 4; i++) { - if (node->get_half_offset() == RTileMap::HALF_OFFSET_X && ABS(over_tile.y) & 1) { + if (node->get_half_offset() == TileMap::HALF_OFFSET_X && ABS(over_tile.y) & 1) { endpoints[i] += cell_xf[0] * 0.5; } - if (node->get_half_offset() == RTileMap::HALF_OFFSET_NEGATIVE_X && ABS(over_tile.y) & 1) { + if (node->get_half_offset() == TileMap::HALF_OFFSET_NEGATIVE_X && ABS(over_tile.y) & 1) { endpoints[i] += cell_xf[0] * -0.5; } - if (node->get_half_offset() == RTileMap::HALF_OFFSET_Y && ABS(over_tile.x) & 1) { + if (node->get_half_offset() == TileMap::HALF_OFFSET_Y && ABS(over_tile.x) & 1) { endpoints[i] += cell_xf[1] * 0.5; } - if (node->get_half_offset() == RTileMap::HALF_OFFSET_NEGATIVE_Y && ABS(over_tile.x) & 1) { + if (node->get_half_offset() == TileMap::HALF_OFFSET_NEGATIVE_Y && ABS(over_tile.x) & 1) { endpoints[i] += cell_xf[1] * -0.5; } endpoints[i] = xform.xform(endpoints[i]); } Color col; - if (node->get_cell(over_tile.x, over_tile.y) != RTileMap::INVALID_CELL) { + if (node->get_cell(over_tile.x, over_tile.y) != TileMap::INVALID_CELL) { col = Color(0.2, 0.8, 1.0, 0.8); } else { col = Color(1.0, 0.4, 0.2, 0.8); @@ -1696,7 +1696,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { Vector ids = get_selected_tiles(); - if (ids.size() == 1 && ids[0] == RTileMap::INVALID_CELL) { + if (ids.size() == 1 && ids[0] == TileMap::INVALID_CELL) { return; } @@ -1707,7 +1707,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { } else if (tool == TOOL_RECTANGLE_PAINT) { Vector ids = get_selected_tiles(); - if (ids.size() == 1 && ids[0] == RTileMap::INVALID_CELL) { + if (ids.size() == 1 && ids[0] == TileMap::INVALID_CELL) { return; } @@ -1721,7 +1721,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { return; } - Ref ts = node->get_tileset(); + Ref ts = node->get_tileset(); if (ts.is_null()) { return; @@ -1757,7 +1757,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { } else { Vector st = get_selected_tiles(); - if (st.size() == 1 && st[0] == RTileMap::INVALID_CELL) { + if (st.size() == 1 && st[0] == TileMap::INVALID_CELL) { return; } @@ -1766,7 +1766,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { } } -void RTileMapEditor::edit(Node *p_tile_map) { +void TileMapEditor::edit(Node *p_tile_map) { search_box->set_text(""); if (!canvas_item_editor_viewport) { @@ -1778,7 +1778,7 @@ void RTileMapEditor::edit(Node *p_tile_map) { } if (p_tile_map) { - node = Object::cast_to(p_tile_map); + node = Object::cast_to(p_tile_map); if (!canvas_item_editor_viewport->is_connected("mouse_entered", this, "_canvas_mouse_enter")) { canvas_item_editor_viewport->connect("mouse_entered", this, "_canvas_mouse_enter"); } @@ -1808,12 +1808,12 @@ void RTileMapEditor::edit(Node *p_tile_map) { _clear_bucket_cache(); } -void RTileMapEditor::_tileset_settings_changed() { +void TileMapEditor::_tileset_settings_changed() { _update_palette(); CanvasItemEditor::get_singleton()->update_viewport(); } -void RTileMapEditor::_icon_size_changed(float p_value) { +void TileMapEditor::_icon_size_changed(float p_value) { if (node) { palette->set_icon_scale(p_value); manual_palette->set_icon_scale(p_value); @@ -1821,36 +1821,36 @@ void RTileMapEditor::_icon_size_changed(float p_value) { } } -void RTileMapEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_manual_toggled"), &RTileMapEditor::_manual_toggled); - ClassDB::bind_method(D_METHOD("_priority_toggled"), &RTileMapEditor::_priority_toggled); - ClassDB::bind_method(D_METHOD("_text_entered"), &RTileMapEditor::_text_entered); - ClassDB::bind_method(D_METHOD("_text_changed"), &RTileMapEditor::_text_changed); - ClassDB::bind_method(D_METHOD("_sbox_input"), &RTileMapEditor::_sbox_input); - ClassDB::bind_method(D_METHOD("_button_tool_select"), &RTileMapEditor::_button_tool_select); - ClassDB::bind_method(D_METHOD("_menu_option"), &RTileMapEditor::_menu_option); - ClassDB::bind_method(D_METHOD("_canvas_mouse_enter"), &RTileMapEditor::_canvas_mouse_enter); - ClassDB::bind_method(D_METHOD("_canvas_mouse_exit"), &RTileMapEditor::_canvas_mouse_exit); - ClassDB::bind_method(D_METHOD("_tileset_settings_changed"), &RTileMapEditor::_tileset_settings_changed); - ClassDB::bind_method(D_METHOD("_rotate"), &RTileMapEditor::_rotate); - ClassDB::bind_method(D_METHOD("_flip_horizontal"), &RTileMapEditor::_flip_horizontal); - ClassDB::bind_method(D_METHOD("_flip_vertical"), &RTileMapEditor::_flip_vertical); - ClassDB::bind_method(D_METHOD("_clear_transform"), &RTileMapEditor::_clear_transform); - ClassDB::bind_method(D_METHOD("_palette_selected"), &RTileMapEditor::_palette_selected); - ClassDB::bind_method(D_METHOD("_palette_multi_selected"), &RTileMapEditor::_palette_multi_selected); - ClassDB::bind_method(D_METHOD("_palette_input"), &RTileMapEditor::_palette_input); +void TileMapEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("_manual_toggled"), &TileMapEditor::_manual_toggled); + ClassDB::bind_method(D_METHOD("_priority_toggled"), &TileMapEditor::_priority_toggled); + ClassDB::bind_method(D_METHOD("_text_entered"), &TileMapEditor::_text_entered); + ClassDB::bind_method(D_METHOD("_text_changed"), &TileMapEditor::_text_changed); + ClassDB::bind_method(D_METHOD("_sbox_input"), &TileMapEditor::_sbox_input); + ClassDB::bind_method(D_METHOD("_button_tool_select"), &TileMapEditor::_button_tool_select); + ClassDB::bind_method(D_METHOD("_menu_option"), &TileMapEditor::_menu_option); + ClassDB::bind_method(D_METHOD("_canvas_mouse_enter"), &TileMapEditor::_canvas_mouse_enter); + ClassDB::bind_method(D_METHOD("_canvas_mouse_exit"), &TileMapEditor::_canvas_mouse_exit); + ClassDB::bind_method(D_METHOD("_tileset_settings_changed"), &TileMapEditor::_tileset_settings_changed); + ClassDB::bind_method(D_METHOD("_rotate"), &TileMapEditor::_rotate); + ClassDB::bind_method(D_METHOD("_flip_horizontal"), &TileMapEditor::_flip_horizontal); + ClassDB::bind_method(D_METHOD("_flip_vertical"), &TileMapEditor::_flip_vertical); + ClassDB::bind_method(D_METHOD("_clear_transform"), &TileMapEditor::_clear_transform); + ClassDB::bind_method(D_METHOD("_palette_selected"), &TileMapEditor::_palette_selected); + ClassDB::bind_method(D_METHOD("_palette_multi_selected"), &TileMapEditor::_palette_multi_selected); + ClassDB::bind_method(D_METHOD("_palette_input"), &TileMapEditor::_palette_input); - ClassDB::bind_method(D_METHOD("_fill_points"), &RTileMapEditor::_fill_points); - ClassDB::bind_method(D_METHOD("_erase_points"), &RTileMapEditor::_erase_points); + ClassDB::bind_method(D_METHOD("_fill_points"), &TileMapEditor::_fill_points); + ClassDB::bind_method(D_METHOD("_erase_points"), &TileMapEditor::_erase_points); - ClassDB::bind_method(D_METHOD("_icon_size_changed"), &RTileMapEditor::_icon_size_changed); - ClassDB::bind_method(D_METHOD("_node_removed"), &RTileMapEditor::_node_removed); + ClassDB::bind_method(D_METHOD("_icon_size_changed"), &TileMapEditor::_icon_size_changed); + ClassDB::bind_method(D_METHOD("_node_removed"), &TileMapEditor::_node_removed); } -RTileMapEditor::CellOp RTileMapEditor::_get_op_from_cell(const Point2i &p_pos) { +TileMapEditor::CellOp TileMapEditor::_get_op_from_cell(const Point2i &p_pos) { CellOp op; op.idx = node->get_cell(p_pos.x, p_pos.y); - if (op.idx != RTileMap::INVALID_CELL) { + if (op.idx != TileMap::INVALID_CELL) { if (node->is_cell_x_flipped(p_pos.x, p_pos.y)) { op.xf = true; } @@ -1865,7 +1865,7 @@ RTileMapEditor::CellOp RTileMapEditor::_get_op_from_cell(const Point2i &p_pos) { return op; } -void RTileMapEditor::_rotate(int steps) { +void TileMapEditor::_rotate(int steps) { const bool normal_rotation_matrix[][3] = { { false, false, false }, { true, true, false }, @@ -1911,24 +1911,24 @@ void RTileMapEditor::_rotate(int steps) { _update_palette(); } -void RTileMapEditor::_flip_horizontal() { +void TileMapEditor::_flip_horizontal() { flip_h = !flip_h; _update_palette(); } -void RTileMapEditor::_flip_vertical() { +void TileMapEditor::_flip_vertical() { flip_v = !flip_v; _update_palette(); } -void RTileMapEditor::_clear_transform() { +void TileMapEditor::_clear_transform() { transpose = false; flip_h = false; flip_v = false; _update_palette(); } -RTileMapEditor::RTileMapEditor(EditorNode *p_editor) { +TileMapEditor::TileMapEditor(EditorNode *p_editor) { node = nullptr; manual_autotile = false; priority_atlastile = false; @@ -1949,7 +1949,7 @@ RTileMapEditor::RTileMapEditor(EditorNode *p_editor) { bucket_cache_visited = nullptr; invalid_cell.resize(1); - invalid_cell.write[0] = RTileMap::INVALID_CELL; + invalid_cell.write[0] = TileMap::INVALID_CELL; ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase Selection"), KEY_DELETE); ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find Tile"), KEY_MASK_CMD + KEY_F); @@ -2083,7 +2083,7 @@ RTileMapEditor::RTileMapEditor(EditorNode *p_editor) { // Menu. options = memnew(MenuButton); - options->set_text("RTileMap"); + options->set_text("TileMap"); options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("TileMap", "EditorIcons")); options->set_process_unhandled_key_input(false); toolbar_right->add_child(options); @@ -2134,7 +2134,7 @@ RTileMapEditor::RTileMapEditor(EditorNode *p_editor) { clear_transform_button->set_disabled(true); } -RTileMapEditor::~RTileMapEditor() { +TileMapEditor::~TileMapEditor() { _clear_bucket_cache(); copydata.clear(); } @@ -2143,7 +2143,7 @@ RTileMapEditor::~RTileMapEditor() { /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// -void RTileMapEditorPlugin::_notification(int p_what) { +void TileMapEditorPlugin::_notification(int p_what) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { switch ((int)EditorSettings::get_singleton()->get("editors/tile_map/editor_side")) { case 0: { // Left. @@ -2156,15 +2156,15 @@ void RTileMapEditorPlugin::_notification(int p_what) { } } -void RTileMapEditorPlugin::edit(Object *p_object) { +void TileMapEditorPlugin::edit(Object *p_object) { tile_map_editor->edit(Object::cast_to(p_object)); } -bool RTileMapEditorPlugin::handles(Object *p_object) const { - return p_object->is_class("RTileMap"); +bool TileMapEditorPlugin::handles(Object *p_object) const { + return p_object->is_class("TileMap"); } -void RTileMapEditorPlugin::make_visible(bool p_visible) { +void TileMapEditorPlugin::make_visible(bool p_visible) { if (p_visible) { tile_map_editor->show(); tile_map_editor->get_toolbar()->show(); @@ -2184,7 +2184,7 @@ void RTileMapEditorPlugin::make_visible(bool p_visible) { } } -RTileMapEditorPlugin::RTileMapEditorPlugin(EditorNode *p_node) { +TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { EDITOR_DEF("editors/tile_map/preview_size", 64); EDITOR_DEF("editors/tile_map/palette_item_hseparation", 8); EDITOR_DEF("editors/tile_map/show_tile_names", true); @@ -2194,7 +2194,7 @@ RTileMapEditorPlugin::RTileMapEditorPlugin(EditorNode *p_node) { EDITOR_DEF("editors/tile_map/editor_side", 1); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/tile_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right")); - tile_map_editor = memnew(RTileMapEditor(p_node)); + tile_map_editor = memnew(TileMapEditor(p_node)); switch ((int)EditorSettings::get_singleton()->get("editors/tile_map/editor_side")) { case 0: { // Left. add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE_LEFT, tile_map_editor); @@ -2206,5 +2206,5 @@ RTileMapEditorPlugin::RTileMapEditorPlugin(EditorNode *p_node) { tile_map_editor->hide(); } -RTileMapEditorPlugin::~RTileMapEditorPlugin() { +TileMapEditorPlugin::~TileMapEditorPlugin() { } diff --git a/modules/rtile_map/tile_map_editor_plugin.h b/modules/rtile_map/tile_map_editor_plugin.h index c4a5dbab4..c638aa35e 100644 --- a/modules/rtile_map/tile_map_editor_plugin.h +++ b/modules/rtile_map/tile_map_editor_plugin.h @@ -45,8 +45,8 @@ class PopupMenu; class ItemList; class VSeparator; -class RTileMapEditor : public VBoxContainer { - GDCLASS(RTileMapEditor, VBoxContainer); +class TileMapEditor : public VBoxContainer { + GDCLASS(TileMapEditor, VBoxContainer); enum Tool { @@ -71,7 +71,7 @@ class RTileMapEditor : public VBoxContainer { OPTION_CUT }; - RTileMap *node; + TileMap *node; bool manual_autotile; bool priority_atlastile; Vector2 manual_position; @@ -138,7 +138,7 @@ class RTileMapEditor : public VBoxContainer { Vector2 ac; CellOp() : - idx(RTileMap::INVALID_CELL), + idx(TileMap::INVALID_CELL), xf(false), yf(false), tr(false) {} @@ -155,7 +155,7 @@ class RTileMapEditor : public VBoxContainer { Point2i autotile_coord; TileData() : - cell(RTileMap::INVALID_CELL), + cell(TileMap::INVALID_CELL), flip_h(false), flip_v(false), transpose(false) {} @@ -230,14 +230,14 @@ public: void edit(Node *p_tile_map); - RTileMapEditor(EditorNode *p_editor); - ~RTileMapEditor(); + TileMapEditor(EditorNode *p_editor); + ~TileMapEditor(); }; -class RTileMapEditorPlugin : public EditorPlugin { - GDCLASS(RTileMapEditorPlugin, EditorPlugin); +class TileMapEditorPlugin : public EditorPlugin { + GDCLASS(TileMapEditorPlugin, EditorPlugin); - RTileMapEditor *tile_map_editor; + TileMapEditor *tile_map_editor; protected: void _notification(int p_what); @@ -246,14 +246,14 @@ public: virtual bool forward_canvas_gui_input(const Ref &p_event) { return tile_map_editor->forward_gui_input(p_event); } virtual void forward_canvas_draw_over_viewport(Control *p_overlay) { tile_map_editor->forward_canvas_draw_over_viewport(p_overlay); } - virtual String get_name() const { return "RTileMap"; } + virtual String get_name() const { return "TileMap"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); - RTileMapEditorPlugin(EditorNode *p_node); - ~RTileMapEditorPlugin(); + TileMapEditorPlugin(EditorNode *p_node); + ~TileMapEditorPlugin(); }; #endif // TILE_MAP_EDITOR_PLUGIN_H diff --git a/modules/rtile_map/tile_set.cpp b/modules/rtile_map/tile_set.cpp index 7c1f7ccef..ac77bd233 100644 --- a/modules/rtile_map/tile_set.cpp +++ b/modules/rtile_map/tile_set.cpp @@ -32,7 +32,7 @@ #include "core/variant/array.h" #include "core/config/engine.h" -bool RTileSet::_set(const StringName &p_name, const Variant &p_value) { +bool TileSet::_set(const StringName &p_name, const Variant &p_value) { String n = p_name; int slash = n.find("/"); if (slash == -1) { @@ -208,7 +208,7 @@ bool RTileSet::_set(const StringName &p_name, const Variant &p_value) { return true; } -bool RTileSet::_get(const StringName &p_name, Variant &r_ret) const { +bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { String n = p_name; int slash = n.find("/"); if (slash == -1) { @@ -323,7 +323,7 @@ bool RTileSet::_get(const StringName &p_name, Variant &r_ret) const { return true; } -void RTileSet::_get_property_list(List *p_list) const { +void TileSet::_get_property_list(List *p_list) const { for (Map::Element *E = tile_map.front(); E; E = E->next()) { int id = E->key(); String pre = itos(id) + "/"; @@ -368,154 +368,154 @@ void RTileSet::_get_property_list(List *p_list) const { } } -void RTileSet::create_tile(int p_id) { - ERR_FAIL_COND_MSG(tile_map.has(p_id), vformat("The RTileSet already has a tile with ID '%d'.", p_id)); +void TileSet::create_tile(int p_id) { + ERR_FAIL_COND_MSG(tile_map.has(p_id), vformat("The TileSet already has a tile with ID '%d'.", p_id)); tile_map[p_id] = TileData(); tile_map[p_id].autotile_data = AutotileData(); _change_notify(""); emit_changed(); } -void RTileSet::autotile_set_bitmask_mode(int p_id, BitmaskMode p_mode) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_bitmask_mode(int p_id, BitmaskMode p_mode) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].autotile_data.bitmask_mode = p_mode; _change_notify(""); emit_changed(); } -RTileSet::BitmaskMode RTileSet::autotile_get_bitmask_mode(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), BITMASK_2X2, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +TileSet::BitmaskMode TileSet::autotile_get_bitmask_mode(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), BITMASK_2X2, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.bitmask_mode; } -void RTileSet::tile_set_texture(int p_id, const Ref &p_texture) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_texture(int p_id, const Ref &p_texture) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].texture = p_texture; emit_changed(); _change_notify("texture"); } -Ref RTileSet::tile_get_texture(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::tile_get_texture(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].texture; } -void RTileSet::tile_set_normal_map(int p_id, const Ref &p_normal_map) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_normal_map(int p_id, const Ref &p_normal_map) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].normal_map = p_normal_map; emit_changed(); } -Ref RTileSet::tile_get_normal_map(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::tile_get_normal_map(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].normal_map; } -void RTileSet::tile_set_material(int p_id, const Ref &p_material) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_material(int p_id, const Ref &p_material) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].material = p_material; emit_changed(); } -Ref RTileSet::tile_get_material(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::tile_get_material(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].material; } -void RTileSet::tile_set_modulate(int p_id, const Color &p_modulate) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_modulate(int p_id, const Color &p_modulate) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].modulate = p_modulate; emit_changed(); _change_notify("modulate"); } -Color RTileSet::tile_get_modulate(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Color(1, 1, 1), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Color TileSet::tile_get_modulate(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Color(1, 1, 1), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].modulate; } -void RTileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].offset = p_offset; emit_changed(); } -Vector2 RTileSet::tile_get_texture_offset(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Vector2 TileSet::tile_get_texture_offset(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].offset; } -void RTileSet::tile_set_region(int p_id, const Rect2 &p_region) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_region(int p_id, const Rect2 &p_region) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].region = p_region; emit_changed(); _change_notify("region"); } -Rect2 RTileSet::tile_get_region(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Rect2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Rect2 TileSet::tile_get_region(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Rect2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].region; } -void RTileSet::tile_set_tile_mode(int p_id, TileMode p_tile_mode) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_tile_mode(int p_id, TileMode p_tile_mode) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].tile_mode = p_tile_mode; emit_changed(); _change_notify("tile_mode"); } -RTileSet::TileMode RTileSet::tile_get_tile_mode(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), SINGLE_TILE, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +TileSet::TileMode TileSet::tile_get_tile_mode(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), SINGLE_TILE, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].tile_mode; } -void RTileSet::autotile_set_icon_coordinate(int p_id, const Vector2 &coord) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_icon_coordinate(int p_id, const Vector2 &coord) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].autotile_data.icon_coord = coord; emit_changed(); } -Vector2 RTileSet::autotile_get_icon_coordinate(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Vector2 TileSet::autotile_get_icon_coordinate(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.icon_coord; } -void RTileSet::autotile_set_spacing(int p_id, int p_spacing) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_spacing(int p_id, int p_spacing) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND(p_spacing < 0); tile_map[p_id].autotile_data.spacing = p_spacing; emit_changed(); } -int RTileSet::autotile_get_spacing(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +int TileSet::autotile_get_spacing(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.spacing; } -void RTileSet::autotile_set_size(int p_id, const Size2 &p_size) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_size(int p_id, const Size2 &p_size) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND(p_size.x <= 0 || p_size.y <= 0); tile_map[p_id].autotile_data.size = p_size; } -Size2 RTileSet::autotile_get_size(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Size2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Size2 TileSet::autotile_get_size(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Size2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.size; } -void RTileSet::autotile_clear_bitmask_map(int p_id) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_clear_bitmask_map(int p_id) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].autotile_data.flags.clear(); } -void RTileSet::autotile_set_subtile_priority(int p_id, const Vector2 &p_coord, int p_priority) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_subtile_priority(int p_id, const Vector2 &p_coord, int p_priority) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND(p_priority <= 0); tile_map[p_id].autotile_data.priority_map[p_coord] = p_priority; } -int RTileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +int TileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (tile_map[p_id].autotile_data.priority_map.has(p_coord)) { return tile_map[p_id].autotile_data.priority_map[p_coord]; } @@ -523,20 +523,20 @@ int RTileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) { return 1; } -const Map &RTileSet::autotile_get_priority_map(int p_id) const { +const Map &TileSet::autotile_get_priority_map(int p_id) const { static Map dummy; - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.priority_map; } -void RTileSet::autotile_set_z_index(int p_id, const Vector2 &p_coord, int p_z_index) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_z_index(int p_id, const Vector2 &p_coord, int p_z_index) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].autotile_data.z_index_map[p_coord] = p_z_index; emit_changed(); } -int RTileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +int TileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (tile_map[p_id].autotile_data.z_index_map.has(p_coord)) { return tile_map[p_id].autotile_data.z_index_map[p_coord]; } @@ -544,14 +544,14 @@ int RTileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) { return 0; } -const Map &RTileSet::autotile_get_z_index_map(int p_id) const { +const Map &TileSet::autotile_get_z_index_map(int p_id) const { static Map dummy; - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.z_index_map; } -void RTileSet::autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p_flag) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p_flag) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (p_flag == 0) { if (tile_map[p_id].autotile_data.flags.has(p_coord)) { tile_map[p_id].autotile_data.flags.erase(p_coord); @@ -561,18 +561,18 @@ void RTileSet::autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p } } -uint32_t RTileSet::autotile_get_bitmask(int p_id, const Vector2 &p_coord) { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +uint32_t TileSet::autotile_get_bitmask(int p_id, const Vector2 &p_coord) { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (!tile_map[p_id].autotile_data.flags.has(p_coord)) { return 0; } return tile_map[p_id].autotile_data.flags[p_coord]; } -const Map &RTileSet::autotile_get_bitmask_map(int p_id) { +const Map &TileSet::autotile_get_bitmask_map(int p_id) { static Map dummy; static Map dummy_atlas; - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (tile_get_tile_mode(p_id) == ATLAS_TILE) { dummy_atlas = Map(); Rect2 region = tile_get_region(p_id); @@ -589,8 +589,8 @@ const Map &RTileSet::autotile_get_bitmask_map(int p_id) { } } -Vector2 RTileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node, const Vector2 &p_tile_location) { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node, const Vector2 &p_tile_location) { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); //First try to forward selection to script if (p_tilemap_node->get_class_name() == "TileMap") { if (get_script_instance() != nullptr) { @@ -650,8 +650,8 @@ Vector2 RTileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, } } -Vector2 RTileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node, const Vector2 &p_tile_location) { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Vector2 TileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node, const Vector2 &p_tile_location) { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); //First try to forward selection to script if (get_script_instance() != nullptr) { if (get_script_instance()->has_method("_forward_atlas_subtile_selection")) { @@ -680,25 +680,25 @@ Vector2 RTileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tile } } -void RTileSet::tile_set_name(int p_id, const String &p_name) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_name(int p_id, const String &p_name) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].name = p_name; emit_changed(); _change_notify("name"); } -String RTileSet::tile_get_name(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), String(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +String TileSet::tile_get_name(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), String(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].name; } -void RTileSet::tile_clear_shapes(int p_id) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_clear_shapes(int p_id) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].shapes_data.clear(); } -void RTileSet::tile_add_shape(int p_id, const Ref &p_shape, const Transform2D &p_transform, bool p_one_way, const Vector2 &p_autotile_coord) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_add_shape(int p_id, const Ref &p_shape, const Transform2D &p_transform, bool p_one_way, const Vector2 &p_autotile_coord) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ShapeData new_data = ShapeData(); new_data.shape = p_shape; @@ -709,13 +709,13 @@ void RTileSet::tile_add_shape(int p_id, const Ref &p_shape, const Trans tile_map[p_id].shapes_data.push_back(new_data); } -int RTileSet::tile_get_shape_count(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +int TileSet::tile_get_shape_count(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].shapes_data.size(); } -void RTileSet::tile_set_shape(int p_id, int p_shape_id, const Ref &p_shape) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref &p_shape) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND(p_shape_id < 0); if (p_shape_id >= tile_map[p_id].shapes_data.size()) { @@ -726,8 +726,8 @@ void RTileSet::tile_set_shape(int p_id, int p_shape_id, const Ref &p_sh emit_changed(); } -Ref RTileSet::tile_get_shape(int p_id, int p_shape_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::tile_get_shape(int p_id, int p_shape_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND_V(p_shape_id < 0, Ref()); if (p_shape_id < tile_map[p_id].shapes_data.size()) { @@ -737,8 +737,8 @@ Ref RTileSet::tile_get_shape(int p_id, int p_shape_id) const { return Ref(); } -void RTileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND(p_shape_id < 0); if (p_shape_id >= tile_map[p_id].shapes_data.size()) { @@ -748,8 +748,8 @@ void RTileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transfor emit_changed(); } -Transform2D RTileSet::tile_get_shape_transform(int p_id, int p_shape_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Transform2D(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Transform2D(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND_V(p_shape_id < 0, Transform2D()); if (p_shape_id < tile_map[p_id].shapes_data.size()) { @@ -759,18 +759,18 @@ Transform2D RTileSet::tile_get_shape_transform(int p_id, int p_shape_id) const { return Transform2D(); } -void RTileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) { +void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) { Transform2D transform = tile_get_shape_transform(p_id, p_shape_id); transform.set_origin(p_offset); tile_set_shape_transform(p_id, p_shape_id, transform); } -Vector2 RTileSet::tile_get_shape_offset(int p_id, int p_shape_id) const { +Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const { return tile_get_shape_transform(p_id, p_shape_id).get_origin(); } -void RTileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND(p_shape_id < 0); if (p_shape_id >= tile_map[p_id].shapes_data.size()) { @@ -780,8 +780,8 @@ void RTileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one emit_changed(); } -bool RTileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), false, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), false, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND_V(p_shape_id < 0, false); if (p_shape_id < tile_map[p_id].shapes_data.size()) { @@ -791,8 +791,8 @@ bool RTileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const { return false; } -void RTileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_margin) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_margin) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND(p_shape_id < 0); if (p_shape_id >= tile_map[p_id].shapes_data.size()) { @@ -802,8 +802,8 @@ void RTileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_m emit_changed(); } -float RTileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +float TileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); ERR_FAIL_COND_V(p_shape_id < 0, 0); if (p_shape_id < tile_map[p_id].shapes_data.size()) { @@ -813,18 +813,18 @@ float RTileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const { return 0; } -void RTileSet::tile_set_light_occluder(int p_id, const Ref &p_light_occluder) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_light_occluder(int p_id, const Ref &p_light_occluder) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].occluder = p_light_occluder; } -Ref RTileSet::tile_get_light_occluder(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::tile_get_light_occluder(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].occluder; } -void RTileSet::autotile_set_light_occluder(int p_id, const Ref &p_light_occluder, const Vector2 &p_coord) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_light_occluder(int p_id, const Ref &p_light_occluder, const Vector2 &p_coord) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (p_light_occluder.is_null()) { if (tile_map[p_id].autotile_data.occluder_map.has(p_coord)) { tile_map[p_id].autotile_data.occluder_map.erase(p_coord); @@ -834,8 +834,8 @@ void RTileSet::autotile_set_light_occluder(int p_id, const Ref RTileSet::autotile_get_light_occluder(int p_id, const Vector2 &p_coord) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::autotile_get_light_occluder(int p_id, const Vector2 &p_coord) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (!tile_map[p_id].autotile_data.occluder_map.has(p_coord)) { return Ref(); @@ -844,34 +844,34 @@ Ref RTileSet::autotile_get_light_occluder(int p_id, const Vec } } -void RTileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].navigation_polygon_offset = p_offset; } -Vector2 RTileSet::tile_get_navigation_polygon_offset(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Vector2 TileSet::tile_get_navigation_polygon_offset(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].navigation_polygon_offset; } -void RTileSet::tile_set_navigation_polygon(int p_id, const Ref &p_navigation_polygon) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_navigation_polygon(int p_id, const Ref &p_navigation_polygon) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].navigation_polygon = p_navigation_polygon; } -Ref RTileSet::tile_get_navigation_polygon(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::tile_get_navigation_polygon(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].navigation_polygon; } -const Map> &RTileSet::autotile_get_light_oclusion_map(int p_id) const { +const Map> &TileSet::autotile_get_light_oclusion_map(int p_id) const { static Map> dummy; - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.occluder_map; } -void RTileSet::autotile_set_navigation_polygon(int p_id, const Ref &p_navigation_polygon, const Vector2 &p_coord) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::autotile_set_navigation_polygon(int p_id, const Ref &p_navigation_polygon, const Vector2 &p_coord) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (p_navigation_polygon.is_null()) { if (tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) { tile_map[p_id].autotile_data.navpoly_map.erase(p_coord); @@ -881,8 +881,8 @@ void RTileSet::autotile_set_navigation_polygon(int p_id, const Ref RTileSet::autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Ref TileSet::autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (!tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) { return Ref(); } else { @@ -890,24 +890,24 @@ Ref RTileSet::autotile_get_navigation_polygon(int p_id, const } } -const Map> &RTileSet::autotile_get_navigation_map(int p_id) const { +const Map> &TileSet::autotile_get_navigation_map(int p_id) const { static Map> dummy; - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].autotile_data.navpoly_map; } -void RTileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].occluder_offset = p_offset; } -Vector2 RTileSet::tile_get_occluder_offset(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Vector2 TileSet::tile_get_occluder_offset(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].occluder_offset; } -void RTileSet::tile_set_shapes(int p_id, const Vector &p_shapes) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_shapes(int p_id, const Vector &p_shapes) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].shapes_data = p_shapes; for (int i = 0; i < p_shapes.size(); i++) { _decompose_convex_shape(p_shapes[i].shape); @@ -915,24 +915,24 @@ void RTileSet::tile_set_shapes(int p_id, const Vector &p_shapes) { emit_changed(); } -Vector RTileSet::tile_get_shapes(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +Vector TileSet::tile_get_shapes(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].shapes_data; } -int RTileSet::tile_get_z_index(int p_id) const { - ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +int TileSet::tile_get_z_index(int p_id) const { + ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); return tile_map[p_id].z_index; } -void RTileSet::tile_set_z_index(int p_id, int p_z_index) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::tile_set_z_index(int p_id, int p_z_index) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map[p_id].z_index = p_z_index; emit_changed(); } -void RTileSet::_tile_set_shapes(int p_id, const Array &p_shapes) { +void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) { ERR_FAIL_COND(!tile_map.has(p_id)); Vector shapes_data; Transform2D default_transform = tile_get_shape_transform(p_id, 0); @@ -998,7 +998,7 @@ void RTileSet::_tile_set_shapes(int p_id, const Array &p_shapes) { emit_changed(); } -Array RTileSet::_tile_get_shapes(int p_id) const { +Array TileSet::_tile_get_shapes(int p_id) const { ERR_FAIL_COND_V(!tile_map.has(p_id), Array()); Array arr; @@ -1016,7 +1016,7 @@ Array RTileSet::_tile_get_shapes(int p_id) const { return arr; } -Array RTileSet::_get_tiles_ids() const { +Array TileSet::_get_tiles_ids() const { Array arr; for (Map::Element *E = tile_map.front(); E; E = E->next()) { @@ -1026,7 +1026,7 @@ Array RTileSet::_get_tiles_ids() const { return arr; } -void RTileSet::_decompose_convex_shape(Ref p_shape) { +void TileSet::_decompose_convex_shape(Ref p_shape) { if (Engine::get_singleton()->is_editor_hint()) { return; } @@ -1048,17 +1048,17 @@ void RTileSet::_decompose_convex_shape(Ref p_shape) { } } -void RTileSet::get_tile_list(List *p_tiles) const { +void TileSet::get_tile_list(List *p_tiles) const { for (Map::Element *E = tile_map.front(); E; E = E->next()) { p_tiles->push_back(E->key()); } } -bool RTileSet::has_tile(int p_id) const { +bool TileSet::has_tile(int p_id) const { return tile_map.has(p_id); } -bool RTileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) { +bool TileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) { if (p_drawn_id == p_neighbor_id) { return true; } else if (get_script_instance() != nullptr) { @@ -1072,14 +1072,14 @@ bool RTileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) { return false; } -void RTileSet::remove_tile(int p_id) { - ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id)); +void TileSet::remove_tile(int p_id) { + ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); tile_map.erase(p_id); _change_notify(""); emit_changed(); } -int RTileSet::get_last_unused_tile_id() const { +int TileSet::get_last_unused_tile_id() const { if (tile_map.size()) { return tile_map.back()->key() + 1; } else { @@ -1087,19 +1087,19 @@ int RTileSet::get_last_unused_tile_id() const { } } -void RTileSet::set_noise_params(const Ref &noise) { +void TileSet::set_noise_params(const Ref &noise) { _noise_params = noise; } -Ref RTileSet::get_noise_params() { +Ref TileSet::get_noise_params() { return _noise_params; } -void RTileSet::setup_noise(Ref noise) { +void TileSet::setup_noise(Ref noise) { if (_noise_params.is_valid()) { _noise_params->setup_noise(noise); } } -int RTileSet::find_tile_by_name(const String &p_name) const { +int TileSet::find_tile_by_name(const String &p_name) const { for (Map::Element *E = tile_map.front(); E; E = E->next()) { if (p_name == E->get().name) { return E->key(); @@ -1108,89 +1108,89 @@ int RTileSet::find_tile_by_name(const String &p_name) const { return -1; } -void RTileSet::clear() { +void TileSet::clear() { tile_map.clear(); _change_notify(""); emit_changed(); } -void RTileSet::_bind_methods() { - ClassDB::bind_method(D_METHOD("create_tile", "id"), &RTileSet::create_tile); - ClassDB::bind_method(D_METHOD("autotile_clear_bitmask_map", "id"), &RTileSet::autotile_clear_bitmask_map); - ClassDB::bind_method(D_METHOD("autotile_set_icon_coordinate", "id", "coord"), &RTileSet::autotile_set_icon_coordinate); - ClassDB::bind_method(D_METHOD("autotile_get_icon_coordinate", "id"), &RTileSet::autotile_get_icon_coordinate); - ClassDB::bind_method(D_METHOD("autotile_set_subtile_priority", "id", "coord", "priority"), &RTileSet::autotile_set_subtile_priority); - ClassDB::bind_method(D_METHOD("autotile_get_subtile_priority", "id", "coord"), &RTileSet::autotile_get_subtile_priority); - ClassDB::bind_method(D_METHOD("autotile_set_z_index", "id", "coord", "z_index"), &RTileSet::autotile_set_z_index); - ClassDB::bind_method(D_METHOD("autotile_get_z_index", "id", "coord"), &RTileSet::autotile_get_z_index); - ClassDB::bind_method(D_METHOD("autotile_set_light_occluder", "id", "light_occluder", "coord"), &RTileSet::autotile_set_light_occluder); - ClassDB::bind_method(D_METHOD("autotile_get_light_occluder", "id", "coord"), &RTileSet::autotile_get_light_occluder); - ClassDB::bind_method(D_METHOD("autotile_set_navigation_polygon", "id", "navigation_polygon", "coord"), &RTileSet::autotile_set_navigation_polygon); - ClassDB::bind_method(D_METHOD("autotile_get_navigation_polygon", "id", "coord"), &RTileSet::autotile_get_navigation_polygon); - ClassDB::bind_method(D_METHOD("autotile_set_bitmask", "id", "bitmask", "flag"), &RTileSet::autotile_set_bitmask); - ClassDB::bind_method(D_METHOD("autotile_get_bitmask", "id", "coord"), &RTileSet::autotile_get_bitmask); - ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &RTileSet::autotile_set_bitmask_mode); - ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &RTileSet::autotile_get_bitmask_mode); - ClassDB::bind_method(D_METHOD("autotile_set_spacing", "id", "spacing"), &RTileSet::autotile_set_spacing); - ClassDB::bind_method(D_METHOD("autotile_get_spacing", "id"), &RTileSet::autotile_get_spacing); - ClassDB::bind_method(D_METHOD("autotile_set_size", "id", "size"), &RTileSet::autotile_set_size); - ClassDB::bind_method(D_METHOD("autotile_get_size", "id"), &RTileSet::autotile_get_size); - ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &RTileSet::tile_set_name); - ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &RTileSet::tile_get_name); - ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &RTileSet::tile_set_texture); - ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &RTileSet::tile_get_texture); - ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &RTileSet::tile_set_normal_map); - ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &RTileSet::tile_get_normal_map); - ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &RTileSet::tile_set_material); - ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &RTileSet::tile_get_material); - ClassDB::bind_method(D_METHOD("tile_set_modulate", "id", "color"), &RTileSet::tile_set_modulate); - ClassDB::bind_method(D_METHOD("tile_get_modulate", "id"), &RTileSet::tile_get_modulate); - ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &RTileSet::tile_set_texture_offset); - ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &RTileSet::tile_get_texture_offset); - ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &RTileSet::tile_set_region); - ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &RTileSet::tile_get_region); - ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &RTileSet::tile_set_shape); - ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &RTileSet::tile_get_shape); - ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_id", "shape_offset"), &RTileSet::tile_set_shape_offset); - ClassDB::bind_method(D_METHOD("tile_get_shape_offset", "id", "shape_id"), &RTileSet::tile_get_shape_offset); - ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &RTileSet::tile_set_shape_transform); - ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &RTileSet::tile_get_shape_transform); - ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &RTileSet::tile_set_shape_one_way); - ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &RTileSet::tile_get_shape_one_way); - ClassDB::bind_method(D_METHOD("tile_set_shape_one_way_margin", "id", "shape_id", "one_way"), &RTileSet::tile_set_shape_one_way_margin); - ClassDB::bind_method(D_METHOD("tile_get_shape_one_way_margin", "id", "shape_id"), &RTileSet::tile_get_shape_one_way_margin); - ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way", "autotile_coord"), &RTileSet::tile_add_shape, DEFVAL(false), DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &RTileSet::tile_get_shape_count); - ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &RTileSet::_tile_set_shapes); - ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &RTileSet::_tile_get_shapes); - ClassDB::bind_method(D_METHOD("tile_set_tile_mode", "id", "tilemode"), &RTileSet::tile_set_tile_mode); - ClassDB::bind_method(D_METHOD("tile_get_tile_mode", "id"), &RTileSet::tile_get_tile_mode); - ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &RTileSet::tile_set_navigation_polygon); - ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &RTileSet::tile_get_navigation_polygon); - ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &RTileSet::tile_set_navigation_polygon_offset); - ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &RTileSet::tile_get_navigation_polygon_offset); - ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &RTileSet::tile_set_light_occluder); - ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &RTileSet::tile_get_light_occluder); - ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &RTileSet::tile_set_occluder_offset); - ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &RTileSet::tile_get_occluder_offset); - ClassDB::bind_method(D_METHOD("tile_set_z_index", "id", "z_index"), &RTileSet::tile_set_z_index); - ClassDB::bind_method(D_METHOD("tile_get_z_index", "id"), &RTileSet::tile_get_z_index); +void TileSet::_bind_methods() { + ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile); + ClassDB::bind_method(D_METHOD("autotile_clear_bitmask_map", "id"), &TileSet::autotile_clear_bitmask_map); + ClassDB::bind_method(D_METHOD("autotile_set_icon_coordinate", "id", "coord"), &TileSet::autotile_set_icon_coordinate); + ClassDB::bind_method(D_METHOD("autotile_get_icon_coordinate", "id"), &TileSet::autotile_get_icon_coordinate); + ClassDB::bind_method(D_METHOD("autotile_set_subtile_priority", "id", "coord", "priority"), &TileSet::autotile_set_subtile_priority); + ClassDB::bind_method(D_METHOD("autotile_get_subtile_priority", "id", "coord"), &TileSet::autotile_get_subtile_priority); + ClassDB::bind_method(D_METHOD("autotile_set_z_index", "id", "coord", "z_index"), &TileSet::autotile_set_z_index); + ClassDB::bind_method(D_METHOD("autotile_get_z_index", "id", "coord"), &TileSet::autotile_get_z_index); + ClassDB::bind_method(D_METHOD("autotile_set_light_occluder", "id", "light_occluder", "coord"), &TileSet::autotile_set_light_occluder); + ClassDB::bind_method(D_METHOD("autotile_get_light_occluder", "id", "coord"), &TileSet::autotile_get_light_occluder); + ClassDB::bind_method(D_METHOD("autotile_set_navigation_polygon", "id", "navigation_polygon", "coord"), &TileSet::autotile_set_navigation_polygon); + ClassDB::bind_method(D_METHOD("autotile_get_navigation_polygon", "id", "coord"), &TileSet::autotile_get_navigation_polygon); + ClassDB::bind_method(D_METHOD("autotile_set_bitmask", "id", "bitmask", "flag"), &TileSet::autotile_set_bitmask); + ClassDB::bind_method(D_METHOD("autotile_get_bitmask", "id", "coord"), &TileSet::autotile_get_bitmask); + ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &TileSet::autotile_set_bitmask_mode); + ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &TileSet::autotile_get_bitmask_mode); + ClassDB::bind_method(D_METHOD("autotile_set_spacing", "id", "spacing"), &TileSet::autotile_set_spacing); + ClassDB::bind_method(D_METHOD("autotile_get_spacing", "id"), &TileSet::autotile_get_spacing); + ClassDB::bind_method(D_METHOD("autotile_set_size", "id", "size"), &TileSet::autotile_set_size); + ClassDB::bind_method(D_METHOD("autotile_get_size", "id"), &TileSet::autotile_get_size); + ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name); + ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name); + ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture); + ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture); + ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map); + ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map); + ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material); + ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material); + ClassDB::bind_method(D_METHOD("tile_set_modulate", "id", "color"), &TileSet::tile_set_modulate); + ClassDB::bind_method(D_METHOD("tile_get_modulate", "id"), &TileSet::tile_get_modulate); + ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset); + ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset); + ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region); + ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region); + ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape); + ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape); + ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_id", "shape_offset"), &TileSet::tile_set_shape_offset); + ClassDB::bind_method(D_METHOD("tile_get_shape_offset", "id", "shape_id"), &TileSet::tile_get_shape_offset); + ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform); + ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform); + ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way); + ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way); + ClassDB::bind_method(D_METHOD("tile_set_shape_one_way_margin", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way_margin); + ClassDB::bind_method(D_METHOD("tile_get_shape_one_way_margin", "id", "shape_id"), &TileSet::tile_get_shape_one_way_margin); + ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way", "autotile_coord"), &TileSet::tile_add_shape, DEFVAL(false), DEFVAL(Vector2())); + ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count); + ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes); + ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes); + ClassDB::bind_method(D_METHOD("tile_set_tile_mode", "id", "tilemode"), &TileSet::tile_set_tile_mode); + ClassDB::bind_method(D_METHOD("tile_get_tile_mode", "id"), &TileSet::tile_get_tile_mode); + ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon); + ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon); + ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset); + ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset); + ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &TileSet::tile_set_light_occluder); + ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder); + ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset); + ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset); + ClassDB::bind_method(D_METHOD("tile_set_z_index", "id", "z_index"), &TileSet::tile_set_z_index); + ClassDB::bind_method(D_METHOD("tile_get_z_index", "id"), &TileSet::tile_get_z_index); - ClassDB::bind_method(D_METHOD("remove_tile", "id"), &RTileSet::remove_tile); - ClassDB::bind_method(D_METHOD("clear"), &RTileSet::clear); - ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &RTileSet::get_last_unused_tile_id); - ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &RTileSet::find_tile_by_name); - ClassDB::bind_method(D_METHOD("get_tiles_ids"), &RTileSet::_get_tiles_ids); + ClassDB::bind_method(D_METHOD("remove_tile", "id"), &TileSet::remove_tile); + ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear); + ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id); + ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name); + ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids); - ClassDB::bind_method(D_METHOD("set_noise_params", "noise"), &RTileSet::set_noise_params); - ClassDB::bind_method(D_METHOD("get_noise_params"), &RTileSet::get_noise_params); + ClassDB::bind_method(D_METHOD("set_noise_params", "noise"), &TileSet::set_noise_params); + ClassDB::bind_method(D_METHOD("get_noise_params"), &TileSet::get_noise_params); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "FastnoiseNoiseParams"), "set_noise_params", "get_noise_params"); - ClassDB::bind_method(D_METHOD("setup_noise", "noise"), &RTileSet::setup_noise); + ClassDB::bind_method(D_METHOD("setup_noise", "noise"), &TileSet::setup_noise); BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_tile_bound", PropertyInfo(Variant::INT, "drawn_id"), PropertyInfo(Variant::INT, "neighbor_id"))); - BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "RTileMap"), PropertyInfo(Variant::VECTOR2, "tile_location"))); - BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_atlas_subtile_selection", PropertyInfo(Variant::INT, "atlastile_id"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "RTileMap"), PropertyInfo(Variant::VECTOR2, "tile_location"))); + BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location"))); + BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_atlas_subtile_selection", PropertyInfo(Variant::INT, "atlastile_id"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location"))); BIND_ENUM_CONSTANT(BITMASK_2X2); BIND_ENUM_CONSTANT(BITMASK_3X3_MINIMAL); @@ -1211,5 +1211,5 @@ void RTileSet::_bind_methods() { BIND_ENUM_CONSTANT(ATLAS_TILE); } -RTileSet::RTileSet() { +TileSet::TileSet() { } diff --git a/modules/rtile_map/tile_set.h b/modules/rtile_map/tile_set.h index fd30f3328..d5180f85b 100644 --- a/modules/rtile_map/tile_set.h +++ b/modules/rtile_map/tile_set.h @@ -40,8 +40,8 @@ #include "scene/resources/shape_2d.h" #include "scene/resources/texture.h" -class RTileSet : public Resource { - GDCLASS(RTileSet, Resource); +class TileSet : public Resource { + GDCLASS(TileSet, Resource); public: struct ShapeData { @@ -266,11 +266,11 @@ public: Ref get_noise_params(); void setup_noise(Ref noise); - RTileSet(); + TileSet(); }; -VARIANT_ENUM_CAST(RTileSet::AutotileBindings); -VARIANT_ENUM_CAST(RTileSet::BitmaskMode); -VARIANT_ENUM_CAST(RTileSet::TileMode); +VARIANT_ENUM_CAST(TileSet::AutotileBindings); +VARIANT_ENUM_CAST(TileSet::BitmaskMode); +VARIANT_ENUM_CAST(TileSet::TileMode); #endif // TILE_SET_H diff --git a/modules/rtile_map/tile_set_editor_plugin.cpp b/modules/rtile_map/tile_set_editor_plugin.cpp index df8eb3880..972835156 100644 --- a/modules/rtile_map/tile_set_editor_plugin.cpp +++ b/modules/rtile_map/tile_set_editor_plugin.cpp @@ -55,7 +55,7 @@ #include "editor/editor_file_dialog.h" #include "editor/editor_inspector.h" -void RTileSetEditor::edit(const Ref &p_tileset) { +void TileSetEditor::edit(const Ref &p_tileset) { tileset = p_tileset; tileset->add_change_receptor(this); @@ -64,7 +64,7 @@ void RTileSetEditor::edit(const Ref &p_tileset) { update_texture_list(); } -void RTileSetEditor::_import_node(Node *p_node, Ref p_library) { +void TileSetEditor::_import_node(Node *p_node, Ref p_library) { for (int i = 0; i < p_node->get_child_count(); i++) { Node *child = p_node->get_child(i); @@ -115,7 +115,7 @@ void RTileSetEditor::_import_node(Node *p_node, Ref p_library) { phys_offset += -s / 2; } - Vector collisions; + Vector collisions; Ref nav_poly; Ref occluder; bool found_collisions = false; @@ -154,7 +154,7 @@ void RTileSetEditor::_import_node(Node *p_node, Ref p_library) { for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) { Ref shape = sb->shape_owner_get_shape(E->get(), k); - RTileSet::ShapeData shape_data; + TileSet::ShapeData shape_data; shape_data.shape = shape; shape_data.shape_transform = shape_transform; shape_data.one_way_collision = one_way; @@ -176,7 +176,7 @@ void RTileSetEditor::_import_node(Node *p_node, Ref p_library) { } } -void RTileSetEditor::_import_scene(Node *p_scene, Ref p_library, bool p_merge) { +void TileSetEditor::_import_scene(Node *p_scene, Ref p_library, bool p_merge) { if (!p_merge) { p_library->clear(); } @@ -184,20 +184,20 @@ void RTileSetEditor::_import_scene(Node *p_scene, Ref p_library, bool _import_node(p_scene, p_library); } -void RTileSetEditor::_undo_redo_import_scene(Node *p_scene, bool p_merge) { +void TileSetEditor::_undo_redo_import_scene(Node *p_scene, bool p_merge) { _import_scene(p_scene, tileset, p_merge); } -Error RTileSetEditor::update_library_file(Node *p_base_scene, Ref ml, bool p_merge) { +Error TileSetEditor::update_library_file(Node *p_base_scene, Ref ml, bool p_merge) { _import_scene(p_base_scene, ml, p_merge); return OK; } -Variant RTileSetEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { +Variant TileSetEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { return false; } -bool RTileSetEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { +bool TileSetEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { Dictionary d = p_data; if (!d.has("type")) { @@ -239,7 +239,7 @@ bool RTileSetEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_da return false; } -void RTileSetEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { +void TileSetEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { if (!can_drop_data_fw(p_point, p_data, p_from)) { return; } @@ -273,45 +273,45 @@ void RTileSetEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, } } -void RTileSetEditor::_bind_methods() { - ClassDB::bind_method("_undo_redo_import_scene", &RTileSetEditor::_undo_redo_import_scene); - ClassDB::bind_method("_on_tileset_toolbar_button_pressed", &RTileSetEditor::_on_tileset_toolbar_button_pressed); - ClassDB::bind_method("_on_textures_added", &RTileSetEditor::_on_textures_added); - ClassDB::bind_method("_on_tileset_toolbar_confirm", &RTileSetEditor::_on_tileset_toolbar_confirm); - ClassDB::bind_method("_on_texture_list_selected", &RTileSetEditor::_on_texture_list_selected); - ClassDB::bind_method("_on_edit_mode_changed", &RTileSetEditor::_on_edit_mode_changed); - ClassDB::bind_method("_on_scroll_container_input", &RTileSetEditor::_on_scroll_container_input); - ClassDB::bind_method("_on_workspace_mode_changed", &RTileSetEditor::_on_workspace_mode_changed); - ClassDB::bind_method("_on_workspace_overlay_draw", &RTileSetEditor::_on_workspace_overlay_draw); - ClassDB::bind_method("_on_workspace_process", &RTileSetEditor::_on_workspace_process); - ClassDB::bind_method("_on_workspace_draw", &RTileSetEditor::_on_workspace_draw); - ClassDB::bind_method("_on_workspace_input", &RTileSetEditor::_on_workspace_input); - ClassDB::bind_method("_on_tool_clicked", &RTileSetEditor::_on_tool_clicked); - ClassDB::bind_method("_on_priority_changed", &RTileSetEditor::_on_priority_changed); - ClassDB::bind_method("_on_z_index_changed", &RTileSetEditor::_on_z_index_changed); - ClassDB::bind_method("_on_grid_snap_toggled", &RTileSetEditor::_on_grid_snap_toggled); - ClassDB::bind_method("_set_snap_step", &RTileSetEditor::_set_snap_step); - ClassDB::bind_method("_set_snap_off", &RTileSetEditor::_set_snap_off); - ClassDB::bind_method("_set_snap_sep", &RTileSetEditor::_set_snap_sep); - ClassDB::bind_method("_validate_current_tile_id", &RTileSetEditor::_validate_current_tile_id); - ClassDB::bind_method("_zoom_in", &RTileSetEditor::_zoom_in); - ClassDB::bind_method("_zoom_out", &RTileSetEditor::_zoom_out); - ClassDB::bind_method("_zoom_reset", &RTileSetEditor::_zoom_reset); - ClassDB::bind_method("_select_edited_shape_coord", &RTileSetEditor::_select_edited_shape_coord); - ClassDB::bind_method("_sort_tiles", &RTileSetEditor::_sort_tiles); +void TileSetEditor::_bind_methods() { + ClassDB::bind_method("_undo_redo_import_scene", &TileSetEditor::_undo_redo_import_scene); + ClassDB::bind_method("_on_tileset_toolbar_button_pressed", &TileSetEditor::_on_tileset_toolbar_button_pressed); + ClassDB::bind_method("_on_textures_added", &TileSetEditor::_on_textures_added); + ClassDB::bind_method("_on_tileset_toolbar_confirm", &TileSetEditor::_on_tileset_toolbar_confirm); + ClassDB::bind_method("_on_texture_list_selected", &TileSetEditor::_on_texture_list_selected); + ClassDB::bind_method("_on_edit_mode_changed", &TileSetEditor::_on_edit_mode_changed); + ClassDB::bind_method("_on_scroll_container_input", &TileSetEditor::_on_scroll_container_input); + ClassDB::bind_method("_on_workspace_mode_changed", &TileSetEditor::_on_workspace_mode_changed); + ClassDB::bind_method("_on_workspace_overlay_draw", &TileSetEditor::_on_workspace_overlay_draw); + ClassDB::bind_method("_on_workspace_process", &TileSetEditor::_on_workspace_process); + ClassDB::bind_method("_on_workspace_draw", &TileSetEditor::_on_workspace_draw); + ClassDB::bind_method("_on_workspace_input", &TileSetEditor::_on_workspace_input); + ClassDB::bind_method("_on_tool_clicked", &TileSetEditor::_on_tool_clicked); + ClassDB::bind_method("_on_priority_changed", &TileSetEditor::_on_priority_changed); + ClassDB::bind_method("_on_z_index_changed", &TileSetEditor::_on_z_index_changed); + ClassDB::bind_method("_on_grid_snap_toggled", &TileSetEditor::_on_grid_snap_toggled); + ClassDB::bind_method("_set_snap_step", &TileSetEditor::_set_snap_step); + ClassDB::bind_method("_set_snap_off", &TileSetEditor::_set_snap_off); + ClassDB::bind_method("_set_snap_sep", &TileSetEditor::_set_snap_sep); + ClassDB::bind_method("_validate_current_tile_id", &TileSetEditor::_validate_current_tile_id); + ClassDB::bind_method("_zoom_in", &TileSetEditor::_zoom_in); + ClassDB::bind_method("_zoom_out", &TileSetEditor::_zoom_out); + ClassDB::bind_method("_zoom_reset", &TileSetEditor::_zoom_reset); + ClassDB::bind_method("_select_edited_shape_coord", &TileSetEditor::_select_edited_shape_coord); + ClassDB::bind_method("_sort_tiles", &TileSetEditor::_sort_tiles); - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &RTileSetEditor::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &RTileSetEditor::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &RTileSetEditor::drop_data_fw); + ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &TileSetEditor::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &TileSetEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("drop_data_fw"), &TileSetEditor::drop_data_fw); - ClassDB::bind_method("edit", &RTileSetEditor::edit); - ClassDB::bind_method("add_texture", &RTileSetEditor::add_texture); - ClassDB::bind_method("remove_texture", &RTileSetEditor::remove_texture); - ClassDB::bind_method("update_texture_list_icon", &RTileSetEditor::update_texture_list_icon); - ClassDB::bind_method("update_workspace_minsize", &RTileSetEditor::update_workspace_minsize); + ClassDB::bind_method("edit", &TileSetEditor::edit); + ClassDB::bind_method("add_texture", &TileSetEditor::add_texture); + ClassDB::bind_method("remove_texture", &TileSetEditor::remove_texture); + ClassDB::bind_method("update_texture_list_icon", &TileSetEditor::update_texture_list_icon); + ClassDB::bind_method("update_workspace_minsize", &TileSetEditor::update_workspace_minsize); } -void RTileSetEditor::_notification(int p_what) { +void TileSetEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up. @@ -358,7 +358,7 @@ void RTileSetEditor::_notification(int p_what) { } } -RTileSetEditor::RTileSetEditor(EditorNode *p_editor) { +TileSetEditor::TileSetEditor(EditorNode *p_editor) { editor = p_editor; undo_redo = EditorNode::get_undo_redo(); current_tile = -1; @@ -674,13 +674,13 @@ RTileSetEditor::RTileSetEditor(EditorNode *p_editor) { scale_ratio = 1.2f; } -RTileSetEditor::~RTileSetEditor() { +TileSetEditor::~TileSetEditor() { if (helper) { memdelete(helper); } } -void RTileSetEditor::_on_tileset_toolbar_button_pressed(int p_index) { +void TileSetEditor::_on_tileset_toolbar_button_pressed(int p_index) { option = p_index; switch (option) { case TOOL_TILESET_ADD_TEXTURE: { @@ -706,7 +706,7 @@ void RTileSetEditor::_on_tileset_toolbar_button_pressed(int p_index) { } } -void RTileSetEditor::_on_tileset_toolbar_confirm() { +void TileSetEditor::_on_tileset_toolbar_confirm() { switch (option) { case TOOL_TILESET_REMOVE_TEXTURE: { String current_texture_path = get_current_texture()->get_path(); @@ -749,7 +749,7 @@ void RTileSetEditor::_on_tileset_toolbar_confirm() { } } -void RTileSetEditor::_on_texture_list_selected(int p_index) { +void TileSetEditor::_on_texture_list_selected(int p_index) { if (get_current_texture().is_valid()) { current_item_index = p_index; preview->set_texture(get_current_texture()); @@ -766,7 +766,7 @@ void RTileSetEditor::_on_texture_list_selected(int p_index) { workspace->update(); } -void RTileSetEditor::_on_textures_added(const PoolStringArray &p_paths) { +void TileSetEditor::_on_textures_added(const PoolStringArray &p_paths) { int invalid_count = 0; for (int i = 0; i < p_paths.size(); i++) { Ref t = Ref(ResourceLoader::load(p_paths[i])); @@ -792,7 +792,7 @@ void RTileSetEditor::_on_textures_added(const PoolStringArray &p_paths) { } } -void RTileSetEditor::_on_edit_mode_changed(int p_edit_mode) { +void TileSetEditor::_on_edit_mode_changed(int p_edit_mode) { draw_handles = false; creating_shape = false; edit_mode = (EditMode)p_edit_mode; @@ -910,7 +910,7 @@ void RTileSetEditor::_on_edit_mode_changed(int p_edit_mode) { workspace->update(); } -void RTileSetEditor::_on_workspace_mode_changed(int p_workspace_mode) { +void TileSetEditor::_on_workspace_mode_changed(int p_workspace_mode) { workspace_mode = (WorkspaceMode)p_workspace_mode; if (p_workspace_mode == WORKSPACE_EDIT) { update_workspace_tile_mode(); @@ -925,7 +925,7 @@ void RTileSetEditor::_on_workspace_mode_changed(int p_workspace_mode) { } } -void RTileSetEditor::_on_workspace_draw() { +void TileSetEditor::_on_workspace_draw() { if (tileset.is_null() || !get_current_texture().is_valid()) { return; } @@ -960,84 +960,84 @@ void RTileSetEditor::_on_workspace_draw() { anchor += WORKSPACE_MARGIN; anchor += region.position; uint32_t mask = tileset->autotile_get_bitmask(get_current_tile(), coord); - if (tileset->autotile_get_bitmask_mode(get_current_tile()) == RTileSet::BITMASK_2X2) { - if (mask & RTileSet::BIND_IGNORE_TOPLEFT) { + if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) { + if (mask & TileSet::BIND_IGNORE_TOPLEFT) { workspace->draw_rect(Rect2(anchor, size / 4), ci); workspace->draw_rect(Rect2(anchor + size / 4, size / 4), ci); - } else if (mask & RTileSet::BIND_TOPLEFT) { + } else if (mask & TileSet::BIND_TOPLEFT) { workspace->draw_rect(Rect2(anchor, size / 2), c); } - if (mask & RTileSet::BIND_IGNORE_TOPRIGHT) { + if (mask & TileSet::BIND_IGNORE_TOPRIGHT) { workspace->draw_rect(Rect2(anchor + Vector2(size.x / 2, 0), size / 4), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x * 3 / 4, size.y / 4), size / 4), ci); - } else if (mask & RTileSet::BIND_TOPRIGHT) { + } else if (mask & TileSet::BIND_TOPRIGHT) { workspace->draw_rect(Rect2(anchor + Vector2(size.x / 2, 0), size / 2), c); } - if (mask & RTileSet::BIND_IGNORE_BOTTOMLEFT) { + if (mask & TileSet::BIND_IGNORE_BOTTOMLEFT) { workspace->draw_rect(Rect2(anchor + Vector2(0, size.y / 2), size / 4), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x / 4, size.y * 3 / 4), size / 4), ci); - } else if (mask & RTileSet::BIND_BOTTOMLEFT) { + } else if (mask & TileSet::BIND_BOTTOMLEFT) { workspace->draw_rect(Rect2(anchor + Vector2(0, size.y / 2), size / 2), c); } - if (mask & RTileSet::BIND_IGNORE_BOTTOMRIGHT) { + if (mask & TileSet::BIND_IGNORE_BOTTOMRIGHT) { workspace->draw_rect(Rect2(anchor + size / 2, size / 4), ci); workspace->draw_rect(Rect2(anchor + size * 3 / 4, size / 4), ci); - } else if (mask & RTileSet::BIND_BOTTOMRIGHT) { + } else if (mask & TileSet::BIND_BOTTOMRIGHT) { workspace->draw_rect(Rect2(anchor + size / 2, size / 2), c); } } else { - if (mask & RTileSet::BIND_IGNORE_TOPLEFT) { + if (mask & TileSet::BIND_IGNORE_TOPLEFT) { workspace->draw_rect(Rect2(anchor, size / 6), ci); workspace->draw_rect(Rect2(anchor + size / 6, size / 6), ci); - } else if (mask & RTileSet::BIND_TOPLEFT) { + } else if (mask & TileSet::BIND_TOPLEFT) { workspace->draw_rect(Rect2(anchor, size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_TOP) { + if (mask & TileSet::BIND_IGNORE_TOP) { workspace->draw_rect(Rect2(anchor + Vector2(size.x / 3, 0), size / 6), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x / 2, size.y / 6), size / 6), ci); - } else if (mask & RTileSet::BIND_TOP) { + } else if (mask & TileSet::BIND_TOP) { workspace->draw_rect(Rect2(anchor + Vector2(size.x / 3, 0), size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_TOPRIGHT) { + if (mask & TileSet::BIND_IGNORE_TOPRIGHT) { workspace->draw_rect(Rect2(anchor + Vector2(size.x * 4 / 6, 0), size / 6), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x * 5 / 6, size.y / 6), size / 6), ci); - } else if (mask & RTileSet::BIND_TOPRIGHT) { + } else if (mask & TileSet::BIND_TOPRIGHT) { workspace->draw_rect(Rect2(anchor + Vector2((size.x / 3) * 2, 0), size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_LEFT) { + if (mask & TileSet::BIND_IGNORE_LEFT) { workspace->draw_rect(Rect2(anchor + Vector2(0, size.y / 3), size / 6), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x / 6, size.y / 2), size / 6), ci); - } else if (mask & RTileSet::BIND_LEFT) { + } else if (mask & TileSet::BIND_LEFT) { workspace->draw_rect(Rect2(anchor + Vector2(0, size.y / 3), size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_CENTER) { + if (mask & TileSet::BIND_IGNORE_CENTER) { workspace->draw_rect(Rect2(anchor + size / 3, size / 6), ci); workspace->draw_rect(Rect2(anchor + size / 2, size / 6), ci); - } else if (mask & RTileSet::BIND_CENTER) { + } else if (mask & TileSet::BIND_CENTER) { workspace->draw_rect(Rect2(anchor + Vector2(size.x / 3, size.y / 3), size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_RIGHT) { + if (mask & TileSet::BIND_IGNORE_RIGHT) { workspace->draw_rect(Rect2(anchor + Vector2(size.x * 4 / 6, size.y / 3), size / 6), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x * 5 / 6, size.y / 2), size / 6), ci); - } else if (mask & RTileSet::BIND_RIGHT) { + } else if (mask & TileSet::BIND_RIGHT) { workspace->draw_rect(Rect2(anchor + Vector2((size.x / 3) * 2, size.y / 3), size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_BOTTOMLEFT) { + if (mask & TileSet::BIND_IGNORE_BOTTOMLEFT) { workspace->draw_rect(Rect2(anchor + Vector2(0, size.y * 4 / 6), size / 6), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x / 6, size.y * 5 / 6), size / 6), ci); - } else if (mask & RTileSet::BIND_BOTTOMLEFT) { + } else if (mask & TileSet::BIND_BOTTOMLEFT) { workspace->draw_rect(Rect2(anchor + Vector2(0, (size.y / 3) * 2), size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_BOTTOM) { + if (mask & TileSet::BIND_IGNORE_BOTTOM) { workspace->draw_rect(Rect2(anchor + Vector2(size.x / 3, size.y * 4 / 6), size / 6), ci); workspace->draw_rect(Rect2(anchor + Vector2(size.x / 2, size.y * 5 / 6), size / 6), ci); - } else if (mask & RTileSet::BIND_BOTTOM) { + } else if (mask & TileSet::BIND_BOTTOM) { workspace->draw_rect(Rect2(anchor + Vector2(size.x / 3, (size.y / 3) * 2), size / 3), c); } - if (mask & RTileSet::BIND_IGNORE_BOTTOMRIGHT) { + if (mask & TileSet::BIND_IGNORE_BOTTOMRIGHT) { workspace->draw_rect(Rect2(anchor + size * 4 / 6, size / 6), ci); workspace->draw_rect(Rect2(anchor + size * 5 / 6, size / 6), ci); - } else if (mask & RTileSet::BIND_BOTTOMRIGHT) { + } else if (mask & TileSet::BIND_BOTTOMRIGHT) { workspace->draw_rect(Rect2(anchor + (size / 3) * 2, size / 3), c); } } @@ -1047,7 +1047,7 @@ void RTileSetEditor::_on_workspace_draw() { case EDITMODE_COLLISION: case EDITMODE_OCCLUSION: case EDITMODE_NAVIGATION: { - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { draw_highlight_subtile(edited_shape_coord); } draw_polygon_shapes(); @@ -1087,11 +1087,11 @@ void RTileSetEditor::_on_workspace_draw() { Rect2i region = tileset->tile_get_region(t_id); region.position += WORKSPACE_MARGIN; Color c; - if (tileset->tile_get_tile_mode(t_id) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(t_id) == TileSet::SINGLE_TILE) { c = COLOR_SINGLE; - } else if (tileset->tile_get_tile_mode(t_id) == RTileSet::AUTO_TILE) { + } else if (tileset->tile_get_tile_mode(t_id) == TileSet::AUTO_TILE) { c = COLOR_AUTOTILE; - } else if (tileset->tile_get_tile_mode(t_id) == RTileSet::ATLAS_TILE) { + } else if (tileset->tile_get_tile_mode(t_id) == TileSet::ATLAS_TILE) { c = COLOR_ATLAS; } draw_tile_subdivision(t_id, COLOR_SUBDIVISION); @@ -1133,11 +1133,11 @@ void RTileSetEditor::_on_workspace_draw() { } Color c; - if (tileset->tile_get_tile_mode(t_id) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(t_id) == TileSet::SINGLE_TILE) { c = COLOR_SINGLE; - } else if (tileset->tile_get_tile_mode(t_id) == RTileSet::AUTO_TILE) { + } else if (tileset->tile_get_tile_mode(t_id) == TileSet::AUTO_TILE) { c = COLOR_AUTOTILE; - } else if (tileset->tile_get_tile_mode(t_id) == RTileSet::ATLAS_TILE) { + } else if (tileset->tile_get_tile_mode(t_id) == TileSet::ATLAS_TILE) { c = COLOR_ATLAS; } workspace->draw_rect(region, c, false); @@ -1147,7 +1147,7 @@ void RTileSetEditor::_on_workspace_draw() { workspace_overlay->update(); } -void RTileSetEditor::_on_workspace_process() { +void TileSetEditor::_on_workspace_process() { if (Input::get_singleton()->is_key_pressed(KEY_ALT) || tools[VISIBLE_INFO]->is_pressed()) { if (!tile_names_visible) { tile_names_visible = true; @@ -1159,7 +1159,7 @@ void RTileSetEditor::_on_workspace_process() { } } -void RTileSetEditor::_on_workspace_overlay_draw() { +void TileSetEditor::_on_workspace_overlay_draw() { if (!tileset.is_valid() || !get_current_texture().is_valid()) { return; } @@ -1182,11 +1182,11 @@ void RTileSetEditor::_on_workspace_overlay_draw() { region.position += WORKSPACE_MARGIN; region.position *= workspace->get_scale().x; Color c; - if (tileset->tile_get_tile_mode(t_id) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(t_id) == TileSet::SINGLE_TILE) { c = COLOR_SINGLE; - } else if (tileset->tile_get_tile_mode(t_id) == RTileSet::AUTO_TILE) { + } else if (tileset->tile_get_tile_mode(t_id) == TileSet::AUTO_TILE) { c = COLOR_AUTOTILE; - } else if (tileset->tile_get_tile_mode(t_id) == RTileSet::ATLAS_TILE) { + } else if (tileset->tile_get_tile_mode(t_id) == TileSet::ATLAS_TILE) { c = COLOR_ATLAS; } String tile_id_name = String::num(t_id, 0) + ": " + tileset->tile_get_name(t_id); @@ -1212,7 +1212,7 @@ void RTileSetEditor::_on_workspace_overlay_draw() { } } -int RTileSetEditor::get_grabbed_point(const Vector2 &p_mouse_pos, real_t p_grab_threshold) { +int TileSetEditor::get_grabbed_point(const Vector2 &p_mouse_pos, real_t p_grab_threshold) { Transform2D xform = workspace->get_transform(); int grabbed_point = -1; @@ -1229,7 +1229,7 @@ int RTileSetEditor::get_grabbed_point(const Vector2 &p_mouse_pos, real_t p_grab_ return grabbed_point; } -bool RTileSetEditor::is_within_grabbing_distance_of_first_point(const Vector2 &p_pos, real_t p_grab_threshold) { +bool TileSetEditor::is_within_grabbing_distance_of_first_point(const Vector2 &p_pos, real_t p_grab_threshold) { Transform2D xform = workspace->get_transform(); const real_t distance = xform.xform(current_shape[0]).distance_to(xform.xform(p_pos)); @@ -1237,7 +1237,7 @@ bool RTileSetEditor::is_within_grabbing_distance_of_first_point(const Vector2 &p return distance < p_grab_threshold; } -void RTileSetEditor::_on_scroll_container_input(const Ref &p_event) { +void TileSetEditor::_on_scroll_container_input(const Ref &p_event) { const Ref mb = p_event; if (mb.is_valid()) { @@ -1256,7 +1256,7 @@ void RTileSetEditor::_on_scroll_container_input(const Ref &p_event) } } -void RTileSetEditor::_on_workspace_input(const Ref &p_ie) { +void TileSetEditor::_on_workspace_input(const Ref &p_ie) { if (tileset.is_null() || !get_current_texture().is_valid()) { return; } @@ -1368,7 +1368,7 @@ void RTileSetEditor::_on_workspace_input(const Ref &p_ie) { if (workspace_mode != WORKSPACE_CREATE_SINGLE) { undo_redo->add_do_method(tileset.ptr(), "autotile_set_size", t_id, snap_step); undo_redo->add_do_method(tileset.ptr(), "autotile_set_spacing", t_id, snap_separation.x); - undo_redo->add_do_method(tileset.ptr(), "tile_set_tile_mode", t_id, workspace_mode == WORKSPACE_CREATE_AUTOTILE ? RTileSet::AUTO_TILE : RTileSet::ATLAS_TILE); + undo_redo->add_do_method(tileset.ptr(), "tile_set_tile_mode", t_id, workspace_mode == WORKSPACE_CREATE_AUTOTILE ? TileSet::AUTO_TILE : TileSet::ATLAS_TILE); } tool_workspacemode[WORKSPACE_EDIT]->set_pressed(true); @@ -1448,44 +1448,44 @@ void RTileSetEditor::_on_workspace_input(const Ref &p_ie) { Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y)); pos = mb->get_position() - (pos + current_tile_region.position); uint32_t bit = 0; - if (tileset->autotile_get_bitmask_mode(get_current_tile()) == RTileSet::BITMASK_2X2) { + if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) { if (pos.x < size.x / 2) { if (pos.y < size.y / 2) { - bit = RTileSet::BIND_TOPLEFT; + bit = TileSet::BIND_TOPLEFT; } else { - bit = RTileSet::BIND_BOTTOMLEFT; + bit = TileSet::BIND_BOTTOMLEFT; } } else { if (pos.y < size.y / 2) { - bit = RTileSet::BIND_TOPRIGHT; + bit = TileSet::BIND_TOPRIGHT; } else { - bit = RTileSet::BIND_BOTTOMRIGHT; + bit = TileSet::BIND_BOTTOMRIGHT; } } } else { if (pos.x < size.x / 3) { if (pos.y < size.y / 3) { - bit = RTileSet::BIND_TOPLEFT; + bit = TileSet::BIND_TOPLEFT; } else if (pos.y > (size.y / 3) * 2) { - bit = RTileSet::BIND_BOTTOMLEFT; + bit = TileSet::BIND_BOTTOMLEFT; } else { - bit = RTileSet::BIND_LEFT; + bit = TileSet::BIND_LEFT; } } else if (pos.x > (size.x / 3) * 2) { if (pos.y < size.y / 3) { - bit = RTileSet::BIND_TOPRIGHT; + bit = TileSet::BIND_TOPRIGHT; } else if (pos.y > (size.y / 3) * 2) { - bit = RTileSet::BIND_BOTTOMRIGHT; + bit = TileSet::BIND_BOTTOMRIGHT; } else { - bit = RTileSet::BIND_RIGHT; + bit = TileSet::BIND_RIGHT; } } else { if (pos.y < size.y / 3) { - bit = RTileSet::BIND_TOP; + bit = TileSet::BIND_TOP; } else if (pos.y > (size.y / 3) * 2) { - bit = RTileSet::BIND_BOTTOM; + bit = TileSet::BIND_BOTTOM; } else { - bit = RTileSet::BIND_CENTER; + bit = TileSet::BIND_CENTER; } } } @@ -1526,44 +1526,44 @@ void RTileSetEditor::_on_workspace_input(const Ref &p_ie) { Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y)); pos = mm->get_position() - (pos + current_tile_region.position); uint32_t bit = 0; - if (tileset->autotile_get_bitmask_mode(get_current_tile()) == RTileSet::BITMASK_2X2) { + if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) { if (pos.x < size.x / 2) { if (pos.y < size.y / 2) { - bit = RTileSet::BIND_TOPLEFT; + bit = TileSet::BIND_TOPLEFT; } else { - bit = RTileSet::BIND_BOTTOMLEFT; + bit = TileSet::BIND_BOTTOMLEFT; } } else { if (pos.y < size.y / 2) { - bit = RTileSet::BIND_TOPRIGHT; + bit = TileSet::BIND_TOPRIGHT; } else { - bit = RTileSet::BIND_BOTTOMRIGHT; + bit = TileSet::BIND_BOTTOMRIGHT; } } } else { if (pos.x < size.x / 3) { if (pos.y < size.y / 3) { - bit = RTileSet::BIND_TOPLEFT; + bit = TileSet::BIND_TOPLEFT; } else if (pos.y > (size.y / 3) * 2) { - bit = RTileSet::BIND_BOTTOMLEFT; + bit = TileSet::BIND_BOTTOMLEFT; } else { - bit = RTileSet::BIND_LEFT; + bit = TileSet::BIND_LEFT; } } else if (pos.x > (size.x / 3) * 2) { if (pos.y < size.y / 3) { - bit = RTileSet::BIND_TOPRIGHT; + bit = TileSet::BIND_TOPRIGHT; } else if (pos.y > (size.y / 3) * 2) { - bit = RTileSet::BIND_BOTTOMRIGHT; + bit = TileSet::BIND_BOTTOMRIGHT; } else { - bit = RTileSet::BIND_RIGHT; + bit = TileSet::BIND_RIGHT; } } else { if (pos.y < size.y / 3) { - bit = RTileSet::BIND_TOP; + bit = TileSet::BIND_TOP; } else if (pos.y > (size.y / 3) * 2) { - bit = RTileSet::BIND_BOTTOM; + bit = TileSet::BIND_BOTTOM; } else { - bit = RTileSet::BIND_CENTER; + bit = TileSet::BIND_CENTER; } } } @@ -1597,7 +1597,7 @@ void RTileSetEditor::_on_workspace_input(const Ref &p_ie) { case EDITMODE_PRIORITY: case EDITMODE_Z_INDEX: { Vector2 shape_anchor = Vector2(0, 0); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { shape_anchor = edited_shape_coord; shape_anchor.x *= (size.x + spacing); shape_anchor.y *= (size.y + spacing); @@ -1617,7 +1617,7 @@ void RTileSetEditor::_on_workspace_input(const Ref &p_ie) { return; } } - if ((tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) && current_tile_region.has_point(mb->get_position())) { + if ((tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) && current_tile_region.has_point(mb->get_position())) { Vector2 coord((int)((mb->get_position().x - current_tile_region.position.x) / (spacing + size.x)), (int)((mb->get_position().y - current_tile_region.position.y) / (spacing + size.y))); if (edited_shape_coord != coord) { edited_shape_coord = coord; @@ -1795,7 +1795,7 @@ void RTileSetEditor::_on_workspace_input(const Ref &p_ie) { } } -void RTileSetEditor::_on_tool_clicked(int p_tool) { +void TileSetEditor::_on_tool_clicked(int p_tool) { if (p_tool == BITMASK_COPY) { bitmask_map_copy = tileset->autotile_get_bitmask_map(get_current_tile()); } else if (p_tool == BITMASK_PASTE) { @@ -1849,7 +1849,7 @@ void RTileSetEditor::_on_tool_clicked(int p_tool) { } undo_redo->add_do_method(tileset.ptr(), "tile_set_shapes", get_current_tile(), sd); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { undo_redo->add_do_method(tileset.ptr(), "tile_add_shape", get_current_tile(), edited_collision_shape, Transform2D(), false, edited_shape_coord); } else { undo_redo->add_do_method(tileset.ptr(), "tile_add_shape", get_current_tile(), edited_collision_shape, Transform2D()); @@ -1920,7 +1920,7 @@ void RTileSetEditor::_on_tool_clicked(int p_tool) { case EDITMODE_OCCLUSION: { if (!edited_occlusion_shape.is_null()) { undo_redo->create_action(TTR("Remove Occlusion Polygon")); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { undo_redo->add_do_method(tileset.ptr(), "tile_set_light_occluder", get_current_tile(), Ref()); undo_redo->add_undo_method(tileset.ptr(), "tile_set_light_occluder", get_current_tile(), tileset->tile_get_light_occluder(get_current_tile())); } else { @@ -1935,7 +1935,7 @@ void RTileSetEditor::_on_tool_clicked(int p_tool) { case EDITMODE_NAVIGATION: { if (!edited_navigation_shape.is_null()) { undo_redo->create_action(TTR("Remove Navigation Polygon")); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { undo_redo->add_do_method(tileset.ptr(), "tile_set_navigation_polygon", get_current_tile(), Ref()); undo_redo->add_undo_method(tileset.ptr(), "tile_set_navigation_polygon", get_current_tile(), tileset->tile_get_navigation_polygon(get_current_tile())); } else { @@ -1961,7 +1961,7 @@ void RTileSetEditor::_on_tool_clicked(int p_tool) { } } -void RTileSetEditor::_on_priority_changed(float val) { +void TileSetEditor::_on_priority_changed(float val) { if ((int)val == tileset->autotile_get_subtile_priority(get_current_tile(), edited_shape_coord)) { return; } @@ -1974,7 +1974,7 @@ void RTileSetEditor::_on_priority_changed(float val) { undo_redo->commit_action(); } -void RTileSetEditor::_on_z_index_changed(float val) { +void TileSetEditor::_on_z_index_changed(float val) { if ((int)val == tileset->autotile_get_z_index(get_current_tile(), edited_shape_coord)) { return; } @@ -1987,12 +1987,12 @@ void RTileSetEditor::_on_z_index_changed(float val) { undo_redo->commit_action(); } -void RTileSetEditor::_on_grid_snap_toggled(bool p_val) { +void TileSetEditor::_on_grid_snap_toggled(bool p_val) { helper->set_snap_options_visible(p_val); workspace->update(); } -Vector RTileSetEditor::_get_collision_shape_points(const Ref &p_shape) { +Vector TileSetEditor::_get_collision_shape_points(const Ref &p_shape) { Ref convex = p_shape; Ref concave = p_shape; if (convex.is_valid()) { @@ -2008,11 +2008,11 @@ Vector RTileSetEditor::_get_collision_shape_points(const Ref & } } -Vector RTileSetEditor::_get_edited_shape_points() { +Vector TileSetEditor::_get_edited_shape_points() { return _get_collision_shape_points(edited_collision_shape); } -void RTileSetEditor::_set_edited_shape_points(const Vector &points) { +void TileSetEditor::_set_edited_shape_points(const Vector &points) { Ref convex = edited_collision_shape; Ref concave = edited_collision_shape; if (convex.is_valid()) { @@ -2031,14 +2031,14 @@ void RTileSetEditor::_set_edited_shape_points(const Vector &points) { } } -void RTileSetEditor::_update_tile_data() { +void TileSetEditor::_update_tile_data() { current_tile_data.clear(); if (get_current_tile() < 0) { return; } - Vector sd = tileset->tile_get_shapes(get_current_tile()); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + Vector sd = tileset->tile_get_shapes(get_current_tile()); + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { SubtileData data; for (int i = 0; i < sd.size(); i++) { data.collisions.push_back(sd[i].shape); @@ -2065,7 +2065,7 @@ void RTileSetEditor::_update_tile_data() { } } -void RTileSetEditor::_update_toggle_shape_button() { +void TileSetEditor::_update_toggle_shape_button() { Ref convex = edited_collision_shape; Ref concave = edited_collision_shape; separator_shape_toggle->show(); @@ -2086,7 +2086,7 @@ void RTileSetEditor::_update_toggle_shape_button() { } } -void RTileSetEditor::_select_next_tile() { +void TileSetEditor::_select_next_tile() { Array tiles = _get_tiles_in_current_texture(true); if (tiles.size() == 0) { set_current_tile(-1); @@ -2104,7 +2104,7 @@ void RTileSetEditor::_select_next_tile() { } if (get_current_tile() == -1) { return; - } else if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + } else if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { return; } else { switch (edit_mode) { @@ -2122,7 +2122,7 @@ void RTileSetEditor::_select_next_tile() { } } -void RTileSetEditor::_select_previous_tile() { +void TileSetEditor::_select_previous_tile() { Array tiles = _get_tiles_in_current_texture(true); if (tiles.size() == 0) { set_current_tile(-1); @@ -2138,7 +2138,7 @@ void RTileSetEditor::_select_previous_tile() { } if (get_current_tile() == -1) { return; - } else if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + } else if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { return; } else { switch (edit_mode) { @@ -2156,7 +2156,7 @@ void RTileSetEditor::_select_previous_tile() { } } -Array RTileSetEditor::_get_tiles_in_current_texture(bool sorted) { +Array TileSetEditor::_get_tiles_in_current_texture(bool sorted) { Array a; List all_tiles; if (!get_current_texture().is_valid()) { @@ -2174,7 +2174,7 @@ Array RTileSetEditor::_get_tiles_in_current_texture(bool sorted) { return a; } -bool RTileSetEditor::_sort_tiles(Variant p_a, Variant p_b) { +bool TileSetEditor::_sort_tiles(Variant p_a, Variant p_b) { int a = p_a; int b = p_b; @@ -2190,7 +2190,7 @@ bool RTileSetEditor::_sort_tiles(Variant p_a, Variant p_b) { } } -Vector2 RTileSetEditor::_get_subtiles_count(int p_tile_id) { +Vector2 TileSetEditor::_get_subtiles_count(int p_tile_id) { const int spacing = tileset->autotile_get_spacing(p_tile_id); const Vector2 region_size = tileset->tile_get_region(p_tile_id).size; const Vector2 subtile_size = tileset->autotile_get_size(p_tile_id); @@ -2201,12 +2201,12 @@ Vector2 RTileSetEditor::_get_subtiles_count(int p_tile_id) { return mn == mn.floor() ? mn.floor() - Vector2(1, 1) : mn.floor(); } -void RTileSetEditor::_select_next_subtile() { +void TileSetEditor::_select_next_subtile() { if (get_current_tile() == -1) { _select_next_tile(); return; } - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { _select_next_tile(); } else if (edit_mode == EDITMODE_REGION || edit_mode == EDITMODE_BITMASK || edit_mode == EDITMODE_ICON) { _select_next_tile(); @@ -2225,12 +2225,12 @@ void RTileSetEditor::_select_next_subtile() { } } -void RTileSetEditor::_select_previous_subtile() { +void TileSetEditor::_select_previous_subtile() { if (get_current_tile() == -1) { _select_previous_tile(); return; } - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { _select_previous_tile(); } else if (edit_mode == EDITMODE_REGION || edit_mode == EDITMODE_BITMASK || edit_mode == EDITMODE_ICON) { _select_previous_tile(); @@ -2249,14 +2249,14 @@ void RTileSetEditor::_select_previous_subtile() { } } -void RTileSetEditor::_select_next_shape() { +void TileSetEditor::_select_next_shape() { if (get_current_tile() == -1) { _select_next_subtile(); } else if (edit_mode != EDITMODE_COLLISION) { _select_next_subtile(); } else { Vector2i edited_coord = Vector2i(); - if (tileset->tile_get_tile_mode(get_current_tile()) != RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) != TileSet::SINGLE_TILE) { edited_coord = Vector2i(edited_shape_coord); } SubtileData data = current_tile_data[edited_coord]; @@ -2294,7 +2294,7 @@ void RTileSetEditor::_select_next_shape() { } } -void RTileSetEditor::_select_previous_shape() { +void TileSetEditor::_select_previous_shape() { if (get_current_tile() == -1) { _select_previous_subtile(); if (get_current_tile() != -1 && edit_mode == EDITMODE_COLLISION) { @@ -2309,7 +2309,7 @@ void RTileSetEditor::_select_previous_shape() { _select_previous_subtile(); } else { Vector2i edited_coord = Vector2i(); - if (tileset->tile_get_tile_mode(get_current_tile()) != RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) != TileSet::SINGLE_TILE) { edited_coord = Vector2i(edited_shape_coord); } SubtileData data = current_tile_data[edited_coord]; @@ -2356,40 +2356,40 @@ void RTileSetEditor::_select_previous_shape() { } } -void RTileSetEditor::_set_edited_collision_shape(const Ref &p_shape) { +void TileSetEditor::_set_edited_collision_shape(const Ref &p_shape) { edited_collision_shape = p_shape; _update_toggle_shape_button(); } -void RTileSetEditor::_set_snap_step(Vector2 p_val) { +void TileSetEditor::_set_snap_step(Vector2 p_val) { snap_step.x = CLAMP(p_val.x, 1, 1024); snap_step.y = CLAMP(p_val.y, 1, 1024); workspace->update(); } -void RTileSetEditor::_set_snap_off(Vector2 p_val) { +void TileSetEditor::_set_snap_off(Vector2 p_val) { snap_offset.x = CLAMP(p_val.x, 0, 1024 + WORKSPACE_MARGIN.x); snap_offset.y = CLAMP(p_val.y, 0, 1024 + WORKSPACE_MARGIN.y); workspace->update(); } -void RTileSetEditor::_set_snap_sep(Vector2 p_val) { +void TileSetEditor::_set_snap_sep(Vector2 p_val) { snap_separation.x = CLAMP(p_val.x, 0, 1024); snap_separation.y = CLAMP(p_val.y, 0, 1024); workspace->update(); } -void RTileSetEditor::_validate_current_tile_id() { +void TileSetEditor::_validate_current_tile_id() { if (get_current_tile() >= 0 && !tileset->has_tile(get_current_tile())) { set_current_tile(-1); } } -void RTileSetEditor::_select_edited_shape_coord() { +void TileSetEditor::_select_edited_shape_coord() { select_coord(edited_shape_coord); } -void RTileSetEditor::_undo_tile_removal(int p_id) { +void TileSetEditor::_undo_tile_removal(int p_id) { undo_redo->add_undo_method(tileset.ptr(), "create_tile", p_id); undo_redo->add_undo_method(tileset.ptr(), "tile_set_name", p_id, tileset->tile_get_name(p_id)); undo_redo->add_undo_method(tileset.ptr(), "tile_set_normal_map", p_id, tileset->tile_get_normal_map(p_id)); @@ -2405,7 +2405,7 @@ void RTileSetEditor::_undo_tile_removal(int p_id) { undo_redo->add_undo_method(tileset.ptr(), "tile_set_region", p_id, tileset->tile_get_region(p_id)); // Necessary to get the version that returns a Array instead of a Vector. undo_redo->add_undo_method(tileset.ptr(), "tile_set_shapes", p_id, tileset->call("tile_get_shapes", p_id)); - if (tileset->tile_get_tile_mode(p_id) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(p_id) == TileSet::SINGLE_TILE) { undo_redo->add_undo_method(tileset.ptr(), "tile_set_light_occluder", p_id, tileset->tile_get_light_occluder(p_id)); undo_redo->add_undo_method(tileset.ptr(), "tile_set_navigation_polygon", p_id, tileset->tile_get_navigation_polygon(p_id)); } else { @@ -2437,7 +2437,7 @@ void RTileSetEditor::_undo_tile_removal(int p_id) { } } -void RTileSetEditor::_zoom_in() { +void TileSetEditor::_zoom_in() { float scale = workspace->get_scale().x; if (scale < max_scale) { scale *= scale_ratio; @@ -2446,7 +2446,7 @@ void RTileSetEditor::_zoom_in() { workspace_overlay->set_custom_minimum_size(workspace->get_rect().size * scale); } } -void RTileSetEditor::_zoom_out() { +void TileSetEditor::_zoom_out() { float scale = workspace->get_scale().x; if (scale > min_scale) { scale /= scale_ratio; @@ -2455,13 +2455,13 @@ void RTileSetEditor::_zoom_out() { workspace_overlay->set_custom_minimum_size(workspace->get_rect().size * scale); } } -void RTileSetEditor::_zoom_reset() { +void TileSetEditor::_zoom_reset() { workspace->set_scale(Vector2(1, 1)); workspace_container->set_custom_minimum_size(workspace->get_rect().size); workspace_overlay->set_custom_minimum_size(workspace->get_rect().size); } -void RTileSetEditor::draw_highlight_current_tile() { +void TileSetEditor::draw_highlight_current_tile() { Color shadow_color = Color(0.3, 0.3, 0.3, 0.3); if ((workspace_mode == WORKSPACE_EDIT && get_current_tile() >= 0) || !edited_region.has_no_area()) { Rect2 region; @@ -2489,7 +2489,7 @@ void RTileSetEditor::draw_highlight_current_tile() { } } -void RTileSetEditor::draw_highlight_subtile(Vector2 coord, const Vector &other_highlighted) { +void TileSetEditor::draw_highlight_subtile(Vector2 coord, const Vector &other_highlighted) { Color shadow_color = Color(0.3, 0.3, 0.3, 0.3); Vector2 size = tileset->autotile_get_size(get_current_tile()); int spacing = tileset->autotile_get_spacing(get_current_tile()); @@ -2525,9 +2525,9 @@ void RTileSetEditor::draw_highlight_subtile(Vector2 coord, const Vector } } -void RTileSetEditor::draw_tile_subdivision(int p_id, Color p_color) const { +void TileSetEditor::draw_tile_subdivision(int p_id, Color p_color) const { Color c = p_color; - if (tileset->tile_get_tile_mode(p_id) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(p_id) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(p_id) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(p_id) == TileSet::ATLAS_TILE) { Rect2 region = tileset->tile_get_region(p_id); Size2 size = tileset->autotile_get_size(p_id); int spacing = tileset->autotile_get_spacing(p_id); @@ -2553,7 +2553,7 @@ void RTileSetEditor::draw_tile_subdivision(int p_id, Color p_color) const { } } -void RTileSetEditor::draw_edited_region_subdivision() const { +void TileSetEditor::draw_edited_region_subdivision() const { Color c = Color(0.3, 0.7, 0.6); Rect2 region = edited_region; Size2 size; @@ -2564,7 +2564,7 @@ void RTileSetEditor::draw_edited_region_subdivision() const { int p_id = get_current_tile(); size = tileset->autotile_get_size(p_id); spacing = tileset->autotile_get_spacing(p_id); - draw = tileset->tile_get_tile_mode(p_id) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(p_id) == RTileSet::ATLAS_TILE; + draw = tileset->tile_get_tile_mode(p_id) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(p_id) == TileSet::ATLAS_TILE; } else { size = snap_step; spacing = snap_separation.x; @@ -2593,7 +2593,7 @@ void RTileSetEditor::draw_edited_region_subdivision() const { } } -void RTileSetEditor::draw_grid_snap() { +void TileSetEditor::draw_grid_snap() { if (tools[TOOL_GRID_SNAP]->is_pressed()) { Color grid_color = Color(0.4, 0, 1); Size2 s = workspace->get_size(); @@ -2642,7 +2642,7 @@ void RTileSetEditor::draw_grid_snap() { } } -void RTileSetEditor::draw_polygon_shapes() { +void TileSetEditor::draw_polygon_shapes() { int t_id = get_current_tile(); if (t_id < 0) { return; @@ -2650,11 +2650,11 @@ void RTileSetEditor::draw_polygon_shapes() { switch (edit_mode) { case EDITMODE_COLLISION: { - Vector sd = tileset->tile_get_shapes(t_id); + Vector sd = tileset->tile_get_shapes(t_id); for (int i = 0; i < sd.size(); i++) { Vector2 coord = Vector2(0, 0); Vector2 anchor = Vector2(0, 0); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { coord = sd[i].autotile_coord; anchor = tileset->autotile_get_size(t_id); anchor.x += tileset->autotile_get_spacing(t_id); @@ -2670,7 +2670,7 @@ void RTileSetEditor::draw_polygon_shapes() { Color c_border; Ref convex = shape; bool is_convex = convex.is_valid(); - if ((tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE || coord == edited_shape_coord) && sd[i].shape == edited_collision_shape) { + if ((tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE || coord == edited_shape_coord) && sd[i].shape == edited_collision_shape) { if (is_convex) { c_bg = Color(0, 1, 1, 0.5); c_border = Color(0, 1, 1); @@ -2708,7 +2708,7 @@ void RTileSetEditor::draw_polygon_shapes() { workspace->draw_polygon(polygon, colors); - if (coord == edited_shape_coord || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (coord == edited_shape_coord || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { if (!creating_shape && polygon.size() > 1) { for (int j = 0; j < polygon.size() - 1; j++) { workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true); @@ -2723,7 +2723,7 @@ void RTileSetEditor::draw_polygon_shapes() { } } break; case EDITMODE_OCCLUSION: { - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { Ref shape = edited_occlusion_shape; if (shape.is_valid()) { Color c_bg = Color(0, 1, 1, 0.5); @@ -2809,7 +2809,7 @@ void RTileSetEditor::draw_polygon_shapes() { } } break; case EDITMODE_NAVIGATION: { - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { Ref shape = edited_navigation_shape; if (shape.is_valid()) { @@ -2916,7 +2916,7 @@ void RTileSetEditor::draw_polygon_shapes() { } } -void RTileSetEditor::close_shape(const Vector2 &shape_anchor) { +void TileSetEditor::close_shape(const Vector2 &shape_anchor) { creating_shape = false; if (edit_mode == EDITMODE_COLLISION) { @@ -2953,7 +2953,7 @@ void RTileSetEditor::close_shape(const Vector2 &shape_anchor) { } } undo_redo->add_do_method(tileset.ptr(), "tile_set_shapes", get_current_tile(), sd); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { undo_redo->add_do_method(tileset.ptr(), "tile_add_shape", get_current_tile(), shape, Transform2D(), false, edited_shape_coord); } else { undo_redo->add_do_method(tileset.ptr(), "tile_add_shape", get_current_tile(), shape, Transform2D()); @@ -2981,7 +2981,7 @@ void RTileSetEditor::close_shape(const Vector2 &shape_anchor) { shape->set_polygon(polygon); undo_redo->create_action(TTR("Create Occlusion Polygon")); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { undo_redo->add_do_method(tileset.ptr(), "autotile_set_light_occluder", get_current_tile(), shape, edited_shape_coord); undo_redo->add_undo_method(tileset.ptr(), "autotile_set_light_occluder", get_current_tile(), tileset->autotile_get_light_occluder(get_current_tile(), edited_shape_coord), edited_shape_coord); } else { @@ -3011,7 +3011,7 @@ void RTileSetEditor::close_shape(const Vector2 &shape_anchor) { shape->make_polygons_from_outlines(); undo_redo->create_action(TTR("Create Navigation Polygon")); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { undo_redo->add_do_method(tileset.ptr(), "autotile_set_navigation_polygon", get_current_tile(), shape, edited_shape_coord); undo_redo->add_undo_method(tileset.ptr(), "autotile_set_navigation_polygon", get_current_tile(), tileset->autotile_get_navigation_polygon(get_current_tile(), edited_shape_coord), edited_shape_coord); } else { @@ -3026,7 +3026,7 @@ void RTileSetEditor::close_shape(const Vector2 &shape_anchor) { tileset->_change_notify(""); } -void RTileSetEditor::select_coord(const Vector2 &coord) { +void TileSetEditor::select_coord(const Vector2 &coord) { _update_tile_data(); current_shape = PoolVector2Array(); if (get_current_tile() == -1) { @@ -3034,7 +3034,7 @@ void RTileSetEditor::select_coord(const Vector2 &coord) { } Rect2 current_tile_region = tileset->tile_get_region(get_current_tile()); current_tile_region.position += WORKSPACE_MARGIN; - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { if (edited_collision_shape != tileset->tile_get_shape(get_current_tile(), 0)) { _set_edited_collision_shape(tileset->tile_get_shape(get_current_tile(), 0)); } @@ -3071,7 +3071,7 @@ void RTileSetEditor::select_coord(const Vector2 &coord) { } } } else { - Vector sd = tileset->tile_get_shapes(get_current_tile()); + Vector sd = tileset->tile_get_shapes(get_current_tile()); bool found_collision_shape = false; for (int i = 0; i < sd.size(); i++) { if (sd[i].autotile_coord == coord) { @@ -3129,7 +3129,7 @@ void RTileSetEditor::select_coord(const Vector2 &coord) { helper->_change_notify(""); } -Vector2 RTileSetEditor::snap_point(const Vector2 &point) { +Vector2 TileSetEditor::snap_point(const Vector2 &point) { Vector2 p = point; Vector2 coord = edited_shape_coord; Vector2 tile_size = tileset->autotile_get_size(get_current_tile()); @@ -3141,7 +3141,7 @@ Vector2 RTileSetEditor::snap_point(const Vector2 &point) { anchor += WORKSPACE_MARGIN; Rect2 region(anchor, tile_size); Rect2 tile_region(tileset->tile_get_region(get_current_tile()).position + WORKSPACE_MARGIN, tileset->tile_get_region(get_current_tile()).size); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { region.position = tileset->tile_get_region(get_current_tile()).position + WORKSPACE_MARGIN; region.size = tileset->tile_get_region(get_current_tile()).size; } @@ -3182,13 +3182,13 @@ Vector2 RTileSetEditor::snap_point(const Vector2 &point) { return p; } -void RTileSetEditor::add_texture(Ref p_texture) { +void TileSetEditor::add_texture(Ref p_texture) { texture_list->add_item(p_texture->get_path().get_file()); texture_map.insert(p_texture->get_path(), p_texture); texture_list->set_item_metadata(texture_list->get_item_count() - 1, p_texture->get_path()); } -void RTileSetEditor::remove_texture(Ref p_texture) { +void TileSetEditor::remove_texture(Ref p_texture) { texture_list->remove_item(texture_list->find_metadata(p_texture->get_path())); texture_map.erase(p_texture->get_path()); @@ -3200,7 +3200,7 @@ void RTileSetEditor::remove_texture(Ref p_texture) { } } -void RTileSetEditor::update_texture_list() { +void TileSetEditor::update_texture_list() { Ref selected_texture = get_current_texture(); helper->set_tileset(tileset); @@ -3239,7 +3239,7 @@ void RTileSetEditor::update_texture_list() { helper->_change_notify(""); } -void RTileSetEditor::update_texture_list_icon() { +void TileSetEditor::update_texture_list_icon() { for (int current_idx = 0; current_idx < texture_list->get_item_count(); current_idx++) { String path = texture_list->get_item_metadata(current_idx); texture_list->set_item_icon(current_idx, texture_map[path]); @@ -3249,7 +3249,7 @@ void RTileSetEditor::update_texture_list_icon() { texture_list->update(); } -void RTileSetEditor::update_workspace_tile_mode() { +void TileSetEditor::update_workspace_tile_mode() { if (!get_current_texture().is_valid()) { tool_workspacemode[WORKSPACE_EDIT]->set_pressed(true); workspace_mode = WORKSPACE_EDIT; @@ -3313,7 +3313,7 @@ void RTileSetEditor::update_workspace_tile_mode() { } separator_editmode->show(); - if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::SINGLE_TILE) { + if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) { if (tool_editmode[EDITMODE_ICON]->is_pressed() || tool_editmode[EDITMODE_PRIORITY]->is_pressed() || tool_editmode[EDITMODE_BITMASK]->is_pressed() || tool_editmode[EDITMODE_Z_INDEX]->is_pressed()) { tool_editmode[EDITMODE_COLLISION]->set_pressed(true); edit_mode = EDITMODE_COLLISION; @@ -3324,13 +3324,13 @@ void RTileSetEditor::update_workspace_tile_mode() { tool_editmode[EDITMODE_BITMASK]->hide(); tool_editmode[EDITMODE_PRIORITY]->hide(); tool_editmode[EDITMODE_Z_INDEX]->hide(); - } else if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::AUTO_TILE) { + } else if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE) { if (edit_mode == EDITMODE_ICON) { select_coord(tileset->autotile_get_icon_coordinate(get_current_tile())); } else { _select_edited_shape_coord(); } - } else if (tileset->tile_get_tile_mode(get_current_tile()) == RTileSet::ATLAS_TILE) { + } else if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::ATLAS_TILE) { if (tool_editmode[EDITMODE_PRIORITY]->is_pressed() || tool_editmode[EDITMODE_BITMASK]->is_pressed()) { tool_editmode[EDITMODE_COLLISION]->set_pressed(true); edit_mode = EDITMODE_COLLISION; @@ -3346,7 +3346,7 @@ void RTileSetEditor::update_workspace_tile_mode() { _on_edit_mode_changed(edit_mode); } -void RTileSetEditor::update_workspace_minsize() { +void TileSetEditor::update_workspace_minsize() { Size2 workspace_min_size = get_current_texture()->get_size(); String current_texture_path = get_current_texture()->get_path(); List tiles; @@ -3371,7 +3371,7 @@ void RTileSetEditor::update_workspace_minsize() { workspace->call_deferred("set_custom_minimum_size", workspace_min_size + WORKSPACE_MARGIN * 2); } -void RTileSetEditor::update_edited_region(const Vector2 &end_point) { +void TileSetEditor::update_edited_region(const Vector2 &end_point) { edited_region = Rect2(region_from, Size2()); if (tools[TOOL_GRID_SNAP]->is_pressed()) { Vector2 grid_coord; @@ -3393,11 +3393,11 @@ void RTileSetEditor::update_edited_region(const Vector2 &end_point) { } } -int RTileSetEditor::get_current_tile() const { +int TileSetEditor::get_current_tile() const { return current_tile; } -void RTileSetEditor::set_current_tile(int p_id) { +void TileSetEditor::set_current_tile(int p_id) { if (current_tile != p_id) { current_tile = p_id; helper->_change_notify(""); @@ -3411,7 +3411,7 @@ void RTileSetEditor::set_current_tile(int p_id) { } } -Ref RTileSetEditor::get_current_texture() { +Ref TileSetEditor::get_current_texture() { if (texture_list->get_selected_items().size() == 0) { return Ref(); } else { @@ -3419,7 +3419,7 @@ Ref RTileSetEditor::get_current_texture() { } } -void RTilesetEditorContext::set_tileset(const Ref &p_tileset) { +void RTilesetEditorContext::set_tileset(const Ref &p_tileset) { tileset = p_tileset; } @@ -3470,7 +3470,7 @@ bool RTilesetEditorContext::_set(const StringName &p_name, const Variant &p_valu tileset->set_script(p_value); return true; } else if (name == "selected_collision_one_way") { - Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); + Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); for (int index = 0; index < sd.size(); index++) { if (sd[index].shape == tileset_editor->edited_collision_shape) { tileset->tile_set_shape_one_way(tileset_editor->get_current_tile(), index, p_value); @@ -3479,7 +3479,7 @@ bool RTilesetEditorContext::_set(const StringName &p_name, const Variant &p_valu } return false; } else if (name == "selected_collision_one_way_margin") { - Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); + Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); for (int index = 0; index < sd.size(); index++) { if (sd[index].shape == tileset_editor->edited_collision_shape) { tileset->tile_set_shape_one_way_margin(tileset_editor->get_current_tile(), index, p_value); @@ -3531,7 +3531,7 @@ bool RTilesetEditorContext::_get(const StringName &p_name, Variant &r_ret) const r_ret = tileset_editor->edited_collision_shape; v = true; } else if (name == "selected_collision_one_way") { - Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); + Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); for (int index = 0; index < sd.size(); index++) { if (sd[index].shape == tileset_editor->edited_collision_shape) { r_ret = sd[index].one_way_collision; @@ -3540,7 +3540,7 @@ bool RTilesetEditorContext::_get(const StringName &p_name, Variant &r_ret) const } } } else if (name == "selected_collision_one_way_margin") { - Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); + Vector sd = tileset->tile_get_shapes(tileset_editor->get_current_tile()); for (int index = 0; index < sd.size(); index++) { if (sd[index].shape == tileset_editor->edited_collision_shape) { r_ret = sd[index].one_way_collision_margin; @@ -3578,11 +3578,11 @@ void RTilesetEditorContext::_get_property_list(List *p_list) const p_list->push_back(PropertyInfo(Variant::OBJECT, "tile_material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial")); p_list->push_back(PropertyInfo(Variant::COLOR, "tile_modulate")); p_list->push_back(PropertyInfo(Variant::INT, "tile_tile_mode", PROPERTY_HINT_ENUM, "SINGLE_TILE,AUTO_TILE,ATLAS_TILE")); - if (tileset->tile_get_tile_mode(id) == RTileSet::AUTO_TILE) { + if (tileset->tile_get_tile_mode(id) == TileSet::AUTO_TILE) { p_list->push_back(PropertyInfo(Variant::INT, "tile_autotile_bitmask_mode", PROPERTY_HINT_ENUM, "2x2,3x3 (minimal),3x3")); p_list->push_back(PropertyInfo(Variant::VECTOR2, "tile_subtile_size")); p_list->push_back(PropertyInfo(Variant::INT, "tile_subtile_spacing", PROPERTY_HINT_RANGE, "0, 1024, 1")); - } else if (tileset->tile_get_tile_mode(id) == RTileSet::ATLAS_TILE) { + } else if (tileset->tile_get_tile_mode(id) == TileSet::ATLAS_TILE) { p_list->push_back(PropertyInfo(Variant::VECTOR2, "tile_subtile_size")); p_list->push_back(PropertyInfo(Variant::INT, "tile_subtile_spacing", PROPERTY_HINT_RANGE, "0, 1024, 1")); } @@ -3592,17 +3592,17 @@ void RTilesetEditorContext::_get_property_list(List *p_list) const p_list->push_back(PropertyInfo(Variant::VECTOR2, "tile_shape_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); p_list->push_back(PropertyInfo(Variant::INT, "tile_z_index", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1")); } - if (tileset_editor->edit_mode == RTileSetEditor::EDITMODE_COLLISION && tileset_editor->edited_collision_shape.is_valid()) { + if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_COLLISION && tileset_editor->edited_collision_shape.is_valid()) { p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_collision", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_collision_shape->get_class())); if (tileset_editor->edited_collision_shape.is_valid()) { p_list->push_back(PropertyInfo(Variant::BOOL, "selected_collision_one_way", PROPERTY_HINT_NONE)); p_list->push_back(PropertyInfo(Variant::REAL, "selected_collision_one_way_margin", PROPERTY_HINT_NONE)); } } - if (tileset_editor->edit_mode == RTileSetEditor::EDITMODE_NAVIGATION && tileset_editor->edited_navigation_shape.is_valid()) { + if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_NAVIGATION && tileset_editor->edited_navigation_shape.is_valid()) { p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_navigation", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_navigation_shape->get_class())); } - if (tileset_editor->edit_mode == RTileSetEditor::EDITMODE_OCCLUSION && tileset_editor->edited_occlusion_shape.is_valid()) { + if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_OCCLUSION && tileset_editor->edited_occlusion_shape.is_valid()) { p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_occlusion", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_occlusion_shape->get_class())); } if (!tileset.is_null()) { @@ -3614,22 +3614,22 @@ void RTilesetEditorContext::_bind_methods() { ClassDB::bind_method("_hide_script_from_inspector", &RTilesetEditorContext::_hide_script_from_inspector); } -RTilesetEditorContext::RTilesetEditorContext(RTileSetEditor *p_tileset_editor) { +RTilesetEditorContext::RTilesetEditorContext(TileSetEditor *p_tileset_editor) { tileset_editor = p_tileset_editor; snap_options_visible = false; } -void RTileSetEditorPlugin::edit(Object *p_node) { - if (Object::cast_to(p_node)) { - tileset_editor->edit(Object::cast_to(p_node)); +void TileSetEditorPlugin::edit(Object *p_node) { + if (Object::cast_to(p_node)) { + tileset_editor->edit(Object::cast_to(p_node)); } } -bool RTileSetEditorPlugin::handles(Object *p_node) const { - return p_node->is_class("RTileSet") || p_node->is_class("RTilesetEditorContext"); +bool TileSetEditorPlugin::handles(Object *p_node) const { + return p_node->is_class("TileSet") || p_node->is_class("RTilesetEditorContext"); } -void RTileSetEditorPlugin::make_visible(bool p_visible) { +void TileSetEditorPlugin::make_visible(bool p_visible) { if (p_visible) { tileset_editor_button->show(); editor->make_bottom_panel_item_visible(tileset_editor); @@ -3645,18 +3645,18 @@ void RTileSetEditorPlugin::make_visible(bool p_visible) { } } -Dictionary RTileSetEditorPlugin::get_state() const { +Dictionary TileSetEditorPlugin::get_state() const { Dictionary state; state["snap_offset"] = tileset_editor->snap_offset; state["snap_step"] = tileset_editor->snap_step; state["snap_separation"] = tileset_editor->snap_separation; - state["snap_enabled"] = tileset_editor->tools[RTileSetEditor::TOOL_GRID_SNAP]->is_pressed(); - state["keep_inside_tile"] = tileset_editor->tools[RTileSetEditor::SHAPE_KEEP_INSIDE_TILE]->is_pressed(); - state["show_information"] = tileset_editor->tools[RTileSetEditor::VISIBLE_INFO]->is_pressed(); + state["snap_enabled"] = tileset_editor->tools[TileSetEditor::TOOL_GRID_SNAP]->is_pressed(); + state["keep_inside_tile"] = tileset_editor->tools[TileSetEditor::SHAPE_KEEP_INSIDE_TILE]->is_pressed(); + state["show_information"] = tileset_editor->tools[TileSetEditor::VISIBLE_INFO]->is_pressed(); return state; } -void RTileSetEditorPlugin::set_state(const Dictionary &p_state) { +void TileSetEditorPlugin::set_state(const Dictionary &p_state) { Dictionary state = p_state; if (state.has("snap_step")) { tileset_editor->_set_snap_step(state["snap_step"]); @@ -3671,33 +3671,33 @@ void RTileSetEditorPlugin::set_state(const Dictionary &p_state) { } if (state.has("snap_enabled")) { - tileset_editor->tools[RTileSetEditor::TOOL_GRID_SNAP]->set_pressed(state["snap_enabled"]); + tileset_editor->tools[TileSetEditor::TOOL_GRID_SNAP]->set_pressed(state["snap_enabled"]); if (tileset_editor->helper) { tileset_editor->_on_grid_snap_toggled(state["snap_enabled"]); } } if (state.has("keep_inside_tile")) { - tileset_editor->tools[RTileSetEditor::SHAPE_KEEP_INSIDE_TILE]->set_pressed(state["keep_inside_tile"]); + tileset_editor->tools[TileSetEditor::SHAPE_KEEP_INSIDE_TILE]->set_pressed(state["keep_inside_tile"]); } if (state.has("show_information")) { - tileset_editor->tools[RTileSetEditor::VISIBLE_INFO]->set_pressed(state["show_information"]); + tileset_editor->tools[TileSetEditor::VISIBLE_INFO]->set_pressed(state["show_information"]); } } -RTileSetEditorPlugin::RTileSetEditorPlugin(EditorNode *p_node) { +TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) { editor = p_node; - tileset_editor = memnew(RTileSetEditor(p_node)); + tileset_editor = memnew(TileSetEditor(p_node)); tileset_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); tileset_editor->hide(); - tileset_editor_button = p_node->add_bottom_panel_item(TTR("RTileSet"), tileset_editor); + tileset_editor_button = p_node->add_bottom_panel_item(TTR("TileSet"), tileset_editor); tileset_editor_button->hide(); file_export_lib = memnew(EditorFileDialog); - file_export_lib->set_title(TTR("Export RTileSet")); + file_export_lib->set_title(TTR("Export TileSet")); file_export_lib->set_mode(EditorFileDialog::MODE_SAVE_FILE); file_export_lib->connect("file_selected", this, "_dialog_action"); file_export_lib_merge = memnew(CheckBox); @@ -3713,22 +3713,22 @@ RTileSetEditorPlugin::RTileSetEditorPlugin(EditorNode *p_node) { editor->get_gui_base()->add_child(file_export_lib); List extensions; - Ref ml(memnew(RTileSet)); + Ref ml(memnew(TileSet)); ResourceSaver::get_recognized_extensions(ml, &extensions); file_export_lib->clear_filters(); for (List::Element *E = extensions.front(); E; E = E->next()) { file_export_lib->add_filter("*." + E->get()); } - p_node->add_convert_menu_item("RTileSet", this, "_convert_scene_to_tile_set", DEFVAL(Variant())); + p_node->add_convert_menu_item("TileSet", this, "_convert_scene_to_tile_set", DEFVAL(Variant())); } -void RTileSetEditorPlugin::_bind_methods() { - ClassDB::bind_method("_convert_scene_to_tile_set", &RTileSetEditorPlugin::_convert_scene_to_tile_set); - ClassDB::bind_method("_dialog_action", &RTileSetEditorPlugin::_dialog_action); +void TileSetEditorPlugin::_bind_methods() { + ClassDB::bind_method("_convert_scene_to_tile_set", &TileSetEditorPlugin::_convert_scene_to_tile_set); + ClassDB::bind_method("_dialog_action", &TileSetEditorPlugin::_dialog_action); } -void RTileSetEditorPlugin::_convert_scene_to_tile_set(Variant p_null) { +void TileSetEditorPlugin::_convert_scene_to_tile_set(Variant p_null) { if (!editor->get_editor_data().get_edited_scene_root()) { editor->show_accept(TTR("This operation can't be done without a scene."), TTR("OK")); return; @@ -3737,10 +3737,10 @@ void RTileSetEditorPlugin::_convert_scene_to_tile_set(Variant p_null) { file_export_lib->popup_centered_ratio(); } -void RTileSetEditorPlugin::_dialog_action(String p_file) { - Ref tileset; +void TileSetEditorPlugin::_dialog_action(String p_file) { + Ref tileset; if (FileAccess::exists(p_file) && file_export_lib_merge->is_pressed()) { - tileset = ResourceLoader::load(p_file, "RTileSet"); + tileset = ResourceLoader::load(p_file, "TileSet"); if (tileset.is_null()) { editor->show_accept(TTR("Can't load TileSet for merging!"), TTR("OK")); @@ -3748,14 +3748,14 @@ void RTileSetEditorPlugin::_dialog_action(String p_file) { } } else { - tileset = Ref(memnew(RTileSet)); + tileset = Ref(memnew(TileSet)); } - RTileSetEditor::update_library_file(editor->get_editor_data().get_edited_scene_root(), tileset, true); + TileSetEditor::update_library_file(editor->get_editor_data().get_edited_scene_root(), tileset, true); Error err = ResourceSaver::save(p_file, tileset); if (err) { - editor->show_accept(TTR("Error saving RTileSet!"), TTR("OK")); + editor->show_accept(TTR("Error saving TileSet!"), TTR("OK")); return; } } diff --git a/modules/rtile_map/tile_set_editor_plugin.h b/modules/rtile_map/tile_set_editor_plugin.h index c1892761d..c3ea6d054 100644 --- a/modules/rtile_map/tile_set_editor_plugin.h +++ b/modules/rtile_map/tile_set_editor_plugin.h @@ -52,11 +52,11 @@ class PopupMenu; class EditorFileDialog; class CheckBox; -class RTileSetEditor : public HSplitContainer { - friend class RTileSetEditorPlugin; +class TileSetEditor : public HSplitContainer { + friend class TileSetEditorPlugin; friend class RTilesetEditorContext; - GDCLASS(RTileSetEditor, HSplitContainer); + GDCLASS(TileSetEditor, HSplitContainer); enum TextureToolButtons { TOOL_TILESET_ADD_TEXTURE, @@ -112,7 +112,7 @@ class RTileSetEditor : public HSplitContainer { Ref navigation_shape; }; - Ref tileset; + Ref tileset; RTilesetEditorContext *helper; EditorNode *editor; UndoRedo *undo_redo; @@ -181,8 +181,8 @@ class RTileSetEditor : public HSplitContainer { Ref get_current_texture(); - static void _import_node(Node *p_node, Ref p_library); - static void _import_scene(Node *p_scene, Ref p_library, bool p_merge); + static void _import_node(Node *p_node, Ref p_library); + static void _import_scene(Node *p_scene, Ref p_library, bool p_merge); void _undo_redo_import_scene(Node *p_scene, bool p_merge); Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); @@ -194,11 +194,11 @@ protected: void _notification(int p_what); public: - void edit(const Ref &p_tileset); - static Error update_library_file(Node *p_base_scene, Ref ml, bool p_merge = true); + void edit(const Ref &p_tileset); + static Error update_library_file(Node *p_base_scene, Ref ml, bool p_merge = true); - RTileSetEditor(EditorNode *p_editor); - ~RTileSetEditor(); + TileSetEditor(EditorNode *p_editor); + ~TileSetEditor(); private: void _on_tileset_toolbar_button_pressed(int p_index); @@ -263,16 +263,16 @@ private: }; class RTilesetEditorContext : public Object { - friend class RTileSetEditor; + friend class TileSetEditor; GDCLASS(RTilesetEditorContext, Object); - Ref tileset; - RTileSetEditor *tileset_editor; + Ref tileset; + TileSetEditor *tileset_editor; bool snap_options_visible; public: bool _hide_script_from_inspector() { return true; } - void set_tileset(const Ref &p_tileset); + void set_tileset(const Ref &p_tileset); private: void set_snap_options_visible(bool p_visible); @@ -284,13 +284,13 @@ protected: static void _bind_methods(); public: - RTilesetEditorContext(RTileSetEditor *p_tileset_editor); + RTilesetEditorContext(TileSetEditor *p_tileset_editor); }; -class RTileSetEditorPlugin : public EditorPlugin { - GDCLASS(RTileSetEditorPlugin, EditorPlugin); +class TileSetEditorPlugin : public EditorPlugin { + GDCLASS(TileSetEditorPlugin, EditorPlugin); - RTileSetEditor *tileset_editor; + TileSetEditor *tileset_editor; Button *tileset_editor_button; EditorNode *editor; @@ -299,7 +299,7 @@ class RTileSetEditorPlugin : public EditorPlugin { CheckBox *file_export_lib_apply_xforms; public: - virtual String get_name() const { return "RTileSet"; } + virtual String get_name() const { return "TileSet"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_node); virtual bool handles(Object *p_node) const; @@ -307,7 +307,7 @@ public: void set_state(const Dictionary &p_state); Dictionary get_state() const; - RTileSetEditorPlugin(EditorNode *p_node); + TileSetEditorPlugin(EditorNode *p_node); protected: static void _bind_methods();