commiting Source folder. Got forgotten in previous commits
This commit is contained in:
35
Plugins/Gaea2Unreal-main/GaeaUnrealTools.uplugin
Normal file
35
Plugins/Gaea2Unreal-main/GaeaUnrealTools.uplugin
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"FileVersion": 3,
|
||||
"Version": 1,
|
||||
"VersionName": "2.2.0.7",
|
||||
"FriendlyName": "Gaea2Unreal",
|
||||
"Description": "Enhance your landscape creation workflow.",
|
||||
"Category": "Gaea",
|
||||
"CreatedBy": "QuadSpinner",
|
||||
"CreatedByURL": "https://quadspinner.com/",
|
||||
"DocsURL": "https://gaea.app/uedocs",
|
||||
"MarketplaceURL": "",
|
||||
"SupportURL": "",
|
||||
"EngineVersion": "5.7.0",
|
||||
"CanContainContent": true,
|
||||
"IsBetaVersion": true,
|
||||
"Installed": true,
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "GaeaUnrealTools",
|
||||
"Type": "Editor",
|
||||
"LoadingPhase": "Default"
|
||||
},
|
||||
{
|
||||
"Name": "GaeaUEToolsEditor",
|
||||
"Type": "Editor",
|
||||
"LoadingPhase": "Default"
|
||||
}
|
||||
],
|
||||
"Plugins": [
|
||||
{
|
||||
"Name": "EditorScriptingUtilities",
|
||||
"Enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Plugins/Gaea2Unreal-main/Resources/Icon128.png
Normal file
BIN
Plugins/Gaea2Unreal-main/Resources/Icon128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
BIN
Plugins/Gaea2Unreal-main/Resources/ImporterIcon.png
Normal file
BIN
Plugins/Gaea2Unreal-main/Resources/ImporterIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,49 @@
|
||||
using System.IO;
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class GaeaUEToolsEditor : ModuleRules
|
||||
{
|
||||
public GaeaUEToolsEditor(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
var EngineDir = Path.GetFullPath(base.Target.RelativeEnginePath);
|
||||
PublicSystemIncludePaths.AddRange(new string[]
|
||||
|
||||
{
|
||||
Path.Combine(EngineDir, "Source/Editor/LandscapeEditor/Private")
|
||||
}
|
||||
);
|
||||
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core", "Landscape", "EditorStyle",
|
||||
}
|
||||
);
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
"InputCore",
|
||||
"LevelEditor",
|
||||
"Projects",
|
||||
"MaterialEditor",
|
||||
"Landscape",
|
||||
"UnrealEd",
|
||||
"ToolMenus",
|
||||
"EditorFramework",
|
||||
"EditorSubsystem",
|
||||
"LandscapeEditor",
|
||||
"Foliage",
|
||||
"Json",
|
||||
"JsonUtilities",
|
||||
"AssetRegistry", "EditorScriptingUtilities"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "GMCSettings.h"
|
||||
|
||||
UGMCSettings::UGMCSettings()
|
||||
{
|
||||
}
|
||||
|
||||
UGMCSettings::~UGMCSettings()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "GWindow.h"
|
||||
#include "GaeaSubsystem.h"
|
||||
#include "WorldPartition/WorldPartitionSubsystem.h"
|
||||
#include "PropertyEditorModule.h"
|
||||
#include "Widgets/Input/SButton.h"
|
||||
#include "Widgets/Layout/SScrollBox.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY(GaeaWindow)
|
||||
|
||||
SMCWindow::SMCWindow()
|
||||
{
|
||||
}
|
||||
|
||||
SMCWindow::~SMCWindow()
|
||||
{
|
||||
}
|
||||
|
||||
SGaeaImportWindow::SGaeaImportWindow()
|
||||
{
|
||||
}
|
||||
|
||||
SGaeaImportWindow::~SGaeaImportWindow()
|
||||
{
|
||||
if (ImporterSettings)
|
||||
{
|
||||
ImporterSettings->RemoveFromRoot();
|
||||
ImporterSettings = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void SGaeaImportWindow::Construct(const FArguments& InArgs)
|
||||
{
|
||||
|
||||
CreateDetailsView();
|
||||
|
||||
SWindow::Construct(SWindow::FArguments()
|
||||
.Title(InArgs._Title)
|
||||
.ClientSize(InArgs._ClientSize)
|
||||
.SizingRule(InArgs._SizingRule)
|
||||
);
|
||||
|
||||
|
||||
this->SetContent(SNew(SVerticalBox)
|
||||
+ SVerticalBox::Slot()
|
||||
.FillHeight(1)
|
||||
[
|
||||
SNew(SScrollBox)
|
||||
+ SScrollBox::Slot()
|
||||
[
|
||||
PropertyWidget.ToSharedRef()
|
||||
]
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.AutoHeight()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Bottom)
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
.FillWidth(0.5)
|
||||
[
|
||||
SNew(SButton)
|
||||
.Text(FText::FromString(("Import Heightmap")))
|
||||
.HAlign(HAlign_Center)
|
||||
.VAlign(VAlign_Center)
|
||||
.ButtonColorAndOpacity(FLinearColor::Gray)
|
||||
.OnClicked(this, &SGaeaImportWindow::OnImportClicked)
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
.FillWidth(0.5)
|
||||
[
|
||||
SNew(SButton)
|
||||
.Text(FText::FromString(("Create Landscape")))
|
||||
.HAlign(HAlign_Center)
|
||||
.VAlign(VAlign_Center)
|
||||
.IsEnabled_Lambda([this]() {return ImporterSettings != nullptr
|
||||
&& !ImporterSettings->HeightMapFileName.IsEmpty()
|
||||
&& (ImporterSettings->WeightmapFileNames.Num() == 0
|
||||
|| ImporterSettings->LandscapeMaterialLayerNames.Num() == 0
|
||||
|| ImporterSettings->WeightmapFileNames.Num() < ImporterSettings->LandscapeMaterialLayerNames.Num());})
|
||||
.ButtonColorAndOpacity(FColor::Emerald)
|
||||
.OnClicked(this, &SGaeaImportWindow::OnCreateLandscapeClicked)
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SGaeaImportWindow::CreateDetailsView()
|
||||
{
|
||||
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
|
||||
|
||||
FDetailsViewArgs Args;
|
||||
Args.bAllowSearch = false;
|
||||
Args.bHideSelectionTip = true;
|
||||
Args.bShowScrollBar = true;
|
||||
|
||||
ImporterSettings = NewObject<UImporterPanelSettings>();
|
||||
ImporterSettings->AddToRoot();
|
||||
PropertyWidget = PropertyModule.CreateDetailView(Args);
|
||||
PropertyWidget->SetObject(ImporterSettings);
|
||||
|
||||
ImporterSettings->Components = FIntPoint(8,8);
|
||||
ImporterSettings->Resolution = FIntPoint(505,505);
|
||||
ImporterSettings->TotalComponents = ImporterSettings->Components.X * ImporterSettings->Components.Y;
|
||||
}
|
||||
|
||||
FReply SGaeaImportWindow::OnImportClicked() const
|
||||
{
|
||||
if (UGaeaSubsystem* Manager = UGaeaSubsystem::GetGaeaSubsystem())
|
||||
{
|
||||
check(ImporterSettings != nullptr); // check if Importer Settings is valid
|
||||
Manager->ImportHeightmap(ImporterSettings->HeightMapFileName, ImporterSettings->jsonFileName, ImporterSettings->Scale, ImporterSettings->Location, ImporterSettings->WeightmapFileNames, ImporterSettings->StoredPath); // Set heightmap path, json path and scale
|
||||
UE_LOG(GaeaWindow, Display, TEXT("Heightmap file path is: %s"), *ImporterSettings->HeightMapFileName); // Log the heightmap file path
|
||||
UE_LOG(GaeaWindow, Display, TEXT("Json file path is: %s"), *ImporterSettings->jsonFileName); // Log the heightmap file path
|
||||
UE_LOG(GaeaWindow, Display, TEXT("Scale value is: %s"), *ImporterSettings->Scale.ToString()); // Log the scale
|
||||
return FReply::Handled();
|
||||
}
|
||||
return FReply::Handled();
|
||||
}
|
||||
|
||||
FReply SGaeaImportWindow::OnCreateLandscapeClicked()
|
||||
{
|
||||
if (UGaeaSubsystem* Manager = UGaeaSubsystem::GetGaeaSubsystem())
|
||||
{
|
||||
Manager->CreateLandscapeActor(ImporterSettings);
|
||||
return FReply::Handled();
|
||||
}
|
||||
|
||||
return FReply::Handled();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "GaeaCommands.h"
|
||||
#include "InputCoreTypes.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FGaea"
|
||||
|
||||
void FGaeaCommands::RegisterCommands()
|
||||
{
|
||||
UI_COMMAND(OpenImporter, "Open Importer", "Opens the Landscape Importer Window", EUserInterfaceActionType::Button, FInputChord(EKeys::P, EModifierKey::Control | EModifierKey::Alt));
|
||||
UI_COMMAND(DeleteSelectedWPLandscape, "Delete Selected WP Landscape", "Deletes a World Partitioned Landscape and its proxies", EUserInterfaceActionType::None, FInputChord(EKeys::V, EModifierKey::Control));
|
||||
}
|
||||
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
@@ -0,0 +1,76 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
#include "GaeaEditorStyle.h"
|
||||
|
||||
#include "Interfaces/IPluginManager.h"
|
||||
#include "Styling/CoreStyle.h"
|
||||
#include "Styling/SlateStyleRegistry.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY(GaeaEditorStyle)
|
||||
|
||||
TUniquePtr<FSlateStyleSet> FGaeaEditorStyle::StyleSet;
|
||||
|
||||
void FGaeaEditorStyle::Initialize()
|
||||
{
|
||||
if (StyleSet.IsValid())
|
||||
{
|
||||
// Only set up once
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the style sheet
|
||||
StyleSet = MakeUnique<FSlateStyleSet>(GetStyleSetName());
|
||||
|
||||
//const FString ContentDir = "All/Plugins/GaeaUnrealTools/Icons/";
|
||||
|
||||
/*static const FString ContentDir = IPluginManager::Get().FindPlugin(TEXT("GaeaUnrealTools"))->GetContentDir();
|
||||
UE_LOG(LogTemp, Warning, TEXT("Content Directory is: %s"), *ContentDir);
|
||||
|
||||
// Construct the relative path to the image file
|
||||
const FString IconPath = ContentDir + "/Icons/ImporterIcon.png";*/
|
||||
|
||||
FString PluginPath = FPaths::Combine(FPaths::ProjectPluginsDir(), TEXT("GaeaUnrealTools"));
|
||||
if (!FPaths::DirectoryExists(PluginPath))
|
||||
PluginPath = FPaths::Combine(FPaths::EnginePluginsDir(), TEXT("GaeaUnrealTools"));
|
||||
|
||||
if (FPaths::DirectoryExists(PluginPath))
|
||||
{
|
||||
// Plugin found, construct the resources path
|
||||
const FString ResourcesPath = FPaths::Combine(PluginPath, TEXT("Resources"));
|
||||
UE_LOG(GaeaEditorStyle, Display, TEXT("Resources Directory is: %s"), *ResourcesPath);
|
||||
|
||||
// Construct the relative path to the image file
|
||||
const FString IconPath = ResourcesPath + "/ImporterIcon.png";
|
||||
StyleSet->Set("ImporterIcon", new FSlateImageBrush(IconPath, FVector2D(40.0f, 40.0f)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Plugin not found
|
||||
UE_LOG(GaeaEditorStyle, Warning, TEXT("GaeaUnrealTools plugin not found"));
|
||||
}
|
||||
|
||||
|
||||
// Register the style set
|
||||
FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get());
|
||||
}
|
||||
|
||||
void FGaeaEditorStyle::Shutdown()
|
||||
{
|
||||
// Unregister the style set
|
||||
if (StyleSet.IsValid())
|
||||
{
|
||||
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleSet.Get());
|
||||
StyleSet.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
FName FGaeaEditorStyle::GetStyleSetName()
|
||||
{
|
||||
static const FName StyleSetName(TEXT("GaeaEditorStyle"));
|
||||
return StyleSetName;
|
||||
}
|
||||
|
||||
FString FGaeaEditorStyle::RootToPluginContentDir(const FString& RelativePath, const TCHAR* Extension)
|
||||
{
|
||||
static const FString ContentDir = IPluginManager::Get().FindPlugin(TEXT("GaeaUnrealTools"))->GetContentDir();
|
||||
return (ContentDir / RelativePath) + Extension;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "GaeaLandscapeComponent.h"
|
||||
#include "Engine.h"
|
||||
|
||||
// Sets default values for this component's properties
|
||||
UGaeaLandscapeComponent::UGaeaLandscapeComponent()
|
||||
{
|
||||
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
|
||||
// off to improve performance if you don't need them.
|
||||
PrimaryComponentTick.bCanEverTick = false;
|
||||
bIsEditorOnly = true;
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Called when the game starts
|
||||
void UGaeaLandscapeComponent::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
// ...
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Called every frame
|
||||
void UGaeaLandscapeComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
{
|
||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
void UGaeaLandscapeComponent::DestroyComponent(bool bPromoteChildren)
|
||||
{
|
||||
if (GEngine)
|
||||
{
|
||||
// Display a message on the screen
|
||||
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("Attempted to delete the Gaea Landscape Component, but this operation is not allowed on landscapes created with the Gaea plugin."));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,262 @@
|
||||
#include "GaeaUEToolsEditor.h"
|
||||
#include "GaeaEditorStyle.h"
|
||||
#include "EditorStyleSet.h"
|
||||
#include "GaeaCommands.h"
|
||||
#include "LevelEditor.h"
|
||||
#include "Misc/CoreDelegates.h"
|
||||
#include "Subsystems/EditorActorSubsystem.h"
|
||||
#include "GaeaLandscapeComponent.h"
|
||||
#include "Landscape.h"
|
||||
#include "ToolMenus.h"
|
||||
#include "WorldPartition/WorldPartitionSubsystem.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY(GaeaUETools);
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FGaeaUEToolsEditorModule"
|
||||
|
||||
void FGaeaUEToolsEditorModule::StartupModule()
|
||||
{
|
||||
FGaeaEditorStyle::Initialize();
|
||||
FGaeaCommands::Register();
|
||||
/*UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(
|
||||
this, &FGaeaUEToolsEditorModule::RegisterMCWindow));*/ // Register Material Creator Callback
|
||||
|
||||
UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(
|
||||
this, &FGaeaUEToolsEditorModule::RegisterGaeaActorMenu));
|
||||
|
||||
/*UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(
|
||||
this, &FGaeaUEToolsEditorModule::RegisterLandscapeActorMenu));*/
|
||||
|
||||
|
||||
UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(
|
||||
this, &FGaeaUEToolsEditorModule::RegisterImporterWindow)); // Register Importer Callback
|
||||
|
||||
// Bind the commands
|
||||
const FLevelEditorModule& LevelEditor = FModuleManager::GetModuleChecked<FLevelEditorModule>("LevelEditor");
|
||||
const TSharedRef<FUICommandList> Commands = LevelEditor.GetGlobalLevelEditorActions();
|
||||
|
||||
Commands->MapAction(
|
||||
FGaeaCommands::Get().OpenImporter,
|
||||
FExecuteAction::CreateLambda([this]()
|
||||
{
|
||||
|
||||
UE_LOG(LogTemp, Log, TEXT("Opening Gaea Landscape Importer Window"));
|
||||
if (UGaeaSubsystem* GSubsystem = UGaeaSubsystem::GetGaeaSubsystem())
|
||||
{
|
||||
//UE_LOG(LogTemp, Log, TEXT("Opened Gaea Landscape Importer Window."));
|
||||
GSubsystem->SpawnGImporterWindow();
|
||||
}
|
||||
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void FGaeaUEToolsEditorModule::ShutdownModule()
|
||||
{
|
||||
FGaeaEditorStyle::Shutdown();
|
||||
FGaeaCommands::Unregister();
|
||||
UToolMenus::UnregisterOwner(this); //Unregister menu entry
|
||||
}
|
||||
|
||||
/*void FGaeaUEToolsEditorModule::RegisterMCWindow()
|
||||
{
|
||||
//Register owner for menu entry
|
||||
FToolMenuOwnerScoped OwnerScoped(this);
|
||||
|
||||
//Set our menu entry name
|
||||
constexpr TCHAR ParentMenuName[] = TEXT("ContentBrowser.Toolbar");
|
||||
UToolMenu* GaeaToolBar = UToolMenus::Get()->ExtendMenu(ParentMenuName);
|
||||
GaeaToolBar->StyleName = TEXT("GaeaToolbar");
|
||||
|
||||
//Find the section of the editor menu we want to add to
|
||||
//FToolMenuSection& Section = GaeaToolBar->FindOrAddSection("Tools");
|
||||
FToolMenuSection& Section = GaeaToolBar->AddSection(TEXT("Gaea Material Creator"), LOCTEXT("GaeaMaterialTools_Label", "GaeaMaterialTools"));
|
||||
|
||||
//Create and define our UI action
|
||||
FToolUIAction OpenGaeaMaterialAction;
|
||||
OpenGaeaMaterialAction.ExecuteAction = FToolMenuExecuteAction::CreateLambda([](const FToolMenuContext& InContext)
|
||||
{
|
||||
if ( UGaeaSubsystem* Manager = UGaeaSubsystem::GetGaeaSubsystem())
|
||||
{
|
||||
Manager->SpawnGMCWindow(); // Spawn Material Creator Window
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//Create our custom toolbar entry
|
||||
const FToolMenuEntry OpenGaeaLandscapeMaterialCreator = FToolMenuEntry::InitToolBarButton(
|
||||
TEXT("OpenGaeaLandscapeMaterialCreator"),
|
||||
OpenGaeaMaterialAction,
|
||||
LOCTEXT("OpenGaeaLandscapeMaterialCreator_Label", "Gaea Landscape Material Creation"),
|
||||
LOCTEXT("OpenGaeaLandscapeMaterialCreator_Label_Description", "Opens Gaea Material Creator"),
|
||||
FSlateIcon(FAppStyle::Get().GetStyleSetName(), TEXT("ClassIcon.Material")))
|
||||
;
|
||||
|
||||
//Add our custom menu entry to our previously selected menu section
|
||||
Section.AddEntry(OpenGaeaLandscapeMaterialCreator);
|
||||
}*/
|
||||
|
||||
void FGaeaUEToolsEditorModule::RegisterImporterWindow()
|
||||
{
|
||||
//Register owner for menu entry
|
||||
FToolMenuOwnerScoped OwnerScoped(this);
|
||||
|
||||
//Set our menu entry name
|
||||
constexpr TCHAR ParentMenuName[] = TEXT("LevelEditor.LevelEditorToolBar.User");
|
||||
UToolMenu* GaeaToolBar = UToolMenus::Get()->ExtendMenu(ParentMenuName);
|
||||
GaeaToolBar->StyleName = TEXT("GaeaToolbar");
|
||||
|
||||
//Find the section of the editor menu we want to add to
|
||||
//FToolMenuSection& Section = GaeaToolBar->FindOrAddSection("User");
|
||||
FToolMenuSection& Section = GaeaToolBar->AddSection(TEXT("Gaea Landscape Importer"), LOCTEXT("GaeaLandscapeImporter_Label", "GaeaImporterTools"));
|
||||
|
||||
//Create and define our UI action
|
||||
FToolUIAction OpenGaeaImporter;
|
||||
OpenGaeaImporter.ExecuteAction = FToolMenuExecuteAction::CreateLambda([](const FToolMenuContext& InContext)
|
||||
{
|
||||
if ( UGaeaSubsystem* Manager = UGaeaSubsystem::GetGaeaSubsystem())
|
||||
{
|
||||
Manager->SpawnGImporterWindow(); // Spawn Importer Window
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//Create our custom toolbar entry - OLD. Does not work with editor shortcut key.
|
||||
/*const FToolMenuEntry OpenGaeaLandscapeImporter = FToolMenuEntry::InitToolBarButton(
|
||||
TEXT("OpenGaeaLandscapeImporter"),
|
||||
OpenGaeaImporter,
|
||||
LOCTEXT("OpenGaeaLandscapeImporter_Label", "Gaea Landscape Importer"),
|
||||
LOCTEXT("OpenGaeaLandscapeImporter_Label_Description", "Opens Gaea Landscape Importer"),
|
||||
//FSlateIcon(FAppStyle::Get().GetStyleSetName(), TEXT("ClassIcon.LandscapeComponent")));
|
||||
FSlateIcon(FGaeaEditorStyle::GetStyleSetName(), TEXT("ImporterIcon"))
|
||||
);*/
|
||||
|
||||
const FToolMenuEntry OpenGaeaLandscapeImporter = FToolMenuEntry::InitToolBarButton(
|
||||
FGaeaCommands::Get().OpenImporter,
|
||||
LOCTEXT("OpenGaeaLandscapeImporter_Label", "Gaea Landscape Importer"),
|
||||
LOCTEXT("OpenGaeaLandscapeImporter_Label_Description", "Opens Gaea Landscape Importer"),
|
||||
FSlateIcon(FGaeaEditorStyle::GetStyleSetName(), TEXT("ImporterIcon"))
|
||||
);
|
||||
|
||||
|
||||
//Add our custom menu entry to our previously selected menu section
|
||||
Section.AddEntry(OpenGaeaLandscapeImporter);
|
||||
}
|
||||
|
||||
void FGaeaUEToolsEditorModule::RegisterGaeaActorMenu()
|
||||
{
|
||||
// Register owner for menu entry
|
||||
FToolMenuOwnerScoped OwnerScoped(this);
|
||||
|
||||
// Create menu entry button in a new sub-menu
|
||||
UToolMenu* Menu = UToolMenus::Get()->ExtendMenu("LevelEditor.ActorContextMenu");
|
||||
Menu->AddDynamicSection("GaeaOptions", FNewToolMenuDelegate::CreateLambda([this](UToolMenu* InMenu)
|
||||
{
|
||||
// This delegate is called when it is time to create the menu section
|
||||
UEditorActorSubsystem* ActorSubsystem = GEditor->GetEditorSubsystem<UEditorActorSubsystem>();
|
||||
if (ActorSubsystem)
|
||||
{
|
||||
const TArray<AActor*>& SelectedActors = ActorSubsystem->GetSelectedLevelActors();
|
||||
if (SelectedActors.Num() > 0)
|
||||
{
|
||||
AActor* Actor = SelectedActors[0];
|
||||
if (Actor && Actor->GetClass()->IsChildOf(ALandscape::StaticClass()))
|
||||
{
|
||||
if (UGaeaLandscapeComponent* GaeaComponent = Actor->FindComponentByClass<UGaeaLandscapeComponent>())
|
||||
{
|
||||
// If a Landscape is selected, then add an item to the section
|
||||
FToolMenuSection& Section = InMenu->AddSection("GaeaOptionsSection",
|
||||
FText::FromString("Gaea Options"),
|
||||
FToolMenuInsert("ActorGeneral", EToolMenuInsertType::Before));
|
||||
|
||||
Section.AddSubMenu(
|
||||
"GaeaLandscapeSubMenu",
|
||||
FText::FromString("Gaea Landscape Actions"),
|
||||
FText::FromString("Contains various actions for landscapes imported from Gaea"),
|
||||
FNewMenuDelegate::CreateRaw(this, &FGaeaUEToolsEditorModule::GaeaActorActions),
|
||||
false,
|
||||
FSlateIcon(FGaeaEditorStyle::GetStyleSetName(), TEXT("ImporterIcon"))
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
void FGaeaUEToolsEditorModule::GaeaActorActions(FMenuBuilder& MenuBuilder)
|
||||
{
|
||||
FUIAction ExecuteReimportGaeaLandscape(
|
||||
FExecuteAction::CreateLambda([]() {
|
||||
if (UGaeaSubsystem* Manager = UGaeaSubsystem::GetGaeaSubsystem())
|
||||
{
|
||||
UWorld* World = GEditor->GetEditorWorldContext().World();
|
||||
if (World)
|
||||
{
|
||||
if (World->IsPartitionedWorld())
|
||||
{
|
||||
Manager->ReimportGaeaWPTerrain(); // Reimport for World Partition
|
||||
}
|
||||
else
|
||||
{
|
||||
Manager->ReimportGaeaTerrain(); // Reimport for standard landscape
|
||||
}
|
||||
} // ReimportTerrain
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
MenuBuilder.AddMenuEntry(
|
||||
FText::FromString("Refresh Landscape in Place"),
|
||||
FText::FromString("Clears current landscape actor internal data and fills with the associated heightmap/weightmaps"),
|
||||
FSlateIcon(),
|
||||
ExecuteReimportGaeaLandscape
|
||||
);
|
||||
}
|
||||
|
||||
void FGaeaUEToolsEditorModule::RegisterLandscapeActorMenu()
|
||||
{
|
||||
FToolMenuOwnerScoped OwnerScoped(this);
|
||||
|
||||
UToolMenu* Menu = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorSceneOutliner.ContextMenu");
|
||||
|
||||
FToolMenuSection& Section = Menu->FindOrAddSection("ActorOptions");
|
||||
|
||||
Section.AddDynamicEntry("DeleteWPLandscapeEntry", FNewToolMenuSectionDelegate::CreateLambda([](FToolMenuSection& Section)
|
||||
{
|
||||
FToolMenuEntry Entry = FToolMenuEntry::InitMenuEntry(
|
||||
"DeleteWPLandscapeEntry",
|
||||
FText::FromString("Delete World Partitioned Landscape"),
|
||||
FText::FromString("Deletes selected landscape and its proxies."),
|
||||
FSlateIcon(FGaeaEditorStyle::GetStyleSetName(), "ImporterIcon"),
|
||||
FUIAction(
|
||||
FExecuteAction::CreateLambda([]()
|
||||
{
|
||||
if (UGaeaSubsystem* Subsystem = UGaeaSubsystem::GetGaeaSubsystem())
|
||||
{
|
||||
//Subsystem->DeleteWPLandscape();
|
||||
}
|
||||
}),
|
||||
FCanExecuteAction::CreateLambda([]()
|
||||
{
|
||||
UEditorActorSubsystem* ActorSubsystem = GEditor->GetEditorSubsystem<UEditorActorSubsystem>();
|
||||
const TArray<AActor*>& Selected = ActorSubsystem->GetSelectedLevelActors();
|
||||
const UWorld* World = GEditor->GetEditorWorldContext().World();
|
||||
const bool bWP = World->IsPartitionedWorld();
|
||||
return Selected.Num() > 0 && Selected[0]->IsA<ALandscape>() && bWP;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
Entry.InsertPosition = FToolMenuInsert("EditSubMenu", EToolMenuInsertType::After);
|
||||
Section.AddEntry(Entry);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FGaeaUEToolsEditorModule, GaeaUEToolsEditor)
|
||||
@@ -0,0 +1,14 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "GaeaWindow.h"
|
||||
|
||||
SGaeaWindow::SGaeaWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SGaeaWindow::~SGaeaWindow()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "ImporterPanelSettings.h"
|
||||
#include "GaeaSubsystem.h"
|
||||
|
||||
UImporterPanelSettings::UImporterPanelSettings()
|
||||
{
|
||||
}
|
||||
|
||||
UImporterPanelSettings::~UImporterPanelSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void UImporterPanelSettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
|
||||
{
|
||||
FName PropertyName = (PropertyChangedEvent.Property != nullptr) ? PropertyChangedEvent.Property->GetFName() : NAME_None;
|
||||
|
||||
if (PropertyName == GET_MEMBER_NAME_CHECKED(UImporterPanelSettings, WeightmapFileNames))
|
||||
{
|
||||
WeightmapFilePaths.Empty();
|
||||
for(int i = 0; i < WeightmapFileNames.Num(); i++)
|
||||
{
|
||||
FString FullPath = FPaths::Combine(*StoredPath, *WeightmapFileNames[i]);
|
||||
WeightmapFilePaths.Add(FullPath); // When WeightmapFileNames is reordered or changed, we mutate WeightmapFilePaths to generate the full paths. This is for UX benefits, and the paths will be used later with the actual layer system.
|
||||
|
||||
}
|
||||
}
|
||||
else if (PropertyName == GET_MEMBER_NAME_CHECKED(UImporterPanelSettings, LandscapeMaterial))
|
||||
{
|
||||
UGaeaSubsystem* Manager = UGaeaSubsystem::GetGaeaSubsystem();
|
||||
TArray<UMaterialExpressionLandscapeLayerBlend*> BlendNodes = Manager->GetLandscapeLayerBlendNodes(LandscapeMaterial);
|
||||
Manager->GetLandscapeLayerBlendNames(BlendNodes, LandscapeMaterialLayerNames);
|
||||
}
|
||||
|
||||
|
||||
Super::PostEditChangeProperty(PropertyChangedEvent);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class GaeaUnrealTools : ModuleRules
|
||||
{
|
||||
public GaeaUnrealTools(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add public include paths required here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add other private include paths required here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
// ... add other public dependencies that you statically link with here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
// ... add private dependencies that you statically link with here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
// ... add any modules that your module loads dynamically here ...
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "GaeaUnrealTools.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FGaeaUnrealToolsModule"
|
||||
|
||||
void FGaeaUnrealToolsModule::StartupModule()
|
||||
{
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||
}
|
||||
|
||||
void FGaeaUnrealToolsModule::ShutdownModule()
|
||||
{
|
||||
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
||||
// we call this function before unloading the module.
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FGaeaUnrealToolsModule, GaeaUnrealTools)
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
class FGaeaUnrealToolsModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
};
|
||||
Reference in New Issue
Block a user