0001199: [PATCH] Add support for default animations
From Melanie... Thanks Melanie! .0.6.0-stable
parent
8f26427055
commit
a01b415d6c
|
@ -914,6 +914,7 @@ namespace OpenSim.Framework
|
|||
|
||||
void SendSunPos(LLVector3 sunPos, LLVector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition);
|
||||
void SendViewerTime(int phase);
|
||||
LLUUID GetDefaultAnimation(string name);
|
||||
|
||||
void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout,
|
||||
uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
|
||||
|
|
|
@ -96,6 +96,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL
|
||||
|
||||
private Dictionary<string, LLUUID> m_defaultAnimations = new Dictionary<string, LLUUID>();
|
||||
|
||||
|
||||
/* protected variables */
|
||||
|
||||
protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
|
||||
|
@ -326,6 +329,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
m_channelVersion = Helpers.StringToField(scene.GetSimulatorVersion());
|
||||
|
||||
InitDefaultAnimations();
|
||||
|
||||
|
||||
m_scene = scene;
|
||||
m_assetCache = assetCache;
|
||||
|
||||
|
@ -3097,6 +3103,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
|
||||
}
|
||||
private void InitDefaultAnimations()
|
||||
{
|
||||
}
|
||||
|
||||
public LLUUID GetDefaultAnimation(string name)
|
||||
{
|
||||
if(m_defaultAnimations.ContainsKey(name))
|
||||
return m_defaultAnimations[name];
|
||||
return LLUUID.Zero;
|
||||
}
|
||||
|
||||
protected virtual bool Logout(IClientAPI client, Packet packet)
|
||||
{
|
||||
|
|
|
@ -1156,6 +1156,63 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
public void AddAnimation(string name)
|
||||
{
|
||||
if(m_isChildAgent)
|
||||
return;
|
||||
|
||||
// Don't let this animation become the movement animation
|
||||
if(m_animations.Count < 1)
|
||||
SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
|
||||
|
||||
LLUUID animID=m_controllingClient.GetDefaultAnimation(name);
|
||||
if(animID == LLUUID.Zero)
|
||||
return;
|
||||
|
||||
if (!m_animations.Contains(animID))
|
||||
{
|
||||
m_animations.Add(animID);
|
||||
m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber);
|
||||
SendAnimPack();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAnimation(string name)
|
||||
{
|
||||
if(m_isChildAgent)
|
||||
return;
|
||||
|
||||
LLUUID animID=m_controllingClient.GetDefaultAnimation(name);
|
||||
if(animID == LLUUID.Zero)
|
||||
return;
|
||||
|
||||
if (m_animations.Contains(animID))
|
||||
{
|
||||
if (m_animations[0] == animID)
|
||||
{
|
||||
SetMovementAnimation(Animations.AnimsLLUUID["STAND"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// What a HACK!! Anim list really needs to be an object!
|
||||
int idx;
|
||||
|
||||
for(idx=0;idx < m_animations.Count;idx++)
|
||||
{
|
||||
if(m_animations[idx] == animID)
|
||||
{
|
||||
int seq=m_animationSeqs[idx];
|
||||
|
||||
m_animations.Remove(animID);
|
||||
m_animationSeqs.Remove(seq);
|
||||
SendAnimPack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID)
|
||||
{
|
||||
|
|
|
@ -449,6 +449,11 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
{
|
||||
}
|
||||
|
||||
public LLUUID GetDefaultAnimation(string name)
|
||||
{
|
||||
return LLUUID.Zero;
|
||||
}
|
||||
|
||||
public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -2136,15 +2136,15 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
|
||||
if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
|
||||
{
|
||||
// Do NOT try to parse LLUUID, animations cannot be triggered by ID
|
||||
LLUUID animID=InventoryKey(anim, (int)AssetType.Animation);
|
||||
if (animID == LLUUID.Zero)
|
||||
return;
|
||||
|
||||
if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
|
||||
{
|
||||
ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter];
|
||||
presence.AddAnimation(animID);
|
||||
// Do NOT try to parse LLUUID, animations cannot be triggered by ID
|
||||
LLUUID animID=InventoryKey(anim, (int)AssetType.Animation);
|
||||
if (animID == LLUUID.Zero)
|
||||
presence.AddAnimation(anim);
|
||||
else
|
||||
presence.AddAnimation(animID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2170,12 +2170,15 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
}
|
||||
|
||||
if (animID == LLUUID.Zero)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
|
||||
{
|
||||
ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter];
|
||||
presence.RemoveAnimation(animID);
|
||||
if (animID == LLUUID.Zero)
|
||||
presence.RemoveAnimation(anim);
|
||||
else
|
||||
presence.RemoveAnimation(animID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue