Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
c98e3a6422
|
@ -1218,7 +1218,6 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
|
void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
|
||||||
void SendViewerTime(int phase);
|
void SendViewerTime(int phase);
|
||||||
UUID GetDefaultAnimation(string name);
|
|
||||||
|
|
||||||
void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, string flAbout,
|
void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, string flAbout,
|
||||||
uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID);
|
uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -40,13 +41,6 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
#region SL / file extension / content-type conversions
|
#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)
|
public static string SLAssetTypeToContentType(int assetType)
|
||||||
{
|
{
|
||||||
switch ((AssetType)assetType)
|
switch ((AssetType)assetType)
|
||||||
|
@ -382,47 +376,5 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
return output;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11206,11 +11206,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
|
OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID GetDefaultAnimation(string name)
|
|
||||||
{
|
|
||||||
return SLUtil.GetDefaultAvatarAnimation(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handler called when we receive a logout packet.
|
/// Handler called when we receive a logout packet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -27,8 +27,10 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
using Animation = OpenSim.Framework.Animation;
|
using Animation = OpenSim.Framework.Animation;
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class AnimationSet
|
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 OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation();
|
||||||
private List<OpenSim.Framework.Animation> m_animations = new List<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>
|
/// </summary>
|
||||||
public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,28 +26,47 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes.Animation
|
namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
{
|
{
|
||||||
public class AvatarAnimations
|
public class AvatarAnimations
|
||||||
{
|
{
|
||||||
public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
|
|
||||||
public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
|
|
||||||
|
|
||||||
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();
|
XmlDocument doc = new XmlDocument();
|
||||||
doc.Load(reader);
|
doc.Load(reader);
|
||||||
|
// if (doc.DocumentElement != null)
|
||||||
|
// {
|
||||||
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
|
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
|
||||||
{
|
{
|
||||||
if (nod.Attributes["name"] != null)
|
if (nod.Attributes["name"] != null)
|
||||||
{
|
{
|
||||||
string name = (string)nod.Attributes["name"].Value;
|
string name = nod.Attributes["name"].Value;
|
||||||
UUID id = (UUID)nod.InnerText;
|
UUID id = (UUID)nod.InnerText;
|
||||||
string animState = (string)nod.Attributes["state"].Value;
|
string animState = (string)nod.Attributes["state"].Value;
|
||||||
|
|
||||||
|
@ -55,9 +74,35 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
AnimsNames.Add(id, name);
|
AnimsNames.Add(id, name);
|
||||||
if (animState != "")
|
if (animState != "")
|
||||||
AnimStateNames.Add(id, 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
if (m_scenePresence.IsChildAgent)
|
if (m_scenePresence.IsChildAgent)
|
||||||
return;
|
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)
|
if (animID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
if (m_scenePresence.IsChildAgent)
|
if (m_scenePresence.IsChildAgent)
|
||||||
return;
|
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)
|
if (animID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -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)
|
public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -133,11 +133,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID GetDefaultAnimation(string name)
|
|
||||||
{
|
|
||||||
return SLUtil.GetDefaultAvatarAnimation(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector3 Position
|
public Vector3 Position
|
||||||
{
|
{
|
||||||
get { return m_scene.Entities[m_uuid].AbsolutePosition; }
|
get { return m_scene.Entities[m_uuid].AbsolutePosition; }
|
||||||
|
|
|
@ -4314,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
if (m_host.RegionHandle == presence.RegionHandle)
|
if (m_host.RegionHandle == presence.RegionHandle)
|
||||||
{
|
{
|
||||||
Dictionary<UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames;
|
Dictionary<UUID, string> animationstateNames = AvatarAnimations.AnimStateNames;
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -5600,7 +5600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
if (agent.Animator.Animations.DefaultAnimation.AnimID
|
if (agent.Animator.Animations.DefaultAnimation.AnimID
|
||||||
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
== AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
||||||
{
|
{
|
||||||
flags |= ScriptBaseClass.AGENT_SITTING;
|
flags |= ScriptBaseClass.AGENT_SITTING;
|
||||||
}
|
}
|
||||||
|
@ -7714,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
LSL_Vector lower;
|
LSL_Vector lower;
|
||||||
LSL_Vector upper;
|
LSL_Vector upper;
|
||||||
if (presence.Animator.Animations.DefaultAnimation.AnimID
|
if (presence.Animator.Animations.DefaultAnimation.AnimID
|
||||||
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
== AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
||||||
{
|
{
|
||||||
// This is for ground sitting avatars
|
// This is for ground sitting avatars
|
||||||
float height = presence.Appearance.AvatarHeight / 2.66666667f;
|
float height = presence.Appearance.AvatarHeight / 2.66666667f;
|
||||||
|
|
|
@ -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)
|
public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue