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


C++ TSharedPtr::AddChild方法代码示例

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


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

示例1: AttachTo

bool FLevelModel::AttachTo(TSharedPtr<FLevelModel> InParent)
{
	if (LevelCollectionModel.IsReadOnly() || 
		!IsLoaded() || 
		IsPersistent() ||
		InParent.IsValid() == false ||
		InParent.Get() == this ||
		HasDescendant(InParent))
	{
		return false;
	}

	TSharedPtr<FLevelModel> CurrentParent = GetParent();
	if (CurrentParent.IsValid())
	{
		CurrentParent->RemoveChild(this->AsShared());
	}

	Parent = InParent;

	CurrentParent = GetParent();
	if (CurrentParent.IsValid())
	{
		CurrentParent->AddChild(this->AsShared());
	}

	OnParentChanged();
	return true;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:29,代码来源:LevelModel.cpp

示例2: AddClass

void FNativeClassHierarchy::AddClass(UClass* InClass, const TSet<FName>& InGameModules, const TMap<FName, FName>& InPluginModules, FAddClassMetrics& AddClassMetrics)
{
	// Ignore deprecated and temporary classes
	if(InClass->HasAnyClassFlags(CLASS_Deprecated | CLASS_NewerVersionExists) || FKismetEditorUtilities::IsClassABlueprintSkeleton(InClass))
	{
		return;
	}

	const FName ClassModuleName = GetClassModuleName(InClass);
	if(ClassModuleName.IsNone())
	{
		return;
	}

	static const FName ModuleRelativePathMetaDataKey = "ModuleRelativePath";
	const FString& ClassModuleRelativeIncludePath = InClass->GetMetaData(ModuleRelativePathMetaDataKey);
	if(ClassModuleRelativeIncludePath.IsEmpty())
	{
		return;
	}

	// Work out which root this class should go under
	const FName RootNodeName = GetClassPathRootForModule(ClassModuleName, InGameModules, InPluginModules);

	// Work out the final path to this class within the hierarchy (which isn't the same as the path on disk)
	const FString ClassModuleRelativePath = ClassModuleRelativeIncludePath.Left(ClassModuleRelativeIncludePath.Find(TEXT("/"), ESearchCase::CaseSensitive, ESearchDir::FromEnd));
	const FString ClassHierarchyPath = ClassModuleName.ToString() + TEXT("/") + ClassModuleRelativePath;

	// Ensure we've added a valid root node
	TSharedPtr<FNativeClassHierarchyNode>& RootNode = RootNodes.FindOrAdd(RootNodeName);
	if(!RootNode.IsValid())
	{
		RootNode = FNativeClassHierarchyNode::MakeFolderEntry(RootNodeName, TEXT("/") + RootNodeName.ToString());
		++AddClassMetrics.NumFoldersAdded;
	}

	// Split the class path and ensure we have nodes for each part
	TArray<FString> HierarchyPathParts;
	ClassHierarchyPath.ParseIntoArray(HierarchyPathParts, TEXT("/"), true);
	TSharedPtr<FNativeClassHierarchyNode> CurrentNode = RootNode;
	for(const FString& HierarchyPathPart : HierarchyPathParts)
	{
		const FName HierarchyPathPartName = *HierarchyPathPart;
		TSharedPtr<FNativeClassHierarchyNode>& ChildNode = CurrentNode->Children.FindOrAdd(FNativeClassHierarchyNodeKey(HierarchyPathPartName, ENativeClassHierarchyNodeType::Folder));
		if(!ChildNode.IsValid())
		{
			ChildNode = FNativeClassHierarchyNode::MakeFolderEntry(HierarchyPathPartName, CurrentNode->EntryPath + TEXT("/") + HierarchyPathPart);
			++AddClassMetrics.NumFoldersAdded;
		}
		CurrentNode = ChildNode;
	}

	// Now add the final entry for the class
	CurrentNode->AddChild(FNativeClassHierarchyNode::MakeClassEntry(InClass, ClassModuleName, ClassModuleRelativePath, CurrentNode->EntryPath + TEXT("/") + InClass->GetName()));
	++AddClassMetrics.NumClassesAdded;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:56,代码来源:NativeClassHierarchy.cpp

示例3: OnLevelsCollectionChanged

void FStreamingLevelCollectionModel::OnLevelsCollectionChanged()
{
	InvalidSelectedLevels.Empty();
	
	// We have to have valid world
	if (!CurrentWorld.IsValid())
	{
		return;
	}

	// Add model for a persistent level
	TSharedPtr<FStreamingLevelModel> PersistentLevelModel = MakeShareable(new FStreamingLevelModel(Editor, *this, NULL));
	PersistentLevelModel->SetLevelExpansionFlag(true);
	RootLevelsList.Add(PersistentLevelModel);
	AllLevelsList.Add(PersistentLevelModel);
	AllLevelsMap.Add(PersistentLevelModel->GetLongPackageName(), PersistentLevelModel);
		
	// Add models for each streaming level in the world
	for (auto It = CurrentWorld->StreamingLevels.CreateConstIterator(); It; ++It)
	{
		ULevelStreaming* StreamingLevel = (*It);
		if (StreamingLevel != NULL)
		{
			TSharedPtr<FStreamingLevelModel> LevelModel = MakeShareable(new FStreamingLevelModel(Editor, *this, StreamingLevel));
			AllLevelsList.Add(LevelModel);
			AllLevelsMap.Add(LevelModel->GetLongPackageName(), LevelModel);

			PersistentLevelModel->AddChild(LevelModel);
			LevelModel->SetParent(PersistentLevelModel);
		}
	}
	
	FLevelCollectionModel::OnLevelsCollectionChanged();

	// Sync levels selection to world
	SetSelectedLevelsFromWorld();
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:37,代码来源:StreamingLevelCollectionModel.cpp


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