You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
58 lines
2.3 KiB
C++
58 lines
2.3 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();
|
|
|
|
const TArray<IClothingSimulationFactoryClassProvider*> ClassProviders = IModularFeatures::Get().GetModularFeatureImplementations<IClothingSimulationFactoryClassProvider>(IClothingSimulationFactoryClassProvider::FeatureName);
|
|
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;
|
|
}
|