creator最强场景预览插件

简介: creator最强场景预览插件

作为开发或者设计的你,是否经常遇到

spine里面的骨骼在场景编辑器没法动,怎么办

龙骨不能实时预览怎么办

还必须跑起游戏才能看动画,这样效率我的天太低了,

有没有一劳永逸的办法

有了最强场景编辑器一切都不是问题

经过笔者的研究,查询spine源码,把eidtor的return去掉,但是发现spine可以预览,但是巨卡无比,经过多次研究,终于完美流畅解决

想了一下,也不是很难的东西,分享出来给大家

pr地址:

https://github.com/cocos-creator/engine/pull/7923/files 

记得gulp build编译,pr还在审核能不能过,看各位大佬了,反正对游戏运行没有任何影响


如何编译引擎?

看官方这里 https://docs.cocos.com/creator/manual/zh/advanced-topics/engine-customization.html?h=引擎 12

gulp build 后 用这个定制

if (CC_EDITOR) {
    // 重写update方法 达到在编辑模式下 自动播放动画的功能
    sp.Skeleton.prototype['update'] = function (dt) {
        if (CC_EDITOR) {
            cc['engine']._animatingInEditMode = 1;
            cc['engine'].animatingInEditMode = 1;
        }
        if (this.paused) return;
        dt *= this.timeScale * sp['timeScale'];
        if (this.isAnimationCached()) {
            // Cache mode and has animation queue.
            if (this._isAniComplete) {
                if (this._animationQueue.length === 0 && !this._headAniInfo) {
                    let frameCache = this._frameCache;
                    if (frameCache && frameCache.isInvalid()) {
                        frameCache.updateToFrame();
                        let frames = frameCache.frames;
                        this._curFrame = frames[frames.length - 1];
                    }
                    return;
                }
                if (!this._headAniInfo) {
                    this._headAniInfo = this._animationQueue.shift();
                }
                this._accTime += dt;
                if (this._accTime > this._headAniInfo.delay) {
                    let aniInfo = this._headAniInfo;
                    this._headAniInfo = null;
                    this.setAnimation(0, aniInfo.animationName, aniInfo.loop);
                }
                return;
            }
            this._updateCache(dt);
        } else {
            this._updateRealtime(dt);
        }
    }
}


相关文章
|
6月前
|
Web App开发 JSON JavaScript
WebGL简易教程(十五):加载gltf模型
WebGL简易教程(十五):加载gltf模型
211 1
|
9月前
|
UED
CocosCreator 面试题(十八)Cocos Creator 图集打包有什么意义 ,我们一般在项目里面怎么规划
CocosCreator 面试题(十八)Cocos Creator 图集打包有什么意义 ,我们一般在项目里面怎么规划
296 0
|
存储 C# 图形学
代码解析 C# 引用类型还是值类型
代码解析 C# 引用类型还是值类型
|
缓存 中间件 atlas
Cocos Creator3.8 项目实战(八)2D UI DrawCall优化详解(上)
Cocos Creator3.8 项目实战(八)2D UI DrawCall优化详解(上)
505 0
|
存储 编译器 图形学
使用Unity在材质球上实现绘画:详细解释每一行Shader代码!
使用Unity在材质球上实现绘画:详细解释每一行Shader代码!
217 0
|
前端开发 图形学 异构计算
Unity优化之Drawcall
Unity优化之Drawcall
586 0
|
人工智能 运维 Cloud Native
贝斯平携手阿里云赋能企业数字化转型
Bespin Global与阿里云共建的《Landing Zone联合解决方案》经过实践证明的方法论与丰富的业务上云最佳实践经验,为客户提供专业科学的业务上云咨询+实施服务,量身定制云上适配解决方案。
贝斯平携手阿里云赋能企业数字化转型
|
人工智能 自然语言处理 算法
如何用好Chatgpt
如何用好Chatgpt
137 1
|
图形学 索引 内存技术
creator源码阅读系列之第三篇(2)
creator源码阅读系列之第三篇
135 0

热门文章

最新文章