adobe/USD-Fileformat-plugins

Export material names

alebalzaeu opened this issue · 2 comments

Expected Behaviour

When exporting materials, the expected behavior is that each material should retain its assigned name.

Actual Behaviour

Materials are being exported with an empty string as their name instead of using the material name property. This issue causes inconsistencies when re-importing as fbx, as the material info is not correctly preserved.

Steps to reproduce

  1. Assign a material with specific name to an object in the scene.
  2. Export the scene and its materials using the fbx export.
  3. Open the exported file and check that the material names are missing.

Sample Code that illustrates the problem

https://github.com/adobe/USD-Fileformat-plugins/blob/main/fbx/src/fbxExport.cpp#L961

exportFbxMaterials(ExportFbxContext& ctx)
{
    InputTranslator inputTranslator(true, ctx.usd->images, DEBUG_TAG);
    ctx.materials.resize(ctx.usd->materials.size());
    for (size_t i = 0; i < ctx.usd->materials.size(); i++) {
        const Material& m = ctx.usd->materials[i];
        FbxSurfacePhong* phong = FbxSurfacePhong::Create(ctx.fbx->scene, "");
.....

=> FbxSurfacePhong::Create(ctx.fbx, materialName);

Thanks for reporting this, a fix will be in the next release

fixed in v1.0.9