Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void UObjectCompiledInDefer(UClass *(*InRegister)(), UClass *(*InStaticClass)(), const TCHAR* Name, const TCHAR* PackageName, bool bDynamic, const TCHAR* DynamicPathName, void (*InInitSearchableValues)(TMap<FName, FName>&))
- {
- if (!bDynamic)
- {
- #if WITH_HOT_RELOAD
- UClass* ClassToHotReload = nullptr;
- bool bFound = false;
- // Either add all classes if not hot-reloading, or those which have changed
- TMap<FName, FFieldCompiledInInfo*>& DeferMap = GetDeferRegisterClassMap();
- if (GIsHotReload)
- {
- FFieldCompiledInInfo* FoundInfo = DeferMap.FindChecked(Name);
- if (FoundInfo->bHasChanged)
- {
- bFound = true;
- ClassToHotReload = FoundInfo->OldClass;
- }
- }
- if (!GIsHotReload || bFound)
- #endif
- {
- FString NoPrefix(RemoveClassPrefix(Name));
- NotifyRegistrationEvent(PackageName, *NoPrefix, ENotifyRegistrationType::NRT_Class, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), false);
- NotifyRegistrationEvent(PackageName, *(FString(DEFAULT_OBJECT_PREFIX) + NoPrefix), ENotifyRegistrationType::NRT_ClassCDO, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), false);
- TArray<UClass *(*)()>& DeferredCompiledInRegistration = GetDeferredCompiledInRegistration();
- checkSlow(!DeferredCompiledInRegistration.Contains(InRegister));
- #if WITH_HOT_RELOAD
- // Mark existing class as no longer constructed and collapse the Children list so that it gets rebuilt upon registration
- if (ClassToHotReload)
- {
- ClassToHotReload->ClassFlags &= ~CLASS_Constructed;
- /*
- for (UField* Child = ClassToHotReload->Children; Child; )
- {
- UField* NextChild = Child->Next;
- Child->Next = nullptr;
- Child = NextChild;
- }
- ClassToHotReload->Children = nullptr;*/
- }
- #endif
- DeferredCompiledInRegistration.Add(InRegister);
- }
- }
- else
- {
- FDynamicClassStaticData ClassFunctions;
- ClassFunctions.ZConstructFn = InRegister;
- ClassFunctions.StaticClassFn = InStaticClass;
- if (InInitSearchableValues)
- {
- InInitSearchableValues(ClassFunctions.SelectedSearchableValues);
- }
- GetDynamicClassMap().Add(FName(DynamicPathName), ClassFunctions);
- FString OriginalPackageName = DynamicPathName;
- check(OriginalPackageName.EndsWith(Name));
- OriginalPackageName.RemoveFromEnd(FString(Name));
- check(OriginalPackageName.EndsWith(TEXT(".")));
- OriginalPackageName.RemoveFromEnd(FString(TEXT(".")));
- NotifyRegistrationEvent(*OriginalPackageName, Name, ENotifyRegistrationType::NRT_Class, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), true);
- NotifyRegistrationEvent(*OriginalPackageName, *(FString(DEFAULT_OBJECT_PREFIX) + Name), ENotifyRegistrationType::NRT_ClassCDO, ENotifyRegistrationPhase::NRP_Added, (UObject *(*)())(InRegister), true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement