Skip to content

Commit

Permalink
don't key attachments by path
Browse files Browse the repository at this point in the history
  • Loading branch information
flyover committed Dec 30, 2016
1 parent 3d59869 commit f174425
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions demo/render-ctx2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ RenderCtx2D.prototype.drawPose = function(spine_pose, atlas_data) {
return;
}

var site = atlas_data && atlas_data.sites[attachment_key];
var site = atlas_data && atlas_data.sites[attachment.path || attachment.name || attachment_key];
var page = site && site.page;
var image_key = (page && page.name) || attachment_key;
var image_key = (page && page.name) || attachment.path || attachment.name || attachment_key;
var image = render.images[image_key];

if (!image || !image.complete) {
Expand Down
4 changes: 2 additions & 2 deletions demo/render-webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,9 @@ RenderWebGL.prototype.drawPose = function(spine_pose, atlas_data) {
return;
}

var site = atlas_data && atlas_data.sites[attachment_key];
var site = atlas_data && atlas_data.sites[attachment.path || attachment.name || attachment_key];
var page = site && site.page;
var image_key = (page && page.name) || attachment_key;
var image_key = (page && page.name) || attachment.path || attachment.name || attachment_key;
var gl_texture = render.gl_textures[image_key];

if (!gl_texture) {
Expand Down
10 changes: 5 additions & 5 deletions spine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ spine.Skin.prototype.iterateAttachments = function(callback) {
var skin_slot = skin.slots[slot_key];
skin_slot.attachment_keys.forEach(function(attachment_key) {
var attachment = skin_slot.attachments[attachment_key];
callback(slot_key, skin_slot, attachment.path || attachment.name || attachment_key, attachment);
callback(slot_key, skin_slot, attachment.name || attachment_key, attachment);
});
});
}
Expand Down Expand Up @@ -3697,9 +3697,9 @@ spine.Data.prototype.iterateAttachments = function(skin_key, callback) {
var data_slot = data.slots[slot_key];
var skin_slot = skin && (skin.slots[slot_key] || default_skin.slots[slot_key]);
var attachment = skin_slot && skin_slot.attachments[data_slot.attachment_key];
var attachment_key = (attachment && (attachment.path || attachment.name)) || data_slot.attachment_key;
var attachment_key = (attachment && attachment.name) || data_slot.attachment_key;
if (attachment && ((attachment.type === 'linkedmesh') || (attachment.type === 'weightedlinkedmesh'))) {
attachment_key = attachment && (attachment.path || attachment.parent_key);
attachment_key = attachment && attachment.parent_key;
attachment = skin_slot && skin_slot.attachments[attachment_key];
}
callback(slot_key, data_slot, skin_slot, attachment_key, attachment);
Expand Down Expand Up @@ -4441,9 +4441,9 @@ spine.Pose.prototype.iterateAttachments = function(callback) {
var pose_slot = pose.slots[slot_key];
var skin_slot = skin && (skin.slots[slot_key] || default_skin.slots[slot_key]);
var attachment = skin_slot && skin_slot.attachments[pose_slot.attachment_key];
var attachment_key = (attachment && (attachment.path || attachment.name)) || pose_slot.attachment_key;
var attachment_key = (attachment && attachment.name) || pose_slot.attachment_key;
if (attachment && ((attachment.type === 'linkedmesh') || (attachment.type === 'weightedlinkedmesh'))) {
attachment_key = attachment && (attachment.path || attachment.parent_key);
attachment_key = attachment && attachment.parent_key;
attachment = skin_slot && skin_slot.attachments[attachment_key];
}
callback(slot_key, pose_slot, skin_slot, attachment_key, attachment);
Expand Down

0 comments on commit f174425

Please sign in to comment.