3#include "IVSmokeHolePreset.h"
5static TMap<uint8, TWeakObjectPtr<UIVSmokeHolePreset>> GHolePresetRegistry;
7void UIVSmokeHolePreset::PostLoad()
11 RegisterToGlobalRegistry();
14void UIVSmokeHolePreset::BeginDestroy()
16 UnregisterFromGlobalRegistry();
18 Super::BeginDestroy();
21void UIVSmokeHolePreset::RegisterToGlobalRegistry()
23 uint8 ID =
static_cast<uint8
>(GetTypeHash(GetPathName()));
24 const uint8 StartID = ID;
25 TObjectPtr<UIVSmokeHolePreset> ToInsert =
this;
27 while (TObjectPtr<UIVSmokeHolePreset> Existing = GHolePresetRegistry.FindRef(ID).Get())
29 if (Existing == ToInsert)
34 if (ToInsert->GetPathName() < Existing->GetPathName())
36 GHolePresetRegistry.Remove(ID);
37 ToInsert->CachedID = ID;
38 GHolePresetRegistry.Add(ID, ToInsert);
46 ensureMsgf(
false, TEXT(
"[UIVSmokeHolePreset] Registry full: %s"), *ToInsert->GetName());
51 ToInsert->CachedID = ID;
52 GHolePresetRegistry.Add(ID, ToInsert);
55void UIVSmokeHolePreset::UnregisterFromGlobalRegistry()
57 GHolePresetRegistry.Remove(CachedID);
62 return GHolePresetRegistry.FindRef(InPresetID).Get();
69 return Curve.Get()->GetFloatValue(X);
static float GetFloatValue(const TObjectPtr< UCurveFloat > Curve, const float X)
static TObjectPtr< UIVSmokeHolePreset > FindByID(const uint8 InPresetID)