Files
UnrealEngineUWP/Engine/Source/Runtime/ClothingSystemRuntimeInterface/Private/ClothingSimulationFactory.cpp
Benn Gallagher 8757cb3641 Physics interface cleanup.
* Removed deprecated or dead code paths
* Simplified build system setup for physics support
* Deprecated build system flags and unsupported macros

#jira none
#rb Chris.Caulfield, Kriss.Gossart
#preflight 62963ec0fe779f23c8ea0c5e

[CL 20450744 by Benn Gallagher in ue5-main branch]
2022-06-01 06:59:18 -04:00

50 lines
2.1 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"),
TEXT("ChaosClothingSimulationFactory"), // Chaos is the default provider when Chaos Cloth is enabled
TEXT("The class name of the default clothing simulation factory.\n")
TEXT("Known providers are:\n")
TEXT("ChaosClothingSimulationFactory\n")
, 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;
}