How to animate a scene? #39
-
Is there a simple way to set something like a timer callback that's being called from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @clairexen ! To make fancy things, like animations, events, callbacks, you need to get to the Qt level of things To update the view periodicallyYou can schedule a rendering at any moment using app = QApplication()
# build the scene itself (can be shared through views, also it is GUI agnostic
scene = madcad.rendering.Scene([...objs...], options={...}) # put here what you would usually put in `show()`
# build the view widget
view = madcad.rendering.View(scene)
view.show()
# build the timer to refresh the view
timer = QTimer()
timer.setInterval(100)
timer.timeout.connect(view.update)
timer.start()
# run the event loop
app.exec() To animate things
If you are familiar with openGL, you can also write your own displays and use I hope this helps ! |
Beta Was this translation helpful? Give feedback.
Hello @clairexen !
show()
is not the way to do this. It is just a helper to make a view window on a scene and run Qt if not already started.To make fancy things, like animations, events, callbacks, you need to get to the Qt level of things
Taking a quick look at
show
you can see that a madcad 3d view is a regular Qt widget, so you can build a window out of it, and useQTimer
time update it periodicallyTo update the view periodically
You can schedule a rendering at any moment using
View.update()
(like any QWidget)Depending on what you are looking for, you can trigger it periodically, or when you have changed something in the scene