-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
Refactor the math module #294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one change
Thanks for the PR and fixes. I'm also rewriting and pruning these classes for the next minor patch, For the version 2 update I plan to include numpy....and for that the math classes are going to get another rewrite, But that's still some time off, |
No problem at all! The simple work didn’t take long, happy to help. Good luck with the UnityPy 2 updates! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot 👍
Summary
This PR has undergone comprehensive optimizations and fixes for the math module.
Breaking Changes
Vector2
andVector4
. (According toVector3
.)Half.py
since the only functionToHalf
in this file is not used any more. (ToHalf
was used in theTexture2DConvertor
in the earlier version of UnityPy, but this usage has been removed in later versions.)Common Changes
@dataclass
decorator for all classes. (Before this PR, onlyVector3
had this decorator.)__truediv__
(Python 3) to replace__div__
(Python2).__eq__
method declarations.Individual Optimizations
Vector3
: UseMethod = method
to redirect duplicated method.Vector3
: Use a better__eq__
method (which is also Unity's implementation).Quaternion
: Remove the redundantself._data
field.Color
: Use a better__eq__
method.Individual Fixes
Vector3
: Incorrect if-statement in__init__
method.Vector3
: Incorrect else-body innormalize
method.Vector3
: IncorrectLengthSquare
method.Quaternion
: Thew
value of the identity quaternion (default quaternion) is1.0
, not0.0
.Matrix4x4
: Corrupted__eq__
method.