diff --git a/plugins/spine/src/SpinePlugin.js b/plugins/spine/src/SpinePlugin.js index 70c5ee8a9..d51afe2ea 100644 --- a/plugins/spine/src/SpinePlugin.js +++ b/plugins/spine/src/SpinePlugin.js @@ -319,14 +319,26 @@ var SpinePlugin = new Class({ }; } + var isWebGL = this.isWebGL; + var add = function (x, y, key, animationName, loop) { + if (isWebGL) + { + this.scene.sys.renderer.pipelines.clear(); + } + var spinePlugin = this.scene.sys[pluginKey]; var spineGO = new SpineGameObject(this.scene, spinePlugin, x, y, key, animationName, loop); this.displayList.add(spineGO); this.updateList.add(spineGO); + if (isWebGL) + { + this.scene.sys.renderer.pipelines.rebind(); + } + return spineGO; }; @@ -334,6 +346,11 @@ var SpinePlugin = new Class({ { if (config === undefined) { config = {}; } + if (isWebGL) + { + this.scene.sys.renderer.pipelines.clear(); + } + var key = GetValue(config, 'key', null); var animationName = GetValue(config, 'animationName', null); var loop = GetValue(config, 'loop', false); @@ -364,6 +381,11 @@ var SpinePlugin = new Class({ spineGO.setAttachment(slotName, attachmentName); } + if (isWebGL) + { + this.scene.sys.renderer.pipelines.rebind(); + } + return spineGO.refresh(); }; @@ -654,7 +676,7 @@ var SpinePlugin = new Class({ * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the Spine json file. Used in replacement of the Loaders default XHR Settings. * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the Spine atlas file. Used in replacement of the Loaders default XHR Settings. * @param {object} [settings] - An external Settings configuration object { prefix: '' } - * + * * @return {Phaser.Loader.LoaderPlugin} The Loader instance. */ spineFileCallback: function (key, jsonURL, atlasURL, preMultipliedAlpha, jsonXhrSettings, atlasXhrSettings, settings)