change name of nameIndices to slotNameIndices to reflect the contents better

This commit is contained in:
Matias 2013-06-13 14:04:47 +03:00
parent c5016f0da0
commit d270c5e8da
3 changed files with 5 additions and 5 deletions

View File

@ -99,7 +99,7 @@ function Skeleton.new (skeletonData)
function self:getAttachment (slotName, attachmentName) function self:getAttachment (slotName, attachmentName)
if not slotName then error("slotName cannot be nil.", 2) end if not slotName then error("slotName cannot be nil.", 2) end
if not attachmentName then error("attachmentName cannot be nil.", 2) end if not attachmentName then error("attachmentName cannot be nil.", 2) end
local slotIndex = skeletonData.nameIndices[slotName] local slotIndex = skeletonData.slotNameIndices[slotName]
if slotIndex == -1 then error("Slot not found: " .. slotName, 2) end if slotIndex == -1 then error("Slot not found: " .. slotName, 2) end
if self.skin then if self.skin then
local attachment = self.skin:getAttachment(slotIndex, attachmentName) local attachment = self.skin:getAttachment(slotIndex, attachmentName)

View File

@ -28,7 +28,7 @@ function SkeletonData.new ()
local self = { local self = {
bones = {}, bones = {},
slots = {}, slots = {},
nameIndices = {}, slotNameIndices = {},
skins = {}, skins = {},
animations = {} animations = {}
} }

View File

@ -103,7 +103,7 @@ function SkeletonJson.new (attachmentLoader)
slotData.attachmentName = slotMap["attachment"] slotData.attachmentName = slotMap["attachment"]
table.insert(skeletonData.slots, slotData) table.insert(skeletonData.slots, slotData)
skeletonData.nameIndices[slotData.name] = #skeletonData.slots skeletonData.slotNameIndices[slotData.name] = #skeletonData.slots
end end
end end
@ -113,7 +113,7 @@ function SkeletonJson.new (attachmentLoader)
for skinName,skinMap in pairs(map) do for skinName,skinMap in pairs(map) do
local skin = Skin.new(skinName) local skin = Skin.new(skinName)
for slotName,slotMap in pairs(skinMap) do for slotName,slotMap in pairs(skinMap) do
local slotIndex = skeletonData.nameIndices[slotName] local slotIndex = skeletonData.slotNameIndices[slotName]
for attachmentName,attachmentMap in pairs(slotMap) do for attachmentName,attachmentMap in pairs(slotMap) do
local attachment = readAttachment(attachmentName, attachmentMap, self.scale) local attachment = readAttachment(attachmentName, attachmentMap, self.scale)
if attachment then if attachment then
@ -213,7 +213,7 @@ function SkeletonJson.new (attachmentLoader)
local slotsMap = map["slots"] local slotsMap = map["slots"]
if slotsMap then if slotsMap then
for slotName,timelineMap in pairs(slotsMap) do for slotName,timelineMap in pairs(slotsMap) do
local slotIndex = skeletonData.nameIndices[slotName] local slotIndex = skeletonData.slotNameIndices[slotName]
for timelineName,values in pairs(timelineMap) do for timelineName,values in pairs(timelineMap) do
if timelineName == TIMELINE_COLOR then if timelineName == TIMELINE_COLOR then