[Python Viewer] Allow users to override rendering flags via user_scn.
Fixes #1190 PiperOrigin-RevId: 603672602 Change-Id: I3ff1bb0dca7e913b36f1b241aaea8b8bb95cadff
This commit is contained in:
committed by
Copybara-Service
parent
92c161a61b
commit
7bb0ce4211
@@ -2091,6 +2091,17 @@ void Simulate::Sync() {
|
||||
}
|
||||
}
|
||||
|
||||
// pick up rendering flags changed via user_scn
|
||||
if (user_scn) {
|
||||
for (int i = 0; i < mjNRNDFLAG; ++i) {
|
||||
if (user_scn->flags[i] != user_scn_flags_prev_[i]) {
|
||||
scn.flags[i] = user_scn->flags[i];
|
||||
}
|
||||
}
|
||||
Copy(user_scn->flags, scn.flags);
|
||||
Copy(user_scn_flags_prev_, user_scn->flags);
|
||||
}
|
||||
|
||||
mjopt_prev_ = scnstate_.model.opt;
|
||||
warn_vgeomfull_prev_ = scnstate_.data.warning[mjWARN_VGEOMFULL].number;
|
||||
}
|
||||
@@ -2270,6 +2281,11 @@ void Simulate::LoadOnRenderThread() {
|
||||
this->scn.flags[mjRND_REFLECTION] = 0;
|
||||
}
|
||||
|
||||
if (this->user_scn) {
|
||||
Copy(this->user_scn->flags, this->scn.flags);
|
||||
Copy(this->user_scn_flags_prev_, this->scn.flags);
|
||||
}
|
||||
|
||||
// clear perturbation state
|
||||
this->pert.active = 0;
|
||||
this->pert.select = 0;
|
||||
|
||||
@@ -130,6 +130,7 @@ class Simulate {
|
||||
mjOption mjopt_prev_;
|
||||
mjvOption opt_prev_;
|
||||
mjvCamera cam_prev_;
|
||||
|
||||
int warn_vgeomfull_prev_;
|
||||
|
||||
// pending GUI-driven actions, to be applied at the next call to Sync
|
||||
@@ -247,6 +248,7 @@ class Simulate {
|
||||
|
||||
// additional user-defined visualization geoms (used in passive mode)
|
||||
mjvScene* user_scn = nullptr;
|
||||
mjtByte user_scn_flags_prev_[mjNRNDFLAG];
|
||||
|
||||
// OpenGL rendering and UI
|
||||
int refresh_rate = 60;
|
||||
|
||||
Reference in New Issue
Block a user