@Override protected void update(BoneRef ref, Bone root, int time) { boolean isObject = ref instanceof ObjectRef; // Tween bone/object Bone bone1 = null, bone2 = null, tweenTarget = null; Timeline t1 = onFirstMainLine() ? anim1.getTimeline(ref.timeline) : anim1.getSimilarTimeline(anim2.getTimeline(ref.timeline)); Timeline t2 = onFirstMainLine() ? anim2.getSimilarTimeline(t1) : anim2.getTimeline(ref.timeline); Timeline targetTimeline = super.getTimeline(onFirstMainLine() ? t1.id : t2.id); if (t1 != null) bone1 = anim1.tweenedKeys[t1.id].object(); if (t2 != null) bone2 = anim2.tweenedKeys[t2.id].object(); if (targetTimeline != null) tweenTarget = this.tweenedKeys[targetTimeline.id].object(); if (isObject && (t2 == null || !tweenSprites)) { if (!onFirstMainLine()) bone1 = bone2; else bone2 = bone1; } if (bone2 != null && tweenTarget != null && bone1 != null) { if (isObject) this.tweenObject( (Object) bone1, (Object) bone2, (Object) tweenTarget, this.weight, this.curve); else this.tweenBone(bone1, bone2, tweenTarget, this.weight, this.curve); this.unmappedTweenedKeys[targetTimeline.id].active = true; } // Transform the bone relative to the parent bone or the root if (this.unmappedTweenedKeys[ref.timeline].active) { this.unmapTimelineObject( targetTimeline.id, isObject, (ref.parent != null) ? this.unmappedTweenedKeys[ref.parent.timeline].object() : root); } }
@Override public void update(int time, Bone root) { super.currentKey = onFirstMainLine() ? anim1.currentKey : anim2.currentKey; for (Timeline.Key timelineKey : this.unmappedTweenedKeys) timelineKey.active = false; if (base != null) { // TODO: Sprites not working properly because of different timeline naming Animation currentAnim = onFirstMainLine() ? anim1 : anim2; Animation baseAnim = baseAnimation == null ? (onFirstMainLine() ? anim1 : anim2) : baseAnimation; for (BoneRef ref : currentKey.boneRefs) { Timeline timeline = baseAnim.getSimilarTimeline(currentAnim.getTimeline(ref.timeline)); if (timeline == null) continue; Timeline.Key key, mappedKey; key = baseAnim.tweenedKeys[timeline.id]; mappedKey = baseAnim.unmappedTweenedKeys[timeline.id]; this.tweenedKeys[ref.timeline].active = key.active; this.tweenedKeys[ref.timeline].object().set(key.object()); this.unmappedTweenedKeys[ref.timeline].active = mappedKey.active; this.unmapTimelineObject( ref.timeline, false, (ref.parent != null) ? this.unmappedTweenedKeys[ref.parent.timeline].object() : root); } /*for(ObjectRef ref: baseAnim.currentKey.objectRefs){ Timeline timeline = baseAnim.getTimeline(ref.timeline);//getSimilarTimeline(ref, tempTimelines); if(timeline != null){ //tempTimelines.addLast(timeline); Timeline.Key key = baseAnim.tweenedKeys[timeline.id]; Timeline.Key mappedKey = baseAnim.mappedTweenedKeys[timeline.id]; Object obj = (Object) key.object(); this.tweenedKeys[ref.timeline].active = key.active; ((Object)this.tweenedKeys[ref.timeline].object()).set(obj); this.mappedTweenedKeys[ref.timeline].active = mappedKey.active; this.unmapTimelineObject(ref.timeline, true,(ref.parent != null) ? this.mappedTweenedKeys[ref.parent.timeline].object(): root); } }*/ // tempTimelines.clear(); } this.tweenBoneRefs(base, root); for (ObjectRef ref : super.currentKey.objectRefs) { // if(ref.parent == base) this.update(ref, root, 0); } }