Skip to content

Commit 15908ce

Browse files
committed
getPostPipeline will now return an array of them all if there is more than one instance
1 parent 69480ef commit 15908ce

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/gameobjects/components/Pipeline.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,21 +278,25 @@ var Pipeline = {
278278
*
279279
* @param {(string|function|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline)} pipeline - The string-based name of the pipeline, or a pipeline class.
280280
*
281-
* @return {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The first Post Pipeline matching the name, or undefined if no match.
281+
* @return {(Phaser.Renderer.WebGL.Pipelines.PostFXPipeline|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[])} The Post Pipeline/s matching the name, or undefined if no match. If more than one match they are returned in an array.
282282
*/
283283
getPostPipeline: function (pipeline)
284284
{
285285
var pipelines = this.postPipelines;
286286

287+
var results = [];
288+
287289
for (var i = 0; i < pipelines.length; i++)
288290
{
289291
var instance = pipelines[i];
290292

291293
if ((typeof pipeline === 'string' && instance.name === pipeline) || instance instanceof pipeline)
292294
{
293-
return instance;
295+
results.push(instance);
294296
}
295297
}
298+
299+
return (results.length === 1) ? results[0] : results;
296300
},
297301

298302
/**

0 commit comments

Comments
 (0)