mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
Merge branch '3.6' into 3.7-beta
This commit is contained in:
commit
f38ffc75bf
@ -5,5 +5,5 @@
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-starling.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.1.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.4.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
spine-starling/spine-starling-example/lib/starling-2.4.swc
Normal file
BIN
spine-starling/spine-starling-example/lib/starling-2.4.swc
Normal file
Binary file not shown.
@ -4,5 +4,5 @@
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/airglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.1.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.4.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
Binary file not shown.
BIN
spine-starling/spine-starling/lib/starling-2.4.swc
Normal file
BIN
spine-starling/spine-starling/lib/starling-2.4.swc
Normal file
Binary file not shown.
@ -29,6 +29,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.starling {
|
||||
import starling.styles.MeshStyle;
|
||||
import spine.attachments.ClippingAttachment;
|
||||
import spine.SkeletonClipping;
|
||||
import spine.Bone;
|
||||
@ -98,6 +99,7 @@ package spine.starling {
|
||||
for (var i : int = 0, n : int = drawOrder.length; i < n; ++i) {
|
||||
var worldVertices : Vector.<Number> = _tempVertices;
|
||||
var slot : Slot = drawOrder[i];
|
||||
|
||||
if (slot.attachment is RegionAttachment) {
|
||||
var region : RegionAttachment = slot.attachment as RegionAttachment;
|
||||
verticesLength = 4 * 2;
|
||||
@ -146,7 +148,7 @@ package spine.starling {
|
||||
indexData.numIndices = indicesLength;
|
||||
indexData.trim();
|
||||
}
|
||||
indexData = mesh.getIndexData();
|
||||
indexData = mesh.getIndexData();
|
||||
attachmentColor = meshAttachment.color;
|
||||
uvs = meshAttachment.uvs;
|
||||
} else if (slot.attachment is ClippingAttachment) {
|
||||
@ -169,17 +171,22 @@ package spine.starling {
|
||||
if (clipper.isClipping()) {
|
||||
clipper.clipTriangles(worldVertices, indices, indices.length, uvs);
|
||||
|
||||
// Need to create a new mesh here, see https://github.com/EsotericSoftware/spine-runtimes/issues/1125
|
||||
mesh = new SkeletonMesh(mesh.texture);
|
||||
if (_twoColorTint) mesh.setStyle(new TwoColorMeshStyle());
|
||||
indexData = mesh.getIndexData();
|
||||
|
||||
verticesCount = clipper.clippedVertices.length >> 1;
|
||||
worldVertices = clipper.clippedVertices;
|
||||
uvs = clipper.clippedUvs;
|
||||
|
||||
indices = clipper.clippedTriangles;
|
||||
indicesLength = indices.length;
|
||||
indexData.numIndices = indicesLength;
|
||||
indexData.trim();
|
||||
for (ii = 0; ii < indicesLength; ii++) {
|
||||
indexData.setIndex(ii, indices[ii]);
|
||||
}
|
||||
indexData.numIndices = indicesLength;
|
||||
indexData.trim();
|
||||
}
|
||||
|
||||
vertexData = mesh.getVertexData();
|
||||
@ -214,8 +221,10 @@ package spine.starling {
|
||||
mesh.setTexCoords(ii, uvs[iii], uvs[iii + 1]);
|
||||
}
|
||||
}
|
||||
painter.state.blendMode = blendModes[slot.data.blendMode.ordinal];
|
||||
painter.batchMesh(mesh);
|
||||
if (indexData.numIndices > 0 && vertexData.numVertices > 0) {
|
||||
painter.state.blendMode = blendModes[slot.data.blendMode.ordinal];
|
||||
painter.batchMesh(mesh);
|
||||
}
|
||||
|
||||
clipper.clipEndWithSlot(slot);
|
||||
}
|
||||
|
||||
@ -682,6 +682,7 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
List<Spine.Event> currentAnimationEvents = new List<Spine.Event>();
|
||||
List<float> currentAnimationEventTimes = new List<float>();
|
||||
List<SpineEventTooltip> currentAnimationEventTooltips = new List<SpineEventTooltip>();
|
||||
|
||||
public bool IsValid { get { return skeletonAnimation != null && skeletonAnimation.valid; } }
|
||||
|
||||
@ -1071,7 +1072,7 @@ namespace Spine.Unity.Editor {
|
||||
int loopCount = (int)(t.TrackTime / t.TrackEnd);
|
||||
float currentTime = t.TrackTime - (t.TrackEnd * loopCount);
|
||||
float normalizedTime = currentTime / t.Animation.Duration;
|
||||
float wrappedTime = normalizedTime % 1;
|
||||
float wrappedTime = normalizedTime % 1f;
|
||||
|
||||
lineRect.x = barRect.x + (lineRectWidth * wrappedTime) - 0.5f;
|
||||
lineRect.width = 2;
|
||||
@ -1080,11 +1081,13 @@ namespace Spine.Unity.Editor {
|
||||
GUI.DrawTexture(lineRect, EditorGUIUtility.whiteTexture);
|
||||
GUI.color = Color.white;
|
||||
|
||||
currentAnimationEventTooltips = currentAnimationEventTooltips ?? new List<SpineEventTooltip>();
|
||||
currentAnimationEventTooltips.Clear();
|
||||
for (int i = 0; i < currentAnimationEvents.Count; i++) {
|
||||
float fr = currentAnimationEventTimes[i];
|
||||
float eventTime = currentAnimationEventTimes[i];
|
||||
var userEventIcon = Icons.userEvent;
|
||||
var evRect = new Rect(barRect) {
|
||||
x = Mathf.Clamp(((fr / t.Animation.Duration) * lineRectWidth) - (userEventIcon.width / 2), barRect.x, float.MaxValue),
|
||||
x = Mathf.Max(((eventTime / t.Animation.Duration) * lineRectWidth) - (userEventIcon.width / 2), barRect.x),
|
||||
y = barRect.y + userEventIcon.height,
|
||||
width = userEventIcon.width,
|
||||
height = userEventIcon.height
|
||||
@ -1094,16 +1097,29 @@ namespace Spine.Unity.Editor {
|
||||
Event ev = Event.current;
|
||||
if (ev.type == EventType.Repaint) {
|
||||
if (evRect.Contains(ev.mousePosition)) {
|
||||
GUIStyle tooltipStyle = EditorStyles.helpBox;
|
||||
Rect tooltipRect = new Rect(evRect);
|
||||
tooltipRect.width = tooltipStyle.CalcSize(new GUIContent(currentAnimationEvents[i].Data.Name)).x;
|
||||
string eventName = currentAnimationEvents[i].Data.Name;
|
||||
Rect tooltipRect = new Rect(evRect) {
|
||||
width = EditorStyles.helpBox.CalcSize(new GUIContent(eventName)).x
|
||||
};
|
||||
tooltipRect.y -= 4;
|
||||
tooltipRect.y -= tooltipRect.height * currentAnimationEventTooltips.Count; // Avoid several overlapping tooltips.
|
||||
tooltipRect.x += 4;
|
||||
GUI.Label(tooltipRect, currentAnimationEvents[i].Data.Name, tooltipStyle);
|
||||
GUI.tooltip = currentAnimationEvents[i].Data.Name;
|
||||
|
||||
// Handle tooltip overflowing to the right.
|
||||
float rightEdgeOverflow = (tooltipRect.x + tooltipRect.width) - (barRect.x + barRect.width);
|
||||
if (rightEdgeOverflow > 0)
|
||||
tooltipRect.x -= rightEdgeOverflow;
|
||||
|
||||
currentAnimationEventTooltips.Add(new SpineEventTooltip { rect = tooltipRect, text = eventName });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw tooltips.
|
||||
for (int i = 0; i < currentAnimationEventTooltips.Count; i++) {
|
||||
GUI.Label(currentAnimationEventTooltips[i].rect, currentAnimationEventTooltips[i].text, EditorStyles.helpBox);
|
||||
GUI.tooltip = currentAnimationEventTooltips[i].text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1130,7 +1146,11 @@ namespace Spine.Unity.Editor {
|
||||
previewGameObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal struct SpineEventTooltip {
|
||||
public Rect rect;
|
||||
public string text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user