Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

0.7.4.1
BlueWall 2012-03-21 20:34:51 -04:00
commit c98e3a6422
10 changed files with 84 additions and 98 deletions

View File

@ -1215,10 +1215,9 @@ namespace OpenSim.Framework
/// <param name="OrbitalPosition">The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView</param>
void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear,
float OrbitalPosition);
void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
void SendViewerTime(int phase);
UUID GetDefaultAnimation(string name);
void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, string flAbout,
uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID);

View File

@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Xml;
using log4net;
@ -40,13 +41,6 @@ namespace OpenSim.Framework
#region SL / file extension / content-type conversions
public static Dictionary<string, UUID> DefaultAvatarAnimations = new Dictionary<string, UUID>();
static SLUtil()
{
DefaultAvatarAnimations = LoadDefaultAvatarAnimations("data/avataranimations.xml");
}
public static string SLAssetTypeToContentType(int assetType)
{
switch ((AssetType)assetType)
@ -382,47 +376,5 @@ namespace OpenSim.Framework
return output;
}
/// <summary>
/// Load the default SL avatar animations.
/// </summary>
/// <returns></returns>
public static Dictionary<string, UUID> LoadDefaultAvatarAnimations(string path)
{
Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
using (XmlTextReader reader = new XmlTextReader(path))
{
XmlDocument doc = new XmlDocument();
doc.Load(reader);
if (doc.DocumentElement != null)
{
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{
if (nod.Attributes["name"] != null)
{
string name = nod.Attributes["name"].Value.ToLower();
string id = nod.InnerText;
animations.Add(name, (UUID)id);
}
}
}
}
return animations;
}
/// <summary>
/// Get the default SL avatar animation with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static UUID GetDefaultAvatarAnimation(string name)
{
if (DefaultAvatarAnimations.ContainsKey(name))
return DefaultAvatarAnimations[name];
return UUID.Zero;
}
}
}

View File

@ -11202,15 +11202,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
scriptQuestion.Data.Questions = question;
scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName);
scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName);
OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
}
public UUID GetDefaultAnimation(string name)
{
return SLUtil.GetDefaultAvatarAnimation(name);
}
/// <summary>
/// Handler called when we receive a logout packet.
/// </summary>

View File

@ -27,8 +27,10 @@
using System;
using System.Collections.Generic;
using OpenSim.Framework;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using Animation = OpenSim.Framework.Animation;
@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
[Serializable]
public class AnimationSet
{
public static AvatarAnimations Animations = new AvatarAnimations();
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation();
private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>();
@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary>
public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID)
{
if (Animations.AnimsUUID.ContainsKey(anim))
// m_log.DebugFormat(
// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}",
// anim, sequenceNum, objectID);
if (AvatarAnimations.AnimsUUID.ContainsKey(anim))
{
return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID);
return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID);
}
return false;
}

View File

@ -26,38 +26,83 @@
*/
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using log4net;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes.Animation
{
public class AvatarAnimations
{
public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public AvatarAnimations()
public static readonly string DefaultAnimationsPath = "data/avataranimations.xml";
public static Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
static AvatarAnimations()
{
using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
LoadAnimations(DefaultAnimationsPath);
}
/// <summary>
/// Load the default SL avatar animations.
/// </summary>
/// <returns></returns>
private static void LoadAnimations(string path)
{
// Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
using (XmlTextReader reader = new XmlTextReader(path))
{
XmlDocument doc = new XmlDocument();
doc.Load(reader);
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{
if (nod.Attributes["name"] != null)
// if (doc.DocumentElement != null)
// {
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{
string name = (string)nod.Attributes["name"].Value;
UUID id = (UUID)nod.InnerText;
string animState = (string)nod.Attributes["state"].Value;
if (nod.Attributes["name"] != null)
{
string name = nod.Attributes["name"].Value;
UUID id = (UUID)nod.InnerText;
string animState = (string)nod.Attributes["state"].Value;
AnimsUUID.Add(name, id);
AnimsNames.Add(id, name);
if (animState != "")
AnimStateNames.Add(id, animState);
AnimsUUID.Add(name, id);
AnimsNames.Add(id, name);
if (animState != "")
AnimStateNames.Add(id, animState);
// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState);
}
}
}
// }
}
// return animations;
}
/// <summary>
/// Get the default avatar animation with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static UUID GetDefaultAnimation(string name)
{
// m_log.DebugFormat(
// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name);
if (AnimsUUID.ContainsKey(name))
{
// m_log.DebugFormat(
// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name);
return AnimsUUID[name];
}
return UUID.Zero;
}
}
}
}

View File

@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_scenePresence.IsChildAgent)
return;
UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name);
// XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
// are referenced with lower case names!
UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper());
if (animID == UUID.Zero)
return;
@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_scenePresence.IsChildAgent)
return;
UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name);
// XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
// are referenced with lower case names!
UUID animID = AvatarAnimations.GetDefaultAnimation(name);
if (animID == UUID.Zero)
return;

View File

@ -1203,11 +1203,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public UUID GetDefaultAnimation(string name)
{
return UUID.Zero;
}
public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID)
{

View File

@ -133,11 +133,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
}
public UUID GetDefaultAnimation(string name)
{
return SLUtil.GetDefaultAvatarAnimation(name);
}
public Vector3 Position
{
get { return m_scene.Entities[m_uuid].AbsolutePosition; }

View File

@ -4314,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.RegionHandle == presence.RegionHandle)
{
Dictionary<UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames;
Dictionary<UUID, string> animationstateNames = AvatarAnimations.AnimStateNames;
if (presence != null)
{
@ -5600,7 +5600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
if (agent.Animator.Animations.DefaultAnimation.AnimID
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
== AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{
flags |= ScriptBaseClass.AGENT_SITTING;
}
@ -7714,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector lower;
LSL_Vector upper;
if (presence.Animator.Animations.DefaultAnimation.AnimID
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
== AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{
// This is for ground sitting avatars
float height = presence.Appearance.AvatarHeight / 2.66666667f;

View File

@ -700,11 +700,6 @@ namespace OpenSim.Tests.Common.Mock
{
}
public UUID GetDefaultAnimation(string name)
{
return UUID.Zero;
}
public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
{
}