当前位置: 首页>>代码示例>>C++>>正文


C++ TWeakObjectPtr类代码示例

本文整理汇总了C++中TWeakObjectPtr的典型用法代码示例。如果您正苦于以下问题:C++ TWeakObjectPtr类的具体用法?C++ TWeakObjectPtr怎么用?C++ TWeakObjectPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TWeakObjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateActorAllViewsVisibility

void FLayers::UpdateActorAllViewsVisibility( const TWeakObjectPtr< AActor >& Actor )
{
	uint64 OriginalHiddenViews = Actor->HiddenEditorViews;

	for ( int32 ViewIndex = 0; ViewIndex < Editor->LevelViewportClients.Num(); ++ViewIndex )
	{
		// don't have this reattach, as we can do it once for all views
		UpdateActorViewVisibility(Editor->LevelViewportClients[ViewIndex], Actor, false);
	}

	// reregister if we changed the visibility bits, as the rendering thread needs them
	if (OriginalHiddenViews != Actor->HiddenEditorViews)
	{
		return;
	}

	Actor->MarkComponentsRenderStateDirty();

	// redraw all viewports if the actor
	for (int32 ViewIndex = 0; ViewIndex < Editor->LevelViewportClients.Num(); ViewIndex++)
	{
		// make sure we redraw all viewports
		Editor->LevelViewportClients[ViewIndex]->Invalidate();
	}
}
开发者ID:VZout,项目名称:Team6UnrealEngine,代码行数:25,代码来源:Layers.cpp

示例2: Generate

void FLightingBuildInfoStatsPage::Generate( TArray< TWeakObjectPtr<UObject> >& OutObjects ) const
{
	if(Entries.Num())
	{		
		for( auto It = Entries.CreateConstIterator(); It; ++It )
		{
			TWeakObjectPtr<ULightingBuildInfo> Entry = *It;
			if(Entry.IsValid())
			{
				ULightingBuildInfo* NewObject = DuplicateObject<ULightingBuildInfo>(Entry.Get(), Entry->GetOuter());
				NewObject->AddToRoot();
				OutObjects.Add( NewObject );
			}
		}
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:16,代码来源:LightingBuildInfoStatsPage.cpp

示例3:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Operations on selected actors.
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TArray< TWeakObjectPtr< AActor > > FLayers::GetSelectedActors() const
{
	// Unfortunately, the batch selection operation is not entirely effective
	// and the result can be that the iterator becomes invalid when adding an actor to a layer
	// due to unintended selection change notifications being fired.
	TArray< TWeakObjectPtr< AActor > > CurrentlySelectedActors;
	for( FSelectionIterator It( Editor->GetSelectedActorIterator() ); It; ++It )
	{
		const TWeakObjectPtr< AActor > Actor = static_cast< AActor* >( *It );
		checkSlow( Actor->IsA(AActor::StaticClass()) );

		CurrentlySelectedActors.Add( Actor );
	}

	return CurrentlySelectedActors;
}
开发者ID:VZout,项目名称:Team6UnrealEngine,代码行数:21,代码来源:Layers.cpp

示例4: FindIconNameForActor

FName FClassIconFinder::FindIconNameForActor( const TWeakObjectPtr<AActor>& InActor )
{
	// Actor specific overrides to normal per-class icons
	AActor* Actor = InActor.Get();
	FName BrushName = NAME_None;

	if ( Actor )
	{
		ABrush* Brush = Cast< ABrush >( Actor );
		if ( Brush )
		{
			if (Brush_Add == Brush->BrushType)
			{
				BrushName = TEXT( "ClassIcon.BrushAdditive" );
			}
			else if (Brush_Subtract == Brush->BrushType)
			{
				BrushName = TEXT( "ClassIcon.BrushSubtractive" );
			}
		}

		// Actor didn't specify an icon - fallback on the class icon
		if ( BrushName.IsNone() )
		{
			BrushName = FindIconNameForClass( Actor->GetClass() );
		}
	}
	else
	{
		// If the actor reference is NULL it must have been deleted
		BrushName = TEXT( "ClassIcon.Deleted" );
	}

	return BrushName;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:35,代码来源:ClassIconFinder.cpp

示例5: GetPlaceholderAsUObject

//------------------------------------------------------------------------------
int32 FLinkerPlaceholderBase::ResolvePlaceholderPropertyValues(UObject* NewObjectValue)
{
	int32 ResolvedTotal = 0;

	UObject* ThisAsUObject = GetPlaceholderAsUObject();
	for (auto& ReferencingPair : ReferencingContainers)
	{
		TWeakObjectPtr<UObject> ContainerPtr = ReferencingPair.Key;
		if (!ContainerPtr.IsValid())
		{
			continue;
		}
		UObject* Container = ContainerPtr.Get();

		for (const UObjectProperty* Property : ReferencingPair.Value)
		{
#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
			check(Property->GetOwnerClass() == Container->GetClass());
#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS

			TArray<const UProperty*> PropertyChain;
			LinkerPlaceholderObjectImpl::BuildPropertyChain(Property, PropertyChain);
			const UProperty* OutermostProperty = PropertyChain.Last();

			uint8* OutermostAddress = OutermostProperty->ContainerPtrToValuePtr<uint8>((uint8*)Container, /*ArrayIndex =*/0);
			int32 ResolvedCount = LinkerPlaceholderObjectImpl::ResolvePlaceholderValues(PropertyChain, PropertyChain.Num() - 1, OutermostAddress, ThisAsUObject, NewObjectValue);
			ResolvedTotal += ResolvedCount;

#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
			// we expect that (because we have had ReferencingProperties added) 
			// there should be at least one reference that is resolved... if 
			// there were none, then a property could have changed its value 
			// after it was set to this
			// 
			// NOTE: this may seem it can be resolved by properties removing 
			//       themselves from ReferencingProperties, but certain 
			//       properties may be the inner of a UArrayProperty (meaning 
			//       there could be multiple references per property)... we'd 
			//       have to inc/decrement a property ref-count to resolve that 
			//       scenario
			check(ResolvedCount > 0);
#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
		}
	}

	return ResolvedTotal;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:48,代码来源:LinkerPlaceholderBase.cpp

示例6: PurgeKilledObjects

// Purges any objects marked pending kill from the object list
void FObjectPropertyNode::PurgeKilledObjects()
{
	// Purge any objects that are marked pending kill from the object list
	for (int32 Index = 0; Index < Objects.Num(); )
	{
		TWeakObjectPtr<UObject> Object = Objects[Index];

		if ( !Object.IsValid() || Object->HasAnyFlags(RF_PendingKill) )
		{
			Objects.RemoveAt(Index, 1);
		}
		else
		{
			++Index;
		}
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:18,代码来源:ObjectPropertyNode.cpp

示例7: Validate

void UAblAbilityTaskDependencyValidator::Validate(const TWeakObjectPtr<UAblAbilityTaskValidatorContext>& Context, const TWeakObjectPtr<const UAblAbilityTask>& Task) const
{
	const TArray<UAblAbilityTask*>& AllTasks = Context->GetAbility()->GetTasks();
	for (const UAblAbilityTask* CurrentTask : AllTasks)
	{
		HasCircularDependency(Context, CurrentTask, CurrentTask);
	}
}
开发者ID:zpzsoft,项目名称:zpzsoft.github.io,代码行数:8,代码来源:ablAbilityTaskValidator.cpp

示例8:

void UK2Node_MacroInstance::FindInContentBrowser(TWeakObjectPtr<UK2Node_MacroInstance> MacroInstance)
{
	if ( MacroInstance.IsValid() )
	{
		UEdGraph* InstanceMacroGraph = MacroInstance.Get()->MacroGraphReference.GetGraph();
		if ( InstanceMacroGraph )
		{
			UBlueprint* BlueprintToSync = FBlueprintEditorUtils::FindBlueprintForGraph(InstanceMacroGraph);
			if ( BlueprintToSync )
			{
				TArray<UObject*> ObjectsToSync;
				ObjectsToSync.Add( BlueprintToSync );
				GEditor->SyncBrowserToObjects(ObjectsToSync);
			}
		}
	}
}
开发者ID:johndpope,项目名称:UE4,代码行数:17,代码来源:K2Node_MacroInstance.cpp

示例9: GetNodeComment

			// Called by the EditableText widget to get the current comment for the node
			static FString GetNodeComment(TWeakObjectPtr<UEdGraphNode> NodeWeakPtr)
			{
				if (UEdGraphNode* SelectedNode = NodeWeakPtr.Get())
				{
					return SelectedNode->NodeComment;
				}
				return FString();
			}
开发者ID:mysheng8,项目名称:UnrealEngine,代码行数:9,代码来源:EdGraphSchema.cpp

示例10: ExecuteFindMaterials

void FAssetTypeActions_Texture::ExecuteFindMaterials(TWeakObjectPtr<UTexture> Object)
{
	auto Texture = Object.Get();
	if ( Texture )
	{
		// @todo AssetTypeActions Implement FindMaterials using the asset registry.
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:8,代码来源:AssetTypeActions_Texture.cpp

示例11: Update

void FMovieSceneActorReferenceTrackInstance::Update(EMovieSceneUpdateData& UpdateData, const TArray<TWeakObjectPtr<UObject>>& RuntimeObjects, class IMovieScenePlayer& Player, FMovieSceneSequenceInstance& SequenceInstance ) 
{
	// TODO: Support default values.
	FGuid ActorReferenceGuid;
	if( ActorReferenceTrack->Eval( UpdateData.Position, UpdateData.LastPosition, ActorReferenceGuid ) )
	{
		AActor* CurrentActor = nullptr;
		if (GuidToActorCache.Contains(ActorReferenceGuid))
		{
			TWeakObjectPtr<AActor> CachedActor = *GuidToActorCache.Find(ActorReferenceGuid);
			if (CachedActor.IsValid())
			{
				CurrentActor = CachedActor.Get();
			}
		}

		if (CurrentActor == nullptr)
		{
			TArray<TWeakObjectPtr<UObject>> RuntimeObjectsForGuid;
			Player.GetRuntimeObjects(SequenceInstance.AsShared(), ActorReferenceGuid, RuntimeObjectsForGuid);
	
			if (RuntimeObjectsForGuid.Num() == 1)
			{
				AActor* ActorForGuid = Cast<AActor>(RuntimeObjectsForGuid[0].Get());

				if (ActorForGuid != nullptr)
				{
					CurrentActor = ActorForGuid;
					if (CurrentActor != nullptr)
					{
						GuidToActorCache.Add(ActorReferenceGuid, CurrentActor);
					}
				}
			}
		}

		if (CurrentActor != nullptr)
		{
			for (auto ObjectPtr : RuntimeObjects)
			{
				UObject* Object = ObjectPtr.Get();
				PropertyBindings->CallFunction<AActor*>(Object, &CurrentActor);
			}
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:46,代码来源:MovieSceneActorReferenceTrackInstance.cpp

示例12: GetTireFrictionScale

float UPhysicalMaterial::GetTireFrictionScale( TWeakObjectPtr<UTireType> TireType )
{
	float Scale = (TireType != NULL) ? TireType->GetFrictionScale() : 1.0f;

	Scale *= TireFrictionScale;

	for ( int32 i = TireFrictionScales.Num() - 1; i >= 0; --i )
	{
		if ( TireFrictionScales[i].TireType == TireType.Get() )
		{
			Scale *= TireFrictionScales[i].FrictionScale;
			break;
		}
	}

	return Scale;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:17,代码来源:PhysicalMaterial.cpp

示例13: GetObjectDisplayName

FString SObjectNameEditableTextBox::GetObjectDisplayName(TWeakObjectPtr<UObject> Object)
{
	FString Result;
	if(Object.IsValid())
	{
		UObject* ObjectPtr = Object.Get();
		if (ObjectPtr->IsA(AActor::StaticClass()))
		{
			Result =  ((AActor*)ObjectPtr)->GetActorLabel();
		}
		else
		{
			Result = ObjectPtr->GetName();
		}
	}
	return Result;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:17,代码来源:SObjectNameEditableTextBox.cpp

示例14: Super

UExporter::UExporter(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	if ( HasAnyFlags(RF_ClassDefaultObject) )
	{
		TWeakObjectPtr<UExporter> DefaultExporterObj(this);
		TWeakObjectPtr<UExporter>* PreviousObj = RegisteredExporters.Find(DefaultExporterObj);
		if(!PreviousObj)
		{
			RegisteredExporters.Add(DefaultExporterObj);
		}
		else if(!PreviousObj->IsValid())
		{
			RegisteredExporters.Remove(*PreviousObj);
			RegisteredExporters.Add(DefaultExporterObj);
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:18,代码来源:UnrealExporter.cpp

示例15: EnsureLayerExists

bool FLayers::InitializeNewActorLayers( const TWeakObjectPtr< AActor >& Actor )
{
	if(	!IsActorValidForLayer( Actor ) )
	{
		return false;
	}

	for( auto LayerNameIt = Actor->Layers.CreateConstIterator(); LayerNameIt; ++LayerNameIt )
	{
		const FName LayerName = *LayerNameIt;
		TWeakObjectPtr< ULayer > Layer = EnsureLayerExists( LayerName );

		Layer->Modify();
		AddActorToStats( Layer, Actor);
	}

	return Actor->Layers.Num() > 0;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:18,代码来源:Layers.cpp


注:本文中的TWeakObjectPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。