Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active January 24, 2016 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/1db5ada92966691934d9 to your computer and use it in GitHub Desktop.
Save tsubaki/1db5ada92966691934d9 to your computer and use it in GitHub Desktop.
選択中のアニメーションクリップからTransformに関連するカーブを消す
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