Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions extensions/ccui/layouts/UILayoutCanvasRenderCmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion extensions/cocostudio/armature/display/CCSkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},

/**
Expand Down
33 changes: 21 additions & 12 deletions extensions/cocostudio/armature/display/CCSkinRenderCmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},

Expand All @@ -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);
Expand Down