Updates proejct with tree spawning, json loader etc.
This commit is contained in:
BIN
Plugins/ForestImporter/Content/Blueprints/BP_FIForestSpawner.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/ForestImporter/Content/Blueprints/BP_FIForestSpawner.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Plugins/ForestImporter/Content/DataDefinitions/FFIForestData.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/ForestImporter/Content/DataDefinitions/FFIForestData.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Plugins/ForestImporter/Content/DataDefinitions/ForestData.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/ForestImporter/Content/DataDefinitions/ForestData.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Plugins/ForestImporter/Content/EditorBlueprints/EBP_ForestImporter.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/ForestImporter/Content/EditorBlueprints/EBP_ForestImporter.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@@ -0,0 +1,17 @@
|
||||
[
|
||||
{"Name":"1","x":"-15.12","y":"7.64","z":"-5.40682839506173","r":"0.0479799561281845","dbh":"9.6","h":"9.444"},
|
||||
{"Name":"2","x":"-6.88","y":"10.26","z":"-0.243574999999998","r":"0.0419804284258564","dbh":"8.4","h":"11.3532"},
|
||||
{"Name":"3","x":"-2.06999999999999","y":"10.64","z":"2.45335828877006","r":"0.190900975744225","dbh":"38.2","h":"9.707"},
|
||||
{"Name":"4","x":"-4.83","y":"14.3","z":"1.67841221122112","r":"0.143288313874472","dbh":"28.7","h":"10.4663"},
|
||||
{"Name":"5","x":"-15.92","y":"15.29","z":"-4.08376397058823","r":"0.25582628359995","dbh":"51.2","h":"13.2696"},
|
||||
{"Name":"6","x":"0.510000000000005","y":"15.66","z":"5.12503727272727","r":"0.248212293732132","dbh":"49.6","h":"10.5504"},
|
||||
{"Name":"7","x":"-15.5","y":"17.96","z":"-2.80311261682243","r":"0.207707718070789","dbh":"41.5","h":"10.5709"},
|
||||
{"Name":"8","x":"-5.98","y":"18.47","z":"2.27009333333334","r":"0.0690890157121087","dbh":"13.8","h":"11.7931"},
|
||||
{"Name":"9","x":"-14.43","y":"20.64","z":"-2.49187435897436","r":"0.224657636678472","dbh":"44.9","h":"11.1663"},
|
||||
{"Name":"10","x":"-3.3","y":"20.26","z":"4.4628838362069","r":"0.234632402008446","dbh":"46.9","h":"26.1493"},
|
||||
{"Name":"11","x":"-7.28","y":"21.27","z":"1.90214520958084","r":"0.122116516019407","dbh":"24.4","h":"8.8303"},
|
||||
{"Name":"12","x":"-5.36","y":"21.83","z":"3.32361354166667","r":"0.221026336614948","dbh":"44.2","h":"26.4361"},
|
||||
{"Name":"13","x":"-9.16","y":"23.43","z":"1.50600110132159","r":"0.276642239001447","dbh":"55.3","h":"9.0957"},
|
||||
{"Name":"14","x":"-9","y":"26.02","z":"2.61905555555556","r":"0.0254846663744571","dbh":"5.1","h":"23.765"},
|
||||
{"Name":"15","x":"-0.109999999999999","y":"27.19","z":"7.17721333333334","r":"0.159445021558632","dbh":"31.9","h":"25.2112"}
|
||||
]
|
||||
BIN
Plugins/ForestImporter/ForestImporter.uplugin
Normal file
BIN
Plugins/ForestImporter/ForestImporter.uplugin
Normal file
Binary file not shown.
BIN
Plugins/ForestImporter/Resources/Icon128.png
(Stored with Git LFS)
Normal file
BIN
Plugins/ForestImporter/Resources/Icon128.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@@ -0,0 +1,56 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class ForestImporter : ModuleRules
|
||||
{
|
||||
public ForestImporter(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",
|
||||
"InputCore",
|
||||
"UnrealEd",
|
||||
"LevelEditor",
|
||||
// ... 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,24 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "ForestImporter.h"
|
||||
#include "ForestImporterEdMode.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FForestImporterModule"
|
||||
|
||||
void FForestImporterModule::StartupModule()
|
||||
{
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||
FEditorModeRegistry::Get().RegisterMode<FForestImporterEdMode>(FForestImporterEdMode::EM_ForestImporterEdModeId,
|
||||
LOCTEXT("ForestImporterEdModeName", "ForestImporterEdMode"), FSlateIcon(), true);
|
||||
}
|
||||
|
||||
void FForestImporterModule::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.
|
||||
FEditorModeRegistry::Get().UnregisterMode(FForestImporterEdMode::EM_ForestImporterEdModeId);
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FForestImporterModule, ForestImporter)
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "ForestImporterEdMode.h"
|
||||
#include "ForestImporterEdModeToolkit.h"
|
||||
#include "Toolkits/ToolkitManager.h"
|
||||
#include "EditorModeManager.h"
|
||||
|
||||
const FEditorModeID FForestImporterEdMode::EM_ForestImporterEdModeId = TEXT("EM_ForestImporterEdMode");
|
||||
|
||||
FForestImporterEdMode::FForestImporterEdMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
FForestImporterEdMode::~FForestImporterEdMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FForestImporterEdMode::Enter()
|
||||
{
|
||||
FEdMode::Enter();
|
||||
|
||||
if (!Toolkit.IsValid() && UsesToolkits())
|
||||
{
|
||||
Toolkit = MakeShareable(new FForestImporterEdModeToolkit);
|
||||
Toolkit->Init(Owner->GetToolkitHost());
|
||||
}
|
||||
}
|
||||
|
||||
void FForestImporterEdMode::Exit()
|
||||
{
|
||||
if (Toolkit.IsValid())
|
||||
{
|
||||
FToolkitManager::Get().CloseToolkit(Toolkit.ToSharedRef());
|
||||
Toolkit.Reset();
|
||||
}
|
||||
|
||||
// Call base Exit method to ensure proper cleanup
|
||||
FEdMode::Exit();
|
||||
}
|
||||
|
||||
bool FForestImporterEdMode::UsesToolkits() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "ForestImporterEdModeToolkit.h"
|
||||
#include "ForestImporterEdMode.h"
|
||||
#include "Engine/Selection.h"
|
||||
#include "Widgets/Input/SButton.h"
|
||||
#include "Widgets/Text/STextBlock.h"
|
||||
#include "EditorModeManager.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FForestImporterEdModeToolkit"
|
||||
|
||||
FForestImporterEdModeToolkit::FForestImporterEdModeToolkit()
|
||||
{
|
||||
}
|
||||
|
||||
void FForestImporterEdModeToolkit::Init(const TSharedPtr<IToolkitHost>& InitToolkitHost)
|
||||
{
|
||||
struct Locals
|
||||
{
|
||||
static bool IsWidgetEnabled()
|
||||
{
|
||||
return GEditor->GetSelectedActors()->Num() != 0;
|
||||
}
|
||||
|
||||
static FReply OnButtonClick(FVector InOffset)
|
||||
{
|
||||
USelection* SelectedActors = GEditor->GetSelectedActors();
|
||||
|
||||
// Let editor know that we're about to do something that we want to undo/redo
|
||||
GEditor->BeginTransaction(LOCTEXT("MoveActorsTransactionName", "MoveActors"));
|
||||
|
||||
// For each selected actor
|
||||
for (FSelectionIterator Iter(*SelectedActors); Iter; ++Iter)
|
||||
{
|
||||
if (AActor* LevelActor = Cast<AActor>(*Iter))
|
||||
{
|
||||
// Register actor in opened transaction (undo/redo)
|
||||
LevelActor->Modify();
|
||||
// Move actor to given location
|
||||
LevelActor->TeleportTo(LevelActor->GetActorLocation() + InOffset, FRotator(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
// We're done moving actors so close transaction
|
||||
GEditor->EndTransaction();
|
||||
|
||||
return FReply::Handled();
|
||||
}
|
||||
|
||||
static TSharedRef<SWidget> MakeButton(FText InLabel, const FVector InOffset)
|
||||
{
|
||||
return SNew(SButton)
|
||||
.Text(InLabel)
|
||||
.OnClicked_Static(&Locals::OnButtonClick, InOffset);
|
||||
}
|
||||
};
|
||||
|
||||
const float Factor = 256.0f;
|
||||
|
||||
SAssignNew(ToolkitWidget, SBorder)
|
||||
.HAlign(HAlign_Center)
|
||||
.Padding(25)
|
||||
.IsEnabled_Static(&Locals::IsWidgetEnabled)
|
||||
[
|
||||
SNew(SVerticalBox)
|
||||
+ SVerticalBox::Slot()
|
||||
.AutoHeight()
|
||||
.HAlign(HAlign_Center)
|
||||
.Padding(50)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.AutoWrapText(true)
|
||||
.Text(LOCTEXT("HelperLabel", "Select some actors and move them around using buttons below"))
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.AutoHeight()
|
||||
[
|
||||
Locals::MakeButton(LOCTEXT("UpButtonLabel", "Up"), FVector(0, 0, Factor))
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+ SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
[
|
||||
Locals::MakeButton(LOCTEXT("LeftButtonLabel", "Left"), FVector(0, -Factor, 0))
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
[
|
||||
Locals::MakeButton(LOCTEXT("RightButtonLabel", "Right"), FVector(0, Factor, 0))
|
||||
]
|
||||
]
|
||||
+ SVerticalBox::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.AutoHeight()
|
||||
[
|
||||
Locals::MakeButton(LOCTEXT("DownButtonLabel", "Down"), FVector(0, 0, -Factor))
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
FModeToolkit::Init(InitToolkitHost);
|
||||
}
|
||||
|
||||
FName FForestImporterEdModeToolkit::GetToolkitFName() const
|
||||
{
|
||||
return FName("ForestImporterEdMode");
|
||||
}
|
||||
|
||||
FText FForestImporterEdModeToolkit::GetBaseToolkitName() const
|
||||
{
|
||||
return NSLOCTEXT("ForestImporterEdModeToolkit", "DisplayName", "ForestImporterEdMode Tool");
|
||||
}
|
||||
|
||||
class FEdMode* FForestImporterEdModeToolkit::GetEditorMode() const
|
||||
{
|
||||
return GLevelEditorModeTools().GetActiveMode(FForestImporterEdMode::EM_ForestImporterEdModeId);
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
class FForestImporterModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "EdMode.h"
|
||||
|
||||
class FForestImporterEdMode : public FEdMode
|
||||
{
|
||||
public:
|
||||
const static FEditorModeID EM_ForestImporterEdModeId;
|
||||
public:
|
||||
FForestImporterEdMode();
|
||||
virtual ~FForestImporterEdMode();
|
||||
|
||||
// FEdMode interface
|
||||
virtual void Enter() override;
|
||||
virtual void Exit() override;
|
||||
//virtual void Tick(FEditorViewportClient* ViewportClient, float DeltaTime) override;
|
||||
//virtual void Render(const FSceneView* View, FViewport* Viewport, FPrimitiveDrawInterface* PDI) override;
|
||||
//virtual void ActorSelectionChangeNotify() override;
|
||||
bool UsesToolkits() const override;
|
||||
// End of FEdMode interface
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Toolkits/BaseToolkit.h"
|
||||
|
||||
class FForestImporterEdModeToolkit : public FModeToolkit
|
||||
{
|
||||
public:
|
||||
|
||||
FForestImporterEdModeToolkit();
|
||||
|
||||
/** FModeToolkit interface */
|
||||
virtual void Init(const TSharedPtr<IToolkitHost>& InitToolkitHost) override;
|
||||
|
||||
/** IToolkit interface */
|
||||
virtual FName GetToolkitFName() const override;
|
||||
virtual FText GetBaseToolkitName() const override;
|
||||
virtual class FEdMode* GetEditorMode() const override;
|
||||
virtual TSharedPtr<class SWidget> GetInlineContent() const override { return ToolkitWidget; }
|
||||
|
||||
private:
|
||||
|
||||
TSharedPtr<SWidget> ToolkitWidget;
|
||||
};
|
||||
Reference in New Issue
Block a user