adobe / USD-Fileformat-plugins

A collection of USD fileformat plugins
312 stars 21 forks source link

Export material names #37

Closed alebalzaeu closed 1 month ago

alebalzaeu commented 1 month ago

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);

kwblackstone commented 1 month ago

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

kwblackstone commented 1 month ago

fixed in v1.0.9