diff options
author | Teravus Ovares | 2008-05-11 21:27:12 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-11 21:27:12 +0000 |
commit | a01b415d6c3fa2ee650b23b7d78432a2eac5a2a7 (patch) | |
tree | 8594200f74b76d91c2d2fc2c3f57e06e0ee565ea /OpenSim | |
parent | * Fixed null reference exception when rezzing an object from inventory with a... (diff) | |
download | opensim-SC_OLD-a01b415d6c3fa2ee650b23b7d78432a2eac5a2a7.zip opensim-SC_OLD-a01b415d6c3fa2ee650b23b7d78432a2eac5a2a7.tar.gz opensim-SC_OLD-a01b415d6c3fa2ee650b23b7d78432a2eac5a2a7.tar.bz2 opensim-SC_OLD-a01b415d6c3fa2ee650b23b7d78432a2eac5a2a7.tar.xz |
0001199: [PATCH] Add support for default animations
From Melanie... Thanks Melanie!
.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 19 |
5 files changed, 90 insertions, 8 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index a01ee0b..a7f6e23 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -914,6 +914,7 @@ namespace OpenSim.Framework | |||
914 | 914 | ||
915 | void SendSunPos(LLVector3 sunPos, LLVector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition); | 915 | void SendSunPos(LLVector3 sunPos, LLVector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition); |
916 | void SendViewerTime(int phase); | 916 | void SendViewerTime(int phase); |
917 | LLUUID GetDefaultAnimation(string name); | ||
917 | 918 | ||
918 | void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, | 919 | void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, |
919 | uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); | 920 | uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8506912..68e1a0d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -96,6 +96,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
96 | 96 | ||
97 | private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL | 97 | private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL |
98 | 98 | ||
99 | private Dictionary<string, LLUUID> m_defaultAnimations = new Dictionary<string, LLUUID>(); | ||
100 | |||
101 | |||
99 | /* protected variables */ | 102 | /* protected variables */ |
100 | 103 | ||
101 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = | 104 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = |
@@ -326,6 +329,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
326 | 329 | ||
327 | m_channelVersion = Helpers.StringToField(scene.GetSimulatorVersion()); | 330 | m_channelVersion = Helpers.StringToField(scene.GetSimulatorVersion()); |
328 | 331 | ||
332 | InitDefaultAnimations(); | ||
333 | |||
334 | |||
329 | m_scene = scene; | 335 | m_scene = scene; |
330 | m_assetCache = assetCache; | 336 | m_assetCache = assetCache; |
331 | 337 | ||
@@ -3097,6 +3103,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3097 | 3103 | ||
3098 | OutPacket(scriptQuestion, ThrottleOutPacketType.Task); | 3104 | OutPacket(scriptQuestion, ThrottleOutPacketType.Task); |
3099 | } | 3105 | } |
3106 | private void InitDefaultAnimations() | ||
3107 | { | ||
3108 | } | ||
3109 | |||
3110 | public LLUUID GetDefaultAnimation(string name) | ||
3111 | { | ||
3112 | if(m_defaultAnimations.ContainsKey(name)) | ||
3113 | return m_defaultAnimations[name]; | ||
3114 | return LLUUID.Zero; | ||
3115 | } | ||
3100 | 3116 | ||
3101 | protected virtual bool Logout(IClientAPI client, Packet packet) | 3117 | protected virtual bool Logout(IClientAPI client, Packet packet) |
3102 | { | 3118 | { |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 466b20a..c74cac3 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1156,6 +1156,63 @@ namespace OpenSim.Region.Environment.Scenes | |||
1156 | } | 1156 | } |
1157 | } | 1157 | } |
1158 | } | 1158 | } |
1159 | public void AddAnimation(string name) | ||
1160 | { | ||
1161 | if(m_isChildAgent) | ||
1162 | return; | ||
1163 | |||
1164 | // Don't let this animation become the movement animation | ||
1165 | if(m_animations.Count < 1) | ||
1166 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); | ||
1167 | |||
1168 | LLUUID animID=m_controllingClient.GetDefaultAnimation(name); | ||
1169 | if(animID == LLUUID.Zero) | ||
1170 | return; | ||
1171 | |||
1172 | if (!m_animations.Contains(animID)) | ||
1173 | { | ||
1174 | m_animations.Add(animID); | ||
1175 | m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber); | ||
1176 | SendAnimPack(); | ||
1177 | } | ||
1178 | } | ||
1179 | |||
1180 | public void RemoveAnimation(string name) | ||
1181 | { | ||
1182 | if(m_isChildAgent) | ||
1183 | return; | ||
1184 | |||
1185 | LLUUID animID=m_controllingClient.GetDefaultAnimation(name); | ||
1186 | if(animID == LLUUID.Zero) | ||
1187 | return; | ||
1188 | |||
1189 | if (m_animations.Contains(animID)) | ||
1190 | { | ||
1191 | if (m_animations[0] == animID) | ||
1192 | { | ||
1193 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"]); | ||
1194 | } | ||
1195 | else | ||
1196 | { | ||
1197 | // What a HACK!! Anim list really needs to be an object! | ||
1198 | int idx; | ||
1199 | |||
1200 | for(idx=0;idx < m_animations.Count;idx++) | ||
1201 | { | ||
1202 | if(m_animations[idx] == animID) | ||
1203 | { | ||
1204 | int seq=m_animationSeqs[idx]; | ||
1205 | |||
1206 | m_animations.Remove(animID); | ||
1207 | m_animationSeqs.Remove(seq); | ||
1208 | SendAnimPack(); | ||
1209 | break; | ||
1210 | } | ||
1211 | } | ||
1212 | } | ||
1213 | } | ||
1214 | } | ||
1215 | |||
1159 | 1216 | ||
1160 | public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID) | 1217 | public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID) |
1161 | { | 1218 | { |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 42912e7..09553ca 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -449,6 +449,11 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
449 | { | 449 | { |
450 | } | 450 | } |
451 | 451 | ||
452 | public LLUUID GetDefaultAnimation(string name) | ||
453 | { | ||
454 | return LLUUID.Zero; | ||
455 | } | ||
456 | |||
452 | public void SendTakeControls(int controls, bool passToAgent, bool TakeControls) | 457 | public void SendTakeControls(int controls, bool passToAgent, bool TakeControls) |
453 | { | 458 | { |
454 | } | 459 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 87c0450..bac8f2a 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2136,15 +2136,15 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2136 | 2136 | ||
2137 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) | 2137 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) |
2138 | { | 2138 | { |
2139 | // Do NOT try to parse LLUUID, animations cannot be triggered by ID | ||
2140 | LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); | ||
2141 | if (animID == LLUUID.Zero) | ||
2142 | return; | ||
2143 | |||
2144 | if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) | 2139 | if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) |
2145 | { | 2140 | { |
2146 | ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; | 2141 | ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; |
2147 | presence.AddAnimation(animID); | 2142 | // Do NOT try to parse LLUUID, animations cannot be triggered by ID |
2143 | LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); | ||
2144 | if (animID == LLUUID.Zero) | ||
2145 | presence.AddAnimation(anim); | ||
2146 | else | ||
2147 | presence.AddAnimation(animID); | ||
2148 | } | 2148 | } |
2149 | } | 2149 | } |
2150 | } | 2150 | } |
@@ -2170,12 +2170,15 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2170 | } | 2170 | } |
2171 | 2171 | ||
2172 | if (animID == LLUUID.Zero) | 2172 | if (animID == LLUUID.Zero) |
2173 | return; | 2173 | return; |
2174 | 2174 | ||
2175 | if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) | 2175 | if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) |
2176 | { | 2176 | { |
2177 | ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; | 2177 | ScenePresence presence = World.m_innerScene.ScenePresences[m_host.TaskInventory[invItemID].PermsGranter]; |
2178 | presence.RemoveAnimation(animID); | 2178 | if (animID == LLUUID.Zero) |
2179 | presence.RemoveAnimation(anim); | ||
2180 | else | ||
2181 | presence.RemoveAnimation(animID); | ||
2179 | } | 2182 | } |
2180 | } | 2183 | } |
2181 | } | 2184 | } |