Detaches this entity if it has previously been attached.
(self)
| 317 | return frame |
| 318 | |
| 319 | def detach(self): |
| 320 | """Detaches this entity if it has previously been attached.""" |
| 321 | if self._parent is not None: |
| 322 | parent = self._parent() # pylint: disable=not-callable |
| 323 | if parent: # Weakref might dereference to None during garbage collection. |
| 324 | self.mjcf_model.detach() |
| 325 | parent._attached.remove(self) # pylint: disable=protected-access |
| 326 | self._parent = None |
| 327 | else: |
| 328 | raise RuntimeError('Cannot detach an entity that is not attached.') |
| 329 | |
| 330 | @property |
| 331 | def parent(self): |