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