aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2011-12-05 17:10:51 +0000
committerMelanie2011-12-05 17:10:51 +0000
commit5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc (patch)
tree537b010672277073530cf013434fa046aabfec7e /OpenSim/Region
parentStrip CR from http responses and limit them to 2048 chars (diff)
parentHG: Added HEAD method to Helo service. This is the preferred method, but its ... (diff)
downloadopensim-SC_OLD-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.zip
opensim-SC_OLD-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.tar.gz
opensim-SC_OLD-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.tar.bz2
opensim-SC_OLD-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.tar.xz
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs123
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs112
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs203
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs103
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs151
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs70
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
11 files changed, 460 insertions, 372 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index b4dbeae..df4dbee 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -1039,7 +1039,7 @@ namespace OpenSim
1039 { 1039 {
1040 //this.HttpServer. 1040 //this.HttpServer.
1041 acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); 1041 acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName);
1042 foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.AgentCircuits.Values) 1042 foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values)
1043 acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); 1043 acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root"));
1044 } 1044 }
1045 ); 1045 );
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 07b4df3..98dda36 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -56,8 +56,6 @@ namespace OpenSim.Region.ClientStack.Linden
56 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, 56 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
57 byte[] data, string inventoryType, string assetType); 57 byte[] data, string inventoryType, string assetType);
58 58
59 public delegate void UploadedBakedTexture(UUID assetID, byte[] data);
60
61 public delegate UUID UpdateItem(UUID itemID, byte[] data); 59 public delegate UUID UpdateItem(UUID itemID, byte[] data);
62 60
63 public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); 61 public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors);
@@ -97,7 +95,6 @@ namespace OpenSim.Region.ClientStack.Linden
97 private static readonly string m_notecardTaskUpdatePath = "0005/"; 95 private static readonly string m_notecardTaskUpdatePath = "0005/";
98 // private static readonly string m_fetchInventoryPath = "0006/"; 96 // private static readonly string m_fetchInventoryPath = "0006/";
99 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. 97 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
100 private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
101 98
102 99
103 // These are callbacks which will be setup by the scene so that we can update scene data when we 100 // These are callbacks which will be setup by the scene so that we can update scene data when we
@@ -164,8 +161,6 @@ namespace OpenSim.Region.ClientStack.Linden
164 IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); 161 IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
165 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); 162 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
166 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); 163 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
167 m_HostCapsObj.RegisterHandler("UploadBakedTexture", new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture));
168
169 } 164 }
170 catch (Exception e) 165 catch (Exception e)
171 { 166 {
@@ -331,74 +326,6 @@ namespace OpenSim.Region.ClientStack.Linden
331 } 326 }
332 327
333 /// <summary> 328 /// <summary>
334 /// Handle a request from the client for a Uri to upload a baked texture.
335 /// </summary>
336 /// <param name="request"></param>
337 /// <param name="path"></param>
338 /// <param name="param"></param>
339 /// <param name="httpRequest"></param>
340 /// <param name="httpResponse"></param>
341 /// <returns>The upload response if the request is successful, null otherwise.</returns>
342 public string UploadBakedTexture(string request, string path,
343 string param, OSHttpRequest httpRequest,
344 OSHttpResponse httpResponse)
345 {
346 try
347 {
348// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName);
349
350 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
351 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
352
353 BakedTextureUploader uploader =
354 new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener);
355 uploader.OnUpLoad += BakedTextureUploaded;
356
357 m_HostCapsObj.HttpListener.AddStreamHandler(
358 new BinaryStreamHandler("POST", capsBase + uploaderPath,
359 uploader.uploaderCaps));
360
361 string protocol = "http://";
362
363 if (m_HostCapsObj.SSLCaps)
364 protocol = "https://";
365
366 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
367 m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
368
369 LLSDAssetUploadResponse uploadResponse =
370 new LLSDAssetUploadResponse();
371 uploadResponse.uploader = uploaderURL;
372 uploadResponse.state = "upload";
373
374 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
375 }
376 catch (Exception e)
377 {
378 m_log.Error("[CAPS]: " + e.ToString());
379 }
380
381 return null;
382 }
383
384 /// <summary>
385 /// Called when a baked texture has been successfully uploaded by a client.
386 /// </summary>
387 /// <param name="assetID"></param>
388 /// <param name="data"></param>
389 public void BakedTextureUploaded(UUID assetID, byte[] data)
390 {
391 // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
392
393 AssetBase asset;
394 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
395 asset.Data = data;
396 asset.Temporary = true;
397 asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
398 m_assetService.Store(asset);
399 }
400
401 /// <summary>
402 /// Called when new asset data for an agent inventory item update has been uploaded. 329 /// Called when new asset data for an agent inventory item update has been uploaded.
403 /// </summary> 330 /// </summary>
404 /// <param name="itemID">Item to update</param> 331 /// <param name="itemID">Item to update</param>
@@ -1067,6 +994,7 @@ namespace OpenSim.Region.ClientStack.Linden
1067 // XXX Maybe this should be some meaningful error packet 994 // XXX Maybe this should be some meaningful error packet
1068 return null; 995 return null;
1069 } 996 }
997
1070 ///Left this in and commented in case there are unforseen issues 998 ///Left this in and commented in case there are unforseen issues
1071 //private void SaveAssetToFile(string filename, byte[] data) 999 //private void SaveAssetToFile(string filename, byte[] data)
1072 //{ 1000 //{
@@ -1090,53 +1018,4 @@ namespace OpenSim.Region.ClientStack.Linden
1090 fs.Close(); 1018 fs.Close();
1091 } 1019 }
1092 } 1020 }
1093
1094 public class BakedTextureUploader
1095 {
1096 public event UploadedBakedTexture OnUpLoad;
1097 private UploadedBakedTexture handlerUpLoad = null;
1098
1099 private string uploaderPath = String.Empty;
1100 private UUID newAssetID;
1101 private IHttpServer httpListener;
1102
1103 public BakedTextureUploader(string path, IHttpServer httpServer)
1104 {
1105 newAssetID = UUID.Random();
1106 uploaderPath = path;
1107 httpListener = httpServer;
1108 // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
1109 }
1110
1111 /// <summary>
1112 /// Handle raw uploaded baked texture data.
1113 /// </summary>
1114 /// <param name="data"></param>
1115 /// <param name="path"></param>
1116 /// <param name="param"></param>
1117 /// <returns></returns>
1118 public string uploaderCaps(byte[] data, string path, string param)
1119 {
1120 handlerUpLoad = OnUpLoad;
1121 if (handlerUpLoad != null)
1122 {
1123 Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); });
1124 }
1125
1126 string res = String.Empty;
1127 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
1128 uploadComplete.new_asset = newAssetID.ToString();
1129 uploadComplete.new_inventory_item = UUID.Zero;
1130 uploadComplete.state = "complete";
1131
1132 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
1133
1134 httpListener.RemoveStreamHandler("POST", uploaderPath);
1135
1136 // m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
1137
1138 return res;
1139 }
1140 }
1141
1142} \ No newline at end of file 1021} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
new file mode 100644
index 0000000..e61815f
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
@@ -0,0 +1,112 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
33using System.Reflection;
34using System.IO;
35using System.Web;
36using log4net;
37using Nini.Config;
38using Mono.Addins;
39using OpenMetaverse;
40using OpenMetaverse.StructuredData;
41using OpenMetaverse.Imaging;
42using OpenSim.Framework;
43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Services.Interfaces;
48using Caps = OpenSim.Framework.Capabilities.Caps;
49using OpenSim.Capabilities.Handlers;
50
51namespace OpenSim.Region.ClientStack.Linden
52{
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
54 public class UploadBakedTextureModule : INonSharedRegionModule
55 {
56// private static readonly ILog m_log =
57// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58
59 /// <summary>
60 /// For historical reasons this is fixed, but there
61 /// </summary>
62 private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
63
64 private Scene m_scene;
65 private bool m_persistBakedTextures;
66
67 public void Initialise(IConfigSource source)
68 {
69 IConfig sconfig = source.Configs["Startup"];
70 if (sconfig != null)
71 m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
72 }
73
74 public void AddRegion(Scene s)
75 {
76 m_scene = s;
77 }
78
79 public void RemoveRegion(Scene s)
80 {
81 }
82
83 public void RegionLoaded(Scene s)
84 {
85 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
86 }
87
88 public void PostInitialise()
89 {
90 }
91
92 public void Close() { }
93
94 public string Name { get { return "UploadBakedTextureModule"; } }
95
96 public Type ReplaceableInterface
97 {
98 get { return null; }
99 }
100
101 public void RegisterCaps(UUID agentID, Caps caps)
102 {
103 caps.RegisterHandler(
104 "UploadBakedTexture",
105 new RestStreamHandler(
106 "POST",
107 "/CAPS/" + m_uploadBakedTexturePath,
108 new UploadBakedTextureHandler(
109 caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture));
110 }
111 }
112} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 5431841..9875f56 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -496,7 +496,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
496 // Well, this is it. The agent is over there. 496 // Well, this is it. The agent is over there.
497 KillEntity(sp.Scene, sp.LocalId); 497 KillEntity(sp.Scene, sp.LocalId);
498 498
499
500 // Now let's make it officially a child agent 499 // Now let's make it officially a child agent
501 sp.MakeChildAgent(); 500 sp.MakeChildAgent();
502 501
@@ -511,9 +510,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
511 sp.Scene.IncomingCloseAgent(sp.UUID); 510 sp.Scene.IncomingCloseAgent(sp.UUID);
512 } 511 }
513 else 512 else
513 {
514 // now we have a child agent in this region. 514 // now we have a child agent in this region.
515 sp.Reset(); 515 sp.Reset();
516 516 }
517 517
518 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 518 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
519 if (sp.Scene.NeedSceneCacheClear(sp.UUID)) 519 if (sp.Scene.NeedSceneCacheClear(sp.UUID))
@@ -965,115 +965,121 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
965 ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, 965 ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion,
966 bool isFlying, string version) 966 bool isFlying, string version)
967 { 967 {
968 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 968 try
969
970 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
971
972 Scene m_scene = agent.Scene;
973
974 if (neighbourRegion != null)
975 { 969 {
976 if (!agent.ValidateAttachments()) 970 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
977 m_log.DebugFormat( 971
978 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", 972 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
979 agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); 973
980 974 Scene m_scene = agent.Scene;
981 pos = pos + (agent.Velocity); 975
982 976 if (neighbourRegion != null)
983 SetInTransit(agent.UUID);
984 AgentData cAgent = new AgentData();
985 agent.CopyTo(cAgent);
986 cAgent.Position = pos;
987 if (isFlying)
988 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
989 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
990 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
991
992 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
993 {
994 // region doesn't take it
995 ReInstantiateScripts(agent);
996 ResetFromTransit(agent.UUID);
997 return agent;
998 }
999
1000 // Next, let's close the child agent connections that are too far away.
1001 agent.CloseChildAgents(neighbourx, neighboury);
1002
1003 //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
1004 agent.ControllingClient.RequestClientInfo();
1005
1006 //m_log.Debug("BEFORE CROSS");
1007 //Scene.DumpChildrenSeeds(UUID);
1008 //DumpKnownRegions();
1009 string agentcaps;
1010 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
1011 {
1012 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
1013 neighbourRegion.RegionHandle);
1014 return agent;
1015 }
1016 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
1017
1018 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
1019
1020 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
1021 IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint;
1022 if (neighbourExternal != null)
1023 { 977 {
978 if (!agent.ValidateAttachments())
979 m_log.DebugFormat(
980 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
981 agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
982
983 pos = pos + (agent.Velocity);
984
985 SetInTransit(agent.UUID);
986 AgentData cAgent = new AgentData();
987 agent.CopyTo(cAgent);
988 cAgent.Position = pos;
989 if (isFlying)
990 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
991 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
992 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
993
994 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
995 {
996 // region doesn't take it
997 ReInstantiateScripts(agent);
998 ResetFromTransit(agent.UUID);
999 return agent;
1000 }
1001
1002 // Next, let's close the child agent connections that are too far away.
1003 agent.CloseChildAgents(neighbourx, neighboury);
1004
1005 //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
1006 agent.ControllingClient.RequestClientInfo();
1007
1008 //m_log.Debug("BEFORE CROSS");
1009 //Scene.DumpChildrenSeeds(UUID);
1010 //DumpKnownRegions();
1011 string agentcaps;
1012 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
1013 {
1014 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
1015 neighbourRegion.RegionHandle);
1016 return agent;
1017 }
1018 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
1019
1020 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
1021
1022 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
1024 if (eq != null) 1023 if (eq != null)
1025 { 1024 {
1026 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, 1025 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1027 capsPath, agent.UUID, agent.ControllingClient.SessionId); 1026 capsPath, agent.UUID, agent.ControllingClient.SessionId);
1028 } 1027 }
1029 else 1028 else
1030 { 1029 {
1031 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, 1030 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1032 capsPath); 1031 capsPath);
1033 } 1032 }
1033
1034 if (!WaitForCallback(agent.UUID))
1035 {
1036 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
1037 ReInstantiateScripts(agent);
1038 ResetFromTransit(agent.UUID);
1039
1040 // Yikes! We should just have a ref to scene here.
1041 //agent.Scene.InformClientOfNeighbours(agent);
1042 EnableChildAgents(agent);
1043
1044 return agent;
1045 }
1046
1047 agent.MakeChildAgent();
1048
1049 // now we have a child agent in this region. Request all interesting data about other (root) agents
1050 agent.SendOtherAgentsAvatarDataToMe();
1051 agent.SendOtherAgentsAppearanceToMe();
1052
1053 // Backwards compatibility
1054 if (version == "Unknown" || version == string.Empty)
1055 {
1056 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
1057 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1058 }
1059
1060 AgentHasMovedAway(agent, false);
1061
1062 // the user may change their profile information in other region,
1063 // so the userinfo in UserProfileCache is not reliable any more, delete it
1064 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1065 if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1066 {
1067 m_log.DebugFormat(
1068 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1069 }
1034 } 1070 }
1035 1071
1036 if (!WaitForCallback(agent.UUID)) 1072 //m_log.Debug("AFTER CROSS");
1037 { 1073 //Scene.DumpChildrenSeeds(UUID);
1038 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); 1074 //DumpKnownRegions();
1039 ReInstantiateScripts(agent); 1075 }
1040 ResetFromTransit(agent.UUID); 1076 catch (Exception e)
1041 1077 {
1042 // Yikes! We should just have a ref to scene here. 1078 m_log.ErrorFormat(
1043 //agent.Scene.InformClientOfNeighbours(agent); 1079 "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}",
1044 EnableChildAgents(agent); 1080 agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace);
1045
1046 return agent;
1047 }
1048
1049 agent.MakeChildAgent();
1050
1051 // now we have a child agent in this region. Request all interesting data about other (root) agents
1052 agent.SendOtherAgentsAvatarDataToMe();
1053 agent.SendOtherAgentsAppearanceToMe();
1054
1055 // Backwards compatibility
1056 if (version == "Unknown" || version == string.Empty)
1057 {
1058 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
1059 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1060 }
1061
1062 AgentHasMovedAway(agent, false);
1063
1064 // the user may change their profile information in other region,
1065 // so the userinfo in UserProfileCache is not reliable any more, delete it
1066 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1067 if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1068 {
1069 m_log.DebugFormat(
1070 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1071 }
1072 } 1081 }
1073 1082
1074 //m_log.Debug("AFTER CROSS");
1075 //Scene.DumpChildrenSeeds(UUID);
1076 //DumpKnownRegions();
1077 return agent; 1083 return agent;
1078 } 1084 }
1079 1085
@@ -1359,7 +1365,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1359 1365
1360 string reason = String.Empty; 1366 string reason = String.Empty;
1361 1367
1362
1363 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); 1368 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
1364 1369
1365 if (regionAccepted && newAgent) 1370 if (regionAccepted && newAgent)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index cd7d6bc..b286d17 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -31,11 +31,10 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
37using Nini.Config;
38
39using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion; 40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
@@ -69,6 +68,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
69 [Test] 68 [Test]
70 public void TestRegisterRegion() 69 public void TestRegisterRegion()
71 { 70 {
71 TestHelpers.InMethod();
72// log4net.Config.XmlConfigurator.Configure();
73
72 SetUp(); 74 SetUp();
73 75
74 // Create 4 regions 76 // Create 4 regions
@@ -191,7 +193,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
191 results = m_LocalConnector.GetHyperlinks(UUID.Zero); 193 results = m_LocalConnector.GetHyperlinks(UUID.Zero);
192 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); 194 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
193 Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected"); 195 Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected");
194
195 } 196 }
196 } 197 }
197} 198} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4cf854e..43cfd80 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -54,11 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
54 /// <value> 54 /// <value>
55 /// The current movement animation 55 /// The current movement animation
56 /// </value> 56 /// </value>
57 public string CurrentMovementAnimation 57 public string CurrentMovementAnimation { get; private set; }
58 { 58
59 get { return m_movementAnimation; }
60 }
61 protected string m_movementAnimation = "CROUCH";
62 private int m_animTickFall; 59 private int m_animTickFall;
63 public int m_animTickJump; // ScenePresence has to see this to control +Z force 60 public int m_animTickJump; // ScenePresence has to see this to control +Z force
64 public bool m_jumping = false; 61 public bool m_jumping = false;
@@ -79,6 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
79 public ScenePresenceAnimator(ScenePresence sp) 76 public ScenePresenceAnimator(ScenePresence sp)
80 { 77 {
81 m_scenePresence = sp; 78 m_scenePresence = sp;
79 CurrentMovementAnimation = "CROUCH";
82 } 80 }
83 81
84 public void AddAnimation(UUID animID, UUID objectID) 82 public void AddAnimation(UUID animID, UUID objectID)
@@ -131,8 +129,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
131 129
132 public void ResetAnimations() 130 public void ResetAnimations()
133 { 131 {
132// m_log.DebugFormat(
133// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
134// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
135
134 m_animations.Clear(); 136 m_animations.Clear();
135 TrySetMovementAnimation("STAND");
136 } 137 }
137 138
138 /// <summary> 139 /// <summary>
@@ -143,6 +144,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
143 { 144 {
144 if (!m_scenePresence.IsChildAgent) 145 if (!m_scenePresence.IsChildAgent)
145 { 146 {
147// m_log.DebugFormat(
148// "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}",
149// anim, m_scenePresence.Name);
150
146 if (m_animations.TrySetDefaultAnimation( 151 if (m_animations.TrySetDefaultAnimation(
147 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) 152 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
148 { 153 {
@@ -155,12 +160,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
155 SendAnimPack(); 160 SendAnimPack();
156 } 161 }
157 } 162 }
163 else
164 {
165 m_log.WarnFormat(
166 "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
167 anim, m_scenePresence.Name);
168 }
158 } 169 }
159 170
160 /// <summary> 171 /// <summary>
161 /// This method determines the proper movement related animation 172 /// This method determines the proper movement related animation
162 /// </summary> 173 /// </summary>
163 public string GetMovementAnimation() 174 private string DetermineMovementAnimation()
164 { 175 {
165 const float FALL_DELAY = 800f; 176 const float FALL_DELAY = 800f;
166 const float PREJUMP_DELAY = 200f; 177 const float PREJUMP_DELAY = 200f;
@@ -263,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
263 return "FALLDOWN"; 274 return "FALLDOWN";
264 } 275 }
265 276
266 return m_movementAnimation; 277 return CurrentMovementAnimation;
267 } 278 }
268 279
269 #endregion Falling/Floating/Landing 280 #endregion Falling/Floating/Landing
@@ -274,7 +285,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation
274 int jumptime; 285 int jumptime;
275 jumptime = Environment.TickCount - m_animTickJump; 286 jumptime = Environment.TickCount - m_animTickJump;
276 287
277
278 if ((move.Z > 0f) && (!m_jumping)) 288 if ((move.Z > 0f) && (!m_jumping))
279 { 289 {
280 // Start jumping, prejump 290 // Start jumping, prejump
@@ -318,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
318 328
319 #region Ground Movement 329 #region Ground Movement
320 330
321 if (m_movementAnimation == "FALLDOWN") 331 if (CurrentMovementAnimation == "FALLDOWN")
322 { 332 {
323 m_falling = false; 333 m_falling = false;
324 m_animTickFall = Environment.TickCount; 334 m_animTickFall = Environment.TickCount;
@@ -331,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation
331 else 341 else
332 return "LAND"; 342 return "LAND";
333 } 343 }
334 else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP")) 344 else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP"))
335 { 345 {
336 int landElapsed = Environment.TickCount - m_animTickFall; 346 int landElapsed = Environment.TickCount - m_animTickFall;
337 int limit = 1000; 347 int limit = 1000;
338 if(m_movementAnimation == "LAND") limit = 350; 348 if (CurrentMovementAnimation == "LAND")
349 limit = 350;
339 // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client 350 // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client
340 351
341 if ((m_animTickFall != 0) && (landElapsed <= limit)) 352 if ((m_animTickFall != 0) && (landElapsed <= limit))
342 { 353 {
343 return m_movementAnimation; 354 return CurrentMovementAnimation;
344 } 355 }
345 else 356 else
346 { 357 {
@@ -378,7 +389,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
378 #endregion Ground Movement 389 #endregion Ground Movement
379 390
380 m_falling = false; 391 m_falling = false;
381 return m_movementAnimation; 392
393 return CurrentMovementAnimation;
382 } 394 }
383 395
384 /// <summary> 396 /// <summary>
@@ -386,8 +398,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
386 /// </summary> 398 /// </summary>
387 public void UpdateMovementAnimations() 399 public void UpdateMovementAnimations()
388 { 400 {
389 m_movementAnimation = GetMovementAnimation(); 401 CurrentMovementAnimation = DetermineMovementAnimation();
390 TrySetMovementAnimation(m_movementAnimation); 402
403// m_log.DebugFormat(
404// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()",
405// CurrentMovementAnimation, m_scenePresence.Name);
406
407 TrySetMovementAnimation(CurrentMovementAnimation);
391 } 408 }
392 409
393 public UUID[] GetAnimationArray() 410 public UUID[] GetAnimationArray()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 11040b7..3cc72fe 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3325,9 +3325,14 @@ namespace OpenSim.Region.Framework.Scenes
3325 if (hasHollow) ret += 1; 3325 if (hasHollow) ret += 1;
3326 break; 3326 break;
3327 case PrimType.SCULPT: 3327 case PrimType.SCULPT:
3328 ret = 1; 3328 // Special mesh handling
3329 if (Shape.SculptType == (byte)SculptType.Mesh)
3330 ret = 8; // if it's a mesh then max 8 faces
3331 else
3332 ret = 1; // if it's a sculpt then max 1 face
3329 break; 3333 break;
3330 } 3334 }
3335
3331 return ret; 3336 return ret;
3332 } 3337 }
3333 3338
@@ -3340,6 +3345,7 @@ namespace OpenSim.Region.Framework.Scenes
3340 { 3345 {
3341 if (Shape.SculptEntry) 3346 if (Shape.SculptEntry)
3342 return PrimType.SCULPT; 3347 return PrimType.SCULPT;
3348
3343 if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) 3349 if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
3344 { 3350 {
3345 if (Shape.PathCurve == (byte)Extrusion.Straight) 3351 if (Shape.PathCurve == (byte)Extrusion.Straight)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 21c9402..3c97852 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -149,9 +149,9 @@ namespace OpenSim.Region.Framework.Scenes
149 } 149 }
150 private bool m_wasFlying; // add for fly velocity control 150 private bool m_wasFlying; // add for fly velocity control
151 151
152 private int m_lastColCount = -1; //KF: Look for Collision chnages 152// private int m_lastColCount = -1; //KF: Look for Collision chnages
153 private int m_updateCount = 0; //KF: Update Anims for a while 153// private int m_updateCount = 0; //KF: Update Anims for a while
154 private static readonly int UPDATE_COUNT = 10; // how many frames to update for 154// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
155 private List<uint> m_lastColliders = new List<uint>(); 155 private List<uint> m_lastColliders = new List<uint>();
156 156
157 private TeleportFlags m_teleportFlags; 157 private TeleportFlags m_teleportFlags;
@@ -794,9 +794,6 @@ namespace OpenSim.Region.Framework.Scenes
794 794
795 AdjustKnownSeeds(); 795 AdjustKnownSeeds();
796 796
797 // TODO: I think, this won't send anything, as we are still a child here...
798 Animator.TrySetMovementAnimation("STAND");
799
800 // we created a new ScenePresence (a new child agent) in a fresh region. 797 // we created a new ScenePresence (a new child agent) in a fresh region.
801 // Request info about all the (root) agents in this region 798 // Request info about all the (root) agents in this region
802 // Note: This won't send data *to* other clients in that region (children don't send) 799 // Note: This won't send data *to* other clients in that region (children don't send)
@@ -1012,13 +1009,17 @@ namespace OpenSim.Region.Framework.Scenes
1012 1009
1013 /// <summary> 1010 /// <summary>
1014 /// This turns a root agent into a child agent 1011 /// This turns a root agent into a child agent
1012 /// </summary>
1013 /// <remarks>
1015 /// when an agent departs this region for a neighbor, this gets called. 1014 /// when an agent departs this region for a neighbor, this gets called.
1016 /// 1015 ///
1017 /// It doesn't get called for a teleport. Reason being, an agent that 1016 /// It doesn't get called for a teleport. Reason being, an agent that
1018 /// teleports out may not end up anywhere near this region 1017 /// teleports out may not end up anywhere near this region
1019 /// </summary> 1018 /// </remarks>
1020 public void MakeChildAgent() 1019 public void MakeChildAgent()
1021 { 1020 {
1021 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
1022
1022 // Reset these so that teleporting in and walking out isn't seen 1023 // Reset these so that teleporting in and walking out isn't seen
1023 // as teleporting back 1024 // as teleporting back
1024 TeleportFlags = TeleportFlags.Default; 1025 TeleportFlags = TeleportFlags.Default;
@@ -1308,11 +1309,11 @@ namespace OpenSim.Region.Framework.Scenes
1308// "[SCENE PRESENCE]: In {0} received agent update from {1}", 1309// "[SCENE PRESENCE]: In {0} received agent update from {1}",
1309// Scene.RegionInfo.RegionName, remoteClient.Name); 1310// Scene.RegionInfo.RegionName, remoteClient.Name);
1310 1311
1311 //if (IsChildAgent) 1312 if (IsChildAgent)
1312 //{ 1313 {
1313 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); 1314 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
1314 // return; 1315 return;
1315 //} 1316 }
1316 1317
1317 ++m_movementUpdateCount; 1318 ++m_movementUpdateCount;
1318 if (m_movementUpdateCount < 1) 1319 if (m_movementUpdateCount < 1)
@@ -1381,14 +1382,14 @@ namespace OpenSim.Region.Framework.Scenes
1381 1382
1382 #endregion Inputs 1383 #endregion Inputs
1383 1384
1384 // Make anims work for client side autopilot 1385// // Make anims work for client side autopilot
1385 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) 1386// if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0)
1386 m_updateCount = UPDATE_COUNT; 1387// m_updateCount = UPDATE_COUNT;
1387 1388//
1388 // Make turning in place work 1389// // Make turning in place work
1389 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || 1390// if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 ||
1390 (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) 1391// (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
1391 m_updateCount = UPDATE_COUNT; 1392// m_updateCount = UPDATE_COUNT;
1392 1393
1393 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) 1394 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
1394 { 1395 {
@@ -1597,8 +1598,8 @@ namespace OpenSim.Region.Framework.Scenes
1597// } 1598// }
1598// } 1599// }
1599 1600
1600 if (update_movementflag && ParentID == 0) 1601// if (update_movementflag && ParentID == 0)
1601 Animator.UpdateMovementAnimations(); 1602// Animator.UpdateMovementAnimations();
1602 } 1603 }
1603 1604
1604 m_scene.EventManager.TriggerOnClientMovement(this); 1605 m_scene.EventManager.TriggerOnClientMovement(this);
@@ -2315,13 +2316,8 @@ namespace OpenSim.Region.Framework.Scenes
2315 2316
2316 public void HandleAgentSitOnGround() 2317 public void HandleAgentSitOnGround()
2317 { 2318 {
2318 m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. 2319// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
2319 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 2320 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2320
2321 // TODO: This doesn't prevent the user from walking yet.
2322 // Setting parent ID would fix this, if we knew what value
2323 // to use. Or we could add a m_isSitting variable.
2324 //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2325 SitGround = true; 2321 SitGround = true;
2326 RemoveFromPhysicalScene(); 2322 RemoveFromPhysicalScene();
2327 } 2323 }
@@ -2933,9 +2929,12 @@ namespace OpenSim.Region.Framework.Scenes
2933 2929
2934 public void Reset() 2930 public void Reset()
2935 { 2931 {
2932// m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName);
2933
2936 // Put the child agent back at the center 2934 // Put the child agent back at the center
2937 AbsolutePosition 2935 AbsolutePosition
2938 = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); 2936 = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70);
2937
2939 Animator.ResetAnimations(); 2938 Animator.ResetAnimations();
2940 } 2939 }
2941 2940
@@ -3158,7 +3157,7 @@ namespace OpenSim.Region.Framework.Scenes
3158 } 3157 }
3159 } 3158 }
3160 3159
3161 public void CopyFrom(AgentData cAgent) 3160 private void CopyFrom(AgentData cAgent)
3162 { 3161 {
3163 m_originRegionID = cAgent.RegionID; 3162 m_originRegionID = cAgent.RegionID;
3164 3163
@@ -3217,13 +3216,10 @@ namespace OpenSim.Region.Framework.Scenes
3217 } 3216 }
3218 } 3217 }
3219 catch { } 3218 catch { }
3220 // Animations 3219
3221 try 3220 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3222 { 3221 if (cAgent.Anims != null)
3223 Animator.ResetAnimations();
3224 Animator.Animations.FromArray(cAgent.Anims); 3222 Animator.Animations.FromArray(cAgent.Anims);
3225 }
3226 catch { }
3227 3223
3228 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) 3224 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3229 { 3225 {
@@ -3305,19 +3301,32 @@ namespace OpenSim.Region.Framework.Scenes
3305 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); 3301 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true);
3306 } 3302 }
3307 3303
3308 // Event called by the physics plugin to tell the avatar about a collision. 3304 /// <summary>
3309 private void PhysicsCollisionUpdate(EventArgs e) 3305 /// Event called by the physics plugin to tell the avatar about a collision.
3306 /// </summary>
3307 /// <remarks>
3308 /// This function is called continuously, even when there are no collisions. If the avatar is walking on the
3309 /// ground or a prim then there will be collision information between the avatar and the surface.
3310 ///
3311 /// FIXME: However, we can't safely avoid calling this yet where there are no collisions without analyzing whether
3312 /// any part of this method is relying on an every-frame call.
3313 /// </remarks>
3314 /// <param name="e"></param>
3315 public void PhysicsCollisionUpdate(EventArgs e)
3310 { 3316 {
3317 if (IsChildAgent)
3318 return;
3319
3311 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) 3320 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
3312 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( 3321 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
3313 // as of this comment the interval is set in AddToPhysicalScene 3322 // as of this comment the interval is set in AddToPhysicalScene
3314 if (Animator != null) 3323 if (Animator != null)
3315 { 3324 {
3316 if (m_updateCount > 0) 3325// if (m_updateCount > 0)
3317 { 3326// {
3318 Animator.UpdateMovementAnimations(); 3327 Animator.UpdateMovementAnimations();
3319 m_updateCount--; 3328// m_updateCount--;
3320 } 3329// }
3321 } 3330 }
3322 3331
3323 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 3332 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
@@ -3325,13 +3334,13 @@ namespace OpenSim.Region.Framework.Scenes
3325 3334
3326 CollisionPlane = Vector4.UnitW; 3335 CollisionPlane = Vector4.UnitW;
3327 3336
3328 // No collisions at all means we may be flying. Update always 3337// // No collisions at all means we may be flying. Update always
3329 // to make falling work 3338// // to make falling work
3330 if (m_lastColCount != coldata.Count || coldata.Count == 0) 3339// if (m_lastColCount != coldata.Count || coldata.Count == 0)
3331 { 3340// {
3332 m_updateCount = UPDATE_COUNT; 3341// m_updateCount = UPDATE_COUNT;
3333 m_lastColCount = coldata.Count; 3342// m_lastColCount = coldata.Count;
3334 } 3343// }
3335 3344
3336 if (coldata.Count != 0 && Animator != null) 3345 if (coldata.Count != 0 && Animator != null)
3337 { 3346 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index f0bbf0b..d4c299f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -31,7 +31,7 @@ using System.Reflection;
31using System.Text; 31using System.Text;
32using System.Threading; 32using System.Threading;
33using System.Timers; 33using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer = System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
@@ -39,11 +39,13 @@ using OpenSim.Framework;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.ClientStack.Linden;
42using OpenSim.Region.CoreModules.Framework.EntityTransfer; 43using OpenSim.Region.CoreModules.Framework.EntityTransfer;
43using OpenSim.Region.CoreModules.World.Serialiser; 44using OpenSim.Region.CoreModules.World.Serialiser;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
45using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
48using GridRegion = OpenSim.Services.Interfaces.GridRegion;
47 49
48namespace OpenSim.Region.Framework.Scenes.Tests 50namespace OpenSim.Region.Framework.Scenes.Tests
49{ 51{
@@ -103,21 +105,71 @@ namespace OpenSim.Region.Framework.Scenes.Tests
103 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 105 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
104 106
105 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); 107 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
108 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
106 109
107 scene.IncomingCloseAgent(sp.UUID); 110 scene.IncomingCloseAgent(sp.UUID);
108 111
109 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); 112 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
110 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); 113 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
114 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0));
115 }
116
117 [Test]
118 public void TestCreateChildScenePresence()
119 {
120 TestHelpers.InMethod();
121// log4net.Config.XmlConfigurator.Configure();
122
123 LocalSimulationConnectorModule lsc = new LocalSimulationConnectorModule();
124
125 IConfigSource configSource = new IniConfigSource();
126 IConfig config = configSource.AddConfig("Modules");
127 config.Set("SimulationServices", "LocalSimulationConnectorModule");
128
129 TestScene scene = SceneHelpers.SetupScene();
130 SceneHelpers.SetupSceneModules(scene, configSource, lsc);
131
132 UUID agentId = TestHelpers.ParseTail(0x01);
133 AgentCircuitData acd = SceneHelpers.GenerateAgentData(agentId);
134 acd.child = true;
135
136 GridRegion region = scene.GridService.GetRegionByName(UUID.Zero, scene.RegionInfo.RegionName);
137 string reason;
138
139 // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and
140 // establish a child scene presence. We pass in the circuit code that the client has to connect with ***
141 // XXX: ViaLogin may not be correct here.
142 scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason);
143
144 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
145 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
146
147 // There's no scene presence yet since only an agent circuit has been established.
148 Assert.That(scene.GetScenePresence(agentId), Is.Null);
149
150 // *** This is the second stage, where the client established a child agent/scene presence using the
151 // circuit code given to the scene in stage 1 ***
152 TestClient client = new TestClient(acd, scene);
153 scene.AddNewClient(client, PresenceType.User);
154
155 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
156 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
157
158 ScenePresence sp = scene.GetScenePresence(agentId);
159 Assert.That(sp, Is.Not.Null);
160 Assert.That(sp.UUID, Is.EqualTo(agentId));
161 Assert.That(sp.IsChildAgent, Is.True);
111 } 162 }
112 163
113 /// <summary> 164 /// <summary>
114 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region 165 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
115 /// </summary> 166 /// </summary>
116 /// <remarks> 167 /// <remarks>
117 /// Please note that unlike the other tests here, this doesn't rely on structures 168 /// Please note that unlike the other tests here, this doesn't rely on anything set up in the instance fields.
169 /// INCOMPLETE
118 /// </remarks> 170 /// </remarks>
119 [Test] 171 [Test]
120 public void TestChildAgentEstablished() 172 public void TestChildAgentEstablishedInNeighbour()
121 { 173 {
122 TestHelpers.InMethod(); 174 TestHelpers.InMethod();
123// log4net.Config.XmlConfigurator.Configure(); 175// log4net.Config.XmlConfigurator.Configure();
@@ -125,18 +177,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests
125 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); 177 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
126 178
127 TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); 179 TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
128// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); 180 TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
129 181
130 IConfigSource configSource = new IniConfigSource(); 182 IConfigSource configSource = new IniConfigSource();
131 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); 183 IConfig config = configSource.AddConfig("Startup");
184 config.Set("serverside_object_permissions", true);
185 config.Set("EventQueue", true);
186
132 EntityTransferModule etm = new EntityTransferModule(); 187 EntityTransferModule etm = new EntityTransferModule();
188
189 EventQueueGetModule eqgm1 = new EventQueueGetModule();
190 SceneHelpers.SetupSceneModules(myScene1, configSource, etm, eqgm1);
191
192 EventQueueGetModule eqgm2 = new EventQueueGetModule();
193 SceneHelpers.SetupSceneModules(myScene2, configSource, etm, eqgm2);
133 194
134 SceneHelpers.SetupSceneModules(myScene1, configSource, etm); 195// SceneHelpers.AddScenePresence(myScene1, agent1Id);
135
136 SceneHelpers.AddScenePresence(myScene1, agent1Id);
137// ScenePresence childPresence = myScene2.GetScenePresence(agent1); 196// ScenePresence childPresence = myScene2.GetScenePresence(agent1);
138 197//
139 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents 198// // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
140// Assert.That(childPresence, Is.Not.Null); 199// Assert.That(childPresence, Is.Not.Null);
141// Assert.That(childPresence.IsChildAgent, Is.True); 200// Assert.That(childPresence.IsChildAgent, Is.True);
142 } 201 }
@@ -194,48 +253,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
194// Assert.That(presence, Is.Null, "presence is not null"); 253// Assert.That(presence, Is.Null, "presence is not null");
195// } 254// }
196 255
197 [Test]
198 public void T012_TestAddNeighbourRegion()
199 {
200 TestHelpers.InMethod();
201
202 string reason;
203
204 if (acd1 == null)
205 fixNullPresence();
206
207 scene.NewUserConnection(acd1, 0, out reason);
208 if (testclient == null)
209 testclient = new TestClient(acd1, scene);
210 scene.AddNewClient(testclient, PresenceType.User);
211
212 ScenePresence presence = scene.GetScenePresence(agent1);
213 presence.MakeRootAgent(new Vector3(90,90,90),false);
214
215 string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
216
217 presence.AddNeighbourRegion(region2, cap);
218 presence.AddNeighbourRegion(region3, cap);
219
220 Assert.That(presence.KnownRegionCount, Is.EqualTo(2));
221 }
222
223 [Test]
224 public void T013_TestRemoveNeighbourRegion()
225 {
226 TestHelpers.InMethod();
227
228 ScenePresence presence = scene.GetScenePresence(agent1);
229 presence.RemoveNeighbourRegion(region3);
230
231 Assert.That(presence.KnownRegionCount,Is.EqualTo(1));
232 /*
233 presence.MakeChildAgent;
234 presence.MakeRootAgent;
235 CompleteAvatarMovement
236 */
237 }
238
239 // I'm commenting this test because it does not represent 256 // I'm commenting this test because it does not represent
240 // crossings. The Thread.Sleep's in here are not meaningful mocks, 257 // crossings. The Thread.Sleep's in here are not meaningful mocks,
241 // and they sometimes fail in panda. 258 // and they sometimes fail in panda.
@@ -338,33 +355,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
338 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); 355 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
339 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); 356 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
340 } 357 }
341
342 public void fixNullPresence()
343 {
344 string firstName = "testfirstname";
345
346 AgentCircuitData agent = new AgentCircuitData();
347 agent.AgentID = agent1;
348 agent.firstname = firstName;
349 agent.lastname = "testlastname";
350 agent.SessionID = UUID.Zero;
351 agent.SecureSessionID = UUID.Zero;
352 agent.circuitcode = 123;
353 agent.BaseFolder = UUID.Zero;
354 agent.InventoryFolder = UUID.Zero;
355 agent.startpos = Vector3.Zero;
356 agent.CapsPath = GetRandomCapsObjectPath();
357 agent.Appearance = new AvatarAppearance();
358
359 acd1 = agent;
360 }
361
362 public static string GetRandomCapsObjectPath()
363 {
364 UUID caps = UUID.Random();
365 string capsPath = caps.ToString();
366 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
367 return capsPath;
368 }
369 } 358 }
370} \ No newline at end of file 359} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
new file mode 100644
index 0000000..4a0533c
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
@@ -0,0 +1,70 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using System.Threading;
33using System.Timers;
34using Nini.Config;
35using NUnit.Framework;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.CoreModules.Framework.EntityTransfer;
42using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Region.Physics.Manager;
45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47
48namespace OpenSim.Region.Framework.Scenes.Tests
49{
50 /// <summary>
51 /// Scene presence animation tests
52 /// </summary>
53 [TestFixture]
54 public class ScenePresenceAnimationTests
55 {
56 [Test]
57 public void TestFlyingAnimation()
58 {
59 TestHelpers.InMethod();
60// log4net.Config.XmlConfigurator.Configure();
61
62 TestScene scene = SceneHelpers.SetupScene();
63 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
64 sp.PhysicsActor.Flying = true;
65 sp.PhysicsCollisionUpdate(new CollisionEventUpdate());
66
67 Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER"));
68 }
69 }
70} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e26aef3..461ee3e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5975,7 +5975,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5975 flags |= ScriptBaseClass.AGENT_TYPING; 5975 flags |= ScriptBaseClass.AGENT_TYPING;
5976 } 5976 }
5977 5977
5978 string agentMovementAnimation = agent.Animator.GetMovementAnimation(); 5978 string agentMovementAnimation = agent.Animator.CurrentMovementAnimation;
5979 5979
5980 if (agentMovementAnimation == "CROUCH") 5980 if (agentMovementAnimation == "CROUCH")
5981 { 5981 {