SHARE
TWEET

Fixed object

a guest May 11th, 2018 170 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void UObjectCompiledInDefer(UClass *(*InRegister)(), UClass *(*InStaticClass)(), const TCHAR* Name, const TCHAR* PackageName, bool bDynamic, const TCHAR* DynamicPathName, void (*InInitSearchableValues)(TMap<FName, FName>&))
  2. {
  3.     if (!bDynamic)
  4.     {
  5. #if WITH_HOT_RELOAD
  6.         UClass* ClassToHotReload = nullptr;
  7.         bool    bFound           = false;
  8.  
  9.         // Either add all classes if not hot-reloading, or those which have changed
  10.         TMap<FName, FFieldCompiledInInfo*>& DeferMap = GetDeferRegisterClassMap();
  11.         if (GIsHotReload)
  12.         {
  13.             FFieldCompiledInInfo* FoundInfo = DeferMap.FindChecked(Name);
  14.             if (FoundInfo->bHasChanged)
  15.             {
  16.                 bFound = true;
  17.                 ClassToHotReload = FoundInfo->OldClass;
  18.             }
  19.         }
  20.         if (!GIsHotReload || bFound)
  21. #endif
  22.         {
  23.             FString NoPrefix(RemoveClassPrefix(Name));
  24.             NotifyRegistrationEvent(PackageName, *NoPrefix, ENotifyRegistrationType::NRT_Class, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), false);
  25.             NotifyRegistrationEvent(PackageName, *(FString(DEFAULT_OBJECT_PREFIX) + NoPrefix), ENotifyRegistrationType::NRT_ClassCDO, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), false);
  26.  
  27.             TArray<UClass *(*)()>& DeferredCompiledInRegistration = GetDeferredCompiledInRegistration();
  28.             checkSlow(!DeferredCompiledInRegistration.Contains(InRegister));
  29.  
  30. #if WITH_HOT_RELOAD
  31.             // Mark existing class as no longer constructed and collapse the Children list so that it gets rebuilt upon registration
  32.             if (ClassToHotReload)
  33.             {
  34.                 ClassToHotReload->ClassFlags &= ~CLASS_Constructed;
  35.                 /*
  36.                 for (UField* Child = ClassToHotReload->Children; Child; )
  37.                 {
  38.                     UField* NextChild = Child->Next;
  39.                     Child->Next = nullptr;
  40.                     Child = NextChild;
  41.                 }
  42.                 ClassToHotReload->Children = nullptr;*/
  43.             }
  44. #endif
  45.  
  46.             DeferredCompiledInRegistration.Add(InRegister);
  47.         }
  48.     }
  49.     else
  50.     {
  51.         FDynamicClassStaticData ClassFunctions;
  52.         ClassFunctions.ZConstructFn = InRegister;
  53.         ClassFunctions.StaticClassFn = InStaticClass;
  54.         if (InInitSearchableValues)
  55.         {
  56.             InInitSearchableValues(ClassFunctions.SelectedSearchableValues);
  57.         }
  58.         GetDynamicClassMap().Add(FName(DynamicPathName), ClassFunctions);
  59.  
  60.         FString OriginalPackageName = DynamicPathName;
  61.         check(OriginalPackageName.EndsWith(Name));
  62.         OriginalPackageName.RemoveFromEnd(FString(Name));
  63.         check(OriginalPackageName.EndsWith(TEXT(".")));
  64.         OriginalPackageName.RemoveFromEnd(FString(TEXT(".")));
  65.  
  66.         NotifyRegistrationEvent(*OriginalPackageName, Name, ENotifyRegistrationType::NRT_Class, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), true);
  67.         NotifyRegistrationEvent(*OriginalPackageName, *(FString(DEFAULT_OBJECT_PREFIX) + Name), ENotifyRegistrationType::NRT_ClassCDO, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), true);
  68.     }
  69. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top