Add a CogAll module to ease the integration for projects that want all windows

This commit is contained in:
Arnaud Jamin
2024-01-09 01:12:31 -05:00
parent 4434b72835
commit 8cbecf504b
15 changed files with 280 additions and 155 deletions
@@ -188,6 +188,19 @@ void RenderSnap(bool* SnapEnable, float* Snap)
ImGui::PopItemWidth();
}
//--------------------------------------------------------------------------------------------------------------------------
bool FCogDebug_Gizmo::Draw(const char* Id, const APlayerController& InPlayerController, USceneComponent& SceneComponent, ECogDebug_GizmoFlags Flags)
{
FTransform Transform = SceneComponent.GetComponentTransform();
if (Draw(Id, InPlayerController, Transform, Flags))
{
SceneComponent.SetWorldTransform(Transform);
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------------------
bool FCogDebug_Gizmo::Draw(const char* Id, const APlayerController& InPlayerController, FTransform& InOutTransform, ECogDebug_GizmoFlags Flags)
{
@@ -90,7 +90,7 @@ struct FCogDebugSettings
float GizmoCursorSelectionThreshold = 10.0f;
UPROPERTY(Config)
float GizmoTranslationAxisLength = 50.0f;
float GizmoTranslationAxisLength = 80.0f;
UPROPERTY(Config)
bool GizmoTranslationSnapEnable = false;
@@ -126,10 +126,10 @@ struct FCogDebugSettings
float GizmoScaleSnapValue = 1.0f;
UPROPERTY(Config)
float GizmoScaleBoxOffset = 50.0f;
float GizmoScaleBoxOffset = 85.0f;
UPROPERTY(Config)
float GizmoScaleBoxExtent = 2.0f;
float GizmoScaleBoxExtent = 5.0f;
UPROPERTY(Config)
float GizmoScaleSpeed = 0.01f;
@@ -77,9 +77,13 @@ struct FCogDebug_GizmoElement
//--------------------------------------------------------------------------------------------------------------------------
struct COGDEBUG_API FCogDebug_Gizmo
{
bool Draw(const char* Id, const APlayerController& InPlayerController, USceneComponent& SceneComponent, ECogDebug_GizmoFlags Flags = ECogDebug_GizmoFlags::None);
bool Draw(const char* Id, const APlayerController& InPlayerController, FTransform& InOutTransform, ECogDebug_GizmoFlags Flags = ECogDebug_GizmoFlags::None);
ECogDebug_GizmoElementType DraggedElementType = ECogDebug_GizmoElementType::MAX;
FVector2D CursorOffset = FVector2D::ZeroVector;
FTransform InitialTransform = FTransform::Identity;
};
@@ -106,11 +106,8 @@ void FCogEngineWindow_CollisionTester::RenderContent()
if (const APlayerController* LocalPlayerController = GetLocalPlayerController())
{
FTransform Transform = CollisionTester->EndComponent->GetComponentTransform();
if (EndGizmo.Draw("CollisionTesterEndGizmo", *LocalPlayerController, Transform, ECogDebug_GizmoFlags::NoRotation | ECogDebug_GizmoFlags::NoScale))
{
CollisionTester->EndComponent->SetWorldTransform(Transform);
}
StartGizmo.Draw("CollisionTesterStartGizmo", *LocalPlayerController, *CollisionTester->StartComponent);
EndGizmo.Draw("CollisionTesterEndGizmo", *LocalPlayerController, *CollisionTester->EndComponent, ECogDebug_GizmoFlags::NoRotation | ECogDebug_GizmoFlags::NoScale);
}
FCogWindowWidgets::SetNextItemToShortWidth();
@@ -41,6 +41,7 @@ protected:
TObjectPtr<UCogEngineConfig_CollisionTester> Config = nullptr;
FCogDebug_Gizmo StartGizmo;
FCogDebug_Gizmo EndGizmo;
};