@@ -4,57 +4,53 @@ ExtArmature.name = 'UIArmature'
44ExtArmature . icon = 'app://res/control/Scale9.png'
55ExtArmature . tag = 10
66
7- ExtArmature . GenEmptyNode = function ( ) {
8- node = new ccs . Armature ( )
9- node . _className = ExtArmature . name
10- return node
7+ ExtArmature . GenEmptyNode = function ( ) {
8+ node = new ccs . Armature ( )
9+ node . _className = ExtArmature . name
10+ return node
1111}
1212
13- ExtArmature . SetBaseNodeProp = function ( node , data ) {
14- data . actionName && ( node . actionName = data . actionName )
15- data . imagePath && ( node . imagePath = data . imagePath )
16- data . plistPath && ( node . plistPath = data . plistPath )
17- data . configFilePath && ( node . configFilePath = data . configFilePath )
13+ ExtArmature . SetBaseNodeProp = function ( node , data ) {
14+ data . actionName && ( node . actionName = data . actionName )
15+ data . imagePath && ( node . imagePath = data . imagePath )
16+ data . plistPath && ( node . plistPath = data . plistPath )
17+ data . configFilePath && ( node . configFilePath = data . configFilePath )
1818}
1919
20- ExtArmature . GenNodeByData = function ( data , parent ) {
21- // data.actionName = 'skill1'
22- // data.imagePath = 'fla/skill1.png'
23- // data.plistPath = 'fla/skill1.plist'
24- // data.configFilePath = 'fla/skill1.xml'
25-
26- node = new ccs . Armature ( )
27- node . _className = ExtArmature . name
28- ExtArmature . SetBaseNodeProp ( node , data )
29- // data.ignoreSetProp = true
30- if ( data . uuid ) {
31- node . uuid = data . uuid
32- }
33- var fullImagePath = getFullPathForName ( data . imagePath )
34- var fullPlistPath = getFullPathForName ( data . plistPath )
35- var fullConfigPath = getFullPathForName ( data . configFilePath )
36- if ( ! fullImagePath || ! fullPlistPath || ! fullConfigPath || ! data . actionName ) {
37- return node
38- }
39- // cc.loader.load([fullImagePath, fullPlistPath, fullConfigPath],
40- // function (results, count, loadedCount) {
41- // if (count == loadedCount + 1) {
42- // }
43- // }, function () {
44- ccs . armatureDataManager . addArmatureFileInfo ( fullImagePath , fullPlistPath , fullConfigPath )
45- // if(!node.getParent() && parent) {
46- // parent.addChild(node)
47- // }
48- node . init ( data . actionName )
49- if ( node . getAnimation ( ) ) {
20+ ExtArmature . GenNodeByData = function ( data , parent ) {
21+ // data.actionName = 'skill1'
22+ // data.imagePath = 'fla/skill1.png'
23+ // data.plistPath = 'fla/skill1.plist'
24+ // data.configFilePath = 'fla/skill1.xml'
25+
26+ node = new ccs . Armature ( )
27+ node . _className = ExtArmature . name
28+ ExtArmature . SetBaseNodeProp ( node , data )
29+ // data.ignoreSetProp = true
30+ if ( data . uuid ) {
31+ node . uuid = data . uuid
32+ }
33+ var fullImagePath = getFullPathForName ( data . imagePath )
34+ var fullPlistPath = getFullPathForName ( data . plistPath )
35+ var fullConfigPath = getFullPathForName ( data . configFilePath )
36+ if ( ! fullImagePath || ! fullPlistPath || ! fullConfigPath || ! data . actionName ) {
37+ return node
38+ }
39+ // cc.loader.load([fullImagePath, fullPlistPath, fullConfigPath],
40+ // function (results, count, loadedCount) {
41+ // if (count == loadedCount + 1) {
42+ // }
43+ // }, function () {
44+ ccs . armatureDataManager . addArmatureFileInfo ( fullImagePath , fullPlistPath , fullConfigPath )
45+ // if(!node.getParent() && parent) {
46+ // parent.addChild(node)
47+ // }
48+ node . init ( data . actionName )
49+ if ( node . getAnimation ( ) ) {
5050 node . getAnimation ( ) . play ( 'stand' , - 1 , 1 )
51- }
51+ }
5252
53- console . log ( "parent111 = " , parent )
54- console . log ( "parent = " , node . getParent ( ) )
55- console . log ( "getNodeToParentTransform = " , node . getNodeToParentTransform ( ) )
56- console . log ( "_offsetPoint = " , node . _offsetPoint )
57- // cocosGenNodeByDataBase(data, node, parent)
53+ // cocosGenNodeByDataBase(data, node, parent)
5854 // var newNode = new ccs.Armature(data.actionName)
5955 // newNode._className = ExtArmature.name
6056 // node.uuid = data.uuid || gen_uuid()
@@ -65,133 +61,129 @@ ExtArmature.GenNodeByData = function (data, parent) {
6561 //
6662 // ExtArmature.SetBaseNodeProp(newNode, data)
6763 // })
68- return node
64+ return node
6965}
7066
71- ExtArmature . ResetPropByData = function ( control , data , parent ) {
72- if ( data . ignoreSetProp ) {
73- return
74- }
75- let node = control . _node
76- parent = parent || node . getParent ( )
77-
78- data . ignoreSetProp = true
79- data . uuid = node . uuid
80- let newNode = cocosGenNodeByData ( data , parent )
81- node . ignoreAddToParent = true
82- ReplaceNode ( node , newNode , parent )
83- control . _node = newNode
67+ ExtArmature . ResetPropByData = function ( control , data , parent ) {
68+ if ( data . ignoreSetProp ) {
69+ return
70+ }
71+ let node = control . _node
72+ parent = parent || node . getParent ( )
73+
74+ data . ignoreSetProp = true
75+ data . uuid = node . uuid
76+ let newNode = cocosGenNodeByData ( data , parent )
77+ node . ignoreAddToParent = true
78+ ReplaceNode ( node , newNode , parent )
79+ control . _node = newNode
8480}
8581
86- ExtArmature . SetNodePropByData = function ( node , data , parent ) {
87- ExtArmature . ResetPropByData ( { _node : node } , data , parent )
82+ ExtArmature . SetNodePropByData = function ( node , data , parent ) {
83+ ExtArmature . ResetPropByData ( { _node : node } , data , parent )
8884}
8985
90- ExtArmature . ExportNodeData = function ( node , data ) {
91- node . actionName && ( data . actionName = node . actionName )
92- node . imagePath && ( data . imagePath = node . imagePath )
93- node . plistPath && ( data . plistPath = node . plistPath )
94- node . configFilePath && ( data . configFilePath = node . configFilePath )
86+ ExtArmature . ExportNodeData = function ( node , data ) {
87+ node . actionName && ( data . actionName = node . actionName )
88+ node . imagePath && ( data . imagePath = node . imagePath )
89+ node . plistPath && ( data . plistPath = node . plistPath )
90+ node . configFilePath && ( data . configFilePath = node . configFilePath )
9591
96- data [ 'anchorX' ] = node . anchorX
97- data [ 'anchorY' ] = node . anchorY
92+ data [ 'anchorX' ] = node . anchorX
93+ data [ 'anchorY' ] = node . anchorY
9894
99- // data['anchorX'] = null
100- // data['anchorY'] = null
95+ // data['anchorX'] = null
96+ // data['anchorY'] = null
10197}
10298
103- ExtArmature . PropCantChange = function ( node , path , value , target ) {
104- // if(path == "anchor.x" || path == "anchor.y") {
105- // return true
106- // }
107- return false
99+ ExtArmature . PropCantChange = function ( node , path , value , target ) {
100+ // if(path == "anchor.x" || path == "anchor.y") {
101+ // return true
102+ // }
103+ return false
108104}
109105
110- ExtArmature . SetPropChange = function ( control , path , value , target ) {
111- let data = cocosExportNodeData ( control . _node , { uuid : true } )
112- data [ path ] = value
113- ExtArmature . ResetPropByData ( control , data )
106+ ExtArmature . SetPropChange = function ( control , path , value , target ) {
107+ let data = cocosExportNodeData ( control . _node , { uuid : true } )
108+ data [ path ] = value
109+ ExtArmature . ResetPropByData ( control , data )
114110}
115111
116112ExtArmature . GetLoadImages = function ( data ) {
117- return [ data [ 'imagePath' ] , data [ 'plistPath' ] , data [ 'configFilePath' ] ]
118- }
113+ return [ data [ 'imagePath' ] , data [ 'plistPath' ] , data [ 'configFilePath' ] ]
114+ }
119115
120- ExtArmature . NodifyPropChange = function ( control ) {
121- SetNodifyPropChange ( control )
116+ ExtArmature . NodifyPropChange = function ( control ) {
117+ SetNodifyPropChange ( control )
122118}
123119
124- function ExtArmatureData ( node ) {
125- this . _node = node
120+ function ExtArmatureData ( node ) {
121+ this . _node = node
126122}
127123
128124ExtArmatureData . prototype = {
129- __displayName__ : 'ExtArmature' ,
130- __type__ : 'ccui.ExtArmature' ,
131-
132- get actionName ( ) {
133- return {
134- path : 'actionName' ,
135- type : 'asset' ,
136- name : 'actionName' ,
137- attrs : {
138- } ,
139- value : this . _node . actionName
140- }
141- } ,
142-
143- get imagePath ( ) {
144- return {
145- path : 'imagePath' ,
146- type : 'asset' ,
147- name : 'imagePath' ,
148- attrs : {
149- } ,
150- value : this . _node . imagePath
151- }
152- } ,
153-
154- get plistPath ( ) {
155- return {
156- path : 'plistPath' ,
157- type : 'asset' ,
158- name : 'plistPath' ,
159- attrs : {
160- } ,
161- value : this . _node . plistPath
162- }
163- } ,
164-
165- get configFilePath ( ) {
166- return {
167- path : 'configFilePath' ,
168- type : 'asset' ,
169- name : 'configFilePath' ,
170- attrs : {
171- } ,
172- value : this . _node . configFilePath
125+ __displayName__ : 'ExtArmature' ,
126+ __type__ : 'ccui.ExtArmature' ,
127+
128+ get actionName ( ) {
129+ return {
130+ path : 'actionName' ,
131+ type : 'asset' ,
132+ name : 'actionName' ,
133+ attrs : { } ,
134+ value : this . _node . actionName
135+ }
136+ } ,
137+
138+ get imagePath ( ) {
139+ return {
140+ path : 'imagePath' ,
141+ type : 'asset' ,
142+ name : 'imagePath' ,
143+ attrs : { } ,
144+ value : this . _node . imagePath
145+ }
146+ } ,
147+
148+ get plistPath ( ) {
149+ return {
150+ path : 'plistPath' ,
151+ type : 'asset' ,
152+ name : 'plistPath' ,
153+ attrs : { } ,
154+ value : this . _node . plistPath
155+ }
156+ } ,
157+
158+ get configFilePath ( ) {
159+ return {
160+ path : 'configFilePath' ,
161+ type : 'asset' ,
162+ name : 'configFilePath' ,
163+ attrs : { } ,
164+ value : this . _node . configFilePath
165+ }
166+ } ,
167+
168+ get __props__ ( ) {
169+ return [
170+ this . actionName ,
171+ this . imagePath ,
172+ this . plistPath ,
173+ this . configFilePath
174+ ]
173175 }
174- } ,
175-
176- get __props__ ( ) {
177- return [
178- this . actionName ,
179- this . imagePath ,
180- this . plistPath ,
181- this . configFilePath
182- ]
183- }
184176}
185177
186178ExtArmature . ExtArmatureData = ExtArmatureData
187179
188- ExtArmature . PropComps = function ( node ) {
189- let datas = [ new WidgetData ( node ) ]
190- datas . push ( new TouchData ( node ) )
191- datas . push ( new ExtArmatureData ( node ) )
192- return datas
180+ ExtArmature . PropComps = function ( node ) {
181+ let datas = [ new WidgetData ( node ) ]
182+ datas . push ( new TouchData ( node ) )
183+ datas . push ( new ExtArmatureData ( node ) )
184+ return datas
193185}
194186
195187module . exports = ExtArmature
196188
197- RegisterExtNodeControl ( ExtArmature . name , ExtArmature )
189+ RegisterExtNodeControl ( ExtArmature . name , ExtArmature )
0 commit comments