Skip to content

Commit

Permalink
remapped morph target values from 0-100 to 0-1
Browse files Browse the repository at this point in the history
added new class for overriding face morph targets
  • Loading branch information
Chris528 committed Apr 24, 2020
1 parent e36021b commit 49aef90
Show file tree
Hide file tree
Showing 7 changed files with 412 additions and 52 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ FQuat USmartsuitBlueprintLibrary::GetQuaternionField(TSharedPtr<FJsonObject> jso
return ReturnVal;
}

double USmartsuitBlueprintLibrary::ParseMorphTargetValue(TSharedPtr<FJsonObject> jsonObject, const FString& FieldName)
{
return FMath::GetMappedRangeValueClamped(FVector2D(0.f, 100.f), FVector2D(0.f, 1.f), jsonObject->GetNumberField(FieldName));
}

void USmartsuitBlueprintLibrary::CreateVirtualProductionSource()
{
FVirtualProductionSource::CreateLiveLinkSource();
Expand Down
157 changes: 105 additions & 52 deletions Plugins/Smartsuit/Source/Smartsuit/Private/VirtualProductionFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,56 +74,109 @@ FFace::FFace(TSharedPtr<FJsonObject> jsonObject)
provider = jsonObject->GetStringField("provider");
faceId = jsonObject->GetStringField("faceId");

eyeBlinkLeft = jsonObject->GetNumberField("eyeBlinkLeft");
eyeLookDownLeft = jsonObject->GetNumberField("eyeLookDownLeft");
eyeLookInLeft = jsonObject->GetNumberField("eyeLookInLeft");
eyeLookOutLeft = jsonObject->GetNumberField("eyeLookOutLeft");
eyeLookUpLeft = jsonObject->GetNumberField("eyeLookUpLeft");
eyeSquintLeft = jsonObject->GetNumberField("eyeSquintLeft");
eyeWideLeft = jsonObject->GetNumberField("eyeWideLeft");
eyeBlinkRight = jsonObject->GetNumberField("eyeBlinkRight");
eyeLookDownRight = jsonObject->GetNumberField("eyeLookDownRight");
eyeLookInRight = jsonObject->GetNumberField("eyeLookInRight");
eyeLookOutRight = jsonObject->GetNumberField("eyeLookOutRight");
eyeLookUpRight = jsonObject->GetNumberField("eyeLookUpRight");
eyeSquintRight = jsonObject->GetNumberField("eyeSquintRight");
eyeWideRight = jsonObject->GetNumberField("eyeWideRight");
jawForward = jsonObject->GetNumberField("jawForward");
jawLeft = jsonObject->GetNumberField("jawLeft");
jawRight = jsonObject->GetNumberField("jawRight");
jawOpen = jsonObject->GetNumberField("jawOpen");
mouthClose = jsonObject->GetNumberField("mouthClose");
mouthFunnel = jsonObject->GetNumberField("mouthFunnel");
mouthPucker = jsonObject->GetNumberField("mouthPucker");
mouthLeft = jsonObject->GetNumberField("mouthLeft");
mouthRight = jsonObject->GetNumberField("mouthRight");
mouthSmileLeft = jsonObject->GetNumberField("mouthSmileLeft");
mouthSmileRight = jsonObject->GetNumberField("mouthSmileRight");
mouthFrownLeft = jsonObject->GetNumberField("mouthFrownLeft");
mouthFrownRight = jsonObject->GetNumberField("mouthFrownRight");
mouthDimpleLeft = jsonObject->GetNumberField("mouthDimpleLeft");
mouthDimpleRight = jsonObject->GetNumberField("mouthDimpleRight");
mouthStretchLeft = jsonObject->GetNumberField("mouthStretchLeft");
mouthStretchRight = jsonObject->GetNumberField("mouthStretchRight");
mouthRollLower = jsonObject->GetNumberField("mouthRollLower");
mouthRollUpper = jsonObject->GetNumberField("mouthRollUpper");
mouthShrugLower = jsonObject->GetNumberField("mouthShrugLower");
mouthShrugUpper = jsonObject->GetNumberField("mouthShrugUpper");
mouthPressLeft = jsonObject->GetNumberField("mouthPressLeft");
mouthPressRight = jsonObject->GetNumberField("mouthPressRight");
mouthLowerDownLeft = jsonObject->GetNumberField("mouthLowerDownLeft");
mouthLowerDownRight = jsonObject->GetNumberField("mouthLowerDownRight");
mouthUpperUpLeft = jsonObject->GetNumberField("mouthUpperUpLeft");
mouthUpperUpRight = jsonObject->GetNumberField("mouthUpperUpRight");
browDownLeft = jsonObject->GetNumberField("browDownLeft");
browDownRight = jsonObject->GetNumberField("browDownRight");
browInnerUp = jsonObject->GetNumberField("browInnerUp");
browOuterUpLeft = jsonObject->GetNumberField("browOuterUpLeft");
browOuterUpRight = jsonObject->GetNumberField("browOuterUpRight");
cheekPuff = jsonObject->GetNumberField("cheekPuff");
cheekSquintLeft = jsonObject->GetNumberField("cheekSquintLeft");
cheekSquintRight = jsonObject->GetNumberField("cheekSquintRight");
noseSneerLeft = jsonObject->GetNumberField("noseSneerLeft");
noseSneerRight = jsonObject->GetNumberField("noseSneerRight");
tongueOut = jsonObject->GetNumberField("tongueOut");
//eyeBlinkLeft = jsonObject->GetNumberField("eyeBlinkLeft");
//eyeLookDownLeft = jsonObject->GetNumberField("eyeLookDownLeft");
//eyeLookInLeft = jsonObject->GetNumberField("eyeLookInLeft");
//eyeLookOutLeft = jsonObject->GetNumberField("eyeLookOutLeft");
//eyeLookUpLeft = jsonObject->GetNumberField("eyeLookUpLeft");
//eyeSquintLeft = jsonObject->GetNumberField("eyeSquintLeft");
//eyeWideLeft = jsonObject->GetNumberField("eyeWideLeft");
//eyeBlinkRight = jsonObject->GetNumberField("eyeBlinkRight");
//eyeLookDownRight = jsonObject->GetNumberField("eyeLookDownRight");
//eyeLookInRight = jsonObject->GetNumberField("eyeLookInRight");
//eyeLookOutRight = jsonObject->GetNumberField("eyeLookOutRight");
//eyeLookUpRight = jsonObject->GetNumberField("eyeLookUpRight");
//eyeSquintRight = jsonObject->GetNumberField("eyeSquintRight");
//eyeWideRight = jsonObject->GetNumberField("eyeWideRight");
//jawForward = jsonObject->GetNumberField("jawForward");
//jawLeft = jsonObject->GetNumberField("jawLeft");
//jawRight = jsonObject->GetNumberField("jawRight");
//jawOpen = jsonObject->GetNumberField("jawOpen");
//mouthClose = jsonObject->GetNumberField("mouthClose");
//mouthFunnel = jsonObject->GetNumberField("mouthFunnel");
//mouthPucker = jsonObject->GetNumberField("mouthPucker");
//mouthLeft = jsonObject->GetNumberField("mouthLeft");
//mouthRight = jsonObject->GetNumberField("mouthRight");
//mouthSmileLeft = jsonObject->GetNumberField("mouthSmileLeft");
//mouthSmileRight = jsonObject->GetNumberField("mouthSmileRight");
//mouthFrownLeft = jsonObject->GetNumberField("mouthFrownLeft");
//mouthFrownRight = jsonObject->GetNumberField("mouthFrownRight");
//mouthDimpleLeft = jsonObject->GetNumberField("mouthDimpleLeft");
//mouthDimpleRight = jsonObject->GetNumberField("mouthDimpleRight");
//mouthStretchLeft = jsonObject->GetNumberField("mouthStretchLeft");
//mouthStretchRight = jsonObject->GetNumberField("mouthStretchRight");
//mouthRollLower = jsonObject->GetNumberField("mouthRollLower");
//mouthRollUpper = jsonObject->GetNumberField("mouthRollUpper");
//mouthShrugLower = jsonObject->GetNumberField("mouthShrugLower");
//mouthShrugUpper = jsonObject->GetNumberField("mouthShrugUpper");
//mouthPressLeft = jsonObject->GetNumberField("mouthPressLeft");
//mouthPressRight = jsonObject->GetNumberField("mouthPressRight");
//mouthLowerDownLeft = jsonObject->GetNumberField("mouthLowerDownLeft");
//mouthLowerDownRight = jsonObject->GetNumberField("mouthLowerDownRight");
//mouthUpperUpLeft = jsonObject->GetNumberField("mouthUpperUpLeft");
//mouthUpperUpRight = jsonObject->GetNumberField("mouthUpperUpRight");
//browDownLeft = jsonObject->GetNumberField("browDownLeft");
//browDownRight = jsonObject->GetNumberField("browDownRight");
//browInnerUp = jsonObject->GetNumberField("browInnerUp");
//browOuterUpLeft = jsonObject->GetNumberField("browOuterUpLeft");
//browOuterUpRight = jsonObject->GetNumberField("browOuterUpRight");
//cheekPuff = jsonObject->GetNumberField("cheekPuff");
//cheekSquintLeft = jsonObject->GetNumberField("cheekSquintLeft");
//cheekSquintRight = jsonObject->GetNumberField("cheekSquintRight");
//noseSneerLeft = jsonObject->GetNumberField("noseSneerLeft");
//noseSneerRight = jsonObject->GetNumberField("noseSneerRight");
//tongueOut = jsonObject->GetNumberField("tongueOut");

eyeBlinkLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeBlinkLeft");
eyeLookDownLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookDownLeft");
eyeLookInLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookInLeft");
eyeLookOutLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookOutLeft");
eyeLookUpLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookUpLeft");
eyeSquintLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeSquintLeft");
eyeWideLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeWideLeft");
eyeBlinkRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeBlinkRight");
eyeLookDownRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookDownRight");
eyeLookInRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookInRight");
eyeLookOutRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookOutRight");
eyeLookUpRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeLookUpRight");
eyeSquintRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeSquintRight");
eyeWideRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "eyeWideRight");
jawForward = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "jawForward");
jawLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "jawLeft");
jawRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "jawRight");
jawOpen = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "jawOpen");
mouthClose = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthClose");
mouthFunnel = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthFunnel");
mouthPucker = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthPucker");
mouthLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthLeft");
mouthRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthRight");
mouthSmileLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthSmileLeft");
mouthSmileRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthSmileRight");
mouthFrownLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthFrownLeft");
mouthFrownRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthFrownRight");
mouthDimpleLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthDimpleLeft");
mouthDimpleRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthDimpleRight");
mouthStretchLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthStretchLeft");
mouthStretchRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthStretchRight");
mouthRollLower = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthRollLower");
mouthRollUpper = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthRollUpper");
mouthShrugLower = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthShrugLower");
mouthShrugUpper = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthShrugUpper");
mouthPressLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthPressLeft");
mouthPressRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthPressRight");
mouthLowerDownLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthLowerDownLeft");
mouthLowerDownRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthLowerDownRight");
mouthUpperUpLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthUpperUpLeft");
mouthUpperUpRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "mouthUpperUpRight");
browDownLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "browDownLeft");
browDownRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "browDownRight");
browInnerUp = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "browInnerUp");
browOuterUpLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "browOuterUpLeft");
browOuterUpRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "browOuterUpRight");
cheekPuff = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "cheekPuff");
cheekSquintLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "cheekSquintLeft");
cheekSquintRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "cheekSquintRight");
noseSneerLeft = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "noseSneerLeft");
noseSneerRight = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "noseSneerRight");
tongueOut = USmartsuitBlueprintLibrary::ParseMorphTargetValue(jsonObject, "tongueOut");
}
Original file line number Diff line number Diff line change
Expand Up @@ -701,4 +701,18 @@ void FVirtualProductionSource::RemoveLiveLinkSource(TSharedPtr<FVirtualProductio

LiveLinkClient->RemoveSource(InSource);
}
}

FName URokokoFaceMapData::GetRemappedCurveName_Implementation(FName CurveName) const
{
if (auto RemappedName = NameMapping.Find(CurveName))
{
return *RemappedName;
}
return "";
}

void URokokoFaceMapData::Initialize()
{
InitializeTMap();
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class USmartsuitBlueprintLibrary : public UBlueprintFunctionLibrary

static FQuat GetQuaternionField(TSharedPtr<FJsonObject> jsonObject);

static double ParseMorphTargetValue(TSharedPtr<FJsonObject> jsonObject, const FString& FieldName);

UFUNCTION(BlueprintCallable, Category = "Smartsuit")
static void CreateVirtualProductionSource();
};
Loading

0 comments on commit 49aef90

Please sign in to comment.