Skip to content

Commit 532f9ae

Browse files
committed
fix propagating texture names when converting special texture
1 parent 842c201 commit 532f9ae

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

sources/asset-processor/model.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ void processModel()
293293

294294
for (const auto &t : part.textures)
295295
{
296+
CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "looking at texture: " + t.name + ", type: " + meshImportTextureTypeToString(t.type));
296297
const String p = processor->convertAssetPath(t.name);
297298
const uint32 n = HashString(p);
298299
switch (t.type)
@@ -315,7 +316,10 @@ void processModel()
315316
}
316317

317318
if (!part.shaderName.empty())
319+
{
320+
CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "looking at shader: " + part.shaderName);
318321
dsm.shaderName = HashString(processor->convertAssetPath(part.shaderName));
322+
}
319323

320324
dsm.renderFlags = part.renderFlags;
321325
dsm.renderLayer = part.renderLayer;

sources/libcore/assets/assetProcessor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ namespace cage
7272
if (isPattern(input, inputDirectory, "", ""))
7373
input = subString(input, inputDirectory.length(), m);
7474
if (input.empty())
75-
CAGE_THROW_ERROR(Exception, "input cannot be empty");
75+
CAGE_THROW_ERROR(Exception, "input path cannot be empty");
7676
if (pathIsAbs(input))
7777
{
7878
if (input[0] != '/')
@@ -86,7 +86,7 @@ namespace cage
8686
input = pathJoin(relativeTo, input);
8787
}
8888
if (input.empty())
89-
CAGE_THROW_ERROR(Exception, "input cannot be empty");
89+
CAGE_THROW_ERROR(Exception, "input path cannot be empty");
9090
return input;
9191
}
9292

sources/libcore/mesh/importConvert.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ namespace cage
453453
ps.push_back(std::move(p));
454454
gltf->images.parts = std::move(ps);
455455
gltf->type = MeshImportTextureType::Special;
456+
gltf->name = Stringizer() + split(gltf->name, "?") + "?gltfPbr";
456457
}
457458
}
458459

@@ -491,6 +492,9 @@ namespace cage
491492
}
492493
}
493494

495+
const String rn = Stringizer() + split(spec->name, "?") + "?spec_rough"; // names must be computed before spec is invalidated
496+
const String mn = Stringizer() + split(spec->name, "?") + "?spec_metal";
497+
494498
{
495499
ImageImportPart p;
496500
p.image = std::move(ri);
@@ -499,6 +503,7 @@ namespace cage
499503
MeshImportTexture res;
500504
res.images.parts = std::move(ps);
501505
res.type = MeshImportTextureType::Roughness;
506+
res.name = rn;
502507
textures.push_back(std::move(res));
503508
}
504509

@@ -510,6 +515,7 @@ namespace cage
510515
MeshImportTexture res;
511516
res.images.parts = std::move(ps);
512517
res.type = MeshImportTextureType::Metallic;
518+
res.name = mn;
513519
textures.push_back(std::move(res));
514520
}
515521
}

0 commit comments

Comments
 (0)