Minor changes to simulate:

- Rename "set key", "reset to key" to "save key" and "load key", respectively.
- Change bindings of F6 and F7 from the not very useful "vertical sync" and "busy wait" to the more useful cycling of frames and labels (as in Domain Explorer).

PiperOrigin-RevId: 438017260
Change-Id: I6d67e99f785f2777e131c591188f554722af7f49
This commit is contained in:
Yuval Tassa
2022-03-29 07:13:32 -07:00
committed by Saran Tunyasuvunakool
parent d627374545
commit e3e98ac2c6
+20 -6
View File
@@ -162,8 +162,8 @@ const mjuiDef defOption[] = {
#else
{mjITEM_CHECKINT, "Fullscreen", 1, &settings.fullscreen, " #294"},
#endif
{mjITEM_CHECKINT, "Vertical Sync", 1, &settings.vsync, " #295"},
{mjITEM_CHECKINT, "Busy Wait", 1, &settings.busywait, " #296"},
{mjITEM_CHECKINT, "Vertical Sync", 1, &settings.vsync, ""},
{mjITEM_CHECKINT, "Busy Wait", 1, &settings.busywait, ""},
{mjITEM_END}
};
@@ -177,8 +177,8 @@ const mjuiDef defSimulation[] = {
{mjITEM_BUTTON, "Align", 2, NULL, "CA"},
{mjITEM_BUTTON, "Copy pose", 2, NULL, "CC"},
{mjITEM_SLIDERINT, "Key", 3, &settings.key, "0 0"},
{mjITEM_BUTTON, "Reset to key", 3},
{mjITEM_BUTTON, "Set key", 3},
{mjITEM_BUTTON, "Load key", 3},
{mjITEM_BUTTON, "Save key", 3},
{mjITEM_SLIDERNUM, "Noise scale", 2, &settings.ctrlnoisestd, "0 2"},
{mjITEM_SLIDERNUM, "Noise rate", 2, &settings.ctrlnoiserate, "0 2"},
{mjITEM_END}
@@ -1404,7 +1404,7 @@ void uiEvent(mjuiState* state) {
break;
case 5: // Adjust key
case 6: // Reset to key
case 6: // Load key
i = settings.key;
d->time = m->key_time[i];
mju_copy(d->qpos, m->key_qpos+i*m->nq, m->nq);
@@ -1418,7 +1418,7 @@ void uiEvent(mjuiState* state) {
updatesettings();
break;
case 7: // Set key
case 7: // Save key
i = settings.key;
m->key_time[i] = d->time;
mju_copy(m->key_qpos+i*m->nq, d->qpos, m->nq);
@@ -1581,6 +1581,20 @@ void uiEvent(mjuiState* state) {
}
break;
case mjKEY_F6: // cycle frame visualisation
if (m) {
vopt.frame = (vopt.frame + 1) % mjNFRAME;
mjui_update(SECT_RENDERING, -1, &ui0, &uistate, &con);
}
break;
case mjKEY_F7: // cycle label visualisation
if (m) {
vopt.label = (vopt.label + 1) % mjNLABEL;
mjui_update(SECT_RENDERING, -1, &ui0, &uistate, &con);
}
break;
case mjKEY_ESCAPE: // free camera
cam.type = mjCAMERA_FREE;
settings.camera = 0;