-
-
Notifications
You must be signed in to change notification settings - Fork 60
Refactor pygfx using pylinalg #482
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
|
Awesome! I will provide more feedback later. This one bit just caught my eye:
@almarklein does this matter for the reactivity abstraction? |
Yes. I agree that props in Python are a bit verbose, but we use them, so the props get properly documented, and so we can apply checks in the setters. And the ones where the value is stored on |
I just saw the |
|
You may want to hold off on refactoring the cameras and controllers until #457 is merged |
use the same caching code for all properties and pull the caching into the base class. This avoids duplicate code and makes the result more readable.
Co-authored-by: Korijn van Golen <korijn@gmail.com>
That sounds reasonable. IIUC that way to show the Gizmo is also more correct, right? I mean, since the translations and rotations appear relative to the camera view-direction, independent of where the object is on the screen?
Good idea. We have validation examples using
That's always a good idea for PR's 😄 In your defense, this changes touched a lot of code. E.g. in hindsight it might have been better to update the Gizmo in a later PR, but that'd have left |
I wouldn't say that it is more or less correct. The 2D gizmo has utility when you want to transform objects in 2D (on some plane with constant offset from the camera). The 3D gizmo (how it is now) has utility if you want to transform a 3D object relative to the camera's position. |
@almarklein Could you try this again with the latest version of this PR? I can't seem to reproduce this or don't see what is weird/wrong. Code_L6vFFYa5Ud.mp4Code_st0ABm8ubQ.mp4 |
|
Alright. I addressed all the comments made in #482 (comment) except for the controller failures that @almarklein reported, because I can't reproduce them. I also dealt with all the open conversations. Now there should be only two things left:
|
|
The Gizmo is looking good!
My bad, I had not updated pylinalg 😊 But we have a thing for that! Could you update the |
48567b0 to
81b1feb
Compare
|
@almarklein sure. Done. I will look into the optimization notes next and then we should be LGTM. |
|
@FirefoxMetzger that was an amazing display of grit. Great work, it's very much appreciated. If anyone still complains pygfx is not pythonic enough after this, I will throw in the towel :) Can you put the optimization options in a new issue? |
Closes #40
Closes #54
Closes pygfx/pylinalg#6
Closes pygfx/pylinalg#21
Closes pygfx/pylinalg#44
This PR updates pygfx to use pylinalg. It does so by introducing a
AffineTransformclass inpygfx.utils.transformwhich stores all the transform-related operations.It also does some quite substantial refactor of
pygfx.WorldObject. It cleans up the caching of the world matrix (will be reintroduced later in this PR), and it also removes a lot of the getters and setters which (as far as I could tell) are just simple one-line wraps around calling the private version of the attribute. This adds a lot of boilerplate that I think we don't need.Before merging, we will have to release a new version of pylinalg and then require it, because there are a lot of new features that this PR depends on.
Also, this is still a draft and a lot of work still has to be done. Putting it here to start tracking progress.