Migrate mjtByte to mjtBool for boolean-valued fields.

PiperOrigin-RevId: 921408093
Change-Id: Icb00457836359779f0f72fc02d6a7c0dc9f6bd23
This commit is contained in:
Yuval Tassa
2026-05-26 05:35:15 -07:00
committed by Copybara-Service
parent 3cabb2eb8e
commit 393c1e4217
33 changed files with 242 additions and 224 deletions
@@ -103,6 +103,14 @@ void ImGui_DataPtrTable::DataPtr(const char* label, const mjtByte* ptr,
}
}
void ImGui_DataPtrTable::DataPtr(const char* label, const mjtBool* ptr,
int index, int n) {
for (int i = 0; i < n; ++i) {
MakeLabel(label, i, n);
ImGui::Text("%s", ptr[index + i] ? "true" : "false");
}
}
void ImGui_DataPtrTable::DataPtr(const char* label, const mjtSize* ptr,
int index, int n) {
Numeric(label, ptr, index, n);
+2 -1
View File
@@ -174,6 +174,7 @@ class ImGui_DataPtrTable {
// dimensionality of n.
void DataPtr(const char* label, const char* ptr, int index, int n);
void DataPtr(const char* label, const mjtByte* ptr, int index, int n);
void DataPtr(const char* label, const mjtBool* ptr, int index, int n);
void DataPtr(const char* label, const mjtSize* ptr, int index, int n);
void DataPtr(const char* label, const int* ptr, int index, int n);
void DataPtr(const char* label, const float* ptr, int index, int n);
@@ -299,7 +300,7 @@ class ImGui_SpecElementTable : public ImGui_DataPtrTable {
ImGui::PushID(&val);
ImGui::SetNextItemWidth(-1.0f);
if constexpr (std::is_same_v<T, mjtByte>) {
if constexpr (std::is_same_v<T, mjtByte> || std::is_same_v<T, mjtBool>) {
if (read_only_) {
ImGui::Text("%s", val ? "true" : "false");
} else {