mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-06 15:48:48 +00:00
CogWindow: Add an option to have no padding on windows (used by CogAbilityWindow_Abilities, Effects, Tags, ...)
This commit is contained in:
@@ -13,6 +13,7 @@ void FCogEngineWindow_Plots::Initialize()
|
|||||||
Super::Initialize();
|
Super::Initialize();
|
||||||
|
|
||||||
bHasMenu = true;
|
bHasMenu = true;
|
||||||
|
bNoPadding = true;
|
||||||
|
|
||||||
Config = GetConfig<UCogEngineConfig_Plots>();
|
Config = GetConfig<UCogEngineConfig_Plots>();
|
||||||
}
|
}
|
||||||
@@ -48,8 +49,13 @@ void FCogEngineWindow_Plots::RenderContent()
|
|||||||
|
|
||||||
RenderMenu();
|
RenderMenu();
|
||||||
|
|
||||||
if (ImGui::BeginTable("PlotTable", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_Resizable))
|
if (ImGui::BeginTable("PlotTable", 2, ImGuiTableFlags_RowBg
|
||||||
|
| ImGuiTableFlags_Resizable
|
||||||
|
| ImGuiTableFlags_BordersV
|
||||||
|
| ImGuiTableFlags_NoPadInnerX
|
||||||
|
| ImGuiTableFlags_NoPadOuterX))
|
||||||
{
|
{
|
||||||
|
|
||||||
ImGui::TableSetupColumn("PlotsList", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::GetFontWidth() * 20.0f);
|
ImGui::TableSetupColumn("PlotsList", ImGuiTableColumnFlags_WidthFixed, FCogWindowWidgets::GetFontWidth() * 20.0f);
|
||||||
ImGui::TableSetupColumn("Plots", ImGuiTableColumnFlags_WidthStretch, 0.0f);
|
ImGui::TableSetupColumn("Plots", ImGuiTableColumnFlags_WidthStretch, 0.0f);
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
@@ -110,6 +116,57 @@ void FCogEngineWindow_Plots::RenderMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void FCogEngineWindow_Plots::RenderPlotsList(TArray<FCogDebugPlotEntry*>& VisiblePlots)
|
||||||
|
{
|
||||||
|
if (ImGui::BeginChild("Plots", ImVec2(0, -1)))
|
||||||
|
{
|
||||||
|
int Index = 0;
|
||||||
|
|
||||||
|
ImGui::Indent(6);
|
||||||
|
|
||||||
|
for (FCogDebugPlotEntry& Entry : FCogDebugPlot::Plots)
|
||||||
|
{
|
||||||
|
if (Entry.CurrentYAxis != ImAxis_COUNT && Entry.CurrentRow != INDEX_NONE)
|
||||||
|
{
|
||||||
|
VisiblePlots.Add(&Entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::PushID(Index);
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, Entry.IsEventPlot ? IM_COL32(128, 128, 255, 255) : IM_COL32(255, 255, 255, 255));
|
||||||
|
ImGui::Selectable(TCHAR_TO_ANSI(*Entry.Name.ToString()), false, 0);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
|
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None))
|
||||||
|
{
|
||||||
|
const auto EntryName = StringCast<ANSICHAR>(*Entry.Name.ToString());
|
||||||
|
ImGui::SetDragDropPayload("DragAndDrop", EntryName.Get(), EntryName.Length() + 1);
|
||||||
|
ImGui::Text(EntryName.Get());
|
||||||
|
ImGui::EndDragDropSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
|
Index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Unindent();
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
if (ImGui::BeginDragDropTarget())
|
||||||
|
{
|
||||||
|
if (const ImGuiPayload* Payload = ImGui::AcceptDragDropPayload("DragAndDrop"))
|
||||||
|
{
|
||||||
|
if (FCogDebugPlotEntry* Plot = FCogDebugPlot::FindPlot(FName((const char*)Payload->Data)))
|
||||||
|
{
|
||||||
|
Plot->ResetAxis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndDragDropTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots)
|
void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots)
|
||||||
{
|
{
|
||||||
@@ -295,54 +352,6 @@ void FCogEngineWindow_Plots::RenderPlots(const TArray<FCogDebugPlotEntry*>& Visi
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void FCogEngineWindow_Plots::RenderPlotsList(TArray<FCogDebugPlotEntry*>& VisiblePlots)
|
|
||||||
{
|
|
||||||
if (ImGui::BeginChild("Plots", ImVec2(0, -1)))
|
|
||||||
{
|
|
||||||
int Index = 0;
|
|
||||||
|
|
||||||
for (FCogDebugPlotEntry& Plot : FCogDebugPlot::Plots)
|
|
||||||
{
|
|
||||||
const auto Label = StringCast<ANSICHAR>(*Plot.Name.ToString());
|
|
||||||
|
|
||||||
if (Plot.CurrentYAxis != ImAxis_COUNT && Plot.CurrentRow != INDEX_NONE)
|
|
||||||
{
|
|
||||||
VisiblePlots.Add(&Plot);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::PushID(Index);
|
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, Plot.IsEventPlot ? IM_COL32(128, 128, 255, 255) : IM_COL32(255, 255, 255, 255));
|
|
||||||
ImGui::Selectable(Label.Get(), false, 0);
|
|
||||||
ImGui::PopStyleColor();
|
|
||||||
|
|
||||||
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None))
|
|
||||||
{
|
|
||||||
ImGui::SetDragDropPayload("DragAndDrop", Label.Get(), Label.Length() + 1);
|
|
||||||
ImGui::TextUnformatted(Label.Get());
|
|
||||||
ImGui::EndDragDropSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::PopID();
|
|
||||||
Index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndChild();
|
|
||||||
|
|
||||||
if (ImGui::BeginDragDropTarget())
|
|
||||||
{
|
|
||||||
if (const ImGuiPayload* Payload = ImGui::AcceptDragDropPayload("DragAndDrop"))
|
|
||||||
{
|
|
||||||
if (FCogDebugPlotEntry* Plot = FCogDebugPlot::FindPlot(FName((const char*)Payload->Data)))
|
|
||||||
{
|
|
||||||
Plot->ResetAxis();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndDragDropTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogEngineWindow_Plots::RenderTimeMarker()
|
void FCogEngineWindow_Plots::RenderTimeMarker()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ protected:
|
|||||||
virtual void RenderTick(float DeltaTime) override;
|
virtual void RenderTick(float DeltaTime) override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
void RenderPlotsList(TArray<FCogDebugPlotEntry*>& VisiblePlots);
|
void RenderPlotsList(TArray<FCogDebugPlotEntry*>& VisiblePlots);
|
||||||
|
|
||||||
void RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots);
|
void RenderPlots(const TArray<FCogDebugPlotEntry*>& VisiblePlots);
|
||||||
|
|||||||
@@ -63,8 +63,18 @@ void FCogWindow::Render(float DeltaTime)
|
|||||||
WindowFlags |= ImGuiWindowFlags_MenuBar;
|
WindowFlags |= ImGuiWindowFlags_MenuBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bNoPadding)
|
||||||
|
{
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::Begin(TCHAR_TO_ANSI(*WindowTitle), &bIsVisible, WindowFlags))
|
if (ImGui::Begin(TCHAR_TO_ANSI(*WindowTitle), &bIsVisible, WindowFlags))
|
||||||
{
|
{
|
||||||
|
if (bNoPadding)
|
||||||
|
{
|
||||||
|
ImGui::PopStyleVar(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetOwner()->GetShowHelp())
|
if (GetOwner()->GetShowHelp())
|
||||||
{
|
{
|
||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
@@ -102,6 +112,13 @@ void FCogWindow::Render(float DeltaTime)
|
|||||||
RenderContent();
|
RenderContent();
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bNoPadding)
|
||||||
|
{
|
||||||
|
ImGui::PopStyleVar(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PostRender();
|
PostRender();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ void UCogWindowManager::RenderMainMenu()
|
|||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
FCogWindowWidgets::HelpMarker("Drag and drop the widget name to reorder them.");
|
FCogWindowWidgets::HelpMarker("Drag and drop the widget names to reorder them.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ protected:
|
|||||||
|
|
||||||
bool bHideMenu = false;
|
bool bHideMenu = false;
|
||||||
|
|
||||||
|
bool bNoPadding = false;
|
||||||
|
|
||||||
bool bHasMenu = false;
|
bool bHasMenu = false;
|
||||||
|
|
||||||
bool bIsVisible = false;
|
bool bIsVisible = false;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ void FCogAIWindow_Blackboard::Initialize()
|
|||||||
Super::Initialize();
|
Super::Initialize();
|
||||||
|
|
||||||
bHasMenu = true;
|
bHasMenu = true;
|
||||||
|
bNoPadding = true;
|
||||||
|
|
||||||
Config = GetConfig<UCogAIConfig_Blackboard>();
|
Config = GetConfig<UCogAIConfig_Blackboard>();
|
||||||
}
|
}
|
||||||
@@ -119,7 +120,6 @@ void FCogAIWindow_Blackboard::RenderContent()
|
|||||||
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
||||||
| ImGuiTableFlags_ScrollY
|
| ImGuiTableFlags_ScrollY
|
||||||
| ImGuiTableFlags_RowBg
|
| ImGuiTableFlags_RowBg
|
||||||
| ImGuiTableFlags_BordersOuter
|
|
||||||
| ImGuiTableFlags_BordersV
|
| ImGuiTableFlags_BordersV
|
||||||
| ImGuiTableFlags_Reorderable
|
| ImGuiTableFlags_Reorderable
|
||||||
| ImGuiTableFlags_Hideable))
|
| ImGuiTableFlags_Hideable))
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ void FCogAbilityWindow_Abilities::Initialize()
|
|||||||
Super::Initialize();
|
Super::Initialize();
|
||||||
|
|
||||||
bHasMenu = true;
|
bHasMenu = true;
|
||||||
|
bNoPadding = true;
|
||||||
|
|
||||||
Asset = GetAsset<UCogAbilityDataAsset>();
|
Asset = GetAsset<UCogAbilityDataAsset>();
|
||||||
Config = GetConfig<UCogAbilityConfig_Abilities>();
|
Config = GetConfig<UCogAbilityConfig_Abilities>();
|
||||||
@@ -233,7 +234,6 @@ void FCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent&
|
|||||||
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
||||||
| ImGuiTableFlags_ScrollY
|
| ImGuiTableFlags_ScrollY
|
||||||
| ImGuiTableFlags_RowBg
|
| ImGuiTableFlags_RowBg
|
||||||
| ImGuiTableFlags_BordersOuter
|
|
||||||
| ImGuiTableFlags_BordersV
|
| ImGuiTableFlags_BordersV
|
||||||
| ImGuiTableFlags_Reorderable
|
| ImGuiTableFlags_Reorderable
|
||||||
| ImGuiTableFlags_Hideable))
|
| ImGuiTableFlags_Hideable))
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ void FCogAbilityWindow_Attributes::Initialize()
|
|||||||
Super::Initialize();
|
Super::Initialize();
|
||||||
|
|
||||||
bHasMenu = true;
|
bHasMenu = true;
|
||||||
|
bNoPadding = true;
|
||||||
|
|
||||||
Config = GetConfig<UCogAbilityConfig_Attributes>();
|
Config = GetConfig<UCogAbilityConfig_Attributes>();
|
||||||
AlignmentConfig = GetConfig<UCogAbilityConfig_Alignment>();
|
AlignmentConfig = GetConfig<UCogAbilityConfig_Alignment>();
|
||||||
@@ -87,7 +88,6 @@ void FCogAbilityWindow_Attributes::RenderContent()
|
|||||||
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
||||||
| ImGuiTableFlags_ScrollY
|
| ImGuiTableFlags_ScrollY
|
||||||
| ImGuiTableFlags_RowBg
|
| ImGuiTableFlags_RowBg
|
||||||
| ImGuiTableFlags_BordersOuter
|
|
||||||
| ImGuiTableFlags_BordersV
|
| ImGuiTableFlags_BordersV
|
||||||
| ImGuiTableFlags_Reorderable
|
| ImGuiTableFlags_Reorderable
|
||||||
| ImGuiTableFlags_Hideable))
|
| ImGuiTableFlags_Hideable))
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ void FCogAbilityWindow_Effects::Initialize()
|
|||||||
Super::Initialize();
|
Super::Initialize();
|
||||||
|
|
||||||
bHasMenu = true;
|
bHasMenu = true;
|
||||||
|
bNoPadding = true;
|
||||||
|
|
||||||
Asset = GetAsset<UCogAbilityDataAsset>();
|
Asset = GetAsset<UCogAbilityDataAsset>();
|
||||||
Config = GetConfig<UCogAbilityConfig_Effects>();
|
Config = GetConfig<UCogAbilityConfig_Effects>();
|
||||||
@@ -97,7 +98,6 @@ void FCogAbilityWindow_Effects::RenderEffectsTable()
|
|||||||
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
||||||
| ImGuiTableFlags_ScrollY
|
| ImGuiTableFlags_ScrollY
|
||||||
| ImGuiTableFlags_RowBg
|
| ImGuiTableFlags_RowBg
|
||||||
| ImGuiTableFlags_BordersOuter
|
|
||||||
| ImGuiTableFlags_BordersV
|
| ImGuiTableFlags_BordersV
|
||||||
| ImGuiTableFlags_Reorderable
|
| ImGuiTableFlags_Reorderable
|
||||||
| ImGuiTableFlags_Hideable))
|
| ImGuiTableFlags_Hideable))
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ void FCogAbilityWindow_Tags::Initialize()
|
|||||||
Super::Initialize();
|
Super::Initialize();
|
||||||
|
|
||||||
bHasMenu = true;
|
bHasMenu = true;
|
||||||
|
bNoPadding = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -79,7 +80,6 @@ void FCogAbilityWindow_Tags::RenderTagContainer(const UAbilitySystemComponent& A
|
|||||||
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
||||||
| ImGuiTableFlags_ScrollY
|
| ImGuiTableFlags_ScrollY
|
||||||
| ImGuiTableFlags_RowBg
|
| ImGuiTableFlags_RowBg
|
||||||
| ImGuiTableFlags_BordersOuter
|
|
||||||
| ImGuiTableFlags_BordersV
|
| ImGuiTableFlags_BordersV
|
||||||
| ImGuiTableFlags_Reorderable
|
| ImGuiTableFlags_Reorderable
|
||||||
| ImGuiTableFlags_Hideable))
|
| ImGuiTableFlags_Hideable))
|
||||||
|
|||||||
Reference in New Issue
Block a user