Skip to content

Commit f455f92

Browse files
committed
Eliminated libchanges (Imgui), cleaned code in PanelInspector
1 parent 9a8992d commit f455f92

File tree

4 files changed

+179
-151
lines changed

4 files changed

+179
-151
lines changed

CENTRAL 3D/Source/Imgui/imgui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ namespace ImGui
417417
IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
418418
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
419419
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
420-
IMGUI_API bool Checkbox(const char* label, bool* v, bool show_label = true); // --- LIBCHANGE ---
420+
IMGUI_API bool Checkbox(const char* label, bool* v);
421421
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
422422
IMGUI_API bool RadioButton(const char* label, bool active); // use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; }
423423
IMGUI_API bool RadioButton(const char* label, int* v, int v_button); // shortcut to handle the above pattern when value is an integer

CENTRAL 3D/Source/Imgui/imgui_widgets.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
978978
return pressed;
979979
}
980980

981-
bool ImGui::Checkbox(const char* label, bool* v, bool show_label)
981+
bool ImGui::Checkbox(const char* label, bool* v)
982982
{
983983
ImGuiWindow* window = GetCurrentWindow();
984984
if (window->SkipItems)
@@ -987,14 +987,7 @@ bool ImGui::Checkbox(const char* label, bool* v, bool show_label)
987987
ImGuiContext& g = *GImGui;
988988
const ImGuiStyle& style = g.Style;
989989
const ImGuiID id = window->GetID(label);
990-
991-
ImVec2 label_size; // LIBCHANGE : made this non const
992-
993-
if(show_label)
994-
label_size = CalcTextSize(label, NULL, true);
995-
else
996-
label_size = CalcTextSize("", NULL, true);
997-
990+
const ImVec2 label_size = CalcTextSize(label, NULL, true);
998991

999992
const float square_sz = GetFrameHeight();
1000993
const ImVec2 pos = window->DC.CursorPos;
@@ -1030,7 +1023,7 @@ bool ImGui::Checkbox(const char* label, bool* v, bool show_label)
10301023

10311024
if (g.LogEnabled)
10321025
LogRenderedText(&total_bb.Min, *v ? "[x]" : "[ ]");
1033-
if (label_size.x > 0.0f && show_label)
1026+
if (label_size.x > 0.0f)
10341027
RenderText(ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y), label);
10351028

10361029
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
@@ -2134,9 +2127,8 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* v, floa
21342127
const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, v, format);
21352128
RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));
21362129

2137-
// --- LIBCHANGE: Commented this to prevent imgui from displaying drag widget's labels
2138-
/* if (label_size.x > 0.0f)
2139-
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);*/
2130+
if (label_size.x > 0.0f)
2131+
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
21402132

21412133
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags);
21422134
return value_changed;

0 commit comments

Comments
 (0)