How to track loaded resources: mudanças entre as edições

De TriLib
Ir para navegação Ir para pesquisar
Sem resumo de edição
Sem resumo de edição
Linha 9: Linha 9:


//Iterate the loaded textures list
//Iterate the loaded textures list
foreach (var kvp in assetLoaderContext.LoadedTextures)
foreach (var kvp in assetLoaderContext.LoadedCompoundTextures)
{
{
//FinalPath contains the loaded texture filename
//FinalPath contains the loaded texture filename

Edição das 09h17min de 18 de maio de 2024

On your loading methods onMaterialsLoad callback, you can use the following snippet to track the loaded resources, in case you need to copy/move them elsewhere:

//ModelPath contains the loaded model path
var modelPath = assetLoaderContext.Filename;
if (!string.IsNullOrEmpty(modelPath))
{
	//Do stuff
}

//Iterate the loaded textures list
foreach (var kvp in assetLoaderContext.LoadedCompoundTextures)
{
	//FinalPath contains the loaded texture filename
	string finalPath = kvp.Key.ResolvedFilename;
	if (!string.IsNullOrEmpty(finalPath))
	{
		//Do stuff
	}
}

//Iterate the loaded resources list
foreach (var kvp in assetLoaderContext.LoadedExternalData)
{
	//FinalPath contains the loaded resource filename
	string finalPath = kvp.Value;
	if (!string.IsNullOrEmpty(finalPath))
	{
		//Do stuff
	}
}