zoukankan      html  css  js  c++  java
  • fbx模型动画提取教程附带一个用代码提取的方法

    http://tieba.baidu.com/p/2700101781?red_tag=x3417052518

    比如说看这张图


    角色已经人形化(Humanoid)了,那它的动画可以用在其它的模型上了也就是可以共用一套模型动画了但是你有没有发现那动画是和fbx模型绑在一起的,没关系你可以选中这几个动画文件按Contrl+D就可以提取出来了,然后你可以把整个fbx模型都删掉了,新生成的动画已经不再基于fbx了,这样可以大大减小资源大小,如果是一个程序员的话你可能会想那这个实现代码是怎样的呢,于是我下午进行了测试终于弄出来了,看见图上的菜单栏多了个
    AnimationClip了吗,那个就是代码生成的了,同样选中动画剪辑然后按AnimationClip里的一个项就可以实现同样的功能了,而我写的代码动画剪辑会生成在Assets/AnimationClip文件夹下,好了贴代码
    using UnityEngine;
    using UnityEditor;
    using System.Collections;
    using System.IO;


    public class AnimationClipTool{


    [MenuItem("AnimationClip/GetFilteredtoAnim",true)]
    static bool NotGetFiltered()
    {
    return Selection.activeObject;
    }


    [MenuItem("AnimationClip/GetFilteredtoAnim")]
    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();
    }
    }

  • 相关阅读:
    php foreach的使用注意
    php数组遍历 使用foreach
    PHP strip_tags() 函数
    php nl2br() 函数
    php文件上传
    一个网站雏形
    jsp接收相同复合参数 request.getParameterValues()用法
    使用div+css制作简单导航 以及要注意问题
    Java 类与对象
    java 基础
  • 原文地址:https://www.cnblogs.com/alps/p/7931081.html
Copyright © 2011-2022 走看看