public FindAnimation ( String animationName ) : |
||
animationName | String | |
Результат |
public void SetMix(String fromName, String toName, float duration) { Animation from = skeletonData.FindAnimation(fromName); if (from == null) { throw new ArgumentException("Animation not found: " + fromName); } Animation to = skeletonData.FindAnimation(toName); if (to == null) { throw new ArgumentException("Animation not found: " + toName); } SetMix(from, to, duration); }
public void SetMix(string fromName, string toName, float duration) { Animation animation = skeletonData.FindAnimation(fromName); if (animation == null) { throw new ArgumentException("Animation not found: " + fromName); } Animation animation2 = skeletonData.FindAnimation(toName); if (animation2 == null) { throw new ArgumentException("Animation not found: " + toName); } SetMix(animation, animation2, duration); }
void Init(GameObject inst) { anim = inst.GetComponent <SpineAnimation> (); Spine.SkeletonData data = anim.skeleton.skeleton.data; Spine.Animation up = data.FindAnimation("jump_up"); Spine.Animation dn = data.FindAnimation("jump_down"); jumpFlightTime = GetJumpLength(up); fallFlightTime = GetJumpLength(dn); //Subscribe to events anim.skeleton.state.Event += HandleCustomEvent; anim.skeleton.state.Complete += OnJumpEnd; }
static int FindAnimation(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Spine.SkeletonData obj = (Spine.SkeletonData)ToLua.CheckObject <Spine.SkeletonData>(L, 1); string arg0 = ToLua.CheckString(L, 2); Spine.Animation o = obj.FindAnimation(arg0); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static AnimationClip ExtractAnimation (string name, SkeletonData skeletonData, Dictionary<int, List<string>> slotLookup, bool bakeIK, SendMessageOptions eventOptions, AnimationClip clip = null) { var animation = skeletonData.FindAnimation(name); var timelines = animation.Timelines; if (clip == null) { clip = new AnimationClip(); } else { clip.ClearCurves(); AnimationUtility.SetAnimationEvents(clip, new AnimationEvent[0]); } #if UNITY_5 #else AnimationUtility.SetAnimationType(clip, ModelImporterAnimationType.Generic); #endif clip.name = name; Skeleton skeleton = new Skeleton(skeletonData); List<int> ignoreRotateTimelineIndexes = new List<int>(); if (bakeIK) { foreach (IkConstraint i in skeleton.IkConstraints) { foreach (Bone b in i.Bones) { int index = skeleton.FindBoneIndex(b.Data.Name); ignoreRotateTimelineIndexes.Add(index); BakeBone(b, animation, clip); } } } foreach (Bone b in skeleton.Bones) { if (b.Data.InheritRotation == false) { int index = skeleton.FindBoneIndex(b.Data.Name); if (ignoreRotateTimelineIndexes.Contains(index) == false) { ignoreRotateTimelineIndexes.Add(index); BakeBone(b, animation, clip); } } } foreach (Timeline t in timelines) { skeleton.SetToSetupPose(); if (t is ScaleTimeline) { ParseScaleTimeline(skeleton, (ScaleTimeline)t, clip); } else if (t is TranslateTimeline) { ParseTranslateTimeline(skeleton, (TranslateTimeline)t, clip); } else if (t is RotateTimeline) { //bypass any rotation keys if they're going to get baked anyway to prevent localEulerAngles vs Baked collision if (ignoreRotateTimelineIndexes.Contains(((RotateTimeline)t).BoneIndex) == false) ParseRotateTimeline(skeleton, (RotateTimeline)t, clip); } else if (t is AttachmentTimeline) { ParseAttachmentTimeline(skeleton, (AttachmentTimeline)t, slotLookup, clip); } else if (t is EventTimeline) { ParseEventTimeline((EventTimeline)t, clip, eventOptions); } } var settings = AnimationUtility.GetAnimationClipSettings(clip); settings.loopTime = true; settings.stopTime = Mathf.Max(clip.length, 0.001f); SetAnimationSettings(clip, settings); clip.EnsureQuaternionContinuity(); EditorUtility.SetDirty(clip); return clip; }