Skip to content

Commit b39cc02

Browse files
committed
Uni-34563:
Array of pair of strings in FbxPrefab component FbxPrefabInspector can display the array
1 parent 90e7318 commit b39cc02

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

Assets/FbxExporters/Editor/FbxPrefabInspector.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ namespace FbxExporters.EditorTools {
66
[CustomEditor(typeof(FbxPrefab))]
77
public class FbxPrefabInspector : UnityEditor.Editor {
88
public override void OnInspectorGUI() {
9+
10+
SerializedProperty m_GameObjectProp = serializedObject.FindProperty("m_nameMapping");
11+
912
FbxPrefab fbxPrefab = (FbxPrefab)target;
1013

1114
// We can only change these settings when applied to a prefab.
@@ -28,17 +31,18 @@ public override void OnInspectorGUI() {
2831

2932
EditorGUI.EndDisabledGroup();
3033

34+
EditorGUILayout.PropertyField(m_GameObjectProp, true);
35+
3136
#if FBXEXPORTER_DEBUG
32-
GUILayout.BeginHorizontal();
33-
GUILayout.Label ("Debug info:");
37+
EditorGUILayout.LabelField ("Debug info:");
3438
try {
35-
fbxPrefab.GetFbxHistory().ToJson();
39+
fbxPrefabUtility.GetFbxHistory().ToJson();
3640
} catch(System.Exception xcp) {
3741
Debug.LogException(xcp);
3842
}
39-
EditorGUILayout.SelectableLabel(fbxPrefab.GetFbxHistoryString());
40-
GUILayout.EndHorizontal();
43+
EditorGUILayout.SelectableLabel(fbxPrefabUtility.GetFbxHistoryString());
4144
#endif
45+
serializedObject.ApplyModifiedProperties();
4246
}
4347
}
44-
}
48+
}

Assets/FbxExporters/FbxPrefab.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public class FbxPrefab : MonoBehaviour
2424
[SerializeField] // [HideInInspector]
2525
string m_fbxHistory;
2626

27+
[System.Serializable]
28+
public struct StringPair { public string FBXObjectName; public string UnityObjectName; }
29+
30+
public StringPair[] m_nameMapping;
31+
2732
/// <summary>
2833
/// Which FBX file does this refer to?
2934
/// </summary>
@@ -47,6 +52,18 @@ public string FbxHistory {
4752
}
4853
}
4954

55+
public StringPair[] NameMapping
56+
{
57+
get
58+
{
59+
return m_nameMapping;
60+
}
61+
set
62+
{
63+
m_nameMapping = value;
64+
}
65+
}
66+
5067
public GameObject FbxModel {
5168
get{
5269
return m_fbxModel;

0 commit comments

Comments
 (0)