Closed tavurth closed 1 year ago
Incorrect reproduction, will update and reopen
I can not replicate this, with code that can run, also where are you getting the values outline
and width
from?
Hmm let me check that, this was a snippet of code which I found to reproduce it.
These variables are not available when following your instructions, so it will not run
The following code:
@tool
extends Polygon2D
func _draw():
var poly = get_polygon()
if not len(poly):
return
for i in range(1, poly.size() - 1):
draw_line(poly[i-1], poly[i], 1, 1)
Crashes my game when using input for the polygon as follows:
func is_holding_array(item) -> bool:
return typeof(item) == TYPE_ARRAY and len(item) == 1
func coordinate_to_vector2(coordinate: Array) -> Vector2:
return Vector2(coordinate[0], coordinate[1])
func coordinates_to_packed_vector2(coords: Array) -> PackedVector2Array:
if is_holding_array(coords):
coords = coords[0]
return coords.map(coordinate_to_vector2)
func _ready():
var poly = preload("Polygon.gd").new()
poly.set_polygon(
coordinates_to_packed_vector2(
[
[
[-790.414, -2106.746],
[-585.631, -1889.194],
[-691.196, -1639.161],
[-696.694, -1497.691],
[-552.177, -1397.827],
[-498.011, -1202.792],
[-514.315, -1049.813],
[-357.318, -912.706],
[-326.068, -793.694],
[-309.054, -680.202],
[-403.158, -572.733],
[-385.159, -492.73],
[-305.721, -439.557],
[-246.699, -360.468],
[-170.929, -338.05],
[-101.088, -256.587],
[-117.475, -183.618],
[-90.856, -141.479],
[4.018, -129.376],
[91.072, -120.111],
[115.555, -151.142],
[123.8, -215.888],
[174.108, -257.399],
[205.418, -313.623],
[269.32, -385.302],
[307.055, -463.138],
[406.056, -534.026],
[350.846, -690.688],
[283.65, -776.969],
[430.092, -917.012],
[568.949, -949.925],
[623.791, -1118.706],
[669.719, -1216.703],
[672.036, -1340.092],
[642.029, -1373.2],
[474.875, -1468.305],
[451.759, -1664.691],
[731.303, -1832.365],
[696.519, -2133.375],
[611.04, -2521.794],
[953.949, -2894.9],
[615.454, -3205.626],
[447.625, -3152.932],
[241.162, -2971.791],
[86.813, -2975.465],
[-423.716, -3159.868],
[-429.239, -2835.354],
[-489.387, -2539.198],
[-718.406, -2381.315],
[-802.642, -2253.309],
],
]
)
)
These variables are not available when following your instructions, so it will not run
As I mentioned, this was a code snippet, not the original full code as to keep the issue clean. Github is sadly not yet perfect.
I reproduced above.
Please make sure your code is valid code though, it doesn't help if it doesn't work right?
Please provide a MRP as your new snippet doesn't give a clear idea of what the code does, what is "geometry", what type is the second part of the code on?
Can you confirm that it is actually the access of get_polygon()
that causes this, because I can not replicate this, it is fully functional.
@AThousandShips you're very quick. I didn't even finish editing yet.
I was responding to the comment you posted, I assumed it was finished, my bad
The above MRP gives me the following error (when run from _ready
)
Please provide an MRP, an MRP is a packaged project (zip) that shows the error.
Your code, as it contains a lot of functionality and details that aren't shown, can't be tested
@AThousandShips while I thank you for checking my codebase, The full source is listed above without missing functionality.
I'm a little busy trying to convert numerous libs to Godot4 right now.
Perhaps you can point out what is missing?
I am sorry I did not notice you updated the code again, it isn't easy to notice...
I can still not replicate any crash, so will leave any further testing to someone else, but I suspect they too will ask you to provide an MRP
To speed up our work, please upload a minimal project that isolates and reproduces the issue. This is always the best way for us to fix it. We recommend attaching a ZIP file with the minimal project directly to the bug report, by drag and dropping the file in the GitHub edition field. This ensures the file can remain available for a long period of time. Only use third-party file hosts if your ZIP file isn't accepted by GitHub because it's too large. We recommend always attaching a minimal reproduction project, even if the issue may seem simple to reproduce manually
@tavurth Please upload a minimal reproduction project to make this easier to troubleshoot.
Unfortunately as I mentioned before I don't get any time to do Godot stuff at the moment, maybe in a month or so
Closing for now. This can be reopened once a minimal reproduction project is uploaded.
Godot version
4.0.stable.official.92bee43ad
System information
Mac
Issue description
Will result in a crash
Steps to reproduce
Please see above
Minimal reproduction project
Please see above