Skip to content

Commit 1566c11

Browse files
author
Benoit Hudson
committed
UNI-24379: don't even try to support skinning for now
There was a bug with a SkinnedMeshRenderer popping up alongside a MeshFilter / MeshRenderer. That's because we bake the mesh pose when we convert: we don't set up bone weights and so on. Eventually we'll change that, but for now, just don't apply the skinned-mesh renderer.
1 parent 0a2f46c commit 1566c11

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
@@ -356,6 +356,15 @@ private static void CopyComponentsRecursive(GameObject from, GameObject to, bool
356356
public static void CopyComponents(GameObject from, GameObject to){
357357
var originalComponents = new List<Component>(to.GetComponents<Component> ());
358358
foreach(var component in from.GetComponents<Component> ()) {
359+
// UNI-24379: we don't support SkinnedMeshRenderer right
360+
// now: we just bake the mesh into its current pose. So
361+
// don't copy the SMR over. There will already be a
362+
// MeshFilter and MeshRenderer due to the static mesh.
363+
// Remove this code when we support skinning.
364+
if (component is SkinnedMeshRenderer) {
365+
continue;
366+
}
367+
359368
var json = EditorJsonUtility.ToJson(component);
360369

361370
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
@@ -177,5 +177,30 @@ public void BasicTest()
177177
directoryFullPath: path, keepOriginal: false);
178178
Assert.That(cubePrefabInstance2.GetComponents<FbxPrefab>().Length, Is.EqualTo(1));
179179
}
180+
181+
[Test]
182+
public void SkinnedMeshTest()
183+
{
184+
// UNI-24379: in the first release, the plugin only handles static
185+
// meshes, not skinned meshes. Rewrite this test when we add that
186+
// feature.
187+
188+
// Create a cube with a bogus skinned-mesh rather than a static
189+
// mesh setup.
190+
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
191+
cube.AddComponent<SkinnedMeshRenderer>();
192+
var meshFilter = cube.GetComponent<MeshFilter>();
193+
var meshRender = cube.GetComponent<MeshRenderer>();
194+
Object.DestroyImmediate(meshRender);
195+
Object.DestroyImmediate(meshFilter);
196+
197+
// Convert it. Make sure it gets deleted, to avoid a useless error about internal consistency.
198+
var cubeInstance = ConvertToModel.Convert(cube, fbxFullPath: GetRandomFbxFilePath());
199+
if (cube) { Object.DestroyImmediate(cube); }
200+
201+
// Make sure it doesn't have a skinned mesh renderer on it.
202+
// In the future we'll want to assert the opposite!
203+
Assert.That(cubeInstance.GetComponentsInChildren<SkinnedMeshRenderer>(), Is.Empty);
204+
}
180205
}
181206
}

0 commit comments

Comments
 (0)