• [Unity菜鸟] FBX模型动画提取


          角色已经人形化(Humanoid)了,那它的动画可以用在其它的模型上了也就是可以共用一套模型动画了,但是你有没有发现那动画是和fbx模型绑在一起的,没关系你可以选中这几个动画文件按Contrl+D就可以提取出来了,然后你可以把整个fbx模型都删掉了,新生成的动画已经不再基于fbx了,这样可以大大减小资源大小。

          如果是一个程序员的话你可能会想那这个实现代码是怎样的呢

    using UnityEngine;
    using UnityEditor;
    using System.Collections;
    using System.IO;
    
    public class AnimationClipTool
    {
        [MenuItem("AnimationClip/GetFilteredtoAnim &1", true)]
        static bool NotGetFiltered()
        {
            return Selection.activeObject;
        }
    
        [MenuItem("AnimationClip/GetFilteredtoAnim &1")]
        static void GetFiltered()
        {
            string targetPath = Application.dataPath + "/AnimationClip";
            if (!Directory.Exists(targetPath))
            {
                Directory.CreateDirectory(targetPath);
            }
            Object[] SelectionAsset = Selection.GetFiltered(typeof(Object), SelectionMode.Unfiltered);
            Debug.Log(SelectionAsset.Length);
            foreach (Object Asset in SelectionAsset)
            {
                AnimationClip newClip = new AnimationClip();
                EditorUtility.CopySerialized(Asset, newClip);
                AssetDatabase.CreateAsset(newClip, "Assets/AnimationClip/" + Asset.name + ".anim");
            }
            AssetDatabase.Refresh();
        }
    }
    

      选中动画剪辑,点击菜单栏上AnimationClip/GetFilteredtoAnim选项(快捷键ALT+1),代码生成的动画剪辑会出现在Assets/AnimationClip文件夹下

          (如果选择的不是动画剪辑而是其他资源文件,会出现 Source and Destination Types do not match 错误)

         

    参考链接 http://tieba.baidu.com/p/2700101781

  • 相关阅读:
    软件设计项目进展18 2019/9/4
    软件设计项目进展17 2019/9/4
    软件设计项目进展16 2019/9/3
    将mcomaster配置以apache运行
    mcollective的web控制台---mcomaster搭建
    check_mk自定义监控增加性能数据图形展示
    check_mk自定义监控实践之powershell
    搭建puppet dashboard及遇到的问题
    通过MCollective实现puppet向windows的推送
    利用puppet管理配置IIS
  • 原文地址:https://www.cnblogs.com/code1992/p/3812555.html
Copyright © 2020-2023  润新知