mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-05 06:44:56 +08:00
Merge branch '3.6' into 3.7-beta
This commit is contained in:
commit
f26cb43a81
Binary file not shown.
@ -132,7 +132,8 @@ package spine.animation {
|
||||
|
||||
// Require mixTime > 0 to ensure the mixing from entry was applied at least once.
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
queue.end(from);
|
||||
|
||||
@ -312,7 +312,8 @@ int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTr
|
||||
|
||||
/* Require mixTime > 0 to ensure the mixing from entry was applied at least once. */
|
||||
if (to->mixTime > 0 && (to->mixTime >= to->mixDuration || to->timeScale == 0)) {
|
||||
if (from->totalAlpha == 0) {
|
||||
/* Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame). */
|
||||
if (from->totalAlpha == 0 || to->mixDuration == 0) {
|
||||
to->mixingFrom = from->mixingFrom;
|
||||
to->interruptAlpha = from->interruptAlpha;
|
||||
_spEventQueue_end(internal->queue, from);
|
||||
|
||||
@ -139,8 +139,9 @@ namespace Spine {
|
||||
bool finished = UpdateMixingFrom(from, delta);
|
||||
|
||||
// Require mixTime > 0 to ensure the mixing from entry was applied at least once.
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
queue.End(from);
|
||||
@ -707,10 +708,13 @@ namespace Spine {
|
||||
} else {
|
||||
for (int ii = mixingToLast; ii >= 0; ii--) {
|
||||
var entry = mixingTo[ii];
|
||||
if (entry.mixDuration > 0 && !entry.HasTimeline(id)) {
|
||||
timelineDataItems[i] = AnimationState.DipMix;
|
||||
timelineDipMixItems[i] = entry;
|
||||
goto outer; // continue outer;
|
||||
if (!entry.HasTimeline(id)) {
|
||||
if (entry.mixDuration > 0) {
|
||||
timelineDataItems[i] = AnimationState.DipMix;
|
||||
timelineDipMixItems[i] = entry;
|
||||
goto outer; // continue outer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
timelineDataItems[i] = AnimationState.Dip;
|
||||
|
||||
@ -258,7 +258,7 @@ namespace Spine {
|
||||
return clipped;
|
||||
}
|
||||
|
||||
public static void MakeClockwise (ExposedList<float> polygon) {
|
||||
static void MakeClockwise (ExposedList<float> polygon) {
|
||||
float[] vertices = polygon.Items;
|
||||
int verticeslength = polygon.Count;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
using System;
|
||||
|
||||
namespace Spine {
|
||||
public class Triangulator {
|
||||
internal class Triangulator {
|
||||
private readonly ExposedList<ExposedList<float>> convexPolygons = new ExposedList<ExposedList<float>>();
|
||||
private readonly ExposedList<ExposedList<int>> convexPolygonsIndices = new ExposedList<ExposedList<int>>();
|
||||
|
||||
|
||||
@ -144,7 +144,8 @@ public class AnimationState {
|
||||
|
||||
// Require mixTime > 0 to ensure the mixing from entry was applied at least once.
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
queue.end(from);
|
||||
|
||||
@ -128,6 +128,7 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
Gdx.files.internal(Gdx.app.getPreferences("spine-skeletonviewer").getString("lastFile", "spineboy/spineboy.json")));
|
||||
|
||||
ui.loadPrefs();
|
||||
ui.prefsLoaded = true;
|
||||
}
|
||||
|
||||
void loadSkeleton (final FileHandle skeletonFile) {
|
||||
@ -142,7 +143,8 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
pixmap.dispose();
|
||||
|
||||
String atlasFileName = skeletonFile.nameWithoutExtension();
|
||||
if (atlasFileName.endsWith(".json")) atlasFileName = new FileHandle(atlasFileName).nameWithoutExtension();
|
||||
if (atlasFileName.endsWith(".json") || atlasFileName.endsWith(".skel"))
|
||||
atlasFileName = atlasFileName.substring(0, atlasFileName.length() - 5);
|
||||
FileHandle atlasFile = skeletonFile.sibling(atlasFileName + ".atlas");
|
||||
if (!atlasFile.exists()) {
|
||||
if (atlasFileName.endsWith("-pro") || atlasFileName.endsWith("-ess"))
|
||||
@ -380,6 +382,8 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
}
|
||||
|
||||
class UI {
|
||||
boolean prefsLoaded;
|
||||
|
||||
Stage stage = new Stage(new ScreenViewport());
|
||||
com.badlogic.gdx.scenes.scene2d.ui.Skin skin = new com.badlogic.gdx.scenes.scene2d.ui.Skin(
|
||||
Gdx.files.internal("skin/skin.json"));
|
||||
@ -436,7 +440,6 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
|
||||
Label statusLabel = new Label("", skin);
|
||||
WidgetGroup toasts = new WidgetGroup();
|
||||
boolean prefsLoaded;
|
||||
|
||||
UI () {
|
||||
initialize();
|
||||
@ -706,6 +709,16 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
}
|
||||
});
|
||||
|
||||
InputListener scrollFocusListener = new InputListener() {
|
||||
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
||||
if (pointer == -1) stage.setScrollFocus(event.getListenerActor());
|
||||
}
|
||||
|
||||
public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
|
||||
if (pointer == -1 && stage.getScrollFocus() == event.getListenerActor()) stage.setScrollFocus(null);
|
||||
}
|
||||
};
|
||||
|
||||
animationList.addListener(new ChangeListener() {
|
||||
public void changed (ChangeEvent event, Actor actor) {
|
||||
if (state != null) {
|
||||
@ -717,6 +730,7 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
}
|
||||
}
|
||||
});
|
||||
animationScroll.addListener(scrollFocusListener);
|
||||
|
||||
loopCheckbox.addListener(new ChangeListener() {
|
||||
public void changed (ChangeEvent event, Actor actor) {
|
||||
@ -736,6 +750,7 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
}
|
||||
}
|
||||
});
|
||||
skinScroll.addListener(scrollFocusListener);
|
||||
|
||||
ChangeListener trackButtonListener = new ChangeListener() {
|
||||
public void changed (ChangeEvent event, Actor actor) {
|
||||
@ -909,7 +924,6 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
scaleSlider.setValue(prefs.getFloat("scale", 1));
|
||||
animationList.setSelected(prefs.getString("animationName", null));
|
||||
skinList.setSelected(prefs.getString("skinName", null));
|
||||
prefsLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -346,7 +346,8 @@ function AnimationState:updateMixingFrom (to, delta)
|
||||
|
||||
-- Require mixTime > 0 to ensure the mixing from entry was applied at least once.
|
||||
if (to.mixTime > 0 and (to.mixTime >= to.mixDuration or to.timeScale == 0)) then
|
||||
if (from.totalAlpha == 0) then
|
||||
-- Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
|
||||
if (from.totalAlpha == 0 or to.mixDuration == 0) then
|
||||
to.mixingFrom = from.mixingFrom
|
||||
to.interruptAlpha = from.interruptAlpha
|
||||
self.queue:_end(from)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
4
spine-ts/build/spine-all.d.ts
vendored
4
spine-ts/build/spine-all.d.ts
vendored
@ -585,6 +585,9 @@ declare module spine {
|
||||
ChainScale = 2,
|
||||
}
|
||||
}
|
||||
interface Math {
|
||||
fround(n: number): number;
|
||||
}
|
||||
declare module spine {
|
||||
class SharedAssetManager implements Disposable {
|
||||
private pathPrefix;
|
||||
@ -987,6 +990,7 @@ declare module spine {
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static newShortArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toSinglePrecision(value: number): number;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
|
||||
@ -1216,7 +1216,7 @@ var spine;
|
||||
return true;
|
||||
var finished = this.updateMixingFrom(from, delta);
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
this.queue.end(from);
|
||||
@ -2974,6 +2974,15 @@ var spine;
|
||||
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
|
||||
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
|
||||
})(spine || (spine = {}));
|
||||
(function () {
|
||||
if (!Math.fround) {
|
||||
Math.fround = (function (array) {
|
||||
return function (x) {
|
||||
return array[0] = x, array[0];
|
||||
};
|
||||
})(new Float32Array(1));
|
||||
}
|
||||
})();
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Assets = (function () {
|
||||
@ -4745,7 +4754,7 @@ var spine;
|
||||
var eventData = skeletonData.findEvent(eventMap.name);
|
||||
if (eventData == null)
|
||||
throw new Error("Event not found: " + eventMap.name);
|
||||
var event_5 = new spine.Event(eventMap.time, eventData);
|
||||
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
|
||||
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
|
||||
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
|
||||
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
|
||||
@ -5879,6 +5888,9 @@ var spine;
|
||||
Utils.toFloatArray = function (array) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
|
||||
};
|
||||
Utils.toSinglePrecision = function (value) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
||||
};
|
||||
return Utils;
|
||||
}());
|
||||
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-canvas.d.ts
vendored
4
spine-ts/build/spine-canvas.d.ts
vendored
@ -585,6 +585,9 @@ declare module spine {
|
||||
ChainScale = 2,
|
||||
}
|
||||
}
|
||||
interface Math {
|
||||
fround(n: number): number;
|
||||
}
|
||||
declare module spine {
|
||||
class SharedAssetManager implements Disposable {
|
||||
private pathPrefix;
|
||||
@ -987,6 +990,7 @@ declare module spine {
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static newShortArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toSinglePrecision(value: number): number;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
|
||||
@ -1216,7 +1216,7 @@ var spine;
|
||||
return true;
|
||||
var finished = this.updateMixingFrom(from, delta);
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
this.queue.end(from);
|
||||
@ -2974,6 +2974,15 @@ var spine;
|
||||
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
|
||||
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
|
||||
})(spine || (spine = {}));
|
||||
(function () {
|
||||
if (!Math.fround) {
|
||||
Math.fround = (function (array) {
|
||||
return function (x) {
|
||||
return array[0] = x, array[0];
|
||||
};
|
||||
})(new Float32Array(1));
|
||||
}
|
||||
})();
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Assets = (function () {
|
||||
@ -4745,7 +4754,7 @@ var spine;
|
||||
var eventData = skeletonData.findEvent(eventMap.name);
|
||||
if (eventData == null)
|
||||
throw new Error("Event not found: " + eventMap.name);
|
||||
var event_5 = new spine.Event(eventMap.time, eventData);
|
||||
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
|
||||
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
|
||||
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
|
||||
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
|
||||
@ -5879,6 +5888,9 @@ var spine;
|
||||
Utils.toFloatArray = function (array) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
|
||||
};
|
||||
Utils.toSinglePrecision = function (value) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
||||
};
|
||||
return Utils;
|
||||
}());
|
||||
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-core.d.ts
vendored
4
spine-ts/build/spine-core.d.ts
vendored
@ -585,6 +585,9 @@ declare module spine {
|
||||
ChainScale = 2,
|
||||
}
|
||||
}
|
||||
interface Math {
|
||||
fround(n: number): number;
|
||||
}
|
||||
declare module spine {
|
||||
class SharedAssetManager implements Disposable {
|
||||
private pathPrefix;
|
||||
@ -987,6 +990,7 @@ declare module spine {
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static newShortArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toSinglePrecision(value: number): number;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
|
||||
@ -1216,7 +1216,7 @@ var spine;
|
||||
return true;
|
||||
var finished = this.updateMixingFrom(from, delta);
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
this.queue.end(from);
|
||||
@ -2974,6 +2974,15 @@ var spine;
|
||||
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
|
||||
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
|
||||
})(spine || (spine = {}));
|
||||
(function () {
|
||||
if (!Math.fround) {
|
||||
Math.fround = (function (array) {
|
||||
return function (x) {
|
||||
return array[0] = x, array[0];
|
||||
};
|
||||
})(new Float32Array(1));
|
||||
}
|
||||
})();
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Assets = (function () {
|
||||
@ -4745,7 +4754,7 @@ var spine;
|
||||
var eventData = skeletonData.findEvent(eventMap.name);
|
||||
if (eventData == null)
|
||||
throw new Error("Event not found: " + eventMap.name);
|
||||
var event_5 = new spine.Event(eventMap.time, eventData);
|
||||
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
|
||||
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
|
||||
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
|
||||
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
|
||||
@ -5879,6 +5888,9 @@ var spine;
|
||||
Utils.toFloatArray = function (array) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
|
||||
};
|
||||
Utils.toSinglePrecision = function (value) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
||||
};
|
||||
return Utils;
|
||||
}());
|
||||
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-threejs.d.ts
vendored
4
spine-ts/build/spine-threejs.d.ts
vendored
@ -585,6 +585,9 @@ declare module spine {
|
||||
ChainScale = 2,
|
||||
}
|
||||
}
|
||||
interface Math {
|
||||
fround(n: number): number;
|
||||
}
|
||||
declare module spine {
|
||||
class SharedAssetManager implements Disposable {
|
||||
private pathPrefix;
|
||||
@ -987,6 +990,7 @@ declare module spine {
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static newShortArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toSinglePrecision(value: number): number;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
|
||||
@ -1216,7 +1216,7 @@ var spine;
|
||||
return true;
|
||||
var finished = this.updateMixingFrom(from, delta);
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
this.queue.end(from);
|
||||
@ -2974,6 +2974,15 @@ var spine;
|
||||
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
|
||||
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
|
||||
})(spine || (spine = {}));
|
||||
(function () {
|
||||
if (!Math.fround) {
|
||||
Math.fround = (function (array) {
|
||||
return function (x) {
|
||||
return array[0] = x, array[0];
|
||||
};
|
||||
})(new Float32Array(1));
|
||||
}
|
||||
})();
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Assets = (function () {
|
||||
@ -4745,7 +4754,7 @@ var spine;
|
||||
var eventData = skeletonData.findEvent(eventMap.name);
|
||||
if (eventData == null)
|
||||
throw new Error("Event not found: " + eventMap.name);
|
||||
var event_5 = new spine.Event(eventMap.time, eventData);
|
||||
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
|
||||
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
|
||||
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
|
||||
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
|
||||
@ -5879,6 +5888,9 @@ var spine;
|
||||
Utils.toFloatArray = function (array) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
|
||||
};
|
||||
Utils.toSinglePrecision = function (value) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
||||
};
|
||||
return Utils;
|
||||
}());
|
||||
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-webgl.d.ts
vendored
4
spine-ts/build/spine-webgl.d.ts
vendored
@ -585,6 +585,9 @@ declare module spine {
|
||||
ChainScale = 2,
|
||||
}
|
||||
}
|
||||
interface Math {
|
||||
fround(n: number): number;
|
||||
}
|
||||
declare module spine {
|
||||
class SharedAssetManager implements Disposable {
|
||||
private pathPrefix;
|
||||
@ -987,6 +990,7 @@ declare module spine {
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static newShortArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toSinglePrecision(value: number): number;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
|
||||
@ -1216,7 +1216,7 @@ var spine;
|
||||
return true;
|
||||
var finished = this.updateMixingFrom(from, delta);
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
this.queue.end(from);
|
||||
@ -2974,6 +2974,15 @@ var spine;
|
||||
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
|
||||
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
|
||||
})(spine || (spine = {}));
|
||||
(function () {
|
||||
if (!Math.fround) {
|
||||
Math.fround = (function (array) {
|
||||
return function (x) {
|
||||
return array[0] = x, array[0];
|
||||
};
|
||||
})(new Float32Array(1));
|
||||
}
|
||||
})();
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Assets = (function () {
|
||||
@ -4745,7 +4754,7 @@ var spine;
|
||||
var eventData = skeletonData.findEvent(eventMap.name);
|
||||
if (eventData == null)
|
||||
throw new Error("Event not found: " + eventMap.name);
|
||||
var event_5 = new spine.Event(eventMap.time, eventData);
|
||||
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
|
||||
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
|
||||
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
|
||||
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
|
||||
@ -5879,6 +5888,9 @@ var spine;
|
||||
Utils.toFloatArray = function (array) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
|
||||
};
|
||||
Utils.toSinglePrecision = function (value) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
||||
};
|
||||
return Utils;
|
||||
}());
|
||||
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-widget.d.ts
vendored
4
spine-ts/build/spine-widget.d.ts
vendored
@ -585,6 +585,9 @@ declare module spine {
|
||||
ChainScale = 2,
|
||||
}
|
||||
}
|
||||
interface Math {
|
||||
fround(n: number): number;
|
||||
}
|
||||
declare module spine {
|
||||
class SharedAssetManager implements Disposable {
|
||||
private pathPrefix;
|
||||
@ -987,6 +990,7 @@ declare module spine {
|
||||
static newFloatArray(size: number): ArrayLike<number>;
|
||||
static newShortArray(size: number): ArrayLike<number>;
|
||||
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||
static toSinglePrecision(value: number): number;
|
||||
}
|
||||
class DebugUtils {
|
||||
static logBones(skeleton: Skeleton): void;
|
||||
|
||||
@ -1216,7 +1216,7 @@ var spine;
|
||||
return true;
|
||||
var finished = this.updateMixingFrom(from, delta);
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
this.queue.end(from);
|
||||
@ -2974,6 +2974,15 @@ var spine;
|
||||
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
|
||||
})(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
|
||||
})(spine || (spine = {}));
|
||||
(function () {
|
||||
if (!Math.fround) {
|
||||
Math.fround = (function (array) {
|
||||
return function (x) {
|
||||
return array[0] = x, array[0];
|
||||
};
|
||||
})(new Float32Array(1));
|
||||
}
|
||||
})();
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var Assets = (function () {
|
||||
@ -4745,7 +4754,7 @@ var spine;
|
||||
var eventData = skeletonData.findEvent(eventMap.name);
|
||||
if (eventData == null)
|
||||
throw new Error("Event not found: " + eventMap.name);
|
||||
var event_5 = new spine.Event(eventMap.time, eventData);
|
||||
var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
|
||||
event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
|
||||
event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
|
||||
event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
|
||||
@ -5879,6 +5888,9 @@ var spine;
|
||||
Utils.toFloatArray = function (array) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
|
||||
};
|
||||
Utils.toSinglePrecision = function (value) {
|
||||
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
||||
};
|
||||
return Utils;
|
||||
}());
|
||||
Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -116,7 +116,8 @@ module spine {
|
||||
|
||||
// Require mixTime > 0 to ensure the mixing from entry was applied at least once.
|
||||
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
|
||||
if (from.totalAlpha == 0) {
|
||||
// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
|
||||
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
||||
to.mixingFrom = from.mixingFrom;
|
||||
to.interruptAlpha = from.interruptAlpha;
|
||||
this.queue.end(from);
|
||||
|
||||
@ -170,7 +170,7 @@ namespace Spine.Unity.Editor {
|
||||
#if NO_PREFAB_MESH
|
||||
if (isInspectingPrefab) {
|
||||
MeshFilter meshFilter = component.GetComponent<MeshFilter>();
|
||||
if (meshFilter != null)
|
||||
if (meshFilter != null && meshFilter.sharedMesh != null)
|
||||
meshFilter.sharedMesh = null;
|
||||
}
|
||||
#endif
|
||||
@ -211,7 +211,7 @@ namespace Spine.Unity.Editor {
|
||||
#if NO_PREFAB_MESH
|
||||
if (isInspectingPrefab) {
|
||||
MeshFilter meshFilter = component.GetComponent<MeshFilter>();
|
||||
if (meshFilter != null)
|
||||
if (meshFilter != null && meshFilter.sharedMesh != null)
|
||||
meshFilter.sharedMesh = null;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1020,13 +1020,18 @@ namespace Spine.Unity.Editor {
|
||||
pageFiles.Add(atlasLines[i + 1].Trim());
|
||||
}
|
||||
|
||||
atlasAsset.materials = new Material[pageFiles.Count];
|
||||
var populatingMaterials = new List<Material>(pageFiles.Count);//atlasAsset.materials = new Material[pageFiles.Count];
|
||||
|
||||
for (int i = 0; i < pageFiles.Count; i++) {
|
||||
string texturePath = assetPath + "/" + pageFiles[i];
|
||||
Texture2D texture = (Texture2D)AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D));
|
||||
|
||||
TextureImporter texImporter = (TextureImporter)TextureImporter.GetAtPath(texturePath);
|
||||
if (texImporter == null) {
|
||||
Debug.LogWarning(string.Format("{0} ::: Texture asset \"{1}\" not found. Skipping. Please check your atlas file for renamed files.", atlasAsset.name, texturePath));
|
||||
continue;
|
||||
}
|
||||
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
texImporter.textureCompression = TextureImporterCompression.Uncompressed;
|
||||
texImporter.alphaSource = TextureImporterAlphaSource.FromInput;
|
||||
@ -1039,7 +1044,6 @@ namespace Spine.Unity.Editor {
|
||||
texImporter.spriteImportMode = SpriteImportMode.None;
|
||||
texImporter.maxTextureSize = 2048;
|
||||
|
||||
|
||||
EditorUtility.SetDirty(texImporter);
|
||||
AssetDatabase.ImportAsset(texturePath);
|
||||
AssetDatabase.SaveAssets();
|
||||
@ -1064,9 +1068,11 @@ namespace Spine.Unity.Editor {
|
||||
EditorUtility.SetDirty(mat);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
atlasAsset.materials[i] = mat;
|
||||
populatingMaterials.Add(mat); //atlasAsset.materials[i] = mat;
|
||||
}
|
||||
|
||||
atlasAsset.materials = populatingMaterials.ToArray();
|
||||
|
||||
for (int i = 0; i < vestigialMaterials.Count; i++)
|
||||
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(vestigialMaterials[i]));
|
||||
|
||||
@ -1078,6 +1084,11 @@ namespace Spine.Unity.Editor {
|
||||
EditorUtility.SetDirty(atlasAsset);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
if (pageFiles.Count != atlasAsset.materials.Length)
|
||||
Debug.LogWarning(string.Format("{0} ::: Not all atlas pages were imported. If you rename your image files, please make sure you also edit the filenames specified in the atlas file.", atlasAsset.name));
|
||||
else
|
||||
Debug.Log(string.Format("{0} ::: Imported with {1} material", atlasAsset.name, atlasAsset.materials.Length));
|
||||
|
||||
// Iterate regions and bake marked.
|
||||
Atlas atlas = atlasAsset.GetAtlas();
|
||||
FieldInfo field = typeof(Atlas).GetField("regions", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.NonPublic);
|
||||
|
||||
@ -72,6 +72,14 @@ namespace Spine.Unity.Modules {
|
||||
#endregion
|
||||
|
||||
#region Runtime Instantiation
|
||||
/// <summary>Adds a SkeletonRenderSeparator and child SkeletonPartsRenderer GameObjects to a given SkeletonRenderer.</summary>
|
||||
/// <returns>The to skeleton renderer.</returns>
|
||||
/// <param name="skeletonRenderer">The target SkeletonRenderer or SkeletonAnimation.</param>
|
||||
/// <param name="sortingLayerID">Sorting layer to be used for the parts renderers.</param>
|
||||
/// <param name="extraPartsRenderers">Number of additional SkeletonPartsRenderers on top of the ones determined by counting the number of separator slots.</param>
|
||||
/// <param name="sortingOrderIncrement">The integer to increment the sorting order per SkeletonPartsRenderer to separate them.</param>
|
||||
/// <param name="baseSortingOrder">The sorting order value of the first SkeletonPartsRenderer.</param>
|
||||
/// <param name="addMinimumPartsRenderers">If set to <c>true</c>, a minimum number of SkeletonPartsRenderer GameObjects (determined by separatorSlots.Count + 1) will be added.</param>
|
||||
public static SkeletonRenderSeparator AddToSkeletonRenderer (SkeletonRenderer skeletonRenderer, int sortingLayerID = 0, int extraPartsRenderers = 0, int sortingOrderIncrement = DefaultSortingOrderIncrement, int baseSortingOrder = 0, bool addMinimumPartsRenderers = true) {
|
||||
if (skeletonRenderer == null) {
|
||||
Debug.Log("Tried to add SkeletonRenderSeparator to a null SkeletonRenderer reference.");
|
||||
@ -90,15 +98,34 @@ namespace Spine.Unity.Modules {
|
||||
var componentRenderers = srs.partsRenderers;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
var smr = SkeletonPartsRenderer.NewPartsRendererGameObject(skeletonRendererTransform, i.ToString());
|
||||
var mr = smr.MeshRenderer;
|
||||
var spr = SkeletonPartsRenderer.NewPartsRendererGameObject(skeletonRendererTransform, i.ToString());
|
||||
var mr = spr.MeshRenderer;
|
||||
mr.sortingLayerID = sortingLayerID;
|
||||
mr.sortingOrder = baseSortingOrder + (i * sortingOrderIncrement);
|
||||
componentRenderers.Add(smr);
|
||||
componentRenderers.Add(spr);
|
||||
}
|
||||
|
||||
return srs;
|
||||
}
|
||||
|
||||
/// <summary>Add a child SkeletonPartsRenderer GameObject to this SkeletonRenderSeparator.</summary>
|
||||
public void AddPartsRenderer (int sortingOrderIncrement = DefaultSortingOrderIncrement) {
|
||||
int sortingLayerID = 0;
|
||||
int sortingOrder = 0;
|
||||
if (partsRenderers.Count > 0) {
|
||||
var previous = partsRenderers[partsRenderers.Count - 1];
|
||||
var previousMeshRenderer = previous.MeshRenderer;
|
||||
sortingLayerID = previousMeshRenderer.sortingLayerID;
|
||||
sortingOrder = previousMeshRenderer.sortingOrder + sortingOrderIncrement;
|
||||
}
|
||||
|
||||
var spr = SkeletonPartsRenderer.NewPartsRendererGameObject(skeletonRenderer.transform, partsRenderers.Count.ToString());
|
||||
partsRenderers.Add(spr);
|
||||
|
||||
var mr = spr.MeshRenderer;
|
||||
mr.sortingLayerID = sortingLayerID;
|
||||
mr.sortingOrder = sortingOrder;
|
||||
}
|
||||
#endregion
|
||||
|
||||
void OnEnable () {
|
||||
|
||||
@ -133,7 +133,7 @@ namespace Spine.Unity.Modules {
|
||||
}
|
||||
|
||||
Applied = false;
|
||||
skeletonRenderer.LateUpdate();
|
||||
if (skeletonRenderer.valid) skeletonRenderer.LateUpdate();
|
||||
}
|
||||
|
||||
public void GetTexture () {
|
||||
|
||||
@ -185,6 +185,20 @@ namespace Spine.Unity {
|
||||
bone.WorldToLocal(worldPosition.x, worldPosition.y, out o.x, out o.y);
|
||||
return o;
|
||||
}
|
||||
|
||||
/// <summary>Sets the skeleton-space position of a bone.</summary>
|
||||
/// <returns>The local position in its parent bone space, or in skeleton space if it is the root bone.</returns>
|
||||
public static Vector2 SetPositionSkeletonSpace (this Bone bone, Vector2 skeletonSpacePosition) {
|
||||
if (bone.parent == null) { // root bone
|
||||
bone.SetPosition(skeletonSpacePosition);
|
||||
return skeletonSpacePosition;
|
||||
} else {
|
||||
var parent = bone.parent;
|
||||
Vector2 parentLocal = parent.WorldToLocal(skeletonSpacePosition);
|
||||
bone.SetPosition(parentLocal);
|
||||
return parentLocal;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Attachments
|
||||
|
||||
@ -61,13 +61,14 @@ namespace Spine.Unity {
|
||||
public bool useClipping = true;
|
||||
public bool immutableTriangles = false;
|
||||
public bool pmaVertexColors = true;
|
||||
/// <summary>Clears the state when this component or its GameObject is disabled. This prevents previous state from being retained when it is enabled again. When pooling your skeleton, setting this to true can be helpful.</summary>
|
||||
public bool clearStateOnDisable = false;
|
||||
public bool tintBlack = false;
|
||||
public bool singleSubmesh = false;
|
||||
|
||||
[UnityEngine.Serialization.FormerlySerializedAs("calculateNormals")]
|
||||
public bool addNormals;
|
||||
public bool calculateTangents;
|
||||
public bool addNormals = false;
|
||||
public bool calculateTangents = false;
|
||||
|
||||
public bool logErrors = false;
|
||||
|
||||
@ -134,6 +135,18 @@ namespace Spine.Unity {
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>Applies MeshGenerator settings to the SkeletonRenderer and its internal MeshGenerator.</summary>
|
||||
public void SetMeshSettings (MeshGenerator.Settings settings) {
|
||||
this.calculateTangents = settings.calculateTangents;
|
||||
this.immutableTriangles = settings.immutableTriangles;
|
||||
this.pmaVertexColors = settings.pmaVertexColors;
|
||||
this.tintBlack = settings.tintBlack;
|
||||
this.useClipping = settings.useClipping;
|
||||
this.zSpacing = settings.zSpacing;
|
||||
|
||||
this.meshGenerator.settings = settings;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public virtual void Awake () {
|
||||
@ -147,6 +160,7 @@ namespace Spine.Unity {
|
||||
|
||||
void OnDestroy () {
|
||||
rendererBuffers.Dispose();
|
||||
valid = false;
|
||||
}
|
||||
|
||||
public virtual void ClearState () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user