Add validation for projection dimensions in Camera2D + projections#2061
Merged
eruvanos merged 16 commits intopythonarcade:developmentfrom Apr 23, 2024
Merged
Conversation
…ojection bounds are equal
* Add ZeroProjectionDimension type to arcade.camera.data_types * Use it in the projection validation in from_raw_data
* Add new test for Camera2D.from_raw_data projection validation * Expand inheritance safety tests for Camera2D classmethods with parametrization
* Inline the validation logic to go fast * Update the docstring to be explicitly clear about this behavior
* Turn camera_class into a fixture * Add simple inline test for from_raw_data's near/far validation
0277038 to
760ae09
Compare
Member
Author
|
After discussion, consensus from @DragonMoffon and users who've tried 3.0 cameras seems to be:
|
DragonMoffon
approved these changes
Apr 20, 2024
Collaborator
DragonMoffon
left a comment
There was a problem hiding this comment.
Validation looks good, and renaming is good. There are issues, but they are with the code rather than the PR, and I will fix them later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR:
ZeroDivisionErrorwhich @MiCurry discoveredChanges
Camera2D.from_raw_data*Dataattributes for clarity per Discord discussion_data->_camera_data_projection->_projection_datanearandfarvalidation to__init__.projectionWhy?
left == righttop == bottomnear == farCamera2D.usefor the first timeExample traceback sanitized from the Discord thread:
Questions
ShouldIt's aZeroProjectionDimensionsubclassZeroDivisionErrororValueError?ValueErrorsince the math hasn't taken place yet.Follow-up work