Add behavior tree window

This commit is contained in:
Arnaud Jamin
2023-10-16 17:04:32 -04:00
parent 170869648c
commit 95d24ae767
8 changed files with 275 additions and 21 deletions
@@ -114,13 +114,13 @@ void UCogEngineWindow_Skeleton::RenderContent()
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, FCogWindowWidgets::GetFontWidth());
HoveredBoneIndex = INDEX_NONE;
DrawBoneEntry(0, false);
RenderBoneEntry(0, false);
ImGui::PopStyleVar();
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogEngineWindow_Skeleton::DrawBoneEntry(int32 BoneIndex, bool OpenAllChildren)
void UCogEngineWindow_Skeleton::RenderBoneEntry(int32 BoneIndex, bool OpenAllChildren)
{
if (BonesInfos.IsValidIndex(BoneIndex) == false)
{
@@ -202,6 +202,7 @@ void UCogEngineWindow_Skeleton::DrawBoneEntry(int32 BoneIndex, bool OpenAllChild
// Checkbox
//------------------------
ImGui::SameLine();
FCogWindowWidgets::PushStyleCompact();
if (ImGui::Checkbox("##Visible", &BoneInfo.ShowBone))
{
if (IsControlDown)
@@ -217,6 +218,7 @@ void UCogEngineWindow_Skeleton::DrawBoneEntry(int32 BoneIndex, bool OpenAllChild
BoneInfo.ShowTrajectory = false;
}
}
FCogWindowWidgets::PopStyleCompact();
const bool HasCustomVisiblity = BoneInfo.ShowName || BoneInfo.ShowAxes || BoneInfo.ShowLocalVelocity || BoneInfo.ShowTrajectory;
if (HasCustomVisiblity)
@@ -239,13 +241,13 @@ void UCogEngineWindow_Skeleton::DrawBoneEntry(int32 BoneIndex, bool OpenAllChild
{
for (int32 ChildIndex : BoneInfo.Children)
{
DrawBoneEntry(ChildIndex, OpenAllChildren);
RenderBoneEntry(ChildIndex, OpenAllChildren);
}
}
if (ShowNode)
{
if (OpenChildren && ShowNode)
if (OpenChildren)
{
ImGui::TreePop();
}
@@ -42,7 +42,7 @@ protected:
virtual void OnSelectionChanged(AActor* OldSelection, AActor* NewSelection) override;
private:
void DrawBoneEntry(int32 BoneIndex, bool OpenAllChildren);
void RenderBoneEntry(int32 BoneIndex, bool OpenAllChildren);
void SetChildrenVisibility(int32 BoneIndex, bool IsVisible);
void DrawSkeleton();
void RefreshSkeleton();