diff --git a/Content/Characters/Creature1/Attributes/GE_Creature1_Attributes.uasset b/Content/Characters/Creature1/Attributes/GE_Creature1_Attributes.uasset index fb28f87..eb3124f 100644 Binary files a/Content/Characters/Creature1/Attributes/GE_Creature1_Attributes.uasset and b/Content/Characters/Creature1/Attributes/GE_Creature1_Attributes.uasset differ diff --git a/Content/Characters/Creature1/BP_Creature1.uasset b/Content/Characters/Creature1/BP_Creature1.uasset index cfc40e5..867bd3c 100644 Binary files a/Content/Characters/Creature1/BP_Creature1.uasset and b/Content/Characters/Creature1/BP_Creature1.uasset differ diff --git a/Content/Characters/Creature1/BT_Creature1.uasset b/Content/Characters/Creature1/BT_Creature1.uasset index 5c80e38..a29c4a7 100644 Binary files a/Content/Characters/Creature1/BT_Creature1.uasset and b/Content/Characters/Creature1/BT_Creature1.uasset differ diff --git a/Content/Characters/Creature1/BT_Creature1_SubTree1.uasset b/Content/Characters/Creature1/BT_Creature1_SubTree1.uasset new file mode 100644 index 0000000..29c3456 Binary files /dev/null and b/Content/Characters/Creature1/BT_Creature1_SubTree1.uasset differ diff --git a/Content/Characters/Creature2/BP_Creature2.uasset b/Content/Characters/Creature2/BP_Creature2.uasset index c55f0ec..e9ea70f 100644 Binary files a/Content/Characters/Creature2/BP_Creature2.uasset and b/Content/Characters/Creature2/BP_Creature2.uasset differ diff --git a/Content/Characters/_Shared_/BP_Creature.uasset b/Content/Characters/_Shared_/BP_Creature.uasset index 3e1aa1d..6d90474 100644 Binary files a/Content/Characters/_Shared_/BP_Creature.uasset and b/Content/Characters/_Shared_/BP_Creature.uasset differ diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp index 35ff52f..6e4a8ad 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Selection.cpp @@ -288,7 +288,7 @@ void UCogEngineWindow_Selection::DrawActorContextMenu(AActor* Actor) //------------------------ // ContextMenu //------------------------ - ImGui::SetNextWindowSize(ImVec2(FCogWindowWidgets::GetFontWidth() * 20, 0)); + ImGui::SetNextWindowSize(ImVec2(FCogWindowWidgets::GetFontWidth() * 30, 0)); if (ImGui::BeginPopupContextItem()) { if (ImGui::Button("Reset Selection", ImVec2(-1, 0))) @@ -331,6 +331,10 @@ void UCogEngineWindow_Selection::DrawActorContextMenu(AActor* Actor) } } + ImGui::Separator(); + + ImGui::Checkbox("Save selection", &bReapplySelection); + ImGui::EndPopup(); } } diff --git a/Plugins/Cog/Source/CogWindow/Private/CogWindowManager.cpp b/Plugins/Cog/Source/CogWindow/Private/CogWindowManager.cpp index 6f9d518..c92c104 100644 --- a/Plugins/Cog/Source/CogWindow/Private/CogWindowManager.cpp +++ b/Plugins/Cog/Source/CogWindow/Private/CogWindowManager.cpp @@ -375,7 +375,8 @@ void UCogWindowManager::RenderMenuItem(UCogWindow& Window, const char* MenuItemN { if (bShowWindowsInMainMenu) { - ImGui::SetNextWindowSizeConstraints(ImVec2(FCogWindowWidgets::GetFontWidth() * 40, ImGui::GetTextLineHeightWithSpacing() * 1), + ImGui::SetNextWindowSizeConstraints( + ImVec2(FCogWindowWidgets::GetFontWidth() * 40, ImGui::GetTextLineHeightWithSpacing() * 5), ImVec2(FCogWindowWidgets::GetFontWidth() * 50, ImGui::GetTextLineHeightWithSpacing() * 60)); if (ImGui::BeginMenu(MenuItemName)) diff --git a/Plugins/CogAI/Source/CogAI/Private/CogAIWindow_BehaviorTree.cpp b/Plugins/CogAI/Source/CogAI/Private/CogAIWindow_BehaviorTree.cpp index c1a7895..90d4ff0 100644 --- a/Plugins/CogAI/Source/CogAI/Private/CogAIWindow_BehaviorTree.cpp +++ b/Plugins/CogAI/Source/CogAI/Private/CogAIWindow_BehaviorTree.cpp @@ -7,6 +7,7 @@ #include "BehaviorTree/Tasks/BTTask_BlueprintBase.h" #include "BehaviorTree/Tasks/BTTask_Wait.h" #include "BrainComponent.h" +#include "CogImguiHelper.h" #include "CogWindowWidgets.h" #include "GameFramework/Pawn.h" #include "imgui_internal.h" @@ -35,6 +36,8 @@ void UCogAIWindow_BehaviorTree::RenderContent() { if (ImGui::BeginMenu("Options")) { + ImGui::ColorEdit4("Active Color", (float*)&ActiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); + ImGui::ColorEdit4("Inactive Color", (float*)&InactiveColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); ImGui::EndMenu(); } @@ -78,6 +81,19 @@ void UCogAIWindow_BehaviorTree::RenderContent() return; } + + UBehaviorTree* RootTree = BehaviorTreeComponent->GetRootTree(); + if (CurrentTree != RootTree) + { + if (ImGui::CollapsingHeader(TCHAR_TO_ANSI(*GetNameSafe(RootTree)), nullptr, ImGuiTreeNodeFlags_DefaultOpen)) + { + RenderNode(*BehaviorTreeComponent, RootTree->RootNode, false); + + ImGui::Spacing(); + ImGui::Spacing(); + } + } + //---------------------------------------------------------------------------------------- // If we use the current tree root node it doesn't seem to be the one instanced. // Not sure if there is a better way to access it, but we find the root node from @@ -92,7 +108,10 @@ void UCogAIWindow_BehaviorTree::RenderContent() if (RootNodeInstanced != nullptr) { - RenderNode(*BehaviorTreeComponent, const_cast(RootNodeInstanced), false); + if (ImGui::CollapsingHeader(TCHAR_TO_ANSI(*GetNameSafe(CurrentTree)), nullptr, ImGuiTreeNodeFlags_DefaultOpen)) + { + RenderNode(*BehaviorTreeComponent, const_cast(RootNodeInstanced), false); + } } } @@ -104,15 +123,7 @@ void UCogAIWindow_BehaviorTree::RenderNode(UBehaviorTreeComponent& BehaviorTreeC const UBTCompositeNode* CompositeNode = Cast(Node); - bool IsActive = false; - for (const UBTNode* ActiveParentNode = BehaviorTreeComponent.GetActiveNode(); ActiveParentNode != nullptr; ActiveParentNode = ActiveParentNode->GetParentNode()) - { - if (Node == ActiveParentNode) - { - IsActive = true; - break; - } - } + const bool IsActive = BehaviorTreeComponent.IsExecutingBranch(Node); bool OpenChildren = false; @@ -245,7 +256,7 @@ void UCogAIWindow_BehaviorTree::RenderNode(UBehaviorTreeComponent& BehaviorTreeC // Name //------------------------ ImGui::SameLine(); - ImVec4 NameColor = IsActive ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) : ImVec4(1.0f, 1.0f, 1.0f, 0.6f); + const ImVec4 NameColor = IsActive ? FCogImguiHelper::ToImVec4(ActiveColor) : FCogImguiHelper::ToImVec4(InactiveColor); ImGui::TextColored(NameColor, "%s", NodeName); } diff --git a/Plugins/CogAI/Source/CogAI/Public/CogAIWindow_BehaviorTree.h b/Plugins/CogAI/Source/CogAI/Public/CogAIWindow_BehaviorTree.h index b541906..6fe4778 100644 --- a/Plugins/CogAI/Source/CogAI/Public/CogAIWindow_BehaviorTree.h +++ b/Plugins/CogAI/Source/CogAI/Public/CogAIWindow_BehaviorTree.h @@ -26,5 +26,11 @@ protected: private: + UPROPERTY(Config) + FVector4f ActiveColor = FVector4f(1.0f, 1.0f, 1.0f, 1.0f); + + UPROPERTY(Config) + FVector4f InactiveColor = FVector4f(1.0f, 1.0f, 1.0f, 0.2f); + ImGuiTextFilter Filter; }; diff --git a/Plugins/CogInput/Source/CogInput/Private/CogInputWindow_Gamepad.cpp b/Plugins/CogInput/Source/CogInput/Private/CogInputWindow_Gamepad.cpp index f7c9718..67830d3 100644 --- a/Plugins/CogInput/Source/CogInput/Private/CogInputWindow_Gamepad.cpp +++ b/Plugins/CogInput/Source/CogInput/Private/CogInputWindow_Gamepad.cpp @@ -38,6 +38,7 @@ void UCogInputWindow_Gamepad::ResetConfig() ButtonColor = FVector4f(0.2f, 0.2f, 0.2f, 1.0f); BorderColor = FVector4f(0.03f, 0.03f, 0.03f, 1.0f); PressedColor = FVector4f(0.6f, 0.6f, 0.6f, 1.0f); + HoveredColor = FVector4f(0.3f, 0.3f, 0.3f, 1.0f); InjectColor = FVector4f(1.0f, 0.5f, 0.0f, 0.5f); Border = 0.02f; } @@ -105,8 +106,7 @@ void UCogInputWindow_Gamepad::AddButton(const FKey& Key, const ImVec2& RelativeP const ImVec2& Size = RelativeSize * CanvasSize.x; const ImVec2 Position = (CanvasMin + CanvasSize * RelativePosition) - Alignment * Size; - ImU32 Color = ImGui::GetColorU32(ImLerp(FCogImguiHelper::ToImVec4(ButtonColor), FCogImguiHelper::ToImVec4(PressedColor), Value)); - + bool IsPressed = false; FCogInjectActionInfo* ActionInfo = Actions.Find(Key); if (ActionInfo != nullptr) { @@ -114,7 +114,7 @@ void UCogInputWindow_Gamepad::AddButton(const FKey& Key, const ImVec2& RelativeP { if (Input->GetActionValue(ActionInfo->Action).Get()) { - Color = FCogImguiHelper::ToImU32(PressedColor); + IsPressed = true; } } } @@ -125,6 +125,16 @@ void UCogInputWindow_Gamepad::AddButton(const FKey& Key, const ImVec2& RelativeP OnButtonClicked(ActionInfo); } + ImU32 Color = FCogImguiHelper::ToImU32(ButtonColor); + if (IsPressed) + { + Color = FCogImguiHelper::ToImU32(PressedColor); + } + else if (ImGui::IsItemHovered()) + { + Color = FCogImguiHelper::ToImU32(HoveredColor); + } + InputContextMenu(Key, ActionInfo, nullptr); if (Border > 0.0f) @@ -144,8 +154,6 @@ void UCogInputWindow_Gamepad::AddStick(const FKey& Key2D, const FKey& KeyBool, b { ImGui::PushID((void*)(&Key2D)); - ImU32 Color = Input->GetKeyValue(KeyBool) > 0.0f ? FCogImguiHelper::ToImU32(PressedColor) : FCogImguiHelper::ToImU32(ButtonColor); - FCogInjectActionInfo* ActionInfoBool = Actions.Find(KeyBool); FCogInjectActionInfo* ActionInfo2D = Actions.Find(Key2D); @@ -169,6 +177,16 @@ void UCogInputWindow_Gamepad::AddStick(const FKey& Key2D, const FKey& KeyBool, b OnButtonClicked(ActionInfoBool); } + ImU32 Color = FCogImguiHelper::ToImU32(ButtonColor); + if (Input->GetKeyValue(KeyBool) > 0.0f) + { + Color = FCogImguiHelper::ToImU32(PressedColor); + } + else if (ImGui::IsItemHovered()) + { + Color = FCogImguiHelper::ToImU32(HoveredColor); + } + InputContextMenu(Key2D, ActionInfoBool, ActionInfo2D); if (Border > 0.0f) @@ -302,11 +320,12 @@ void UCogInputWindow_Gamepad::RenderContent() ImGui::Checkbox("Invert Left Stick Y", &bInvertLeftStickY); ImGui::Checkbox("Invert Right Stick Y", &bInvertRightStickY); ImGui::Separator(); - ImGui::ColorEdit4("Background Color", (float*)&BackgroundColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit4("Border Color", (float*)&BorderColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit4("Button Color", (float*)&ButtonColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit4("Pressed Color", (float*)&PressedColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit4("Inject Color", (float*)&InjectColor, ImGuiColorEditFlags_NoInputs); + ImGui::ColorEdit4("Background Color", (float*)&BackgroundColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); + ImGui::ColorEdit4("Border Color", (float*)&BorderColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); + ImGui::ColorEdit4("Button Color", (float*)&ButtonColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); + ImGui::ColorEdit4("Pressed Color", (float*)&PressedColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); + ImGui::ColorEdit4("Hovered Color", (float*)&HoveredColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); + ImGui::ColorEdit4("Inject Color", (float*)&InjectColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf); FCogWindowWidgets::SliderWithReset("Border", &Border, 0.0f, 0.1f, 0.02f, "%0.3f"); ImGui::EndPopup(); } diff --git a/Plugins/CogInput/Source/CogInput/Public/CogInputWindow_Gamepad.h b/Plugins/CogInput/Source/CogInput/Public/CogInputWindow_Gamepad.h index bc83b31..76c09e1 100644 --- a/Plugins/CogInput/Source/CogInput/Public/CogInputWindow_Gamepad.h +++ b/Plugins/CogInput/Source/CogInput/Public/CogInputWindow_Gamepad.h @@ -63,6 +63,9 @@ private: UPROPERTY(Config) FVector4f PressedColor = FVector4f(0.6f, 0.6f, 0.6f, 1.0f); + UPROPERTY(Config) + FVector4f HoveredColor = FVector4f(0.3f, 0.3f, 0.3f, 1.0f); + UPROPERTY(Config) FVector4f InjectColor = FVector4f(1.0f, 0.5f, 0.0f, 0.5f);