Skip to content

Commit

Permalink
[unity] Changed SpineShaderWithOutlineGUI outline methods from privat…
Browse files Browse the repository at this point in the history
…e to protected virtual.
  • Loading branch information
HaraldCsaszar committed Apr 18, 2023
1 parent 0289cdc commit 6245c39
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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**

Expand Down
Expand Up @@ -84,7 +84,6 @@ public class SpineShaderWithOutlineGUI : ShaderGUI {
#endregion

#region Virtual Interface

protected virtual void FindProperties (MaterialProperty[] props) {

_OutlineWidth = FindProperty("_OutlineWidth", props, false);
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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
}
Expand Up @@ -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;
Expand Down

0 comments on commit 6245c39

Please sign in to comment.