public override void OnGUI() { var displays = GetValue(kDisplayedUI); var errorCode = GetValue(kInputErrorCode); m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); if ((displays & DelightingUI.Display.SectionInput) != 0) { EditorGUILayout.Space(); SetValue(kFoldInputParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldInputParameters), Content.inputParametersTitle, DelightingHelpers.GetIcon(errorCode, kInputError))); if (GetValue(kFoldInputParameters)) { ++EditorGUI.indentLevel; if ((displays & DelightingUI.Display.FieldBaseTexture) != 0) { SetValue(kBaseTexture, EditorGUIXLayout.InlineObjectField(Content.baseTextureLabel, GetValue(kBaseTexture), DelightingHelpers.GetIcon(errorCode, kBaseValueError))); } if ((displays & DelightingUI.Display.FieldNormalsTexture) != 0) { SetValue(kNormalsTexture, EditorGUIXLayout.InlineObjectField(Content.normalsTextureLabel, GetValue(kNormalsTexture), DelightingHelpers.GetIcon(errorCode, kNormalsValueError))); } if ((displays & DelightingUI.Display.FieldBentNormalsTexture) != 0) { SetValue(kBentNormalsTexture, EditorGUIXLayout.InlineObjectField(Content.bentNormalsTextureLabel, GetValue(kBentNormalsTexture), DelightingHelpers.GetIcon(errorCode, kBentNormalsValueError))); } if ((displays & DelightingUI.Display.FieldAmbientOcclusionTexture) != 0) { SetValue(kAmbientOcclusionTexture, EditorGUIXLayout.InlineObjectField(Content.ambientOcclusionTextureLabel, GetValue(kAmbientOcclusionTexture), DelightingHelpers.GetIcon(errorCode, kAmbientOcclusionValueError))); } --EditorGUI.indentLevel; } EditorGUILayout.Space(); SetValue(kFoldOptionalParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldOptionalParameters), Content.optionalParametersTitle, DelightingHelpers.GetIcon(errorCode, kOptionalError))); if (GetValue(kFoldOptionalParameters)) { ++EditorGUI.indentLevel; if ((displays & DelightingUI.Display.FieldPositionTexture) != 0) { SetValue(kPositionTexture, EditorGUIXLayout.InlineObjectField(Content.positionTextureLabel, GetValue(kPositionTexture), DelightingHelpers.GetIcon(errorCode, kPositionValueError))); } if ((displays & DelightingUI.Display.FieldMaskTexture) != 0) { SetValue(kMaskTexture, EditorGUIXLayout.InlineObjectField(Content.maskLabel, GetValue(kMaskTexture), DelightingHelpers.GetIcon(errorCode, kMaskValueError))); } if ((displays & DelightingUI.Display.FieldSwitchYZAxes) != 0) { SetValue(kSwitchYZaxes, EditorGUILayout.Toggle(Content.switchYZLabel, GetValue(kSwitchYZaxes))); } --EditorGUI.indentLevel; } } if ((displays & DelightingUI.Display.SectionDelighting) != 0) { EditorGUILayout.Space(); SetValue(kFoldDelightingParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldDelightingParameters), Content.delightingParametersTitle)); if (GetValue(kFoldDelightingParameters)) { ++EditorGUI.indentLevel; GUI.enabled = GetValue(kPreviewTexture) != null; //if ((displays & DelightingUI.Display.FieldNoiseReduction) != 0) // SetValue(kSmoothNormals, EditorGUILayout.Slider(Content.smoothNormalsLabel, GetValue(kSmoothNormals), 0, 2)); if ((displays & DelightingUI.Display.FieldRemoveHighlights) != 0) { SetValue(kRemoveHighlights, EditorGUILayout.Slider(Content.removeHighlightsLabel, GetValue(kRemoveHighlights), 0, 1)); } if ((displays & DelightingUI.Display.FieldRemoveDarkNoise) != 0) { SetValue(kRemoveDarkNoise, EditorGUILayout.Slider(Content.removeDarkNoiseLabel, GetValue(kRemoveDarkNoise), 0, 1)); } if ((displays & DelightingUI.Display.FieldSeparateDarkAreas) != 0) { SetValue(kSeparateDarkAreas, EditorGUILayout.Slider(Content.separateDarkAreasLabel, GetValue(kSeparateDarkAreas), 0, 1)); } if ((displays & DelightingUI.Display.FieldForceLocalDelighting) != 0) { SetValue(kForceLocalDelighting, EditorGUILayout.Slider(Content.forceLocalDelightingLabel, GetValue(kForceLocalDelighting), 0, 1)); } GUI.enabled = true; --EditorGUI.indentLevel; } } if ((displays & DelightingUI.Display.SectionImport) != 0) { EditorGUILayout.Space(); SetValue(kFoldImportParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldImportParameters), Content.importPanelTitle)); if (GetValue(kFoldImportParameters)) { ++EditorGUI.indentLevel; SetValue(kBaseTextureSuffix, EditorGUILayout.TextField(Content.baseTextureLabel, GetValue(kBaseTextureSuffix))); SetValue(kNormalsTextureSuffix, EditorGUILayout.TextField(Content.normalsTextureLabel, GetValue(kNormalsTextureSuffix))); SetValue(kBentNormalsTextureSuffix, EditorGUILayout.TextField(Content.bentNormalsTextureLabel, GetValue(kBentNormalsTextureSuffix))); SetValue(kAmbientOcclusionTextureSuffix, EditorGUILayout.TextField(Content.ambientOcclusionTextureLabel, GetValue(kAmbientOcclusionTextureSuffix))); SetValue(kPositionsTextureSuffix, EditorGUILayout.TextField(Content.positionTextureLabel, GetValue(kPositionsTextureSuffix))); SetValue(kMaskTextureSuffix, EditorGUILayout.TextField(Content.maskLabel, GetValue(kMaskTextureSuffix))); --EditorGUI.indentLevel; } } var messages = GetValue(kInspectorErrorMessages); if (messages != null) { EditorGUILayout.Space(); for (int i = 0; i < messages.Count; i++) { EditorGUILayout.HelpBox(messages[i], MessageType.Error, true); } } if ((displays & (DelightingUI.Display.ButtonCompute | DelightingUI.Display.ButtonExport)) != 0) { var computeStyle = Styles.largeButton; var exportStyle = Styles.largeButton; if ((displays & (DelightingUI.Display.ButtonCompute | DelightingUI.Display.ButtonExport)) == (DelightingUI.Display.ButtonCompute | DelightingUI.Display.ButtonExport)) { computeStyle = Styles.largeButtonLeft; exportStyle = Styles.largeButtonRight; } GUILayout.Box(GUIContent.none, Styles.separator); GUI.enabled = GetValue(kHasValidInput); GUILayout.BeginHorizontal(); if ((displays & DelightingUI.Display.ButtonCompute) != 0 && GUILayout.Button(Content.computeLabel, computeStyle)) { ExecuteCommand(kCmdProcessFromGather); } if ((displays & DelightingUI.Display.ButtonExport) != 0 && GUILayout.Button(Content.exportLabel, exportStyle)) { ExecuteCommand(kCmdExport); } GUILayout.EndHorizontal(); } GUI.enabled = true; if ((displays & DelightingUI.Display.SectionDebug) != 0) { EditorGUILayout.Space(); SetValue(kFoldDebugParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldDebugParameters), Content.debugPanelTitle)); if (GetValue(kFoldDebugParameters)) { ++EditorGUI.indentLevel; m_DebugTexture.OnGUI(); --EditorGUI.indentLevel; } } EditorGUILayout.EndScrollView(); }