aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2011-12-02 18:57:57 -0500
committerBlueWall2011-12-02 18:57:57 -0500
commit21f4ee8a3d3712b44514080fa284ca36c8a1196d (patch)
treea6200d79186597f15adaf2b3582390a1a4b2d415
parentMake fix to Nini for null references in some cases. (diff)
parentStop some places where we're trying to reset animations in child agents where... (diff)
downloadopensim-SC_OLD-21f4ee8a3d3712b44514080fa284ca36c8a1196d.zip
opensim-SC_OLD-21f4ee8a3d3712b44514080fa284ca36c8a1196d.tar.gz
opensim-SC_OLD-21f4ee8a3d3712b44514080fa284ca36c8a1196d.tar.bz2
opensim-SC_OLD-21f4ee8a3d3712b44514080fa284ca36c8a1196d.tar.xz
Merge branch 'master' of /home/opensim/var/repo/opensim
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs4
-rw-r--r--OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs183
-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.cs210
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs28
8 files changed, 430 insertions, 244 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index e1b4fe7..245d931 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -350,7 +350,5 @@ namespace OpenSim.Capabilities.Handlers
350 } 350 }
351 return null; 351 return null;
352 } 352 }
353
354
355 } 353 }
356} 354} \ No newline at end of file
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
new file mode 100644
index 0000000..b89fd6a
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
@@ -0,0 +1,183 @@
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 OpenMetaverse;
39using OpenMetaverse.StructuredData;
40using OpenMetaverse.Imaging;
41using OpenSim.Framework;
42using OpenSim.Framework.Capabilities;
43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Services.Interfaces;
47using Caps = OpenSim.Framework.Capabilities.Caps;
48
49namespace OpenSim.Capabilities.Handlers
50{
51 public class UploadBakedTextureHandler
52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 private Caps m_HostCapsObj;
56 private IAssetService m_assetService;
57 private bool m_persistBakedTextures;
58
59 public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures)
60 {
61 m_HostCapsObj = caps;
62 m_assetService = assetService;
63 m_persistBakedTextures = persistBakedTextures;
64 }
65
66 /// <summary>
67 /// Handle a request from the client for a Uri to upload a baked texture.
68 /// </summary>
69 /// <param name="request"></param>
70 /// <param name="path"></param>
71 /// <param name="param"></param>
72 /// <param name="httpRequest"></param>
73 /// <param name="httpResponse"></param>
74 /// <returns>The upload response if the request is successful, null otherwise.</returns>
75 public string UploadBakedTexture(
76 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
77 {
78 try
79 {
80// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName);
81
82 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
83 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
84
85 BakedTextureUploader uploader =
86 new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener);
87 uploader.OnUpLoad += BakedTextureUploaded;
88
89 m_HostCapsObj.HttpListener.AddStreamHandler(
90 new BinaryStreamHandler("POST", capsBase + uploaderPath,
91 uploader.uploaderCaps));
92
93 string protocol = "http://";
94
95 if (m_HostCapsObj.SSLCaps)
96 protocol = "https://";
97
98 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
99 m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
100
101 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
102 uploadResponse.uploader = uploaderURL;
103 uploadResponse.state = "upload";
104
105 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
106 }
107 catch (Exception e)
108 {
109 m_log.Error("[UPLOAD BAKED TEXTURE HANDLER]: " + e.ToString());
110 }
111
112 return null;
113 }
114
115 /// <summary>
116 /// Called when a baked texture has been successfully uploaded by a client.
117 /// </summary>
118 /// <param name="assetID"></param>
119 /// <param name="data"></param>
120 private void BakedTextureUploaded(UUID assetID, byte[] data)
121 {
122 // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
123
124 AssetBase asset;
125 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
126 asset.Data = data;
127 asset.Temporary = true;
128 asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
129 m_assetService.Store(asset);
130 }
131 }
132
133 class BakedTextureUploader
134 {
135// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
136
137 public event Action<UUID, byte[]> OnUpLoad;
138
139 private string uploaderPath = String.Empty;
140 private UUID newAssetID;
141 private IHttpServer httpListener;
142
143 public BakedTextureUploader(string path, IHttpServer httpServer)
144 {
145 newAssetID = UUID.Random();
146 uploaderPath = path;
147 httpListener = httpServer;
148 // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
149 }
150
151 /// <summary>
152 /// Handle raw uploaded baked texture data.
153 /// </summary>
154 /// <param name="data"></param>
155 /// <param name="path"></param>
156 /// <param name="param"></param>
157 /// <returns></returns>
158 public string uploaderCaps(byte[] data, string path, string param)
159 {
160 Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
161
162 // Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
163 // on another thread which might send out avatar updates before the asset has been put into the asset
164 // service.
165 if (handlerUpLoad != null)
166 handlerUpLoad(newAssetID, data);
167
168 string res = String.Empty;
169 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
170 uploadComplete.new_asset = newAssetID.ToString();
171 uploadComplete.new_inventory_item = UUID.Zero;
172 uploadComplete.state = "complete";
173
174 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
175
176 httpListener.RemoveStreamHandler("POST", uploaderPath);
177
178// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID);
179
180 return res;
181 }
182 }
183} \ No newline at end of file
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 d01f89b..99064c8 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -495,7 +495,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
495 // Well, this is it. The agent is over there. 495 // Well, this is it. The agent is over there.
496 KillEntity(sp.Scene, sp.LocalId); 496 KillEntity(sp.Scene, sp.LocalId);
497 497
498
499 // Now let's make it officially a child agent 498 // Now let's make it officially a child agent
500 sp.MakeChildAgent(); 499 sp.MakeChildAgent();
501 500
@@ -510,9 +509,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
510 sp.Scene.IncomingCloseAgent(sp.UUID); 509 sp.Scene.IncomingCloseAgent(sp.UUID);
511 } 510 }
512 else 511 else
512 {
513 // now we have a child agent in this region. 513 // now we have a child agent in this region.
514 sp.Reset(); 514 sp.Reset();
515 515 }
516 516
517 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 517 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
518 if (sp.Scene.NeedSceneCacheClear(sp.UUID)) 518 if (sp.Scene.NeedSceneCacheClear(sp.UUID))
@@ -946,111 +946,121 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
946 ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, 946 ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion,
947 bool isFlying, string version) 947 bool isFlying, string version)
948 { 948 {
949 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 949 try
950
951 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
952
953 Scene m_scene = agent.Scene;
954
955 if (neighbourRegion != null)
956 { 950 {
957 if (!agent.ValidateAttachments()) 951 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
958 m_log.DebugFormat( 952
959 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", 953 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
960 agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); 954
961 955 Scene m_scene = agent.Scene;
962 pos = pos + (agent.Velocity); 956
963 957 if (neighbourRegion != null)
964 SetInTransit(agent.UUID);
965 AgentData cAgent = new AgentData();
966 agent.CopyTo(cAgent);
967 cAgent.Position = pos;
968 if (isFlying)
969 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
970 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
971 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
972
973 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
974 { 958 {
975 // region doesn't take it 959 if (!agent.ValidateAttachments())
976 ReInstantiateScripts(agent); 960 m_log.DebugFormat(
977 ResetFromTransit(agent.UUID); 961 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
978 return agent; 962 agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
963
964 pos = pos + (agent.Velocity);
965
966 SetInTransit(agent.UUID);
967 AgentData cAgent = new AgentData();
968 agent.CopyTo(cAgent);
969 cAgent.Position = pos;
970 if (isFlying)
971 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
972 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
973 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
974
975 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
976 {
977 // region doesn't take it
978 ReInstantiateScripts(agent);
979 ResetFromTransit(agent.UUID);
980 return agent;
981 }
982
983 // Next, let's close the child agent connections that are too far away.
984 agent.CloseChildAgents(neighbourx, neighboury);
985
986 //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
987 agent.ControllingClient.RequestClientInfo();
988
989 //m_log.Debug("BEFORE CROSS");
990 //Scene.DumpChildrenSeeds(UUID);
991 //DumpKnownRegions();
992 string agentcaps;
993 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
994 {
995 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
996 neighbourRegion.RegionHandle);
997 return agent;
998 }
999 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
1000
1001 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
1002
1003 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
1004 if (eq != null)
1005 {
1006 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1007 capsPath, agent.UUID, agent.ControllingClient.SessionId);
1008 }
1009 else
1010 {
1011 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1012 capsPath);
1013 }
1014
1015 if (!WaitForCallback(agent.UUID))
1016 {
1017 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
1018 ReInstantiateScripts(agent);
1019 ResetFromTransit(agent.UUID);
1020
1021 // Yikes! We should just have a ref to scene here.
1022 //agent.Scene.InformClientOfNeighbours(agent);
1023 EnableChildAgents(agent);
1024
1025 return agent;
1026 }
1027
1028 agent.MakeChildAgent();
1029
1030 // now we have a child agent in this region. Request all interesting data about other (root) agents
1031 agent.SendOtherAgentsAvatarDataToMe();
1032 agent.SendOtherAgentsAppearanceToMe();
1033
1034 // Backwards compatibility
1035 if (version == "Unknown" || version == string.Empty)
1036 {
1037 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
1038 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1039 }
1040
1041 AgentHasMovedAway(agent, false);
1042
1043 // the user may change their profile information in other region,
1044 // so the userinfo in UserProfileCache is not reliable any more, delete it
1045 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1046 if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1047 {
1048 m_log.DebugFormat(
1049 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1050 }
979 } 1051 }
980 1052
981 // Next, let's close the child agent connections that are too far away. 1053 //m_log.Debug("AFTER CROSS");
982 agent.CloseChildAgents(neighbourx, neighboury);
983
984 //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
985 agent.ControllingClient.RequestClientInfo();
986
987 //m_log.Debug("BEFORE CROSS");
988 //Scene.DumpChildrenSeeds(UUID); 1054 //Scene.DumpChildrenSeeds(UUID);
989 //DumpKnownRegions(); 1055 //DumpKnownRegions();
990 string agentcaps; 1056 }
991 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) 1057 catch (Exception e)
992 { 1058 {
993 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", 1059 m_log.ErrorFormat(
994 neighbourRegion.RegionHandle); 1060 "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}",
995 return agent; 1061 agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace);
996 }
997 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
998
999 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
1000
1001 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
1002 if (eq != null)
1003 {
1004 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1005 capsPath, agent.UUID, agent.ControllingClient.SessionId);
1006 }
1007 else
1008 {
1009 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1010 capsPath);
1011 }
1012
1013 if (!WaitForCallback(agent.UUID))
1014 {
1015 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
1016 ReInstantiateScripts(agent);
1017 ResetFromTransit(agent.UUID);
1018
1019 // Yikes! We should just have a ref to scene here.
1020 //agent.Scene.InformClientOfNeighbours(agent);
1021 EnableChildAgents(agent);
1022
1023 return agent;
1024 }
1025
1026 agent.MakeChildAgent();
1027
1028 // now we have a child agent in this region. Request all interesting data about other (root) agents
1029 agent.SendOtherAgentsAvatarDataToMe();
1030 agent.SendOtherAgentsAppearanceToMe();
1031
1032 // Backwards compatibility
1033 if (version == "Unknown" || version == string.Empty)
1034 {
1035 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
1036 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1037 }
1038
1039 AgentHasMovedAway(agent, false);
1040
1041 // the user may change their profile information in other region,
1042 // so the userinfo in UserProfileCache is not reliable any more, delete it
1043 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1044 if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1045 {
1046 m_log.DebugFormat(
1047 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1048 }
1049 } 1062 }
1050 1063
1051 //m_log.Debug("AFTER CROSS");
1052 //Scene.DumpChildrenSeeds(UUID);
1053 //DumpKnownRegions();
1054 return agent; 1064 return agent;
1055 } 1065 }
1056 1066
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4cf854e..6b1208c 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -131,8 +131,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
131 131
132 public void ResetAnimations() 132 public void ResetAnimations()
133 { 133 {
134// m_log.DebugFormat(
135// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
136// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
137
134 m_animations.Clear(); 138 m_animations.Clear();
135 TrySetMovementAnimation("STAND");
136 } 139 }
137 140
138 /// <summary> 141 /// <summary>
@@ -155,6 +158,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation
155 SendAnimPack(); 158 SendAnimPack();
156 } 159 }
157 } 160 }
161 // Don't leave this on since on teleports SP.HandleAgentUpdate() still hammers us for a while after it teleports
162// else
163// {
164// m_log.WarnFormat(
165// "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
166// anim, m_scenePresence.Name);
167// throw new Exception(string.Format("aaargh on setting {0}", anim));
168// }
158 } 169 }
159 170
160 /// <summary> 171 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9a71cd4..3ac6327 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3700,7 +3700,6 @@ namespace OpenSim.Region.Framework.Scenes
3700 return false; 3700 return false;
3701 } 3701 }
3702 3702
3703
3704 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 3703 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
3705 3704
3706 if (childAgentUpdate != null) 3705 if (childAgentUpdate != null)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c2d3501..b93b67d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -782,9 +782,6 @@ namespace OpenSim.Region.Framework.Scenes
782 782
783 AdjustKnownSeeds(); 783 AdjustKnownSeeds();
784 784
785 // TODO: I think, this won't send anything, as we are still a child here...
786 Animator.TrySetMovementAnimation("STAND");
787
788 // we created a new ScenePresence (a new child agent) in a fresh region. 785 // we created a new ScenePresence (a new child agent) in a fresh region.
789 // Request info about all the (root) agents in this region 786 // Request info about all the (root) agents in this region
790 // Note: This won't send data *to* other clients in that region (children don't send) 787 // Note: This won't send data *to* other clients in that region (children don't send)
@@ -998,13 +995,17 @@ namespace OpenSim.Region.Framework.Scenes
998 995
999 /// <summary> 996 /// <summary>
1000 /// This turns a root agent into a child agent 997 /// This turns a root agent into a child agent
998 /// </summary>
999 /// <remarks>
1001 /// when an agent departs this region for a neighbor, this gets called. 1000 /// when an agent departs this region for a neighbor, this gets called.
1002 /// 1001 ///
1003 /// It doesn't get called for a teleport. Reason being, an agent that 1002 /// It doesn't get called for a teleport. Reason being, an agent that
1004 /// teleports out may not end up anywhere near this region 1003 /// teleports out may not end up anywhere near this region
1005 /// </summary> 1004 /// </remarks>
1006 public void MakeChildAgent() 1005 public void MakeChildAgent()
1007 { 1006 {
1007 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
1008
1008 // Reset these so that teleporting in and walking out isn't seen 1009 // Reset these so that teleporting in and walking out isn't seen
1009 // as teleporting back 1010 // as teleporting back
1010 TeleportFlags = TeleportFlags.Default; 1011 TeleportFlags = TeleportFlags.Default;
@@ -2298,11 +2299,6 @@ namespace OpenSim.Region.Framework.Scenes
2298 { 2299 {
2299 m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. 2300 m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
2300 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 2301 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2301
2302 // TODO: This doesn't prevent the user from walking yet.
2303 // Setting parent ID would fix this, if we knew what value
2304 // to use. Or we could add a m_isSitting variable.
2305 //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2306 SitGround = true; 2302 SitGround = true;
2307 RemoveFromPhysicalScene(); 2303 RemoveFromPhysicalScene();
2308 } 2304 }
@@ -2911,9 +2907,12 @@ namespace OpenSim.Region.Framework.Scenes
2911 2907
2912 public void Reset() 2908 public void Reset()
2913 { 2909 {
2910// m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName);
2911
2914 // Put the child agent back at the center 2912 // Put the child agent back at the center
2915 AbsolutePosition 2913 AbsolutePosition
2916 = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); 2914 = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70);
2915
2917 Animator.ResetAnimations(); 2916 Animator.ResetAnimations();
2918 } 2917 }
2919 2918
@@ -3136,7 +3135,7 @@ namespace OpenSim.Region.Framework.Scenes
3136 } 3135 }
3137 } 3136 }
3138 3137
3139 public void CopyFrom(AgentData cAgent) 3138 private void CopyFrom(AgentData cAgent)
3140 { 3139 {
3141 m_originRegionID = cAgent.RegionID; 3140 m_originRegionID = cAgent.RegionID;
3142 3141
@@ -3195,13 +3194,8 @@ namespace OpenSim.Region.Framework.Scenes
3195 } 3194 }
3196 } 3195 }
3197 catch { } 3196 catch { }
3198 // Animations 3197
3199 try 3198 Animator.Animations.FromArray(cAgent.Anims);
3200 {
3201 Animator.ResetAnimations();
3202 Animator.Animations.FromArray(cAgent.Anims);
3203 }
3204 catch { }
3205 3199
3206 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) 3200 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3207 { 3201 {