Skip to content

Commit eef1edd

Browse files
committed
Bug Fix
1 parent ffa0832 commit eef1edd

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,42 +1259,29 @@ protected bool ExportInstance (GameObject unityGo, FbxNode fbxNode, FbxScene fbx
12591259
SharedMeshes [unityPrefabParent.name] = fbxNode.GetMesh ();
12601260
return true;
12611261
}
1262+
return false;
12621263
}
1264+
1265+
// We don't export the mesh because we already have it from the parent, but we still need to assign the material
1266+
var renderer = unityGo.GetComponent<Renderer>();
1267+
var materials = renderer ? renderer.sharedMaterials : null;
12631268

1264-
1265-
if (SharedMeshes.TryGetValue (unityPrefabParent.name, out fbxMesh))
1269+
Unity.FbxSdk.FbxSurfaceMaterial newMaterial = null;
1270+
if (materials != null)
12661271
{
1267-
// We don't export the mesh because we already have it from the parent, but we still need to assign the material
1268-
var renderer = unityGo.GetComponent<Renderer>();
1269-
var materials = renderer ? renderer.sharedMaterials : null;
1270-
1271-
Unity.FbxSdk.FbxSurfaceMaterial newMaterial = null;
1272-
if (materials != null)
1273-
{
1274-
foreach (var mat in materials) {
1275-
if (MaterialMap.TryGetValue(mat.name, out newMaterial));
1276-
{
1277-
fbxNode.AddMaterial(newMaterial);
1278-
}
1272+
foreach (var mat in materials) {
1273+
if (MaterialMap.TryGetValue(mat.name, out newMaterial));
1274+
{
1275+
fbxNode.AddMaterial(newMaterial);
12791276
}
12801277
}
1281-
1282-
// set the fbxNode containing the mesh
1283-
fbxNode.SetNodeAttribute (fbxMesh);
1284-
fbxNode.SetShadingMode (FbxNode.EShadingMode.eWireFrame);
1285-
}
1286-
else
1287-
{
1288-
if (ExportMesh (unityGo, fbxNode) && fbxNode.GetMesh() != null) {
1289-
SharedMeshes [unityPrefabParent.name] = fbxNode.GetMesh ();
1290-
return true;
1291-
}
1292-
else
1293-
{
1294-
return false;
1295-
}
12961278
}
12971279

1280+
// set the fbxNode containing the mesh
1281+
fbxNode.SetNodeAttribute (fbxMesh);
1282+
fbxNode.SetShadingMode (FbxNode.EShadingMode.eWireFrame);
1283+
1284+
12981285
return true;
12991286
}
13001287

0 commit comments

Comments
 (0)