Skip to content

Commit e7f6df3

Browse files
committed
Merge branch 'master' into Ut-3303-remap-prefab-to-unity-materials
2 parents 0a9fb75 + 650d720 commit e7f6df3

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Changes in Fbx Exporter
22

3-
## [3.0.2-preview.1] - 2020-03-23
3+
## [3.0.2-preview.1] - 2020-03-19
44
### Fixed
5+
- Blendshapes naming in FBX so that multiple blendshapes all import correctly in Maya.
6+
- Don't override transforms when creating FBX Linked Prefab, so that the prefab updates properly when the FBX transforms are modified.
57
- Changed FBX Linked Prefab to keep Unity materials instead of using materials exported to FBX file.
68

79
## [3.0.1-preview.2] - 2020-01-22

com.unity.formats.fbx/Editor/ConvertToNestedPrefab.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ public static GameObject Convert(
412412
// replace hierarchy in the scene
413413
if (!isPrefabAsset && toConvert != null)
414414
{
415-
fbxInstance.transform.parent = toConvert.transform.parent;
415+
// don't worry about keeping the world position in the prefab, as we will fix the transform on the instance root
416+
fbxInstance.transform.SetParent(toConvert.transform.parent, worldPositionStays: false);
416417
fbxInstance.transform.SetSiblingIndex(toConvert.transform.GetSiblingIndex());
417418
}
418419

@@ -863,10 +864,13 @@ internal static void CopyComponents(GameObject to, GameObject from, GameObject r
863864
continue;
864865
}
865866

866-
// ignore MeshFilter, but still ensure scene references are maintained
867-
if (fromComponent is MeshFilter)
867+
// ignore MeshFilter and Transform, but still ensure scene references are maintained.
868+
// Don't need to copy regular transform (except for the root object) as the values should already be correct in the FBX.
869+
// Furthermore, copying transform values may result in overrides in the prefab, which is undesired as if
870+
// the transform is updated in the FBX, it won't be in the prefab.
871+
if (fromComponent is MeshFilter || (fromComponent is Transform && from != root))
868872
{
869-
FixSceneReferences(fromComponent, to.GetComponent<MeshFilter>(), root);
873+
FixSceneReferences(fromComponent, to.GetComponent(fromComponent.GetType()), root);
870874
continue;
871875
}
872876

com.unity.formats.fbx/Tests/FbxTests/ConvertToModelTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ public void TestStaticHelpers()
435435
b2.transform.parent = b.transform; // in alpha order
436436
a.AddComponent<BoxCollider> ();
437437
a1.transform.localPosition = new Vector3 (1, 2, 3);
438+
a.transform.localPosition = new Vector3(4, 5, 6);
438439

439440
Assert.AreNotEqual(b.GetComponent<MeshFilter>().sharedMesh, a.GetComponent<MeshFilter>().sharedMesh);
440441
Assert.IsFalse (b.GetComponent<BoxCollider> ());
@@ -443,11 +444,12 @@ public void TestStaticHelpers()
443444

444445
ConvertToNestedPrefab.UpdateFromSourceRecursive (b, a);
445446

446-
// everything except the mesh + materials should change
447+
// everything except the mesh + materials and child transforms should change
447448
Assert.AreNotEqual(b.GetComponent<MeshFilter>().sharedMesh, a.GetComponent<MeshFilter>().sharedMesh);
448449
Assert.IsTrue (b.GetComponent<BoxCollider> ());
449450
Assert.AreEqual ("BB", b.transform.GetChild (1).name);
450-
Assert.AreEqual (a1.transform.localPosition, b1.transform.localPosition);
451+
Assert.AreEqual(a.transform.localPosition, b.transform.localPosition);
452+
Assert.AreNotEqual (a1.transform.localPosition, b1.transform.localPosition);
451453
}
452454

453455
// Test GetFbxAssetOrNull

0 commit comments

Comments
 (0)