You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
59 lines
1.9 KiB
C++
59 lines
1.9 KiB
C++
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||
|
|
|
||
|
|
#include "GeometryCacheModulePrivatePCH.h"
|
||
|
|
#include "GeometryCache.h"
|
||
|
|
#include "ActorFactoryGeometryCache.h"
|
||
|
|
#include "GeometryCacheActor.h"
|
||
|
|
#include "GeometryCacheComponent.h"
|
||
|
|
|
||
|
|
UActorFactoryGeometryCache::UActorFactoryGeometryCache(const FObjectInitializer& ObjectInitializer)
|
||
|
|
: Super(ObjectInitializer)
|
||
|
|
{
|
||
|
|
DisplayName = FText::FromString( "Geometry Cache" );
|
||
|
|
NewActorClass = AGeometryCacheActor::StaticClass();
|
||
|
|
bUseSurfaceOrientation = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
bool UActorFactoryGeometryCache::CanCreateActorFrom(const FAssetData& AssetData, FText& OutErrorMsg)
|
||
|
|
{
|
||
|
|
if (!AssetData.IsValid() || !AssetData.GetClass()->IsChildOf(UGeometryCache::StaticClass()))
|
||
|
|
{
|
||
|
|
OutErrorMsg = FText::FromString("A valid GeometryCache must be specified.");
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
void UActorFactoryGeometryCache::PostSpawnActor(UObject* Asset, AActor* NewActor)
|
||
|
|
{
|
||
|
|
Super::PostSpawnActor(Asset, NewActor);
|
||
|
|
|
||
|
|
UGeometryCache* GeometryCache = CastChecked<UGeometryCache>(Asset);
|
||
|
|
|
||
|
|
// Change properties
|
||
|
|
AGeometryCacheActor* GeometryCacheActor = CastChecked<AGeometryCacheActor>(NewActor);
|
||
|
|
UGeometryCacheComponent* GeometryCacheComponent = GeometryCacheActor->GetGeometryCacheComponent();
|
||
|
|
check(GeometryCacheComponent);
|
||
|
|
|
||
|
|
GeometryCacheComponent->UnregisterComponent();
|
||
|
|
|
||
|
|
// Set GeometryCache (data) instance
|
||
|
|
GeometryCacheComponent->GeometryCache = GeometryCache;
|
||
|
|
|
||
|
|
// Init Component
|
||
|
|
GeometryCacheComponent->RegisterComponent();
|
||
|
|
}
|
||
|
|
|
||
|
|
void UActorFactoryGeometryCache::PostCreateBlueprint(UObject* Asset, AActor* CDO)
|
||
|
|
{
|
||
|
|
if (Asset != NULL && CDO != NULL)
|
||
|
|
{
|
||
|
|
// Set GeometryCache (data) instance
|
||
|
|
UGeometryCache* GeometryCache = CastChecked<UGeometryCache>(Asset);
|
||
|
|
AGeometryCacheActor* GeometryCacheActor = CastChecked<AGeometryCacheActor>(CDO);
|
||
|
|
UGeometryCacheComponent* GeometryCacheComponent = GeometryCacheActor->GetGeometryCacheComponent();
|
||
|
|
|
||
|
|
GeometryCacheComponent->GeometryCache = GeometryCache;
|
||
|
|
}
|
||
|
|
}
|