进口fbx角色动画read-only解
原文链接:http://answers.unity3d.com/questions/8172/how-to-add-new-curves-or-animation-events-to-an-im.html
unity4.3版本号
方法1:
You can use an editor script that copies over the curves from the original imported Animation Clip into the duplicated Animation Clip.
Here is such an editor script.
- Place it in a folder called Editor, located somewhere inside the Assets folder.
- The script assumes that you have already made a duplicate of the imported clip and called it the same name but with a *copy postfix. For example, if you have an imported clip called MyAnimation,
it will search for *MyAnimation_copy*. - Select the original imported Animation Clip in the Project View.
- You can now use the menu Assets -> Transfer Clip Curves to Copy
And the script:
- using UnityEditor;
- using UnityEngine;
- using System.Collections;
- public class CurvesTransferer {
- const string duplicatePostfix = "_copy";
- [MenuItem ("Assets/Transfer Clip Curves to Copy")]
- static void CopyCurvesToDuplicate () {
- // Get selected AnimationClip
- AnimationClip imported = Selection.activeObject as AnimationClip;
- if (imported == null) {
- Debug.Log("Selected object is not an AnimationClip");
- return;
- }
- // Find path of copy
- string importedPath = AssetDatabase.GetAssetPath(imported);
- string copyPath = importedPath.Substring(0, importedPath.LastIndexOf("/"));
- copyPath += "/" + imported.name + duplicatePostfix + ".anim";
- // Get copy AnimationClip
- AnimationClip copy = AssetDatabase.LoadAssetAtPath(copyPath, typeof(AnimationClip)) as AnimationClip;
- if (copy == null) {
- Debug.Log("No copy found at "+copyPath);
- return;
- }
- // Copy curves from imported to copy
- AnimationClipCurveData[] curveDatas = AnimationUtility.GetAllCurves(imported, true);
- for (int i=0; i<curveDatas.Length; i++) {
- AnimationUtility.SetEditorCurve(
- copy,
- curveDatas[i].path,
- curveDatas[i].type,
- curveDatas[i].propertyName,
- curveDatas[i].curve
- );
- }
- Debug.Log("Copying curves into "+copy.name+" is done");
- }
- }
方法2:
There is more simple variant. This script creates a new animation file itself and makes all copying operations.
- using UnityEditor;
- using UnityEngine;
- public class CurvesTransferer
- {
- const string duplicatePostfix = "_copy";
- static void CopyClip(string importedPath, string copyPath)
- {
- AnimationClip src = AssetDatabase.LoadAssetAtPath(importedPath, typeof(AnimationClip)) as AnimationClip;
- AnimationClip newClip = new AnimationClip();
- newClip.name = src.name + duplicatePostfix;
- AssetDatabase.CreateAsset(newClip, copyPath);
- AssetDatabase.Refresh();
- }
- [MenuItem("Assets/Transfer Clip Curves to Copy")]
- static void CopyCurvesToDuplicate()
- {
- // Get selected AnimationClip
- AnimationClip imported = Selection.activeObject as AnimationClip;
- if (imported == null)
- {
- Debug.Log("Selected object is not an AnimationClip");
- return;
- }
- // Find path of copy
- string importedPath = AssetDatabase.GetAssetPath(imported);
- string copyPath = importedPath.Substring(0, importedPath.LastIndexOf("/"));
- copyPath += "/" + imported.name + duplicatePostfix + ".anim";
- CopyClip(importedPath, copyPath);
- AnimationClip copy = AssetDatabase.LoadAssetAtPath(copyPath, typeof(AnimationClip)) as AnimationClip;
- if (copy == null)
- {
- Debug.Log("No copy found at " + copyPath);
- return;
- }
- // Copy curves from imported to copy
- AnimationClipCurveData[] curveDatas = AnimationUtility.GetAllCurves(imported, true);
- for (int i = 0; i < curveDatas.Length; i++)
- {
- AnimationUtility.SetEditorCurve(
- copy,
- curveDatas[i].path,
- curveDatas[i].type,
- curveDatas[i].propertyName,
- curveDatas[i].curve
- );
- }
- Debug.Log("Copying curves into " + copy.name + " is done");
- }
- }
方法3:
Guys, I loved this script so much, I went ahead and added a couple of features.
Here is a modified version of MaDDoX's edit that includes logic for automatically placing the animations into folders.
It first uses an animations folder to contain them all and then if the animation came from an FBX file, it will use the FBX's name to create a subfolder for those animations. Hopefully, this helps y'all keep things organized.
- using UnityEditor;
- using UnityEngine;
- using System.IO;
- using System.Collections;
- public class MultipleCurvesTransferer {
- const string duplicatePostfix = "Edit";
- const string animationFolder = "Animations";
- static void CopyClip(string importedPath, string copyPath) {
- AnimationClip src = AssetDatabase.LoadAssetAtPath(importedPath, typeof(AnimationClip)) as AnimationClip;
- AnimationClip newClip = new AnimationClip();
- newClip.name = src.name + duplicatePostfix;
- AssetDatabase.CreateAsset(newClip, copyPath);
- AssetDatabase.Refresh();
- }
- [MenuItem("Assets/Transfer Multiple Clips Curves to Copy")]
- static void CopyCurvesToDuplicate()
- {
- // Get selected AnimationClip
- Object[] imported = Selection.GetFiltered(typeof(AnimationClip), SelectionMode.Unfiltered);
- if (imported.Length == 0)
- {
- Debug.LogWarning("Either no objects were selected or the objects selected were not AnimationClips.");
- return;
- }
- //If necessary, create the animations folder.
- if (Directory.Exists("Assets/" + animationFolder) == false) {
- AssetDatabase.CreateFolder("Assets", animationFolder);
- }
- foreach (AnimationClip clip in imported) {
- string importedPath = AssetDatabase.GetAssetPath(clip);
- //If the animation came from an FBX, then use the FBX name as a subfolder to contain the animations.
- string copyPath;
- if (importedPath.Contains(".fbx")) {
- //With subfolder.
- string folder = importedPath.Substring(importedPath.LastIndexOf("/") + 1, importedPath.LastIndexOf(".") - importedPath.LastIndexOf("/") - 1);
- if (!Directory.Exists("Assets/Animations/" + folder)) {
- AssetDatabase.CreateFolder("Assets/Animations", folder);
- }
- copyPath = "Assets/Animations/" + folder + "/" + clip.name + duplicatePostfix + ".anim";
- } else {
- //No Subfolder
- copyPath = "Assets/Animations/" + clip.name + duplicatePostfix + ".anim";
- }
- Debug.Log("CopyPath: " + copyPath);
- CopyClip(importedPath, copyPath);
- AnimationClip copy = AssetDatabase.LoadAssetAtPath(copyPath, typeof(AnimationClip)) as AnimationClip;
- if (copy == null)
- {
- Debug.Log("No copy found at " + copyPath);
- return;
- }
- // Copy curves from imported to copy
- AnimationClipCurveData[] curveDatas = AnimationUtility.GetAllCurves(clip, true);
- for (int i = 0; i < curveDatas.Length; i++)
- {
- AnimationUtility.SetEditorCurve(
- copy,
- curveDatas[i].path,
- curveDatas[i].type,
- curveDatas[i].propertyName,
- curveDatas[i].curve
- );
- }
- Debug.Log("Copying curves into " + copy.name + " is done");
- }
- }
- }
....
进口fbx角色动画read-only解的更多相关文章
- CSS3图片翻转动画技术详解
CSS动画非常的有趣:这种技术的美就在于,通过使用很多简单的属性,你能创建出漂亮的消隐效果.其中代表性的一种就是CSS图片翻转效果,能让你看到一张卡片的正反两面上的内容.本文就是要用最简单的方法向大家 ...
- iOS:核心动画的详解介绍:CAAnimation(抽象类)及其子类
核心动画的详解介绍:CAAnimation(抽象类) 1.核心动画基本概念 Core Animation是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍! 使用它 ...
- Android Animations 视图动画使用详解!!!
转自:http://www.open-open.com/lib/view/open1335777066015.html Android Animations 视图动画使用详解 一.动画类型 Andro ...
- pygame 笔记-3 角色动画及背景的使用
上二节,已经知道如何控制基本的运动了,但是只有一个很单调的方块,不太美观,本节学习如何加载背景图,以及角色的动画. 素材准备:(原自github) 角色动画的原理:动画都是一帧帧渲染的,比如向左走的动 ...
- POPSpring动画参数详解
POPSpring动画参数详解 效果 源码 https://github.com/YouXianMing/Animations // // POPSpringParameterController.m ...
- 【Salvation】——怪物角色动画&主角碰撞死亡动画
写在前面:这个动画功能同样也是使用JavaScript编写脚本,在Unity3D游戏引擎的环境中实现,在怪物的角色动画中,很多与人物相同,这里不再重复. 一.设计敌人 拖一个精英sprite到层次面板 ...
- Unity3D NGUI UIPlayTween(原UIButtonTween)动画事件详解
http://blog.csdn.net/asd237241291/article/details/8507817 原创文章如需转载请注明:转载自 脱莫柔Unity3D学习之旅 Unity3D引擎技术 ...
- Android基础夯实--重温动画(五)之属性动画 ObjectAnimator详解
只有一种真正的英雄主义 一.摘要 ObjectAnimator是ValueAnimator的子类,它和ValueAnimator一样,同样具有计算属性值的功能,但对比ValueAnimator,它会更 ...
- RocketMQ——角色与术语详解
原文地址:http://jaskey.github.io/blog/2016/12/15/rocketmq-concept/ RocketMQ——角色与术语详解 2016-12-15 THU 15:4 ...
随机推荐
- 修ecshop品牌筛选以LOGO图片形式显示
如何实现商品列表页属性筛选区品牌筛选以LOGO形式展示,最模板总结ecshop/'>ecshop教程入下: 1.修改 category.php 文件,将(大概215行) $sql = " ...
- git笔记之解决eclipse不能提交jar等文件的问题
今天用git托管了一个java web项目,由于是web项目,所以要上传jar文件(此项目未使用maven管理),一直使用git commit and push,就是在server上看不到jar文件上 ...
- php获取前一天,前一个月,前一年的时间
获取前一天的时间: $mytime= date("Y-m-d H:i:s", strtotime("-1 day")); 获取三天前的时间: $mytime= ...
- 修改linux系统时间、rtc时间以及时间同步
修改linux的系统时间用date -s [MMDDhhmm[[CC]YY][.ss]] 但是系统重启就会从新和硬件时钟同步. 要想永久修改系统时间,就需要如下命令:hwclock hwclock - ...
- bnu1066
hnu1066 给我们一张图,问我们摧毁边使得s和t不连通有多少种方案, 方案与方案之间不能存在相同的摧毁目标. 这是一个神奇的题目. 这题可以转为求s与t的最短路,为什么呢? 因为方案与方案之间不能 ...
- IOS开发-表视图LV3导航控制器
学到这里感觉有点难了,其实这篇文章再草稿箱里放了好久了~ 最近对于学习的热情下降了.这不行-抓紧学习走起! 在这一章节的学习中主要针对导航控制器及表视图来建立多视图的应用, 首先要了解一些概念-- 1 ...
- kb3035583
dism /online /Get-Packages /Format:Table|findstr 3035583 升级到w10补丁
- 8 shell命令之find
find命令,像cd一样经常使用.只是可能大多数时间仅仅要那么一两个參数就足够使用了.或者说,勉强够用了.可是当我们主动的去翻看一下find的手冊,会发现原来更实用的功能都没实用到. 本文结合自己的使 ...
- [文学阅读] METEOR: An Automatic Metric for MT Evaluation with Improved Correlation with Human Judgments
METEOR: An Automatic Metric for MT Evaluation with Improved Correlation with Human Judgments Satanje ...
- 关于VCL的编写 (一) 如何编写自己的VCL控件
如何编写自己的VCL控件 用过Delphi的朋友们,大概对Delphi的最喜欢Delphi的不是他的强类型的pascal语法,而是强大的VCL控件,本人就是一位VCL控件的爱好者. VCL控件的开源, ...