Skip to content

Commit 5a64324

Browse files
committed
Fix spine issues
1 parent d30a136 commit 5a64324

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@
298298
proto.uploadData = function (f32buffer, ui32buffer, vertexDataOffset) {
299299
var node = this._node, locTexture = node._texture;
300300
if (!(locTexture && locTexture._textureLoaded && node._rect.width && node._rect.height) || !this._displayedOpacity)
301-
return false;
301+
return 0;
302302

303303
// Fill in vertex data with quad information (4 vertices for sprite)
304304
var opacity = this._displayedOpacity;

extensions/spine/CCSkeleton.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,18 @@ sp.Skeleton = cc.Node.extend(/** @lends sp.Skeleton# */{
106106
init: function () {
107107
cc.Node.prototype.init.call(this);
108108
this._premultipliedAlpha = (cc._renderType === cc.game.RENDER_TYPE_WEBGL && cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA);
109+
},
110+
111+
onEnter: function () {
112+
cc.Node.prototype.onEnter.call(this);
109113
this.scheduleUpdate();
110114
},
111115

116+
onExit: function () {
117+
this.unscheduleUpdate();
118+
cc.Node.prototype.onExit.call(this);
119+
},
120+
112121
/**
113122
* Sets whether open debug slots.
114123
* @param {boolean} enable true to open, false to close.

extensions/spine/CCSkeletonCanvasRenderCmd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ proto.rendering = function (wrapper, scaleX, scaleY) {
102102
proto.updateStatus = function() {
103103
this.originUpdateStatus();
104104
this._updateCurrentRegions();
105-
this._regionFlag = _ccsg.Node.CanvasRenderCmd.RegionStatus.DirtyDouble;
106-
this._dirtyFlag &= ~_ccsg.Node._dirtyFlags.contentDirty;
105+
this._regionFlag = cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble;
106+
this._dirtyFlag &= ~cc.Node._dirtyFlags.contentDirty;
107107
};
108108

109109
proto.getLocalBB = function() {

extensions/spine/CCSkeletonWebGLRenderCmd.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ proto._uploadRegionAttachmentData = function(attachment, slot, premultipliedAlph
246246
var srcIdx = i < 4 ? i % 3 : i - 2;
247247
var vx = vertices[srcIdx * 8],
248248
vy = vertices[srcIdx * 8 + 1];
249-
var x = vx * wa + vy * wb + wx,
250-
y = vx * wc + vy * wd + wy;
249+
var x = vx * wa + vy * wc + wx,
250+
y = vx * wb + vy * wd + wy;
251251
var r = vertices[srcIdx * 8 + 2] * nodeR,
252252
g = vertices[srcIdx * 8 + 3] * nodeG,
253253
b = vertices[srcIdx * 8 + 4] * nodeB,
@@ -290,8 +290,8 @@ proto._uploadMeshAttachmentData = function(attachment, slot, premultipliedAlpha,
290290
for (var i = 0, n = vertices.length; i < n; i += 8) {
291291
var vx = vertices[i],
292292
vy = vertices[i + 1];
293-
var x = vx * wa + vy * wb + wx,
294-
y = vx * wc + vy * wd + wy;
293+
var x = vx * wa + vy * wc + wx,
294+
y = vx * wb + vy * wd + wy;
295295
var r = vertices[i + 2] * nodeR,
296296
g = vertices[i + 3] * nodeG,
297297
b = vertices[i + 4] * nodeB,

0 commit comments

Comments
 (0)