Merge from Release-Engine-Test @ 16624776 to UE5/Main

This represents UE4/Main @ 16579691 and Dev-PerfTest @ 16579576

[CL 16625248 by aurel cordonnier in ue5-main branch]
This commit is contained in:
aurel cordonnier
2021-06-10 13:13:24 -04:00
parent 249140a8d6
commit e0ad4e25df
1660 changed files with 288365 additions and 21768 deletions
@@ -14,7 +14,8 @@ namespace UnrealBuildTool.Rules
new string[]
{
"Core",
"DatasmithCore"
"DatasmithCore",
"DirectLink",
}
);
@@ -9,6 +9,7 @@
#include "DatasmithFacadeMesh.h"
#include "DatasmithFacadeMetaData.h"
#include "DatasmithFacadeTexture.h"
#include "DatasmithFacadeVariant.h"
// Datasmith SDK.
#include "DatasmithExporterManager.h"
@@ -221,6 +222,40 @@ void FDatasmithFacadeScene::RemoveTexture(
SceneRef->RemoveTexture(InTexturePtr->GetDatasmithTextureElement());
}
void FDatasmithFacadeScene::AddLevelVariantSets(
FDatasmithFacadeLevelVariantSets* InLevelVariantSetsPtr
)
{
if (InLevelVariantSetsPtr)
{
SceneRef->AddLevelVariantSets(InLevelVariantSetsPtr->GetDatasmithLevelVariantSets());
}
}
int32 FDatasmithFacadeScene::GetLevelVariantSetsCount() const
{
return SceneRef->GetLevelVariantSetsCount();
}
FDatasmithFacadeLevelVariantSets* FDatasmithFacadeScene::GetNewLevelVariantSets(
int32 LevelVariantSetsIndex
)
{
if (TSharedPtr<IDatasmithLevelVariantSetsElement> LevelVariantSetsElement = SceneRef->GetLevelVariantSets(LevelVariantSetsIndex))
{
return new FDatasmithFacadeLevelVariantSets(LevelVariantSetsElement.ToSharedRef());
}
return nullptr;
}
void FDatasmithFacadeScene::RemoveLevelVariantSets(
FDatasmithFacadeLevelVariantSets* InLevelVariantSetsPtr
)
{
SceneRef->RemoveLevelVariantSets(InLevelVariantSetsPtr->GetDatasmithLevelVariantSets());
}
void FDatasmithFacadeScene::AddMetaData(
FDatasmithFacadeMetaData* InMetaData
)
@@ -422,7 +457,8 @@ void FDatasmithFacadeScene::Shutdown()
}
bool FDatasmithFacadeScene::ExportScene(
const TCHAR* InOutputPath
const TCHAR* InOutputPath,
bool bCleanupUnusedElements
)
{
FString OutputPath = InOutputPath;
@@ -435,10 +471,10 @@ bool FDatasmithFacadeScene::ExportScene(
FString SceneFolder = FPaths::GetPath(OutputPath);
SetOutputPath(*SceneFolder);
return ExportScene();
return ExportScene(bCleanupUnusedElements);
}
bool FDatasmithFacadeScene::ExportScene()
bool FDatasmithFacadeScene::ExportScene(bool bCleanupUnusedElements)
{
if ( FCString::Strlen(SceneExporterRef->GetName()) == 0
|| FCString::Strlen(SceneExporterRef->GetOutputPath()) == 0)
@@ -447,7 +483,7 @@ bool FDatasmithFacadeScene::ExportScene()
}
// Export the Datasmith scene instance into its file.
SceneExporterRef->Export(SceneRef);
SceneExporterRef->Export(SceneRef, bCleanupUnusedElements);
return true;
}
@@ -0,0 +1,343 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "DatasmithFacadeVariant.h"
#include "DatasmithFacadeMaterial.h"
FDatasmithFacadePropertyCapture::FDatasmithFacadePropertyCapture()
: FDatasmithFacadeElement(FDatasmithSceneFactory::CreatePropertyCapture())
{
}
FDatasmithFacadePropertyCapture::FDatasmithFacadePropertyCapture(
const TSharedRef<IDatasmithBasePropertyCaptureElement>& InInternalPropertyCapture
) :
FDatasmithFacadeElement( InInternalPropertyCapture )
{
}
void FDatasmithFacadePropertyCapture::SetPropertyPath(const TCHAR* Path)
{
GetDatasmithPropertyCapture()->SetPropertyPath(Path);
}
const TCHAR* FDatasmithFacadePropertyCapture::GetPropertyPath()
{
return *GetDatasmithPropertyCapture()->GetPropertyPath();
}
EDatasmithFacadePropertyCategory FDatasmithFacadePropertyCapture::GetCategory() const
{
return static_cast<EDatasmithFacadePropertyCategory>(GetDatasmithPropertyCapture()->GetCategory());
}
TSharedRef<IDatasmithBasePropertyCaptureElement> FDatasmithFacadePropertyCapture::GetDatasmithPropertyCapture() const
{
return StaticCastSharedRef<IDatasmithBasePropertyCaptureElement>( InternalDatasmithElement );
}
FDatasmithFacadeActorBinding::FDatasmithFacadeActorBinding(
FDatasmithFacadeActor* InActorPtr
) :
FDatasmithFacadeElement(FDatasmithSceneFactory::CreateActorBinding())
{
GetDatasmithActorBinding()->SetActor(InActorPtr->GetDatasmithActorElement());
}
FDatasmithFacadeActorBinding::FDatasmithFacadeActorBinding(
const TSharedRef<IDatasmithActorBindingElement>& InInternalActorBinding
) :
FDatasmithFacadeElement( InInternalActorBinding )
{
}
TSharedRef<IDatasmithActorBindingElement> FDatasmithFacadeActorBinding::GetDatasmithActorBinding() const
{
return StaticCastSharedRef<IDatasmithActorBindingElement>( InternalDatasmithElement );
}
void FDatasmithFacadeActorBinding::AddRelativeLocationCapture(
float X,
float Y,
float Z
)
{
FVector Location(X, Y, Z);
TSharedRef<IDatasmithPropertyCaptureElement> LocationProperty = FDatasmithSceneFactory::CreatePropertyCapture();
LocationProperty->SetCategory(EDatasmithPropertyCategory::RelativeLocation);
LocationProperty->SetRecordedData((uint8*)&Location, sizeof(FVector));
GetDatasmithActorBinding()->AddPropertyCapture(LocationProperty);
}
void FDatasmithFacadeActorBinding::AddRelativeRotationCapture(
float Pitch,
float Yaw,
float Roll
)
{
FRotator Rotation(Pitch, Yaw, Roll);
TSharedRef<IDatasmithPropertyCaptureElement> RotationProperty = FDatasmithSceneFactory::CreatePropertyCapture();
RotationProperty->SetCategory(EDatasmithPropertyCategory::RelativeRotation);
RotationProperty->SetRecordedData((uint8*)&Rotation, sizeof(FRotator));
GetDatasmithActorBinding()->AddPropertyCapture(RotationProperty);
}
void FDatasmithFacadeActorBinding::AddRelativeRotationCapture(
float X,
float Y,
float Z,
float W
)
{
FRotator Rotation(FQuat(X, Y, Z, W));
TSharedRef<IDatasmithPropertyCaptureElement> RotationProperty = FDatasmithSceneFactory::CreatePropertyCapture();
RotationProperty->SetCategory(EDatasmithPropertyCategory::RelativeRotation);
RotationProperty->SetRecordedData((uint8*)&Rotation, sizeof(FRotator));
GetDatasmithActorBinding()->AddPropertyCapture(RotationProperty);
}
void FDatasmithFacadeActorBinding::AddRelativeScaleCapture(
float X,
float Y,
float Z
)
{
FVector Scale(X, Y, Z);
TSharedRef<IDatasmithPropertyCaptureElement> ScaleProperty = FDatasmithSceneFactory::CreatePropertyCapture();
ScaleProperty->SetCategory(EDatasmithPropertyCategory::RelativeScale3D);
ScaleProperty->SetRecordedData((uint8*)&Scale, sizeof(FVector));
GetDatasmithActorBinding()->AddPropertyCapture(ScaleProperty);
}
void FDatasmithFacadeActorBinding::AddRelativeTransformCapture(
const float InMatrix[16],
bool bRowMajor
)
{
TSharedPtr<IDatasmithActorElement> Actor = GetDatasmithActorBinding()->GetActor();
FDatasmithFacadeActor FacadeActor(Actor.ToSharedRef()); //todo: probably could reuse existing actor reference, or make ConvertTransform static
// Decompose matrix to FTransform with use of FDatasmithFacadeActor::ConvertTransform()
FTransform Transform = FacadeActor.ConvertTransform(InMatrix, bRowMajor);
//todo: can inline these functions
FVector Scale = Transform.GetScale3D();
FVector Location = Transform.GetTranslation();
FQuat Rotation = Transform.GetRotation();
AddRelativeScaleCapture(Scale.X, Scale.Y, Scale.Z);
AddRelativeLocationCapture(Location.X, Location.Y, Location.Z);
AddRelativeRotationCapture(Rotation.X, Rotation.Y, Rotation.Z, Rotation.W);
}
void FDatasmithFacadeActorBinding::AddVisibilityCapture(
bool bInVisibility
)
{
TSharedRef<IDatasmithPropertyCaptureElement> VisibilityProperty = FDatasmithSceneFactory::CreatePropertyCapture();
VisibilityProperty->SetCategory(EDatasmithPropertyCategory::Visibility);
VisibilityProperty->SetRecordedData((uint8*)&bInVisibility, sizeof(bool));
GetDatasmithActorBinding()->AddPropertyCapture(VisibilityProperty);
}
void FDatasmithFacadeActorBinding::AddMaterialCapture(
FDatasmithFacadeBaseMaterial* InMaterialPtr
)
{
TSharedRef<IDatasmithObjectPropertyCaptureElement> MaterialProperty = FDatasmithSceneFactory::CreateObjectPropertyCapture();
MaterialProperty->SetCategory(EDatasmithPropertyCategory::Material);
MaterialProperty->SetRecordedObject(InMaterialPtr->GetDatasmithBaseMaterial());
GetDatasmithActorBinding()->AddPropertyCapture(MaterialProperty);
}
void FDatasmithFacadeActorBinding::AddPropertyCapture(
FDatasmithFacadePropertyCapture* InPropertyCapturePtr
)
{
if (InPropertyCapturePtr)
{
GetDatasmithActorBinding()->AddPropertyCapture(InPropertyCapturePtr->GetDatasmithPropertyCapture());
}
}
int32 FDatasmithFacadeActorBinding::GetPropertyCapturesCount() const
{
return GetDatasmithActorBinding()->GetPropertyCapturesCount();
}
FDatasmithFacadePropertyCapture* FDatasmithFacadeActorBinding::GetNewPropertyCapture(
int32 PropertyCaptureIndex
)
{
if (TSharedPtr<IDatasmithBasePropertyCaptureElement> PropertyCaptureElement = GetDatasmithActorBinding()->GetPropertyCapture(PropertyCaptureIndex))
{
return new FDatasmithFacadePropertyCapture(PropertyCaptureElement.ToSharedRef());
}
return nullptr;
}
void FDatasmithFacadeActorBinding::RemovePropertyCapture(
FDatasmithFacadePropertyCapture* InPropertyCapturePtr
)
{
GetDatasmithActorBinding()->RemovePropertyCapture(InPropertyCapturePtr->GetDatasmithPropertyCapture());
}
FDatasmithFacadeVariant::FDatasmithFacadeVariant(
const TCHAR* InElementName
) :
FDatasmithFacadeElement(FDatasmithSceneFactory::CreateVariant(InElementName))
{
}
FDatasmithFacadeVariant::FDatasmithFacadeVariant(
const TSharedRef<IDatasmithVariantElement>& InInternalVariant
) :
FDatasmithFacadeElement( InInternalVariant )
{
}
TSharedRef<IDatasmithVariantElement> FDatasmithFacadeVariant::GetDatasmithVariant() const
{
return StaticCastSharedRef<IDatasmithVariantElement>( InternalDatasmithElement );
}
void FDatasmithFacadeVariant::AddActorBinding(
FDatasmithFacadeActorBinding* InActorBindingPtr
)
{
if (InActorBindingPtr)
{
GetDatasmithVariant()->AddActorBinding(InActorBindingPtr->GetDatasmithActorBinding());
}
}
int32 FDatasmithFacadeVariant::GetActorBindingsCount() const
{
return GetDatasmithVariant()->GetActorBindingsCount();
}
FDatasmithFacadeActorBinding* FDatasmithFacadeVariant::GetNewActorBinding(
int32 ActorBindingIndex
)
{
if (TSharedPtr<IDatasmithActorBindingElement> ActorBindingElement = GetDatasmithVariant()->GetActorBinding(ActorBindingIndex))
{
return new FDatasmithFacadeActorBinding(ActorBindingElement.ToSharedRef());
}
return nullptr;
}
void FDatasmithFacadeVariant::RemoveActorBinding(
FDatasmithFacadeActorBinding* InActorBindingPtr
)
{
GetDatasmithVariant()->RemoveActorBinding(InActorBindingPtr->GetDatasmithActorBinding());
}
FDatasmithFacadeVariantSet::FDatasmithFacadeVariantSet(
const TCHAR* InElementName
) :
FDatasmithFacadeElement(FDatasmithSceneFactory::CreateVariantSet(InElementName))
{
}
FDatasmithFacadeVariantSet::FDatasmithFacadeVariantSet(
const TSharedRef<IDatasmithVariantSetElement>& InInternalVariantSet
) :
FDatasmithFacadeElement( InInternalVariantSet )
{
}
TSharedRef<IDatasmithVariantSetElement> FDatasmithFacadeVariantSet::GetDatasmithVariantSet() const
{
return StaticCastSharedRef<IDatasmithVariantSetElement>( InternalDatasmithElement );
}
void FDatasmithFacadeVariantSet::AddVariant(
FDatasmithFacadeVariant* InVariantPtr
)
{
if (InVariantPtr)
{
GetDatasmithVariantSet()->AddVariant(InVariantPtr->GetDatasmithVariant());
}
}
int32 FDatasmithFacadeVariantSet::GetVariantsCount() const
{
return GetDatasmithVariantSet()->GetVariantsCount();
}
FDatasmithFacadeVariant* FDatasmithFacadeVariantSet::GetNewVariant(
int32 VariantIndex
)
{
if (TSharedPtr<IDatasmithVariantElement> VariantElement = GetDatasmithVariantSet()->GetVariant(VariantIndex))
{
return new FDatasmithFacadeVariant(VariantElement.ToSharedRef());
}
return nullptr;
}
void FDatasmithFacadeVariantSet::RemoveVariant(
FDatasmithFacadeVariant* InVariantPtr
)
{
GetDatasmithVariantSet()->RemoveVariant(InVariantPtr->GetDatasmithVariant());
}
FDatasmithFacadeLevelVariantSets::FDatasmithFacadeLevelVariantSets(
const TCHAR* InElementName
) :
FDatasmithFacadeElement(FDatasmithSceneFactory::CreateLevelVariantSets(InElementName))
{
}
FDatasmithFacadeLevelVariantSets::FDatasmithFacadeLevelVariantSets(
const TSharedRef<IDatasmithLevelVariantSetsElement>& InInternalLevelVariantsSet
) :
FDatasmithFacadeElement( InInternalLevelVariantsSet )
{
}
TSharedRef<IDatasmithLevelVariantSetsElement> FDatasmithFacadeLevelVariantSets::GetDatasmithLevelVariantSets() const
{
return StaticCastSharedRef<IDatasmithLevelVariantSetsElement>( InternalDatasmithElement );
}
void FDatasmithFacadeLevelVariantSets::AddVariantSet(
FDatasmithFacadeVariantSet* InVariantSetPtr
)
{
if (InVariantSetPtr)
{
GetDatasmithLevelVariantSets()->AddVariantSet(InVariantSetPtr->GetDatasmithVariantSet());
}
}
int32 FDatasmithFacadeLevelVariantSets::GetVariantSetsCount() const
{
return GetDatasmithLevelVariantSets()->GetVariantSetsCount();
}
FDatasmithFacadeVariantSet* FDatasmithFacadeLevelVariantSets::GetNewVariantSet(
int32 VariantSetIndex
)
{
if (TSharedPtr<IDatasmithVariantSetElement> VariantSetElement = GetDatasmithLevelVariantSets()->GetVariantSet(VariantSetIndex))
{
return new FDatasmithFacadeVariantSet(VariantSetElement.ToSharedRef());
}
return nullptr;
}
void FDatasmithFacadeLevelVariantSets::RemoveVariantSet(
FDatasmithFacadeVariantSet* InVariantSetPtr
)
{
GetDatasmithLevelVariantSets()->RemoveVariantSet(InVariantSetPtr->GetDatasmithVariantSet());
}
@@ -1,10 +1,13 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "DatasmithFacadeDirectLink.h"
#include "DirectLink/DatasmithFacadeDirectLink.h"
#include "DatasmithFacadeLog.h"
#include "DatasmithFacadeScene.h"
#include "DirectLink/DatasmithFacadeEndPointObserver.h"
#include "DirectLink/DatasmithFacadeEndPointObserverImpl.h"
#include "DatasmithExporterManager.h"
#include "DirectLinkEndpoint.h"
#include "Modules/ModuleManager.h"
#include "Misc/CommandLine.h"
@@ -67,3 +70,18 @@ bool FDatasmithFacadeDirectLink::UpdateScene(FDatasmithFacadeScene* FacadeScene)
return false;
}
void FDatasmithFacadeDirectLink::AddEndpointObserver(FDatasmithFacadeEndpointObserver* Observer)
{
if (Observer)
{
Impl.GetEnpoint()->AddEndpointObserver(&*Observer->GetObserver());
}
}
void FDatasmithFacadeDirectLink::RemoveEndpointObserver(FDatasmithFacadeEndpointObserver* Observer)
{
if (Observer)
{
Impl.GetEnpoint()->RemoveEndpointObserver(&*Observer->GetObserver());
}
}
@@ -0,0 +1,68 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "DirectLink/DatasmithFacadeEndpointObserver.h"
#include "DirectLink/DatasmithFacadeEndpointObserverImpl.h"
FDatasmithFacadeRawInfo::FDatasmithFacadeDataPointId* FDatasmithFacadeRawInfo::FDatasmithFacadeEndpointInfo::GetNewDestination(int32 Index) const
{
if (EndpointInfo.Destinations.IsValidIndex(Index))
{
return new FDatasmithFacadeDataPointId(EndpointInfo.Destinations[Index]);
}
return nullptr;
}
FDatasmithFacadeRawInfo::FDatasmithFacadeDataPointId* FDatasmithFacadeRawInfo::FDatasmithFacadeEndpointInfo::GetNewSource(int32 Index) const
{
if (EndpointInfo.Sources.IsValidIndex(Index))
{
return new FDatasmithFacadeDataPointId(EndpointInfo.Sources[Index]);
}
return nullptr;
}
FDatasmithFacadeRawInfo::FDatasmithFacadeEndpointInfo* FDatasmithFacadeRawInfo::GetNewEndpointInfo(const FMessageAddress* MessageAddress) const
{
const DirectLink::FRawInfo::FEndpointInfo* EndPointInfo = MessageAddress ? RawInfo.EndpointsInfo.Find(*MessageAddress) : nullptr;
if (EndPointInfo)
{
return new FDatasmithFacadeEndpointInfo(*EndPointInfo);
}
return nullptr;
}
FDatasmithFacadeRawInfo::FDatasmithFacadeDataPointInfo* FDatasmithFacadeRawInfo::GetNewDataPointsInfo(const FGuid* Id) const
{
const DirectLink::FRawInfo::FDataPointInfo* DataPointInfo = Id ? RawInfo.DataPointsInfo.Find(*Id) : nullptr;
if (DataPointInfo)
{
return new FDatasmithFacadeDataPointInfo(*DataPointInfo);
}
return nullptr;
}
FDatasmithFacadeRawInfo::FDatasmithFacadeStreamInfo* FDatasmithFacadeRawInfo::GetNewStreamInfo(int32 Index) const
{
if (RawInfo.StreamsInfo.IsValidIndex(Index))
{
return new FDatasmithFacadeStreamInfo(RawInfo.StreamsInfo[Index]);
}
return nullptr;
}
FDatasmithFacadeEndpointObserver::FDatasmithFacadeEndpointObserver()
: ObserverImpl(MakeShared<FDatasmithFacadeEndpointObserverImpl>())
{}
void FDatasmithFacadeEndpointObserver::RegisterOnStateChangedDelegateInternal(FDatasmithFacadeEndpointObserver::OnStateChangedDelegate InOnStateChangedDelegate)
{
ObserverImpl->RegisterOnStateChangedDelegate(InOnStateChangedDelegate);
}
void FDatasmithFacadeEndpointObserver::UnregisterOnStateChangedDelegateInternal(FDatasmithFacadeEndpointObserver::OnStateChangedDelegate InOnStateChangedDelegate)
{
ObserverImpl->UnregisterOnStateChangedDelegate(InOnStateChangedDelegate);
}
@@ -0,0 +1,39 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "DirectLinkEndpoint.h"
#include "DirectLink/DatasmithFacadeEndpointObserver.h"
class FDatasmithFacadeEndpointObserverImpl : public DirectLink::IEndpointObserver
{
public:
virtual void OnStateChanged(const DirectLink::FRawInfo& RawInfo) override
{
if (OnStateChangedPtr)
{
// The new pointer will be owned by the C# wrapper.
OnStateChangedPtr(new FDatasmithFacadeRawInfo(RawInfo));
}
}
void RegisterOnStateChangedDelegate(FDatasmithFacadeEndpointObserver::OnStateChangedDelegate InOnStateChangedDelegate)
{
if (ensure(!OnStateChangedPtr))
{
OnStateChangedPtr = InOnStateChangedDelegate;
}
}
void UnregisterOnStateChangedDelegate(FDatasmithFacadeEndpointObserver::OnStateChangedDelegate InOnStateChangedDelegate)
{
if (ensure(OnStateChangedPtr == InOnStateChangedDelegate))
{
OnStateChangedPtr = nullptr;
}
}
private:
FDatasmithFacadeEndpointObserver::OnStateChangedDelegate OnStateChangedPtr;
};
@@ -15,6 +15,7 @@ class FDatasmithFacadeMesh;
class FDatasmithFacadeMeshElement;
class FDatasmithFacadeMetaData;
class FDatasmithFacadeTexture;
class FDatasmithFacadeLevelVariantSets;
class DATASMITHFACADE_API FDatasmithFacadeScene
@@ -128,6 +129,20 @@ public:
FDatasmithFacadeTexture* InTexturePtr
);
void AddLevelVariantSets(
FDatasmithFacadeLevelVariantSets* InLevelVariantSetsPtr
);
int32 GetLevelVariantSetsCount() const;
FDatasmithFacadeLevelVariantSets* GetNewLevelVariantSets(
int32 LevelVariantSetsIndex
);
void RemoveLevelVariantSets(
FDatasmithFacadeLevelVariantSets* InLevelVariantSetsPtr
);
void AddMetaData(
FDatasmithFacadeMetaData* InMetaDataPtr
);
@@ -183,16 +198,21 @@ public:
/** Build and export a Datasmith scene instance and its scene element assets.
* The passed InOutputPath parameter will override any Name and OutputPath previously specified.
* @param bCleanupUnusedElements Remove unused meshes, textures and materials before exporting
* @return True if the scene was properly exported.
*/
bool ExportScene(
const TCHAR* InOutputPath // Datasmith scene output file path
const TCHAR* InOutputPath, // Datasmith scene output file path
bool bCleanupUnusedElements = true
);
/** Build and export a Datasmith scene instance and its scene element assets.
* @param bCleanupUnusedElements Remove unused meshes, textures and materials before exporting
* @return True if the scene was properly exported.
*/
bool ExportScene();
bool ExportScene(
bool bCleanupUnusedElements = true
);
/**
* Set the Datasmith scene's label.
@@ -0,0 +1,251 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
// Datasmith facade.
#include "DatasmithFacadeElement.h"
#include "DatasmithFacadeActor.h"
// Datasmith SDK classes.
class IDatasmithBasePropertyCaptureElement;
class IDatasmithActorBindingElement;
class IDatasmithVariantElement;
class IDatasmithVariantSetElement;
class IDatasmithLevelVariantSetsElement;
// Datasmith facade classes.
class FDatasmithFacadeBaseMaterial;
enum class EDatasmithFacadePropertyCategory : uint64
{
Undefined = 0,
Generic = 1,
RelativeLocation = 2,
RelativeRotation = 4,
RelativeScale3D = 8,
Visibility = 16,
Material = 32,
Color = 64,
Option = 128
};
// not trivial to reuse EDatasmithMaterialExpressionType (eg with a "using" declaration). #swig
#define DS_CHECK_ENUM_MISMATCH(name) static_assert((uint64)EDatasmithFacadePropertyCategory::name == (uint64)EDatasmithPropertyCategory::name, "enum mismatch");
DS_CHECK_ENUM_MISMATCH(Undefined)
DS_CHECK_ENUM_MISMATCH(Generic)
DS_CHECK_ENUM_MISMATCH(RelativeLocation)
DS_CHECK_ENUM_MISMATCH(RelativeRotation)
DS_CHECK_ENUM_MISMATCH(RelativeScale3D)
DS_CHECK_ENUM_MISMATCH(Visibility)
DS_CHECK_ENUM_MISMATCH(Material)
DS_CHECK_ENUM_MISMATCH(Color)
DS_CHECK_ENUM_MISMATCH(Option)
#undef DS_CHECK_ENUM_MISMATCH
class DATASMITHFACADE_API FDatasmithFacadePropertyCapture :
public FDatasmithFacadeElement
{
public:
FDatasmithFacadePropertyCapture();
virtual ~FDatasmithFacadePropertyCapture() {}
void SetPropertyPath(const TCHAR* Path);
const TCHAR* GetPropertyPath();
EDatasmithFacadePropertyCategory GetCategory() const;
#ifdef SWIG_FACADE
protected:
#endif
explicit FDatasmithFacadePropertyCapture(
const TSharedRef<IDatasmithBasePropertyCaptureElement>& InInternalPropertyCapture
);
TSharedRef<IDatasmithBasePropertyCaptureElement> GetDatasmithPropertyCapture() const;
};
class DATASMITHFACADE_API FDatasmithFacadeActorBinding :
public FDatasmithFacadeElement
{
public:
FDatasmithFacadeActorBinding(
FDatasmithFacadeActor* InActorPtr
);
virtual ~FDatasmithFacadeActorBinding() {}
void AddPropertyCapture(
FDatasmithFacadePropertyCapture* InPropertyCapturePtr
);
int32 GetPropertyCapturesCount() const;
FDatasmithFacadePropertyCapture* GetNewPropertyCapture(
int32 PropertyCaptureIndex
);
void RemovePropertyCapture(
FDatasmithFacadePropertyCapture* InPropertyCapturePtr
);
void AddRelativeLocationCapture(
float X,
float Y,
float Z
);
void AddRelativeRotationCapture(
float Pitch,
float Yaw,
float Roll
);
void AddRelativeRotationCapture(
float X,
float Y,
float Z,
float W
);
void AddRelativeScaleCapture(
float X,
float Y,
float Z
);
void AddRelativeTransformCapture(
const float InMatrix[16],
bool bRowMajor = false
);
void AddVisibilityCapture(
bool bInVisibility
);
void AddMaterialCapture(
FDatasmithFacadeBaseMaterial* InMaterialPtr
);
#ifdef SWIG_FACADE
protected:
#endif
explicit FDatasmithFacadeActorBinding(
const TSharedRef<IDatasmithActorBindingElement>& InInternalActorBinding
);
TSharedRef<IDatasmithActorBindingElement> GetDatasmithActorBinding() const;
};
class DATASMITHFACADE_API FDatasmithFacadeVariant :
public FDatasmithFacadeElement
{
public:
FDatasmithFacadeVariant(
const TCHAR* InElementName
);
virtual ~FDatasmithFacadeVariant() {}
void AddActorBinding(
FDatasmithFacadeActorBinding* InActorBindingPtr
);
int32 GetActorBindingsCount() const;
FDatasmithFacadeActorBinding* GetNewActorBinding(
int32 ActorBindingIndex
);
void RemoveActorBinding(
FDatasmithFacadeActorBinding* InActorBindingPtr
);
#ifdef SWIG_FACADE
protected:
#endif
explicit FDatasmithFacadeVariant(
const TSharedRef<IDatasmithVariantElement>& InInternalVariant
);
TSharedRef<IDatasmithVariantElement> GetDatasmithVariant() const;
};
class DATASMITHFACADE_API FDatasmithFacadeVariantSet :
public FDatasmithFacadeElement
{
public:
FDatasmithFacadeVariantSet(
const TCHAR* InElementName
);
virtual ~FDatasmithFacadeVariantSet() {}
void AddVariant(
FDatasmithFacadeVariant* InVariantPtr
);
int32 GetVariantsCount() const;
FDatasmithFacadeVariant* GetNewVariant(
int32 VariantIndex
);
void RemoveVariant(
FDatasmithFacadeVariant* InVariantPtr
);
#ifdef SWIG_FACADE
protected:
#endif
explicit FDatasmithFacadeVariantSet(
const TSharedRef<IDatasmithVariantSetElement>& InInternalVariantSet
);
TSharedRef<IDatasmithVariantSetElement> GetDatasmithVariantSet() const;
};
class DATASMITHFACADE_API FDatasmithFacadeLevelVariantSets :
public FDatasmithFacadeElement
{
public:
FDatasmithFacadeLevelVariantSets(
const TCHAR* InElementName
);
virtual ~FDatasmithFacadeLevelVariantSets() {}
void AddVariantSet(
FDatasmithFacadeVariantSet* InVariantSetPtr
);
int32 GetVariantSetsCount() const;
FDatasmithFacadeVariantSet* GetNewVariantSet(
int32 VariantSetIndex
);
void RemoveVariantSet(
FDatasmithFacadeVariantSet* InVariantSetPtr
);
#ifdef SWIG_FACADE
protected:
#endif
explicit FDatasmithFacadeLevelVariantSets(
const TSharedRef<IDatasmithLevelVariantSetsElement>& InInternalLevelVariantsSet
);
TSharedRef<IDatasmithLevelVariantSetsElement> GetDatasmithLevelVariantSets() const;
};
@@ -7,7 +7,7 @@
#include "CoreTypes.h"
class FDatasmithFacadeScene;
class FDatasmithFacadeEndpointObserver;
class DATASMITHFACADE_API FDatasmithFacadeDirectLink
{
@@ -20,6 +20,18 @@ public:
bool InitializeForScene(FDatasmithFacadeScene* FacadeScene);
bool UpdateScene(FDatasmithFacadeScene* FacadeScene);
/**
* Register an IEndpointObserver that will be notified periodically with the last state of the swarm.
* @param Observer Object that should be notified
*/
void AddEndpointObserver(FDatasmithFacadeEndpointObserver* Observer);
/**
* Removes a previously added observer
* @param Observer Observer to remove
*/
void RemoveEndpointObserver(FDatasmithFacadeEndpointObserver* Observer);
private:
FDatasmithDirectLink Impl;
};
@@ -0,0 +1,163 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "DirectLinkEndpoint.h"
#include "CoreTypes.h"
class FDatasmithFacadeScene;
struct DATASMITHFACADE_API FDatasmithFacadeRawInfo
{
struct DATASMITHFACADE_API FDatasmithFacadeDataPointId
{
public:
const TCHAR* GetName() const { return *DataPointId.Name; }
FGuid GetId() const { return DataPointId.Id; }
bool IsPublic() const { return DataPointId.bIsPublic; }
#ifdef SWIG_FACADE
private:
#endif
explicit FDatasmithFacadeDataPointId(const DirectLink::FRawInfo::FDataPointId& InDataPointId)
: DataPointId(InDataPointId)
{}
private:
DirectLink::FRawInfo::FDataPointId DataPointId;
};
struct DATASMITHFACADE_API FDatasmithFacadeEndpointInfo
{
public:
const TCHAR* GetName() const { return *EndpointInfo.Name; }
int32 GetNumberOfDestinations() const { return EndpointInfo.Destinations.Num(); }
/**
* Returns the Destination info at the given index, returns null if the index is invalid.
* The caller is responsible of deleting the returned object pointer.
*/
FDatasmithFacadeDataPointId* GetNewDestination(int32 Index) const;
int32 GetNumberOfSources() const { return EndpointInfo.Sources.Num(); }
/**
* Returns the Source info at the given index, returns null if the index is invalid.
* The caller is responsible of deleting the returned object pointer.
*/
FDatasmithFacadeDataPointId* GetNewSource(int32 Index) const;
const TCHAR* GetUserName() const { return *EndpointInfo.UserName; }
const TCHAR* GetExecutableName() const { return *EndpointInfo.ExecutableName; }
const TCHAR* GetComputerName() const { return *EndpointInfo.ComputerName; }
bool IsLocal() const { return EndpointInfo.bIsLocal; }
uint32 GetProcessId() const { return EndpointInfo.ProcessId; }
#ifdef SWIG_FACADE
private:
#endif
explicit FDatasmithFacadeEndpointInfo(const DirectLink::FRawInfo::FEndpointInfo& InEndpointInfo)
: EndpointInfo(InEndpointInfo)
{}
private:
DirectLink::FRawInfo::FEndpointInfo EndpointInfo;
};
struct DATASMITHFACADE_API FDatasmithFacadeDataPointInfo
{
FMessageAddress GetEndpointAddress() const { return DataPointInfo.EndpointAddress; }
const TCHAR* GetName() const { return *DataPointInfo.Name; }
bool IsSource() const { return DataPointInfo.bIsSource; }
bool IsOnThisEndpoint() const { return DataPointInfo.bIsOnThisEndpoint; }
bool IsPublic() const { return DataPointInfo.bIsPublic; }
#ifdef SWIG_FACADE
private:
#endif
explicit FDatasmithFacadeDataPointInfo(const DirectLink::FRawInfo::FDataPointInfo& InDataPointInfo)
: DataPointInfo(InDataPointInfo)
{}
private:
DirectLink::FRawInfo::FDataPointInfo DataPointInfo;
};
struct DATASMITHFACADE_API FDatasmithFacadeStreamInfo
{
public:
uint32 GetStreamId() const { return StreamInfo.StreamId; }
FGuid GetSource() const { return StreamInfo.Source; }
FGuid GetDestination() const { return StreamInfo.Destination; }
bool IsActive() const { return StreamInfo.bIsActive; }
#ifdef SWIG_FACADE
private:
#endif
explicit FDatasmithFacadeStreamInfo(const DirectLink::FRawInfo::FStreamInfo& InStreamInfo)
: StreamInfo(InStreamInfo)
{}
private:
DirectLink::FRawInfo::FStreamInfo StreamInfo;
};
/**
* Returns the MessageAddress associated to the current DirectLink Endpoint.
*/
FMessageAddress GetThisEndpointAddress() const { return RawInfo.ThisEndpointAddress; }
/**
* Returns the Endpoint info associated to given MessageAddress, returns null if there is no Endpoint associated to the MessageAddress.
* The caller is responsible of deleting the returned object pointer.
*/
FDatasmithFacadeEndpointInfo* GetNewEndpointInfo(const FMessageAddress* MessageAddress) const;
/**
* Returns the DataPointInfo (Source or Destination) associated to the given Id, returns null if there is no DataPointInfo associated to the Id.
* The caller is responsible of deleting the returned object pointer.
*/
FDatasmithFacadeDataPointInfo* GetNewDataPointsInfo(const FGuid* Id) const;
int32 GetNumberOfStreamsInfo() const { return RawInfo.StreamsInfo.Num(); }
/**
* Returns the Stream info at the given index, returns null if the index is invalid.
* The caller is responsible of deleting the returned object pointer.
*/
FDatasmithFacadeStreamInfo* GetNewStreamInfo(int32 Index) const;
#ifdef SWIG_FACADE
private:
#endif
explicit FDatasmithFacadeRawInfo(const DirectLink::FRawInfo& InRawInfo)
: RawInfo(InRawInfo)
{}
private:
DirectLink::FRawInfo RawInfo;
};
class FDatasmithFacadeEndpointObserverImpl;
class DATASMITHFACADE_API FDatasmithFacadeEndpointObserver
{
public:
typedef void(*OnStateChangedDelegate)(FDatasmithFacadeRawInfo*);
FDatasmithFacadeEndpointObserver();
void RegisterOnStateChangedDelegateInternal(FDatasmithFacadeEndpointObserver::OnStateChangedDelegate InOnStateChanged);
void UnregisterOnStateChangedDelegateInternal(FDatasmithFacadeEndpointObserver::OnStateChangedDelegate InOnStateChanged);
#ifdef SWIG_FACADE
private:
#endif
const TSharedRef<FDatasmithFacadeEndpointObserverImpl>& GetObserver() const { return ObserverImpl; }
private:
TSharedRef<FDatasmithFacadeEndpointObserverImpl> ObserverImpl;
};