/* EDITOR DRAWING */ #region Editor Drawing public override void OnInspectorGUI() { serializedObject.Update(); // Branding BeffioDitherEditorUtilities.DrawInspectorBranding(); GUILayout.Space(10); // Cache dirty state to prevent layouting error bool isDirty = CurrentPattern.IsDirty; // Settings EditorGUI.BeginChangeCheck(); { // Texture Settings DrawTextureSettingGUI(); // Type Selection DrawPatternTypeSelectionGUI(); // Pattern Settings DrawPatternSettingsGUI(); // Apply changes to serializedObject serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { if (_autoGenerate) { Generate(CurrentPattern); BeffioDitherEditorUtilities.UpdateMaterialsForTexture(_pattern.Texture); CurrentPattern.IsDirty = false; } else { CurrentPattern.IsDirty = true; } } } // Buttons DrawButtonGUI(); // Help Message if (isDirty) { EditorGUILayout.HelpBox(ContentText.notGeneratedHelpBox, MessageType.Warning); } }
/* INSPECTOR DRAWING */ #region Inspector Drawing protected override void DrawGUI(MaterialEditor materialEditor, MaterialProperty[] properties) { // Branding BeffioDitherEditorUtilities.DrawInspectorBranding(); EditorGUILayout.Space(); // Base Information FindProperties(properties); // Draw Base Paint Settings DrawStandardPropertiesGUI(materialEditor, properties); EditorGUILayout.Space(); EditorGUILayout.LabelField(ContentText.ditheringHeader, EditorStyles.boldLabel); DrawDitheringSettingsGUI(materialEditor); }
public override void OnInspectorGUI() { serializedObject.Update(); // Branding BeffioDitherEditorUtilities.DrawInspectorBranding(); GUILayout.Space(10); // Warning DrawGUIWarning(); GUILayout.Space(10); // Fields DrawGUIFields(); serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
/* EDITOR DRAWING */ #region Editor Drawing public override void OnInspectorGUI() { serializedObject.Update(); // Branding BeffioDitherEditorUtilities.DrawInspectorBranding(); GUILayout.Space(10); // Cache dirty and texture states to prevent layouting error bool hasTexture = CurrentPalette.HasTexture; bool isDirty = CurrentPalette.IsDirty; EditorGUI.BeginChangeCheck(); { // Settings DrawSettingsGUI(); // Color List DrawColorListGUI(); // Apply Changes to serializedObject serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { if (_autoGenerate) { GeneratePaletteTexture(CurrentPalette); BeffioDitherEditorUtilities.UpdateMaterialsForTexture(_palette.Texture); CurrentPalette.IsDirty = false; } else { CurrentPalette.IsDirty = true; } } } GUILayout.Space(10); // Auto generate checkbox _autoGenerate = EditorGUILayout.Toggle(ContentText.autoGenerate, _autoGenerate); // Buttons DrawButtonsGUI(); // BW randomization checkbox _randomBW = EditorGUILayout.Toggle(ContentText.randomizeColorsBW, _randomBW); if (!_randomBW) { _selectiveRandomization = EditorGUILayout.Toggle(ContentText.selectiveRandomization, _selectiveRandomization); if (_selectiveRandomization) { EditorGUI.indentLevel = 1; _r = EditorGUILayout.Toggle("R", _r); _g = EditorGUILayout.Toggle("G", _g); _b = EditorGUILayout.Toggle("B", _b); EditorGUI.indentLevel = 0; } } // Help Messages DrawHelpBoxGUI(hasTexture, isDirty); }