Skip to content

Conversation

MayberryZoom
Copy link
Contributor

No description provided.

icon.sDisabledIconId = sDisabledIconId
icon.sInspectorLabel = sInspectorLabel
icon.vAnchorOffset = list(vAnchorOffset)
icon.vAnchorOffset = Vec2(*vAnchorOffset)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably just make this take a Vec2 as the argument

return None
return ValueError(f"Invalid CVector{length}D: {__value}")

return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should keep this length check, since isinstance(Vec4(0.0, 0.0, 0.0, 0.0), Vec2) is true. the float check isn't strictly necessary but doesn't hurt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want that to explicitly fail? Shouldn't you be using type(Vec4(0.0, 0.0, 0.0, 0.0)) is Vec2 if you want to exclude subclasses?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could you use that instead of this length check if you prefer. still needs to be a special case tho

("base::math::CVector2D", ["foo", "bar"], TypeError("Expected Vec2; got list")),
("base::math::CVector2D", [0.0], TypeError("Expected Vec2; got list")),
("base::math::CVector3D", [0.0], TypeError("Expected Vec3; got list")),
("base::math::CVector4D", [0.0], TypeError("Expected Vec4; got list")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise, add test cases where you pass a Vec3 and a Vec4 to a Vec2 field and ensure they error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants