mirror of
https://github.com/Ed94/Cog.git
synced 2026-07-24 00:17:53 +00:00
CogPackage: fix Gameplay Cues not cooked
CogSample: Add area of effect CogSample: Add "Easy" cheat CogWindow: Fix some tooltips CogEngine: Spawns now spawn the default controller CogDebug: Early out on DebugDraw if WorldContextObject is null
This commit is contained in:
@@ -17,399 +17,521 @@
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::String2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FString& Text, const FVector2D& Location, const FColor& Color, bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
FCogDebugDrawImGui::AddText(
|
||||
FCogImguiHelper::ToImVec2(Location),
|
||||
Text,
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
true,
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
return;
|
||||
}
|
||||
|
||||
FCogDebugDrawImGui::AddText(
|
||||
FCogImguiHelper::ToImVec2(Location),
|
||||
Text,
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
true,
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Segment2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& SegmentStart, const FVector2D& SegmentEnd, const FColor& Color, bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
FCogDebugDrawImGui::AddLine(
|
||||
FCogImguiHelper::ToImVec2(SegmentStart),
|
||||
FCogImguiHelper::ToImVec2(SegmentEnd),
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
return;
|
||||
}
|
||||
|
||||
FCogDebugDrawImGui::AddLine(
|
||||
FCogImguiHelper::ToImVec2(SegmentStart),
|
||||
FCogImguiHelper::ToImVec2(SegmentEnd),
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Circle2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& Location, float Radius, const FColor& Color, bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
FCogDebugDrawImGui::AddCircle(
|
||||
FCogImguiHelper::ToImVec2(Location),
|
||||
Radius,
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
FCogDebugSettings::GetDebugSegments(),
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
return;
|
||||
}
|
||||
|
||||
FCogDebugDrawImGui::AddCircle(
|
||||
FCogImguiHelper::ToImVec2(Location),
|
||||
Radius,
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
FCogDebugSettings::GetDebugSegments(),
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void FCogDebugDraw::Rect2D(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& Min, const FVector2D& Max, const FColor& Color, bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const ImVec2 ImMin = FCogImguiHelper::ToImVec2(Min);
|
||||
const ImVec2 ImMax = FCogImguiHelper::ToImVec2(Max);
|
||||
|
||||
FCogDebugDrawImGui::AddRect(
|
||||
ImMin,
|
||||
ImMax,
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
0.0f,
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
return;
|
||||
}
|
||||
|
||||
FCogDebugDrawImGui::AddRect(
|
||||
FCogImguiHelper::ToImVec2(Min),
|
||||
FCogImguiHelper::ToImVec2(Max),
|
||||
FCogImguiHelper::ToImU32(Color),
|
||||
0.0f,
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::Fade2D);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::String(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FString& Text, const FVector& Location, const FColor& Color, const bool Persistent)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_LOCATION(WorldContextObject, LogCategory, Verbose, Location, 10.0f, NewColor, TEXT("%s"), *Text);
|
||||
|
||||
::DrawDebugString(
|
||||
WorldContextObject->GetWorld(),
|
||||
Location,
|
||||
*Text,
|
||||
nullptr,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugTextDuration(Persistent),
|
||||
FCogDebugSettings::TextShadow,
|
||||
FCogDebugSettings::TextSize);
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_LOCATION(WorldContextObject, LogCategory, Verbose, Location, 10.0f, NewColor, TEXT("%s"), *Text);
|
||||
|
||||
::DrawDebugString(
|
||||
World,
|
||||
Location,
|
||||
*Text,
|
||||
nullptr,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugTextDuration(Persistent),
|
||||
FCogDebugSettings::TextShadow,
|
||||
FCogDebugSettings::TextSize);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Point(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& Location, const float Size, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
::DrawDebugPoint(
|
||||
WorldContextObject->GetWorld(),
|
||||
Location,
|
||||
Size,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakePoint(Location, Size, NewColor, Persistent, FCogDebugSettings::DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
::DrawDebugPoint(
|
||||
World,
|
||||
Location,
|
||||
Size,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakePoint(Location, Size, NewColor, Persistent, FCogDebugSettings::DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Segment(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& SegmentStart, const FVector& SegmentEnd, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_SEGMENT(WorldContextObject, LogCategory, Verbose, SegmentStart, SegmentEnd, NewColor, TEXT_EMPTY);
|
||||
::DrawDebugLine(
|
||||
WorldContextObject->GetWorld(),
|
||||
SegmentStart,
|
||||
SegmentEnd,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeSegment(SegmentStart, SegmentEnd, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_SEGMENT(WorldContextObject, LogCategory, Verbose, SegmentStart, SegmentEnd, NewColor, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugLine(
|
||||
World,
|
||||
SegmentStart,
|
||||
SegmentEnd,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeSegment(SegmentStart, SegmentEnd, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Bone(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& BoneLocation, const FVector& ParentLocation, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_SEGMENT(WorldContextObject, LogCategory, Verbose, BoneLocation, ParentLocation, NewColor, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugLine(
|
||||
WorldContextObject->GetWorld(),
|
||||
BoneLocation,
|
||||
ParentLocation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
::DrawDebugPoint(
|
||||
WorldContextObject->GetWorld(),
|
||||
BoneLocation,
|
||||
FCogDebugSettings::GetDebugThickness(4.0f),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeBone(BoneLocation, ParentLocation, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_SEGMENT(WorldContextObject, LogCategory, Verbose, BoneLocation, ParentLocation, NewColor, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugLine(
|
||||
World,
|
||||
BoneLocation,
|
||||
ParentLocation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
::DrawDebugPoint(
|
||||
World,
|
||||
BoneLocation,
|
||||
FCogDebugSettings::GetDebugThickness(4.0f),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeBone(BoneLocation, ParentLocation, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Arrow(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& SegmentStart, const FVector& SegmentEnd, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, SegmentStart, SegmentEnd, NewColor, TEXT_EMPTY);
|
||||
::DrawDebugDirectionalArrow(
|
||||
WorldContextObject->GetWorld(),
|
||||
SegmentStart,
|
||||
SegmentEnd,
|
||||
FCogDebugSettings::ArrowSize,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeArrow(SegmentStart, SegmentEnd, FCogDebugSettings::ArrowSize, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, SegmentStart, SegmentEnd, NewColor, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugDirectionalArrow(
|
||||
World,
|
||||
SegmentStart,
|
||||
SegmentEnd,
|
||||
FCogDebugSettings::ArrowSize,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeArrow(SegmentStart, SegmentEnd, FCogDebugSettings::ArrowSize, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Axis(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& AxisLoc, const FRotator& AxisRot, float Scale, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
FRotationMatrix R(AxisRot);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::X) * Scale, FColor::Red, TEXT_EMPTY);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::Y) * Scale, FColor::Green, TEXT_EMPTY);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::Z) * Scale, FColor::Blue, TEXT_EMPTY);
|
||||
::DrawDebugCoordinateSystem(
|
||||
WorldContextObject->GetWorld(),
|
||||
AxisLoc,
|
||||
AxisRot,
|
||||
Scale * FCogDebugSettings::AxesScale,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeAxes(AxisLoc, AxisRot, FCogDebugSettings::ArrowSize, FColor::Red, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FRotationMatrix R(AxisRot);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::X) * Scale, FColor::Red, TEXT_EMPTY);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::Y) * Scale, FColor::Green, TEXT_EMPTY);
|
||||
UE_VLOG_ARROW(WorldContextObject, LogCategory, Verbose, AxisLoc, AxisLoc + R.GetScaledAxis(EAxis::Z) * Scale, FColor::Blue, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugCoordinateSystem(
|
||||
World,
|
||||
AxisLoc,
|
||||
AxisRot,
|
||||
Scale * FCogDebugSettings::AxesScale,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeAxes(AxisLoc, AxisRot, FCogDebugSettings::ArrowSize, FColor::Red, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Circle(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, float Radius, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
const FVector Center = Matrix.GetOrigin();
|
||||
const FVector UpVector = Matrix.GetUnitAxis(EAxis::X);
|
||||
UE_VLOG_CIRCLE(WorldContextObject, LogCategory, Verbose, Center, UpVector, Radius, NewColor, TEXT_EMPTY);
|
||||
::DrawDebugCircle(
|
||||
WorldContextObject->GetWorld(),
|
||||
Matrix,
|
||||
Radius,
|
||||
FCogDebugSettings::GetCircleSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
false);
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCircle(Center, Matrix.Rotator(), Radius, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
const FVector Center = Matrix.GetOrigin();
|
||||
const FVector UpVector = Matrix.GetUnitAxis(EAxis::X);
|
||||
UE_VLOG_CIRCLE(WorldContextObject, LogCategory, Verbose, Center, UpVector, Radius, NewColor, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugCircle(
|
||||
World,
|
||||
Matrix,
|
||||
Radius,
|
||||
FCogDebugSettings::GetCircleSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0),
|
||||
false);
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCircle(Center, Matrix.Rotator(), Radius, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::CircleArc(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, float InnerRadius, float OuterRadius, float Angle, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
|
||||
//TODO : Add VLOG
|
||||
|
||||
FCogDebugDrawHelper::DrawArc(
|
||||
WorldContextObject->GetWorld(),
|
||||
Matrix,
|
||||
InnerRadius,
|
||||
OuterRadius,
|
||||
Angle,
|
||||
FCogDebugSettings::GetCircleSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCircleArc(Matrix.GetOrigin(), Matrix.Rotator(), InnerRadius, OuterRadius, Angle, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
|
||||
//TODO : Add VLOG
|
||||
|
||||
FCogDebugDrawHelper::DrawArc(
|
||||
World,
|
||||
Matrix,
|
||||
InnerRadius,
|
||||
OuterRadius,
|
||||
Angle,
|
||||
FCogDebugSettings::GetCircleSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCircleArc(Matrix.GetOrigin(), Matrix.Rotator(), InnerRadius, OuterRadius, Angle, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::FlatCapsule(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector2D& Start, const FVector2D& End, const float Radius, const float Z, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
// TODO : Add VLOG
|
||||
|
||||
FCogDebugDrawHelper::DrawFlatCapsule(
|
||||
WorldContextObject->GetWorld(),
|
||||
Start,
|
||||
End,
|
||||
Radius,
|
||||
Z,
|
||||
FCogDebugSettings::GetCircleSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeFlatCapsule(Start, End, Radius, Z, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
// TODO : Add VLOG
|
||||
|
||||
FCogDebugDrawHelper::DrawFlatCapsule(
|
||||
World,
|
||||
Start,
|
||||
End,
|
||||
Radius,
|
||||
Z,
|
||||
FCogDebugSettings::GetCircleSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeFlatCapsule(Start, End, Radius, Z, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Sphere(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& Location, float Radius, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_CAPSULE(WorldContextObject, LogCategory, Verbose, Location, 0.0f, Radius, FQuat::Identity, NewColor, TEXT_EMPTY);
|
||||
FCogDebugDrawHelper::DrawSphere(
|
||||
WorldContextObject->GetWorld(),
|
||||
Location,
|
||||
Radius,
|
||||
FCogDebugSettings::GetDebugSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCapsule(Location, FQuat::Identity, Radius, 0.0f, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_CAPSULE(WorldContextObject, LogCategory, Verbose, Location, 0.0f, Radius, FQuat::Identity, NewColor, TEXT_EMPTY);
|
||||
|
||||
FCogDebugDrawHelper::DrawSphere(
|
||||
World,
|
||||
Location,
|
||||
Radius,
|
||||
FCogDebugSettings::GetDebugSegments(),
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCapsule(Location, FQuat::Identity, Radius, 0.0f, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Box(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& Center, const FVector& Extent, const FQuat& Rotation, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_OBOX(WorldContextObject, LogCategory, Verbose, FBox(-Extent, Extent), FQuatRotationTranslationMatrix::Make(Rotation, Center), NewColor, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugBox(
|
||||
WorldContextObject->GetWorld(),
|
||||
Center,
|
||||
Extent,
|
||||
Rotation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeBox(Center, FRotator(Rotation), Extent, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_OBOX(WorldContextObject, LogCategory, Verbose, FBox(-Extent, Extent), FQuatRotationTranslationMatrix::Make(Rotation, Center), NewColor, TEXT_EMPTY);
|
||||
|
||||
::DrawDebugBox(
|
||||
World,
|
||||
Center,
|
||||
Extent,
|
||||
Rotation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeBox(Center, FRotator(Rotation), Extent, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::SolidBox(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& Center, const FVector& Extent, const FQuat& Rotation, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_OBOX(WorldContextObject, LogCategory, Verbose, FBox(-Extent, Extent), FQuatRotationTranslationMatrix::Make(Rotation, Center), NewColor, TEXT_EMPTY);
|
||||
|
||||
// If we make the Box Thick enough, it will be displayed as a filled box.
|
||||
// We don't use "DrawDebugSolidBox" because it produced weird result, with color being darker than what is intended
|
||||
const float NeededThickness = FMath::Min3(Extent.X, Extent.Y, Extent.Z) * 10.f;
|
||||
|
||||
::DrawDebugBox(
|
||||
WorldContextObject->GetWorld(),
|
||||
Center,
|
||||
Extent,
|
||||
Rotation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
NeededThickness);
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeSolidBox(Center, FRotator(Rotation), Extent, NewColor, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_OBOX(WorldContextObject, LogCategory, Verbose, FBox(-Extent, Extent), FQuatRotationTranslationMatrix::Make(Rotation, Center), NewColor, TEXT_EMPTY);
|
||||
|
||||
// If we make the Box Thick enough, it will be displayed as a filled box.
|
||||
// We don't use "DrawDebugSolidBox" because it produced weird result, with color being darker than what is intended
|
||||
const float NeededThickness = FMath::Min3(Extent.X, Extent.Y, Extent.Z) * 10.f;
|
||||
|
||||
::DrawDebugBox(
|
||||
World,
|
||||
Center,
|
||||
Extent,
|
||||
Rotation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
NeededThickness);
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeSolidBox(Center, FRotator(Rotation), Extent, NewColor, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Frustrum(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FMatrix& Matrix, const float Angle, const float AspectRatio, const float NearPlane, const float FarPlane, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
|
||||
FCogDebugDrawHelper::DrawFrustum(
|
||||
WorldContextObject->GetWorld(),
|
||||
Matrix,
|
||||
Angle,
|
||||
AspectRatio,
|
||||
NearPlane,
|
||||
FarPlane,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
// TODO: Replicate Shape
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
|
||||
FCogDebugDrawHelper::DrawFrustum(
|
||||
World,
|
||||
Matrix,
|
||||
Angle,
|
||||
AspectRatio,
|
||||
NearPlane,
|
||||
FarPlane,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
// TODO: Replicate Shape
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Capsule(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const FVector& Center, const float HalfHeight, const float Radius, const FQuat& Rotation, const FColor& Color, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(WorldContextObject->GetWorld(), Color, Persistent);
|
||||
UE_VLOG_CAPSULE(WorldContextObject, LogCategory, Verbose, Center, HalfHeight, Radius, FQuat::Identity, NewColor, TEXT_EMPTY);
|
||||
|
||||
DrawDebugCapsule(
|
||||
WorldContextObject->GetWorld(),
|
||||
Center,
|
||||
HalfHeight,
|
||||
Radius,
|
||||
Rotation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCapsule(Center, Rotation, Radius, HalfHeight, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const FColor NewColor = FCogDebugSettings::ModulateDebugColor(World, Color, Persistent);
|
||||
UE_VLOG_CAPSULE(WorldContextObject, LogCategory, Verbose, Center, HalfHeight, Radius, FQuat::Identity, NewColor, TEXT_EMPTY);
|
||||
|
||||
DrawDebugCapsule(
|
||||
World,
|
||||
Center,
|
||||
HalfHeight,
|
||||
Radius,
|
||||
Rotation,
|
||||
NewColor,
|
||||
FCogDebugSettings::GetDebugPersistent(Persistent),
|
||||
FCogDebugSettings::GetDebugDuration(Persistent),
|
||||
FCogDebugSettings::GetDebugDepthPriority(DepthPriority),
|
||||
FCogDebugSettings::GetDebugThickness(0));
|
||||
|
||||
ReplicateShape(WorldContextObject, FCogDebugShape::MakeCapsule(Center, Rotation, Radius, HalfHeight, NewColor, 0.0f, Persistent, DepthPriority));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -430,31 +552,39 @@ void FCogDebugDraw::Points(const FLogCategoryBase& LogCategory, const UObject* W
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::Path(const FLogCategoryBase& LogCategory, const UObject* WorldContextObject, const TArray<FVector>& Points, float PointSize, const FColor& StartColor, const FColor& EndColor, const bool Persistent, const uint8 DepthPriority)
|
||||
{
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
if (Points.Num() == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Points.Num() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FVector LastPoint = Points[0];
|
||||
|
||||
int32 Index = 0;
|
||||
for (const FVector& Position : Points)
|
||||
{
|
||||
const FLinearColor LinearColor = FLinearColor::LerpUsingHSV(FLinearColor(StartColor), FLinearColor(EndColor), Points.Num() <= 1 ? 0.0f : Index / (float)(Points.Num() - 1));
|
||||
FColor Color = LinearColor.ToFColor(true);
|
||||
|
||||
Point(LogCategory, WorldContextObject, Position, PointSize, Color, Persistent, DepthPriority);
|
||||
|
||||
if (Index > 0)
|
||||
{
|
||||
return;
|
||||
Segment(LogCategory, WorldContextObject, LastPoint, Position, Color, Persistent, DepthPriority);
|
||||
}
|
||||
|
||||
FVector LastPoint = Points[0];
|
||||
|
||||
int32 Index = 0;
|
||||
for (const FVector& Position : Points)
|
||||
{
|
||||
const FLinearColor LinearColor = FLinearColor::LerpUsingHSV(FLinearColor(StartColor), FLinearColor(EndColor), Points.Num() <= 1 ? 0.0f : Index / (float)(Points.Num() - 1));
|
||||
FColor Color = LinearColor.ToFColor(true);
|
||||
|
||||
Point(LogCategory, WorldContextObject, Position, PointSize, Color, Persistent, DepthPriority);
|
||||
|
||||
if (Index > 0)
|
||||
{
|
||||
Segment(LogCategory, WorldContextObject, LastPoint, Position, Color, Persistent, DepthPriority);
|
||||
}
|
||||
|
||||
Index++;
|
||||
LastPoint = Position;
|
||||
}
|
||||
Index++;
|
||||
LastPoint = Position;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,40 +596,42 @@ void FCogDebugDraw::Skeleton(const FLogCategoryBase& LogCategory, const USkeleta
|
||||
return;
|
||||
}
|
||||
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory))
|
||||
if (FCogDebugLog::IsLogCategoryActive(LogCategory) == false)
|
||||
{
|
||||
const FReferenceSkeleton& ReferenceSkeleton = Skeleton->GetSkeletalMeshAsset()->GetRefSkeleton();
|
||||
const FTransform WorldTransform = Skeleton->GetComponentTransform();
|
||||
const TArray<FTransform>& ComponentSpaceTransforms = Skeleton->GetComponentSpaceTransforms();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int32 BoneIndex = 0; BoneIndex < ComponentSpaceTransforms.Num(); ++BoneIndex)
|
||||
const FReferenceSkeleton& ReferenceSkeleton = Skeleton->GetSkeletalMeshAsset()->GetRefSkeleton();
|
||||
const FTransform WorldTransform = Skeleton->GetComponentTransform();
|
||||
const TArray<FTransform>& ComponentSpaceTransforms = Skeleton->GetComponentSpaceTransforms();
|
||||
|
||||
for (int32 BoneIndex = 0; BoneIndex < ComponentSpaceTransforms.Num(); ++BoneIndex)
|
||||
{
|
||||
if (DrawSecondaryBones == false)
|
||||
{
|
||||
if (DrawSecondaryBones == false)
|
||||
FName BoneName = ReferenceSkeleton.GetBoneName(BoneIndex);
|
||||
if (FCogDebugSettings::IsSecondarySkeletonBone(BoneName))
|
||||
{
|
||||
FName BoneName = ReferenceSkeleton.GetBoneName(BoneIndex);
|
||||
if (FCogDebugSettings::IsSecondarySkeletonBone(BoneName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const FTransform Transform = ComponentSpaceTransforms[BoneIndex] * WorldTransform;
|
||||
const FVector BoneLocation = Transform.GetLocation();
|
||||
const FRotator BoneRotation = FRotator(Transform.GetRotation());
|
||||
const int32 ParentIndex = ReferenceSkeleton.GetParentIndex(BoneIndex);
|
||||
|
||||
FVector ParentLocation;
|
||||
if (ParentIndex >= 0)
|
||||
{
|
||||
ParentLocation = (ComponentSpaceTransforms[ParentIndex] * WorldTransform).GetLocation();
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentLocation = WorldTransform.GetLocation();
|
||||
}
|
||||
|
||||
Bone(LogCategory, Skeleton->GetOwner(), BoneLocation, ParentLocation, Color, false, DepthPriority);
|
||||
}
|
||||
|
||||
const FTransform Transform = ComponentSpaceTransforms[BoneIndex] * WorldTransform;
|
||||
const FVector BoneLocation = Transform.GetLocation();
|
||||
const FRotator BoneRotation = FRotator(Transform.GetRotation());
|
||||
const int32 ParentIndex = ReferenceSkeleton.GetParentIndex(BoneIndex);
|
||||
|
||||
FVector ParentLocation;
|
||||
if (ParentIndex >= 0)
|
||||
{
|
||||
ParentLocation = (ComponentSpaceTransforms[ParentIndex] * WorldTransform).GetLocation();
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentLocation = WorldTransform.GetLocation();
|
||||
}
|
||||
|
||||
Bone(LogCategory, Skeleton->GetOwner(), BoneLocation, ParentLocation, Color, false, DepthPriority);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,7 +639,7 @@ void FCogDebugDraw::Skeleton(const FLogCategoryBase& LogCategory, const USkeleta
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugDraw::ReplicateShape(const UObject* WorldContextObject, const FCogDebugShape& Shape)
|
||||
{
|
||||
UWorld* World = WorldContextObject != nullptr ? WorldContextObject->GetWorld() : nullptr;
|
||||
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||
if (World == nullptr)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -119,7 +119,11 @@ void ACogEngineReplicator::Server_Spawn_Implementation(const FCogEngineSpawnEntr
|
||||
|
||||
FActorSpawnParameters Params;
|
||||
Params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
|
||||
GetWorld()->SpawnActor(SpawnEntry.Class, &Transform, Params);
|
||||
AActor* SpawnerActor = GetWorld()->SpawnActor(SpawnEntry.Class, &Transform, Params);
|
||||
if (APawn* SpawnedPawn = Cast<APawn>(SpawnerActor))
|
||||
{
|
||||
SpawnedPawn->SpawnDefaultController();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !UE_BUILD_SHIPPING
|
||||
|
||||
@@ -49,8 +49,6 @@ void UCogEngineWindow_LogCategories::RenderContent()
|
||||
{
|
||||
if (ImGui::BeginMenu("Options"))
|
||||
{
|
||||
FCogWindowWidgets::HelpMarker("If checked, only show the debug of the currently selected actor. Otherwise show the debug of all actors.");
|
||||
|
||||
ImGui::Checkbox("Show detailed verbosity", &bShowAllVerbosity);
|
||||
ImGui::SameLine();
|
||||
FCogWindowWidgets::HelpMarker("Show the verbosity level of each log category.");
|
||||
|
||||
@@ -26,13 +26,6 @@ void UCogWindow_Settings::RenderContent()
|
||||
{
|
||||
GetOwner()->bRefreshDPIScale = true;
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Compact Mode", &GetOwner()->bCompactMode);
|
||||
|
||||
ImGui::Checkbox("Show Windows In Main Menu", &GetOwner()->bShowWindowsInMainMenu);
|
||||
|
||||
ImGui::Checkbox("Show Window Help", &GetOwner()->bShowHelp);
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
@@ -41,6 +34,12 @@ void UCogWindow_Settings::RenderContent()
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Compact Mode", &GetOwner()->bCompactMode);
|
||||
|
||||
ImGui::Checkbox("Show Windows In Main Menu", &GetOwner()->bShowWindowsInMainMenu);
|
||||
|
||||
ImGui::Checkbox("Show Window Help", &GetOwner()->bShowHelp);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
Reference in New Issue
Block a user