Skip to content

Commit

Permalink
Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Sep 25, 2024
1 parent e105a0f commit b61b56d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/viser/_scene_handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import copy
import dataclasses
import warnings
from functools import cached_property
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -223,9 +224,11 @@ def visible(self, visible: bool) -> None:

def remove(self) -> None:
"""Remove the node from the scene."""
# No-op if already removed.
# Warn if already removed.
if self._impl.removed:
warnings.warn(f"Attempted to remove already removed node: {self.name}")
return

self._impl.removed = True
self._impl.api._websock_interface.queue_message(
_messages.RemoveSceneNodeMessage(self._impl.name)
Expand Down

0 comments on commit b61b56d

Please sign in to comment.