| | 1 | | #if UNITY_2017_1_OR_NEWER |
| | 2 | | using System; |
| | 3 | | using System.Linq; |
| | 4 | | using UnityEditor; |
| | 5 | | using UnityEditor.AssetImporters; |
| | 6 | | using UnityEngine; |
| | 7 | |
|
| | 8 | | namespace UnityGLTF |
| | 9 | | { |
| | 10 | | [CustomEditor(typeof(GLTFImporter))] |
| | 11 | | [CanEditMultipleObjects] |
| | 12 | | public class GLTFImporterInspector : AssetImporterEditor |
| | 13 | | { |
| | 14 | | private string[] _importNormalsNames; |
| | 15 | |
|
| | 16 | | public override void OnInspectorGUI() |
| | 17 | | { |
| 0 | 18 | | if (_importNormalsNames == null) |
| | 19 | | { |
| 0 | 20 | | _importNormalsNames = Enum.GetNames(typeof(GLTFImporterNormals)) |
| 0 | 21 | | .Select(n => ObjectNames.NicifyVariableName(n)) |
| | 22 | | .ToArray(); |
| | 23 | | } |
| 0 | 24 | | EditorGUILayout.LabelField("Meshes", EditorStyles.boldLabel); |
| 0 | 25 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_removeEmptyRootObjects")); |
| 0 | 26 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_scaleFactor")); |
| 0 | 27 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_maximumLod"), new GUIContent("Maximum LOD")); |
| 0 | 28 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_readWriteEnabled"), new GUIContent("Read/Write |
| 0 | 29 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_generateColliders")); |
| 0 | 30 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_swapUvs"), new GUIContent("Swap UVs")); |
| 0 | 31 | | EditorGUILayout.Separator(); |
| 0 | 32 | | EditorGUILayout.LabelField("Normals", EditorStyles.boldLabel); |
| 0 | 33 | | EditorGUI.BeginChangeCheck(); |
| 0 | 34 | | var importNormalsProp = serializedObject.FindProperty("_importNormals"); |
| 0 | 35 | | var importNormals = EditorGUILayout.Popup(importNormalsProp.displayName, importNormalsProp.intValue, _import |
| 0 | 36 | | if (EditorGUI.EndChangeCheck()) |
| | 37 | | { |
| 0 | 38 | | importNormalsProp.intValue = importNormals; |
| | 39 | | } |
| 0 | 40 | | EditorGUILayout.Separator(); |
| 0 | 41 | | EditorGUILayout.LabelField("Materials", EditorStyles.boldLabel); |
| 0 | 42 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_importMaterials")); |
| 0 | 43 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_useJpgTextures"), new GUIContent("Use JPG Text |
| | 44 | |
|
| 0 | 45 | | EditorGUILayout.Separator(); |
| 0 | 46 | | EditorGUILayout.LabelField("Misc", EditorStyles.boldLabel); |
| 0 | 47 | | EditorGUILayout.PropertyField(serializedObject.FindProperty("_importSkeleton")); |
| | 48 | |
|
| 0 | 49 | | ApplyRevertGUI(); |
| 0 | 50 | | } |
| | 51 | | } |
| | 52 | | } |
| | 53 | | #endif |