CogWindow: CogWindows are not UObject anymore

CogWindows are now normal object because we want to be able to Ifdef them, and UObject cannot be ifdef. CogWindows were UObject mainly for saving their config. The configs have been moved in separated class, which are UObject.
This commit is contained in:
Arnaud Jamin
2023-10-27 02:39:33 -04:00
parent 42ca1afc6a
commit e72504b47a
73 changed files with 1448 additions and 981 deletions
@@ -2,19 +2,21 @@
#include "CoreMinimal.h"
#include "CogWindow.h"
#include "CogWindowConfig.h"
#include "imgui.h"
#include "CogEngineWindow_Inspector.generated.h"
class UCogEngineConfig_Inspector;
using FCogEngineInspectorApplyFunction = TFunction<void(UObject*)>;
UCLASS(Config = Cog)
class COGENGINE_API UCogEngineWindow_Inspector : public UCogWindow
//--------------------------------------------------------------------------------------------------------------------------
class COGENGINE_API FCogEngineWindow_Inspector : public FCogWindow
{
GENERATED_BODY()
typedef FCogWindow Super;
public:
UCogEngineWindow_Inspector();
virtual void Initialize() override;
virtual UObject* GetInspectedObject() const { return InspectedObject.Get(); }
@@ -24,24 +26,6 @@ public:
virtual void AddFavorite(UObject* Object, FCogEngineInspectorApplyFunction ApplyFunction);
UPROPERTY(Config)
bool bSyncWithSelection = true;
UPROPERTY(Config)
bool bShowDisplayName = true;
UPROPERTY(Config)
bool bShowRowBackground = true;
UPROPERTY(Config)
bool bShowBorders = false;
UPROPERTY(Config)
bool bShowCategories = true;
UPROPERTY(Config)
bool bSortByName = true;
protected:
virtual void RenderHelp() override;
@@ -120,4 +104,45 @@ protected:
TArray<TWeakObjectPtr<UObject>> History;
int32 HistoryIndex = INDEX_NONE;
TWeakObjectPtr<UCogEngineConfig_Inspector> Config = nullptr;
};
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(Config = Cog)
class UCogEngineConfig_Inspector : public UCogWindowConfig
{
GENERATED_BODY()
public:
UPROPERTY(Config)
bool bSyncWithSelection = true;
UPROPERTY(Config)
bool bShowDisplayName = true;
UPROPERTY(Config)
bool bShowRowBackground = true;
UPROPERTY(Config)
bool bShowBorders = false;
UPROPERTY(Config)
bool bShowCategories = true;
UPROPERTY(Config)
bool bSortByName = true;
virtual void Reset() override
{
Super::Reset();
bSyncWithSelection = true;
bShowDisplayName = true;
bShowRowBackground = true;
bShowBorders = false;
bShowCategories = true;
bSortByName = true;
}
};