Skip to content

Commit

Permalink
Issue #122, wrong spriteName
Browse files Browse the repository at this point in the history
setMixByName alias for setMix, deprecated
bump version 1.1.2
  • Loading branch information
ivanpopelyshev committed Oct 4, 2016
1 parent 26c115a commit d973453
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
20 changes: 14 additions & 6 deletions bin/pixi-spine.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/pixi-spine.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions bin/pixi-spine.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/pixi-spine.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pixi-spine",
"version": "1.1.1",
"version": "1.1.2",
"description": "Spine implementation for pixi v^3 and v^4",
"author": "Mat Groves",
"contributors": [
Expand Down
8 changes: 4 additions & 4 deletions src/Spine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Spine extends PIXI.Container {

if (attachment instanceof spine.RegionAttachment) {
var spriteName = attachment.region.name;
var sprite = this.createSprite(slot, attachment);
var sprite = this.createSprite(slot, attachment, spriteName);
slot.currentSprite = sprite;
slot.currentSpriteName = spriteName;
slotContainer.addChild(sprite);
Expand Down Expand Up @@ -218,7 +218,7 @@ export class Spine extends PIXI.Container {
slot.sprites[spriteName].visible = true;
}
else {
var sprite = this.createSprite(slot, attachment);
var sprite = this.createSprite(slot, attachment, spriteName);
slotContainer.addChild(sprite);
}
slot.currentSprite = slot.sprites[spriteName];
Expand Down Expand Up @@ -369,7 +369,7 @@ export class Spine extends PIXI.Container {
* @param attachment {spine.RegionAttachment} The attachment that the sprite will represent
* @private
*/
createSprite(slot: spine.Slot, attachment: spine.RegionAttachment) {
createSprite(slot: spine.Slot, attachment: spine.RegionAttachment, defName: string) {
let region = attachment.region;
if (slot.tempAttachment === attachment) {
region = slot.tempRegion;
Expand All @@ -389,7 +389,7 @@ export class Spine extends PIXI.Container {
this.setSpriteRegion(attachment, sprite, attachment.region);

slot.sprites = slot.sprites || {};
slot.sprites[attachment.name] = sprite;
slot.sprites[defName] = sprite;
return sprite;
};

Expand Down
9 changes: 9 additions & 0 deletions src/core/AnimationStateData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ export class AnimationStateData {
this.setMixWith(from, to, duration);
}

private static deprecatedWarning1: boolean = false;
setMixByName(fromName: string, toName: string, duration: number) {
if (!AnimationStateData.deprecatedWarning1) {
AnimationStateData.deprecatedWarning1 = true;
console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.");
}
this.setMix(fromName, toName, duration);
}

setMixWith (from: Animation, to: Animation, duration: number) {
if (from == null) throw new Error("from cannot be null.");
if (to == null) throw new Error("to cannot be null.");
Expand Down

0 comments on commit d973453

Please sign in to comment.