mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-01 12:18:15 +00:00
Add CogInterfaces plugin to fix interface usage when compiling shipping builds
This commit is contained in:
@@ -22,8 +22,9 @@ public class CogDebug : ModuleRules
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
"CogImgui"
|
||||
}
|
||||
"CogImgui",
|
||||
"CogInterfaces",
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -12,10 +12,37 @@ DEFINE_LOG_CATEGORY(LogCogServerDebug);
|
||||
|
||||
TMap<FName, FCogDebugLogCategoryInfo> FCogDebugLogCategoryManager::LogCategories;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLogCategoryManager::AddLogCategory(FLogCategoryBase& LogCategory)
|
||||
// FCogDebugLogCategoryInfo
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
FString FCogDebugLogCategoryInfo::GetDisplayName() const
|
||||
{
|
||||
LogCategories.Add(LogCategory.GetCategoryName(), FCogDebugLogCategoryInfo{ &LogCategory, ELogVerbosity::NumVerbosity });
|
||||
if (DisplayName.IsEmpty() == false)
|
||||
{
|
||||
return DisplayName;
|
||||
}
|
||||
|
||||
if (LogCategory != nullptr)
|
||||
{
|
||||
return LogCategory->GetCategoryName().ToString();
|
||||
}
|
||||
|
||||
return FString("Invalid");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// FCogDebugLogCategoryManager
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogDebugLogCategoryManager::AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName)
|
||||
{
|
||||
LogCategories.Add(LogCategory.GetCategoryName(),
|
||||
FCogDebugLogCategoryInfo
|
||||
{
|
||||
&LogCategory,
|
||||
ELogVerbosity::NumVerbosity,
|
||||
DisplayName,
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "CogDebugPlot.h"
|
||||
|
||||
#include "CogDebugFilteredActorInterface.h"
|
||||
#include "CogDebugDraw.h"
|
||||
#include "CogDebugHelper.h"
|
||||
#include "CogInterfacesFilteredActor.h"
|
||||
#include "CogImguiHelper.h"
|
||||
|
||||
FCogDebugPlotEvent FCogDebugPlot::DefaultEvent;
|
||||
@@ -427,7 +427,7 @@ FCogDebugPlotEntry* FCogDebugPlot::RegisterPlot(const UObject* WorldContextObjec
|
||||
//---------------------------------------------------------------------------------
|
||||
// Cast to ICogActorFilteringDebugInterface to know if we should filter
|
||||
//---------------------------------------------------------------------------------
|
||||
if (Cast<ICogDebugFilteredActorInterface>(WorldContextObject))
|
||||
if (Cast<ICogInterfacesFilteredActor>(WorldContextObject))
|
||||
{
|
||||
if (WorldContextObject != FCogDebugSettings::GetSelection())
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "CogDebugSettings.h"
|
||||
|
||||
#include "CogInterfacesFilteredActor.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TWeakObjectPtr<AActor> FCogDebugSettings::Selection;
|
||||
bool FCogDebugSettings::FilterBySelection = true;
|
||||
@@ -72,7 +74,7 @@ bool FCogDebugSettings::IsDebugActiveForActor(const AActor* Actor)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Cast<ICogDebugFilteredActorInterface>(Actor))
|
||||
if (Cast<ICogInterfacesFilteredActor>(Actor))
|
||||
{
|
||||
return (SelectionPtr == Actor || FilterBySelection == false);
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogDebugAllegianceInterface.generated.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UENUM(BlueprintType)
|
||||
enum class ECogAllegiance : uint8
|
||||
{
|
||||
Ally,
|
||||
Enemy
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
UINTERFACE(MinimalAPI, Blueprintable)
|
||||
class UCogAllegianceInterface : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
class ICogAllegianceInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
virtual ECogAllegiance GetAllegiance(const AActor* OtherActor) const = 0;
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CogDebugFilteredActorInterface.generated.h"
|
||||
|
||||
UINTERFACE(MinimalAPI, Blueprintable)
|
||||
class UCogDebugFilteredActorInterface : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
class ICogDebugFilteredActorInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
virtual bool IsActorFilteringDebug() const { return true; }
|
||||
};
|
||||
@@ -13,12 +13,15 @@ struct COGDEBUG_API FCogDebugLogCategoryInfo
|
||||
{
|
||||
FLogCategoryBase* LogCategory = nullptr;
|
||||
ELogVerbosity::Type ServerVerbosity = ELogVerbosity::NoLogging;
|
||||
FString DisplayName;
|
||||
|
||||
FString GetDisplayName() const;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
struct COGDEBUG_API FCogDebugLogCategoryManager
|
||||
{
|
||||
static void AddLogCategory(FLogCategoryBase& LogCategory);
|
||||
static void AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName = "");
|
||||
|
||||
static bool IsVerbosityActive(ELogVerbosity::Type Verbosity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user