Last active
January 24, 2016 14:54
-
-
Save tsubaki/1db5ada92966691934d9 to your computer and use it in GitHub Desktop.
選択中のアニメーションクリップからTransformに関連するカーブを消す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEditor; | |
using System.Linq; | |
public class RmoveAnimationCurve { | |
[MenuItem("Assets/RemoveTransform")] | |
static void Remove() | |
{ | |
// 選択中の項目からAnimationClip一覧を取得 | |
var clips = Selection.objects | |
.Where (c => c is AnimationClip) | |
.Select (c => (AnimationClip)c); | |
foreach (var clip in clips) { | |
// Transformに関連するBindingを取得し、消す | |
var bindings = AnimationUtility.GetCurveBindings (clip); | |
var removeBindings = bindings.Where (c => c.type == typeof(Transform)); | |
foreach (var binding in removeBindings) { | |
AnimationUtility.SetEditorCurve (clip, binding, null); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment