1 Star 6 Fork 9

陈皮皮 / Cocos 扩展 - 快速生成图片帧动画

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
scene.js 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
陈皮皮 提交于 2020-04-20 18:15 . update
module.exports = {
// 绑定动画至节点
'bind-to-node': function (event, data) {
Editor.log('[SPACG] 绑定新动画至当前选中节点...');
let nodes = this.getCurrentSelectedNodes();
if (nodes.length > 0) {
cc.loader.load({ uuid: data.uuid, url: data.path, type: 'cc.AnimationClip' }, (err, res) => {
for (let i = 0; i < nodes.length; i++) {
Editor.log('[SPACG] 绑定至 ' + nodes[i].name);
let animation = nodes[i].getComponent(cc.Animation);
if (!animation) animation = nodes[i].addComponent(cc.Animation);
animation.addClip(res);
}
});
} else {
Editor.warn('[SPACG] 当前未选中任何节点!');
}
event.reply(null, true);
},
// 获取当前选中的节点
getCurrentSelectedNodes() {
let scene = cc.director.getScene()
let uuids = Editor.Selection.curSelection('node');
let nodes = [];
for (let i = 0; i < uuids.length; i++) {
let node = scene.getChildByUuid(uuids[i]);
if (node) nodes.push(node);
}
return nodes;
}
};
JavaScript
1
https://gitee.com/ichenpipi/ccc-sf-ac-generator.git
git@gitee.com:ichenpipi/ccc-sf-ac-generator.git
ichenpipi
ccc-sf-ac-generator
Cocos 扩展 - 快速生成图片帧动画
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891