Skip to content

Commit ecbbacd

Browse files
committed
Working Remapping API. Include working references and meshes filters
1 parent 0cd5b8a commit ecbbacd

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Assets/FbxExporters/Editor/FbxPrefabAutoUpdater.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ public class FbxRepresentation
320320
/// <summary>
321321
/// Children of this node.
322322
/// The key is the name, which is assumed to be unique.
323-
/// Old fbx data, new fbx data should have FBX Object Name
324-
/// Prefab data should have FBX Object Name
323+
/// Old fbx data should have Unity Object Name
324+
/// new fbx data should have FBX Object Name
325+
/// Prefab data should have Unity Object Name
325326
/// The value is, recursively, the representation of that subtree.
326327
/// </summary>
327328
Dictionary<string, FbxRepresentation> m_children = new Dictionary<string, FbxRepresentation>();
@@ -796,9 +797,9 @@ void ClassifyReparenting()
796797

797798
var prefabParent = m_prefabData.GetParent(prefabNodeName);
798799
var oldParent = m_oldFbxData.GetParent(prefabNodeName);
799-
var newParent = m_newFbxData.GetParent(prefabNodeName);
800+
var newParent = m_newFbxData.GetParent(m_fbxPrefabUtility.getFBXObjectName(prefabNodeName));
800801

801-
// If it's a nameMapping, don't add a reparenting, we'll rename it later
802+
// If it's a name mapping, don't add a reparenting, we'll rename it later
802803
if (oldParent == m_fbxPrefabUtility.getUnityObjectName(newParent)) {
803804
continue;
804805
}
@@ -861,18 +862,21 @@ void ClassifyComponents(Transform newFbx, Transform prefab)
861862
// about what components might be on it.
862863
foreach (var nodeNameInUpdatedPrefab in m_nodesInUpdatedPrefab)
863864
{
864-
if (!m_newFbxData.HasNode(nodeNameInUpdatedPrefab)) {
865+
if (!m_newFbxData.HasNode(m_fbxPrefabUtility.getFBXObjectName(nodeNameInUpdatedPrefab))) {
865866
// It's not in the FBX, so clearly we're not updating any components.
866867
// We don't need to check if it's in m_prefab because
867868
// we're only iterating over those.
868869
continue;
869870
}
871+
// Get the matching name for the node in the m_newFbxData
872+
string nodeNameInFBX = m_fbxPrefabUtility.getFBXObjectName(nodeNameInUpdatedPrefab);
873+
870874
var allTypes = m_oldFbxData.GetComponentTypes(nodeNameInUpdatedPrefab).Union(
871-
m_newFbxData.GetComponentTypes(nodeNameInUpdatedPrefab));
875+
m_newFbxData.GetComponentTypes(nodeNameInFBX));
872876

873877
foreach(var typename in allTypes) {
874878
var oldValues = m_oldFbxData.GetComponentValues(nodeNameInUpdatedPrefab, typename);
875-
var newValues = m_newFbxData.GetComponentValues(nodeNameInUpdatedPrefab, typename);
879+
var newValues = m_newFbxData.GetComponentValues(nodeNameInFBX, typename);
876880
List<string> prefabValues = null; // get them only if we need them.
877881

878882
// If we have multiple identical-type components, match them up by index.

0 commit comments

Comments
 (0)