summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index 993f606f2f..147bb5f4e9 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -1603,12 +1603,31 @@ void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfor
}
RenderingServer::get_singleton()->canvas_item_add_set_transform(p_canvas_item->get_canvas_item(), p_transform);
+
+ Ref<Texture2D> one_way_icon = get_theme_icon(SNAME("OneWayTile"), SNAME("EditorIcons"));
for (int i = 0; i < tile_data->get_collision_polygons_count(physics_layer); i++) {
Vector<Vector2> polygon = tile_data->get_collision_polygon_points(physics_layer, i);
- if (polygon.size() >= 3) {
- p_canvas_item->draw_polygon(polygon, color);
+ if (polygon.size() < 3) {
+ continue;
+ }
+
+ p_canvas_item->draw_polygon(polygon, color);
+
+ if (tile_data->is_collision_polygon_one_way(physics_layer, i)) {
+ PackedVector2Array uvs;
+ uvs.resize(polygon.size());
+ Vector2 size_1 = Vector2(1, 1) / tile_set->get_tile_size();
+
+ for (int j = 0; j < polygon.size(); j++) {
+ uvs.write[j] = polygon[j] * size_1 + Vector2(0.5, 0.5);
+ }
+
+ Vector<Color> color2;
+ color2.push_back(Color(1, 1, 1, 0.4));
+ p_canvas_item->draw_polygon(polygon, color2, uvs, one_way_icon);
}
}
+
RenderingServer::get_singleton()->canvas_item_add_set_transform(p_canvas_item->get_canvas_item(), Transform2D());
}