회원 로그인
|
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개(1/8페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
유니티 강좌 모음(영문) | 푸딩뱃살 | 60079 | 2013.08.28 12:02 | |
유니티 경고, 에러 모음 (재정리 예정) [1+1] | 푸딩뱃살 | 70762 | 2013.08.12 00:09 | |
144 | [콘솔] 오류 : ~ multicast group | 푸딩뱃살 | 1042 | 2019.09.04 00:23 |
143 | [콘솔] 오류 : NullReferenceException | 푸딩뱃살 | 1074 | 2019.07.23 00:26 |
142 | [유니티] Unite Seoul 2019 다시보기 | 푸딩뱃살 | 1240 | 2019.06.28 10:00 |
141 | [정보] GDC 2019 유니티 키노트 하이라이트 | 푸딩뱃살 | 1344 | 2019.03.26 10:45 |
140 | [유니티] Unite Seoul 2018 아젠다 & 세션 다시보기 | 푸딩뱃살 | 2719 | 2018.05.25 10:32 |
139 | [VR/AR] Stereo 360 Image and Video Capture | 푸딩뱃살 | 2031 | 2018.02.02 10:53 |
138 | [VR/AR] ARKit - Face Tracking | 푸딩뱃살 | 1772 | 2018.01.17 16:57 |
137 | [참고] ADAM :Making 참고 | 푸딩뱃살 | 2024 | 2017.12.04 11:14 |
136 | [정보] ARKit Face Tracking on iPhone X | 푸딩뱃살 | 3129 | 2017.11.08 09:59 |
135 | [VR/AR] Vive Full Body Tracking Demo | 푸딩뱃살 | 2134 | 2017.10.31 18:54 |
134 | [애셋] 유니티 모델링 - UModeler | 푸딩뱃살 | 2181 | 2017.10.20 14:02 |
133 | [유니티] 맥에서 안드로이드/자바 SDK 경로 | 푸딩뱃살 | 3268 | 2017.10.04 23:58 |
132 | [콘솔] 오류 : Fatal Error! The project is on case sensitive file | 푸딩뱃살 | 2703 | 2017.10.01 19:59 |
131 | [참고] Adam (Made with Unity) | 푸딩뱃살 | 2478 | 2017.10.01 18:33 |
130 | [정보] 보안 패치 | 푸딩뱃살 | 1913 | 2017.08.21 15:59 |
129 | [콘솔] 오류: Failed to load '.dll', ...... | 푸딩뱃살 | 2056 | 2017.08.20 00:57 |
128 | [콘솔] 오류: [VRDevice] Initialization of device oculus failed. | 푸딩뱃살 | 1909 | 2017.08.19 03:05 |
127 | [콘솔] 오류: MissingComponentException | 푸딩뱃살 | 2953 | 2017.08.19 02:05 |
126 | [콘솔] 오류: Android Manifests | 푸딩뱃살 | 2729 | 2017.08.18 03:01 |
125 | [VR/AR] Google VR SDK for Unity | 푸딩뱃살 | 3551 | 2017.08.18 00:10 |