Batch operations with 3D scene. #3009
kovalp
started this conversation in
Ideas / Feature Requests
Replies: 1 comment 3 replies
-
Thanks for this feature request, @kovalp! I managed to reproduce the behavior you're describing with the following code: with ui.scene() as scene:
scene.move_camera(y=-6, z=7)
for x in range(100):
for y in range(100):
scene.box().scale(0.09).move(x / 10 - 5, y / 10 - 5) A solution might be to send multiple messages at once in https://github.com/zauberzeug/nicegui/blob/main/nicegui/outbox.py like we do for updates. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, the 3D scene is updated whenever any primitive is changed (moved, rotated, colored). This is very convenient and intuitive. However, the immediate updates cause a relatively slow data transfer Python-JavaScript. For example, once a 3D scene of a few thousands of boxes is initialized it becomes interactive (mouse) with no visible lags. However, the initialization is visibly slow. During the initialization the user might see a box appearing at the origin and then moved to its destination place with the right color/opacity.
It would be nice to introduce a batch update of the scene, when the programmer could construct the primitives without any Python-JavaScript communication. Once all the primitives constructed/updated, the communication with the browser should be done in a single message and explicitly.
An idea could be to buffer the information about changes while calling the methods on primitives, e.g.
box.move(...)
orbox.material(...)
. Once the scene is defined, a methodscene.apply()
would communicate the changes in a one shot.Related issue: #2989
Beta Was this translation helpful? Give feedback.
All reactions