You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Before: 3548 unity files Total CPU Time: 47343.578125 s Total time in Parallel executor: 494.60 seconds After: 3445 unity files Total CPU Time: 46044.671875 s Total time in Parallel executor: 468.51 seconds #jira #preflight 63336159b20e73a098b7f24f [CL 22218213 by bryan sefcik in ue5-main branch]
91 lines
2.7 KiB
C++
91 lines
2.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "GenericSmartObject.h"
|
|
#include "UObject/ConstructorHelpers.h"
|
|
#include "Components/ArrowComponent.h"
|
|
#include "Components/SceneComponent.h"
|
|
#include "Engine/Texture2D.h"
|
|
#include "Components/BillboardComponent.h"
|
|
#include "SmartObjectRenderingComponent.h"
|
|
#include "SmartObjectComponent.h"
|
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(GenericSmartObject)
|
|
|
|
#if WITH_EDITOR
|
|
#include "ObjectEditorUtils.h"
|
|
#endif // WITH_EDITOR
|
|
|
|
|
|
AGenericSmartObject::AGenericSmartObject(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
USceneComponent* SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComp"));
|
|
RootComponent = SceneComponent;
|
|
RootComponent->Mobility = EComponentMobility::Static;
|
|
|
|
SOComponent = CreateDefaultSubobject<USmartObjectComponent>(TEXT("SmartObjectComp"));
|
|
SOComponent->SetupAttachment(RootComponent);
|
|
|
|
#if WITH_EDITORONLY_DATA
|
|
UBillboardComponent* SpriteComponent = CreateEditorOnlyDefaultSubobject<UBillboardComponent>(TEXT("Sprite"));
|
|
RenderingComponent = CreateEditorOnlyDefaultSubobject<USmartObjectRenderingComponent>(TEXT("RenderComp"));
|
|
|
|
if (!IsRunningCommandlet())
|
|
{
|
|
// Structure to hold one-time initialization
|
|
struct FConstructorStatics
|
|
{
|
|
ConstructorHelpers::FObjectFinderOptional<UTexture2D> NoteTextureObject;
|
|
FName NotesID;
|
|
FText GenericSOName;
|
|
FConstructorStatics()
|
|
: NoteTextureObject(TEXT("/SmartObjects/S_BrainInBox"))
|
|
, NotesID(TEXT("SmartObject"))
|
|
, GenericSOName(NSLOCTEXT("SpriteCategory", "GenericSO", "GenericSO"))
|
|
{
|
|
}
|
|
};
|
|
static FConstructorStatics ConstructorStatics;
|
|
if (SpriteComponent)
|
|
{
|
|
SpriteComponent->Sprite = ConstructorStatics.NoteTextureObject.Get();
|
|
SpriteComponent->SetRelativeScale3D_Direct(FVector(0.5f, 0.5f, 0.5f));
|
|
SpriteComponent->SpriteInfo.Category = ConstructorStatics.NotesID;
|
|
SpriteComponent->SpriteInfo.DisplayName = ConstructorStatics.GenericSOName;
|
|
SpriteComponent->SetupAttachment(RootComponent);
|
|
SpriteComponent->Mobility = EComponentMobility::Static;
|
|
}
|
|
|
|
if (RenderingComponent)
|
|
{
|
|
RenderingComponent->SetupAttachment(RootComponent);
|
|
}
|
|
}
|
|
|
|
#endif // WITH_EDITORONLY_DATA
|
|
|
|
SetHidden(true);
|
|
SetCanBeDamaged(false);
|
|
}
|
|
|
|
#if WITH_EDITOR
|
|
void AGenericSmartObject::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
|
|
{
|
|
static const FName SmartObjectName = FName(TEXT("SmartObject"));
|
|
|
|
Super::PostEditChangeProperty(PropertyChangedEvent);
|
|
|
|
if (PropertyChangedEvent.Property)
|
|
{
|
|
if (FObjectEditorUtils::GetCategoryFName(PropertyChangedEvent.Property) == SmartObjectName)
|
|
{
|
|
if (RenderingComponent)
|
|
{
|
|
MarkComponentsRenderStateDirty();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif // WITH_EDITOR
|
|
|