Add update_{hfield,mesh,texture} methods to the passive viewer.

Fixes #812.
Fixes #958.
Fixes #965.

PiperOrigin-RevId: 548181282
Change-Id: I6eb0cd2ce52c66083e83dd08d69e0cfb4178dbba
This commit is contained in:
Saran Tunyasuvunakool
2023-07-14 11:42:55 -07:00
committed by Copybara-Service
parent b5bef1b639
commit 0ccfef7314
6 changed files with 153 additions and 55 deletions
+12
View File
@@ -154,6 +154,18 @@ PYBIND11_MODULE(_simulate, pymodule) {
simulate.uiloadrequest.fetch_sub(1);
},
py::call_guard<py::gil_scoped_release>())
.def(
"update_hfield",
[](SimulateWrapper& simulate, int hfieldid) {
simulate.UpdateHField(hfieldid);
},
py::call_guard<py::gil_scoped_release>())
.def(
"update_texture",
[](SimulateWrapper& simulate, int texid) {
simulate.UpdateTexture(texid);
},
py::call_guard<py::gil_scoped_release>())
.def_property(
"droploadrequest",
+16 -2
View File
@@ -113,8 +113,22 @@ class Handle:
def sync(self):
sim = self._sim()
if sim is not None:
with sim.lock():
sim.sync()
sim.sync() # locks internally
def update_hfield(self, hfieldid: int):
sim = self._sim()
if sim is not None:
sim.update_hfield(hfieldid) # locks internally and blocks until done
def update_mesh(self, meshid: int):
sim = self._sim()
if sim is not None:
sim.update_mesh(meshid) # locks internally and blocks until done
def update_texture(self, texid: int):
sim = self._sim()
if sim is not None:
sim.update_texture(texid) # locks internally and blocks until done
def __enter__(self):
return self