mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-23 02:06:46 +08:00
Merge branch 'master' into spine-ue4
This commit is contained in:
commit
08ef2ec560
Binary file not shown.
@ -219,7 +219,7 @@ public class AnimationState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entry.mixDuration > 0) queueEvents(from, animationTime);
|
if (entry.mixDuration > 0) queueEvents(from, animationTime);
|
||||||
events.length = 0;
|
this.events.length = 0;
|
||||||
from.nextAnimationLast = animationTime;
|
from.nextAnimationLast = animationTime;
|
||||||
from.nextTrackLast = from.trackTime;
|
from.nextTrackLast = from.trackTime;
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public dynamic class MeshAttachment extends VertexAttachment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyFFD (sourceAttachment:Attachment) : Boolean {
|
override public function applyDeform (sourceAttachment:VertexAttachment) : Boolean {
|
||||||
return this == sourceAttachment || (inheritDeform && _parentMesh == sourceAttachment);
|
return this == sourceAttachment || (inheritDeform && _parentMesh == sourceAttachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -582,6 +582,7 @@ static spAnimation* _spSkeletonBinary_readAnimation (spSkeletonBinary* self, con
|
|||||||
kv_trim(spTimeline*, timelines);
|
kv_trim(spTimeline*, timelines);
|
||||||
|
|
||||||
animation = spAnimation_create(name, 0);
|
animation = spAnimation_create(name, 0);
|
||||||
|
FREE(animation->timelines);
|
||||||
animation->duration = duration;
|
animation->duration = duration;
|
||||||
animation->timelinesCount = kv_size(timelines);
|
animation->timelinesCount = kv_size(timelines);
|
||||||
animation->timelines = kv_array(timelines);
|
animation->timelines = kv_array(timelines);
|
||||||
|
|||||||
Binary file not shown.
@ -42,7 +42,7 @@ public class Main extends Sprite {
|
|||||||
var example:Class;
|
var example:Class;
|
||||||
example = SpineboyExample;
|
example = SpineboyExample;
|
||||||
// example = GoblinsExample;
|
// example = GoblinsExample;
|
||||||
// example = RaptorExample;
|
example = RaptorExample;
|
||||||
// example = TankExample;
|
// example = TankExample;
|
||||||
// example = VineExample;
|
// example = VineExample;
|
||||||
// example = StretchymanExample;
|
// example = StretchymanExample;
|
||||||
|
|||||||
Binary file not shown.
@ -288,47 +288,56 @@ namespace Spine.Unity.Editor {
|
|||||||
var sprites = new List<SpriteMetaData>(spriteSheet);
|
var sprites = new List<SpriteMetaData>(spriteSheet);
|
||||||
|
|
||||||
var regions = AtlasAssetInspector.GetRegions(atlas);
|
var regions = AtlasAssetInspector.GetRegions(atlas);
|
||||||
int textureHeight = texture.height;
|
|
||||||
char[] FilenameDelimiter = {'.'};
|
char[] FilenameDelimiter = {'.'};
|
||||||
int updatedCount = 0;
|
int updatedCount = 0;
|
||||||
int addedCount = 0;
|
int addedCount = 0;
|
||||||
|
|
||||||
foreach (var r in regions) {
|
foreach (var r in regions) {
|
||||||
int width, height;
|
|
||||||
if (r.rotate) {
|
|
||||||
width = r.height;
|
|
||||||
height = r.width;
|
|
||||||
} else {
|
|
||||||
width = r.width;
|
|
||||||
height = r.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
int x = r.x;
|
|
||||||
int y = textureHeight - height - r.y;
|
|
||||||
|
|
||||||
string pageName = r.page.name.Split(FilenameDelimiter, StringSplitOptions.RemoveEmptyEntries)[0];
|
string pageName = r.page.name.Split(FilenameDelimiter, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||||
string textureName = texture.name;
|
string textureName = texture.name;
|
||||||
bool pageMatch = string.Equals(pageName, textureName,StringComparison.Ordinal);
|
bool pageMatch = string.Equals(pageName, textureName, StringComparison.Ordinal);
|
||||||
|
|
||||||
|
// if (pageMatch) {
|
||||||
|
// int pw = r.page.width;
|
||||||
|
// int ph = r.page.height;
|
||||||
|
// bool mismatchSize = pw != texture.width || pw > t.maxTextureSize || ph != texture.height || ph > t.maxTextureSize;
|
||||||
|
// if (mismatchSize)
|
||||||
|
// Debug.LogWarningFormat("Size mismatch found.\nExpected atlas size is {0}x{1}. Texture Import Max Size of texture '{2}'({4}x{5}) is currently set to {3}.", pw, ph, texture.name, t.maxTextureSize, texture.width, texture.height);
|
||||||
|
// }
|
||||||
|
|
||||||
int spriteIndex = pageMatch ? sprites.FindIndex(
|
int spriteIndex = pageMatch ? sprites.FindIndex(
|
||||||
(s) => string.Equals(s.name, r.name, StringComparison.Ordinal)
|
(s) => string.Equals(s.name, r.name, StringComparison.Ordinal)
|
||||||
) : -1;
|
) : -1;
|
||||||
bool matchFound = spriteIndex >= 0;
|
bool spriteNameMatchExists = spriteIndex >= 0;
|
||||||
|
|
||||||
if (matchFound) {
|
if (pageMatch) {
|
||||||
var s = sprites[spriteIndex];
|
Rect spriteRect = new Rect();
|
||||||
s.rect = new Rect(x, y, width, height);
|
|
||||||
sprites[spriteIndex] = s;
|
if (r.rotate) {
|
||||||
updatedCount++;
|
spriteRect.width = r.height;
|
||||||
} else {
|
spriteRect.height = r.width;
|
||||||
if (pageMatch) {
|
} else {
|
||||||
|
spriteRect.width = r.width;
|
||||||
|
spriteRect.height = r.height;
|
||||||
|
}
|
||||||
|
spriteRect.x = r.x;
|
||||||
|
spriteRect.y = r.page.height - spriteRect.height - r.y;
|
||||||
|
|
||||||
|
if (spriteNameMatchExists) {
|
||||||
|
var s = sprites[spriteIndex];
|
||||||
|
s.rect = spriteRect;
|
||||||
|
sprites[spriteIndex] = s;
|
||||||
|
updatedCount++;
|
||||||
|
} else {
|
||||||
sprites.Add(new SpriteMetaData {
|
sprites.Add(new SpriteMetaData {
|
||||||
name = r.name,
|
name = r.name,
|
||||||
pivot = new Vector2(0.5f, 0.5f),
|
pivot = new Vector2(0.5f, 0.5f),
|
||||||
rect = new Rect(x, y, width, height)
|
rect = spriteRect
|
||||||
});
|
});
|
||||||
addedCount++;
|
addedCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t.spritesheet = sprites.ToArray();
|
t.spritesheet = sprites.ToArray();
|
||||||
|
|||||||
@ -55,7 +55,7 @@ namespace Spine.Unity {
|
|||||||
public bool followBoneRotation = true;
|
public bool followBoneRotation = true;
|
||||||
|
|
||||||
[Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")]
|
[Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")]
|
||||||
public bool followSkeletonFlip = false;
|
public bool followSkeletonFlip = true;
|
||||||
|
|
||||||
[Tooltip("Follows the target bone's local scale. BoneFollower cannot inherit world/skewed scale because of UnityEngine.Transform property limitations.")]
|
[Tooltip("Follows the target bone's local scale. BoneFollower cannot inherit world/skewed scale because of UnityEngine.Transform property limitations.")]
|
||||||
public bool followLocalScale = false;
|
public bool followLocalScale = false;
|
||||||
|
|||||||
@ -51,6 +51,51 @@ namespace Spine.Unity.Editor {
|
|||||||
targetBoneFollower.SkeletonRenderer.Initialize(false);
|
targetBoneFollower.SkeletonRenderer.Initialize(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnSceneGUI () {
|
||||||
|
if (targetBoneFollower == null) return;
|
||||||
|
var skeletonRendererComponent = targetBoneFollower.skeletonRenderer;
|
||||||
|
if (skeletonRendererComponent == null) return;
|
||||||
|
|
||||||
|
var transform = skeletonRendererComponent.transform;
|
||||||
|
var skeleton = skeletonRendererComponent.skeleton;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(targetBoneFollower.boneName)) {
|
||||||
|
SpineHandles.DrawBones(transform, skeleton);
|
||||||
|
SpineHandles.DrawBoneNames(transform, skeleton);
|
||||||
|
Handles.Label(targetBoneFollower.transform.position, "No bone selected", EditorStyles.helpBox);
|
||||||
|
} else {
|
||||||
|
var targetBone = targetBoneFollower.bone;
|
||||||
|
if (targetBone == null) return;
|
||||||
|
SpineHandles.DrawBoneWireframe(transform, targetBone, SpineHandles.TransformContraintColor);
|
||||||
|
Handles.Label(targetBone.GetWorldPosition(transform), targetBone.Data.Name, SpineHandles.BoneNameStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Context Menu Item
|
||||||
|
[MenuItem ("CONTEXT/SkeletonRenderer/Add BoneFollower GameObject")]
|
||||||
|
static void AddBoneFollowerGameObject (MenuCommand cmd) {
|
||||||
|
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
||||||
|
var go = new GameObject("BoneFollower");
|
||||||
|
var t = go.transform;
|
||||||
|
t.SetParent(skeletonRenderer.transform);
|
||||||
|
t.localPosition = Vector3.zero;
|
||||||
|
|
||||||
|
var f = go.AddComponent<BoneFollower>();
|
||||||
|
f.skeletonRenderer = skeletonRenderer;
|
||||||
|
|
||||||
|
EditorGUIUtility.PingObject(t);
|
||||||
|
|
||||||
|
Undo.RegisterCreatedObjectUndo(go, "Add BoneFollower");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
[MenuItem ("CONTEXT/SkeletonRenderer/Add BoneFollower GameObject", true)]
|
||||||
|
static bool ValidateAddBoneFollowerGameObject (MenuCommand cmd) {
|
||||||
|
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
||||||
|
return skeletonRenderer.valid;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
override public void OnInspectorGUI () {
|
override public void OnInspectorGUI () {
|
||||||
if (needsReset) {
|
if (needsReset) {
|
||||||
targetBoneFollower.Initialize();
|
targetBoneFollower.Initialize();
|
||||||
|
|||||||
@ -531,7 +531,7 @@ namespace Spine.Unity.Editor {
|
|||||||
bool abortSkeletonImport = false;
|
bool abortSkeletonImport = false;
|
||||||
foreach (string sp in skeletonPaths) {
|
foreach (string sp in skeletonPaths) {
|
||||||
if (!reimport && CheckForValidSkeletonData(sp)) {
|
if (!reimport && CheckForValidSkeletonData(sp)) {
|
||||||
ClearExistingSkeletonData(sp);
|
ReloadSkeletonData(sp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ namespace Spine.Unity.Editor {
|
|||||||
// Any post processing of images
|
// Any post processing of images
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClearExistingSkeletonData (string skeletonJSONPath) {
|
static void ReloadSkeletonData (string skeletonJSONPath) {
|
||||||
string dir = Path.GetDirectoryName(skeletonJSONPath);
|
string dir = Path.GetDirectoryName(skeletonJSONPath);
|
||||||
TextAsset textAsset = (TextAsset)AssetDatabase.LoadAssetAtPath(skeletonJSONPath, typeof(TextAsset));
|
TextAsset textAsset = (TextAsset)AssetDatabase.LoadAssetAtPath(skeletonJSONPath, typeof(TextAsset));
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(dir);
|
DirectoryInfo dirInfo = new DirectoryInfo(dir);
|
||||||
@ -611,6 +611,7 @@ namespace Spine.Unity.Editor {
|
|||||||
if (Selection.activeObject == skeletonDataAsset)
|
if (Selection.activeObject == skeletonDataAsset)
|
||||||
Selection.activeObject = null;
|
Selection.activeObject = null;
|
||||||
|
|
||||||
|
Debug.LogFormat("Changes to '{0}' detected. Clearing SkeletonDataAsset: {1}", skeletonJSONPath, localPath);
|
||||||
skeletonDataAsset.Clear();
|
skeletonDataAsset.Clear();
|
||||||
|
|
||||||
string guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(skeletonDataAsset));
|
string guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(skeletonDataAsset));
|
||||||
@ -643,9 +644,8 @@ namespace Spine.Unity.Editor {
|
|||||||
// if (currentHash == null || lastHash != currentHash)
|
// if (currentHash == null || lastHash != currentHash)
|
||||||
// Do any upkeep on synchronized assets
|
// Do any upkeep on synchronized assets
|
||||||
|
|
||||||
if (currentHash != null) {
|
if (currentHash != null)
|
||||||
EditorPrefs.SetString(guid + "_hash", currentHash);
|
EditorPrefs.SetString(guid + "_hash", currentHash);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1399,17 +1399,18 @@ namespace Spine.Unity.Editor {
|
|||||||
public static Color TransformContraintColor { get { return new Color(170/255f, 226/255f, 35/255f); } }
|
public static Color TransformContraintColor { get { return new Color(170/255f, 226/255f, 35/255f); } }
|
||||||
public static Color IkColor { get { return new Color(228/255f,90/255f,43/255f); } }
|
public static Color IkColor { get { return new Color(228/255f,90/255f,43/255f); } }
|
||||||
|
|
||||||
|
static Vector3[] _boneMeshVerts = {
|
||||||
|
new Vector3(0, 0, 0),
|
||||||
|
new Vector3(0.1f, 0.1f, 0),
|
||||||
|
new Vector3(1, 0, 0),
|
||||||
|
new Vector3(0.1f, -0.1f, 0)
|
||||||
|
};
|
||||||
static Mesh _boneMesh;
|
static Mesh _boneMesh;
|
||||||
public static Mesh BoneMesh {
|
public static Mesh BoneMesh {
|
||||||
get {
|
get {
|
||||||
if (_boneMesh == null) {
|
if (_boneMesh == null) {
|
||||||
_boneMesh = new Mesh {
|
_boneMesh = new Mesh {
|
||||||
vertices = new [] {
|
vertices = _boneMeshVerts,
|
||||||
new Vector3(0, 0, 0),
|
|
||||||
new Vector3(0.1f, 0.1f, 0),
|
|
||||||
new Vector3(1, 0, 0),
|
|
||||||
new Vector3(0.1f, -0.1f, 0)
|
|
||||||
},
|
|
||||||
uv = new Vector2[4],
|
uv = new Vector2[4],
|
||||||
triangles = new [] { 0, 1, 2, 2, 3, 0 }
|
triangles = new [] { 0, 1, 2, 2, 3, 0 }
|
||||||
};
|
};
|
||||||
@ -1506,6 +1507,34 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Vector3[] _boneWireBuffer = new Vector3[5];
|
||||||
|
static Vector3[] GetBoneWireBuffer (Matrix4x4 m) {
|
||||||
|
for (int i = 0, n = _boneMeshVerts.Length; i < n; i++)
|
||||||
|
_boneWireBuffer[i] = m.MultiplyPoint(_boneMeshVerts[i]);
|
||||||
|
|
||||||
|
_boneWireBuffer[4] = _boneWireBuffer[0]; // closed polygon.
|
||||||
|
return _boneWireBuffer;
|
||||||
|
}
|
||||||
|
public static void DrawBoneWireframe (Transform transform, Bone b, Color color) {
|
||||||
|
Handles.color = color;
|
||||||
|
var pos = new Vector3(b.WorldX, b.WorldY, 0);
|
||||||
|
float length = b.Data.Length;
|
||||||
|
|
||||||
|
if (length > 0) {
|
||||||
|
Quaternion rot = Quaternion.Euler(0, 0, b.WorldRotationX);
|
||||||
|
Vector3 scale = Vector3.one * length * b.WorldScaleX;
|
||||||
|
const float my = 1.5f;
|
||||||
|
scale.y *= (SpineHandles.handleScale + 1f) * 0.5f;
|
||||||
|
scale.y = Mathf.Clamp(scale.x, -my, my);
|
||||||
|
Handles.DrawPolyLine(GetBoneWireBuffer(transform.localToWorldMatrix * Matrix4x4.TRS(pos, rot, scale)));
|
||||||
|
var wp = transform.TransformPoint(pos);
|
||||||
|
DrawBoneCircle(wp, color, transform.forward);
|
||||||
|
} else {
|
||||||
|
var wp = transform.TransformPoint(pos);
|
||||||
|
DrawBoneCircle(wp, color, transform.forward);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void DrawBone (Transform transform, Bone b, float boneScale) {
|
public static void DrawBone (Transform transform, Bone b, float boneScale) {
|
||||||
var pos = new Vector3(b.WorldX, b.WorldY, 0);
|
var pos = new Vector3(b.WorldX, b.WorldY, 0);
|
||||||
float length = b.Data.Length;
|
float length = b.Data.Length;
|
||||||
|
|||||||
@ -45,11 +45,37 @@ namespace Spine.Unity.Modules {
|
|||||||
[SpineSlot] public string slot;
|
[SpineSlot] public string slot;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
void OnValidate () {
|
||||||
|
var skeletonComponent = GetComponent<ISkeletonComponent>();
|
||||||
|
var skeletonRenderer = skeletonComponent as SkeletonRenderer;
|
||||||
|
bool apma;
|
||||||
|
|
||||||
|
if (skeletonRenderer != null) {
|
||||||
|
apma = skeletonRenderer.pmaVertexColors;
|
||||||
|
} else {
|
||||||
|
var skeletonGraphic = skeletonComponent as SkeletonGraphic;
|
||||||
|
apma = skeletonGraphic != null && skeletonGraphic.SpineMeshGenerator.PremultiplyVertexColors;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apma) {
|
||||||
|
try {
|
||||||
|
sprite.texture.GetPixel(0, 0);
|
||||||
|
} catch (UnityException e) {
|
||||||
|
Debug.LogFormat("Texture of {0} ({1}) is not read/write enabled. SpriteAttacher requires this in order to work with a SkeletonRenderer that renders premultiplied alpha. Please check the texture settings.", sprite.name, sprite.texture.name);
|
||||||
|
UnityEditor.EditorGUIUtility.PingObject(sprite.texture);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
RegionAttachment attachment;
|
RegionAttachment attachment;
|
||||||
bool applyPMA;
|
bool applyPMA;
|
||||||
|
|
||||||
Dictionary<Texture, AtlasPage> atlasPageCache = new Dictionary<Texture, AtlasPage>();
|
static Dictionary<Texture, AtlasPage> atlasPageCache;
|
||||||
AtlasPage GetPageFor (Texture texture, Shader shader) {
|
static AtlasPage GetPageFor (Texture texture, Shader shader) {
|
||||||
|
if (atlasPageCache == null) atlasPageCache = new Dictionary<Texture, AtlasPage>();
|
||||||
AtlasPage atlasPage;
|
AtlasPage atlasPage;
|
||||||
atlasPageCache.TryGetValue(texture, out atlasPage);
|
atlasPageCache.TryGetValue(texture, out atlasPage);
|
||||||
if (atlasPage == null) {
|
if (atlasPage == null) {
|
||||||
@ -76,7 +102,7 @@ namespace Spine.Unity.Modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Shader attachmentShader = applyPMA ? Shader.Find(DefaultPMAShader) : Shader.Find(DefaultStraightAlphaShader);
|
Shader attachmentShader = applyPMA ? Shader.Find(DefaultPMAShader) : Shader.Find(DefaultStraightAlphaShader);
|
||||||
attachment = applyPMA ? sprite.ToRegionAttachmentPMAClone(attachmentShader) : sprite.ToRegionAttachment(GetPageFor(sprite.texture, attachmentShader));
|
attachment = applyPMA ? sprite.ToRegionAttachmentPMAClone(attachmentShader) : sprite.ToRegionAttachment(SpriteAttacher.GetPageFor(sprite.texture, attachmentShader));
|
||||||
skeletonComponent.Skeleton.FindSlot(slot).Attachment = attachment;
|
skeletonComponent.Skeleton.FindSlot(slot).Attachment = attachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,11 +175,12 @@ namespace Spine.Unity.Editor {
|
|||||||
#region Menus
|
#region Menus
|
||||||
[MenuItem("CONTEXT/SkeletonRenderer/Add BoundingBoxFollower GameObject")]
|
[MenuItem("CONTEXT/SkeletonRenderer/Add BoundingBoxFollower GameObject")]
|
||||||
static void AddBoundingBoxFollowerChild (MenuCommand command) {
|
static void AddBoundingBoxFollowerChild (MenuCommand command) {
|
||||||
AddBoundingBoxFollowerChild((SkeletonRenderer)command.context);
|
var go = AddBoundingBoxFollowerChild((SkeletonRenderer)command.context);
|
||||||
|
Undo.RegisterCreatedObjectUndo(go, "Add BoundingBoxFollower");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
static void AddBoundingBoxFollowerChild (SkeletonRenderer sr, BoundingBoxFollower original = null) {
|
static GameObject AddBoundingBoxFollowerChild (SkeletonRenderer sr, BoundingBoxFollower original = null) {
|
||||||
var go = new GameObject("BoundingBoxFollower");
|
var go = new GameObject("BoundingBoxFollower");
|
||||||
go.transform.SetParent(sr.transform, false);
|
go.transform.SetParent(sr.transform, false);
|
||||||
var newFollower = go.AddComponent<BoundingBoxFollower>();
|
var newFollower = go.AddComponent<BoundingBoxFollower>();
|
||||||
@ -196,6 +197,7 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
Selection.activeGameObject = go;
|
Selection.activeGameObject = go;
|
||||||
EditorGUIUtility.PingObject(go);
|
EditorGUIUtility.PingObject(go);
|
||||||
|
return go;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,26 +90,6 @@ inline half3 calculateNormalFromBumpMap(float2 texUV, half3 tangentWorld, half3
|
|||||||
|
|
||||||
#endif // _NORMALMAP
|
#endif // _NORMALMAP
|
||||||
|
|
||||||
#if defined(_DIFFUSE_RAMP)
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
// Diffuse ramp functions
|
|
||||||
//
|
|
||||||
|
|
||||||
uniform sampler2D _DiffuseRamp;
|
|
||||||
|
|
||||||
inline fixed3 calculateDiffuseRamp(float ramp)
|
|
||||||
{
|
|
||||||
return tex2D(_DiffuseRamp, float2(ramp, ramp)).rgb;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline fixed3 calculateRampedDiffuse(fixed3 lightColor, float attenuation, float angleDot)
|
|
||||||
{
|
|
||||||
float ramp = clamp(((angleDot * 0.5) + 0.5) * attenuation, 0.0, 1.0);
|
|
||||||
return lightColor * calculateDiffuseRamp(ramp);
|
|
||||||
}
|
|
||||||
#endif // _DIFFUSE_RAMP
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Blending functions
|
// Blending functions
|
||||||
//
|
//
|
||||||
|
|||||||
@ -39,11 +39,9 @@ inline half3 calculateSpriteWorldNormal(VertexInput vertex)
|
|||||||
//Rotate fixed normal by inverse camera matrix to convert the fixed normal into world space
|
//Rotate fixed normal by inverse camera matrix to convert the fixed normal into world space
|
||||||
float3x3 invView = transpose((float3x3)UNITY_MATRIX_VP);
|
float3x3 invView = transpose((float3x3)UNITY_MATRIX_VP);
|
||||||
float3 normal = _FixedNormal.xyz;
|
float3 normal = _FixedNormal.xyz;
|
||||||
|
|
||||||
#if UNITY_REVERSED_Z
|
#if UNITY_REVERSED_Z
|
||||||
normal.z = -normal.z;
|
normal.z = -normal.z;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return normalize(mul(invView, normal));
|
return normalize(mul(invView, normal));
|
||||||
#endif // !MESH_NORMALS
|
#endif // !MESH_NORMALS
|
||||||
}
|
}
|
||||||
@ -84,6 +82,36 @@ inline half3 calculateSpriteWorldBinormal(half3 normalWorld, half3 tangentWorld,
|
|||||||
|
|
||||||
#endif // _NORMALMAP
|
#endif // _NORMALMAP
|
||||||
|
|
||||||
|
#if defined(_DIFFUSE_RAMP)
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
// Diffuse ramp functions
|
||||||
|
//
|
||||||
|
|
||||||
|
//Disable for softer, more traditional diffuse ramping
|
||||||
|
#define HARD_DIFFUSE_RAMP
|
||||||
|
|
||||||
|
uniform sampler2D _DiffuseRamp;
|
||||||
|
|
||||||
|
inline fixed3 calculateDiffuseRamp(float ramp)
|
||||||
|
{
|
||||||
|
return tex2D(_DiffuseRamp, float2(ramp, ramp)).rgb;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fixed3 calculateRampedDiffuse(fixed3 lightColor, float attenuation, float angleDot)
|
||||||
|
{
|
||||||
|
float d = angleDot * 0.5 + 0.5;
|
||||||
|
#if defined(HARD_DIFFUSE_RAMP)
|
||||||
|
half3 ramp = calculateDiffuseRamp(d * attenuation * 2);
|
||||||
|
return lightColor * ramp;
|
||||||
|
#else
|
||||||
|
half3 ramp = calculateDiffuseRamp(d);
|
||||||
|
return lightColor * ramp * (attenuation * 2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif // _DIFFUSE_RAMP
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Rim Lighting functions
|
// Rim Lighting functions
|
||||||
//
|
//
|
||||||
|
|||||||
@ -55,10 +55,10 @@ inline fixed3 calculateLightDiffuse(VertexOutput input, float3 normalWorld)
|
|||||||
float3 lightWorldDirection = normalize(_WorldSpaceLightPos0.xyz - input.posWorld.xyz * _WorldSpaceLightPos0.w);
|
float3 lightWorldDirection = normalize(_WorldSpaceLightPos0.xyz - input.posWorld.xyz * _WorldSpaceLightPos0.w);
|
||||||
|
|
||||||
float attenuation = LIGHT_ATTENUATION(input);
|
float attenuation = LIGHT_ATTENUATION(input);
|
||||||
float angleDot = dotClamped(normalWorld, lightWorldDirection);
|
float angleDot = max(0, dot(normalWorld, lightWorldDirection));
|
||||||
|
|
||||||
#if defined(_DIFFUSE_RAMP)
|
#if defined(_DIFFUSE_RAMP)
|
||||||
fixed3 lightDiffuse = calculateRampedDiffuse(_LightColor0.rgb, sqrt(attenuation), angleDot);
|
fixed3 lightDiffuse = calculateRampedDiffuse(_LightColor0.rgb, attenuation, angleDot);
|
||||||
#else
|
#else
|
||||||
fixed3 lightDiffuse = _LightColor0.rgb * (attenuation * angleDot);
|
fixed3 lightDiffuse = _LightColor0.rgb * (attenuation * angleDot);
|
||||||
#endif // _DIFFUSE_RAMP
|
#endif // _DIFFUSE_RAMP
|
||||||
@ -147,7 +147,7 @@ fixed4 fragBase(VertexOutput input) : SV_Target
|
|||||||
fixed3 diffuse = calculateLightDiffuse(input, normalWorld);
|
fixed3 diffuse = calculateLightDiffuse(input, normalWorld);
|
||||||
|
|
||||||
//Combine along with vertex lighting for the base lighting pass
|
//Combine along with vertex lighting for the base lighting pass
|
||||||
fixed3 lighting = saturate(ambient + diffuse + input.vertexLighting);
|
fixed3 lighting = ambient + diffuse + input.vertexLighting;
|
||||||
|
|
||||||
APPLY_EMISSION(lighting, input.texcoord)
|
APPLY_EMISSION(lighting, input.texcoord)
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ struct VertexLightInfo
|
|||||||
fixed3 lightColor;
|
fixed3 lightColor;
|
||||||
|
|
||||||
#if defined(_DIFFUSE_RAMP)
|
#if defined(_DIFFUSE_RAMP)
|
||||||
float attenuationSqrt;
|
float attenuation;
|
||||||
#endif // _DIFFUSE_RAMP
|
#endif // _DIFFUSE_RAMP
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ inline VertexLightInfo getVertexLightAttenuatedInfo(int index, float3 viewPos)
|
|||||||
{
|
{
|
||||||
VertexLightInfo lightInfo;
|
VertexLightInfo lightInfo;
|
||||||
|
|
||||||
//For directional lights _WorldSpaceLightPos0.w is set to zero
|
//For directional lights unity_LightPosition.w is set to zero
|
||||||
lightInfo.lightDirection = unity_LightPosition[index].xyz - viewPos.xyz * unity_LightPosition[index].w;
|
lightInfo.lightDirection = unity_LightPosition[index].xyz - viewPos.xyz * unity_LightPosition[index].w;
|
||||||
float lengthSq = dot(lightInfo.lightDirection, lightInfo.lightDirection);
|
float lengthSq = dot(lightInfo.lightDirection, lightInfo.lightDirection);
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ inline VertexLightInfo getVertexLightAttenuatedInfo(int index, float3 viewPos)
|
|||||||
//If using a diffuse ramp texture then need to pass through the lights attenuation, otherwise premultiply the light color with it
|
//If using a diffuse ramp texture then need to pass through the lights attenuation, otherwise premultiply the light color with it
|
||||||
#if defined(_DIFFUSE_RAMP)
|
#if defined(_DIFFUSE_RAMP)
|
||||||
lightInfo.lightColor = unity_LightColor[index].rgb;
|
lightInfo.lightColor = unity_LightColor[index].rgb;
|
||||||
lightInfo.attenuationSqrt = sqrt(attenuation);
|
lightInfo.attenuation = attenuation;
|
||||||
#else
|
#else
|
||||||
lightInfo.lightColor = unity_LightColor[index].rgb * attenuation;
|
lightInfo.lightColor = unity_LightColor[index].rgb * attenuation;
|
||||||
#endif // _DIFFUSE_RAMP
|
#endif // _DIFFUSE_RAMP
|
||||||
@ -205,25 +205,23 @@ fixed3 calculateAmbientLight(half3 normalWorld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Light Packing Functions (this stuff gets messy!)
|
// Light Packing Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(_DIFFUSE_RAMP)
|
#if defined(_DIFFUSE_RAMP)
|
||||||
|
|
||||||
inline fixed3 calculateLightDiffuse(fixed3 lightColor, half3 normal, half3 lightDirection, float attenuation)
|
inline fixed3 calculateLightDiffuse(fixed3 lightColor, half3 viewNormal, half3 lightViewDir, float attenuation)
|
||||||
{
|
{
|
||||||
float angleDot = max(0, dot(normal, lightDirection));
|
float angleDot = max(0, dot(viewNormal, lightViewDir));
|
||||||
fixed3 diffuse = calculateRampedDiffuse(lightColor, attenuation, angleDot);
|
return calculateRampedDiffuse(lightColor, attenuation, angleDot);
|
||||||
return diffuse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
inline fixed3 calculateLightDiffuse(fixed3 attenuatedLightColor, half3 normal, half3 lightDirection)
|
inline fixed3 calculateLightDiffuse(fixed3 attenuatedLightColor, half3 viewNormal, half3 lightViewDir)
|
||||||
{
|
{
|
||||||
float angleDot = max(0, dot(normal, lightDirection));
|
float angleDot = max(0, dot(viewNormal, lightViewDir));
|
||||||
fixed3 diffuse = attenuatedLightColor * angleDot;
|
return attenuatedLightColor * angleDot;
|
||||||
return diffuse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _NORMALMAP
|
#endif // _NORMALMAP
|
||||||
@ -231,16 +229,6 @@ inline fixed3 calculateLightDiffuse(fixed3 attenuatedLightColor, half3 normal, h
|
|||||||
|
|
||||||
#if defined(PER_PIXEL_LIGHTING)
|
#if defined(PER_PIXEL_LIGHTING)
|
||||||
|
|
||||||
inline VertexLightInfo getVertexLightAttenuatedInfoWorldSpace(int index, float3 viewPos)
|
|
||||||
{
|
|
||||||
VertexLightInfo lightInfo = getVertexLightAttenuatedInfo(index, viewPos);
|
|
||||||
|
|
||||||
//Convert light direction from view space to world space
|
|
||||||
lightInfo.lightDirection = normalize(mul((float3x3)UNITY_MATRIX_V, lightInfo.lightDirection));
|
|
||||||
|
|
||||||
return lightInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define VERTEX_LIGHT_0_DIR VertexLightInfo0.xyz
|
#define VERTEX_LIGHT_0_DIR VertexLightInfo0.xyz
|
||||||
#define VERTEX_LIGHT_0_R VertexLightInfo4.x
|
#define VERTEX_LIGHT_0_R VertexLightInfo4.x
|
||||||
#define VERTEX_LIGHT_0_G VertexLightInfo4.y
|
#define VERTEX_LIGHT_0_G VertexLightInfo4.y
|
||||||
@ -277,24 +265,24 @@ inline VertexLightInfo getVertexLightAttenuatedInfoWorldSpace(int index, float3
|
|||||||
|
|
||||||
#define PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo) \
|
#define PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo) \
|
||||||
{ \
|
{ \
|
||||||
output.LIGHT_DIFFUSE_ATTEN_##index = lightInfo.attenuationSqrt; \
|
output.LIGHT_DIFFUSE_ATTEN_##index = lightInfo.attenuation; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, vertexLightColor, normalDirection, vertexLightDir) \
|
#define ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, lightColor, viewNormal, lightViewDir) \
|
||||||
{ \
|
{ \
|
||||||
diffuse += calculateLightDiffuse(vertexLightColor, normalDirection, vertexLightDir, input.LIGHT_DIFFUSE_ATTEN_##index); \
|
diffuse += calculateLightDiffuse(lightColor, viewNormal, lightViewDir, input.LIGHT_DIFFUSE_ATTEN_##index); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo)
|
#define PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo)
|
||||||
#define ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, vertexLightColor, normalDirection, vertexLightDir) \
|
#define ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, lightColor, viewNormal, lightViewDir) \
|
||||||
{ \
|
{ \
|
||||||
diffuse += calculateLightDiffuse(vertexLightColor, normalDirection, vertexLightDir); \
|
diffuse += calculateLightDiffuse(lightColor, viewNormal, lightViewDir); \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PACK_VERTEX_LIGHT(index, output, viewPos) \
|
#define PACK_VERTEX_LIGHT(index, output, viewPos) \
|
||||||
{ \
|
{ \
|
||||||
VertexLightInfo lightInfo = getVertexLightAttenuatedInfoWorldSpace(index, viewPos); \
|
VertexLightInfo lightInfo = getVertexLightAttenuatedInfo(index, viewPos); \
|
||||||
output.VERTEX_LIGHT_##index##_DIR = lightInfo.lightDirection; \
|
output.VERTEX_LIGHT_##index##_DIR = lightInfo.lightDirection; \
|
||||||
output.VERTEX_LIGHT_##index##_R = lightInfo.lightColor.r; \
|
output.VERTEX_LIGHT_##index##_R = lightInfo.lightColor.r; \
|
||||||
output.VERTEX_LIGHT_##index##_G = lightInfo.lightColor.g; \
|
output.VERTEX_LIGHT_##index##_G = lightInfo.lightColor.g; \
|
||||||
@ -302,11 +290,11 @@ inline VertexLightInfo getVertexLightAttenuatedInfoWorldSpace(int index, float3
|
|||||||
PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo); \
|
PACK_VERTEX_LIGHT_DIFFUSE(index, output, lightInfo); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADD_VERTEX_LIGHT(index, input, normalDirection, diffuse) \
|
#define ADD_VERTEX_LIGHT(index, input, viewNormal, diffuse) \
|
||||||
{ \
|
{ \
|
||||||
half3 vertexLightDir = input.VERTEX_LIGHT_##index##_DIR; \
|
half3 lightViewDir = input.VERTEX_LIGHT_##index##_DIR; \
|
||||||
fixed3 vertexLightColor = fixed3(input.VERTEX_LIGHT_##index##_R, input.VERTEX_LIGHT_##index##_G, input.VERTEX_LIGHT_##index##_B); \
|
fixed3 lightColor = fixed3(input.VERTEX_LIGHT_##index##_R, input.VERTEX_LIGHT_##index##_G, input.VERTEX_LIGHT_##index##_B); \
|
||||||
ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, vertexLightColor, normalDirection, vertexLightDir) \
|
ADD_VERTEX_LIGHT_DIFFUSE(index, diffuse, input, lightColor, viewNormal, lightViewDir) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#else //!PER_PIXEL_LIGHTING
|
#else //!PER_PIXEL_LIGHTING
|
||||||
@ -318,8 +306,8 @@ inline VertexLightInfo getVertexLightAttenuatedInfoWorldSpace(int index, float3
|
|||||||
inline fixed3 calculateLightDiffuse(int index, float3 viewPos, half3 viewNormal)
|
inline fixed3 calculateLightDiffuse(int index, float3 viewPos, half3 viewNormal)
|
||||||
{
|
{
|
||||||
VertexLightInfo lightInfo = getVertexLightAttenuatedInfo(index, viewPos);
|
VertexLightInfo lightInfo = getVertexLightAttenuatedInfo(index, viewPos);
|
||||||
float diff = max (0, dot (viewNormal, lightInfo.lightDirection));
|
float angleDot = max(0, dot(viewNormal, lightInfo.lightDirection));
|
||||||
return lightInfo.lightColor * diff;
|
return lightInfo.lightColor * angleDot;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !PER_PIXEL_LIGHTING
|
#endif // !PER_PIXEL_LIGHTING
|
||||||
@ -405,10 +393,11 @@ fixed4 frag(VertexOutput input) : SV_Target
|
|||||||
fixed3 diffuse = fixed3(0,0,0);
|
fixed3 diffuse = fixed3(0,0,0);
|
||||||
|
|
||||||
//Add each vertex light to diffuse
|
//Add each vertex light to diffuse
|
||||||
ADD_VERTEX_LIGHT(0, input, normalWorld, diffuse)
|
half3 normalView = normalize(mul((float3x3)UNITY_MATRIX_V, normalWorld));
|
||||||
ADD_VERTEX_LIGHT(1, input, normalWorld, diffuse)
|
ADD_VERTEX_LIGHT(0, input, normalView, diffuse)
|
||||||
ADD_VERTEX_LIGHT(2, input, normalWorld, diffuse)
|
ADD_VERTEX_LIGHT(1, input, normalView, diffuse)
|
||||||
ADD_VERTEX_LIGHT(3, input, normalWorld, diffuse)
|
ADD_VERTEX_LIGHT(2, input, normalView, diffuse)
|
||||||
|
ADD_VERTEX_LIGHT(3, input, normalView, diffuse)
|
||||||
|
|
||||||
fixed3 lighting = ambient + diffuse;
|
fixed3 lighting = ambient + diffuse;
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Shader "Spine/Sprite/Pixel Lit"
|
|||||||
|
|
||||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||||
|
|
||||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||||
@ -36,7 +36,7 @@ Shader "Spine/Sprite/Pixel Lit"
|
|||||||
|
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" }
|
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" }
|
||||||
LOD 200
|
LOD 200
|
||||||
|
|
||||||
Pass
|
Pass
|
||||||
@ -64,7 +64,7 @@ Shader "Spine/Sprite/Pixel Lit"
|
|||||||
#pragma shader_feature _FOG
|
#pragma shader_feature _FOG
|
||||||
|
|
||||||
#pragma multi_compile_fwdbase
|
#pragma multi_compile_fwdbase
|
||||||
#pragma fragmentoption ARB_precision_hint_fastest
|
#pragma fragmentoption ARB_precision_hint_fastest
|
||||||
#pragma multi_compile_fog
|
#pragma multi_compile_fog
|
||||||
|
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
|
|||||||
@ -16,7 +16,7 @@ Shader "Spine/Sprite/Unlit"
|
|||||||
|
|
||||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||||
|
|
||||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||||
@ -25,7 +25,7 @@ Shader "Spine/Sprite/Unlit"
|
|||||||
|
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" }
|
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" }
|
||||||
LOD 100
|
LOD 100
|
||||||
|
|
||||||
Pass
|
Pass
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Shader "Spine/Sprite/Vertex Lit"
|
|||||||
|
|
||||||
_BlendTex ("Blend Texture", 2D) = "white" {}
|
_BlendTex ("Blend Texture", 2D) = "white" {}
|
||||||
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
_BlendAmount ("Blend", Range(0,1)) = 0.0
|
||||||
|
|
||||||
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
[HideInInspector] _SrcBlend ("__src", Float) = 1.0
|
||||||
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
[HideInInspector] _DstBlend ("__dst", Float) = 0.0
|
||||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||||
@ -36,7 +36,7 @@ Shader "Spine/Sprite/Vertex Lit"
|
|||||||
|
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
Tags { "Queue"="Transparent" "RenderType"="Sprite" }
|
Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" }
|
||||||
LOD 150
|
LOD 150
|
||||||
|
|
||||||
Pass
|
Pass
|
||||||
|
|||||||
@ -266,7 +266,9 @@ namespace Spine.Unity.Modules {
|
|||||||
[MenuItem ("CONTEXT/SkeletonRenderer/Add Skeleton Render Separator")]
|
[MenuItem ("CONTEXT/SkeletonRenderer/Add Skeleton Render Separator")]
|
||||||
static void AddRenderSeparatorComponent (MenuCommand cmd) {
|
static void AddRenderSeparatorComponent (MenuCommand cmd) {
|
||||||
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
var skeletonRenderer = cmd.context as SkeletonRenderer;
|
||||||
skeletonRenderer.gameObject.AddComponent<SkeletonRenderSeparator>();
|
var newComponent = skeletonRenderer.gameObject.AddComponent<SkeletonRenderSeparator>();
|
||||||
|
|
||||||
|
Undo.RegisterCreatedObjectUndo(newComponent, "Add SkeletonRenderSeparator");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
|
|||||||
@ -233,7 +233,6 @@ namespace Spine.Unity.Editor {
|
|||||||
menu.AddItem(new GUIContent(bones.Items[i].Data.Name), bones.Items[i].Data.Name == current, callback, bones.Items[i]);
|
menu.AddItem(new GUIContent(bones.Items[i].Data.Name), bones.Items[i].Data.Name == current, callback, bones.Items[i]);
|
||||||
|
|
||||||
menu.ShowAsContext();
|
menu.ShowAsContext();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetBoneSelected (object obj) {
|
void TargetBoneSelected (object obj) {
|
||||||
|
|||||||
@ -55,7 +55,6 @@ namespace Spine.Unity.Editor {
|
|||||||
GUIContent SpawnHierarchyButtonLabel = new GUIContent("Spawn Hierarchy", Icons.skeleton);
|
GUIContent SpawnHierarchyButtonLabel = new GUIContent("Spawn Hierarchy", Icons.skeleton);
|
||||||
GUIContent SlotsRootLabel = new GUIContent("Slots", Icons.slotRoot);
|
GUIContent SlotsRootLabel = new GUIContent("Slots", Icons.slotRoot);
|
||||||
static AnimBool showSlots = new AnimBool(false);
|
static AnimBool showSlots = new AnimBool(false);
|
||||||
static bool showPaths = true;
|
|
||||||
static bool debugSkeleton = false;
|
static bool debugSkeleton = false;
|
||||||
|
|
||||||
void OnEnable () {
|
void OnEnable () {
|
||||||
@ -102,10 +101,6 @@ namespace Spine.Unity.Editor {
|
|||||||
debugSkeleton = EditorGUILayout.Foldout(debugSkeleton, "Debug Skeleton");
|
debugSkeleton = EditorGUILayout.Foldout(debugSkeleton, "Debug Skeleton");
|
||||||
|
|
||||||
if (debugSkeleton) {
|
if (debugSkeleton) {
|
||||||
EditorGUI.BeginChangeCheck();
|
|
||||||
showPaths = EditorGUILayout.Toggle("Show Paths", showPaths);
|
|
||||||
requireRepaint |= EditorGUI.EndChangeCheck();
|
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
skeleton.FlipX = EditorGUILayout.ToggleLeft("skeleton.FlipX", skeleton.FlipX);
|
skeleton.FlipX = EditorGUILayout.ToggleLeft("skeleton.FlipX", skeleton.FlipX);
|
||||||
skeleton.FlipY = EditorGUILayout.ToggleLeft("skeleton.FlipY", skeleton.FlipY);
|
skeleton.FlipY = EditorGUILayout.ToggleLeft("skeleton.FlipY", skeleton.FlipY);
|
||||||
|
|||||||
@ -224,7 +224,7 @@ namespace Spine.Unity {
|
|||||||
var utilityBones = this.utilityBones;
|
var utilityBones = this.utilityBones;
|
||||||
for (int i = 0, n = utilityBones.Count; i < n; i++) {
|
for (int i = 0, n = utilityBones.Count; i < n; i++) {
|
||||||
var b = utilityBones[i];
|
var b = utilityBones[i];
|
||||||
if (b.bone == null) return;
|
if (b.bone == null) continue;
|
||||||
hasTransformBones |= (b.mode == SkeletonUtilityBone.Mode.Override);
|
hasTransformBones |= (b.mode == SkeletonUtilityBone.Mode.Override);
|
||||||
hasUtilityConstraints |= constraintTargets.Contains(b.bone);
|
hasUtilityConstraints |= constraintTargets.Contains(b.bone);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user