-
Notifications
You must be signed in to change notification settings - Fork 343
flip camera2D init and from_raw_data #2072
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
from_raw_data cameras won't reference the same data objects but create new ones fix examples and tests
While I understand why it was done the way it was, this fundamentally breaks a core assumption of the Cameras. The CameraData and OrthographicProjectionData objects have to be shared between objects. |
I can rewrite from_raw_data to build a camera with the arguments (c data and p data).
or “from_camera_data” with same arguments as “from_raw_data” but reusing the internal data objects.
rewrite done on fb025ec |
I'm wondering if we might run into some shallow vs deep copy issues with camera1 = Camera(...)
camera2 = Camera.from_camera_data(camera1.view_data, camera1.projection_data) In that case I think adjusting either camera would affect the other, since they both contain references to each other. We should be able to easily test this in a unit test, which I'll make if I get some freetime today. |
I think this is the intended purpose. |
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.
TL;DR: The docstring change to clarify the shared data object behavior is the most we should do in this PR.
@MiCurry the shared behavior is intended, but I agree we need to document it better and think about the CameraAPI a bit more.
However, this PR isn't the place for those changes. We can add a minimal docstring fix since @DragonMoffon and @DigiDuncan are finishing up prototyping improvements which will likely cause merge conflicts with further API changes.
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.
LGTM. A bunch of changes are coming, so we'll fix lingering API & doc issues in subsequent PRs.
This is the camera init/from_raw_data code flip we talk on discord.
Nota that from_raw_data cameras won't reference the same data objects but create new ones using data from the provided objects.
I have also fixed examples and tests.
I tested using the example codes and all worked