commiting Source folder. Got forgotten in previous commits
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Materials/MaterialInstance.h"
|
||||
#include "GMCSettings.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
UENUM()
|
||||
enum class ELandscapeBlendLayersType : uint8
|
||||
{
|
||||
LB_WeightedBlend,
|
||||
LB_AlphaBlends,
|
||||
LB_HeightBlends,
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct GAEAUETOOLSEDITOR_API FGaeaLandscapeSetting
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Material to pull textures from. Used with MS materials, mostly.
|
||||
UPROPERTY(EditAnywhere, Category="Gaea")
|
||||
UMaterialInstance* InstancedMaterial = nullptr;
|
||||
|
||||
// Function to create "instanced" layer functions from to inject into the landscape master material
|
||||
UPROPERTY(EditAnywhere, Category="Gaea")
|
||||
UMaterialFunction* MaterialFunctionBase = nullptr;
|
||||
|
||||
// Sets the landscape layer name and layer function name
|
||||
UPROPERTY(EditAnywhere, Category="Gaea")
|
||||
FName LayerName;
|
||||
|
||||
// Sets the parameter grouping within the function layer
|
||||
UPROPERTY(EditAnywhere, Category="Gaea")
|
||||
FName LayerGrouping;
|
||||
|
||||
// Sets the landscape layer blend type
|
||||
UPROPERTY(EditAnywhere, Category="Gaea")
|
||||
ELandscapeBlendLayersType LandscapeLayerType = ELandscapeBlendLayersType::LB_WeightedBlend;
|
||||
|
||||
|
||||
};
|
||||
UCLASS()
|
||||
class GAEAUETOOLSEDITOR_API UGMCSettings : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UGMCSettings();
|
||||
~UGMCSettings();
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Landscape Layer Creation settings")
|
||||
TArray<FGaeaLandscapeSetting> LandscapeLayerSettings;
|
||||
|
||||
UPROPERTY(EditAnywhere, DisplayName="Material Save Location",meta = (ContentDir), Category="Landscape Creation settings")
|
||||
FDirectoryPath ContentBrowserPath;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Landscape Creation settings")
|
||||
FString LandscapeMaterialName;
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Widgets/SWindow.h"
|
||||
#include "DesktopPlatformModule.h"
|
||||
#include "ImporterPanelSettings.h"
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(GaeaWindow, Log, All);
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
Material Creator Window Class
|
||||
-----------------------------------------------------------------------------*/
|
||||
class GAEAUETOOLSEDITOR_API SMCWindow : public SWindow
|
||||
{
|
||||
public:
|
||||
SMCWindow();
|
||||
~SMCWindow();
|
||||
|
||||
SLATE_BEGIN_ARGS(SMCWindow)
|
||||
{
|
||||
Title(FText::GetEmpty());
|
||||
ClientSize(FVector2d(800,600));
|
||||
SizingRule(ESizingRule::UserSized);
|
||||
}
|
||||
|
||||
SLATE_ARGUMENT(FText, Title);
|
||||
SLATE_ARGUMENT(FVector2D, ClientSize);
|
||||
SLATE_ARGUMENT(ESizingRule, SizingRule);
|
||||
|
||||
SLATE_END_ARGS()
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
Import Window Class
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
class GAEAUETOOLSEDITOR_API SGaeaImportWindow : public SWindow
|
||||
{
|
||||
public:
|
||||
SGaeaImportWindow();
|
||||
~SGaeaImportWindow();
|
||||
|
||||
SLATE_BEGIN_ARGS(SGaeaImportWindow)
|
||||
{
|
||||
Title(FText::GetEmpty());
|
||||
ClientSize(FVector2d(800,600));
|
||||
SizingRule(ESizingRule::UserSized);
|
||||
}
|
||||
|
||||
SLATE_ARGUMENT(FText, Title);
|
||||
SLATE_ARGUMENT(FVector2D, ClientSize);
|
||||
SLATE_ARGUMENT(ESizingRule, SizingRule);
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
void CreateDetailsView();
|
||||
|
||||
private:
|
||||
|
||||
UImporterPanelSettings* ImporterSettings = nullptr;
|
||||
TSharedPtr<class IDetailsView> PropertyWidget;
|
||||
FReply OnImportClicked() const;
|
||||
FReply OnCreateLandscapeClicked();
|
||||
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
#pragma once
|
||||
|
||||
#include "Framework/Commands/Commands.h"
|
||||
#include "EditorStyleSet.h"
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class GAEAUETOOLSEDITOR_API FGaeaCommands : public TCommands<FGaeaCommands>
|
||||
{
|
||||
public:
|
||||
|
||||
FGaeaCommands() : TCommands(TEXT("Gaea"), NSLOCTEXT("Contexts", "Gaea", "Gaea Commands"), NAME_None, FAppStyle::GetAppStyleSetName())
|
||||
{
|
||||
}
|
||||
|
||||
virtual void RegisterCommands() override;
|
||||
|
||||
TSharedPtr<FUICommandInfo> OpenImporter;
|
||||
TSharedPtr<FUICommandInfo> DeleteSelectedWPLandscape;
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "Styling/SlateStyle.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(GaeaEditorStyle, Log, All);
|
||||
|
||||
class FGaeaEditorStyle final
|
||||
{
|
||||
public:
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
||||
static ISlateStyle& Get()
|
||||
{
|
||||
return *StyleSet.Get();
|
||||
}
|
||||
|
||||
static FName GetStyleSetName();
|
||||
|
||||
private:
|
||||
|
||||
static FString RootToPluginContentDir(const FString& RelativePath, const TCHAR* Extension);
|
||||
|
||||
static TUniquePtr<FSlateStyleSet> StyleSet;
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "GaeaLandscapeComponent.generated.h"
|
||||
|
||||
class ULandscapeLayerInfoObject;
|
||||
|
||||
UCLASS(ClassGroup=(Custom), meta=(NotBlueprintable, NotBlueprintType))
|
||||
class GAEAUETOOLSEDITOR_API UGaeaLandscapeComponent final : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this component's properties
|
||||
UGaeaLandscapeComponent();
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Gaea Landscape")
|
||||
bool LockProperties = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Gaea Landscape", meta = (FilePathFilter = "png", EditCondition = "!LockProperties"))
|
||||
FFilePath HeightmapFilepath;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Gaea Landscape", meta = (FilePathFilter = "json", EditCondition = "!LockProperties"))
|
||||
FFilePath DefinitionFilepath;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Gaea Landscape", meta = (FilePathFilter = "png", EditCondition = "!LockProperties"))
|
||||
TArray<FFilePath> WeightmapFilepaths;
|
||||
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||
|
||||
virtual void DestroyComponent(bool bPromoteChildren = false) override;
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,124 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#include "Math/MathFwd.h"
|
||||
#include "EditorSubsystem.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "IDetailsView.h"
|
||||
#include "Input/Reply.h"
|
||||
#include "IDesktopPlatform.h"
|
||||
//#include "GaeaUEFunctionLibrary.h"
|
||||
//#include "GMCSettings.h"
|
||||
#include "ImporterPanelSettings.h"
|
||||
#include "LandscapeImportHelper.h"
|
||||
#include "LandscapeTiledImage.h"
|
||||
#include "Landscape.h"
|
||||
#include "GaeaSubsystem.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(GaeaSubsystem, Log, All);
|
||||
|
||||
class FJsonObject;
|
||||
|
||||
USTRUCT()
|
||||
struct FGaeaJson
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY()
|
||||
FString ID = TEXT("");
|
||||
UPROPERTY()
|
||||
int32 Resolution = 0;
|
||||
UPROPERTY()
|
||||
float ScaleX = 1.0f;
|
||||
UPROPERTY()
|
||||
float ScaleY = 1.0f;
|
||||
UPROPERTY()
|
||||
float ScaleZ = 1.0f;
|
||||
UPROPERTY()
|
||||
float Height = 0.0f;
|
||||
UPROPERTY()
|
||||
FString Unit = TEXT("");
|
||||
|
||||
};
|
||||
|
||||
UCLASS(NotBlueprintable)
|
||||
class GAEAUETOOLSEDITOR_API UGaeaSubsystem final : public UEditorSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
// Get instance of the Gaea Subsystem
|
||||
UFUNCTION()
|
||||
static UGaeaSubsystem* GetGaeaSubsystem();
|
||||
|
||||
// Spawn the Gaea Material Creator Window - future release
|
||||
/*UFUNCTION(Category="Gaea")
|
||||
void SpawnGMCWindow();*/
|
||||
|
||||
// Spawn the Gaea Landscape Creator Window
|
||||
UFUNCTION()
|
||||
void SpawnGImporterWindow();
|
||||
|
||||
UFUNCTION()
|
||||
void ReimportGaeaTerrain();
|
||||
|
||||
UFUNCTION()
|
||||
void ReimportGaeaWPTerrain();
|
||||
|
||||
// Open import dialog for heightmap file types. Will set a path for heightmap and json files.
|
||||
UFUNCTION()
|
||||
void ImportHeightmap(FString& Heightmap, FString& JSON, FVector& Scale, FVector& Location, TArray<FString>& Weightmaps, FString& CachedPath);
|
||||
|
||||
UFUNCTION()
|
||||
FString ReadStringFromFile(FString Path, bool& bOutSuccess, FString& OutMessage);
|
||||
|
||||
TSharedPtr<FJsonObject> ReadJson(FString Path, bool& bOutSuccess, FString& OutMessage);
|
||||
|
||||
UFUNCTION()
|
||||
FGaeaJson CreateStructFromJson(FString Path, bool& bOutSuccess, FString& OutMessage);
|
||||
|
||||
UFUNCTION()
|
||||
ALandscape* GetLandscape(ULandscapeInfo* LandscapeInfo) const;
|
||||
|
||||
//FGuid GetLayerGuidFromIndex(int32 Index, ULandscapeInfo* LandscapeInfo) const;
|
||||
|
||||
//Creates a landscape actor from our panel settings.
|
||||
UFUNCTION()
|
||||
void CreateLandscapeActor(UImporterPanelSettings* Settings);
|
||||
|
||||
UFUNCTION()
|
||||
TArray<UMaterialExpressionLandscapeLayerBlend*> GetLandscapeLayerBlendNodes(UMaterialInterface* MaterialInterface);
|
||||
|
||||
UFUNCTION()
|
||||
TArray<FName> GetLandscapeLayerBlendNames(TArray<UMaterialExpressionLandscapeLayerBlend*> LayerBlends, TArray<FName>& Names);
|
||||
|
||||
UFUNCTION()
|
||||
void GetLandscapeActorProxies(ALandscape* Landscape, TArray<ALandscapeProxy*>& LandscapeStreamingProxies);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY()
|
||||
UImporterPanelSettings* ImporterSettings = nullptr;
|
||||
|
||||
/*UPROPERTY()
|
||||
UGMCSettings* PanelSettings = nullptr;*/
|
||||
|
||||
UPROPERTY()
|
||||
FString DefaultDialogPath;
|
||||
|
||||
TSharedPtr<IDetailsView> PropertyWidget;
|
||||
TWeakPtr<SWindow> WindowValidator;
|
||||
TWeakPtr<SWindow> ImporterWindowValidator;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
//#include "CoreMinimal.h"
|
||||
#include "Modules/ModuleInterface.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "GaeaSubsystem.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(GaeaUETools, Log, All);
|
||||
|
||||
class FToolBarBuilder;
|
||||
class FMenuBuilder;
|
||||
|
||||
class FGaeaUEToolsEditorModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
|
||||
// void RegisterMCWindow();
|
||||
|
||||
// Primary importer window
|
||||
void RegisterImporterWindow();
|
||||
|
||||
// Submenu for all landscape actor options
|
||||
void RegisterGaeaActorMenu();
|
||||
|
||||
// Entry for refreshing landscape from Gaea heightmap and json
|
||||
void GaeaActorActions(FMenuBuilder& MenuBuilder);
|
||||
|
||||
void RegisterLandscapeActorMenu();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Widgets/SWindow.h"
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
class GAEAUETOOLSEDITOR_API SGaeaWindow : public SWindow
|
||||
{
|
||||
|
||||
public:
|
||||
SGaeaWindow();
|
||||
virtual ~SGaeaWindow() override;
|
||||
|
||||
SLATE_BEGIN_ARGS(SGaeaWindow)
|
||||
{
|
||||
Title(FText::GetEmpty());
|
||||
ClientSize(FVector2d(800,600));
|
||||
SizingRule(ESizingRule::FixedSize);
|
||||
}
|
||||
|
||||
SLATE_ARGUMENT(FText, Title);
|
||||
SLATE_ARGUMENT(FVector2D, ClientSize);
|
||||
SLATE_ARGUMENT(ESizingRule, SizingRule);
|
||||
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs)
|
||||
{
|
||||
SWindow::Construct(SWindow::FArguments()
|
||||
.Title(InArgs._Title)
|
||||
.ClientSize(InArgs._ClientSize)
|
||||
.SizingRule(InArgs._SizingRule));
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool bClosed = false;
|
||||
|
||||
FOnWindowClosed WindowStatus;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Materials/MaterialInterface.h"
|
||||
#include "ImporterPanelSettings.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS(NotBlueprintable)
|
||||
class GAEAUETOOLSEDITOR_API UImporterPanelSettings final : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UImporterPanelSettings();
|
||||
~UImporterPanelSettings();
|
||||
|
||||
|
||||
UPROPERTY(VisibleAnywhere, DisplayName="Heightmap Filename", Category="Filepaths")
|
||||
FString HeightMapFileName;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, DisplayName="JSON Filename", Category="Filepaths")
|
||||
FString jsonFileName;
|
||||
|
||||
//Reorder these to match the desired landscape layer. This must always be less than the amount of layers provided by the landscape material.
|
||||
UPROPERTY(EditAnywhere, DisplayName= "Weightmap Filenames", Category="Filepaths")
|
||||
TArray<FString> WeightmapFileNames;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<FString> WeightmapFilePaths;
|
||||
|
||||
UPROPERTY()
|
||||
FString StoredPath;
|
||||
|
||||
UPROPERTY()
|
||||
bool EnableEditLayers = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, DisplayName="Flip Y Axis", Category="Landscape Actor Settings")
|
||||
bool FlipYAxis;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Landscape Actor Settings|World Partition", DisplayName="Enable World Partition")
|
||||
bool bIsWorldPartition = true;
|
||||
|
||||
// Used only if the level has world partition support.
|
||||
UPROPERTY(EditAnywhere, Category="Landscape Actor Settings|World Partition", meta = (EditCondition = "bIsWorldPartition", UIMin="1", UIMax="16", ClampMin="1", ClampMax="16"))
|
||||
int32 WorldPartitionGridSize = 2;
|
||||
|
||||
//Must be set to automatically setup layer weightmaps.
|
||||
UPROPERTY(Category="Rendering", EditAnywhere, DisplayName="Landscape Material")
|
||||
TObjectPtr<UMaterialInterface> LandscapeMaterial;
|
||||
|
||||
UPROPERTY(Category="Rendering", VisibleAnywhere, DisplayName="Landscape Layer Names", meta = (EditCondition = "IsLandscapeMaterialLayerNamesNotEmpty()"))
|
||||
TArray<FName> LandscapeMaterialLayerNames;
|
||||
|
||||
UFUNCTION()
|
||||
bool IsLandscapeMaterialLayerNamesNotEmpty() const
|
||||
{
|
||||
return LandscapeMaterialLayerNames.Num() > 0;
|
||||
}
|
||||
|
||||
//Where to create layer info objects.
|
||||
UPROPERTY(Category="Rendering", EditAnywhere, meta = (ContentDir), DisplayName="Layer Info Folder")
|
||||
FDirectoryPath LayerInfoFolder;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Transform")
|
||||
FVector Location = FVector(0,0,100);
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Transform")
|
||||
FRotator Rotation;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Transform")
|
||||
FVector Scale = FVector(100,100,100);
|
||||
|
||||
UPROPERTY()
|
||||
FIntPoint Components;
|
||||
|
||||
UPROPERTY()
|
||||
FIntPoint Resolution;
|
||||
|
||||
UPROPERTY()
|
||||
int32 TotalComponents;
|
||||
|
||||
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user