Skip to content

Commit

Permalink
[unity] Minor SkeletonGraphic fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pharan committed Jul 15, 2016
1 parent 0e883f3 commit 5611de2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static void MatchRectTransformWithBounds (MenuCommand command) {
var skeletonGraphic = (SkeletonGraphic)command.context;
var mesh = skeletonGraphic.SpineMeshGenerator.LastGeneratedMesh;

mesh.RecalculateBounds();
var bounds = mesh.bounds;
var size = bounds.size;
var center = bounds.center;
Expand All @@ -120,19 +121,6 @@ static void MatchRectTransformWithBounds (MenuCommand command) {
skeletonGraphic.rectTransform.pivot = p;
}

public static Material DefaultSkeletonGraphicMaterial {
get {
var guids = AssetDatabase.FindAssets("SkeletonGraphicDefault t:material");
if (guids.Length <= 0)
return null;
var firstAssetPath = AssetDatabase.GUIDToAssetPath(guids[0]);
if (string.IsNullOrEmpty(firstAssetPath))
return null;
var firstMaterial = AssetDatabase.LoadAssetAtPath<Material>(firstAssetPath);
return firstMaterial;
}
}

[MenuItem("GameObject/Spine/SkeletonGraphic (UnityUI)", false, 15)]
static public void SkeletonGraphicCreateMenuItem () {
var parentGameObject = Selection.activeObject as GameObject;
Expand Down Expand Up @@ -219,6 +207,19 @@ static GameObject NewSkeletonGraphicGameObject (string gameObjectName) {
return go;
}

public static Material DefaultSkeletonGraphicMaterial {
get {
var guids = AssetDatabase.FindAssets("SkeletonGraphicDefault t:material");
if (guids.Length <= 0) return null;

var firstAssetPath = AssetDatabase.GUIDToAssetPath(guids[0]);
if (string.IsNullOrEmpty(firstAssetPath)) return null;

var firstMaterial = AssetDatabase.LoadAssetAtPath<Material>(firstAssetPath);
return firstMaterial;
}
}

#endregion

#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This is a premultiply-alpha adaptation of the built-in Unity shader "UI/Default" to allow Unity UI stencil masking.

Shader "Spine/SkeletonGraphic (Premultiply Alpha)"
{
Properties
Expand Down Expand Up @@ -84,7 +86,7 @@ Shader "Spine/SkeletonGraphic (Premultiply Alpha)"
fixed4 frag(v2f IN) : SV_Target
{
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
clip (color.a - 0.01);
//clip(color.a - 0.01);
return color;
}
ENDCG
Expand Down

0 comments on commit 5611de2

Please sign in to comment.