public Animator(IScenePresence sp) { m_scenePresence = sp; IConfig animationConfig = sp.Scene.Config.Configs["Animations"]; if (animationConfig != null) { m_useSplatAnimation = animationConfig.GetBoolean("enableSplatAnimation", m_useSplatAnimation); } //This step makes sure that we don't waste almost 2.5! seconds on incoming agents m_animations = new AnimationSet(DefaultAnimations); }
// Compare two AnimationSets and return 'true' if the default animations are the same // and all of the animations in the list are equal. public override bool Equals(object obj) { AnimationSet other = obj as AnimationSet; if (other != null) { if (this.DefaultAnimation.Equals(other.DefaultAnimation) && this.ImplicitDefaultAnimation.Equals(other.ImplicitDefaultAnimation)) { // The defaults are the same. Is the list of animations the same? OpenSim.Framework.Animation[] thisAnims = this.ToArray(); OpenSim.Framework.Animation[] otherAnims = other.ToArray(); if (thisAnims.Length == 0 && otherAnims.Length == 0) { return(true); // the common case } if (thisAnims.Length == otherAnims.Length) { // Do this the hard way but since the list is usually short this won't take long. foreach (OpenSim.Framework.Animation thisAnim in thisAnims) { bool found = false; foreach (OpenSim.Framework.Animation otherAnim in otherAnims) { if (thisAnim.Equals(otherAnim)) { found = true; break; } } if (!found) { // If anything is not in the other list, these are not equal return(false); } } // Found everything in the other list. Since lists are equal length, they must be equal. return(true); } } return(false); } // Don't know what was passed, but the base system will figure it out for me. return(base.Equals(obj)); }
public void Close() { m_animations = null; m_scenePresence = null; }
private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb) { sb.AppendFormat("Animations for {0}\n", sp.Name); ConsoleDisplayList cdl = new ConsoleDisplayList() { Indent = 2 }; ScenePresenceAnimator spa = sp.Animator; AnimationSet anims = sp.Animator.Animations; string cma = spa.CurrentMovementAnimation; cdl.AddRow( "Current movement anim", string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma)); UUID defaultAnimId = anims.DefaultAnimation.AnimID; cdl.AddRow( "Default anim", string.Format("{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId))); UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID; cdl.AddRow( "Implicit default anim", string.Format("{0}, {1}", implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId))); cdl.AddToStringBuilder(sb); ConsoleDisplayTable cdt = new ConsoleDisplayTable() { Indent = 2 }; cdt.AddColumn("Animation ID", 36); cdt.AddColumn("Name", 20); cdt.AddColumn("Seq", 3); cdt.AddColumn("Object ID", 36); UUID[] animIds; int[] sequenceNumbers; UUID[] objectIds; sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds); for (int i = 0; i < animIds.Length; i++) { UUID animId = animIds[i]; string animName = sp.Animator.GetAnimName(animId); int seq = sequenceNumbers[i]; UUID objectId = objectIds[i]; cdt.AddRow(animId, animName, seq, objectId); } cdt.AddToStringBuilder(sb); sb.Append("\n"); }