Skip to content

Commit

Permalink
Renamed StreamOptions. As Transform now becomes Root Only as it will …
Browse files Browse the repository at this point in the history
…send the Transform and all associated properties on that Root

FBModel based classes that do not have a more specific class will now stream as GenericStreamObjects
  • Loading branch information
EpicAeryll committed Jan 23, 2018
1 parent 2104ee5 commit c692ce2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
31 changes: 17 additions & 14 deletions Source/Private/MobuLiveLinkLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bool MobuLiveLinkLayout::FBCreate()
ModelStoreFunctions.Emplace(FBLight::TypeInfo, (ModelStoreFunctionType)&MobuLiveLinkLayout::StoreLight);
ModelStoreFunctions.Emplace(FBModelSkeleton::TypeInfo, (ModelStoreFunctionType)&MobuLiveLinkLayout::StoreSkeleton);
ModelStoreFunctions.Emplace(FBModelRoot::TypeInfo, (ModelStoreFunctionType)&MobuLiveLinkLayout::StoreSkeleton);
ModelStoreFunctions.Emplace(FBModelNull::TypeInfo, (ModelStoreFunctionType)&MobuLiveLinkLayout::StoreGeneric);

// Get a handle on the device.
LiveLinkDevice = ((MobuLiveLink *)(FBDevice *)Device);
Expand Down Expand Up @@ -73,21 +72,21 @@ void MobuLiveLinkLayout::UICreate()
StreamLayout.AddRegion("ObjectSelector", "ObjectSelector",
S, kFBAttachLeft, "", 1.00,
S, kFBAttachTop, "", 1.00,
2 * W, kFBAttachNone, NULL, 1.00,
H, kFBAttachNone, NULL, 1.00);
2 * W, kFBAttachNone, nullptr, 1.00,
H, kFBAttachNone, nullptr, 1.00);

StreamLayout.AddRegion("AddToStreamButton", "AddToStreamButton",
S, kFBAttachRight, "ObjectSelector", 1.00,
0, kFBAttachTop, "ObjectSelector", 1.00,
W, kFBAttachNone, NULL, 1.00,
H, kFBAttachNone, NULL, 1.00);
W, kFBAttachNone, nullptr, 1.00,
H, kFBAttachNone, nullptr, 1.00);


StreamLayout.AddRegion("RemoveFromStreamButton", "RemoveFromStreamButton",
S, kFBAttachRight, "AddToStreamButton", 1.00,
0, kFBAttachTop, "AddToStreamButton", 1.00,
W, kFBAttachNone, NULL, 1.00,
H, kFBAttachNone, NULL, 1.00);
W, kFBAttachNone, nullptr, 1.00,
H, kFBAttachNone, nullptr, 1.00);

StreamLayout.AddRegion("StreamSpread", "StreamSpread",
S, kFBAttachLeft, "", 1.00,
Expand Down Expand Up @@ -204,17 +203,21 @@ void MobuLiveLinkLayout::EventAddToStream(HISender Sender, HKEvent Event)
else if (!IsModelInDeviceStream(LiveLinkDevice, Model))
{
ModelStoreFunctionType* StoreFunction = ModelStoreFunctions.Find(Model->GetTypeId());
StreamObjectPtr StoreObject;
if (StoreFunction != nullptr)
{
StreamObjectPtr StoreObject = (this->*(*StoreFunction))(Model);

LiveLinkDevice->StreamObjects.Emplace((kReference)Model, StoreObject);
AddSpreadRowFromStreamObject(StoreObject);
FBTrace("Added New Object to StreamObject\n");

ParentsToIgnore.Emplace(Model);
StoreObject = (this->*(*StoreFunction))(Model);
}
else
{
StoreObject = StoreGeneric(Model);
}
LiveLinkDevice->StreamObjects.Emplace((kReference)Model, StoreObject);
AddSpreadRowFromStreamObject(StoreObject);
FBTrace("Added New Object to StreamObject\n");

ParentsToIgnore.Emplace(Model);

}
}
ObjectSelection.Clear();
Expand Down
7 changes: 6 additions & 1 deletion Source/Public/StreamStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#include <fbsdk/fbsdk.h>
#pragma warning(pop)

// TODO: StreamObjectBase should not rely on FBModel, instead it should just have some virtual accessors for data like Root Name
// There would then be a ModelStreamObject which works with FBModels and then all specific cases of FBModel inherit from that
// i.e. StreamObjectBase -> ModelStreamObject -> LightStreamObject
// This would fix the hacks I had to do to support EditorActiveCameraStreamObject

// Abstract class. Inherit from this to support streaming.
// Wraps an FBModel* to get the required data for streaming.
class StreamObjectBase
Expand Down Expand Up @@ -66,7 +71,7 @@ class StreamObjectBase

StreamObjectBase(const FBModel* ModelPointer, const TSharedPtr<ILiveLinkProvider> StreamProvider, std::initializer_list<FString> Options);

// model-less constructor
// model-less constructor to support EditorActiveCameraStreamObject
StreamObjectBase(const FName InSubjectName, const TSharedPtr<ILiveLinkProvider> StreamProvider);
};

Expand Down
2 changes: 1 addition & 1 deletion Source/StreamObjects/CameraStreamObject.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "StreamStore.h"

CameraStreamObject::CameraStreamObject(const FBModel* ModelPointer, const TSharedPtr<ILiveLinkProvider> StreamProvider) :
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("As Camera"), TEXT("As Transform") })
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("Camera"), TEXT("Root Only") })
{
UpdateFromModel();
}
Expand Down
4 changes: 2 additions & 2 deletions Source/StreamObjects/GenericStreamObject.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "StreamStore.h"

GenericStreamObject::GenericStreamObject(const FBModel* ModelPointer, const TSharedPtr<ILiveLinkProvider> StreamProvider) :
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("As Transform") })
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("Root Only") })
{
UpdateFromModel();
};
Expand All @@ -26,7 +26,7 @@ void GenericStreamObject::GetStreamData()
BoneTransforms.Emplace(UnrealTransformFromModel((FBModel*)RootModel));

// Generic Models have no special properties
TArray<FLiveLinkCurveElement> CurveData;
TArray<FLiveLinkCurveElement> CurveData = GetAllAnimatableCurves((FBModel*)RootModel);

FBTime LocalTime = FBSystem().LocalTime;
Provider->UpdateSubjectFrame(SubjectName, BoneTransforms, CurveData, LocalTime.GetSecondDouble(), LocalTime.GetFrame());
Expand Down
2 changes: 1 addition & 1 deletion Source/StreamObjects/LightStreamObject.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "StreamStore.h"

LightStreamObject::LightStreamObject(const FBModel* ModelPointer, const TSharedPtr<ILiveLinkProvider> StreamProvider) :
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("As Light"), TEXT("As Transform") })
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("Light"), TEXT("Root Only") })
{
UpdateFromModel();
};
Expand Down
2 changes: 1 addition & 1 deletion Source/StreamObjects/SkeletonHeirarchyStreamObject.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "StreamStore.h"

SkeletonHeirarchyStreamObject::SkeletonHeirarchyStreamObject(const FBModel* ModelPointer, const TSharedPtr<ILiveLinkProvider> StreamProvider) :
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("As Heirarchy"), TEXT("As Transform") })
StreamObjectBase(ModelPointer, StreamProvider, { TEXT("Full Heirarchy"), TEXT("Root Only") })
{
UpdateFromModel();
};
Expand Down

0 comments on commit c692ce2

Please sign in to comment.