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:
1 parent
e682d16c3a
commit
36eac713f4
1 file changed
+3
@@ -172,6 +172,7 @@ 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)
|
||||||
|
if translation is not None:
|
||||||
self._refresh_stepper_block()
|
self._refresh_stepper_block()
|
||||||
return body_id
|
return body_id
|
||||||
|
|
||||||
@@ -273,7 +274,9 @@ 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)
|
||||||
|
if moving:
|
||||||
self._refresh_stepper_block()
|
self._refresh_stepper_block()
|
||||||
|
|
||||||
# -- Legacy convenience (keep for backward compat) -----------------------
|
# -- Legacy convenience (keep for backward compat) -----------------------
|
||||||
|
|||||||
Reference in new issue
Block a user