Skip to content

Commit c3a7ea5

Browse files
committed
Merge pull request cocos2d#1773 from VisualSJ/develop-3.0
Fixed a bug that ant. Variable name changed
2 parents 78bcb2b + e2667b7 commit c3a7ea5

19 files changed

+455
-454
lines changed

extensions/cocostudio/armature/CCArmature.js

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,32 @@
3737
* @property {ccs.ColliderFilter} colliderFilter - <@writeonly> The collider filter of the armature
3838
*/
3939
ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
40-
animation:null,
41-
armatureData:null,
42-
batchNode:null,
43-
name:"",
44-
_textureAtlas:null,
45-
_parentBone:null,
46-
_boneDic:null,
47-
_topBoneList:null,
48-
_armatureIndexDic:null,
49-
_offsetPoint:null,
50-
version:0,
51-
_armatureTransformDirty:true,
52-
_body:null,
53-
_textureAtlasDic:null,
54-
_blendFunc:null,
55-
_className:"Armature",
56-
57-
/**
58-
* Create a armature node.
59-
* @constructor
60-
* @param {String} name
61-
* @param {ccs.Bone} parentBone
62-
* @example
63-
* var armature = new ccs.Armature();
64-
*/
65-
ctor:function (name, parentBone) {
40+
animation: null,
41+
armatureData: null,
42+
batchNode: null,
43+
name: "",
44+
_textureAtlas: null,
45+
_parentBone: null,
46+
_boneDic: null,
47+
_topBoneList: null,
48+
_armatureIndexDic: null,
49+
_offsetPoint: null,
50+
version: 0,
51+
_armatureTransformDirty: true,
52+
_body: null,
53+
_textureAtlasDic: null,
54+
_blendFunc: null,
55+
_className: "Armature",
56+
57+
/**
58+
* Create a armature node.
59+
* @constructor
60+
* @param {String} name
61+
* @param {ccs.Bone} parentBone
62+
* @example
63+
* var armature = new ccs.Armature();
64+
*/
65+
ctor: function (name, parentBone) {
6666
cc.NodeRGBA.prototype.ctor.call(this);
6767
this.animation = null;
6868
this.armatureData = null;
@@ -80,7 +80,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
8080
this._textureAtlasDic = null;
8181
this._blendFunc = null;
8282

83-
parentBone && ccs.Armature.prototype.init.call(this, name, parentBone);
83+
parentBone && ccs.Armature.prototype.init.call(this, name, parentBone);
8484
},
8585

8686
/**
@@ -89,7 +89,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
8989
* @param {ccs.Bone} parentBone
9090
* @return {Boolean}
9191
*/
92-
init:function (name, parentBone) {
92+
init: function (name, parentBone) {
9393
cc.NodeRGBA.prototype.init.call(this);
9494
if (parentBone) {
9595
this._parentBone = parentBone;
@@ -161,11 +161,11 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
161161
this.setCascadeColorEnabled(true);
162162
return true;
163163
},
164-
onEnter:function(){
164+
onEnter: function () {
165165
cc.NodeRGBA.prototype.onEnter.call(this);
166166
this.scheduleUpdate();
167167
},
168-
onExit:function(){
168+
onExit: function () {
169169
cc.NodeRGBA.prototype.onExit.call(this);
170170
this.unscheduleUpdate();
171171
},
@@ -174,7 +174,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
174174
* @param {String} boneName
175175
* @return {ccs.Bone}
176176
*/
177-
createBone:function (boneName) {
177+
createBone: function (boneName) {
178178
var existedBone = this.getBone(boneName);
179179
if (existedBone) {
180180
return existedBone;
@@ -201,7 +201,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
201201
* @param {ccs.Bone} bone
202202
* @param {String} parentName
203203
*/
204-
addBone:function (bone, parentName) {
204+
addBone: function (bone, parentName) {
205205
if (!bone) {
206206
cc.log("Argument must be non-nil");
207207
return;
@@ -233,7 +233,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
233233
* @param {ccs.Bone} bone
234234
* @param {Boolean} recursion
235235
*/
236-
removeBone:function (bone, recursion) {
236+
removeBone: function (bone, recursion) {
237237
if (!bone) {
238238
cc.log("bone must be added to the bone dictionary!");
239239
return;
@@ -251,7 +251,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
251251
* @param {String} name
252252
* @return {ccs.Bone}
253253
*/
254-
getBone:function (name) {
254+
getBone: function (name) {
255255
return this._boneDic[name];
256256
},
257257

@@ -260,13 +260,13 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
260260
* @param {ccs.Bone} bone
261261
* @param {String} parentName
262262
*/
263-
changeBoneParent:function (bone, parentName) {
263+
changeBoneParent: function (bone, parentName) {
264264
if (!bone) {
265265
cc.log("bone must be added to the bone dictionary!");
266266
return;
267267
}
268268
var parentBone = bone.getParentBone();
269-
if(parentBone){
269+
if (parentBone) {
270270
cc.arrayRemoveObject(parentBone.getChildrenBone(), bone);
271271
bone.setParentBone(null);
272272
}
@@ -275,8 +275,8 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
275275
var boneParent = this._boneDic[parentName];
276276
if (boneParent) {
277277
boneParent.addChildBone(bone);
278-
cc.arrayRemoveObject(this._topBoneList,bone);
279-
}else{
278+
cc.arrayRemoveObject(this._topBoneList, bone);
279+
} else {
280280
this._topBoneList.push(bone);
281281
}
282282
}
@@ -286,14 +286,14 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
286286
* Get CCArmature's bone dictionary
287287
* @return {Object}
288288
*/
289-
getBoneDic:function () {
289+
getBoneDic: function () {
290290
return this._boneDic;
291291
},
292292

293293
/**
294294
* Set contentSize and Calculate anchor point.
295295
*/
296-
updateOffsetPoint:function () {
296+
updateOffsetPoint: function () {
297297
// Set contentsize and Calculate anchor point.
298298
var rect = this.boundingBox();
299299
this.setContentSize(rect);
@@ -305,7 +305,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
305305
}
306306
},
307307

308-
update:function (dt) {
308+
update: function (dt) {
309309
this.animation.update(dt);
310310
var locTopBoneList = this._topBoneList;
311311
for (var i = 0; i < locTopBoneList.length; i++) {
@@ -317,7 +317,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
317317

318318
nodeToParentTransform: null,
319319

320-
_nodeToParentTransformForWebGL:function () {
320+
_nodeToParentTransformForWebGL: function () {
321321
if (this._transformDirty) {
322322
this._armatureTransformDirty = true;
323323
// Translate values
@@ -359,13 +359,13 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
359359

360360
// Build Transform Matrix
361361
// Adjusted transform calculation for rotational skew
362-
var t = {a:cy * scx, b:sy * scx, c:-sx * scy, d:cx * scy, tx:x, ty:y};
362+
var t = {a: cy * scx, b: sy * scx, c: -sx * scy, d: cx * scy, tx: x, ty: y};
363363

364364
// XXX: Try to inline skew
365365
// If skew is needed, apply skew and then anchor point
366366
if (needsSkewMatrix) {
367-
t = cc.AffineTransformConcat({a:1.0, b:Math.tan(cc.degreesToRadians(this._skewY)),
368-
c:Math.tan(cc.degreesToRadians(this._skewX)), d:1.0, tx:0.0, ty:0.0}, t);
367+
t = cc.AffineTransformConcat({a: 1.0, b: Math.tan(cc.degreesToRadians(this._skewY)),
368+
c: Math.tan(cc.degreesToRadians(this._skewX)), d: 1.0, tx: 0.0, ty: 0.0}, t);
369369

370370
// adjust anchor point
371371
if (apx !== 0 || apy !== 0)
@@ -382,9 +382,9 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
382382
return this._transform;
383383
},
384384

385-
_nodeToParentTransformForCanvas:function () {
385+
_nodeToParentTransformForCanvas: function () {
386386
if (!this._transform)
387-
this._transform = {a:1, b:0, c:0, d:1, tx:0, ty:0};
387+
this._transform = {a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0};
388388
if (this._transformDirty) {
389389
this._armatureTransformDirty = true;
390390
var t = this._transform;// quick reference
@@ -461,7 +461,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
461461
return this._transform;
462462
},
463463

464-
draw:function () {
464+
draw: function () {
465465
//cc.g_NumberOfDraws++;
466466
},
467467

@@ -485,7 +485,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
485485
* This boundingBox will calculate all bones' boundingBox every time
486486
* @return {cc.rect}
487487
*/
488-
boundingBox:function () {
488+
boundingBox: function () {
489489
var minx = 0, miny = 0, maxx = 0, maxy = 0;
490490
var first = true;
491491
var boundingBox = cc.rect(0, 0, 0, 0);
@@ -531,7 +531,7 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
531531
return null;
532532
},
533533

534-
getTexureAtlasWithTexture:function(){
534+
getTexureAtlasWithTexture: function () {
535535
return null;
536536
},
537537

@@ -579,88 +579,88 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
579579
* return parent bone
580580
* @returns {ccs.Bone}
581581
*/
582-
getParentBone:function(){
582+
getParentBone: function () {
583583
return this._parentBone;
584584
},
585585

586586
/**
587587
* armatureAnimation getter
588588
* @return {ccs.ArmatureAnimation}
589589
*/
590-
getAnimation:function () {
590+
getAnimation: function () {
591591
return this.animation;
592592
},
593593

594594
/**
595595
* armatureAnimation setter
596596
* @param {ccs.ArmatureAnimation} animation
597597
*/
598-
setAnimation:function (animation) {
598+
setAnimation: function (animation) {
599599
this.animation = animation;
600600
},
601601

602602
/**
603603
* armatureData getter
604604
* @return {ccs.ArmatureData}
605605
*/
606-
getArmatureData:function () {
606+
getArmatureData: function () {
607607
return this.armatureData;
608608
},
609609

610610
/**
611611
* armatureData setter
612612
* @param {ccs.ArmatureData} armatureData
613613
*/
614-
setArmatureData:function (armatureData) {
614+
setArmatureData: function (armatureData) {
615615
this.armatureData = armatureData;
616616
},
617-
getName:function () {
617+
getName: function () {
618618
return this.name;
619619
},
620-
setName:function (name) {
620+
setName: function (name) {
621621
this.name = name;
622622
},
623-
getBatchNode:function () {
623+
getBatchNode: function () {
624624
return this.batchNode;
625625
},
626-
setBatchNode:function (batchNode) {
626+
setBatchNode: function (batchNode) {
627627
this.batchNode = batchNode;
628628
},
629629

630630
/**
631631
* version getter
632632
* @returns {Number}
633633
*/
634-
getVersion:function () {
634+
getVersion: function () {
635635
return this.version;
636636
},
637637

638638
/**
639639
* version setter
640640
* @param {Number} version
641641
*/
642-
setVersion:function (version) {
642+
setVersion: function (version) {
643643
this.version = version;
644644
},
645645

646646
/**
647647
* armatureTransformDirty getter
648648
* @returns {Boolean}
649649
*/
650-
getArmatureTransformDirty:function () {
650+
getArmatureTransformDirty: function () {
651651
return this._armatureTransformDirty;
652652
},
653-
getBody:function(){
653+
getBody: function () {
654654
return this._body;
655655
},
656656

657-
setBody:function(body){
657+
setBody: function (body) {
658658
if (this._body == body)
659659
return;
660660

661661
this._body = body;
662662
this._body.data = this;
663-
var child,displayObject;
663+
var child, displayObject;
664664
for (var i = 0; i < this._children.length; i++) {
665665
child = this._children[i];
666666
if (child instanceof ccs.Bone) {
@@ -674,24 +674,24 @@ ccs.Armature = ccs.NodeRGBA.extend(/** @lends ccs.Armature# */{
674674
}
675675
}
676676
},
677-
getShapeList:function(){
678-
if(this._body)
677+
getShapeList: function () {
678+
if (this._body)
679679
return this._body.shapeList;
680680
return [];
681681
}
682682

683683
});
684684

685685

686-
if(cc._renderType == cc._RENDER_TYPE_WEBGL){
686+
if (cc._renderType == cc._RENDER_TYPE_WEBGL) {
687687
//WebGL
688688
ccs.Armature.prototype.nodeToParentTransform = ccs.Armature.prototype._nodeToParentTransformForWebGL;
689-
}else{
689+
} else {
690690
//Canvas
691691
ccs.Armature.prototype.nodeToParentTransform = ccs.Armature.prototype._nodeToParentTransformForCanvas;
692692
}
693693

694-
window._p = ccs.Armature.prototype;
694+
var _p = ccs.Armature.prototype;
695695

696696
/** @expose */
697697
_p.parentBone;
@@ -703,7 +703,7 @@ cc.defineGetterSetter(_p, "body", _p.getBody, _p.setBody);
703703
_p.colliderFilter;
704704
cc.defineGetterSetter(_p, "colliderFilter", null, _p.setColliderFilter);
705705

706-
delete window._p;
706+
_p = null;
707707

708708
/**
709709
* allocates and initializes a armature.

0 commit comments

Comments
 (0)