From f17442578997e91104b5031d6acb805e520860bb Mon Sep 17 00:00:00 2001
From: Isaac Burns <isaacburns@gmail.com>
Date: Fri, 30 Dec 2016 12:13:48 -0600
Subject: [PATCH] don't key attachments by path

---
 demo/render-ctx2d.js |  4 ++--
 demo/render-webgl.js |  4 ++--
 spine.js             | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/demo/render-ctx2d.js b/demo/render-ctx2d.js
index e8d52d4..5551078 100644
--- a/demo/render-ctx2d.js
+++ b/demo/render-ctx2d.js
@@ -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) {
diff --git a/demo/render-webgl.js b/demo/render-webgl.js
index de09656..ea619d3 100644
--- a/demo/render-webgl.js
+++ b/demo/render-webgl.js
@@ -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) {
diff --git a/spine.js b/spine.js
index ad02507..c00a80a 100644
--- a/spine.js
+++ b/spine.js
@@ -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);
     });
   });
 }
@@ -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);
@@ -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);
