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 1: Linha 1:
On your "MaterialsLoadedCallback", you can use the following snippet to track the loaded resources, in case you need to copy/move them elsewhere:
On your "MaterialsLoadedCallback", you can use the following snippet to track the loaded resources, in case you need to copy/move them elsewhere:
<source lang="csharp">
<source lang="csharp">
//Modelpath contains the laoded model path
var modelPath = assetLoaderContext.Filename;
foreach (var kvp in assetLoaderContext.LoadedTextures)
foreach (var kvp in assetLoaderContext.LoadedTextures)
{
{
//Finalpath contains the loaded texture filename
string finalPath = kvp.Key.ResolvedFilename;
string finalPath = kvp.Key.ResolvedFilename;
if (!string.IsNullOrEmpty(finalPath))
if (!string.IsNullOrEmpty(finalPath))
{
{
//Finalpath contains the loaded texture filename
//Do stuff
}
}
}
}
foreach (var kvp in assetLoaderContext.LoadedExternalData)
foreach (var kvp in assetLoaderContext.LoadedExternalData)
{
{
//Finalpath contains the loaded resource filename
string finalPath = kvp.Value;
string finalPath = kvp.Value;
if (!string.IsNullOrEmpty(finalPath))
if (!string.IsNullOrEmpty(finalPath))
{
{
//Finalpath contains the loaded resource filename
//Do stuff
}
}
}
}
</source>
</source>

Edição das 21h59min de 7 de junho de 2021

On your "MaterialsLoadedCallback", you can use the following snippet to track the loaded resources, in case you need to copy/move them elsewhere: <source lang="csharp"> //Modelpath contains the laoded model path var modelPath = assetLoaderContext.Filename;

foreach (var kvp in assetLoaderContext.LoadedTextures) { //Finalpath contains the loaded texture filename string finalPath = kvp.Key.ResolvedFilename; if (!string.IsNullOrEmpty(finalPath)) { //Do stuff } }

foreach (var kvp in assetLoaderContext.LoadedExternalData) { //Finalpath contains the loaded resource filename string finalPath = kvp.Value; if (!string.IsNullOrEmpty(finalPath)) { //Do stuff } } </source>