Skip to content

Commit bf393b9

Browse files
committed
run success, but effect wrong
1 parent 71eac1e commit bf393b9

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

Diff for: extensions/spine/CCSkeleton.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ sp.Skeleton = cc.Node.extend(/** @lends sp.Skeleton# */{
228228
var attachment = slot.attachment;
229229
if (!attachment || !(attachment instanceof spine.RegionAttachment))
230230
continue;
231-
vertices = attachment.updateWorldVertices(slot, false);
231+
// 3.5 vertices = attachment.updateWorldVertices(slot, false);
232+
vertices = spine.Utils.setArraySize(new Array(), 8, 0);
233+
attachment.computeWorldVertices(slot.bone, vertices, 0, 8);
232234
minX = Math.min(minX, vertices[VERTEX.X1] * scaleX, vertices[VERTEX.X4] * scaleX, vertices[VERTEX.X2] * scaleX, vertices[VERTEX.X3] * scaleX);
233235
minY = Math.min(minY, vertices[VERTEX.Y1] * scaleY, vertices[VERTEX.Y4] * scaleY, vertices[VERTEX.Y2] * scaleY, vertices[VERTEX.Y3] * scaleY);
234236
maxX = Math.max(maxX, vertices[VERTEX.X1] * scaleX, vertices[VERTEX.X4] * scaleX, vertices[VERTEX.X2] * scaleX, vertices[VERTEX.X3] * scaleX);

Diff for: extensions/spine/CCSkeletonCanvasRenderCmd.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ proto.rendering = function (wrapper, scaleX, scaleY) {
8787
}
8888

8989
// Bone origins.
90+
// FIXME: point position wrong, might due to scale
9091
drawingUtil.setPointSize(4);
9192
drawingUtil.setDrawColor(0, 0, 255, 255); // Root bone is blue.
9293

@@ -114,7 +115,9 @@ proto._updateRegionAttachmentSlot = function (attachment, slot, points) {
114115
if (!points)
115116
return;
116117

117-
var vertices = attachment.updateWorldVertices(slot, false);
118+
// 3.5 var vertices = attachment.updateWorldVertices(slot, false);
119+
var vertices = spine.Utils.setArraySize(new Array(), 8, 0);
120+
attachment.computeWorldVertices(slot.bone, vertices, 0, 8);
118121
var VERTEX = spine.RegionAttachment;
119122
points.length = 0;
120123
points.push(cc.p(vertices[VERTEX.X1], vertices[VERTEX.Y1]));

Diff for: extensions/spine/CCSkeletonWebGLRenderCmd.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ proto._uploadRegionAttachmentData = function(attachment, slot, premultipliedAlph
233233
nodeG = nodeColor.g,
234234
nodeB = nodeColor.b,
235235
nodeA = this._displayedOpacity;
236-
var vertices = attachment.updateWorldVertices(slot, premultipliedAlpha);
236+
// 3.5 var vertices = attachment.updateWorldVertices(slot, premultipliedAlpha);
237+
// FIXME: lose premultipliedAlpha?
238+
var vertices = spine.Utils.setArraySize(new Array(), 8, 0);
239+
attachment.computeWorldVertices(slot.bone, vertices, 0, 8);
240+
237241
var wt = this._worldTransform,
238242
wa = wt.a, wb = wt.b, wc = wt.c, wd = wt.d,
239243
wx = wt.tx, wy = wt.ty,
@@ -280,14 +284,17 @@ proto._uploadMeshAttachmentData = function(attachment, slot, premultipliedAlpha,
280284
wx = wt.tx, wy = wt.ty,
281285
z = this._node.vertexZ;
282286
// get the vertex data
283-
var vertices = attachment.updateWorldVertices(slot, premultipliedAlpha);
287+
// 3.5 var vertices = attachment.updateWorldVertices(slot, premultipliedAlpha);
288+
var verticesLength = attachment.worldVerticesLength;
289+
var vertices = spine.Utils.setArraySize(new Array(), verticesLength, 0);
290+
attachment.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
284291
var offset = vertexDataOffset;
285292
var nodeColor = this._displayedColor;
286293
var nodeR = nodeColor.r,
287294
nodeG = nodeColor.g,
288295
nodeB = nodeColor.b,
289296
nodeA = this._displayedOpacity;
290-
for (var i = 0, n = vertices.length; i < n; i += 8) {
297+
for (var i = 0, n = vertices.length; i < n; i += 2) {
291298
var vx = vertices[i],
292299
vy = vertices[i + 1];
293300
var x = vx * wa + vy * wb + wx,

Diff for: extensions/spine/Spine.js

+3
Original file line numberDiff line numberDiff line change
@@ -6453,3 +6453,6 @@ var spine;
64536453
SwirlEffect.interpolation = new spine.PowOut(2);
64546454
spine.SwirlEffect = SwirlEffect;
64556455
})(spine || (spine = {}));
6456+
6457+
var sp = sp || {};
6458+
sp.spine = spine;

0 commit comments

Comments
 (0)