-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add model[] formspec element #10320
Add model[] formspec element #10320
Conversation
XD. I have just created the same PR, too. |
Includes minor code style changes.
1) Get rid of static 'rotation_bound' 2) Shorten and tweak the documentation a bit 3) Rename to "model[]" 4) Correct devtest, add license
PS: Ready for re-review. |
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.
This is a good start with current formspec version and clearly sufficient to see how it will be used in mods.
I see a lot of future possibilities. But having a JSON or table formspec parser would be much better to handle multiple needed options:
- x, y and z initial rotation;
- x, y and z rotation speed;
- x, y and z rotation limitations;
- frame or sequence picking (use still character model, or show only the walk...);
- mouse events, drag and drop...
if (vec_rot.size() >= 2) | ||
e->setRotation(v2f(stof(vec_rot[0]), stof(vec_rot[1]))); | ||
|
||
e->enableContinuousRotation(inf_rotation); |
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.
It could be great to be able to control rotation speed around three axes. Anyway, I thinks it's good for now and that could be implemented later with future table or JSON formspec parser.
m_last_time = new_time; | ||
|
||
core::rect<s32> oldViewPort = m_driver->getViewPort(); | ||
m_driver->setViewPort(getAbsoluteClippingRect()); |
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.
This causes some unintended size reduction of the model if element clipped. It could be weird in scrollable containers.
Scene should be drawn in a view port sized as AbsoluteRect
and clipped to getAbsoluteClippingRect()
, a bit like in drawItemStack
.
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.
Could you please update the code according to your plans? I don't know what to do there.
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.
Seems a bit more complicated than I thought. I'm having a look.
Could use properties for this, ie: key-value like used by |
|
Soon it'll be turing complete |
Hmm, is it already commit-finished and therefore ready for merging? |
Please, don't leave and merge it if it is ready for now. I'm so eager to see this feature already in the game engine. |
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.
I'm having a weird issue (on Windows) where, when using the devtest formspec, the game will segfault if both models are present at the same time, but only when this was the first world to be entered after opening the Minetest window. If one model is removed, it works fine, and if the other model is added back in without closing the Minetest window after using the one model, no segfault occurs. It's very strange.
I'm no expert on the model stuff, but it looks OK. If this segfault issue (whatever it is) and pyrollo's model reduction issue are addressed, then 👍.
Cannot reproduce (with my previous PR code).
Offset-ing the mesh when the element is clipped is easy but the camera position is necessarily centered inside the element bounds (thus the model must also be centered to have consistent rotation). I see 2 solutions:
|
Unfortunately, not really an option. The current behaviour would be weird with
With this current PR, I have had the problem on both Windows and Linux. So, it's probably newly introduced. |
Could you please provide a gdb/windbg backtrace? I didn't experience any segfault with this branch. |
Thanks for the review. I updated and retested the PR accordingly. |
OK, it has my approval if @pyrollo's issue can be addressed. If it actually is impossible to fix (that seems unlikely, but I'm no expert), then I'll still approve. |
I'm just going to say that waiting for a solution to the clipping problem really isn't too important. It may look funny in scroll containers for now, but I think the benefits outweigh the problem. So, 👍 |
I check it. Some problems:
|
stop fooling around and fix the animations. Thankz. |
@runsy Please open a new bug report for the transparency issue and a new feature request for the frame range thing. |
Formspec element to display models, written by @kilbith, rebased and tweaked. Co-authored-by: Jean-Patrick Guerrero <[email protected]> Co-authored-by: sfan5 <[email protected]>
Copypasta from #10261 because I see potential in this feature.
To do
This PR is Ready for Review.
How to test
/test_formspec