Skip to content

view_update might be throttling? #52

@banesullivan-kobold

Description

@banesullivan-kobold

I'm experiencing an issue where calling view_update() for VtkRemoteView does not always work. It seems like the call might be throttled?

It results in a clunky user interface in this slicing example. After moving the plane widget in the scene on the left, the scene on the right should immediately update. However it does not always update, sometimes requireing a user-click in either of the two views for the one on the right to update

import pyvista as pv
from trame.app import get_server
from trame.ui.vuetify3 import SinglePageLayout
from trame.widgets import vtk as vtk_widgets
from trame.widgets import vuetify3 as vuetify

pv.OFF_SCREEN = True

server = get_server()
state, ctrl = server.state, server.controller

state.trame__title = "Multi Plotters"


mesh = pv.Wavelet()

pl1 = pv.Plotter()
pl1.add_mesh(mesh.contour())
pl1.reset_camera()

pl2 = pv.Plotter()
pl2.add_mesh(mesh.outline(), color='black')
pl2.reset_camera()

def my_callback(normal, origin):
    pl2.add_mesh(mesh.slice(normal, origin), name="slice")
    ctrl.view2_update()  # <-- is this being throttled?

pl1.add_plane_widget(my_callback)


with SinglePageLayout(server) as layout:
    layout.title.set_text("Multi Views")
    layout.icon.click = ctrl.view_reset_camera

    with layout.content:
        with vuetify.VContainer(
            fluid=True,
            classes="pa-0 fill-height",
        ):
            with vuetify.VCol(classes="pa-0 fill-height"):
                view = vtk_widgets.VtkRemoteView(pl1.render_window, ref="view1")
                ctrl.view1_update = view.update
            with vuetify.VCol(classes="pa-0 fill-height"):
                view = vtk_widgets.VtkRemoteView(pl2.render_window, ref="view2")
                ctrl.view2_update = view.update

server.start()
view-update.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions