-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting object.polygon in script makes all points (0,0) #3845
Comments
The Polygon array needs to be an array of Points. The documentation for MapObject.polygon is a little misleading, it makes it sound like any object with x and y properties will do, but it has to be specifically a point. |
Qt.point does work, but I remember JS object points working in previous Tiled versions. (Don't have time to find which version ATM.) Thanks |
I think it was the change from Qt5 to Qt6 that made typing more strict, not a change to Tiled directly. |
While Qt 6 has become more strict for functions called from JS, this is likely also the result of change 4a0f569 made for Tiled 1.10.2, where I changed the However, I wasn't aware this would then only work for objects created using I'd stick with the more strictly typed one if it resulted in proper type errors, but as it stands there is apparently a silent failure to do what would be expected, which is worse. |
I agree with this on the principle of least surprise, since JavaScript isn't normally expected to be strict on types. |
Describe the bug
When a script assigns a new polygon to a MapObject, all the polygon points will end up as (0,0).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The polygon is unchanged and two identical point arrays are output to console.
Actual behavior
The polygon collapses as all its points are zeroed. This is confirmed by console output, in which the second array has the same number of points but they are all QPointF(0,0).
Specifications:
The text was updated successfully, but these errors were encountered: