-
Notifications
You must be signed in to change notification settings - Fork 17
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
Allow previewing non-drawable scene objects with drawable children #76
Conversation
a526e74
to
577cf95
Compare
Please rebase to get the CI fixes from #77 |
f718963
to
936dd0d
Compare
There are still some problems here with certain objects not being positioned/scaled correctly. For example, if you preview the spyroom scene node, the telescope and book appear far off from the rest of the geometry. I'm not sure what exactly causes this and how it could be handled better - I don't fully understand all the ways that Plasma stores object positions and geometry... |
For static objects, the matrix is usually baked into the geometry data, but for dynamic objects (anything animated or kickable and including clickables, probably) the matrix is stored in the CoordinateInterface (and then they can get complicated the chains of children inheriting parent matrices). |
The "Preview" context menu item for scene objects was only enabled if the scene object had a draw interface directly attached. This PR implements previewing scene objects where there's no draw interface on the object itself, but some of the children do have draw interfaces.
Here's how this looks for Ahnonay for example:
I don't know the PlasmaShop codebase very well, but I didn't have to do much to get this working.
QPlasmaRender
already supported rendering multiple objects at once, so it was just a matter of recursively going through the parent object's children and adding every scene object to the renderer.This doesn't work perfectly yet though. The code that sets the initial camera perspective only looks at the parent scene object and not the children, which isn't much help if the parent isn't drawable. At best, the camera starts zoomed too far in, and at worst, it lands in the middle of nowhere, far from the actual objects. Not sure how to fix this - the vector/matrix math in
QPlasmaRender::center
goes a bit over my head.