Skip to content

Commit 3647e28

Browse files
committed
Added Texture.getFrameNames which is handy for things like atlas imports or sprite sheets.
1 parent 17d6667 commit 3647e28

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

v3/src/textures/Texture.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,25 @@ Texture.prototype = {
109109
}
110110
},
111111

112+
getFrameNames: function (includeBase)
113+
{
114+
if (includeBase === undefined) { includeBase = false; }
115+
116+
var out = Object.keys(this.frames);
117+
118+
if (!includeBase)
119+
{
120+
var idx = out.indexOf('__BASE');
121+
122+
if (idx !== -1)
123+
{
124+
out.splice(idx, 1);
125+
}
126+
}
127+
128+
return out;
129+
},
130+
112131
getSourceImage: function (name)
113132
{
114133
if (name === undefined || name === null || this.frameTotal === 1)
@@ -136,7 +155,7 @@ Texture.prototype = {
136155
{
137156
this.source[i].glTextureIndex = index;
138157

139-
console.log(this.source[i].image.currentSrc, 'index = ', index);
158+
// console.log(this.source[i].image.currentSrc, 'index = ', index);
140159

141160
index++;
142161
}

0 commit comments

Comments
 (0)