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


C++ TObjectIterator::IsChildOf方法代码示例

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


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

示例1: DumpUsageStats

void UBehaviorTreeManager::DumpUsageStats() const
{
	FNodeClassCounter AllNodesCounter;
	
	for (TObjectIterator<UClass> It; It; ++It)
	{
		if (It->IsChildOf(UBTNode::StaticClass()) && It->HasAnyClassFlags(CLASS_Abstract) == false
#if WITH_EDITOR
			&& !(FKismetEditorUtilities::IsClassABlueprintSkeleton(*It)
				|| It->HasAnyClassFlags(CLASS_NewerVersionExists))
#endif
			)

		{
			AllNodesCounter.Declare(*It);
		}
	}

	UE_LOG(LogBehaviorTree, Display, TEXT("----------------------UBehaviorTreeManager::DumpUsageStats----------------------\nBehavior Trees:"));

	// get all BTNode classes
	
	for (TObjectIterator<UBehaviorTree> It; It; ++It)
	{
		FNodeClassCounter TreeNodeCounter;
		UE_LOG(LogBehaviorTree, Display, TEXT("--- %s ---"), *(It->GetName()));
		StatNodeUsage(It->RootNode, TreeNodeCounter);
		TreeNodeCounter.Print();
		AllNodesCounter.Append(TreeNodeCounter);
	}
	
	UE_LOG(LogBehaviorTree, Display, TEXT("--- Total Nodes usage:"));
	AllNodesCounter.Print(TEXT(","));
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:34,代码来源:BehaviorTreeManager.cpp

示例2: AssembleListOfExporters

void AssembleListOfExporters(TArray<UExporter*>& OutExporters)
{
	auto TransientPackage = GetTransientPackage();

	// @todo DB: Assemble this set once.
	OutExporters.Empty();
	for (TObjectIterator<UClass> It; It; ++It)
	{
		if (It->IsChildOf(UExporter::StaticClass()) && !It->HasAnyClassFlags(CLASS_Abstract))
		{
			UExporter* Exporter = NewObject<UExporter>(TransientPackage, *It);
			OutExporters.Add(Exporter);
		}
	}
}
开发者ID:Nicole-W,项目名称:janusvr_utils,代码行数:15,代码来源:JanusExporterTool.cpp

示例3: GetUnitTestClassDefList

void NUTUtil::GetUnitTestClassDefList(TArray<UUnitTest*>& OutUnitTestClassDefaults)
{
	for (TObjectIterator<UClass> It; It; ++It)
	{
		if (It->IsChildOf(UUnitTest::StaticClass()) && *It != UUnitTest::StaticClass() && *It != UClientUnitTest::StaticClass())
		{
			UUnitTest* CurDefault = Cast<UUnitTest>(It->GetDefaultObject());

			if (CurDefault != NULL)
			{
				OutUnitTestClassDefaults.Add(CurDefault);
			}
		}
	}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:15,代码来源:NUTUtil.cpp

示例4: InitializeStreamingMethods

/**
 * Initializes the list of possible level streaming methods.
 * Does nothing if the lists are already initialized.
 */
void InitializeStreamingMethods()
{
    check( GStreamingMethodStrings.Num() == GStreamingMethodClassList.Num() );
    if ( GStreamingMethodClassList.Num() == 0 )
    {
        // Assemble a list of possible level streaming methods.
        for ( TObjectIterator<UClass> It ; It ; ++It )
        {
            if ( It->IsChildOf( ULevelStreaming::StaticClass() ) &&
                    (It->HasAnyClassFlags(CLASS_EditInlineNew)) &&
                    !(It->HasAnyClassFlags(CLASS_Hidden | CLASS_Abstract | CLASS_Deprecated | CLASS_Transient)))
            {
                const FString ClassName( It->GetName() );
                // Strip the leading "LevelStreaming" text from the class name.
                // @todo DB: This assumes the names of all ULevelStreaming-derived types begin with the string "LevelStreaming".
                GStreamingMethodStrings.Add( ClassName.Mid( 14 ) );
                GStreamingMethodClassList.Add( *It );
            }
        }
    }
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:25,代码来源:EditorLevelUtils.cpp

示例5: if

UObject* UFactory::StaticImportObject
(
	UClass*				Class,
	UObject*			InOuter,
	FName				Name,
	EObjectFlags		Flags,
	bool&				bOutOperationCanceled,
	const TCHAR*		Filename,
	UObject*			Context,
	UFactory*			InFactory,
	const TCHAR*		Parms,
	FFeedbackContext*	Warn,
	int32				MaxImportFileSize
)
{
	check(Class);

	CurrentFilename = Filename;

	// Make list of all applicable factories.
	TArray<UFactory*> Factories;
	if( InFactory )
	{
		// Use just the specified factory.
		if (ensureMsgf( !InFactory->SupportedClass || Class->IsChildOf(InFactory->SupportedClass), 
			TEXT("Factory is (%s), SupportedClass is (%s) and Class name is (%s)"), *InFactory->GetName(), (InFactory->SupportedClass)? *InFactory->SupportedClass->GetName() : TEXT("None"), *Class->GetName() ))
		{
			Factories.Add( InFactory );
		}
	}
	else
	{
		auto TransientPackage = GetTransientPackage();
		// Try all automatic factories, sorted by priority.
		for( TObjectIterator<UClass> It; It; ++It )
		{
			if( It->IsChildOf( UFactory::StaticClass() ) )
			{
				UFactory* Default = It->GetDefaultObject<UFactory>();
				if (Class->IsChildOf(Default->SupportedClass) && Default->ImportPriority >= 0)
				{
					Factories.Add(NewObject<UFactory>(TransientPackage, *It));
				}
			}
		}

		Factories.Sort([](const UFactory& A, const UFactory& B) -> bool
		{
			// First sort so that higher priorities are earlier in the list
			if( A.ImportPriority > B.ImportPriority )
			{
				return true;
			}
			else if( A.ImportPriority < B.ImportPriority )
			{
				return false;
			}

			// Then sort so that factories that only create new assets are tried after those that actually import the file data (when they have an equivalent priority)
			const bool bFactoryAImportsFiles = !A.CanCreateNew();
			const bool bFactoryBImportsFiles = !B.CanCreateNew();
			if( bFactoryAImportsFiles && !bFactoryBImportsFiles )
			{
				return true;
			}

			return false;
		});
	}

	bool bLoadedFile = false;

	// Try each factory in turn.
	for( int32 i=0; i<Factories.Num(); i++ )
	{
		UFactory* Factory = Factories[i];
		UObject* Result = NULL;
		if( Factory->CanCreateNew() )
		{
			UE_LOG(LogFactory, Log,  TEXT("FactoryCreateNew: %s with %s (%i %i %s)"), *Class->GetName(), *Factories[i]->GetClass()->GetName(), Factory->bCreateNew, Factory->bText, Filename );
			Factory->ParseParms( Parms );
			Result = Factory->FactoryCreateNew( Class, InOuter, Name, Flags, NULL, Warn );
		}
		else if( FCString::Stricmp(Filename,TEXT(""))!=0 )
		{
			if( Factory->bText )
			{
				//UE_LOG(LogFactory, Log,  TEXT("FactoryCreateText: %s with %s (%i %i %s)"), *Class->GetName(), *Factories(i)->GetClass()->GetName(), Factory->bCreateNew, Factory->bText, Filename );
				FString Data;
				if( FFileHelper::LoadFileToString( Data, Filename ) )
				{
					bLoadedFile = true;
					const TCHAR* Ptr = *Data;
					Factory->ParseParms( Parms );
					Result = Factory->FactoryCreateText( Class, InOuter, Name, Flags, NULL, *FPaths::GetExtension(Filename), Ptr, Ptr+Data.Len(), Warn );
				}
			}
			else
			{
				UE_LOG(LogFactory, Log,  TEXT("FactoryCreateBinary: %s with %s (%i %i %s)"), *Class->GetName(), *Factories[i]->GetClass()->GetName(), Factory->bCreateNew, Factory->bText, Filename );
//.........这里部分代码省略.........
开发者ID:Codermay,项目名称:Unreal4,代码行数:101,代码来源:Factory.cpp


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