studio: share ImGui and ImPlot contexts across python child extension modules.
Each pybind extension module holds its own copy of the ImGui/ImPlot globals (extension modules are loaded RTLD_LOCAL), so the viewer that owns the contexts must share the pointers explicitly. Without this, client plotting GUIs and user plotting scripts (e.g. the implot sample) crash on null context pointers. PiperOrigin-RevId: 951917287 Change-Id: I639a173c2ae9f1af4feaf57aff7b5c81854b7393
This commit is contained in:
committed by
Copybara-Service
parent
91bb075108
commit
e0224c6440
@@ -55,10 +55,11 @@ class Renderer {
|
||||
std::vector<std::byte> pixels(width * height * 3);
|
||||
{
|
||||
py::gil_scoped_release no_gil;
|
||||
impl_->Render(
|
||||
model.get(), data.get(), perturb ? perturb.value().get() : nullptr,
|
||||
camera ? camera.value().get() : nullptr,
|
||||
vis_option ? vis_option.value().get() : nullptr, width, height, pixels);
|
||||
impl_->Render(model.get(), data.get(),
|
||||
perturb ? perturb.value().get() : nullptr,
|
||||
camera ? camera.value().get() : nullptr,
|
||||
vis_option ? vis_option.value().get() : nullptr, width,
|
||||
height, pixels);
|
||||
}
|
||||
return pybind11::bytes((const char*)pixels.data(), pixels.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user