本文整理汇总了C++中UObject::IsPendingKill方法的典型用法代码示例。如果您正苦于以下问题:C++ UObject::IsPendingKill方法的具体用法?C++ UObject::IsPendingKill怎么用?C++ UObject::IsPendingKill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UObject
的用法示例。
在下文中一共展示了UObject::IsPendingKill方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostReceivedBunch
void FObjectReplicator::PostReceivedBunch()
{
if ( GetObject() == NULL )
{
UE_LOG(LogNet, Verbose, TEXT("PostReceivedBunch: Object == NULL"));
return;
}
// Call PostNetReceive
const bool bIsServer = (OwningChannel->Connection->Driver->ServerConnection == NULL);
if (!bIsServer && bHasReplicatedProperties)
{
PostNetReceive();
bHasReplicatedProperties = false;
}
// Check if PostNetReceive() destroyed Object
UObject *Object = GetObject();
if (Object == NULL || Object->IsPendingKill())
{
return;
}
// Call RepNotifies
CallRepNotifies(true);
if (!Object->IsPendingKill())
{
Object->PostRepNotifies();
}
}
示例2: InnerList
FExportObjectInnerContext::FExportObjectInnerContext(TArray<UObject*>& ObjsToIgnore)
{
// For each object . . .
for ( TObjectIterator<UObject> It ; It ; ++It )
{
UObject* InnerObj = *It;
if ( !InnerObj->IsPendingKill() )
{
if ( !ObjsToIgnore.Contains(InnerObj) )
{
UObject* OuterObj = InnerObj->GetOuter();
if ( OuterObj && !OuterObj->IsPendingKill() )
{
InnerList* Inners = ObjectToInnerMap.Find( OuterObj );
if ( Inners )
{
// Add object to existing inner list.
Inners->Add( InnerObj );
}
else
{
// Create a new inner list for the outer object.
InnerList& InnersForOuterObject = ObjectToInnerMap.Add( OuterObj, InnerList() );
InnersForOuterObject.Add( InnerObj );
}
}
}
}
}
}
示例3: InnerList
FExportObjectInnerContext::FExportObjectInnerContext(TArray<UObject*>& ObjsToIgnore)
{
// For each object . . .
for (UObject* InnerObj : TObjectRange<UObject>(RF_ClassDefaultObject | RF_PendingKill))
{
if (!ObjsToIgnore.Contains(InnerObj))
{
UObject* OuterObj = InnerObj->GetOuter();
if (OuterObj && !OuterObj->IsPendingKill())
{
InnerList* Inners = ObjectToInnerMap.Find(OuterObj);
if (Inners)
{
// Add object to existing inner list.
Inners->Add(InnerObj);
}
else
{
// Create a new inner list for the outer object.
InnerList& InnersForOuterObject = ObjectToInnerMap.Add(OuterObj, InnerList());
InnersForOuterObject.Add(InnerObj);
}
}
}
}
}
示例4: PassesFilter
bool FFrontendFilter_InUseByLoadedLevels::PassesFilter(FAssetFilterType InItem) const
{
bool bObjectInUse = false;
if ( InItem.IsAssetLoaded() )
{
UObject* Asset = InItem.GetAsset();
const bool bUnreferenced = !Asset->HasAnyMarks( OBJECTMARK_TagExp );
const bool bIndirectlyReferencedObject = Asset->HasAnyMarks( OBJECTMARK_TagImp );
const bool bRejectObject =
Asset->GetOuter() == NULL || // Skip objects with null outers
Asset->HasAnyFlags( RF_Transient ) || // Skip transient objects (these shouldn't show up in the CB anyway)
Asset->IsPendingKill() || // Objects that will be garbage collected
bUnreferenced || // Unreferenced objects
bIndirectlyReferencedObject; // Indirectly referenced objects
if( !bRejectObject && Asset->HasAnyFlags( RF_Public ) )
{
// The object is in use
bObjectInUse = true;
}
}
return bObjectInUse;
}
示例5: ClearEffects
void FGameplayCueHandler::ClearEffects(TArray< TSharedPtr<FGameplayCueViewEffects> > &Effects)
{
bool RemovedSomething = false;
for (TSharedPtr<FGameplayCueViewEffects> &EffectPtr : Effects)
{
if (!EffectPtr.IsValid())
{
continue;
}
FGameplayCueViewEffects &Effect = *EffectPtr.Get();
if (Effect.SpawnedActor.IsValid())
{
Effect.SpawnedActor->Destroy();
RemovedSomething = true;
}
if (Effect.AudioComponent.IsValid())
{
Effect.AudioComponent->Stop();
RemovedSomething = true;
}
if (Effect.ParticleSystemComponent.IsValid())
{
Effect.ParticleSystemComponent->DestroyComponent();
RemovedSomething = true;
}
}
Effects.Empty();
// Cleanup flat array
if (RemovedSomething)
{
for (int32 idx=0; idx < SpawnedObjects.Num(); ++idx)
{
UObject *Obj = SpawnedObjects[idx];
if (!Obj || Obj->IsPendingKill())
{
SpawnedObjects.RemoveAtSwap(idx);
idx--;
}
}
}
}
示例6: PostReceivedBunch
void FObjectReplicator::PostReceivedBunch()
{
// Call PostNetReceive
const bool bIsServer = (OwningChannel->Connection->Driver->ServerConnection == NULL);
if (!bIsServer && bHasReplicatedProperties)
{
PostNetReceive();
bHasReplicatedProperties = false;
}
// Check if PostNetReceive() destroyed Object
UObject *Object = GetObject();
if (Object == NULL || Object->IsPendingKill())
{
return;
}
RepLayout->CallRepNotifies( RepState, Object );
// Call RepNotifies
if ( RepNotifies.Num() > 0 )
{
for (int32 RepNotifyIdx = 0; RepNotifyIdx < RepNotifies.Num(); RepNotifyIdx++)
{
//UE_LOG(LogNet, Log, TEXT("Calling Object->%s with %s"), *RepNotifies(RepNotifyIdx)->RepNotifyFunc.ToString(), *RepNotifies(RepNotifyIdx)->GetName());
UProperty* RepProperty = RepNotifies[RepNotifyIdx];
UFunction* RepNotifyFunc = Object->FindFunctionChecked(RepProperty->RepNotifyFunc);
if (RepNotifyFunc->NumParms == 0)
{
Object->ProcessEvent(RepNotifyFunc, NULL);
}
else if (RepNotifyFunc->NumParms == 1)
{
Object->ProcessEvent(RepNotifyFunc, RepProperty->ContainerPtrToValuePtr<uint8>(RepState->StaticBuffer.GetTypedData()) );
}
else if (RepNotifyFunc->NumParms == 2)
{
// Fixme: this isn't as safe as it could be. Right now we have two types of parameters: MetaData (a TArray<uint8>)
// and the last local value (pointer into the Recent[] array).
//
// Arrays always expect MetaData. Everything else, including structs, expect last value.
// This is enforced with UHT only. If a ::NetSerialize function ever starts producing a MetaData array thats not in UArrayProperty,
// we have no static way of catching this and the replication system could pass the wrong thing into ProcessEvent here.
//
// But this is all sort of an edge case feature anyways, so its not worth tearing things up too much over.
FMemMark Mark(FMemStack::Get());
uint8* Parms = new(FMemStack::Get(),MEM_Zeroed,RepNotifyFunc->ParmsSize)uint8;
TFieldIterator<UProperty> Itr(RepNotifyFunc);
check(Itr);
Itr->CopyCompleteValue( Itr->ContainerPtrToValuePtr<void>(Parms), RepProperty->ContainerPtrToValuePtr<uint8>(RepState->StaticBuffer.GetTypedData()) );
++Itr;
check(Itr);
TArray<uint8> *NotifyMetaData = RepNotifyMetaData.Find(RepNotifies[RepNotifyIdx]);
check(NotifyMetaData);
Itr->CopyCompleteValue( Itr->ContainerPtrToValuePtr<void>(Parms), NotifyMetaData );
Object->ProcessEvent(RepNotifyFunc, Parms );
Mark.Pop();
}
if (Object == NULL || Object->IsPendingKill())
{
// script event destroyed Object
break;
}
}
}
RepNotifies.Reset();
RepNotifyMetaData.Empty();
}
示例7: ReceivedBunch
//.........这里部分代码省略.........
// Get the parameters.
FMemMark Mark(FMemStack::Get());
uint8* Parms = new(FMemStack::Get(),MEM_Zeroed,Function->ParmsSize)uint8;
// Use the replication layout to receive the rpc parameter values
TSharedPtr<FRepLayout> FuncRepLayout = OwningChannel->Connection->Driver->GetFunctionRepLayout( Function );
FuncRepLayout->ReceivePropertiesForRPC( Object, Function, OwningChannel, Bunch, Parms );
if ( Bunch.IsError() )
{
UE_LOG( LogNet, Error, TEXT( "ReceivedBunch: ReceivePropertiesForRPC - Bunch.IsError() == true: %s" ), *Object->GetFullName() );
return false;
}
// validate that the function is callable here
const bool bCanExecute = ( ( !bIsServer || RepFlags.bNetOwner ) ); // we are client or net owner
if ( bCanExecute )
{
// Call the function.
RPC_ResetLastFailedReason();
Object->ProcessEvent( Function, Parms );
if ( RPC_GetLastFailedReason() != NULL )
{
UE_LOG( LogNet, Error, TEXT( "ReceivedBunch: RPC_GetLastFailedReason: %s" ), RPC_GetLastFailedReason() );
return false;
}
}
else
{
UE_LOG( LogNet, Warning, TEXT( "Rejected unwanted function %s in %s" ), *Message.ToString(), *Object->GetFullName() );
if ( !OwningChannel->Connection->TrackLogsPerSecond() ) // This will disconnect the client if we get her too often
{
return false;
}
}
// Destroy the parameters.
//warning: highly dependent on UObject::ProcessEvent freeing of parms!
for ( UProperty * Destruct=Function->DestructorLink; Destruct; Destruct=Destruct->DestructorLinkNext )
{
if( Destruct->IsInContainer(Function->ParmsSize) )
{
Destruct->DestroyValue_InContainer(Parms);
}
}
Mark.Pop();
if ( Object == NULL || Object->IsPendingKill() )
{
// replicated function destroyed Object
return true; // FIXME: Should this return false to kick connection? Seems we'll cause a read misalignment here if we don't
}
// Next.
RepIndex = Bunch.ReadInt( ClassCache->GetMaxIndex() + 1 );
if ( Bunch.IsError() )
{
UE_LOG( LogNet, Error, TEXT( "ReceivedBunch: Error reading bunch 2: %s" ), *Object->GetFullName() );
return false;
}
if ( RepIndex > ClassCache->GetMaxIndex() )
{
UE_LOG( LogNet, Error, TEXT( "ReceivedBunch: RepIndex too large: %s" ), *Object->GetFullName() );
return false;
}
if ( RepIndex == ClassCache->GetMaxIndex() )
{
// We're done
FieldCache = NULL;
}
else
{
FieldCache = ClassCache->GetFromIndex( RepIndex );
if ( FieldCache == NULL )
{
UE_LOG( LogNet, Error, TEXT( "ReceivedBunch: FieldCache == NULL: %s" ), *Object->GetFullName() );
return false;
}
}
}
else if ( FieldCache )
{
UE_LOG( LogNet, Error, TEXT( "ReceivedBunch: Invalid replicated field %i in %s" ), RepIndex, *Object->GetFullName() );
return false;
}
}
return true;
}
示例8: ExportObjectInner
void UExporter::ExportObjectInner(const FExportObjectInnerContext* Context, UObject* Object, FOutputDevice& Ar, uint32 PortFlags, bool bSkipComponents)
{
// indent all the text in here
TextIndent += 3;
FExportObjectInnerContext::InnerList ObjectInners;
if ( Context )
{
const FExportObjectInnerContext::InnerList* Inners = Context->ObjectToInnerMap.Find( Object );
if ( Inners )
{
ObjectInners = *Inners;
}
}
else
{
for (TObjectIterator<UObject> It; It; ++It)
{
if ( It->GetOuter() == Object )
{
ObjectInners.Add( *It );
}
}
}
TArray<UObject*> Components;
if (!bSkipComponents)
{
// first export the components
Object->CollectDefaultSubobjects(Components, false);
}
if (!(PortFlags & PPF_SeparateDefine))
{
for ( int32 ObjIndex = 0 ; ObjIndex < ObjectInners.Num() ; ++ObjIndex )
{
// NOTE: We ignore inner objects that have been tagged for death
UObject* Obj = ObjectInners[ObjIndex];
if ( !Obj->IsPendingKill() && !Obj->IsDefaultSubobject() && !Obj->HasAnyFlags(RF_TextExportTransient) && FCString::Stricmp(*Obj->GetClass()->GetName(), TEXT("Model")) != 0)
{
// export the object
UExporter::ExportToOutputDevice( Context, Obj, NULL, Ar, (PortFlags & PPF_Copy) ? TEXT("Copy") : TEXT("T3D"), TextIndent, PortFlags | PPF_SeparateDeclare, false, ExportRootScope );
}
}
if (!bSkipComponents)
{
ExportComponentDefinitions(Context, Components, Ar, PortFlags | PPF_SeparateDeclare);
}
}
if (!(PortFlags & PPF_SeparateDeclare))
{
for ( int32 ObjIndex = 0 ; ObjIndex < ObjectInners.Num() ; ++ObjIndex )
{
// NOTE: We ignore inner objects that have been tagged for death
UObject* Obj = ObjectInners[ObjIndex];
if ( !Obj->IsPendingKill() && !Obj->IsDefaultSubobject() && !Obj->HasAnyFlags(RF_TextExportTransient) && FCString::Stricmp(*Obj->GetClass()->GetName(), TEXT("Model")) != 0)
{
// export the object
UExporter::ExportToOutputDevice( Context, Obj, NULL, Ar, (PortFlags & PPF_Copy) ? TEXT("Copy") : TEXT("T3D"), TextIndent, PortFlags | PPF_SeparateDefine, false, ExportRootScope );
// don't reexport below in ExportProperties
Obj->Mark(OBJECTMARK_TagImp);
}
}
if (!bSkipComponents)
{
ExportComponentDefinitions(Context, Components, Ar, PortFlags | PPF_SeparateDefine);
}
// export the object's properties
// Note: we use archetype as the object to diff properties against before they exported. When object is created, they should create from archetype
// and using this system, it should recover all properties it needs to copy
uint8 *CompareObject;
if (Object->HasAnyFlags(RF_ClassDefaultObject))
{
CompareObject = (uint8*)Object;
}
else
{
CompareObject = (uint8*)Object->GetArchetype();
}
ExportProperties( Context, Ar, Object->GetClass(), (uint8*)Object, TextIndent, Object->GetClass(), CompareObject, Object, PortFlags, ExportRootScope );
if (!bSkipComponents)
{
// Export anything extra for the components. Used for instanced foliage.
// This is done after the actor properties so these are set when regenerating the extra data objects.
ExportComponentExtra( Context, Components, Ar, PortFlags );
}
}
// remove indent
TextIndent -= 3;
}
示例9: ReceivedBunch
//.........这里部分代码省略.........
UFunction * Function = Object->FindFunction( Message );
if ( Function == NULL )
{
UE_LOG(LogNet, Error, TEXT("ReceivedBunch: Function == NULL: %s"), *Object->GetFullName());
return false;
}
if ( ( Function->FunctionFlags & FUNC_Net ) == 0 )
{
UE_LOG(LogRep, Error, TEXT("Rejected non RPC function %s in %s"), *Message.ToString(), *Object->GetFullName());
return false;
}
if ( ( Function->FunctionFlags & ( bIsServer ? FUNC_NetServer : ( FUNC_NetClient | FUNC_NetMulticast ) ) ) == 0 )
{
UE_LOG(LogRep, Error, TEXT("Rejected RPC function due to access rights %s in %s"), *Message.ToString(), *Object->GetFullName());
return false;
}
UE_LOG(LogRepTraffic, Log, TEXT(" Received RPC: %s"), *Message.ToString());
// Get the parameters.
FMemMark Mark(FMemStack::Get());
uint8* Parms = new(FMemStack::Get(),MEM_Zeroed,Function->ParmsSize)uint8;
// Use the replication layout to receive the rpc parameter values
TSharedPtr<FRepLayout> FuncRepLayout = OwningChannel->Connection->Driver->GetFunctionRepLayout( Function );
FuncRepLayout->ReceivePropertiesForRPC( Object, Function, OwningChannel, Bunch, Parms );
if ( Bunch.IsError() )
{
UE_LOG(LogRep, Error, TEXT("ReceivedBunch: ReceivePropertiesForRPC - Bunch.IsError() == true: Function: %s, Object: %s"), *Message.ToString(), *Object->GetFullName());
return false;
}
// validate that the function is callable here
const bool bCanExecute = ( !bIsServer || RepFlags.bNetOwner ); // we are client or net owner
if ( bCanExecute )
{
// Call the function.
RPC_ResetLastFailedReason();
Object->ProcessEvent( Function, Parms );
if ( RPC_GetLastFailedReason() != NULL )
{
UE_LOG(LogRep, Error, TEXT("ReceivedBunch: RPC_GetLastFailedReason: %s"), RPC_GetLastFailedReason());
return false;
}
}
else
{
UE_LOG(LogRep, Verbose, TEXT("Rejected unwanted function %s in %s"), *Message.ToString(), *Object->GetFullName());
if ( !OwningChannel->Connection->TrackLogsPerSecond() ) // This will disconnect the client if we get here too often
{
UE_LOG(LogRep, Error, TEXT("Rejected too many unwanted functions %s in %s"), *Message.ToString(), *Object->GetFullName());
return false;
}
}
// Destroy the parameters.
//warning: highly dependent on UObject::ProcessEvent freeing of parms!
for ( UProperty * Destruct=Function->DestructorLink; Destruct; Destruct=Destruct->DestructorLinkNext )
{
if( Destruct->IsInContainer(Function->ParmsSize) )
{
Destruct->DestroyValue_InContainer(Parms);
}
}
Mark.Pop();
if ( Object == NULL || Object->IsPendingKill() )
{
// replicated function destroyed Object
return true; // FIXME: Should this return false to kick connection? Seems we'll cause a read misalignment here if we don't
}
// Next.
FieldCache = ReadField( ClassCache, Bunch );
if ( Bunch.IsError() )
{
UE_LOG(LogNet, Error, TEXT("ReceivedBunch: Error reading field 3: %s"), *Object->GetFullName());
return false;
}
}
else if ( FieldCache )
{
UE_LOG(LogRep, Error, TEXT("ReceivedBunch: Invalid replicated field %i in %s"), FieldCache->FieldNetIndex, *Object->GetFullName());
return false;
}
}
return true;
}
示例10: UpdateUnmappedObjects
void FObjectReplicator::UpdateUnmappedObjects( bool & bOutHasMoreUnmapped )
{
UObject* Object = GetObject();
if ( Object == NULL || Object->IsPendingKill() )
{
bOutHasMoreUnmapped = false;
return;
}
if ( Connection->State == USOCK_Closed )
{
UE_LOG(LogNet, Warning, TEXT("FObjectReplicator::UpdateUnmappedObjects: Connection->State == USOCK_Closed"));
return;
}
checkf( RepState->RepNotifies.Num() == 0, TEXT("Failed RepState RepNotifies check. Num=%d. Object=%s"), RepState->RepNotifies.Num(), *Object->GetFullName() );
checkf( RepNotifies.Num() == 0, TEXT("Failed replicator RepNotifies check. Num=%d. Object=%s."), RepNotifies.Num(), *Object->GetFullName() );
bool bSomeObjectsWereMapped = false;
// Let the rep layout update any unmapped properties
RepLayout->UpdateUnmappedObjects( RepState, Connection->PackageMap, Object, bSomeObjectsWereMapped, bOutHasMoreUnmapped );
// Update unmapped objects for custom properties (currently just fast tarray)
for ( auto It = UnmappedCustomProperties.CreateIterator(); It; ++It )
{
const int32 Offset = It.Key();
UStructProperty* StructProperty = It.Value();
UScriptStruct* InnerStruct = StructProperty->Struct;
check( InnerStruct->StructFlags & STRUCT_NetDeltaSerializeNative );
UScriptStruct::ICppStructOps* CppStructOps = InnerStruct->GetCppStructOps();
check( CppStructOps );
check( !InnerStruct->InheritedCppStructOps() );
FNetDeltaSerializeInfo Parms;
FNetSerializeCB NetSerializeCB( OwningChannel->Connection->Driver );
Parms.DebugName = StructProperty->GetName();
Parms.Struct = InnerStruct;
Parms.Map = Connection->PackageMap;
Parms.NetSerializeCB = &NetSerializeCB;
Parms.bUpdateUnmappedObjects = true;
Parms.bCalledPreNetReceive = bSomeObjectsWereMapped; // RepLayout used this to flag whether PreNetReceive was called
Parms.Object = Object;
// Call the custom delta serialize function to handle it
CppStructOps->NetDeltaSerialize( Parms, (uint8*)Object + Offset );
// Merge in results
bSomeObjectsWereMapped |= Parms.bOutSomeObjectsWereMapped;
bOutHasMoreUnmapped |= Parms.bOutHasMoreUnmapped;
if ( Parms.bOutSomeObjectsWereMapped )
{
// If we mapped a property, call the rep notify
TArray<uint8> MetaData;
QueuePropertyRepNotify( Object, StructProperty, 0, MetaData );
}
// If this property no longer has unmapped objects, we can stop checking it
if ( !Parms.bOutHasMoreUnmapped )
{
It.RemoveCurrent();
}
}
// Call any rep notifies that need to happen when object pointers change
// Pass in false to override the check for queued bunches. Otherwise, if the owning channel has queued bunches,
// the RepNotifies will remain in the list and the check for 0 RepNotifies above will fail next time.
CallRepNotifies(false);
if ( bSomeObjectsWereMapped )
{
// If we mapped some objects, make sure to call PostNetReceive (some game code will need to think this was actually replicated to work)
PostNetReceive();
}
}
示例11: PreUpdate
void FMovieSceneSequenceInstance::PreUpdate(class IMovieScenePlayer& Player)
{
// Remove any stale runtime objects
TMap<FGuid, FMovieSceneObjectBindingInstance>::TIterator ObjectIt = ObjectBindingInstances.CreateIterator();
for(; ObjectIt; ++ObjectIt )
{
FMovieSceneObjectBindingInstance& ObjectBindingInstance = ObjectIt.Value();
for (int32 ObjectIndex = 0; ObjectIndex < ObjectBindingInstance.RuntimeObjects.Num(); )
{
UObject* RuntimeObject = ObjectBindingInstance.RuntimeObjects[ObjectIndex].Get();
if (RuntimeObject == nullptr || RuntimeObject->HasAnyFlags(RF_BeginDestroyed|RF_FinishDestroyed) || RuntimeObject->IsPendingKill())
{
ObjectBindingInstance.RuntimeObjects.RemoveAt(ObjectIndex);
}
else
{
++ObjectIndex;
}
}
}
Player.GetSpawnRegister().PreUpdateSequenceInstance(*this, Player);
}