@@ -37,19 +37,19 @@ const Node = Class.create(/** @lends Node.prototype */ {
37
37
/**
38
38
* traverse callback 返回值,执行后不暂停 traverse
39
39
* @memberOf Node
40
- * @type {Enum }
40
+ * @type {any }
41
41
*/
42
42
TRAVERSE_STOP_NONE ,
43
43
/**
44
44
* traverse callback 返回值,执行后暂停子元素 traverse
45
45
* @memberOf Node
46
- * @type {Enum }
46
+ * @type {any }
47
47
*/
48
48
TRAVERSE_STOP_CHILDREN ,
49
49
/**
50
50
* traverse callback 返回值,执行后暂停所有 traverse
51
51
* @memberOf Node
52
- * @type {Enum }
52
+ * @type {any }
53
53
*/
54
54
TRAVERSE_STOP_ALL
55
55
} ,
@@ -69,11 +69,24 @@ const Node = Class.create(/** @lends Node.prototype */ {
69
69
* @type {string }
70
70
*/
71
71
name : '' ,
72
+ /**
73
+ * 动画
74
+ * @type {Animation }
75
+ * @default null
76
+ */
77
+ anim : null ,
72
78
/**
73
79
* animation 查找 id
74
80
* @type {String }
81
+ * @default ''
75
82
*/
76
83
animationId : '' ,
84
+ /**
85
+ * 骨骼名称
86
+ * @type {String }
87
+ * @default ''
88
+ */
89
+ jointName : '' ,
77
90
/**
78
91
* 是否自动更新世界矩阵
79
92
* @default true
@@ -139,7 +152,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
139
152
140
153
/**
141
154
* @constructs
142
- * @param {object } params 初始化参数,所有params都会复制到实例上
155
+ * @param {object } [ params] 初始化参数,所有params都会复制到实例上
143
156
*/
144
157
constructor ( params ) {
145
158
/**
@@ -383,7 +396,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
383
396
/**
384
397
* _traverse
385
398
* @private
386
- * @param {Function(Node) } callback
399
+ * @param {NodeTraverseCallback } callback
387
400
* @param {Boolean } onlyChild
388
401
* @return {Enum } TRAVERSE_STOP_ALL, TRAVERSE_STOP_CHILDREN, TRAVERSE_STOP_NONE
389
402
*/
@@ -407,7 +420,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
407
420
} ,
408
421
/**
409
422
* 遍历当前元素的子孙元素
410
- * @param {Function(Node) } callback 每个元素都会调用这个函数处理
423
+ * @param {NodeTraverseCallback } callback 每个元素都会调用这个函数处理
411
424
* @param {Boolean } [onlyChild=false] 是否只遍历子元素
412
425
* @return {Node } this
413
426
*/
@@ -417,7 +430,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
417
430
} ,
418
431
/**
419
432
* 遍历当前元素的子孙元素(广度优先)
420
- * @param {Function(Node) } callback 每个元素都会调用这个函数处理
433
+ * @param {NodeTraverseCallback } callback 每个元素都会调用这个函数处理
421
434
* @param {Boolean } [onlyChild=false] 是否只遍历子元素
422
435
* @return {Node } this
423
436
*/
@@ -447,7 +460,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
447
460
} ,
448
461
/**
449
462
* 根据函数来获取一个子孙元素(广度优先)
450
- * @param {Function } fn 判读函数
463
+ * @param {NodeGetChildByCallback } fn 判读函数
451
464
* @return {Node|null } 返回获取到的子孙元素
452
465
*/
453
466
getChildByFnBFS ( fn ) {
@@ -500,7 +513,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
500
513
} ,
501
514
/**
502
515
* 根据函数来获取一个子孙元素
503
- * @param {Function } fn 判读函数
516
+ * @param {NodeGetChildByCallback } fn 判读函数
504
517
* @return {Node|null } 返回获取到的子孙元素
505
518
*/
506
519
getChildByFn ( fn ) {
@@ -517,7 +530,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
517
530
} ,
518
531
/**
519
532
* 根据函数来获取匹配的所有子孙元素
520
- * @param {Function } fn 判读函数
533
+ * @param {NodeGetChildByCallback } fn 判读函数
521
534
* @return {Node[] } 返回获取到的子孙元素
522
535
*/
523
536
getChildrenByFn ( fn ) {
@@ -976,7 +989,7 @@ const Node = Class.create(/** @lends Node.prototype */ {
976
989
} ,
977
990
/**
978
991
* 销毁 Node 资源
979
- * @param {WebGLRenderer } renderer
992
+ * @param {WebGLRenderer } [ renderer] stage时可以不传
980
993
* @param {Boolean } [destroyTextures=false] 是否销毁材质的贴图,默认不销毁
981
994
* @return {Node } this
982
995
*/
@@ -1045,3 +1058,18 @@ export default Node;
1045
1058
* @property {Mesh } mesh 碰撞的 mesh
1046
1059
* @property {Vector3 } point 碰撞得点
1047
1060
*/
1061
+
1062
+
1063
+ /**
1064
+ * Node traverse 回调
1065
+ * @callback NodeTraverseCallback
1066
+ * @param {Node } node
1067
+ * @return {any } Node.TRAVERSE_STOP_NONE | Node.TRAVERSE_STOP_CHILDREN | Node.TRAVERSE_STOP_ALL
1068
+ */
1069
+
1070
+ /**
1071
+ * Node getChildByCallback 回调
1072
+ * @callback NodeGetChildByCallback
1073
+ * @param {Node } node
1074
+ * @return {boolean }
1075
+ */
0 commit comments