Merge branch '3.7-beta' into 3.7-beta-cpp

This commit is contained in:
badlogic 2018-12-13 18:13:27 +01:00
commit b7bfb28407
129 changed files with 1890 additions and 158 deletions

View File

@ -169,6 +169,8 @@ package spine {
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (data.transformMode == TransformMode.noScale
&& (pa * pd - pb * pc < 0) != (sx < 0 != sy < 0)) s = -s;
var r : Number = Math.PI / 2 + Math.atan2(zc, za);
var zb : Number = Math.cos(r) * s;
var zd : Number = Math.sin(r) * s;

View File

@ -228,13 +228,13 @@ package spine {
}
var scaleX : Number = bone.ascaleX, scaleY : Number = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001) scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001) scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
var shearY : Number = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -263,13 +263,13 @@ package spine {
}
var scaleX : Number = bone.ascaleX, scaleY : Number = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001) scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001) scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
var shearY : Number = bone.ashearY;
if (shearMix > 0) shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
if (shearMix != 0) shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

View File

@ -154,6 +154,8 @@ void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rota
za *= s;
zc *= s;
s = SQRT(za * za + zc * zc);
if (self->data->transformMode == SP_TRANSFORMMODE_NOSCALE && (pa * pd - pb * pc < 0) != (sx < 0 != sy < 0))
s = -s;
r = PI / 2 + ATAN2(zc, za);
zb = COS(r) * s;
zd = SIN(r) * s;

View File

@ -205,13 +205,13 @@ void _spTransformConstraint_applyAbsoluteLocal (spTransformConstraint* self) {
}
scaleX = bone->ascaleX, scaleY = bone->ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001) scaleX = (scaleX + (target->ascaleX - scaleX + self->data->offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001) scaleY = (scaleY + (target->ascaleY - scaleY + self->data->offsetScaleY) * scaleMix) / scaleY;
}
shearY = bone->ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
r = target->ashearY - shearY + self->data->offsetShearY;
r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
bone->shearY += r * shearMix;
@ -245,13 +245,13 @@ void _spTransformConstraint_applyRelativeLocal (spTransformConstraint* self) {
scaleX = bone->ascaleX;
scaleY = bone->ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001f) scaleX *= ((target->ascaleX - 1 + self->data->offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001f) scaleY *= ((target->ascaleY - 1 + self->data->offsetScaleY) * scaleMix) + 1;
}
shearY = bone->ashearY;
if (shearMix > 0) shearY += (target->ashearY + self->data->offsetShearY) * shearMix;
if (shearMix != 0) shearY += (target->ashearY + self->data->offsetShearY) * shearMix;
spBone_updateWorldTransformWith(bone, x, y, rotation, scaleX, scaleY, bone->ashearX, shearY);
}

View File

@ -183,6 +183,9 @@ Bone::updateWorldTransform(float x, float y, float rotation, float scaleX, float
za *= s;
zc *= s;
s = MathUtil::sqrt(za * za + zc * zc);
if (_data.getTransformMode() == TransformMode_NoScale
&& (pa * pd - pb * pc < 0) != (_skeleton.getScaleX() < 0 != _skeleton.getScaleY() < 0))
s = -s;
r = MathUtil::Pi / 2 + MathUtil::atan2(zc, za);
zb = MathUtil::cos(r) * s;
zd = MathUtil::sin(r) * s;

View File

@ -315,7 +315,7 @@ void TransformConstraint::applyAbsoluteLocal() {
}
float scaleX = bone._ascaleX, scaleY = bone._ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001f) {
scaleX = (scaleX + (target._ascaleX - scaleX + _data._offsetScaleX) * scaleMix) / scaleX;
}
@ -326,7 +326,7 @@ void TransformConstraint::applyAbsoluteLocal() {
}
float shearY = bone._ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
float r = target._ashearY - shearY + _data._offsetShearY;
r -= (16384 - (int) (16384.499999999996 - r / 360)) * 360;
bone._shearY += r * shearMix;
@ -363,7 +363,7 @@ void TransformConstraint::applyRelativeLocal() {
}
float scaleX = bone._ascaleX, scaleY = bone._ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001f) {
scaleX *= ((target._ascaleX - 1 + _data._offsetScaleX) * scaleMix) + 1;
}
@ -374,7 +374,7 @@ void TransformConstraint::applyRelativeLocal() {
}
float shearY = bone._ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
shearY += (target._ashearY + _data._offsetShearY) * shearMix;
}

View File

@ -217,6 +217,9 @@ namespace Spine {
za *= s;
zc *= s;
s = (float)Math.Sqrt(za * za + zc * zc);
if (data.transformMode == TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (skeleton.scaleX < 0 != skeleton.scaleY < 0)) s = -s;
float r = MathUtils.PI / 2 + MathUtils.Atan2(zc, za);
float zb = MathUtils.Cos(r) * s;
float zd = MathUtils.Sin(r) * s;

View File

@ -152,7 +152,6 @@ namespace Spine {
child.UpdateWorldTransform ();
return;
}
//float px = parent.x, py = parent.y, psx = parent.scaleX, psy = parent.scaleY, csx = child.scaleX;
if (!parent.appliedValid) parent.UpdateAppliedTransform();
if (!child.appliedValid) child.UpdateAppliedTransform();
float px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;

View File

@ -81,8 +81,7 @@ namespace Spine {
if (!translate && !rotate) return;
PathConstraintData data = this.data;
SpacingMode spacingMode = data.spacingMode;
bool percentSpacing = spacingMode == SpacingMode.Percent;
bool percentSpacing = data.spacingMode == SpacingMode.Percent;
RotateMode rotateMode = data.rotateMode;
bool tangents = rotateMode == RotateMode.Tangent, scale = rotateMode == RotateMode.ChainScale;
int boneCount = this.bones.Count, spacesCount = tangents ? boneCount : boneCount + 1;
@ -158,9 +157,8 @@ namespace Spine {
float length = bone.data.length;
boneX += (length * (cos * a - sin * c) - dx) * rotateMix;
boneY += (length * (sin * a + cos * c) - dy) * rotateMix;
} else {
} else
r += offsetRotation;
}
if (r > MathUtils.PI)
r -= MathUtils.PI2;
else if (r < -MathUtils.PI) //
@ -185,8 +183,8 @@ namespace Spine {
float[] spacesItems = this.spaces.Items, output = this.positions.Resize(spacesCount * 3 + 2).Items, world;
bool closed = path.Closed;
int verticesLength = path.WorldVerticesLength, curveCount = verticesLength / 6, prevCurve = NONE;
float pathLength = 0;
float pathLength;
if (!path.ConstantSpeed) {
float[] lengths = path.Lengths;
curveCount -= closed ? 1 : 2;

View File

@ -122,18 +122,18 @@ namespace Spine {
/// <summary>Caches information about bones and constraints. Must be called if bones, constraints or weighted path attachments are added
/// or removed.</summary>
public void UpdateCache () {
ExposedList<IUpdatable> updateCache = this.updateCache;
var updateCache = this.updateCache;
updateCache.Clear();
this.updateCacheReset.Clear();
ExposedList<Bone> bones = this.bones;
var bones = this.bones;
for (int i = 0, n = bones.Count; i < n; i++)
bones.Items[i].sorted = false;
ExposedList<IkConstraint> ikConstraints = this.ikConstraints;
var ikConstraints = this.ikConstraints;
var transformConstraints = this.transformConstraints;
var pathConstraints = this.pathConstraints;
int ikCount = IkConstraints.Count, transformCount = transformConstraints.Count, pathCount = pathConstraints.Count;
int ikCount = ikConstraints.Count, transformCount = transformConstraints.Count, pathCount = pathConstraints.Count;
int constraintCount = ikCount + transformCount + pathCount;
//outer:
for (int i = 0; i < constraintCount; i++) {
@ -293,6 +293,54 @@ namespace Spine {
updateItems[i].Update();
}
/// <summary>
/// Updates the world transform for each bone and applies all constraints. The root bone will be temporarily parented to the specified bone.
/// </summary>
public void UpdateWorldTransform (Bone parent) {
// This partial update avoids computing the world transform for constrained bones when 1) the bone is not updated
// before the constraint, 2) the constraint only needs to access the applied local transform, and 3) the constraint calls
// updateWorldTransform.
var updateCacheReset = this.updateCacheReset;
var updateCacheResetItems = updateCacheReset.Items;
for (int i = 0, n = updateCacheReset.Count; i < n; i++) {
Bone bone = updateCacheResetItems[i];
bone.ax = bone.x;
bone.ay = bone.y;
bone.arotation = bone.rotation;
bone.ascaleX = bone.scaleX;
bone.ascaleY = bone.scaleY;
bone.ashearX = bone.shearX;
bone.ashearY = bone.shearY;
bone.appliedValid = true;
}
// Apply the parent bone transform to the root bone. The root bone
// always inherits scale, rotation and reflection.
Bone rootBone = this.RootBone;
float pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
rootBone.worldX = pa * x + pb * y + parent.worldX;
rootBone.worldY = pc * x + pd * y + parent.worldY;
float rotationY = rootBone.rotation + 90 + rootBone.shearY;
float la = MathUtils.CosDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX;
float lb = MathUtils.CosDeg(rotationY) * rootBone.scaleY;
float lc = MathUtils.SinDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX;
float ld = MathUtils.SinDeg(rotationY) * rootBone.scaleY;
rootBone.a = (pa * la + pb * lc) * scaleX;
rootBone.b = (pa * lb + pb * ld) * scaleX;
rootBone.c = (pc * la + pd * lc) * scaleY;
rootBone.d = (pc * lb + pd * ld) * scaleY;
// Update everything except root bone.
var updateCache = this.updateCache;
var updateCacheItems = updateCache.Items;
for (int i = 0, n = updateCache.Count; i < n; i++) {
var updatable = updateCacheItems[i];
if (updatable != rootBone)
updatable.Update();
}
}
/// <summary>Sets the bones, constraints, and slots to their setup pose values.</summary>
public void SetToSetupPose () {
SetBonesToSetupPose();
@ -425,11 +473,13 @@ namespace Spine {
skin = newSkin;
}
/// <summary>Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment name.</summary>
/// <returns>May be null.</returns>
public Attachment GetAttachment (string slotName, string attachmentName) {
return GetAttachment(data.FindSlotIndex(slotName), attachmentName);
}
/// <summary>Finds an attachment by looking in the skin and skeletonData.defaultSkin using the slot index and attachment name.First the skin is checked and if the attachment was not found, the default skin is checked.</summary>
/// <returns>May be null.</returns>
public Attachment GetAttachment (int slotIndex, string attachmentName) {
if (attachmentName == null) throw new ArgumentNullException("attachmentName", "attachmentName cannot be null.");
@ -440,6 +490,7 @@ namespace Spine {
return data.defaultSkin != null ? data.defaultSkin.GetAttachment(slotIndex, attachmentName) : null;
}
/// <summary>A convenience method to set an attachment by finding the slot with FindSlot, finding the attachment with GetAttachment, then setting the slot's slot.Attachment.</summary>
/// <param name="attachmentName">May be null.</param>
public void SetAttachment (string slotName, string attachmentName) {
if (slotName == null) throw new ArgumentNullException("slotName", "slotName cannot be null.");

View File

@ -58,7 +58,7 @@ namespace Spine {
bones = new ExposedList<Bone>();
foreach (BoneData boneData in data.bones)
bones.Add (skeleton.FindBone (boneData.name));
target = skeleton.FindBone(data.target.name);
}
@ -230,13 +230,13 @@ namespace Spine {
}
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001f) scaleX = (scaleX + (target.ascaleX - scaleX + data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001f) scaleY = (scaleY + (target.ascaleY - scaleY + data.offsetScaleY) * scaleMix) / scaleY;
}
float shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
float r = target.ashearY - shearY + data.offsetShearY;
r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
bone.shearY += r * shearMix;
@ -265,13 +265,13 @@ namespace Spine {
}
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001f) scaleX *= ((target.ascaleX - 1 + data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001f) scaleY *= ((target.ascaleY - 1 + data.offsetScaleY) * scaleMix) + 1;
}
float shearY = bone.ashearY;
if (shearMix > 0) shearY += (target.ashearY + data.offsetShearY) * shearMix;
if (shearMix != 0) shearY += (target.ashearY + data.offsetShearY) * shearMix;
bone.UpdateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

View File

@ -37,6 +37,8 @@ import com.badlogic.gdx.math.Matrix3;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.spine.BoneData.TransformMode;
/** Stores a bone's current pose.
* <p>
* A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a
@ -180,6 +182,8 @@ public class Bone implements Updatable {
za *= s;
zc *= s;
s = (float)Math.sqrt(za * za + zc * zc);
if (data.transformMode == TransformMode.noScale
&& (pa * pd - pb * pc < 0) != (skeleton.scaleX < 0 != skeleton.scaleY < 0)) s = -s;
float r = PI / 2 + atan2(zc, za);
float zb = cos(r) * s;
float zd = sin(r) * s;

View File

@ -242,16 +242,16 @@ public class TransformConstraint implements Constraint {
}
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX != 0) scaleX = (scaleX + (target.ascaleX - scaleX + data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY != 0) scaleY = (scaleY + (target.ascaleY - scaleY + data.offsetScaleY) * scaleMix) / scaleY;
}
float shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
float r = target.ashearY - shearY + data.offsetShearY;
r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
bone.shearY += r * shearMix;
shearY += r * shearMix;
}
bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
@ -277,13 +277,13 @@ public class TransformConstraint implements Constraint {
}
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
scaleX *= ((target.ascaleX - 1 + data.offsetScaleX) * scaleMix) + 1;
scaleY *= ((target.ascaleY - 1 + data.offsetScaleY) * scaleMix) + 1;
}
float shearY = bone.ashearY;
if (shearMix > 0) shearY += (target.ashearY + data.offsetShearY) * shearMix;
if (shearMix != 0) shearY += (target.ashearY + data.offsetShearY) * shearMix;
bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

View File

@ -172,6 +172,9 @@ function Bone:updateWorldTransformWith (x, y, rotation, scaleX, scaleY, shearX,
za = za * s
zc = zc * s
s = math_sqrt(za * za + zc * zc)
if transformMode == TransformMode.noScale and pa * pd - pb * pc < 0 ~= (sx < 0) ~= (sy < 0) then
s = -s
end
local r = math_pi / 2 + math_atan2(zc, za)
local zb = math_cos(r) * s
local zd = math_sin(r) * s

View File

@ -281,7 +281,7 @@ function TransformConstraint:applyAbsoluteLocal ()
local scaleX = bone.ascaleX
local scaleY = bone.ascaleY
if scaleMix > 0 then
if scaleMix ~= 0 then
if scaleX > 0.00001 then
scaleX = (scaleX + (target.ascaleX - scaleX + self.data.offsetScaleX) * scaleMix) / scaleX
end
@ -291,7 +291,7 @@ function TransformConstraint:applyAbsoluteLocal ()
end
local shearY = bone.ashearY
if shearMix > 0 then
if shearMix ~= 0 then
local r = target.ashearY - shearY + self.data.offsetShearY
r = r - (16384 - math_floor(16384.499999999996 - r / 360)) * 360
bone.shearY = bone.shearY + r * shearMix
@ -324,7 +324,7 @@ function TransformConstraint:applyRelativeLocal ()
local scaleX = bone.ascaleX
local scaleY = bone.ascaleY
if scaleMix > 0 then
if scaleMix ~= 0 then
if scaleX > 0.00001 then
scaleX = scaleX * (((target.ascaleX - 1 + self.data.offsetScaleX) * scaleMix) + 1)
end
@ -334,7 +334,7 @@ function TransformConstraint:applyRelativeLocal ()
end
local shearY = bone.ashearY
if shearMix > 0 then shearY = shearY + (target.ashearY + self.data.offsetShearY) * shearMix end
if shearMix ~= 0 then shearY = shearY + (target.ashearY + self.data.offsetShearY) * shearMix end
bone:updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY)
end

View File

@ -1788,6 +1788,7 @@ declare module spine {
atlasUrl: string;
animation: string;
animations: string[];
defaultMix: number;
skin: string;
skins: string[];
controlBones: string[];
@ -1862,6 +1863,7 @@ declare module spine {
validateConfig(config: SpinePlayerConfig): SpinePlayerConfig;
showError(error: string): void;
render(): HTMLElement;
private lastPopup;
showSpeedDialog(speedButton: HTMLElement): void;
showAnimationsDialog(animationsButton: HTMLElement): void;
showSkinsDialog(skinButton: HTMLElement): void;

View File

@ -2489,6 +2489,9 @@ var spine;
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.data.transformMode == spine.TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
var r = Math.PI / 2 + Math.atan2(zc, za);
var zb = Math.cos(r) * s;
var zd = Math.sin(r) * s;
@ -5731,14 +5734,14 @@ var spine;
y += (target.ay - y + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001)
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
var shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
var r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -5765,14 +5768,14 @@ var spine;
y += (target.ay + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001)
scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
var shearY = bone.ashearY;
if (shearMix > 0)
if (shearMix != 0)
shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}
@ -10117,7 +10120,7 @@ var spine;
return;
}
if (!isContained(_this.dom, event.target)) {
_this.dom.parentNode.removeChild(_this.dom);
_this.dom.remove();
window.removeEventListener("click", windowClickListener);
dismissedListener();
dismissed = true;
@ -10291,6 +10294,8 @@ var spine;
config.controlBones = [];
if (typeof config.showControls === "undefined")
config.showControls = true;
if (typeof config.defaultMix === "undefined")
config.defaultMix = 0.25;
return config;
};
SpinePlayer.prototype.showError = function (error) {
@ -10413,6 +10418,13 @@ var spine;
};
SpinePlayer.prototype.showSpeedDialog = function (speedButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Speed") {
this.lastPopup = null;
speedButton.classList.remove("spine-player-button-icon-speed-selected");
return;
}
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Speed</div>\n\t\t\t\t<hr>\n\t\t\t\t<div class=\"spine-player-row\" style=\"user-select: none; align-items: center; padding: 8px;\">\n\t\t\t\t\t<div class=\"spine-player-column\">\n\t\t\t\t\t\t<div class=\"spine-player-speed-slider\" style=\"margin-bottom: 4px;\"></div>\n\t\t\t\t\t\t<div class=\"spine-player-row\" style=\"justify-content: space-between;\">\n\t\t\t\t\t\t\t<div>0.1x</div>\n\t\t\t\t\t\t\t<div>1x</div>\n\t\t\t\t\t\t\t<div>2x</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t");
var sliderParent = findWithClass(popup.dom, "spine-player-speed-slider")[0];
var slider = new Slider(2, 0.1, true);
@ -10425,9 +10437,17 @@ var spine;
popup.show(function () {
speedButton.classList.remove("spine-player-button-icon-speed-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.showAnimationsDialog = function (animationsButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Animations") {
this.lastPopup = null;
animationsButton.classList.remove("spine-player-button-icon-animations-selected");
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Animations</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
@ -10453,9 +10473,17 @@ var spine;
popup.show(function () {
animationsButton.classList.remove("spine-player-button-icon-animations-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.showSkinsDialog = function (skinButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Skins") {
this.lastPopup = null;
skinButton.classList.remove("spine-player-button-icon-skins-selected");
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Skins</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
@ -10481,9 +10509,17 @@ var spine;
popup.show(function () {
skinButton.classList.remove("spine-player-button-icon-skins-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.showSettingsDialog = function (settingsButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Debug") {
this.lastPopup = null;
settingsButton.classList.remove("spine-player-button-icon-settings-selected");
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Debug</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\">\n\t\t\t\t</li>\n\t\t\t");
@ -10510,6 +10546,7 @@ var spine;
popup.show(function () {
settingsButton.classList.remove("spine-player-button-icon-settings-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.drawFrame = function (requestNextFrame) {
var _this = this;
@ -10639,7 +10676,7 @@ var spine;
}
this.skeleton = new spine.Skeleton(skeletonData);
var stateData = new spine.AnimationStateData(skeletonData);
stateData.defaultMix = 0.2;
stateData.defaultMix = this.config.defaultMix;
this.animationState = new spine.AnimationState(stateData);
if (this.config.controlBones) {
this.config.controlBones.forEach(function (bone) {

File diff suppressed because one or more lines are too long

View File

@ -2489,6 +2489,9 @@ var spine;
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.data.transformMode == spine.TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
var r = Math.PI / 2 + Math.atan2(zc, za);
var zb = Math.cos(r) * s;
var zd = Math.sin(r) * s;
@ -5731,14 +5734,14 @@ var spine;
y += (target.ay - y + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001)
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
var shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
var r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -5765,14 +5768,14 @@ var spine;
y += (target.ay + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001)
scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
var shearY = bone.ashearY;
if (shearMix > 0)
if (shearMix != 0)
shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

File diff suppressed because one or more lines are too long

View File

@ -2489,6 +2489,9 @@ var spine;
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.data.transformMode == spine.TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
var r = Math.PI / 2 + Math.atan2(zc, za);
var zb = Math.cos(r) * s;
var zd = Math.sin(r) * s;
@ -5731,14 +5734,14 @@ var spine;
y += (target.ay - y + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001)
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
var shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
var r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -5765,14 +5768,14 @@ var spine;
y += (target.ay + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001)
scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
var shearY = bone.ashearY;
if (shearMix > 0)
if (shearMix != 0)
shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

File diff suppressed because one or more lines are too long

View File

@ -2489,6 +2489,9 @@ var spine;
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.data.transformMode == spine.TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
var r = Math.PI / 2 + Math.atan2(zc, za);
var zb = Math.cos(r) * s;
var zd = Math.sin(r) * s;
@ -5731,14 +5734,14 @@ var spine;
y += (target.ay - y + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001)
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
var shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
var r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -5765,14 +5768,14 @@ var spine;
y += (target.ay + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001)
scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
var shearY = bone.ashearY;
if (shearMix > 0)
if (shearMix != 0)
shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

File diff suppressed because one or more lines are too long

View File

@ -2489,6 +2489,9 @@ var spine;
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.data.transformMode == spine.TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
var r = Math.PI / 2 + Math.atan2(zc, za);
var zb = Math.cos(r) * s;
var zd = Math.sin(r) * s;
@ -5731,14 +5734,14 @@ var spine;
y += (target.ay - y + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001)
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
var shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
var r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -5765,14 +5768,14 @@ var spine;
y += (target.ay + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001)
scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
var shearY = bone.ashearY;
if (shearMix > 0)
if (shearMix != 0)
shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

File diff suppressed because one or more lines are too long

View File

@ -1698,6 +1698,7 @@ declare module spine {
atlasUrl: string;
animation: string;
animations: string[];
defaultMix: number;
skin: string;
skins: string[];
controlBones: string[];
@ -1772,6 +1773,7 @@ declare module spine {
validateConfig(config: SpinePlayerConfig): SpinePlayerConfig;
showError(error: string): void;
render(): HTMLElement;
private lastPopup;
showSpeedDialog(speedButton: HTMLElement): void;
showAnimationsDialog(animationsButton: HTMLElement): void;
showSkinsDialog(skinButton: HTMLElement): void;

View File

@ -2489,6 +2489,9 @@ var spine;
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.data.transformMode == spine.TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
var r = Math.PI / 2 + Math.atan2(zc, za);
var zb = Math.cos(r) * s;
var zd = Math.sin(r) * s;
@ -5731,14 +5734,14 @@ var spine;
y += (target.ay - y + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001)
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
var shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
var r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -5765,14 +5768,14 @@ var spine;
y += (target.ay + this.data.offsetY) * translateMix;
}
var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001)
scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001)
scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
var shearY = bone.ashearY;
if (shearMix > 0)
if (shearMix != 0)
shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}
@ -9454,7 +9457,7 @@ var spine;
return;
}
if (!isContained(_this.dom, event.target)) {
_this.dom.parentNode.removeChild(_this.dom);
_this.dom.remove();
window.removeEventListener("click", windowClickListener);
dismissedListener();
dismissed = true;
@ -9628,6 +9631,8 @@ var spine;
config.controlBones = [];
if (typeof config.showControls === "undefined")
config.showControls = true;
if (typeof config.defaultMix === "undefined")
config.defaultMix = 0.25;
return config;
};
SpinePlayer.prototype.showError = function (error) {
@ -9750,6 +9755,13 @@ var spine;
};
SpinePlayer.prototype.showSpeedDialog = function (speedButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Speed") {
this.lastPopup = null;
speedButton.classList.remove("spine-player-button-icon-speed-selected");
return;
}
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Speed</div>\n\t\t\t\t<hr>\n\t\t\t\t<div class=\"spine-player-row\" style=\"user-select: none; align-items: center; padding: 8px;\">\n\t\t\t\t\t<div class=\"spine-player-column\">\n\t\t\t\t\t\t<div class=\"spine-player-speed-slider\" style=\"margin-bottom: 4px;\"></div>\n\t\t\t\t\t\t<div class=\"spine-player-row\" style=\"justify-content: space-between;\">\n\t\t\t\t\t\t\t<div>0.1x</div>\n\t\t\t\t\t\t\t<div>1x</div>\n\t\t\t\t\t\t\t<div>2x</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t");
var sliderParent = findWithClass(popup.dom, "spine-player-speed-slider")[0];
var slider = new Slider(2, 0.1, true);
@ -9762,9 +9774,17 @@ var spine;
popup.show(function () {
speedButton.classList.remove("spine-player-button-icon-speed-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.showAnimationsDialog = function (animationsButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Animations") {
this.lastPopup = null;
animationsButton.classList.remove("spine-player-button-icon-animations-selected");
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Animations</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
@ -9790,9 +9810,17 @@ var spine;
popup.show(function () {
animationsButton.classList.remove("spine-player-button-icon-animations-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.showSkinsDialog = function (skinButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Skins") {
this.lastPopup = null;
skinButton.classList.remove("spine-player-button-icon-skins-selected");
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Skins</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
@ -9818,9 +9846,17 @@ var spine;
popup.show(function () {
skinButton.classList.remove("spine-player-button-icon-skins-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.showSettingsDialog = function (settingsButton) {
var _this = this;
if (this.lastPopup)
this.lastPopup.dom.remove();
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Debug") {
this.lastPopup = null;
settingsButton.classList.remove("spine-player-button-icon-settings-selected");
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Debug</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\">\n\t\t\t\t</li>\n\t\t\t");
@ -9847,6 +9883,7 @@ var spine;
popup.show(function () {
settingsButton.classList.remove("spine-player-button-icon-settings-selected");
});
this.lastPopup = popup;
};
SpinePlayer.prototype.drawFrame = function (requestNextFrame) {
var _this = this;
@ -9976,7 +10013,7 @@ var spine;
}
this.skeleton = new spine.Skeleton(skeletonData);
var stateData = new spine.AnimationStateData(skeletonData);
stateData.defaultMix = 0.2;
stateData.defaultMix = this.config.defaultMix;
this.animationState = new spine.AnimationState(stateData);
if (this.config.controlBones) {
this.config.controlBones.forEach(function (bone) {

File diff suppressed because one or more lines are too long

View File

@ -150,6 +150,8 @@ module spine {
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.data.transformMode == TransformMode.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
let r = Math.PI / 2 + Math.atan2(zc, za);
let zb = Math.cos(r) * s;
let zd = Math.sin(r) * s;

View File

@ -222,13 +222,13 @@ module spine {
}
let scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001) scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
if (scaleY > 0.00001) scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
}
let shearY = bone.ashearY;
if (shearMix > 0) {
if (shearMix != 0) {
let r = target.ashearY - shearY + this.data.offsetShearY;
r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
bone.shearY += r * shearMix;
@ -257,13 +257,13 @@ module spine {
}
let scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix > 0) {
if (scaleMix != 0) {
if (scaleX > 0.00001) scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
if (scaleY > 0.00001) scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
}
let shearY = bone.ashearY;
if (shearMix > 0) shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
if (shearMix != 0) shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}

View File

@ -53,6 +53,9 @@
/* Optional: list of animation names from which the user can choose. */
animations: string[]
/* Optional: the default mix time used to switch between two animations. */
defaultMix: number
/* Optional: the name of the skin to be set. Default: the default skin. */
skin: string
@ -158,7 +161,7 @@
return;
}
if (!isContained(this.dom, event.target)) {
this.dom.parentNode.removeChild(this.dom);
this.dom.remove();
window.removeEventListener("click", windowClickListener);
dismissedListener();
dismissed = true;
@ -354,6 +357,9 @@
if (typeof config.showControls === "undefined")
config.showControls = true;
if (typeof config.defaultMix === "undefined")
config.defaultMix = 0.25;
return config;
}
@ -507,7 +513,14 @@
return dom;
}
private lastPopup: Popup;
showSpeedDialog (speedButton: HTMLElement) {
if (this.lastPopup) this.lastPopup.dom.remove()
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Speed") {
this.lastPopup = null;
speedButton.classList.remove("spine-player-button-icon-speed-selected")
return;
}
let popup = new Popup(this.dom, this.playerControls, /*html*/`
<div class="spine-player-popup-title">Speed</div>
<hr>
@ -533,9 +546,16 @@
popup.show(() => {
speedButton.classList.remove("spine-player-button-icon-speed-selected")
});
this.lastPopup = popup;
}
showAnimationsDialog (animationsButton: HTMLElement) {
if (this.lastPopup) this.lastPopup.dom.remove()
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Animations") {
this.lastPopup = null;
animationsButton.classList.remove("spine-player-button-icon-animations-selected")
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0) return;
let popup = new Popup(this.dom, this.playerControls, /*html*/`
@ -574,9 +594,16 @@
popup.show(() => {
animationsButton.classList.remove("spine-player-button-icon-animations-selected")
});
this.lastPopup = popup;
}
showSkinsDialog (skinButton: HTMLElement) {
if (this.lastPopup) this.lastPopup.dom.remove()
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Skins") {
this.lastPopup = null;
skinButton.classList.remove("spine-player-button-icon-skins-selected")
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0) return;
let popup = new Popup(this.dom, this.playerControls, /*html*/`
@ -616,9 +643,16 @@
popup.show(() => {
skinButton.classList.remove("spine-player-button-icon-skins-selected")
});
this.lastPopup = popup;
}
showSettingsDialog (settingsButton: HTMLElement) {
if (this.lastPopup) this.lastPopup.dom.remove()
if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Debug") {
this.lastPopup = null;
settingsButton.classList.remove("spine-player-button-icon-settings-selected")
return;
}
if (!this.skeleton || this.skeleton.data.animations.length == 0) return;
let popup = new Popup(this.dom, this.playerControls, /*html*/`
@ -653,6 +687,7 @@
popup.show(() => {
settingsButton.classList.remove("spine-player-button-icon-settings-selected")
});
this.lastPopup = popup;
}
drawFrame (requestNextFrame = true) {
@ -808,7 +843,7 @@
}
this.skeleton = new Skeleton(skeletonData);
let stateData = new AnimationStateData(skeletonData);
stateData.defaultMix = 0.2;
stateData.defaultMix = this.config.defaultMix;
this.animationState = new AnimationState(stateData);
// Check if all controllable bones are in the skeleton

View File

@ -372,7 +372,6 @@ MonoBehaviour:
singleSubmesh: 0
addNormals: 0
calculateTangents: 0
logErrors: 0
disableRenderingOnOverride: 1
_animationName: idle
loop: 1

View File

@ -17,6 +17,15 @@ namespace Spine.Unity.Examples {
public bool useOverrideMixDuration;
public float overrideMixDuration = 0.2f;
public bool useOverrideAttachmentThreshold = true;
[Range(0f,1f)]
public float attachmentThreshold = 0.5f;
public bool useOverrideDrawOrderThreshold;
[Range(0f, 1f)]
public float drawOrderThreshold = 0.5f;
[System.Serializable]
public struct AnimationControl {
[SpineAnimation]
@ -94,14 +103,24 @@ namespace Spine.Unity.Examples {
// Check each control, and play the appropriate animation.
if (Input.GetKeyDown(control.key)) {
TrackEntry trackEntry;
if (!string.IsNullOrEmpty(control.animationName)) {
var trackEntry = animationState.SetAnimation(trackIndex, control.animationName, control.loop);
trackEntry = animationState.SetAnimation(trackIndex, control.animationName, control.loop);
} else {
float mix = control.useCustomMixDuration ? control.mixDuration : animationState.Data.DefaultMix;
trackEntry = animationState.SetEmptyAnimation(trackIndex, mix);
}
if (trackEntry != null) {
if (control.useCustomMixDuration)
trackEntry.MixDuration = control.mixDuration;
} else {
float mix = control.useCustomMixDuration ? control.mixDuration : animationState.Data.DefaultMix;
animationState.SetEmptyAnimation(trackIndex, mix);
if (useOverrideAttachmentThreshold)
trackEntry.AttachmentThreshold = attachmentThreshold;
if (useOverrideDrawOrderThreshold)
trackEntry.DrawOrderThreshold = drawOrderThreshold;
}
// Don't parse more than one animation per track.

View File

@ -0,0 +1,692 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 8
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 3
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFiltering: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousColorSigma: 1
m_PVRFilteringAtrousNormalSigma: 1
m_PVRFilteringAtrousPositionSigma: 1
m_LightingDataAsset: {fileID: 0}
m_ShadowMaskMode: 2
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
m_NavMeshData: {fileID: 0}
--- !u!21 &185304931
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: whirlyblendmodes_Material SkeletonPMAScreen
m_Shader: {fileID: 4800000, guid: 4e8caa36c07aacf4ab270da00784e4d9, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- <noninit>:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: dc1b9f9665c8aa74799404a1d2038e3d, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- <noninit>: 0
- _Cutoff: 0.1
- _StraightAlphaInput: 0
m_Colors:
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007121922}
- _Color: {r: 1, g: 1, b: 1, a: 1}
--- !u!1 &200188759
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 200188764}
- component: {fileID: 200188763}
- component: {fileID: 200188762}
- component: {fileID: 200188761}
- component: {fileID: 200188760}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &200188760
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 200188759}
m_Enabled: 1
--- !u!124 &200188761
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 200188759}
m_Enabled: 1
--- !u!92 &200188762
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 200188759}
m_Enabled: 1
--- !u!20 &200188763
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 200188759}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.41089964, g: 0.5221931, b: 0.58823526, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &200188764
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 200188759}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &267173954
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 267173958}
- component: {fileID: 267173957}
- component: {fileID: 267173956}
- component: {fileID: 267173955}
m_Layer: 0
m_Name: Spine GameObject (spineboy-pro)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &267173955
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267173954}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2}
initialSkinName: default
initialFlipX: 0
initialFlipY: 0
separatorSlotNames:
- head
zSpacing: 0
useClipping: 1
immutableTriangles: 0
pmaVertexColors: 1
clearStateOnDisable: 0
tintBlack: 0
singleSubmesh: 0
addNormals: 0
calculateTangents: 0
disableRenderingOnOverride: 1
_animationName: run
loop: 1
timeScale: 1
--- !u!23 &267173956
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267173954}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2}
- {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -4
--- !u!33 &267173957
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267173954}
m_Mesh: {fileID: 0}
--- !u!4 &267173958
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267173954}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.53, y: -4.14, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1573089138}
- {fileID: 1776944555}
- {fileID: 1476882955}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!21 &1280556233
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: whirlyblendmodes_Material SkeletonPMAMultiply
m_Shader: {fileID: 4800000, guid: 8bdcdc7ee298e594a9c20c61d25c33b6, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- <noninit>:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: dc1b9f9665c8aa74799404a1d2038e3d, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- <noninit>: 0
- _Cutoff: 0.1
- _StraightAlphaInput: 0
m_Colors:
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007110106}
- _Color: {r: 1, g: 1, b: 1, a: 1}
--- !u!1 &1476882951
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1476882955}
- component: {fileID: 1476882954}
- component: {fileID: 1476882953}
- component: {fileID: 1476882952}
m_Layer: 0
m_Name: 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1476882952
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476882951}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1c0b968d1e7333b499e347acb644f1c1, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!23 &1476882953
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476882951}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 5
--- !u!33 &1476882954
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476882951}
m_Mesh: {fileID: 0}
--- !u!4 &1476882955
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476882951}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.63, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 267173958}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1573089137
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1573089138}
- component: {fileID: 1573089139}
m_Layer: 0
m_Name: BoneFollower
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1573089138
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1573089137}
m_LocalRotation: {x: 0, y: 0, z: 0.72986394, w: 0.68359244}
m_LocalPosition: {x: 0.6028927, y: 3.6779804, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1738947319}
m_Father: {fileID: 267173958}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1573089139
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1573089137}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a1fd8daaed7b64148a34acb96ba14ce1, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonRenderer: {fileID: 267173955}
boneName: head
followZPosition: 1
followBoneRotation: 1
followSkeletonFlip: 1
followLocalScale: 0
initializeOnAwake: 1
--- !u!1 &1738947315
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1738947319}
- component: {fileID: 1738947318}
- component: {fileID: 1738947317}
- component: {fileID: 1738947316}
- component: {fileID: 1738947320}
m_Layer: 0
m_Name: Spine GameObject (whirlyblendmodes)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1738947316
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1738947315}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonDataAsset: {fileID: 11400000, guid: a515487a7cc6cca479d8c7c700c9145d, type: 2}
initialSkinName: default
initialFlipX: 0
initialFlipY: 0
separatorSlotNames: []
zSpacing: 0
useClipping: 1
immutableTriangles: 0
pmaVertexColors: 1
clearStateOnDisable: 0
tintBlack: 0
singleSubmesh: 0
addNormals: 0
calculateTangents: 0
disableRenderingOnOverride: 1
_animationName: animation
loop: 1
timeScale: 1
--- !u!23 &1738947317
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1738947315}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: e162c08da1abc294cb851248f51dfc40, type: 2}
- {fileID: 1280556233}
- {fileID: 185304931}
- {fileID: 2100000, guid: e162c08da1abc294cb851248f51dfc40, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1738947318
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1738947315}
m_Mesh: {fileID: 0}
--- !u!4 &1738947319
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1738947315}
m_LocalRotation: {x: -0, y: -0, z: 0.78918, w: -0.61416197}
m_LocalPosition: {x: 2.003, y: -0.445, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1573089138}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -104.218}
--- !u!210 &1738947320
SortingGroup:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1738947315}
m_Enabled: 1
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &1776944551
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1776944555}
- component: {fileID: 1776944554}
- component: {fileID: 1776944553}
- component: {fileID: 1776944552}
m_Layer: 0
m_Name: 0
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1776944552
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1776944551}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1c0b968d1e7333b499e347acb644f1c1, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!23 &1776944553
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1776944551}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -17
--- !u!33 &1776944554
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1776944551}
m_Mesh: {fileID: 0}
--- !u!4 &1776944555
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1776944551}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.15, y: 0.36, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 267173958}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0a9f938ebd96eda46b25875547a2c188
timeCreated: 1538614434
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -170,6 +170,123 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &219658205
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 219658210}
- component: {fileID: 219658209}
- component: {fileID: 219658208}
- component: {fileID: 219658207}
- component: {fileID: 219658206}
m_Layer: 0
m_Name: Spine GameObject (spineboy) (3)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &219658206
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 219658205}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62982591830b87b45a3f6efd3ee82630, type: 3}
m_Name:
m_EditorClassIdentifier:
originalMaterial: {fileID: 2100000, guid: 1455e88fdb81ccc45bdeaedd657bad4d, type: 2}
replacementMaterial: {fileID: 2100000, guid: 99689194ebb5b66469537473d95c68c9, type: 2}
replacementEnabled: 1
skeletonAnimation: {fileID: 219658207}
phasePropertyName: _GrayPhase
phase: 1
--- !u!114 &219658207
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 219658205}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonDataAsset: {fileID: 11400000, guid: a467507a4ffb1d542a558739b2fede77, type: 2}
initialSkinName: base
initialFlipX: 0
initialFlipY: 0
separatorSlotNames: []
zSpacing: 0
useClipping: 1
immutableTriangles: 0
pmaVertexColors: 1
clearStateOnDisable: 0
tintBlack: 0
singleSubmesh: 0
addNormals: 0
calculateTangents: 0
disableRenderingOnOverride: 1
_animationName: run
loop: 1
timeScale: 1
--- !u!23 &219658208
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 219658205}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 1455e88fdb81ccc45bdeaedd657bad4d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &219658209
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 219658205}
m_Mesh: {fileID: 0}
--- !u!4 &219658210
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 219658205}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 6.97, y: -1.75, z: 0}
m_LocalScale: {x: 0.8, y: 0.8, z: 0.8}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &508727089
GameObject:
m_ObjectHideFlags: 0
@ -214,7 +331,6 @@ MonoBehaviour:
singleSubmesh: 0
addNormals: 0
calculateTangents: 0
logErrors: 0
disableRenderingOnOverride: 1
_animationName: run
loop: 1
@ -232,7 +348,7 @@ MeshRenderer:
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 128e02fa6a4f5964fa898757a425b354, type: 2}
- {fileID: 2100000, guid: 1455e88fdb81ccc45bdeaedd657bad4d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -265,8 +381,8 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 508727089}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3, y: -2, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalPosition: {x: -3.46, y: -1.82, z: 0}
m_LocalScale: {x: 0.8, y: 0.8, z: 0.8}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
@ -345,7 +461,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.000030518, y: -344}
m_AnchoredPosition: {x: -451, y: -287}
m_SizeDelta: {x: 969, y: 93}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1057001081
@ -432,7 +548,6 @@ MonoBehaviour:
singleSubmesh: 0
addNormals: 0
calculateTangents: 0
logErrors: 0
disableRenderingOnOverride: 1
_animationName: run
loop: 1
@ -450,7 +565,7 @@ MeshRenderer:
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 128e02fa6a4f5964fa898757a425b354, type: 2}
- {fileID: 2100000, guid: 1455e88fdb81ccc45bdeaedd657bad4d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -483,8 +598,8 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1334021432}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3, y: -2, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalPosition: {x: -6.62, y: 0.08, z: 0}
m_LocalScale: {x: 0.8, y: 0.8, z: 0.8}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
@ -620,6 +735,123 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1576132083
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1576132089}
- component: {fileID: 1576132088}
- component: {fileID: 1576132087}
- component: {fileID: 1576132086}
- component: {fileID: 1576132085}
m_Layer: 0
m_Name: Spine GameObject (spineboy) (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1576132085
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576132083}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62982591830b87b45a3f6efd3ee82630, type: 3}
m_Name:
m_EditorClassIdentifier:
originalMaterial: {fileID: 2100000, guid: 1455e88fdb81ccc45bdeaedd657bad4d, type: 2}
replacementMaterial: {fileID: 2100000, guid: 99689194ebb5b66469537473d95c68c9, type: 2}
replacementEnabled: 1
skeletonAnimation: {fileID: 1576132086}
phasePropertyName: _GrayPhase
phase: 0.468
--- !u!114 &1576132086
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576132083}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3}
m_Name:
m_EditorClassIdentifier:
skeletonDataAsset: {fileID: 11400000, guid: a467507a4ffb1d542a558739b2fede77, type: 2}
initialSkinName: base
initialFlipX: 0
initialFlipY: 0
separatorSlotNames: []
zSpacing: 0
useClipping: 1
immutableTriangles: 0
pmaVertexColors: 1
clearStateOnDisable: 0
tintBlack: 0
singleSubmesh: 0
addNormals: 0
calculateTangents: 0
disableRenderingOnOverride: 1
_animationName: run
loop: 1
timeScale: 1
--- !u!23 &1576132087
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576132083}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 1455e88fdb81ccc45bdeaedd657bad4d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1576132088
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576132083}
m_Mesh: {fileID: 0}
--- !u!4 &1576132089
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576132083}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.18, y: 0.28, z: 0}
m_LocalScale: {x: 0.8, y: 0.8, z: 0.8}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1909315727
GameObject:
m_ObjectHideFlags: 0
@ -706,6 +938,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1057001080}
- {fileID: 1968442398}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -714,3 +947,79 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1968442397
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1968442398}
- component: {fileID: 1968442400}
- component: {fileID: 1968442399}
m_Layer: 5
m_Name: Text (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1968442398
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1968442397}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.000005, y: 1.000005, z: 1.000005}
m_Children: []
m_Father: {fileID: 1909315731}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 482, y: -254}
m_SizeDelta: {x: 969, y: 93}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1968442399
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1968442397}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 40
m_Alignment: 1
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 'These Spineboys use the same SkeletonData as the ones on the left.
But have substituted Materials that use a different shader.'
--- !u!222 &1968442400
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1968442397}

View File

@ -23,8 +23,9 @@ namespace Spine.Unity.Examples {
var mousePosition = Input.mousePosition;
var worldMousePosition = camera.ScreenToWorldPoint(mousePosition);
var skeletonSpacePoint = skeletonAnimation.transform.InverseTransformPoint(worldMousePosition);
//if (skeletonAnimation.Skeleton.FlipX) skeletonSpacePoint.x *= -1;
bone.SetPosition(skeletonSpacePoint);
skeletonSpacePoint.x *= skeletonAnimation.Skeleton.ScaleX;
skeletonSpacePoint.y *= skeletonAnimation.Skeleton.ScaleY;
bone.SetLocalPosition(skeletonSpacePoint);
}
}

View File

@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Spine.Unity.Examples {
public class MaterialReplacementExample : MonoBehaviour {
public Material originalMaterial;
public Material replacementMaterial;
public bool replacementEnabled = true;
public SkeletonAnimation skeletonAnimation;
[Space]
public string phasePropertyName = "_FillPhase";
[Range(0f, 1f)] public float phase = 1f;
bool previousEnabled;
MaterialPropertyBlock mpb;
void Start () {
previousEnabled = replacementEnabled;
SetReplacementEnabled(replacementEnabled);
mpb = new MaterialPropertyBlock();
}
void Update () {
mpb.SetFloat(phasePropertyName, phase);
GetComponent<MeshRenderer>().SetPropertyBlock(mpb);
if (previousEnabled != replacementEnabled)
SetReplacementEnabled(replacementEnabled);
previousEnabled = replacementEnabled;
}
void SetReplacementEnabled (bool active) {
if (replacementEnabled) {
skeletonAnimation.CustomMaterialOverride[originalMaterial] = replacementMaterial;
} else {
skeletonAnimation.CustomMaterialOverride.Remove(originalMaterial);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 62982591830b87b45a3f6efd3ee82630
timeCreated: 1539082420
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -24,7 +24,7 @@ namespace Spine.Unity.Examples {
// OPTIONAL: Add all the attachments from the template skin.
var templateSkin = skeletonAnimation.Skeleton.Data.FindSkin(templateSkinName);
if (templateSkin != null)
equipsSkin.Append(templateSkin);
equipsSkin.AddAttachments(templateSkin);
skeletonAnimation.Skeleton.Skin = equipsSkin;
RefreshSkeletonAttachments();
@ -40,8 +40,8 @@ namespace Spine.Unity.Examples {
// 1. Collect all the attachments of all active skins.
collectedSkin = collectedSkin ?? new Skin("Collected skin");
collectedSkin.Clear();
collectedSkin.Append(skeletonAnimation.Skeleton.Data.DefaultSkin);
collectedSkin.Append(equipsSkin);
collectedSkin.AddAttachments(skeletonAnimation.Skeleton.Data.DefaultSkin);
collectedSkin.AddAttachments(equipsSkin);
// 2. Create a repacked skin.
var repackedSkin = collectedSkin.GetRepackedSkin("Repacked skin", skeletonAnimation.SkeletonDataAsset.atlasAssets[0].PrimaryMaterial, out runtimeMaterial, out runtimeAtlas);

View File

@ -118,8 +118,8 @@ namespace Spine.Unity.Examples {
// Under the hood, this relies on
if (repack) {
var repackedSkin = new Skin("repacked skin");
repackedSkin.Append(skeleton.Data.DefaultSkin); // Include the "default" skin. (everything outside of skin placeholders)
repackedSkin.Append(customSkin); // Include your new custom skin.
repackedSkin.AddAttachments(skeleton.Data.DefaultSkin); // Include the "default" skin. (everything outside of skin placeholders)
repackedSkin.AddAttachments(customSkin); // Include your new custom skin.
repackedSkin = repackedSkin.GetRepackedSkin("repacked skin", sourceMaterial, out runtimeMaterial, out runtimeAtlas); // Pack all the items in the skin.
skeleton.SetSkin(repackedSkin); // Assign the repacked skin to your Skeleton.
if (bbFollower != null) bbFollower.Initialize(true);

View File

@ -118,8 +118,8 @@ namespace Spine.Unity.Examples {
// call Skin.GetRepackedSkin to get a cloned skin with cloned attachments that all use one texture.
if (repack) {
var repackedSkin = new Skin("repacked skin");
repackedSkin.Append(skeleton.Data.DefaultSkin);
repackedSkin.Append(customSkin);
repackedSkin.AddAttachments(skeleton.Data.DefaultSkin);
repackedSkin.AddAttachments(customSkin);
repackedSkin = repackedSkin.GetRepackedSkin("repacked skin", sourceMaterial, out runtimeMaterial, out runtimeAtlas);
skeleton.SetSkin(repackedSkin);
} else {

View File

@ -20,7 +20,7 @@ namespace Spine.Unity.Examples {
combinedSkin.Clear();
foreach (var skinName in skinsToCombine) {
var skin = skeleton.Data.FindSkin(skinName);
if (skin != null) combinedSkin.Append(skin);
if (skin != null) combinedSkin.AddAttachments(skin);
}
skeleton.SetSkin(combinedSkin);

View File

@ -34,7 +34,7 @@ using UnityEngine;
using System.Collections.Generic;
using Spine.Unity.Modules.AttachmentTools;
namespace Spine.Unity.Modules {
namespace Spine.Unity.Examples {
public class SpriteAttacher : MonoBehaviour {
public const string DefaultPMAShader = "Spine/Skeleton";
public const string DefaultStraightAlphaShader = "Sprites/Default";
@ -50,16 +50,16 @@ namespace Spine.Unity.Modules {
void OnValidate () {
var skeletonComponent = GetComponent<ISkeletonComponent>();
var skeletonRenderer = skeletonComponent as SkeletonRenderer;
bool apma;
bool applyPMA;
if (skeletonRenderer != null) {
apma = skeletonRenderer.pmaVertexColors;
applyPMA = skeletonRenderer.pmaVertexColors;
} else {
var skeletonGraphic = skeletonComponent as SkeletonGraphic;
apma = skeletonGraphic != null && skeletonGraphic.MeshGenerator.settings.pmaVertexColors;
applyPMA = skeletonGraphic != null && skeletonGraphic.MeshGenerator.settings.pmaVertexColors;
}
if (apma) {
if (applyPMA) {
try {
sprite.texture.GetPixel(0, 0);
} catch (UnityException e) {

View File

@ -3,7 +3,7 @@ using UnityEngine;
using Spine;
using Spine.Unity;
namespace Spine.Unity.Examples {
namespace Spine.Unity.Prototyping {
/// <summary>
/// Stores and serializes initial settings for a Spine Skeleton component. The settings only get applied on Start at runtime.</summary>
public class SkeletonColorInitialize : MonoBehaviour {

View File

@ -32,7 +32,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace Spine.Unity.Modules {
namespace Spine.Unity.Prototyping {
public class SpineEventUnityHandler : MonoBehaviour {

View File

@ -56,8 +56,7 @@ namespace Spine.Unity.Examples {
if (skeletonRenderer == null) return;
var skeleton = skeletonRenderer.skeleton; if (skeleton == null) return;
fillAnimation.Animation.Apply(skeleton, 0, percent, false, null, 1f, MixBlend.Setup, MixDirection.In);
fillAnimation.Animation.PoseSkeleton(skeleton, percent);
skeleton.Update(Time.deltaTime);
skeleton.UpdateWorldTransform();
}

View File

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -27,7 +27,7 @@ namespace Spine.Unity.Examples {
[Header("Debug")]
[SerializeField] float balance;
[SerializeField] float distanceBetweenFeet;
[SerializeField] Foot nearFoot, farFoot;
[SerializeField] protected Foot nearFoot, farFoot;
Skeleton skeleton;
Bone nearFootBone, farFootBone;
@ -184,8 +184,8 @@ namespace Spine.Unity.Examples {
nearFoot.UpdateStepProgress(deltaTime, stepSpeed, shuffleDistance, forward, backward);
farFoot.UpdateStepProgress(deltaTime, stepSpeed, shuffleDistance, forward, backward);
nearFootBone.SetPosition(thisTransform.InverseTransformPoint(nearFoot.worldPos));
farFootBone.SetPosition(thisTransform.InverseTransformPoint(farFoot.worldPos));
nearFootBone.SetLocalPosition(thisTransform.InverseTransformPoint(nearFoot.worldPos));
farFootBone.SetLocalPosition(thisTransform.InverseTransformPoint(farFoot.worldPos));
}

View File

@ -13,8 +13,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: bb54bdab69af2bb49b35577b80dcaad9, type: 2}
skeletonJSON: {fileID: 4900000, guid: c3921acb20cbc25418859f1b213d3d3f, type: 3}
scale: 0.01
skeletonJSON: {fileID: 4900000, guid: c3921acb20cbc25418859f1b213d3d3f, type: 3}
skeletonDataModifiers: []
fromAnimation: []
toAnimation: []
duration: []

View File

@ -13,9 +13,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: d5fc231712b346f459c8583fa224a669, type: 2}
spriteCollection: {fileID: 0}
scale: 0.01
skeletonJSON: {fileID: 4900000, guid: 3ae635b4540c450408d30a8afb9f75a7, type: 3}
skeletonDataModifiers: []
fromAnimation: []
toAnimation: []
duration: []

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6b194f808b1af6499c93410e504af42, type: 3}
m_Name: stretchyman-diffuse-pma_Atlas
m_EditorClassIdentifier:
atlasFile: {fileID: 4900000, guid: 492ecfd45cd2de542bc20043b10ee4aa, type: 3}
materials:
- {fileID: 2100000, guid: 824cfb62bcbe3db49a3ce6db7e3757d1, type: 2}

View File

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: stretchyman-diffuse-pma_Material
m_Shader: {fileID: 4800000, guid: 2ce511398fb980f41b7d316c51534590, type: 3}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _EMISSION _FIXED_NORMALS _FIXED_NORMALS_VIEWSPACE
_NORMALMAP
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
AlphaDepth: true
IGNOREPROJECTOR: true
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BlendTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: d00f264cbe0cc4a49a54a221ee812855, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DiffuseRamp:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 2800000, guid: 4cad8f072f658544a80ba2b271aec125, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 33f10ea7e20549d40a1c23a1adc3f760, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- PixelSnap: 0
- _BlendAmount: 0
- _BlendMode: 0
- _Brightness: 1
- _BumpScale: 1
- _Cull: 0
- _CustomRenderQueue: 0
- _Cutoff: 0.1
- _DstBlend: 10
- _EmissionPower: 1
- _EnableExternalAlpha: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _Hue: 0
- _Metallic: 0
- _RenderQueue: 0
- _RimPower: 1.79
- _Saturation: 1
- _ShadowAlphaCutoff: 0.1
- _SrcBlend: 1
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _FixedNormal: {r: 0, g: 0, b: 1, a: 1}
- _OverlayColor: {r: 0, g: 0, b: 0, a: 0}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}

Some files were not shown because too many files have changed in this diff Show More