unity从模型中抽取动画文件(animation)
http://www.cnblogs.com/leng-yuye/archive/2013/01/11/2856144.html
由于模型是由第三方的软件制作的,用unity不能直接编辑模型里的动画文件(read-ony),比如为动画绑定事件,所以要把模型中的动画文件抽取出来,这样文件是可写的了。抽取动画文件的脚本非本人所写,贴在此处大家分享。---unity3d
using UnityEditor;
using UnityEngine;
using System.IO; public class CurvesTransferer
{
[MenuItem("Character Generator/Transfer Clip Curves to Copy")]
static void CopyClip()
{
foreach (Object o in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets))
{
if (!(o is GameObject)) continue;
if (!o.name.Contains("@")) continue;
GameObject animationFBX = (GameObject)o; AnimationClip srcClip = animationFBX.animation.clip;
AnimationClip newClip = new AnimationClip();
newClip.name = srcClip.name; // Create directory to store generated materials.
if (!Directory.Exists(AnimationsPath(animationFBX)))
Directory.CreateDirectory(AnimationsPath(animationFBX)); string animationPath = AnimationsPath(animationFBX) + newClip.name + ".anim"; AssetDatabase.CreateAsset(newClip, animationPath);
AssetDatabase.Refresh(); AnimationClipCurveData[] curveDatas = AnimationUtility.GetAllCurves(srcClip, true);
for (int i = 0; i < curveDatas.Length; i++)
{
AnimationUtility.SetEditorCurve(newClip, curveDatas[i].path, curveDatas[i].type, curveDatas[i].propertyName, curveDatas[i].curve);
}
}
} // Returns the path to the directory that holds the specified FBX.
static string CharacterRoot(GameObject character)
{
string root = AssetDatabase.GetAssetPath(character);
return root.Substring(0, root.LastIndexOf('/') + 1);
} // Returns the path to the directory that holds materials generated
// for the specified FBX.
public static string AnimationsPath(GameObject character)
{
return CharacterRoot(character) + "Copy Animations/";
}
}
unity从模型中抽取动画文件(animation)的更多相关文章
- Unity - 通过降低精度减少动画文件的大小
Animation是Unity中的动画文件,主要内容由一个个关键帧数据构成.通过将Unity的资源序列化方式调整为Text,就可以以文本方式查看动画文件.通过菜单项Edit -> Project ...
- unity, 查看.anim中的动画曲线(和帧)
在场景里建一个gameObject,添加一个Animation组件,将.anim文件添加到Animation组件的Animations中,然后在Animation组件面板中选中.anim,然后 菜单- ...
- css3中的动画 @keyframes animation
动画的运用比较重要.接下来我希望针对我自己学习遇到的问题,再总结一下这个属性的使用方法. 创建一个动画: @keyframes 动画名 {样式} 引用自己创建的动画: animation:动画名 时 ...
- IOS中的动画——Core Animation
一.基础动画 CABasicAnimation //初始化方式 CABasicAnimation * cabase=[CABasicAnimation animation]; //通过keyPath设 ...
- 测试Animation大型动画文件拆分播放的可行性
最近遇到一个问题,剧情动画文件大了复杂了之后,每次修改输出很麻烦,导出fbx就需要20分钟. 所以我想到了一个比较好的解决方法,在unity这边解决.把动画文件拆分成若干份,然后赋予不同的层并行播放 ...
- iOS中的动画
iOS中的动画 Core Animation Core Animation是一组非常强大的动画处理API,使用它能做出非常绚丽的动画效果,而且往往是事半功倍,使用它需要添加QuartzCore .fr ...
- iOS中的动画(转载)
iOS中的动画 最近两天没事在慢慢学习一些动画,好多东西长时间不用都给忘了,找到一篇介绍很详细的文章就粘贴了过来以备复习,原文地址:https://my.oschina.net/aofe/blog/ ...
- Silverlight & Blend动画设计系列九:动画(Animation)与视图状态管理(Visual State Manager)
Silverlight中的动画(Animation)与视图状态管理(Visual State Manager) 结合使用是非常常见的,动画用于管理对象在某段事件段内执行的动画动作,视图状态管理则用于控 ...
- Unity中的动画系统和Timeline(3) 模型和动画导入
动画导入 美工做好的模型,直接将文件夹拖进来就导入好了.导入模型后,检查模型的材质贴图等是否丢失,若丢失,根据名字补上.如果美工取名规范,一一对应的话,就很简单.如果不是,那就呵呵哒. 有的美工做的比 ...
随机推荐
- ipa验证错误问题总结
The following issues were found during validation.这个error的产生原因是因为代码中写的标示符或者方法名,与系统的命名空间冲突. 具体是哪个标示符或 ...
- EasyDarwin开源流媒体服务器性能瓶颈分析及优化方案设计
EasyDarwin现有架构介绍 EasyDarwin的现有架构对网络事件的处理是这样的,每一个Socket连接在EasyDarwin内部的对应存在形式就是一个Session,不论是RTSP服务对应的 ...
- go echo studygolang ___go_build_myT_go__1_.exe
https://github.com/studygolang/studygolang [stat]; 用户在线数据存到哪里:redis -> 表示存入 redis,这样支持多机部署; onlin ...
- In Git, there are two main ways to integrate changes from one branch into another: the merge and the rebase.
https://git-scm.com/book/en/v2/Git-Branching-Rebasing
- The Apache Thrift API client/server architecture
http://thrift.apache.org/ The Apache Thrift software framework, for scalable cross-language services ...
- DuiLib笔记之CDuiString的bug
在C/C++中,当使用==比较两个对象时,推荐的风格是将常量置前 例如 if (0 == variable) { ... } 但在DuiLib中,CDuiString存在一个bug:在用==进行比较时 ...
- appium(11)-java-client
Welcome to the Appium Java client wiki! This framework is an extension of the Selenium Java client. ...
- 03-树3 Tree Traversals Again(25 point(s)) 【Tree】
03-树3 Tree Traversals Again(25 point(s)) An inorder binary tree traversal can be implemented in a no ...
- UIBezierPath(转)
@import url(/css/cuteeditor.css); @import url(/css/cuteeditor.css); @import url(http://i.cnblogs.com ...
- SVN版本控制中.a无法提交问题
1.首先xcode是默认忽略.a文件的.改变方法如下: 1⃣️. 打开终端, 在命令行中输入: vi ~/.subversion/config 来打开配置文件.2⃣️. 然后, 在[miscell ...