UnityEditor.ModelImporterModelEditor.OnInspectorGUI C# (CSharp) Method

OnInspectorGUI() public method

public OnInspectorGUI ( ) : void
return void
        public override void OnInspectorGUI()
        {
            string text;
            if (styles == null)
            {
                styles = new Styles();
            }
            GUILayout.Label(styles.Meshes, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_GlobalScale, styles.ScaleFactor, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_FileScale, styles.FileScaleFactor, new GUILayoutOption[0]);
            EditorGUILayout.Popup(this.m_MeshCompression, styles.MeshCompressionOpt, styles.MeshCompressionLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_IsReadable, styles.IsReadable, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_OptimizeMeshForGPU, styles.OptimizeMeshForGPU, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_ImportBlendShapes, styles.ImportBlendShapes, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AddColliders, styles.GenerateColliders, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_SwapUVChannels, styles.SwapUVChannels, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_GenerateSecondaryUV, styles.GenerateSecondaryUV, new GUILayoutOption[0]);
            if (this.m_GenerateSecondaryUV.boolValue)
            {
                EditorGUI.indentLevel++;
                this.m_SecondaryUVAdvancedOptions = EditorGUILayout.Foldout(this.m_SecondaryUVAdvancedOptions, styles.GenerateSecondaryUVAdvanced, EditorStyles.foldout);
                if (this.m_SecondaryUVAdvancedOptions)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.Slider(this.m_SecondaryUVHardAngle, 0f, 180f, styles.secondaryUVHardAngle, new GUILayoutOption[0]);
                    EditorGUILayout.Slider(this.m_SecondaryUVPackMargin, 1f, 64f, styles.secondaryUVPackMargin, new GUILayoutOption[0]);
                    EditorGUILayout.Slider(this.m_SecondaryUVAngleDistortion, 1f, 75f, styles.secondaryUVAngleDistortion, new GUILayoutOption[0]);
                    EditorGUILayout.Slider(this.m_SecondaryUVAreaDistortion, 1f, 75f, styles.secondaryUVAreaDistortion, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_SecondaryUVHardAngle.floatValue = Mathf.Round(this.m_SecondaryUVHardAngle.floatValue);
                        this.m_SecondaryUVPackMargin.floatValue = Mathf.Round(this.m_SecondaryUVPackMargin.floatValue);
                        this.m_SecondaryUVAngleDistortion.floatValue = Mathf.Round(this.m_SecondaryUVAngleDistortion.floatValue);
                        this.m_SecondaryUVAreaDistortion.floatValue = Mathf.Round(this.m_SecondaryUVAreaDistortion.floatValue);
                    }
                }
                EditorGUI.indentLevel--;
            }
            GUILayout.Label(styles.TangentSpace, EditorStyles.boldLabel, new GUILayoutOption[0]);
            bool flag = true;
            foreach (ModelImporter importer in base.targets)
            {
                if (!importer.isTangentImportSupported)
                {
                    flag = false;
                }
            }
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Popup(this.m_NormalImportMode, styles.TangentSpaceModeOptLabelsAll, styles.TangentSpaceNormalLabel, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_TangentImportMode.intValue = this.m_NormalImportMode.intValue;
                if (!flag && (this.m_TangentImportMode.intValue == 0))
                {
                    this.m_TangentImportMode.intValue = 1;
                }
            }
            GUIContent[] tangentSpaceModeOptLabelsAll = styles.TangentSpaceModeOptLabelsAll;
            ModelImporterTangentSpaceMode[] tangentSpaceModeOptEnumsAll = styles.TangentSpaceModeOptEnumsAll;
            if ((this.m_NormalImportMode.intValue == 1) || !flag)
            {
                tangentSpaceModeOptLabelsAll = styles.TangentSpaceModeOptLabelsCalculate;
                tangentSpaceModeOptEnumsAll = styles.TangentSpaceModeOptEnumsCalculate;
            }
            else if (this.m_NormalImportMode.intValue == 2)
            {
                tangentSpaceModeOptLabelsAll = styles.TangentSpaceModeOptLabelsNone;
                tangentSpaceModeOptEnumsAll = styles.TangentSpaceModeOptEnumsNone;
            }
            EditorGUI.BeginDisabledGroup(this.m_NormalImportMode.intValue == 2);
            int index = Array.IndexOf<ModelImporterTangentSpaceMode>(tangentSpaceModeOptEnumsAll, (ModelImporterTangentSpaceMode) this.m_TangentImportMode.intValue);
            EditorGUI.BeginChangeCheck();
            index = EditorGUILayout.Popup(styles.TangentSpaceTangentLabel, index, tangentSpaceModeOptLabelsAll, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_TangentImportMode.intValue = (int) tangentSpaceModeOptEnumsAll[index];
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(this.m_NormalImportMode.intValue != 1);
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Slider(this.m_NormalSmoothAngle, 0f, 180f, styles.SmoothingAngle, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_NormalSmoothAngle.floatValue = Mathf.Round(this.m_NormalSmoothAngle.floatValue);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(this.m_TangentImportMode.intValue != 1);
            EditorGUILayout.PropertyField(this.m_SplitTangentsAcrossSeams, styles.SplitTangents, new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.PropertyField(this.m_KeepQuads, styles.KeepQuads, new GUILayoutOption[0]);
            GUILayout.Label(styles.Materials, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_ImportMaterials, styles.ImportMaterials, new GUILayoutOption[0]);
            if (this.m_ImportMaterials.boolValue)
            {
                EditorGUILayout.Popup(this.m_MaterialName, !this.m_ShowAllMaterialNameOptions ? styles.MaterialNameOptMain : styles.MaterialNameOptAll, styles.MaterialName, new GUILayoutOption[0]);
                EditorGUILayout.Popup(this.m_MaterialSearch, styles.MaterialSearchOpt, styles.MaterialSearch, new GUILayoutOption[0]);
                string[] textArray1 = new string[] { styles.MaterialHelpStart.text.Replace("%MAT%", styles.MaterialNameHelp[this.m_MaterialName.intValue].text), "\n", styles.MaterialSearchHelp[this.m_MaterialSearch.intValue].text, "\n", styles.MaterialHelpEnd.text };
                text = string.Concat(textArray1);
            }
            else
            {
                text = styles.MaterialHelpDefault.text;
            }
            GUILayout.Label(new GUIContent(text), EditorStyles.helpBox, new GUILayoutOption[0]);
            base.ApplyRevertGUI();
        }