void UEdGraphNode::PostLoad() { Super::PostLoad(); // Create Guid if not present (and not CDO) if(!NodeGuid.IsValid() && !IsTemplate() && GetLinker() && GetLinker()->IsPersistent() && GetLinker()->IsLoading()) { UE_LOG(LogBlueprint, Warning, TEXT("Node '%s' missing NodeGuid."), *GetPathName()); // Generate new one CreateNewGuid(); } // Duplicating a Blueprint needs to have a new Node Guid generated, which was not occuring before this version if(GetLinkerUE4Version() < VER_UE4_POST_DUPLICATE_NODE_GUID) { // Generate new one CreateNewGuid(); } // Moving to the new style comments requires conversion to preserve previous state if(GetLinkerUE4Version() < VER_UE4_GRAPH_INTERACTIVE_COMMENTBUBBLES) { bCommentBubbleVisible = !NodeComment.IsEmpty(); } }
void USkeleton::PostLoad() { Super::PostLoad(); if( GetLinker() && (GetLinker()->UE4Ver() < VER_UE4_REFERENCE_SKELETON_REFACTOR) ) { // Convert RefLocalPoses & BoneTree to FReferenceSkeleton ConvertToFReferenceSkeleton(); } // catch any case if guid isn't valid check(Guid.IsValid()); }
/** Tags generated objects with flags */ void UPackage::TagSubobjects(EObjectFlags NewFlags) { Super::TagSubobjects(NewFlags); if (MetaData) { MetaData->SetFlags(NewFlags); } if (GetLinker()) { GetLinker()->SetFlags(NewFlags); } }
const TCHAR* UClassProperty::ImportText_Internal( const TCHAR* Buffer, void* Data, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText ) const { const TCHAR* Result = UObjectProperty::ImportText_Internal( Buffer, Data, PortFlags, Parent, ErrorText ); if( Result ) { CheckValidObject(Data); if (UClass* AssignedPropertyClass = dynamic_cast<UClass*>(GetObjectPropertyValue(Data))) { #if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING FLinkerLoad* PropertyLinker = GetLinker(); bool const bIsDeferringValueLoad = ((PropertyLinker == nullptr) || (PropertyLinker->LoadFlags & LOAD_DeferDependencyLoads)) && Cast<ULinkerPlaceholderClass>(MetaClass); #if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS check(bIsDeferringValueLoad || !Cast<ULinkerPlaceholderClass>(MetaClass)); #endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS #else // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING bool const bIsDeferringValueLoad = false; #endif // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING // Validate metaclass. if ((!AssignedPropertyClass->IsChildOf(MetaClass)) && !bIsDeferringValueLoad) { // the object we imported doesn't implement our interface class ErrorText->Logf(TEXT("Invalid object '%s' specified for property '%s'"), *AssignedPropertyClass->GetFullName(), *GetName()); SetObjectPropertyValue(Data, NULL); Result = NULL; } } } return Result; }
void USkeleton::PostLoad() { Super::PostLoad(); if( GetLinker() && (GetLinker()->UE4Ver() < VER_UE4_REFERENCE_SKELETON_REFACTOR) ) { // Convert RefLocalPoses & BoneTree to FReferenceSkeleton ConvertToFReferenceSkeleton(); } // Build look up table between Slot nodes and their Group. BuildSlotToGroupMap(); // catch any case if guid isn't valid check(Guid.IsValid()); }
/** * Returns the licensee version of the linker for this object. * * @return the licensee version of the engine's package file when this object * was last saved, or GPackageFileLicenseeVersion (current version) if * this object does not have a linker, which indicates that * a) this object is a native only class, or * b) this object's linker has been detached, in which case it is already fully loaded */ int32 UObjectBaseUtility::GetLinkerLicenseeUE4Version() const { ULinkerLoad* Loader = GetLinker(); // No linker. if( Loader == NULL ) { // the _Linker reference is never set for the top-most UPackage of a package (the linker root), so if this object // is the linker root, find our loader in the global list. if( GetOutermost() == this ) { Loader = ULinkerLoad::FindExistingLinkerForPackage(const_cast<UPackage*>(CastChecked<UPackage>((const UObject*)this))); } } if ( Loader != NULL ) { // We have a linker so we can return its version. return Loader->LicenseeUE4Ver(); } else { // We don't have a linker associated as we e.g. might have been saved or had loaders reset, ... return GPackageFileLicenseeUE4Version; } }
int32 UObjectBaseUtility::GetLinkerCustomVersion(FGuid CustomVersionKey) const { ULinkerLoad* Loader = GetLinker(); // No linker. if( Loader == NULL ) { // the _Linker reference is never set for the top-most UPackage of a package (the linker root), so if this object // is the linker root, find our loader in the global list. if( GetOutermost() == this ) { Loader = ULinkerLoad::FindExistingLinkerForPackage(const_cast<UPackage*>(CastChecked<UPackage>((const UObject*)this))); } } if ( Loader != NULL ) { // We have a linker so we can return its version. auto* CustomVersion = Loader->Summary.GetCustomVersionContainer().GetVersion(CustomVersionKey); return CustomVersion ? CustomVersion->Version : -1; } // We don't have a linker associated as we e.g. might have been saved or had loaders reset, ... // We must have a current version for this tag. auto* CustomVersion = FCustomVersionContainer::GetRegistered().GetVersion(CustomVersionKey); check(CustomVersion); return CustomVersion->Version; }
void USimpleConstructionScript::PreloadChain() { GetLinker()->Preload(this); for (USCS_Node* Node : RootNodes) { Node->PreloadChain(); } }
void CSpacePortal::OnRequestUseObject(int64 SourceID,ePipeline& RequestInfo){ int64 EventID = RequestInfo.PopInt(); ePipeline* ObjectInfo = (ePipeline*)RequestInfo.GetData(0); ePipeline* ExePipe = (ePipeline*)RequestInfo.GetData(1); CObjectData Object(*ObjectInfo); int64 ExecuterID = Object.m_ID; CLinker ExecuterLinker; GetLinker(ExecuterID,ExecuterLinker); if (!ExecuterLinker.IsValid()) { ExePipe->GetLabel() = Format1024(_T("Error: Executer not started.")); ExePipe->SetID(RETURN_ERROR); CLinker Requester; GetLinker(SourceID,Requester); if (Requester.IsValid()) { CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID); ePipeline& Letter = FeedbackMsg.GetLetter(); Letter.PushPipe(*ExePipe); Requester().PushMsgToSend(FeedbackMsg); } return; } PushExecuterEvent(ExecuterID,SourceID,EventID); WriteLogDB(_T("Use Object Event:%I64ld"),EventID); CMsg NewMsg(MSG_OBJECT_RUN,NULL,EventID); ePipeline& NewLetter = NewMsg.GetLetter(); NewLetter.PushPipe(*ExePipe); ExecuterLinker().PushMsgToSend(NewMsg); };
void UArrayProperty::LinkInternal(FArchive& Ar) { ULinkerLoad* MyLinker = GetLinker(); if( MyLinker ) { MyLinker->Preload(this); } Ar.Preload(Inner); Inner->Link(Ar); Super::LinkInternal(Ar); }
void CSpacePortal::OnRequestCloseObject(int64 SourceID,ePipeline& RequestInfo){ int64 EventID = RequestInfo.PopInt(); ePipeline* ObjectInfo = (ePipeline*)RequestInfo.GetData(0); ePipeline* ExePipe = (ePipeline*)RequestInfo.GetData(1); CObjectData Object(*ObjectInfo); //If it does not start the external organs, this is considered a normal close int64 ExecuterID = Object.m_ID; CLinker ExecuterLinker; GetLinker(ExecuterID,ExecuterLinker); if (!ExecuterLinker.IsValid()) { CLinker Requester; GetLinker(SourceID,Requester); if (Requester.IsValid()) { CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID); ePipeline& Letter = FeedbackMsg.GetLetter(); Letter.PushPipe(*ExePipe); Requester().PushMsgToSend(FeedbackMsg); } return; } PushExecuterEvent(ExecuterID,SourceID,EventID); WriteLogDB(_T("Close Object Event:%I64ld"),EventID); CMsg NewMsg(MSG_OBJECT_CLOSE,NULL,EventID); ePipeline& NewLetter = NewMsg.GetLetter(); NewLetter.PushPipe(*ExePipe); ExecuterLinker().PushMsgToSend(NewMsg); }
void UInterpCurveEdSetup::Serialize(FArchive& Ar) { Super::Serialize(Ar); if (Ar.IsLoading() && GetLinker() && (GetLinker()->UE3Ver() < 203)) { for (int32 i=0; i<Tabs.Num(); i++) { FCurveEdTab& Tab = Tabs[i]; for(int32 j=Tab.Curves.Num()-1; j>=0; j--) { FCurveEdEntry& Entry = Tab.Curves[j]; if (Entry.bHideCurve) { Entry.bHideCurve = 0x00000001; } } } } }
void UInheritableComponentHandler::PreloadAll() { if (HasAllFlags(RF_NeedLoad)) { auto Linker = GetLinker(); if (Linker) { Linker->Preload(this); } } PreloadAllTempates(); }
void UChildActorComponent::PostLoad() { Super::PostLoad(); // For a period of time the parent component property on Actor was not a UPROPERTY so this value was not set if (ChildActor) { FActorParentComponentSetter::Set(ChildActor, this); } // Since the template could have been changed we need to respawn the child actor // Don't do this if there is no linker which implies component was created via duplication if (ChildActorTemplate && GetLinker()) { DestroyChildActor(); } }
void UObjectPropertyBase::CheckValidObject(void* Value) const { UObject *Object = GetObjectPropertyValue(Value); if (Object) { // // here we want to make sure the the object value still matches the // object type expected by the property... UClass* ObjectClass = Object->GetClass(); // we could be in the middle of replacing references to the // PropertyClass itself (in the middle of an FArchiveReplaceObjectRef // pass)... if this is the case, then we might have already replaced // the object's class, but not the PropertyClass yet (or vise-versa)... // so we use this to ensure, in that situation, that we don't clear the // object value (if CLASS_NewerVersionExists is set, then we are likely // in the middle of an FArchiveReplaceObjectRef pass) bool bIsReplacingClassRefs = PropertyClass && PropertyClass->HasAnyClassFlags(CLASS_NewerVersionExists) != ObjectClass->HasAnyClassFlags(CLASS_NewerVersionExists); #if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING FLinkerLoad* PropertyLinker = GetLinker(); bool const bIsDeferringValueLoad = ((PropertyLinker == nullptr) || (PropertyLinker->LoadFlags & LOAD_DeferDependencyLoads)) && (Object->IsA<ULinkerPlaceholderExportObject>() || Object->IsA<ULinkerPlaceholderClass>()); #if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS check( bIsDeferringValueLoad || (!Object->IsA<ULinkerPlaceholderExportObject>() && !Object->IsA<ULinkerPlaceholderClass>()) ); #endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS #else // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING bool const bIsDeferringValueLoad = false; #endif // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING if ((PropertyClass != nullptr) && !ObjectClass->IsChildOf(PropertyClass) && !bIsReplacingClassRefs && !bIsDeferringValueLoad) { UE_LOG(LogProperty, Warning, TEXT("Serialized %s for a property of %s. Reference will be NULLed.\n Property = %s\n Item = %s"), *Object->GetClass()->GetFullName(), *PropertyClass->GetFullName(), *GetFullName(), *Object->GetFullName() ); SetObjectPropertyValue(Value, NULL); } } }
void UUserDefinedStruct::RecursivelyPreload() { ULinkerLoad* Linker = GetLinker(); if( Linker && (NULL == PropertyLink) ) { TArray<UObject*> AllChildMembers; GetObjectsWithOuter(this, AllChildMembers); for (int32 Index = 0; Index < AllChildMembers.Num(); ++Index) { UObject* Member = AllChildMembers[Index]; Linker->Preload(Member); } Linker->Preload(this); if (NULL == PropertyLink) { StaticLink(true); } } }
void USCS_Node::PreloadChain() { if( HasAnyFlags(RF_NeedLoad) ) { GetLinker()->Preload(this); } if (ComponentTemplate && ComponentTemplate->HasAnyFlags(RF_NeedLoad)) { ComponentTemplate->GetLinker()->Preload(ComponentTemplate); } for( TArray<USCS_Node*>::TIterator ChildIt(ChildNodes); ChildIt; ++ChildIt ) { USCS_Node* CurrentChild = *ChildIt; if( CurrentChild ) { CurrentChild->PreloadChain(); } } }
void UStructProperty::LinkInternal(FArchive& Ar) { // We potentially have to preload the property itself here, if we were the inner of an array property if(HasAnyFlags(RF_NeedLoad)) { GetLinker()->Preload(this); } #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) if (Struct == NULL) { UE_LOG(LogProperty, Error, TEXT("Struct type unknown for property '%s'; perhaps the USTRUCT() was renamed or deleted?"), *GetFullName()); } #endif // Preload is required here in order to load the value of Struct->PropertiesSize Ar.Preload(Struct); if ( !ensure(Struct) ) { Struct = GetFallbackStruct(); } PreloadInnerStructMembers(this); ElementSize = Align(Struct->PropertiesSize, Struct->GetMinAlignment()); if (Struct->StructFlags & STRUCT_IsPlainOldData) // if there is nothing to construct or the struct is known to be memcpy-able, then allow memcpy { PropertyFlags |= CPF_IsPlainOldData; } if (Struct->StructFlags & STRUCT_NoDestructor) { PropertyFlags |= CPF_NoDestructor; } if (Struct->StructFlags & STRUCT_ZeroConstructor) { PropertyFlags |= CPF_ZeroConstructor; } }
void CSpacePortal::OnRequestStartObject(int64 SourceID,ePipeline& RequestInfo){ int64 EventID = RequestInfo.PopInt(); ePipeline* ObjectInfo = (ePipeline*)RequestInfo.GetData(0); ePipeline* ExePipe = (ePipeline*)RequestInfo.GetData(1); CObjectData Object(*ObjectInfo); ePipeline AddrData = Object.m_Address; assert(Object.m_ID != 0); //Checks whether the specified object addresses is valid SpaceAddress Address = FindChildSpace(AddrData,Object.m_Fingerprint); if (!Address.IsValid()) { CLinker Requester; GetLinker(SourceID,Requester); if (Requester.IsValid()) { CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID); ePipeline& Letter = FeedbackMsg.GetLetter(); ExePipe->SetID(RETURN_ERROR); ExePipe->GetLabel() = Format1024(_T("Error: object address invalid")); Letter.PushPipe(*ExePipe); Requester().PushMsgToSend(FeedbackMsg); } return; } //Need to open the corresponding DLL object in advance, in order to determine the type of executer //CSpace Space(Address.ParentID,Address.ChildID); AddrData = Object.m_Address; tstring FilePath = SpacePath2FileAddress(AddrData); tstring ObjectName = GetFileName(Object.m_Name); //不含扩展名 FilePath += _T("\\")+ObjectName; FilePath += _T("\\")+Object.m_Name; Dll_Object TempDll(Object.m_ID,FilePath); if (!TempDll.IsValid()) { int32 error = ::GetLastError(); ExePipe->SetID(RETURN_ERROR); ExePipe->GetLabel() = Format1024(_T("Load object fail: <%s>"),FilePath.c_str()); CLinker Requester; GetLinker(SourceID,Requester); if (Requester.IsValid()) { CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID); ePipeline& Letter = FeedbackMsg.GetLetter(); Letter.PushPipe(*ExePipe); Requester().PushMsgToSend(FeedbackMsg); } return ; } DLL_TYPE DllType = TempDll.GetDllType(); tstring ExecuterFile; switch (DllType) { case DLL_VC6: { ExecuterFile = _T("EXE_VC6.EXE"); } break; case DLL_VC6D: { ExecuterFile = _T("EXE_VC6D.EXE"); } break; case DLL_VC10: { ExecuterFile = _T("EXE_VC10.EXE"); } break; case DLL_VC10D: { ExecuterFile = _T("EXE_VC10D.EXE"); } break; default: { ExePipe->GetLabel() = Format1024(_T("Error: dll type not support:%d"),(int)DllType); ExePipe->SetID(RETURN_ERROR); CLinker Requester; GetLinker(SourceID,Requester); if (Requester.IsValid()) { CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID); ePipeline& Letter = FeedbackMsg.GetLetter(); Letter.PushPipe(*ExePipe); Requester().PushMsgToSend(FeedbackMsg); } return; } } //start a executer int64 ExeSourceID = Object.m_ID; //ExecuterID is equal to the external object instance ID bool ret = StartExecuter(ExeSourceID,ExecuterFile); if (!ret) { ExePipe->GetLabel() = Format1024(_T("Error: Executer start fail.")); ExePipe->SetID(RETURN_ERROR); CLinker Requester; GetLinker(SourceID,Requester); if (Requester.IsValid()) { CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID); ePipeline& Letter = FeedbackMsg.GetLetter(); Letter.PushPipe(*ExePipe); Requester().PushMsgToSend(FeedbackMsg); } return; } RegisterExecuterUser(SourceID,ExeSourceID); CLinker ExecuterLinker; GetLinker(ExeSourceID,ExecuterLinker); //Register a start external object event PushExecuterEvent(ExeSourceID,SourceID,EventID); WriteLogDB(_T("Start Object Event:%I64ld"),EventID); //send execute msg CMsg NewMsg(MSG_OBJECT_START,NULL,EventID); ePipeline& NewLetter = NewMsg.GetLetter(); NewLetter.PushString(FilePath); NewLetter.PushPipe(*ExePipe); ExecuterLinker().PushMsgToSend(NewMsg); };