회원 로그인
|
3D파일 Animation의 Read-Only
3D파일 Animation의 Read-Only
*.max, *.ma, *.fbx와 같은 3D파일을 유니티에서 임포트가 가능한데 애니메이션이 들어간 리소스 같은 경우 Read-Only 표시와 함께 애니메이션 키 수정을 비롯한 애니메이션 이벤트를 줄 수가 없어 당황 스럽다.(리소스를 수정/저장 못한다는건 당연하겠지만...)
<Edit/Duplicate 또는 단축키 Ctrl+D로 복제된 *.anim 파일들>
해결책으로 임포트한 3D 리소스의 애니메이션들을 복제(duplicate, ctrl+d)
Animator창 State/Motion에 anim들을 다시 연결하면 된다.
anim 복제하기 스크립트(CurvesTransferer)라는 것이 있는데 제대로 작동이 안되는 듯하다.(아래)
스크립트도 오래전 것이라 유니티에서 사용안하는 api가 있다.
anim 복제하기 스크립트(CurvesTransferer)라는 것이 있는데 제대로 작동이 안되는 듯하다.(아래)
스크립트도 오래전 것이라 유니티에서 사용안하는 api가 있다.
using UnityEditor; using UnityEngine; using System.IO; public class MultipleCurvesTransferer { const string duplicatePostfix = "_copy"; 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); Debug.Log("clipPath: " + importedPath); //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") || 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( clip, EditorCurveBinding.FloatCurve(curveDatas[i].path, curveDatas[i].type, curveDatas[i].propertyName), curveDatas[i].curve ); // AnimationUtility.SetEditorCurve( // copy, // curveDatas[i].path, // curveDatas[i].type, // curveDatas[i].propertyName, // curveDatas[i].curve // ); } Debug.Log("Copying curves into " + copy.name + " is done"); } } }스크립트 출처> http://answers.unity3d.com/questions/8172/how-to-add-new-curves-or-animation-events-to-an-im.html
참고> http://devkorea.co.kr/bbs/board.php?bo_table=m03_qna&wr_id=6261
http://answers.unity3d.com/questions/187907/how-to-add-keyframes-on-imported-read-only-animati.html
댓글 0개
| 엮인글 0개
146개(2/8페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
유니티 강좌 모음(영문) | 푸딩뱃살 | 60266 | 2013.08.28 12:02 | |
유니티 경고, 에러 모음 (재정리 예정) [1+1] | 푸딩뱃살 | 71051 | 2013.08.12 00:09 | |
124 | [스트립트] VR Cardboard 토글 | 푸딩뱃살 | 2662 | 2017.08.17 17:36 |
123 | [참고] Unitypackage Unpacker [1+1] | 푸딩뱃살 | 4031 | 2017.08.08 17:02 |
122 | [유니티] Unite 2017 서울 - 발표 자료 링크 | 푸딩뱃살 | 5439 | 2017.05.31 10:13 |
121 | [유니티] Terrain Setting - Resolution | 푸딩뱃살 | 2773 | 2017.05.25 00:12 |
120 | [유니티] Unite 2013 - Real-time facial animation with Mixamo and | 푸딩뱃살 | 2965 | 2017.05.22 18:12 |
119 | [유니티] Unite 2016 서울 다시보기 | 푸딩뱃살 | 2612 | 2017.05.18 09:49 |
118 | [유니티] 유니티 프로그램 빌드 과정 | 푸딩뱃살 | 2547 | 2017.03.26 14:32 |
117 | [VR/AR] Google Cardboard VR (GVR) 임포트 시 | 푸딩뱃살 | 2143 | 2017.03.19 21:05 |
116 | [유니티] 맥os 안드로이드 SDK와 JDK 경로 | 푸딩뱃살 | 2202 | 2017.03.09 11:44 |
115 | [유니티] Failed to compile resuources with the following paramet | 푸딩뱃살 | 4459 | 2017.03.04 10:20 |
>> | [유니티] 3D파일 Animation의 Read-Only | 푸딩뱃살 | 6879 | 2016.07.22 15:13 |
113 | [스트립트] List를 사용한 코루틴 모두 실행 | 푸딩뱃살 | 3713 | 2016.04.28 01:17 |
112 | [유니티] 특정 Scene에서 Sprite 깨짐 현상 | 푸딩뱃살 | 8626 | 2016.03.03 01:27 |
111 | [유니티] 구글 플레이 서비스 에러: CommandInvokationFailure | 푸딩뱃살 | 13772 | 2016.02.29 18:51 |
110 | [스트립트] 해상도 구하기 | 푸딩뱃살 | 3969 | 2016.02.28 23:13 |
109 | [스트립트] Android (반)자동 Setting | 푸딩뱃살 | 4131 | 2016.02.04 15:24 |
108 | [스트립트] Invoke() / InvokeRepeating() | 푸딩뱃살 | 7348 | 2016.02.04 14:45 |
107 | [스트립트] DontDestroyOnLoad() | 푸딩뱃살 | 6693 | 2016.01.29 13:20 |
106 | [스트립트] 버젼 관리 | 푸딩뱃살 | 3321 | 2016.01.20 15:48 |
105 | [유니티] 서버를 이용한 inApp 프로세스 | 푸딩뱃살 | 3986 | 2016.01.12 12:32 |