Skip to content

Commit e9de7d7

Browse files
authored
Merge pull request #149 from Unity-Technologies/uni-24379-skinned-mesh-fix
UNI-24379: don't even try to support skinning for now
2 parents f8f772e + 1566c11 commit e9de7d7

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,15 @@ private static void CopyComponentsRecursive(GameObject from, GameObject to, bool
389389
public static void CopyComponents(GameObject from, GameObject to){
390390
var originalComponents = new List<Component>(to.GetComponents<Component> ());
391391
foreach(var component in from.GetComponents<Component> ()) {
392+
// UNI-24379: we don't support SkinnedMeshRenderer right
393+
// now: we just bake the mesh into its current pose. So
394+
// don't copy the SMR over. There will already be a
395+
// MeshFilter and MeshRenderer due to the static mesh.
396+
// Remove this code when we support skinning.
397+
if (component is SkinnedMeshRenderer) {
398+
continue;
399+
}
400+
392401
var json = EditorJsonUtility.ToJson(component);
393402

394403
System.Type expectedType = component.GetType();

Assets/FbxExporters/Editor/UnitTests/ConvertToModelTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,30 @@ public void BasicTest()
188188
Assert.IsFalse(cube);
189189
}
190190
}
191+
192+
[Test]
193+
public void SkinnedMeshTest()
194+
{
195+
// UNI-24379: in the first release, the plugin only handles static
196+
// meshes, not skinned meshes. Rewrite this test when we add that
197+
// feature.
198+
199+
// Create a cube with a bogus skinned-mesh rather than a static
200+
// mesh setup.
201+
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
202+
cube.AddComponent<SkinnedMeshRenderer>();
203+
var meshFilter = cube.GetComponent<MeshFilter>();
204+
var meshRender = cube.GetComponent<MeshRenderer>();
205+
Object.DestroyImmediate(meshRender);
206+
Object.DestroyImmediate(meshFilter);
207+
208+
// Convert it. Make sure it gets deleted, to avoid a useless error about internal consistency.
209+
var cubeInstance = ConvertToModel.Convert(cube, fbxFullPath: GetRandomFbxFilePath());
210+
if (cube) { Object.DestroyImmediate(cube); }
211+
212+
// Make sure it doesn't have a skinned mesh renderer on it.
213+
// In the future we'll want to assert the opposite!
214+
Assert.That(cubeInstance.GetComponentsInChildren<SkinnedMeshRenderer>(), Is.Empty);
215+
}
191216
}
192217
}

0 commit comments

Comments
 (0)