diff --git a/README.md b/README.md index 46da5f325..29d0b4791 100644 --- a/README.md +++ b/README.md @@ -308,6 +308,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser * TilingSprite._renderCanvas wasn't correctly allowing for pixel rounding (thanks @ximop #2022) * Cache.addSpriteSheet didn't include default values for the `frameMax`, `margin` and `spacing` arguments (thanks @vladkens #2017 #2018) * Tilemap.shuffle was calling the deprecated Phaser.Utils.shuffle, which has now moved to Phaser.ArrayUtils.shuffle. +* Enabling a filter on a display object that had a blend mode set would cause the object to become invisible. The two cannot be combined, so when you set a filter on a display object it now automatically resets the blend mode to `NORMAL`. The same does not happen in reverse however, so if you've got a filter set and then change the blend mode it will still break. Be careful to capture this yourself (thanks @wayfu #1994) For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md). diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index e3d37dd80..e5d3fb9da 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -327,8 +327,13 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', { /** * Sets the filters for the displayObject. - * * IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. - * To remove filters simply set this property to 'null' + * IMPORTANT: This is a webGL only feature and will be ignored by the Canvas renderer. + * + * To remove filters simply set this property to 'null'. + * + * You cannot have a filter and a blend mode active at the same time. Setting a filter will reset + * this objects blend mode to NORMAL. + * * @property filters * @type Array(Filter) */ @@ -360,6 +365,11 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { } this._filters = value; + + if (this.blendMode) + { + this.blendMode = PIXI.blendModes.NORMAL; + } } }); diff --git a/src/pixi/display/Sprite.js b/src/pixi/display/Sprite.js index fd9e9a3bc..5776a5a53 100644 --- a/src/pixi/display/Sprite.js +++ b/src/pixi/display/Sprite.js @@ -87,6 +87,8 @@ PIXI.Sprite = function(texture) /** * The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode. * + * Warning: You cannot have a blend mode and a filter active on the same Sprite. Doing so will render the sprite invisible. + * * @property blendMode * @type Number * @default PIXI.blendModes.NORMAL;