#include "tile_map_layer.h"
#include "core/io/marshalls.h"
#include "scene/2d/tile_map.h"
#include "scene/gui/control.h"
#include "scene/resources/world_2d.h"
#include "servers/navigation_server_2d.h"
#ifdef DEBUG_ENABLED
#include "servers/navigation_server_3d.h"
#endif
#ifdef DEBUG_ENABLED
constexpr int TILE_MAP_DEBUG_QUADRANT_SIZE = …;
Vector2i TileMapLayer::_coords_to_debug_quadrant_coords(const Vector2i &p_coords) const { … }
void TileMapLayer::_debug_update(bool p_force_cleanup) { … }
void TileMapLayer::_debug_quadrants_update_cell(CellData &r_cell_data, SelfList<DebugQuadrant>::List &r_dirty_debug_quadrant_list) { … }
#endif
void TileMapLayer::_rendering_update(bool p_force_cleanup) { … }
void TileMapLayer::_rendering_notification(int p_what) { … }
void TileMapLayer::_rendering_quadrants_update_cell(CellData &r_cell_data, SelfList<RenderingQuadrant>::List &r_dirty_rendering_quadrant_list) { … }
void TileMapLayer::_rendering_occluders_clear_cell(CellData &r_cell_data) { … }
void TileMapLayer::_rendering_occluders_update_cell(CellData &r_cell_data) { … }
#ifdef DEBUG_ENABLED
void TileMapLayer::_rendering_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) { … }
#endif
void TileMapLayer::_physics_update(bool p_force_cleanup) { … }
void TileMapLayer::_physics_notification(int p_what) { … }
void TileMapLayer::_physics_clear_cell(CellData &r_cell_data) { … }
void TileMapLayer::_physics_update_cell(CellData &r_cell_data) { … }
#ifdef DEBUG_ENABLED
void TileMapLayer::_physics_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) {
ERR_FAIL_COND(tile_set.is_null());
if (!get_tree()) {
return;
}
bool show_collision = false;
switch (collision_visibility_mode) {
case TileMapLayer::DEBUG_VISIBILITY_MODE_DEFAULT:
show_collision = !Engine::get_singleton()->is_editor_hint() && get_tree()->is_debugging_collisions_hint();
break;
case TileMapLayer::DEBUG_VISIBILITY_MODE_FORCE_HIDE:
show_collision = false;
break;
case TileMapLayer::DEBUG_VISIBILITY_MODE_FORCE_SHOW:
show_collision = true;
break;
}
if (!show_collision) {
return;
}
RenderingServer *rs = RenderingServer::get_singleton();
PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
Color debug_collision_color = get_tree()->get_debug_collisions_color();
Vector<Color> color;
color.push_back(debug_collision_color);
Transform2D quadrant_to_local(0, p_quadrant_pos);
Transform2D global_to_quadrant = (get_global_transform() * quadrant_to_local).affine_inverse();
for (RID body : r_cell_data.bodies) {
if (body.is_valid()) {
Transform2D body_to_quadrant = global_to_quadrant * Transform2D(ps->body_get_state(body, PhysicsServer2D::BODY_STATE_TRANSFORM));
rs->canvas_item_add_set_transform(p_canvas_item, body_to_quadrant);
for (int shape_index = 0; shape_index < ps->body_get_shape_count(body); shape_index++) {
const RID &shape = ps->body_get_shape(body, shape_index);
const PhysicsServer2D::ShapeType &type = ps->shape_get_type(shape);
if (type == PhysicsServer2D::SHAPE_CONVEX_POLYGON) {
rs->canvas_item_add_polygon(p_canvas_item, ps->shape_get_data(shape), color);
} else {
WARN_PRINT("Wrong shape type for a tile, should be SHAPE_CONVEX_POLYGON.");
}
}
rs->canvas_item_add_set_transform(p_canvas_item, Transform2D());
}
}
};
#endif
void TileMapLayer::_navigation_update(bool p_force_cleanup) { … }
void TileMapLayer::_navigation_notification(int p_what) { … }
void TileMapLayer::_navigation_clear_cell(CellData &r_cell_data) { … }
void TileMapLayer::_navigation_update_cell(CellData &r_cell_data) { … }
#ifdef DEBUG_ENABLED
void TileMapLayer::_navigation_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) { … }
#endif
void TileMapLayer::_scenes_update(bool p_force_cleanup) { … }
void TileMapLayer::_scenes_clear_cell(CellData &r_cell_data) { … }
void TileMapLayer::_scenes_update_cell(CellData &r_cell_data) { … }
#ifdef DEBUG_ENABLED
void TileMapLayer::_scenes_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) { … }
#endif
void TileMapLayer::_build_runtime_update_tile_data(bool p_force_cleanup) { … }
void TileMapLayer::_build_runtime_update_tile_data_for_cell(CellData &r_cell_data, bool p_use_tilemap_for_runtime, bool p_auto_add_to_dirty_list) { … }
void TileMapLayer::_clear_runtime_update_tile_data() { … }
void TileMapLayer::_clear_runtime_update_tile_data_for_cell(CellData &r_cell_data) { … }
TileSet::TerrainsPattern TileMapLayer::_get_best_terrain_pattern_for_constraints(int p_terrain_set, const Vector2i &p_position, const RBSet<TerrainConstraint> &p_constraints, TileSet::TerrainsPattern p_current_pattern) const { … }
RBSet<TerrainConstraint> TileMapLayer::_get_terrain_constraints_from_added_pattern(const Vector2i &p_position, int p_terrain_set, TileSet::TerrainsPattern p_terrains_pattern) const { … }
RBSet<TerrainConstraint> TileMapLayer::_get_terrain_constraints_from_painted_cells_list(const RBSet<Vector2i> &p_painted, int p_terrain_set, bool p_ignore_empty_terrains) const { … }
void TileMapLayer::_tile_set_changed() { … }
void TileMapLayer::_renamed() { … }
void TileMapLayer::_update_notify_local_transform() { … }
void TileMapLayer::_queue_internal_update() { … }
void TileMapLayer::_deferred_internal_update() { … }
void TileMapLayer::_internal_update(bool p_force_cleanup) { … }
void TileMapLayer::_physics_interpolated_changed() { … }
void TileMapLayer::_notification(int p_what) { … }
void TileMapLayer::_bind_methods() { … }
void TileMapLayer::_validate_property(PropertyInfo &p_property) const { … }
void TileMapLayer::_update_self_texture_filter(RS::CanvasItemTextureFilter p_texture_filter) { … }
void TileMapLayer::_update_self_texture_repeat(RS::CanvasItemTextureRepeat p_texture_repeat) { … }
#ifdef TOOLS_ENABLED
bool TileMapLayer::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { … }
#endif
void TileMapLayer::set_as_tile_map_internal_node(int p_index) { … }
Rect2 TileMapLayer::get_rect(bool &r_changed) const { … }
HashMap<Vector2i, TileSet::TerrainsPattern> TileMapLayer::terrain_fill_constraints(const Vector<Vector2i> &p_to_replace, int p_terrain_set, const RBSet<TerrainConstraint> &p_constraints) const { … }
HashMap<Vector2i, TileSet::TerrainsPattern> TileMapLayer::terrain_fill_connect(const Vector<Vector2i> &p_coords_array, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains) const { … }
HashMap<Vector2i, TileSet::TerrainsPattern> TileMapLayer::terrain_fill_path(const Vector<Vector2i> &p_coords_array, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains) const { … }
HashMap<Vector2i, TileSet::TerrainsPattern> TileMapLayer::terrain_fill_pattern(const Vector<Vector2i> &p_coords_array, int p_terrain_set, TileSet::TerrainsPattern p_terrains_pattern, bool p_ignore_empty_terrains) const { … }
TileMapCell TileMapLayer::get_cell(const Vector2i &p_coords) const { … }
void TileMapLayer::draw_tile(RID p_canvas_item, const Vector2 &p_position, const Ref<TileSet> p_tile_set, int p_atlas_source_id, const Vector2i &p_atlas_coords, int p_alternative_tile, int p_frame, Color p_modulation, const TileData *p_tile_data_override, real_t p_normalized_animation_offset) { … }
void TileMapLayer::set_cell(const Vector2i &p_coords, int p_source_id, const Vector2i &p_atlas_coords, int p_alternative_tile) { … }
void TileMapLayer::erase_cell(const Vector2i &p_coords) { … }
void TileMapLayer::fix_invalid_tiles() { … }
void TileMapLayer::clear() { … }
int TileMapLayer::get_cell_source_id(const Vector2i &p_coords) const { … }
Vector2i TileMapLayer::get_cell_atlas_coords(const Vector2i &p_coords) const { … }
int TileMapLayer::get_cell_alternative_tile(const Vector2i &p_coords) const { … }
TileData *TileMapLayer::get_cell_tile_data(const Vector2i &p_coords) const { … }
TypedArray<Vector2i> TileMapLayer::get_used_cells() const { … }
TypedArray<Vector2i> TileMapLayer::get_used_cells_by_id(int p_source_id, const Vector2i &p_atlas_coords, int p_alternative_tile) const { … }
Rect2i TileMapLayer::get_used_rect() const { … }
bool TileMapLayer::is_cell_flipped_h(const Vector2i &p_coords) const { … }
bool TileMapLayer::is_cell_flipped_v(const Vector2i &p_coords) const { … }
bool TileMapLayer::is_cell_transposed(const Vector2i &p_coords) const { … }
Ref<TileMapPattern> TileMapLayer::get_pattern(TypedArray<Vector2i> p_coords_array) { … }
void TileMapLayer::set_pattern(const Vector2i &p_position, const Ref<TileMapPattern> p_pattern) { … }
void TileMapLayer::set_cells_terrain_connect(TypedArray<Vector2i> p_cells, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains) { … }
void TileMapLayer::set_cells_terrain_path(TypedArray<Vector2i> p_path, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains) { … }
bool TileMapLayer::has_body_rid(RID p_physics_body) const { … }
Vector2i TileMapLayer::get_coords_for_body_rid(RID p_physics_body) const { … }
void TileMapLayer::update_internals() { … }
void TileMapLayer::notify_runtime_tile_data_update() { … }
Vector2i TileMapLayer::map_pattern(const Vector2i &p_position_in_tilemap, const Vector2i &p_coords_in_pattern, Ref<TileMapPattern> p_pattern) { … }
TypedArray<Vector2i> TileMapLayer::get_surrounding_cells(const Vector2i &p_coords) { … }
Vector2i TileMapLayer::get_neighbor_cell(const Vector2i &p_coords, TileSet::CellNeighbor p_cell_neighbor) const { … }
Vector2 TileMapLayer::map_to_local(const Vector2i &p_pos) const { … }
Vector2i TileMapLayer::local_to_map(const Vector2 &p_pos) const { … }
void TileMapLayer::set_enabled(bool p_enabled) { … }
bool TileMapLayer::is_enabled() const { … }
void TileMapLayer::set_tile_set(const Ref<TileSet> &p_tile_set) { … }
Ref<TileSet> TileMapLayer::get_tile_set() const { … }
void TileMapLayer::set_highlight_mode(HighlightMode p_highlight_mode) { … }
TileMapLayer::HighlightMode TileMapLayer::get_highlight_mode() const { … }
void TileMapLayer::set_tile_map_data_from_array(const Vector<uint8_t> &p_data) { … }
Vector<uint8_t> TileMapLayer::get_tile_map_data_as_array() const { … }
void TileMapLayer::set_self_modulate(const Color &p_self_modulate) { … }
void TileMapLayer::set_y_sort_enabled(bool p_y_sort_enabled) { … }
void TileMapLayer::set_y_sort_origin(int p_y_sort_origin) { … }
int TileMapLayer::get_y_sort_origin() const { … }
void TileMapLayer::set_x_draw_order_reversed(bool p_x_draw_order_reversed) { … }
bool TileMapLayer::is_x_draw_order_reversed() const { … }
void TileMapLayer::set_z_index(int p_z_index) { … }
void TileMapLayer::set_light_mask(int p_light_mask) { … }
void TileMapLayer::set_rendering_quadrant_size(int p_size) { … }
int TileMapLayer::get_rendering_quadrant_size() const { … }
void TileMapLayer::set_collision_enabled(bool p_enabled) { … }
bool TileMapLayer::is_collision_enabled() const { … }
void TileMapLayer::set_use_kinematic_bodies(bool p_use_kinematic_bodies) { … }
bool TileMapLayer::is_using_kinematic_bodies() const { … }
void TileMapLayer::set_collision_visibility_mode(TileMapLayer::DebugVisibilityMode p_show_collision) { … }
TileMapLayer::DebugVisibilityMode TileMapLayer::get_collision_visibility_mode() const { … }
void TileMapLayer::set_occlusion_enabled(bool p_enabled) { … }
bool TileMapLayer::is_occlusion_enabled() const { … }
void TileMapLayer::set_navigation_enabled(bool p_enabled) { … }
bool TileMapLayer::is_navigation_enabled() const { … }
void TileMapLayer::set_navigation_map(RID p_map) { … }
RID TileMapLayer::get_navigation_map() const { … }
void TileMapLayer::set_navigation_visibility_mode(TileMapLayer::DebugVisibilityMode p_show_navigation) { … }
TileMapLayer::DebugVisibilityMode TileMapLayer::get_navigation_visibility_mode() const { … }
TileMapLayer::TileMapLayer() { … }
TileMapLayer::~TileMapLayer() { … }
HashMap<Vector2i, TileSet::CellNeighbor> TerrainConstraint::get_overlapping_coords_and_peering_bits() const { … }
TerrainConstraint::TerrainConstraint(Ref<TileSet> p_tile_set, const Vector2i &p_position, int p_terrain) { … }
TerrainConstraint::TerrainConstraint(Ref<TileSet> p_tile_set, const Vector2i &p_position, const TileSet::CellNeighbor &p_bit, int p_terrain) { … }