From 6245c399fe541aeb8e998b5c84c0599b93023b90 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 18 Apr 2023 11:48:40 +0200 Subject: [PATCH] [unity] Changed SpineShaderWithOutlineGUI outline methods from private to protected virtual. --- CHANGELOG.md | 1 + .../Editor/Shaders/SpineShaderWithOutlineGUI.cs | 14 ++++---------- .../Editor/Shaders/SpineSpriteShaderGUI.cs | 8 -------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa183651ae..8c408eb05f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ * `SkeletonGraphic` now supports automatic scaling based on its `RectTransform` bounds. Automatic scaling can be enabled by setting the added `Layout Scale Mode` Inspector property to either `Width Controls Height`, `Height Controls Width`, `FitInParent` or `EnvelopeParent`. It is set to `None` by default to keep previous behaviour and avoid breaking existing projects. To modify the reference layout bounds, hit the additional `Edit Layout Bounds` toggle button to switch into edit mode, adjust the bounds or hit `Match RectTransform with Mesh`, and hit the button again when done adjusting. The skeleton will now be scaled accordingly to fit the reference layout bounds to the object's `RectTransform`. * **Breaking changes** + * Changed `SpineShaderWithOutlineGUI` outline related methods from `private` to `protected virtual` to allow for custom shader GUI subclasses to switch to different outline shaders. * **Changes of default values** diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs index 12b1d9d55d..db546ae2f4 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineShaderWithOutlineGUI.cs @@ -84,7 +84,6 @@ public class SpineShaderWithOutlineGUI : ShaderGUI { #endregion #region Virtual Interface - protected virtual void FindProperties (MaterialProperty[] props) { _OutlineWidth = FindProperty("_OutlineWidth", props, false); @@ -168,11 +167,7 @@ public class SpineShaderWithOutlineGUI : ShaderGUI { } } - #endregion - - #region Private Functions - - void SwitchShaderToOutlineSettings (Material material, bool enableOutline) { + protected virtual void SwitchShaderToOutlineSettings (Material material, bool enableOutline) { string shaderName = material.shader.name; bool isSetToOutlineShader = shaderName.Contains(ShaderOutlineNamePrefix); @@ -187,7 +182,7 @@ public class SpineShaderWithOutlineGUI : ShaderGUI { } } - static bool IsOutlineEnabled (MaterialEditor editor, out bool mixedValue) { + protected static bool IsOutlineEnabled (MaterialEditor editor, out bool mixedValue) { mixedValue = false; bool isAnyEnabled = false; foreach (Material material in editor.targets) { @@ -200,7 +195,7 @@ public class SpineShaderWithOutlineGUI : ShaderGUI { return isAnyEnabled; } - static bool IsShaderWithoutStandardVariantShader (MaterialEditor editor, out bool mixedValue) { + protected static bool IsShaderWithoutStandardVariantShader (MaterialEditor editor, out bool mixedValue) { mixedValue = false; bool isAnyShaderWithoutVariant = false; foreach (Material material in editor.targets) { @@ -213,13 +208,12 @@ public class SpineShaderWithOutlineGUI : ShaderGUI { return isAnyShaderWithoutVariant; } - static bool BoldToggleField (GUIContent label, bool value) { + protected static bool BoldToggleField (GUIContent label, bool value) { FontStyle origFontStyle = EditorStyles.label.fontStyle; EditorStyles.label.fontStyle = FontStyle.Bold; value = EditorGUILayout.Toggle(label, value, EditorStyles.toggle); EditorStyles.label.fontStyle = origFontStyle; return value; } - #endregion } diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs index cca79d418a..ce0ea0d6e1 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Shaders/SpineSpriteShaderGUI.cs @@ -268,14 +268,6 @@ private enum eDiffuseRampMode { _lightAffectsAdditive = FindProperty("_LightAffectsAdditive", props, false); } - static bool BoldToggleField (GUIContent label, bool value) { - FontStyle origFontStyle = EditorStyles.label.fontStyle; - EditorStyles.label.fontStyle = FontStyle.Bold; - value = EditorGUILayout.Toggle(label, value, EditorStyles.toggle); - EditorStyles.label.fontStyle = origFontStyle; - return value; - } - protected virtual void ShaderPropertiesGUI () { // Use default labelWidth EditorGUIUtility.labelWidth = 0f;