diff --git a/extensions/ccui/layouts/UILayoutCanvasRenderCmd.js b/extensions/ccui/layouts/UILayoutCanvasRenderCmd.js index 1b38960ba7..9f66e072fa 100644 --- a/extensions/ccui/layouts/UILayoutCanvasRenderCmd.js +++ b/extensions/ccui/layouts/UILayoutCanvasRenderCmd.js @@ -39,6 +39,10 @@ var proto = ccui.Layout.CanvasRenderCmd.prototype = Object.create(ccui.ProtectedNode.CanvasRenderCmd.prototype); proto.constructor = ccui.Layout.CanvasRenderCmd; + cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED, function () { + ccui.Layout.CanvasRenderCmd.prototype.widgetVisit = ccui.Widget.CanvasRenderCmd.prototype.widgetVisit; + }); + proto.visit = function(parentCmd){ var node = this._node; if (!node._visible) diff --git a/extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js b/extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js index 4d0a4f06f3..72d00fd355 100644 --- a/extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js +++ b/extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js @@ -101,9 +101,9 @@ proto.initShaderCache = function(){}; proto.setShaderProgram = function(){}; - proto.updateChildPosition = function(ctx, dis){ - //dis.visit(ctx); - cc.renderer.pushRenderCommand(dis._renderCmd); + proto.updateChildPosition = function(dis, bone){ + dis.visit(); + // cc.renderer.pushRenderCommand(dis._renderCmd); }; proto.rendering = function(ctx, scaleX, scaleY){ @@ -120,7 +120,7 @@ switch (selBone.getDisplayRenderNodeType()) { case ccs.DISPLAY_TYPE_SPRITE: if(selNode instanceof ccs.Skin) - this.updateChildPosition(ctx, selNode, selBone, alphaPremultiplied, alphaNonPremultipled); + this.updateChildPosition(selNode, selBone, alphaPremultiplied, alphaNonPremultipled); break; case ccs.DISPLAY_TYPE_ARMATURE: selNode._renderCmd.rendering(ctx, scaleX, scaleY); diff --git a/extensions/cocostudio/armature/display/CCSkin.js b/extensions/cocostudio/armature/display/CCSkin.js index f391970d25..9f75ceb42e 100644 --- a/extensions/cocostudio/armature/display/CCSkin.js +++ b/extensions/cocostudio/armature/display/CCSkin.js @@ -108,7 +108,7 @@ ccs.Skin = ccs.Sprite.extend(/** @lends ccs.Skin# */{ this.setRotationY(cc.radiansToDegrees(-skinData.skewY)); this.setPosition(skinData.x, skinData.y); - this.updateArmatureTransform(); + this._renderCmd.transform(); }, /** diff --git a/extensions/cocostudio/armature/display/CCSkinRenderCmd.js b/extensions/cocostudio/armature/display/CCSkinRenderCmd.js index 730a57e605..8ed2065784 100644 --- a/extensions/cocostudio/armature/display/CCSkinRenderCmd.js +++ b/extensions/cocostudio/armature/display/CCSkinRenderCmd.js @@ -46,18 +46,28 @@ wt.tx = t.tx * pt.a + t.ty * pt.c + pt.tx; wt.ty = t.tx * pt.b + t.ty * pt.d + pt.ty; - var lx = node._offsetPosition.x, rx = lx + node._rect.width, - by = node._offsetPosition.y, ty = by + node._rect.height; - var vertices = this._vertices; - vertices[0].x = lx * wt.a + ty * wt.c + wt.tx; // tl - vertices[0].y = lx * wt.b + ty * wt.d + wt.ty; - vertices[1].x = lx * wt.a + by * wt.c + wt.tx; // bl - vertices[1].y = lx * wt.b + by * wt.d + wt.ty; - vertices[2].x = rx * wt.a + ty * wt.c + wt.tx; // tr - vertices[2].y = rx * wt.b + ty * wt.d + wt.ty; - vertices[3].x = rx * wt.a + by * wt.c + wt.tx; // br - vertices[3].y = rx * wt.b + by * wt.d + wt.ty; + if (vertices) { + var lx = node._offsetPosition.x, rx = lx + node._rect.width, + by = node._offsetPosition.y, ty = by + node._rect.height; + + vertices[0].x = lx * wt.a + ty * wt.c + wt.tx; // tl + vertices[0].y = lx * wt.b + ty * wt.d + wt.ty; + vertices[1].x = lx * wt.a + by * wt.c + wt.tx; // bl + vertices[1].y = lx * wt.b + by * wt.d + wt.ty; + vertices[2].x = rx * wt.a + ty * wt.c + wt.tx; // tr + vertices[2].y = rx * wt.b + ty * wt.d + wt.ty; + vertices[3].x = rx * wt.a + by * wt.c + wt.tx; // br + vertices[3].y = rx * wt.b + by * wt.d + wt.ty; + } + } + else { + wt.a = t.a; + wt.b = t.b; + wt.c = t.c; + wt.d = t.d; + wt.tx = t.tx; + wt.ty = t.ty; } }, @@ -76,7 +86,6 @@ ccs.Skin.CanvasRenderCmd = function(renderable){ cc.Sprite.CanvasRenderCmd.call(this, renderable); - this._needDraw = true; }; var proto = ccs.Skin.CanvasRenderCmd.prototype = Object.create(cc.Sprite.CanvasRenderCmd.prototype);