Use `Vector2i` when returning atlas size in `Geometry2D::make_atlas`

This commit is contained in:
Marc Gilleron 2022-09-19 11:37:02 +01:00
parent 908795301b
commit 700bb066e0
2 changed files with 2 additions and 3 deletions

View File

@ -810,14 +810,13 @@ Dictionary Geometry2D::make_atlas(const Vector<Size2> &p_rects) {
::Geometry2D::make_atlas(rects, result, size); ::Geometry2D::make_atlas(rects, result, size);
Size2 r_size = size;
Vector<Point2> r_result; Vector<Point2> r_result;
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
r_result.push_back(result[i]); r_result.push_back(result[i]);
} }
ret["points"] = r_result; ret["points"] = r_result;
ret["size"] = r_size; ret["size"] = size;
return ret; return ret;
} }

View File

@ -126,7 +126,7 @@
<return type="Dictionary" /> <return type="Dictionary" />
<param index="0" name="sizes" type="PackedVector2Array" /> <param index="0" name="sizes" type="PackedVector2Array" />
<description> <description>
Given an array of [Vector2]s representing tiles, builds an atlas. The returned dictionary has two keys: [code]points[/code] is an array of [Vector2] that specifies the positions of each tile, [code]size[/code] contains the overall size of the whole atlas as [Vector2]. Given an array of [Vector2]s representing tiles, builds an atlas. The returned dictionary has two keys: [code]points[/code] is a [PackedVector2Array] that specifies the positions of each tile, [code]size[/code] contains the overall size of the whole atlas as [Vector2i].
</description> </description>
</method> </method>
<method name="merge_polygons"> <method name="merge_polygons">