ue/plugins/vmc4ue/VMC4UEBlueprintFunctionLibrary.cpp.patch

57 lines
2.1 KiB
Diff
Raw Normal View History

2024-06-03 14:47:02 +00:00
--- ./VMC4UE/VMC4UE/Source/VMC4UE/Source/VMC4UEBlueprintFunctionLibrary.cpp
+++ ./VMC4UEBlueprintFunctionLibrary.cpp
@@ -119,27 +119,29 @@ UVMC4UEStreamingSkeletalMeshTransform* UVMC4UEBlueprin
{
return nullptr;
}
-
+
+ UVMC4UEStreamingSkeletalMeshTransform* StreamingSkeletalMeshTransform = nullptr;
+
+ // Try to get existing transform
{
- // Get
FRWScopeLock RWScopeLock(OSCManager->RWLock, FRWScopeLockType::SLT_ReadOnly);
- auto StreamingSkeletalMeshTransform = OSCManager->StreamingSkeletalMeshTransformMap.Find(Port);
- if (StreamingSkeletalMeshTransform != nullptr)
+ auto FoundTransform = OSCManager->StreamingSkeletalMeshTransformMap.Find(Port);
+ if (FoundTransform != nullptr)
{
- return *StreamingSkeletalMeshTransform;
+ return *FoundTransform;
}
}
+
+ // Create new transform if not found
{
- // Create
FRWScopeLock RWScopeLock(OSCManager->RWLock, FRWScopeLockType::SLT_Write);
- auto StreamingSkeletalMeshTransform = OSCManager->StreamingSkeletalMeshTransformMap.Find(Port);
- if (StreamingSkeletalMeshTransform != nullptr)
+ auto FoundTransform = OSCManager->StreamingSkeletalMeshTransformMap.Find(Port);
+ if (FoundTransform != nullptr)
{
- return *StreamingSkeletalMeshTransform;
+ return *FoundTransform;
}
- UVMC4UEStreamingSkeletalMeshTransform* NewStreamingSkeletalMeshTransform = NewObject<UVMC4UEStreamingSkeletalMeshTransform>();
- //FRWScopeLock RWScopeLock2(NewStreamingSkeletalMeshTransform->RWLock, FRWScopeLockType::SLT_Write);
+ UVMC4UEStreamingSkeletalMeshTransform* NewStreamingSkeletalMeshTransform = NewObject<UVMC4UEStreamingSkeletalMeshTransform>();
OSCManager->StreamingSkeletalMeshTransformMap.Emplace(Port, NewStreamingSkeletalMeshTransform);
// Bind Port
@@ -149,9 +151,10 @@ UVMC4UEStreamingSkeletalMeshTransform* UVMC4UEBlueprin
OSCManager->OscReceivers.Emplace(OscReceiver);
- return NewStreamingSkeletalMeshTransform;
+ StreamingSkeletalMeshTransform = NewStreamingSkeletalMeshTransform;
}
- return nullptr;
+
+ return StreamingSkeletalMeshTransform;
}
void UVMC4UEBlueprintFunctionLibrary::RefreshConnection(float Seconds)