Esempio n. 1
0
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(","));
}
/**
 * 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 );
            }
        }
    }
}
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);
		}
	}
}
/**
 * Loads all of the code packages completely (for script classes). Then iterates
 * through the UClass-es finding all commandlets and dumping information on them
 */
static void ListAllCommandlets(void)
{
	warnf(TEXT("%-40s    %s"),TEXT("Commandlet"),TEXT("Description"));
	warnf(TEXT("--------------------------------------------------------------------------------"));
	// Now iterate through all UClass-es looking for commandlets
	for (TObjectIterator<UClass> It; It; ++It)
	{
		UCommandlet* DefObject = Cast<UCommandlet>(It->GetDefaultObject());
		if (DefObject != NULL)
		{
			// Ignore commandlets that can't be created
			if (It->HasAnyClassFlags(CLASS_Abstract) == FALSE)
			{
				const FString& Name = GetCommandletName(DefObject);
				warnf(TEXT("%-40s - %s"),*Name,*DefObject->HelpDescription);
			}
		}
	}
}