Skip to content

Commit 0a2f922

Browse files
committed
ExportMesh(), return export result (success or failure)
1 parent 1b78181 commit 0a2f922

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,10 @@ public void ExportMesh (Mesh mesh, FbxNode fbxNode, Material[] materials = null)
568568
/// <summary>
569569
/// Exports a unity mesh and attaches it to the node as an FbxMesh.
570570
/// </summary>
571-
void ExportMesh (MeshInfo meshInfo, FbxNode fbxNode)
571+
bool ExportMesh (MeshInfo meshInfo, FbxNode fbxNode)
572572
{
573573
if (!meshInfo.IsValid) {
574-
return;
574+
return false;
575575
}
576576

577577
NumMeshes++;
@@ -661,6 +661,7 @@ void ExportMesh (MeshInfo meshInfo, FbxNode fbxNode)
661661
// set the fbxNode containing the mesh
662662
fbxNode.SetNodeAttribute (fbxMesh);
663663
fbxNode.SetShadingMode (FbxNode.EShadingMode.eWireFrame);
664+
return true;
664665
}
665666

666667
/// <summary>
@@ -1611,12 +1612,12 @@ public static void UnRegisterMeshCallback(GetMeshForObject callback)
16111612
/// This goes through the callback system to find the right mesh and
16121613
/// allow plugins to substitute their own meshes.
16131614
/// </summary>
1614-
void ExportMesh (GameObject gameObject, FbxNode fbxNode)
1615+
bool ExportMesh (GameObject gameObject, FbxNode fbxNode)
16151616
{
16161617
// First allow the object-based callbacks to have a hack at it.
16171618
foreach(var callback in MeshForObjectCallbacks) {
16181619
if (callback(this, gameObject, fbxNode)) {
1619-
return;
1620+
return true;
16201621
}
16211622
}
16221623

@@ -1650,7 +1651,7 @@ void ExportMesh (GameObject gameObject, FbxNode fbxNode)
16501651
GetMeshForComponent callback;
16511652
if (MeshForComponentCallbacks.TryGetValue (componentType, out callback)) {
16521653
if (callback (this, monoBehaviour, fbxNode)) {
1653-
return;
1654+
return true;
16541655
}
16551656
}
16561657
componentType = componentType.BaseType;
@@ -1664,15 +1665,16 @@ void ExportMesh (GameObject gameObject, FbxNode fbxNode)
16641665
if (meshFilter) {
16651666
var renderer = gameObject.GetComponent<Renderer>();
16661667
var materials = renderer ? renderer.sharedMaterials : null;
1667-
ExportMesh(new MeshInfo(meshFilter.sharedMesh, materials), fbxNode);
1668+
return ExportMesh(new MeshInfo(meshFilter.sharedMesh, materials), fbxNode);
16681669
} else {
16691670
var smr = defaultComponent as SkinnedMeshRenderer;
16701671
if (smr) {
16711672
var mesh = new Mesh();
16721673
smr.BakeMesh(mesh);
16731674
var materials = smr.sharedMaterials;
1674-
ExportMesh(new MeshInfo(mesh, materials), fbxNode);
1675+
bool result = ExportMesh(new MeshInfo(mesh, materials), fbxNode);
16751676
Object.DestroyImmediate(mesh);
1677+
return result;
16761678
}
16771679
}
16781680
}

0 commit comments

Comments
 (0)