-
-
Notifications
You must be signed in to change notification settings - Fork 168
Refactor the math module #294
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
Conversation
K0lb3
left a comment
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! |
K0lb3
left a comment
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
Vector2andVector4. (According toVector3.)Half.pysince the only functionToHalfin this file is not used any more. (ToHalfwas used in theTexture2DConvertorin the earlier version of UnityPy, but this usage has been removed in later versions.)Common Changes
@dataclassdecorator for all classes. (Before this PR, onlyVector3had this decorator.)__truediv__(Python 3) to replace__div__(Python2).__eq__method declarations.Individual Optimizations
Vector3: UseMethod = methodto redirect duplicated method.Vector3: Use a better__eq__method (which is also Unity's implementation).Quaternion: Remove the redundantself._datafield.Color: Use a better__eq__method.Individual Fixes
Vector3: Incorrect if-statement in__init__method.Vector3: Incorrect else-body innormalizemethod.Vector3: IncorrectLengthSquaremethod.Quaternion: Thewvalue of the identity quaternion (default quaternion) is1.0, not0.0.Matrix4x4: Corrupted__eq__method.