vuer-ai / vuer

Vuer is a 3D visualization tool for robotics and VR applications.
https://docs.vuer.ai
MIT License
154 stars 4 forks source link

Bug (or misunderstanding of semantics) in VuerSession.remove #24

Open jdubie opened 3 months ago

jdubie commented 3 months ago

To repro - run this code and observe the sphere doesn't get removed

from asyncio import sleep

from vuer import Vuer
from vuer.schemas import Scene, Box, Plane, Sphere

cert_file="./cert.pem"
key_file="./key.pem"
app = Vuer(
    host="0.0.0.0",
    cert=cert_file,
    key=key_file,
    queries=dict(
        grid=False,
        ws='wss://localhost:8012',
    ),
    queue_len=3,
)

@app.spawn(start=True)

async def main(session):
    #session.set @ Scene()
    while True:
        session.upsert @ Sphere(key='s', args=[0.5, 20, 20], position=[0, 1, -2], materialType="depth")
        await sleep(1.0)

        # Removing does nothing
        session.remove @ 's'

        # This works! So my work around is to make things small/move them b/c i can't remove
        #session.upsert @ Sphere(key='s', args=[0.5, 20, 20], position=[0, 1, -3], materialType="depth")
        await sleep(1.0)
geyang commented 3 months ago

I will take a look and get back to you asap.

geyang commented 2 months ago

There is a new syntax that I added in v0.0.32 that allows you to hide components. You can now do:

sess.update @ ComponentName(hide=True, ...)

and it should hide that component.