simulation: refresh the stepper latch only when a moving body is added or removed
Keeps the stationary add/remove path unchanged (test_surface_actuation builds a Simulation without a stepper). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e682d16c3a
commit
36eac713f4
@@ -172,7 +172,8 @@ class Simulation:
|
|||||||
self.bodies.stage_add(obj)
|
self.bodies.stage_add(obj)
|
||||||
return -1
|
return -1
|
||||||
body_id = self.bodies.add(obj)
|
body_id = self.bodies.add(obj)
|
||||||
self._refresh_stepper_block()
|
if translation is not None:
|
||||||
|
self._refresh_stepper_block()
|
||||||
return body_id
|
return body_id
|
||||||
|
|
||||||
def add_jet(self, jet) -> int:
|
def add_jet(self, jet) -> int:
|
||||||
@@ -273,8 +274,10 @@ class Simulation:
|
|||||||
if self._initialized:
|
if self._initialized:
|
||||||
self.bodies.stage_remove(id)
|
self.bodies.stage_remove(id)
|
||||||
else:
|
else:
|
||||||
|
moving = self.bodies.get(id).motion is not None
|
||||||
self.bodies.remove(id)
|
self.bodies.remove(id)
|
||||||
self._refresh_stepper_block()
|
if moving:
|
||||||
|
self._refresh_stepper_block()
|
||||||
|
|
||||||
# -- Legacy convenience (keep for backward compat) -----------------------
|
# -- Legacy convenience (keep for backward compat) -----------------------
|
||||||
def add_cylinder(self, center: Tuple[float, ...],
|
def add_cylinder(self, center: Tuple[float, ...],
|
||||||
|
|||||||
Reference in New Issue
Block a user