Files
UnrealEngineUWP/Engine/Source/Runtime/ClothingSystemRuntimeInterface/Private/ClothingSimulationInteractor.cpp
Zousar Shaker fd2e870030 Automated search-and-replace pass to change uses of UE_TRANSITIONAL_OBJECT_PTR(Type) to TObjectPtr<Type>.
There were two instance of the type being incorrect and they were manually fixed.

#rb none

[CL 17472048 by Zousar Shaker in ue5-main branch]
2021-09-09 10:05:04 -04:00

53 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ClothingSimulationInteractor.h"
#include "ClothingAssetBase.h"
#include "ClothingSimulationInterface.h"
void UClothingSimulationInteractor::CreateClothingInteractor(const UClothingAssetBase* ClothingAsset, int32 ClothingId)
{
if (ClothingAsset)
{
if (UClothingInteractor* const ClothingInteractor = CreateClothingInteractor())
{
ClothingInteractor->ClothingId = ClothingId;
ClothingInteractors.Emplace(ClothingAsset->GetName(), ClothingInteractor);
}
}
}
void UClothingSimulationInteractor::DestroyClothingInteractors()
{
ClothingInteractors.Reset();
}
UClothingInteractor* UClothingSimulationInteractor::GetClothingInteractor(const FString& ClothingAssetName) const
{
if (const TObjectPtr<UClothingInteractor>* ClothingInteractor = ClothingInteractors.Find(FName(ClothingAssetName)))
{
return *ClothingInteractor;
}
// Returning the default object will still make this a valid ClothingInteractor pointer, but one with no type or interface
return UClothingInteractor::StaticClass()->GetDefaultObject<UClothingInteractor>();
}
void UClothingSimulationInteractor::Sync(IClothingSimulation* Simulation, IClothingSimulationContext* Context)
{
LastNumCloths = Simulation->GetNumCloths();
LastNumKinematicParticles = Simulation->GetNumKinematicParticles();
LastNumDynamicParticles = Simulation->GetNumDynamicParticles();
LastNumIterations = Simulation->GetNumIterations();
LastNumSubsteps = Simulation->GetNumSubsteps();
LastSimulationTime = Simulation->GetSimulationTime();
for (const auto& ClothingInteractor : UClothingSimulationInteractor::ClothingInteractors)
{
if (ClothingInteractor.Value)
{
ClothingInteractor.Value->Sync(Simulation);
}
}
}