Add ImGui context sharing for UI rendering in Python MuJoCo Studio
PiperOrigin-RevId: 930507935 Change-Id: I7615931f9a71793b049e8b6b442be6a2d726f0b2
This commit is contained in:
committed by
Copybara-Service
parent
684eccc146
commit
41ac783d3a
@@ -22,6 +22,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <fstream>
|
||||
#include <imgui.h>
|
||||
#include <implot.h>
|
||||
#include <mujoco/mujoco.h>
|
||||
#include <mujoco/experimental/platform/hal/graphics_mode.h>
|
||||
@@ -180,6 +181,10 @@ class Viewer {
|
||||
window_->Present(pixels_);
|
||||
}
|
||||
|
||||
intptr_t GetImGuiContext() {
|
||||
return reinterpret_cast<intptr_t>(ImGui::GetCurrentContext());
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<mujoco::platform::Window> window_;
|
||||
std::unique_ptr<mujoco::platform::Renderer> renderer_;
|
||||
@@ -195,7 +200,8 @@ PYBIND11_MODULE(native_viewer_cc, m) {
|
||||
.def("Present", &Viewer::Present)
|
||||
.def("UploadImage", &Viewer::UploadImage)
|
||||
.def("RenderToTexture", &Viewer::RenderToTexture)
|
||||
.def("GetDropFile", &Viewer::GetDropFile);
|
||||
.def("GetDropFile", &Viewer::GetDropFile)
|
||||
.def("GetImGuiContext", &Viewer::GetImGuiContext);
|
||||
m.def("IsCrd", &IsCrd);
|
||||
m.def("IsCuda", &IsCuda);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user