Exemplo n.º 1
0
void UAkGameplayStatics::UnloadBankByName(const FString& BankName)
{
	FAkAudioDevice * AudioDevice = FAkAudioDevice::Get();
	if( AudioDevice )
	{
		if(AudioDevice->GetAkBankManager() != NULL )
		{
			for ( TObjectIterator<UAkAudioBank> Iter; Iter; ++Iter )
			{
				if( Iter->GetName() == BankName )
				{
					Iter->Unload();
					return;
				}
			}

			
			// Bank not found in the assets, unload it by name anyway
			AudioDevice->UnloadBank(BankName);
		}
		else
		{
			AudioDevice->UnloadBank(BankName);
		}
	}
}
Exemplo n.º 2
0
void UAkGameplayStatics::LoadBankByName(const FString& BankName)
{
	
	FAkAudioDevice * AudioDevice = FAkAudioDevice::Get();
	if( AudioDevice )
	{
		if(AudioDevice->GetAkBankManager() != NULL )
		{
			for ( TObjectIterator<UAkAudioBank> Iter; Iter; ++Iter )
			{
				if( Iter->GetName() == BankName )
				{
					Iter->Load();
					return;
				}
			}

			// Bank not found in the assets, load it by name anyway
			AkUInt32 bankID;
			AudioDevice->LoadBank(BankName, AK_DEFAULT_POOL_ID, bankID);
		}
		else
		{
			AkUInt32 bankID;
			AudioDevice->LoadBank(BankName, AK_DEFAULT_POOL_ID, bankID);
		}
	}
}
Exemplo n.º 3
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(","));
}
Exemplo n.º 4
0
void ReattachMaterials(const TArray<FString>& Args)
{
	FMaterialUpdateContext MaterialUpdateContext;

	UE_LOG(LogConsoleResponse, Display, TEXT("Reattach.Materials:"));

	// Clear the parents out of combination material
	for( TObjectIterator<UMaterial> MaterialIt; MaterialIt; ++MaterialIt )
	{
		if(Args.Num() == 1)
		{
			UE_LOG(LogConsoleResponse, Display, TEXT("   %s"), *MaterialIt->GetName());

			if(MaterialIt->GetName() == Args[0])
			{
				MaterialUpdateContext.AddMaterial(*MaterialIt);
			}
		}
	}
	UE_LOG(LogConsoleResponse, Display, TEXT(""));
}
Exemplo n.º 5
0
/**
 * 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 Assignment::ApplyToMeshes()
{
	UClass *refMeshClass= AStaticMeshActor::StaticClass();
	UClass *refSkeletaMeshClass = ASkeletalMeshActor::StaticClass();

	for (TObjectIterator<UObject> Itr; Itr; ++Itr)
	{
		if (Itr->GetClass()->IsChildOf(refMeshClass))
		{
			UE_LOG(ModoMaterialImporter, Log, TEXT("Scan materials in: %s %s"), *Itr->GetName(), *Itr->GetClass()->GetDesc());

			AStaticMeshActor *aMeshActor = dynamic_cast<AStaticMeshActor*> (*Itr);

			if (aMeshActor != NULL)
			{
				UMeshComponent* meshCompo = aMeshActor->GetStaticMeshComponent();

				if (meshCompo != NULL)
				{
					for (int i = 0; i < meshCompo->GetNumMaterials(); i++)
					{
						UMaterialInterface* material = meshCompo->GetMaterial(i);

						// It seems a UE4 bug, GetNumMaterials contains NULL materials!
						if (material == NULL)
							continue;

						std::string strName = (TCHAR_TO_UTF8(*material->GetName()));

						std::map<std::string, UMaterial*>::iterator mat_itr = Materials.find(strName);
						if (mat_itr != Materials.end())
						{
							UE_LOG(ModoMaterialImporter, Log, TEXT("Set Material: %s"), *material->GetName());
							meshCompo->SetMaterial(i, mat_itr->second);
						}
					}
				}
			}
		}
		else if (Itr->GetClass()->IsChildOf(refSkeletaMeshClass))
		{
			UE_LOG(ModoMaterialImporter, Log, TEXT("Scan materials in: %s %s"), *Itr->GetName(), *Itr->GetClass()->GetDesc());

			ASkeletalMeshActor *aMeshActor = dynamic_cast<ASkeletalMeshActor*> (*Itr);

			if (aMeshActor != NULL)
			{
				UMeshComponent * meshCompo = aMeshActor->GetSkeletalMeshComponent();
				for (int i = 0; i < meshCompo->GetNumMaterials(); i++)
				{
					UMaterialInterface* material = meshCompo->GetMaterial(i);

					// It seems a UE4 bug, GetNumMaterials contains NULL materials!
					if (material == NULL)
						continue;

					std::string strName = (TCHAR_TO_UTF8(*material->GetName()));

					std::map<std::string, UMaterial*>::iterator mat_itr = Materials.find(strName);
					if (mat_itr != Materials.end())
					{
						UE_LOG(ModoMaterialImporter, Log, TEXT("Set Material: %s"), *material->GetName());
						meshCompo->SetMaterial(i, mat_itr->second);
					}
				}
			}
		}
	}
}