Init
This commit is contained in:
0
Config/DefaultEditor.ini
Normal file
0
Config/DefaultEditor.ini
Normal file
70
Config/DefaultEngine.ini
Normal file
70
Config/DefaultEngine.ini
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
|
||||||
|
|
||||||
|
[/Script/EngineSettings.GameMapsSettings]
|
||||||
|
GameDefaultMap=/Game/Levels/Main.Main
|
||||||
|
EditorStartupMap=/Game/Levels/Main.Main
|
||||||
|
|
||||||
|
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
||||||
|
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
|
||||||
|
-D3D12TargetedShaderFormats=PCD3D_SM5
|
||||||
|
+D3D12TargetedShaderFormats=PCD3D_SM6
|
||||||
|
-D3D11TargetedShaderFormats=PCD3D_SM5
|
||||||
|
+D3D11TargetedShaderFormats=PCD3D_SM5
|
||||||
|
Compiler=Default
|
||||||
|
AudioSampleRate=48000
|
||||||
|
AudioCallbackBufferFrameSize=1024
|
||||||
|
AudioNumBuffersToEnqueue=1
|
||||||
|
AudioMaxChannels=0
|
||||||
|
AudioNumSourceWorkers=4
|
||||||
|
SpatializationPlugin=
|
||||||
|
SourceDataOverridePlugin=
|
||||||
|
ReverbPlugin=
|
||||||
|
OcclusionPlugin=
|
||||||
|
CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0)
|
||||||
|
CacheSizeKB=65536
|
||||||
|
MaxChunkSizeOverrideKB=0
|
||||||
|
bResampleForDevice=False
|
||||||
|
MaxSampleRate=48000.000000
|
||||||
|
HighSampleRate=32000.000000
|
||||||
|
MedSampleRate=24000.000000
|
||||||
|
LowSampleRate=12000.000000
|
||||||
|
MinSampleRate=8000.000000
|
||||||
|
CompressionQualityModifier=1.000000
|
||||||
|
AutoStreamingThreshold=0.000000
|
||||||
|
SoundCueCookQualityIndex=-1
|
||||||
|
|
||||||
|
[/Script/HardwareTargeting.HardwareTargetingSettings]
|
||||||
|
TargetedHardwareClass=Desktop
|
||||||
|
AppliedTargetedHardwareClass=Desktop
|
||||||
|
DefaultGraphicsPerformance=Maximum
|
||||||
|
AppliedDefaultGraphicsPerformance=Maximum
|
||||||
|
|
||||||
|
[/Script/Engine.RendererSettings]
|
||||||
|
r.GenerateMeshDistanceFields=True
|
||||||
|
r.DynamicGlobalIlluminationMethod=1
|
||||||
|
r.ReflectionMethod=1
|
||||||
|
r.Shadow.Virtual.Enable=1
|
||||||
|
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
|
||||||
|
|
||||||
|
[/Script/WorldPartitionEditor.WorldPartitionEditorSettings]
|
||||||
|
CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet'
|
||||||
|
|
||||||
|
[/Script/Engine.Engine]
|
||||||
|
+ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/UE5_GridTool")
|
||||||
|
+ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/UE5_GridTool")
|
||||||
|
+ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="UE5_GridToolGameModeBase")
|
||||||
|
|
||||||
|
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
|
||||||
|
bEnablePlugin=True
|
||||||
|
bAllowNetworkConnection=True
|
||||||
|
SecurityToken=1E5C251E4FE5E97D0DE06C9C4F292D89
|
||||||
|
bIncludeInShipping=False
|
||||||
|
bAllowExternalStartInShipping=False
|
||||||
|
bCompileAFSProject=False
|
||||||
|
bUseCompression=False
|
||||||
|
bLogFiles=False
|
||||||
|
bReportStats=False
|
||||||
|
ConnectionType=USBOnly
|
||||||
|
bUseManualIPAddress=False
|
||||||
|
ManualIPAddress=
|
||||||
|
|
||||||
3
Config/DefaultGame.ini
Normal file
3
Config/DefaultGame.ini
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
[/Script/EngineSettings.GeneralProjectSettings]
|
||||||
|
ProjectID=8541077E41E6FCEB2E0EE49C8DCD06BF
|
||||||
85
Config/DefaultInput.ini
Normal file
85
Config/DefaultInput.ini
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
[/Script/Engine.InputSettings]
|
||||||
|
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||||
|
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||||
|
-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||||
|
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||||
|
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||||
|
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||||
|
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||||
|
bAltEnterTogglesFullscreen=True
|
||||||
|
bF11TogglesFullscreen=True
|
||||||
|
bUseMouseForTouch=False
|
||||||
|
bEnableMouseSmoothing=True
|
||||||
|
bEnableFOVScaling=True
|
||||||
|
bCaptureMouseOnLaunch=True
|
||||||
|
bEnableLegacyInputScales=True
|
||||||
|
bEnableMotionControls=True
|
||||||
|
bFilterInputByPlatformUser=False
|
||||||
|
bShouldFlushPressedKeysOnViewportFocusLost=True
|
||||||
|
bAlwaysShowTouchInterface=False
|
||||||
|
bShowConsoleOnFourFingerTap=True
|
||||||
|
bEnableGestureRecognizer=False
|
||||||
|
bUseAutocorrect=False
|
||||||
|
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
|
||||||
|
DefaultViewportMouseLockMode=LockOnCapture
|
||||||
|
FOVScale=0.011110
|
||||||
|
DoubleClickTime=0.200000
|
||||||
|
DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput
|
||||||
|
DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent
|
||||||
|
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
|
||||||
|
-ConsoleKeys=Tilde
|
||||||
|
+ConsoleKeys=Tilde
|
||||||
|
+ConsoleKeys=Caret
|
||||||
|
|
||||||
BIN
Content/Blueprints/BP_LevelChunk.uasset
Normal file
BIN
Content/Blueprints/BP_LevelChunk.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprints/SpawnableElements/BP_SpawnableBox.uasset
Normal file
BIN
Content/Blueprints/SpawnableElements/BP_SpawnableBox.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/SpawnableElements/BP_SpawnableSphere.uasset
Normal file
BIN
Content/Blueprints/SpawnableElements/BP_SpawnableSphere.uasset
Normal file
Binary file not shown.
BIN
Content/Levels/Main.umap
Normal file
BIN
Content/Levels/Main.umap
Normal file
Binary file not shown.
15
Source/UE5_GridTool.Target.cs
Normal file
15
Source/UE5_GridTool.Target.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
using UnrealBuildTool;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
public class UE5_GridToolTarget : TargetRules
|
||||||
|
{
|
||||||
|
public UE5_GridToolTarget( TargetInfo Target) : base(Target)
|
||||||
|
{
|
||||||
|
Type = TargetType.Game;
|
||||||
|
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||||
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||||
|
ExtraModuleNames.Add("UE5_GridTool");
|
||||||
|
}
|
||||||
|
}
|
||||||
84
Source/UE5_GridTool/LevelChunk.cpp
Normal file
84
Source/UE5_GridTool/LevelChunk.cpp
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
#include "LevelChunk.h"
|
||||||
|
|
||||||
|
ALevelChunk::ALevelChunk()
|
||||||
|
{
|
||||||
|
PrimaryActorTick.bCanEverTick = false;
|
||||||
|
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
|
||||||
|
SetupGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
void ALevelChunk::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
CleanupComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALevelChunk::SetupGrid() {
|
||||||
|
// Set XYZ base points. Next we will offset each next slot from these points
|
||||||
|
float ZBase = -(100.f * (SizeZ - 1) / 2);
|
||||||
|
float XBase = -(100.f * (SizeX - 1) / 2);
|
||||||
|
float YBase = -(100.f * (SizeY - 1) / 2);
|
||||||
|
int32 Count = 0;
|
||||||
|
|
||||||
|
// Z axis loop
|
||||||
|
for (int32 z = 0; z < SizeZ; ++z) {
|
||||||
|
float ZOffset = ZBase + (100.f * z);
|
||||||
|
|
||||||
|
// X axis loop
|
||||||
|
for (int32 x = 0; x < SizeX; ++x) {
|
||||||
|
float XOffset = XBase + (100.f * x);
|
||||||
|
|
||||||
|
// Y axis loop
|
||||||
|
for (int32 y = 0; y < SizeY; ++y) {
|
||||||
|
float YOffset = YBase + (100.f * y);
|
||||||
|
ULevelGridSlot* ThisSlot = CreateDefaultSubobject<ULevelGridSlot>(*FString::Printf(TEXT("GridSlot %i"), Count));
|
||||||
|
UStaticMeshComponent* PreviewMesh = CreateDefaultSubobject<UStaticMeshComponent>(*FString::Printf(TEXT("PreviewMesh %i"), Count));
|
||||||
|
ThisSlot->Index = Count;
|
||||||
|
ThisSlot->SetupAttachment(RootComponent);
|
||||||
|
ThisSlot->EditorScale = 0.25f;
|
||||||
|
ThisSlot->SetRelativeLocation(FVector(XOffset, YOffset, ZOffset));
|
||||||
|
PreviewMesh->SetRelativeLocation(FVector(XOffset, YOffset, ZOffset));
|
||||||
|
Slots.Add(ThisSlot);
|
||||||
|
PreviewMeshes.Add(PreviewMesh);
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preview elements --- Go through all of the slots and if given slot has any class chosen, and that class has any static mesh, set corresponding PreviewMesh to display that mesh.
|
||||||
|
void ALevelChunk::PreviewElements() {
|
||||||
|
for (ULevelGridSlot* Slot : Slots) {
|
||||||
|
if (IsValid(Slot)) {
|
||||||
|
|
||||||
|
UClass* Class = Slot->ResolveClass();
|
||||||
|
if (IsValid(Class)) {
|
||||||
|
|
||||||
|
ASpawnableElement* DefaultObject = Cast<ASpawnableElement>(Class->GetDefaultObject());
|
||||||
|
if (IsValid(DefaultObject->StaticMesh)) {
|
||||||
|
PreviewMeshes[Slot->Index]->SetStaticMesh(DefaultObject->StaticMesh->GetStaticMesh());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set all PreviewMeshes to nullptr
|
||||||
|
void ALevelChunk::HidePreview() {
|
||||||
|
int32 Count = 0;
|
||||||
|
for (UStaticMeshComponent* PreviewMesh : PreviewMeshes) {
|
||||||
|
if (IsValid(PreviewMesh)) {
|
||||||
|
|
||||||
|
PreviewMesh->SetStaticMesh(nullptr);
|
||||||
|
}
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALevelChunk::CleanupComponents() {
|
||||||
|
for (UStaticMeshComponent* PreviewMesh : PreviewMeshes) {
|
||||||
|
PreviewMesh->UnregisterComponent();
|
||||||
|
}
|
||||||
|
PreviewMeshes.Empty();
|
||||||
|
}
|
||||||
55
Source/UE5_GridTool/LevelChunk.h
Normal file
55
Source/UE5_GridTool/LevelChunk.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "LevelGridSlot.h"
|
||||||
|
#include "Components/SceneComponent.h"
|
||||||
|
#include "Components/StaticMeshComponent.h"
|
||||||
|
#include "SpawnableElement.h"
|
||||||
|
#include "LevelChunk.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class UE5_GRIDTOOL_API ALevelChunk : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
ALevelChunk();
|
||||||
|
|
||||||
|
// --- Variables
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actor Setup")
|
||||||
|
int32 SizeX = 6;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actor Setup")
|
||||||
|
int32 SizeY = 6;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actor Setup")
|
||||||
|
int32 SizeZ = 4;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly)
|
||||||
|
TArray<ULevelGridSlot*> Slots;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TArray<UStaticMeshComponent*> PreviewMeshes;
|
||||||
|
|
||||||
|
// --- Functions
|
||||||
|
|
||||||
|
// Remove preview elements
|
||||||
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Actor Methods")
|
||||||
|
void HidePreview();
|
||||||
|
|
||||||
|
// Temporarily spawn each element in this chunk
|
||||||
|
UFUNCTION(BlueprintCallable, CallInEditor, Category = "Actor Methods")
|
||||||
|
void PreviewElements();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void BeginPlay() override;
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void SetupGrid();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void CleanupComponents();
|
||||||
|
|
||||||
|
};
|
||||||
37
Source/UE5_GridTool/LevelGridSlot.cpp
Normal file
37
Source/UE5_GridTool/LevelGridSlot.cpp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include "LevelGridSlot.h"
|
||||||
|
|
||||||
|
// Sets default values for this component's properties
|
||||||
|
ULevelGridSlot::ULevelGridSlot()
|
||||||
|
{
|
||||||
|
PrimaryComponentTick.bCanEverTick = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the game starts
|
||||||
|
void ULevelGridSlot::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
Spawn();
|
||||||
|
}
|
||||||
|
|
||||||
|
UClass* ULevelGridSlot::ResolveClass() {
|
||||||
|
UClass* Class = nullptr;
|
||||||
|
if (!Object.IsNull()) {
|
||||||
|
if (!Object.IsValid()) {
|
||||||
|
Class = Object.LoadSynchronous();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Class = Object.Get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Class;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ULevelGridSlot::Spawn() {
|
||||||
|
UClass* Class = ResolveClass();
|
||||||
|
|
||||||
|
if (IsValid(Class)) {
|
||||||
|
FActorSpawnParameters SpawnParams;
|
||||||
|
GetWorld()->SpawnActor<ASpawnableElement>(Class, this->GetComponentLocation(), this->GetComponentRotation(), SpawnParams);
|
||||||
|
}
|
||||||
|
this->DestroyComponent();
|
||||||
|
}
|
||||||
36
Source/UE5_GridTool/LevelGridSlot.h
Normal file
36
Source/UE5_GridTool/LevelGridSlot.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "SpawnableElement.h"
|
||||||
|
#include "Components/BillboardComponent.h"
|
||||||
|
#include "LevelGridSlot.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||||
|
class UE5_GRIDTOOL_API ULevelGridSlot : public UBillboardComponent
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this component's properties
|
||||||
|
ULevelGridSlot();
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actor Setup")
|
||||||
|
TSoftClassPtr<ASpawnableElement> Object;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
int32 Index;
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
UClass* ResolveClass();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Called when the game starts
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UFUNCTION()
|
||||||
|
void Spawn();
|
||||||
|
};
|
||||||
7
Source/UE5_GridTool/SpawnableElement.cpp
Normal file
7
Source/UE5_GridTool/SpawnableElement.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "SpawnableElement.h"
|
||||||
|
|
||||||
|
ASpawnableElement::ASpawnableElement()
|
||||||
|
{
|
||||||
|
PrimaryActorTick.bCanEverTick = false;
|
||||||
|
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
|
||||||
|
}
|
||||||
21
Source/UE5_GridTool/SpawnableElement.h
Normal file
21
Source/UE5_GridTool/SpawnableElement.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "Components/StaticMeshComponent.h"
|
||||||
|
#include "SpawnableElement.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class UE5_GRIDTOOL_API ASpawnableElement : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this actor's properties
|
||||||
|
ASpawnableElement();
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||||
|
UStaticMeshComponent* StaticMesh;
|
||||||
|
};
|
||||||
23
Source/UE5_GridTool/UE5_GridTool.Build.cs
Normal file
23
Source/UE5_GridTool/UE5_GridTool.Build.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
using UnrealBuildTool;
|
||||||
|
|
||||||
|
public class UE5_GridTool : ModuleRules
|
||||||
|
{
|
||||||
|
public UE5_GridTool(ReadOnlyTargetRules Target) : base(Target)
|
||||||
|
{
|
||||||
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
||||||
|
|
||||||
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
|
|
||||||
|
// Uncomment if you are using Slate UI
|
||||||
|
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||||
|
|
||||||
|
// Uncomment if you are using online features
|
||||||
|
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
|
||||||
|
|
||||||
|
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
|
||||||
|
}
|
||||||
|
}
|
||||||
6
Source/UE5_GridTool/UE5_GridTool.cpp
Normal file
6
Source/UE5_GridTool/UE5_GridTool.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "UE5_GridTool.h"
|
||||||
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
|
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, UE5_GridTool, "UE5_GridTool" );
|
||||||
6
Source/UE5_GridTool/UE5_GridTool.h
Normal file
6
Source/UE5_GridTool/UE5_GridTool.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
5
Source/UE5_GridTool/UE5_GridToolGameModeBase.cpp
Normal file
5
Source/UE5_GridTool/UE5_GridToolGameModeBase.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UE5_GridToolGameModeBase.h"
|
||||||
|
|
||||||
17
Source/UE5_GridTool/UE5_GridToolGameModeBase.h
Normal file
17
Source/UE5_GridTool/UE5_GridToolGameModeBase.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/GameModeBase.h"
|
||||||
|
#include "UE5_GridToolGameModeBase.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class UE5_GRIDTOOL_API AUE5_GridToolGameModeBase : public AGameModeBase
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
};
|
||||||
15
Source/UE5_GridToolEditor.Target.cs
Normal file
15
Source/UE5_GridToolEditor.Target.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
using UnrealBuildTool;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
public class UE5_GridToolEditorTarget : TargetRules
|
||||||
|
{
|
||||||
|
public UE5_GridToolEditorTarget( TargetInfo Target) : base(Target)
|
||||||
|
{
|
||||||
|
Type = TargetType.Editor;
|
||||||
|
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||||
|
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||||
|
ExtraModuleNames.Add("UE5_GridTool");
|
||||||
|
}
|
||||||
|
}
|
||||||
25
UE5_GridTool.uproject
Normal file
25
UE5_GridTool.uproject
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"FileVersion": 3,
|
||||||
|
"EngineAssociation": "5.1",
|
||||||
|
"Category": "",
|
||||||
|
"Description": "",
|
||||||
|
"Modules": [
|
||||||
|
{
|
||||||
|
"Name": "UE5_GridTool",
|
||||||
|
"Type": "Runtime",
|
||||||
|
"LoadingPhase": "Default",
|
||||||
|
"AdditionalDependencies": [
|
||||||
|
"Engine"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Plugins": [
|
||||||
|
{
|
||||||
|
"Name": "ModelingToolsEditorMode",
|
||||||
|
"Enabled": true,
|
||||||
|
"TargetAllowList": [
|
||||||
|
"Editor"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user