diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 1de85ae2ce..571a593e28 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -1909,12 +1909,10 @@ var Node = cc.Class({ * * @method getDisplayedOpacity * @returns {number} displayed opacity + * @deprecated please use opacity property, cascade opacity is removed * @example * var displayOpacity = node.getDisplayedOpacity(); */ - getDisplayedOpacity () { - return this._sgNode.getDisplayedOpacity(); - }, /** * !#en @@ -1927,12 +1925,10 @@ var Node = cc.Class({ * * @method getDisplayedColor * @returns {Color} + * @deprecated please use color property, cascade color is not supported * @example * var displayColor = node.getDisplayedColor(); */ - getDisplayedColor () { - return this._sgNode.getDisplayedColor(); - }, _updateLocalMatrix () { if (this._localMatDirty) { diff --git a/cocos2d/core/components/CCSpriteDistortion.js b/cocos2d/core/components/CCSpriteDistortion.js deleted file mode 100644 index d673c19e36..0000000000 --- a/cocos2d/core/components/CCSpriteDistortion.js +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** - Copyright (c) 2013-2016 Chukong Technologies Inc. - - http://www.cocos.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license - to use Cocos Creator solely to develop games on your target platforms. You shall - not use Cocos Creator software for developing other software or tools that's - used for developing games. You are not granted to publish, distribute, - sublicense, and/or sell copies of Cocos Creator. - - The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -/** - * !#en A distortion used to change the rendering of simple sprite.If will take effect after sprite component is added. - * !#zh 扭曲效果组件,用于改变SIMPLE类型sprite的渲染,只有当sprite组件已经添加后,才能起作用. - * @class SpriteDistortion - * @extends Component - * @example - * // Create a new node and add sprite components. - * var node = new cc.Node("New Sprite"); - * var sprite = node.addComponent(cc.Sprite); - * var spriteDistortion = node.addComponent(cc.SpriteDistortion); - * node.parent = this.node; - */ - -var SpriteDistortion = cc.Class({ - name: 'cc.SpriteDistortion', extends: require('./CCComponent'), - editor: CC_EDITOR && { - menu: 'i18n:MAIN_MENU.component.renderers/SpriteDistortion', - executeInEditMode: true, - requireComponent: cc.Sprite, - }, - - ctor: function() { - this._spriteSGNode = null; - }, - - properties: { - /** - * !#en Change the UV offset for distortion rendering. - * !#zh 在渲染时改变UV的整体偏移. - * @property offset - * @type {Vec2} - * @example - * distortion.offset = new cc.Vec2(0.5, 0.3);; - */ - _distortionOffset: cc.v2(0.0,0.0), - offset: { - get: function() { - return this._distortionOffset; - }, - set:function(value) { - this._distortionOffset.x = value.x; - this._distortionOffset.y = value.y; - if(this._spriteSGNode) { - this._spriteSGNode.setDistortionOffset(this._distortionOffset); - } - } - }, - - /** - * !#en Change the UV scale for distortion rendering. - * !#zh 在渲染时改变UV的寻址系数 - * @property tiling - * @type {Vec2} - * @example - * distortion.tiling = new cc.Vec2(0.5, 0.3);; - */ - _distortionTiling: cc.v2(1.0,1.0), - tiling: { - get: function() { - return this._distortionTiling; - }, - set:function(value) { - this._distortionTiling.x = value.x; - this._distortionTiling.y = value.y; - if(this._spriteSGNode) { - this._spriteSGNode.setDistortionTiling(this._distortionTiling); - } - } - }, - }, - - onEnable: function () { - var sprite = this.node.getComponent('cc.Sprite'); - var sgNode = this._spriteSGNode = sprite && sprite._sgNode; - if(this._spriteSGNode) { - sgNode.setState(cc.Scale9Sprite.state.DISTORTION); - sgNode.setDistortionOffset(this._distortionOffset); - sgNode.setDistortionTiling(this._distortionTiling); - } - }, - - onDisable: function () { - if(this._spriteSGNode) { - this._spriteSGNode.setState(cc.Scale9Sprite.state.NORMAL); - } - - this._spriteSGNode = null; - }, - -}); - -cc.SpriteDistortion = module.exports = SpriteDistortion; diff --git a/cocos2d/core/components/index.js b/cocos2d/core/components/index.js index fa3104f8ed..f1c390355a 100644 --- a/cocos2d/core/components/index.js +++ b/cocos2d/core/components/index.js @@ -46,7 +46,6 @@ var components = [ require('./editbox/CCEditBox'), // require('./CCVideoPlayer'), // require('./CCWebView'), - require('./CCSpriteDistortion'), require('./CCLabelOutline'), require('./CCRichText'), require('./CCToggleContainer'), diff --git a/cocos2d/deprecated.js b/cocos2d/deprecated.js index 6b4442da20..ad702bdb1c 100644 --- a/cocos2d/deprecated.js +++ b/cocos2d/deprecated.js @@ -442,6 +442,8 @@ if (CC_DEV) { 'setGLServerState', '_initRendererCmd', '_createRenderCmd', + 'getDisplayedOpacity', + 'getDisplayedColor', 'updateDisplayedOpacity', 'updateDisplayedColor', 'userData', diff --git a/cocos2d/tilemap/CCTiledMap.js b/cocos2d/tilemap/CCTiledMap.js index 6ae1f6ce2a..1514d770f4 100644 --- a/cocos2d/tilemap/CCTiledMap.js +++ b/cocos2d/tilemap/CCTiledMap.js @@ -430,7 +430,6 @@ let TiledMap = cc.Class({ }, _applyFile () { - let sgNode = this._sgNode; let file = this._tmxFile; let self = this; if (file) { diff --git a/modules.json b/modules.json index 3a09324285..b44e22702b 100644 --- a/modules.json +++ b/modules.json @@ -30,12 +30,6 @@ "./cocos2d/core/components/CCMask.js" ] }, - { - "name": "CCSpriteDistortion", - "entries": [ - "./cocos2d/core/components/CCSpriteDistortion.js" - ] - }, { "name": "LabelOutline", "entries": [ diff --git a/test/qunit/unit-es5/test-component-scheduler.js b/test/qunit/unit-es5/test-component-scheduler.js index 5426f979e5..96a838b146 100644 --- a/test/qunit/unit-es5/test-component-scheduler.js +++ b/test/qunit/unit-es5/test-component-scheduler.js @@ -2,7 +2,7 @@ largeModule('Component Scheduler', { setup: SetupEngine.setup, teardown: function () { cc.director._scene = new cc.Scene(); - cc.director._runningScene = cc.director._scene._sgNode; + cc.director._runningScene = cc.director._scene; SetupEngine.teardown(); } }); diff --git a/test/qunit/unit-es5/test-prefab-sync.js b/test/qunit/unit-es5/test-prefab-sync.js index 801476d987..1c8a8e482c 100644 --- a/test/qunit/unit-es5/test-prefab-sync.js +++ b/test/qunit/unit-es5/test-prefab-sync.js @@ -157,9 +157,6 @@ strictEqual(reloadedParent.active, false, 'root active should be kept'); strictEqual(reloadedParent.children.length, 1, 'children should be synced'); - // test parent sgNode - strictEqual(reloadedParent._sgNode.parent === scene._sgNode, true, 'parent of parent _sgNode should be synced'); - // test child var syncedChild = reloadedParent.children[0]; strictEqual(syncedChild.active, child.active, 'child active should be synced'); @@ -167,9 +164,6 @@ strictEqual(syncedChild.y, child.y, 'child position should be synced'); strictEqual(syncedChild.scaleY, child.scaleY, 'child scale should be synced'); strictEqual(syncedChild.parent, reloadedParent, 'prefab reference should redirect to scene node'); - - // test child sgNode - strictEqual(syncedChild._sgNode.parent === reloadedParent._sgNode, true, 'parent of child _sgNode should be synced'); }); })(); diff --git a/test/qunit/unit-es5/test-prefab.js b/test/qunit/unit-es5/test-prefab.js index e30b23fa83..2c4dc6e032 100644 --- a/test/qunit/unit-es5/test-prefab.js +++ b/test/qunit/unit-es5/test-prefab.js @@ -209,7 +209,6 @@ strictEqual(testNode.childrenCount, 2, 'Should create removed node'); var created = testNode.children[1]; - ok(created._sgNode, 'Checking created node'); var comp = created.getComponent(MyComponent); comp.resetExpect(CallbackTester.OnLoad, 'call onLoad while attaching to node'); diff --git a/test/qunit/unit-es5/test-spriteRenderer.js b/test/qunit/unit-es5/test-spriteRenderer.js index 773b31f9e3..6d57188253 100644 --- a/test/qunit/unit-es5/test-spriteRenderer.js +++ b/test/qunit/unit-es5/test-spriteRenderer.js @@ -9,7 +9,7 @@ test('basic test', function () { node.color = Color.RED; var render = node.addComponent(cc.Sprite); - deepEqual(render._sgNode.color, Color.RED, 'color set success'); + deepEqual(node.color, Color.RED, 'color set success'); var newSprite = new cc.SpriteFrame(); var texture = cc.textureUtil.loadImage(url);