diff --git a/cocos2d/core/3d/CCSkeletonAnimation.js b/cocos2d/core/3d/CCSkeletonAnimation.js index f8d5e1bca3..318020a289 100644 --- a/cocos2d/core/3d/CCSkeletonAnimation.js +++ b/cocos2d/core/3d/CCSkeletonAnimation.js @@ -41,6 +41,10 @@ var SkeletonAnimation = cc.Class({ name: 'cc.SkeletonAnimation', extends: Animation, + editor: CC_EDITOR && { + inspector: 'packages://inspector/inspectors/comps/skeleton-animation.js', + }, + properties: { _model: Model, _nodes: [cc.Node], @@ -82,6 +86,30 @@ var SkeletonAnimation = cc.Class({ let clip = state.clip; clip.init(this._nodes); return state; + }, + + searchClips: CC_EDITOR && function () { + this._clips.length = 0; + let self = this; + Editor.assetdb.queryPathByUuid(this._model._uuid, function (err, modelPath) { + if (err) return console.error(err); + + const Path = require('fire-path'); + let queryPath = Path.relative(Editor.remote.Project.path, modelPath); + queryPath = Path.join(Path.dirname(queryPath), Path.basenameNoExt(queryPath)); + queryPath = `db://${queryPath}*/*.sac`; + + Editor.assetdb.queryAssets(queryPath, null, function (err, results) { + if (results) { + for (let i = 0; i < results.length; i++) { + let clip = new SkeletonAnimationClip(); + clip._uuid = results[i].uuid; + self._clips.push(clip); + } + self._defaultClip = self._clips[0]; + } + }); + }); } }); diff --git a/cocos2d/core/3d/CCSkeletonAnimationClip.js b/cocos2d/core/3d/CCSkeletonAnimationClip.js index 73c3c6d962..d9e59c1b3a 100644 --- a/cocos2d/core/3d/CCSkeletonAnimationClip.js +++ b/cocos2d/core/3d/CCSkeletonAnimationClip.js @@ -30,7 +30,7 @@ const Model = require('./CCModel'); */ /** * !#en SkeletonAnimationClip Asset. - * !#zh 网格资源。 + * !#zh 骨骼动画剪辑。 * @class SkeletonAnimationClip * @extends AnimationClip */ diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index bb8bca9018..d5b1686c09 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -713,24 +713,6 @@ var Node = cc.Class({ * node.rotation = 90; * cc.log("Node Rotation: " + node.rotation); */ - rotation: { - get () { - return this._rotationX; - }, - set (value) { - if (this._rotationX !== value || this._rotationY !== value) { - this._rotationX = this._rotationY = value; - // Update quaternion from rotation - math.quat.fromEuler(this._quat, 0, 0, -value); - this.setLocalDirty(LocalDirtyFlag.ROTATION); - this._renderFlag |= RenderFlow.FLAG_TRANSFORM; - - if (this._eventMask & ROTATION_ON) { - this.emit(EventType.ROTATION_CHANGED); - } - } - } - }, /** * !#en The rotation as Euler angles in degrees, used in 2.5D project. @@ -2131,19 +2113,36 @@ var Node = cc.Class({ } }, - /** - * !#en Set rotation of node (along z axi). - * !#zh 设置该节点以局部坐标系 Z 轴为轴进行旋转的角度。 - * @method setRotation - * @param {Number} rotation Degree rotation value - */ - /** * !#en Get rotation of node (along z axi). * !#zh 获取该节点以局部坐标系 Z 轴为轴进行旋转的角度。 * @method getRotation * @param {Number} rotation Degree rotation value */ + getRotation () { + return this._rotationX; + }, + + + /** + * !#en Set rotation of node (along z axi). + * !#zh 设置该节点以局部坐标系 Z 轴为轴进行旋转的角度。 + * @method setRotation + * @param {Number} rotation Degree rotation value + */ + setRotation (value) { + if (this._rotationX !== value || this._rotationY !== value) { + this._rotationX = this._rotationY = value; + // Update quaternion from rotation + math.quat.fromEuler(this._quat, 0, 0, -value); + this.setLocalDirty(LocalDirtyFlag.ROTATION); + this._renderFlag |= RenderFlow.FLAG_TRANSFORM; + + if (this._eventMask & ROTATION_ON) { + this.emit(EventType.ROTATION_CHANGED); + } + } + }, /** * !#en