-
Notifications
You must be signed in to change notification settings - Fork 53
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
RayClicks integration #106
Conversation
Notes from chat:
@dataclasses.dataclass
class ScenePointerEvent:
client_id: int
type: Literal["click"] # Later we can add `double_click`, `move`, `down`, `up`, etc
ray_origin: Tuple[float, float, float]
ray_direction: Tuple[float, float, float] We can also rename the existing
add_sphere_button = server.add_gui_button("Add sphere")
@add_sphere_button.on_click
def _(_) -> None:
@viser_server.on_scene_click # Or whatever this is called
def add_sphere(event: viser.ScenePointerEvent) -> None:
add_the_sphere(event)
viser_server.remove_scene_click_cb(add_sphere) Separate PRs:
|
Moved everything to a separate file Also, with regards to the prior notes:
Both should be there now.
I experimented a bit with the example test file, and it seems that both the scene node clicks and the scene pointer events are registered. :)
This should be implemented now with
... still thinking about it, I think it's worth trying the approach in the code snippit in the previous convo. Will try soon! |
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.
let's gooo
* initial rayclick imp * Example code bug * Move scene pointer logic to diff file, add pointer on/off logic * Updated names + example * Remove pointer listener if removed all callbacks * Formatting changes * Tweaks * Docs + backwards compatibility * Update cursor for scene clicks * Add events.md --------- Co-authored-by: Brent Yi <[email protected]>
Similar to "ClickMessage"s supported in the previous Nerfstudio viewer, where a doubleclick sends a ray to the client.
The ray is specified in world coordinates, where:
I named it "RayClicking" here, to disambiguate it with the "Clicks" on the SceneNodeHandles.