• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TWeakObjectPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Super

UExporter::UExporter(const FObjectInitializer& ObjectInitializer)
    : Super(ObjectInitializer)
{
    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:kidaa,项目名称:UnrealEngineVR,代码行数:18,代码来源:UnrealExporter.cpp


示例17: MakeAllLayersVisible

void FLayers::MakeAllLayersVisible()
{
	TArray< FName > AllLayerNames;
	FLayers::AddAllLayerNamesTo( AllLayerNames );
	for( auto LayerIt = GetWorld()->Layers.CreateIterator(); LayerIt; ++LayerIt )
	{
		TWeakObjectPtr< ULayer > Layer = *LayerIt;

		if( !Layer->bIsVisible )
		{
			Layer->Modify();
			Layer->bIsVisible = true;
			LayersChanged.Broadcast( ELayersAction::Modify, Layer, "bIsVisible" );
		}
	}

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


示例18: PurgeInvalidObjectNodes

void FPropertyTable::PurgeInvalidObjectNodes()
{
	TArray< TSharedRef< FObjectPropertyNode > > ValidNodes;
	for( auto NodeIter = SourceObjectPropertyNodes.CreateIterator(); NodeIter; ++NodeIter )
	{
		const TWeakObjectPtr< UObject > Object = NodeIter.Key();

		if ( !Object.IsValid() )
		{
			ValidNodes.Add( NodeIter.Value() );
		}
	}

	SourceObjectPropertyNodes.Empty();
	for( auto NodeIter = ValidNodes.CreateIterator(); NodeIter; ++NodeIter )
	{
		const TSharedRef< FObjectPropertyNode >& CurrentNode = *NodeIter;
		SourceObjectPropertyNodes.Add( CurrentNode->GetUObject( 0 ), CurrentNode );
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:20,代码来源:PropertyTable.cpp


示例19: CreateChildrenForPins

void FBPProfilerBranchStat::CreateChildrenForPins()
{
	TWeakObjectPtr<const UObject> ObjectPtr = ObjectContext.GetObjectPtr();
	bAreExecutionPathsSequential = IsBranchSequential();
	if (const UEdGraphNode* GraphNode = Cast<const UEdGraphNode>(ObjectPtr.Get()))
	{
		for (auto Pin : GraphNode->Pins)
		{
			if (Pin->Direction == EGPD_Output && Pin->PinType.PinCategory == UEdGraphSchema_K2::PC_Exec)
			{
				FBPProfilerStatPtr& Result = CachedChildren.FindOrAdd(Pin);
				if (!Result.IsValid())
				{
					FScriptExecEvent NewExitPin(Pin, ObjectContext);
					Result = MakeShareable(new FBPProfilerStat(AsShared(), NewExitPin));
				}
			}
		}
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:20,代码来源:BPProfilerStatisticWidgets.cpp


示例20: GetCurveName

	/** Called to get the name of a curve back from the animation skeleton */
	virtual FText GetCurveName(USkeleton::AnimCurveUID Uid) const
	{
		if(BaseSequence.IsValid())
		{
			FSmartNameMapping* NameMapping = BaseSequence.Get()->GetSkeleton()->SmartNames.GetContainer(USkeleton::AnimCurveMappingName);
			if(NameMapping)
			{
				FName CurveName;
				if(NameMapping->GetName(Uid, CurveName))
				{
					return FText::FromName(CurveName);
				}
			}
		}
		return FText::GetEmpty();
	}
开发者ID:Codermay,项目名称:Unreal4,代码行数:17,代码来源:SAnimCurvePanel.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TWeakPtr类代码示例发布时间:2022-05-31
下一篇:
C++ TVirtualPad类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap