You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Use thread safety locks when finding latency marker modular features from rhi thread #rb Mike.Fricker #ROBOMERGE-AUTHOR: peter.knepley #ROBOMERGE-SOURCE: CL 19015311 via CL 19015708 via CL 19015763 via CL 19015857 via CL 19016025 via CL 19031920 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v917-18934589) [CL 19032149 by peter knepley in ue5-main branch]
61 lines
2.4 KiB
C++
61 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "ClothingSimulationFactory.h"
|
|
#include "HAL/IConsoleManager.h"
|
|
#include "Features/IModularFeatures.h"
|
|
|
|
const FName IClothingSimulationFactoryClassProvider::FeatureName = TEXT("ClothingSimulationFactoryClassProvider");
|
|
|
|
namespace ClothingSimulationFactoryConsoleVariables
|
|
{
|
|
TAutoConsoleVariable<FString> CVarDefaultClothingSimulationFactoryClass(
|
|
TEXT("p.Cloth.DefaultClothingSimulationFactoryClass"),
|
|
#if WITH_CHAOS_CLOTHING
|
|
TEXT("ChaosClothingSimulationFactory"), // Chaos is the default provider when Chaos Cloth is enabled
|
|
#elif WITH_APEX_CLOTHING
|
|
TEXT("ClothingSimulationFactoryNv"), // otherwise it's nv cloth
|
|
#else
|
|
TEXT(""), // otherwise it's none
|
|
#endif
|
|
TEXT("The class name of the default clothing simulation factory.\n")
|
|
TEXT("Known providers are:\n")
|
|
#if WITH_CHAOS_CLOTHING
|
|
TEXT("ChaosClothingSimulationFactory\n")
|
|
#endif
|
|
#if WITH_APEX_CLOTHING
|
|
TEXT("ClothingSimulationFactoryNv\n")
|
|
#endif
|
|
, ECVF_Cheat);
|
|
}
|
|
|
|
TSubclassOf<class UClothingSimulationFactory> UClothingSimulationFactory::GetDefaultClothingSimulationFactoryClass()
|
|
{
|
|
TSubclassOf<UClothingSimulationFactory> DefaultClothingSimulationFactoryClass = nullptr;
|
|
|
|
const FString DefaultClothingSimulationFactoryClassName = ClothingSimulationFactoryConsoleVariables::CVarDefaultClothingSimulationFactoryClass.GetValueOnAnyThread();
|
|
|
|
IModularFeatures::Get().LockModularFeatureList();
|
|
const TArray<IClothingSimulationFactoryClassProvider*> ClassProviders = IModularFeatures::Get().GetModularFeatureImplementations<IClothingSimulationFactoryClassProvider>(IClothingSimulationFactoryClassProvider::FeatureName);
|
|
IModularFeatures::Get().UnlockModularFeatureList();
|
|
for (const auto& ClassProvider : ClassProviders)
|
|
{
|
|
if (ClassProvider)
|
|
{
|
|
const TSubclassOf<UClothingSimulationFactory> ClothingSimulationFactoryClass = ClassProvider->GetClothingSimulationFactoryClass();
|
|
if (ClothingSimulationFactoryClass.Get() != nullptr)
|
|
{
|
|
// Always set the default to the last non null factory class (in case the search for the cvar doesn't yield any results)
|
|
DefaultClothingSimulationFactoryClass = ClothingSimulationFactoryClass;
|
|
|
|
// Early exit if the cvar string matches
|
|
if (ClothingSimulationFactoryClass->GetName() == DefaultClothingSimulationFactoryClassName)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return DefaultClothingSimulationFactoryClass;
|
|
}
|