protected virtual void InitVarDefs(SpriterAnimation animation) { if (animation.Meta != null && animation.Meta.Varlines != null && animation.Meta.Varlines.Length > 0) { foreach (SpriterVarline varline in animation.Meta.Varlines) { SpriterVarDef varDefs = animation.Entity.Variables[varline.Def]; Init(varDefs, varline); } } foreach (SpriterTimeline timeline in animation.Timelines) { if (timeline.Meta == null || timeline.Meta.Varlines == null || timeline.Meta.Varlines.Length == 0) { continue; } SpriterObjectInfo objInfo = animation.Entity.ObjectInfos.First(o => o.Name == timeline.Name); foreach (SpriterVarline varline in timeline.Meta.Varlines) { SpriterVarDef varDef = objInfo.Variables[varline.Def]; Init(varDef, varline); } } }
public virtual void tweenBones(SpriterAnimation animation) { foreach (SpriterBone key in bonesToTween.Keys) { SpriterBone toTween = key; SpriterKeyFrame frame = animation.frames[bonesToTween[key]]; long time = frame.getTime(); SpriterKeyFrame currentFrame = animation.getPreviousFrameForBone (toTween, time); SpriterKeyFrame nextFrame = animation.getNextFrameFor (toTween, currentFrame, 1); if (nextFrame != currentFrame) { SpriterBone bone1 = currentFrame.getBoneFor(toTween ); SpriterBone bone2 = nextFrame.getBoneFor(toTween); this.interpolateAbstractObject(toTween, bone1, bone2, currentFrame.getTime(), nextFrame .getTime(), time); } SpriterBone[] bones = new SpriterBone [frame.getBones().Length + 1]; for (int i = 0; i < bones.Length - 1; i++) { bones[i] = frame.getBones()[i]; } bones[bones.Length - 1] = toTween; frame.setBones(bones); } }
/// <summary> /// Sets the entity for this player instance. /// The animation will be switched to the first one of the new entity. </summary> /// <param name="value"> the new entity </param> /// <exception cref="SpriterException"> if the entity is <code>null</code> </exception> public void SetEntity(Entity value) { if (value == null) { throw new SpriterException("entity can not be null!"); } this.Entity = value; int maxAnims = value.SpriterAnimationWithMostTimelines.Timelines(); TweenedKeys = new Timeline.Key[maxAnims]; UnmappedTweenedKeys = new Timeline.Key[maxAnims]; for (int i = 0; i < maxAnims; i++) { Timeline.Key key = new Timeline.Key(i); Timeline.Key keyU = new Timeline.Key(i); key.Object = new Object(new Point(0, 0)); keyU.Object = new Object(new Point(0, 0)); TweenedKeys[i] = key; UnmappedTweenedKeys[i] = keyU; this.objToTimeline[keyU.Object] = keyU; } this.tempTweenedKeys = TweenedKeys; this.tempUnmappedTweenedKeys = UnmappedTweenedKeys; this.Animation = value.GetAnimation(0); }
/// <summary> /// Sets the animation of this player. </summary> /// <param name="animation"> the new animation </param> /// <exception cref="SpriterException"> if the animation is <code>null</code> or the current animation is not a member of the current set entity </exception> public void SetAnimation(SpriterAnimation value) { SpriterAnimation prevAnim = this.Animation; if (value == this.Animation) { return; } if (value == null) { throw new SpriterException("animation can not be null!"); } if (!this.Entity.ContainsAnimation(value) && value.Id != -1) { throw new SpriterException("animation has to be in the same entity as the current set one!"); } if (value != this.Animation) { Time = 0; } this.Animation = value; int tempTime = this.Time; this.Time = 0; this.Update(); this.Time = tempTime; if (OnAnimationChanged != null) { OnAnimationChanged(prevAnim, value); } }
public virtual void tweenObjects(SpriterAnimation animation) { foreach (SpriterObject key in objectsToTween.Keys) { SpriterObject toTween = key; SpriterKeyFrame frame = animation.frames[objectsToTween[key]]; long time = frame.getTime(); SpriterKeyFrame currentFrame = animation.getPreviousFrameForObject (toTween, time); SpriterKeyFrame nextFrame = animation.getNextFrameFor (toTween, currentFrame, 1); if (nextFrame != currentFrame) { SpriterObject object1 = currentFrame.getObjectFor (toTween); SpriterObject object2 = nextFrame.getObjectFor(toTween ); this.interpolateSpriterObject(toTween, object1, object2, currentFrame.getTime(), nextFrame.getTime(), time); } SpriterObject[] objects = new SpriterObject [frame.getObjects().Length + 1]; for (int i = 0; i < objects.Length - 1; i++) { objects[i] = frame.getObjects()[i]; } objects[objects.Length - 1] = toTween; frame.setObjects(objects); } }
private void LoadAnimations(ContentReader input, Entity entity, int animationCount) { for (int i = 0; i < animationCount; i++) { // i on id string name = input.ReadString(); int length = input.ReadInt32(); bool looping = input.ReadBoolean(); int mainlineKeysCount = input.ReadInt32(); int timelineCount = input.ReadInt32(); SpriterAnimation anim = new SpriterAnimation( new Mainline(mainlineKeysCount), i, name, length, looping, timelineCount ); entity.AddAnimation(anim); LoadMainlineKeys(input, anim.Mainline, mainlineKeysCount); LoadTimelines(input, anim, entity, timelineCount); anim.Prepare(); } }
private static int GetDrawablesCount(SpriterAnimation animation, SpriterMainlineKey key) { int drawablesCount = 0; foreach (SpriterObjectRef obj in key.ObjectRefs) { SpriterTimeline timeline = animation.Timelines[obj.TimelineId]; if (timeline.ObjectType == SpriterObjectType.Sprite) { ++drawablesCount; } else if (timeline.ObjectType == SpriterObjectType.Entity) { Spriter spriter = animation.Entity.Spriter; HashSet <SpriterAnimation> animations = new HashSet <SpriterAnimation>(); foreach (SpriterTimelineKey timelineKey in timeline.Keys) { SpriterObject spriterObject = timelineKey.ObjectInfo; SpriterAnimation newAnim = spriter.Entities[spriterObject.EntityId].Animations[spriterObject.AnimationId]; if (!animations.Contains(newAnim)) { animations.Add(newAnim); } } IEnumerable <int> drawableCount = animations.Select <SpriterAnimation, int>(GetDrawablesCount); drawablesCount += drawableCount.Max(); } } return(drawablesCount); }
public override FrameData GetFrameData(float time, float deltaTime, float factor, SpriterAnimation first, SpriterAnimation second = null) { if (second != null) return base.GetFrameData(time, deltaTime, factor, first, second); FrameData[] animData = data[first.Name]; int index = (int)(time / first.Length * animData.Length); if (index == animData.Length) index = animData.Length - 1; return animData[index]; }
private static int GetDrawablesCount(SpriterAnimation animation) { int drawablesCount = 0; foreach (SpriterMainlineKey key in animation.MainlineKeys) { int countForKey = GetDrawablesCount(animation, key); drawablesCount = Math.Max(drawablesCount, countForKey); } return(drawablesCount); }
public virtual FrameMetadata GetFrameMetadata(float time, float deltaTime, float factor, SpriterAnimation first, SpriterAnimation second = null) { metadata.Clear(); if (second == null) { SpriterProcessor.UpdateFrameMetadata(metadata, first, time, deltaTime); } else { SpriterProcessor.GetFrameMetadata(metadata, first, second, time, deltaTime, factor); } return metadata; }
private void LoadTimelines(ContentReader input, SpriterAnimation anim, Entity entity, int count) { for (int id = 0; id < count; id++) { string name = input.ReadString(); string objtype = input.ReadString(); int keyCount = input.ReadInt32(); Entity.ObjectType type = SpriterUtils.GetObjectInfoFor(objtype); Entity.ObjectInfo info = entity.GetInfo(name); if (info == null) { info = new Entity.ObjectInfo(name, type, new Dimension(0f, 0f), new List <FileReference>()); } Timeline timeline = new Timeline(id, name, info, keyCount); anim.AddTimeline(timeline); LoadTimelineKeys(input, timeline, keyCount); } }
private static void InitInfos(SpriterAnimation animation) { if (animation.Timelines == null) { animation.Timelines = new SpriterTimeline[0]; } var infos = from t in animation.Timelines from k in t.Keys let o = k.ObjectInfo where o != null && (float.IsNaN(o.PivotX) || float.IsNaN(o.PivotY)) select o; foreach (SpriterObject info in infos) { SpriterFile file = animation.Entity.Spriter.Folders[info.FolderId].Files[info.FileId]; info.PivotX = file.PivotX; info.PivotY = file.PivotY; } }
public virtual FrameMetadata GetFrameMetadata(float time, float deltaTime, float factor, SpriterAnimation first, SpriterAnimation second = null) { metadata.Clear(); if (second == null) { SpriterProcessor.UpdateFrameMetadata(metadata, first, time, deltaTime); } else { SpriterProcessor.GetFrameMetadata(metadata, first, second, time, deltaTime, factor); } return(metadata); }
/// <summary> /// Returns the pre-calculated FrameData or newly calculated in case of blending. /// </summary> public override FrameData GetFrameData(float time, float deltaTime, float factor, SpriterAnimation first, SpriterAnimation second = null) { if (Data == null || second != null) { return(base.GetFrameData(time, deltaTime, factor, first, second)); } FrameData[] animData = Data[first.Name]; int index = (int)(time / first.Length * animData.Length); if (index >= animData.Length) { index = animData.Length - 1; } return(animData[index]); }
public virtual FrameData GetFrameData(float time, float deltaTime, float factor, SpriterAnimation first, SpriterAnimation second = null) { return(second == null?Calculator.GetFrameData(first, time, deltaTime) : Calculator.GetFrameData(first, second, time, deltaTime, factor)); }
private void SetObject(SpriterAnimation anim, Transform characterRoot, bool lastFrame, float currentTime, float frameRate, Dictionary<string, AnimationCurve>[] curves, List<Component> processedSprites, ISpriterTimelineBone obj1, Dictionary<int, Transform> bones, Dictionary<int, Vector2> scales, SpriterMainlineBoneBase boneBase = null, SpriterMainlineObjectBase obj = null) { // Find the sprite object SpriterTimelineKey spriterTimelineKey = null; bool isTransient = false; string timelineName = null; int id = -1; var mainlineObjectRef = obj as SpriterMainlineObjectRef; var mainlineObject = obj as SpriterMainlineObject; if (mainlineObjectRef != null) { SpriterTimeline spriterTimeline = anim.timelines.Find(timeline => mainlineObjectRef.timeline == timeline.ID); spriterTimelineKey = spriterTimeline.keys.Find(key => key.ID == mainlineObjectRef.key); timelineName = spriterTimeline.name; id = mainlineObjectRef.ID; } if (mainlineObject != null) { timelineName = mainlineObject.name; id = mainlineObject.ID; isTransient = true; } var boneRef = boneBase as SpriterMainlineBoneRef; var bone = boneBase as SpriterMainlineBone; if (boneRef != null) { SpriterTimeline spriterTimeline = anim.timelines.Find(timeline => boneRef.timeline == timeline.ID); spriterTimelineKey = spriterTimeline.keys.Find(key => key.ID == boneRef.key); timelineName = spriterTimeline.name; id = boneRef.ID; isTransient = false; } if (bone != null) { timelineName = "trans_bone_"; id = bone.ID; isTransient = true; } //UISprite uiSprite = FindSpriteObject(characterRoot, obj1, timelineName, id); //var uiSprite = colorHelper.GetComponent<UISprite>(); int parent = -1; if (obj != null) parent = obj.parent; else if (boneRef != null) parent = boneRef.parent; else if (bone != null) parent = bone.parent; Transform parentT = characterRoot; Vector2 localScale = Vector2.one; if (parent != -1) { if (!bones.TryGetValue(parent, out parentT)) Debug.LogError("Parent " + parent + " does not exist"); scales.TryGetValue(parent, out localScale); } Transform animObj = FindObject(parentT, timelineName, id); Transform animSpriteObj = null; SpriterNGUIColorHelper colorHelper = null; animObj.localPosition = new Vector2(obj1.position.x * localScale.x, obj1.position.y * localScale.y); localScale.x *= obj1.scale.x; localScale.y *= obj1.scale.y; if (boneBase != null) { bones.Add(boneBase.ID, animObj); scales.Add(boneBase.ID, localScale); } var animKeyName = GetRelativeName(animObj, characterRoot); string animSpriteKeyName = null; //animObj.localScale = obj1.scale; var sprObj = obj1 as ISpriterTimelineObject; if (sprObj != null) { System.Diagnostics.Debug.Assert(obj != null, "obj != null"); colorHelper = FindChildSpriteObject(animObj, (ISpriterTimelineObject)obj1); animSpriteObj = colorHelper.transform; animSpriteKeyName = GetRelativeName(colorHelper, characterRoot); //set this here so that bones don't get screwed with animObj.localScale = localScale; Vector2 paddingTL; Vector2 paddingBR; Vector2 size; GetSpriteInfo(colorHelper, out paddingTL, out paddingBR, out size); float pW = paddingTL.x + paddingBR.x; float pH = paddingTL.y + paddingBR.y; float w = sprObj.targetFile.width - pW; float h = sprObj.targetFile.height - pH; Vector2 pivot = sprObj.pivot; //check if the pivot is the default if ((pivot - new Vector2(0, 1)).sqrMagnitude < 0.001f) { pivot = sprObj.targetFile.pivot; } colorHelper.transform.localRotation = Quaternion.identity; colorHelper.transform.localPosition = new Vector2(-pivot.x*sprObj.targetFile.width, (1 - pivot.y)*sprObj.targetFile.height) + new Vector2(paddingTL.x, -paddingTL.y); colorHelper.transform.localScale = new Vector3(w, h, 1); colorHelper.color = obj1.color; colorHelper.depth = obj.zIndex; } if (spriterTimelineKey != null) { float lastRot = animObj.localEulerAngles.z; float targetRot = ((obj1.angle + 180)%360) - 180; //TODO: fix rotation if (targetRot - 180 > lastRot) targetRot -= 360; if (targetRot + 180 < lastRot) targetRot += 360; /*if (spriterTimelineKey.spin != -1) { //clockwise while (targetRot < lastRot - 5) targetRot += 360; } else { //counterclockwise while (targetRot > lastRot + 5) targetRot -= 360; }*/ animObj.localRotation = Quaternion.Euler(0, 0, targetRot); } else animObj.localRotation = Quaternion.Euler(0, 0, ((obj1.angle + 180)%360) - 180); AnimationCurve currentCurveXPos; AnimationCurve currentCurveYPos; //AnimationCurve currentCurveZPos; AnimationCurve currentCurveXScale; AnimationCurve currentCurveYScale; //AnimationCurve currentCurveZScale; AnimationCurve currentCurveXRot; AnimationCurve currentCurveYRot; AnimationCurve currentCurveZRot; AnimationCurve currentCurveWRot; AnimationCurve currentCurveColorR = null; AnimationCurve currentCurveColorG = null; AnimationCurve currentCurveColorB = null; AnimationCurve currentCurveSpriteXPos = null; AnimationCurve currentCurveSpriteYPos = null; if (!curves[0].ContainsKey(animKeyName)) { // New object, create new animation curves currentCurveXPos = new AnimationCurve(); currentCurveYPos = new AnimationCurve(); //currentCurveZPos = new AnimationCurve(); currentCurveXScale = new AnimationCurve(); currentCurveYScale = new AnimationCurve(); //currentCurveZScale = new AnimationCurve(); currentCurveXRot = new AnimationCurve(); currentCurveYRot = new AnimationCurve(); currentCurveZRot = new AnimationCurve(); currentCurveWRot = new AnimationCurve(); curves[0].Add(animKeyName, currentCurveXPos); curves[1].Add(animKeyName, currentCurveYPos); //curves[2].Add(animKeyName, currentCurveZPos); curves[3].Add(animKeyName, currentCurveXScale); curves[4].Add(animKeyName, currentCurveYScale); //curves[5].Add(animKeyName, currentCurveZScale); curves[6].Add(animKeyName, currentCurveXRot); curves[7].Add(animKeyName, currentCurveYRot); curves[8].Add(animKeyName, currentCurveZRot); curves[9].Add(animKeyName, currentCurveWRot); } else { // Get the current animation curves currentCurveXPos = curves[0][animKeyName]; currentCurveYPos = curves[1][animKeyName]; //currentCurveZPos = curves[2][animKeyName]; currentCurveXScale = curves[3][animKeyName]; currentCurveYScale = curves[4][animKeyName]; //currentCurveZScale = curves[5][animKeyName]; currentCurveXRot = curves[6][animKeyName]; currentCurveYRot = curves[7][animKeyName]; currentCurveZRot = curves[8][animKeyName]; currentCurveWRot = curves[9][animKeyName]; } if (animSpriteKeyName != null) { if (!curves[0].ContainsKey(animSpriteKeyName)) { currentCurveSpriteXPos = new AnimationCurve(); currentCurveSpriteYPos = new AnimationCurve(); currentCurveColorR = new AnimationCurve(); currentCurveColorG = new AnimationCurve(); currentCurveColorB = new AnimationCurve(); curves[0].Add(animSpriteKeyName, currentCurveSpriteXPos); curves[1].Add(animSpriteKeyName, currentCurveSpriteYPos); curves[11].Add(animSpriteKeyName, currentCurveColorR); curves[12].Add(animSpriteKeyName, currentCurveColorG); curves[13].Add(animSpriteKeyName, currentCurveColorB); } else { currentCurveSpriteXPos = curves[0][animSpriteKeyName]; currentCurveSpriteYPos = curves[1][animSpriteKeyName]; currentCurveColorR = curves[11][animSpriteKeyName]; currentCurveColorG = curves[12][animSpriteKeyName]; currentCurveColorB = curves[13][animSpriteKeyName]; } AnimationCurve currentCurveToggle; if (!curves[10].ContainsKey(animSpriteKeyName)) { currentCurveToggle = new AnimationCurve(); curves[10].Add(animSpriteKeyName, currentCurveToggle); if (currentTime > 0) currentCurveToggle.AddKey(SteppedKeyframe(0, 0)); } else { currentCurveToggle = curves[10][animSpriteKeyName]; } int keyPos = currentCurveToggle.AddKey(SteppedKeyframe(currentTime, colorHelper.color.a)); if (keyPos > 0) { // Check if sprite was previously turned off if (currentCurveToggle.keys[keyPos - 1].value < 0.01f) { currentCurveToggle.AddKey(SteppedKeyframe(currentTime - (.001f/frameRate), 0)); } } } if (isTransient) { DuplicateLast(currentTime, frameRate, currentCurveXPos); DuplicateLast(currentTime, frameRate, currentCurveYPos); DuplicateLast(currentTime, frameRate, currentCurveXScale); DuplicateLast(currentTime, frameRate, currentCurveYScale); DuplicateLast(currentTime, frameRate, currentCurveXRot); DuplicateLast(currentTime, frameRate, currentCurveYRot); DuplicateLast(currentTime, frameRate, currentCurveZRot); DuplicateLast(currentTime, frameRate, currentCurveWRot); } currentCurveXPos.AddKey(LinearKeyframe(currentTime, animObj.localPosition.x)); currentCurveYPos.AddKey(LinearKeyframe(currentTime, animObj.localPosition.y)); currentCurveXScale.AddKey(LinearKeyframe(currentTime, animObj.localScale.x)); currentCurveYScale.AddKey(LinearKeyframe(currentTime, animObj.localScale.y)); currentCurveXRot.AddKey(LinearKeyframe(currentTime, animObj.localRotation.x)); currentCurveYRot.AddKey(LinearKeyframe(currentTime, animObj.localRotation.y)); currentCurveZRot.AddKey(LinearKeyframe(currentTime, animObj.localRotation.z)); currentCurveWRot.AddKey(LinearKeyframe(currentTime, animObj.localRotation.w)); if (animSpriteKeyName != null) { if (isTransient) { DuplicateLast(currentTime, frameRate, currentCurveColorR); DuplicateLast(currentTime, frameRate, currentCurveColorG); DuplicateLast(currentTime, frameRate, currentCurveColorB); DuplicateLast(currentTime, frameRate, currentCurveSpriteXPos); DuplicateLast(currentTime, frameRate, currentCurveSpriteYPos); } currentCurveColorR.AddKey(LinearKeyframe(currentTime, colorHelper.color.r)); currentCurveColorG.AddKey(LinearKeyframe(currentTime, colorHelper.color.g)); currentCurveColorB.AddKey(LinearKeyframe(currentTime, colorHelper.color.b)); currentCurveSpriteXPos.AddKey(LinearKeyframe(currentTime, animSpriteObj.localPosition.x)); currentCurveSpriteYPos.AddKey(LinearKeyframe(currentTime, animSpriteObj.localPosition.y)); } if (colorHelper != null) { colorHelper.color = lastFrame ? obj1.color : new Color(obj1.color.r, obj1.color.g, obj1.color.b, 0); // Mark as processed processedSprites.Add(colorHelper); } }
private void RecordFrame(SpriterAnimation anim, Transform characterRoot, SpriterMainlineKey keyframe, SpriterMainlineKey endKey, float currentTime, float frameRate, Dictionary<string, AnimationCurve>[] curves) { // Go through each sprite, keeping track of what is processed var processedSprites = new List<Component>(); var bones = new Dictionary<int, Transform>(); var scales = new Dictionary<int, Vector2>(); foreach (SpriterMainlineBoneBase obj in keyframe.hierarchy.bones) { var obj1 = (obj as ISpriterTimelineBone); if (obj1 == null && obj is SpriterMainlineBoneRef) obj1 = ((SpriterMainlineBoneRef)obj).target; if (obj1 == null) { Debug.LogError("Unknown type"); continue; } SetObject(anim, characterRoot, keyframe == endKey, currentTime, frameRate, curves, processedSprites, obj1, bones, scales, obj); } //foreach(ISpriterSprite sprite in frame.sprites) foreach(SpriterMainlineObjectBase obj in keyframe.objects) { var obj1 = (obj as ISpriterTimelineObject); if (obj1 == null && obj is SpriterMainlineObjectRef) obj1 = ((SpriterMainlineObjectRef)obj).target; if (obj1 == null) { Debug.LogError("Unknown type"); continue; } SetObject(anim, characterRoot, keyframe == endKey, currentTime, frameRate, curves, processedSprites, obj1, bones, scales, null, obj); } //turn off all unused sprites foreach (var colorHelper in characterRoot.GetComponentsInChildren<SpriterNGUIColorHelper>()) { //check if it's been used this keyframe if (!processedSprites.Contains(colorHelper)) { //grab the curve. If it doesn't exist, create it. AnimationCurve val; if (!curves[10].TryGetValue(GetRelativeName(colorHelper, characterRoot), out val)) { val = new AnimationCurve(); curves[10].Add(GetRelativeName(colorHelper, characterRoot), val); } //If this is not the first keyframe, and the previous key was visible, //make sure we step the value int pos = val.AddKey(SteppedKeyframe(currentTime, 0)); if (pos > 0) { if (val.keys[pos - 1].value > 0) { val.AddKey(SteppedKeyframe(currentTime - (.001f / frameRate), val.keys[pos - 1].value)); } } } } }
//import Com.Brashmonkey.Spriter.converters.SpriterObjectConverter; //import AnimationObject; //final private SpriterObjectConverter objectConverter = new SpriterObjectConverter(); public virtual SpriterAnimation buildAnimation( Animation animation) { MainLine mainline = animation.getMainline(); IList <TimeLine> timeLines = animation.getTimeline(); IList <Key> keyFrames = mainline .getKey(); bonesToTween = new Dictionary <SpriterBone , int>(); objectsToTween = new Dictionary <SpriterObject , int>(); SpriterAnimation spriterAnimation = new SpriterAnimation(animation.getId(), animation.getName(), animation.getLength()); for (int k = 0; k < keyFrames.Count; k++) { Key mainlineKey = keyFrames[k]; IList <SpriterObject> tempObjects = new List <SpriterObject >(); IList <SpriterBone> tempBones = new List <SpriterBone >(); SpriterKeyFrame frame = new SpriterKeyFrame (); frame.setTime(mainlineKey.getTime()); frame.setId(mainlineKey.getId()); foreach (BoneRef boneRef in mainlineKey.getBoneRef()) { TimeLine timeline = timeLines[boneRef.getTimeline()]; Key timelineKey = timeline.getKey()[boneRef.getKey()]; SpriterBone bone = boneMerger.merge(boneRef, timelineKey ); bone.setName(timeline.getName()); if (mainlineKey.getTime() != timelineKey.getTime()) { bonesToTween.Add(bone, k); } else { tempBones.Add(bone); } } //} foreach (AnimationObjectRef objectRef in mainlineKey.getObjectRef ()) { TimeLine timeline = timeLines[objectRef.getTimeline()]; Key timelineKey = timeline.getKey()[objectRef.getKey() ]; SpriterObject @object = objectMerger.merge(objectRef , timelineKey); @object.setName(timeline.getName()); if (mainlineKey.getTime() != timelineKey.getTime()) { objectsToTween.Add(@object, k); } else { tempObjects.Add(@object); } } //} SpriterObject[] objArray = new SpriterObject[tempObjects.Count]; tempObjects.CopyTo(objArray, 0); frame.setObjects(objArray); SpriterBone[] boneArray = new SpriterBone[tempBones.Count]; tempBones.CopyTo(boneArray, 0); frame.setBones(boneArray); spriterAnimation.frames.Add(frame); } this.tweenBones(spriterAnimation); this.tweenObjects(spriterAnimation); return(spriterAnimation); }