aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-02-23 01:40:30 +0000
committerMelanie2012-02-23 01:40:30 +0000
commit1dfc9902649bfb4f02340644a0589fe139a3322a (patch)
tree631a932e9317c50d96c7dbaa91ffc675421a9b48
parentRestore the taskItem null check that I accidentally blatted in 5397a6d (diff)
downloadopensim-SC-1dfc9902649bfb4f02340644a0589fe139a3322a.zip
opensim-SC-1dfc9902649bfb4f02340644a0589fe139a3322a.tar.gz
opensim-SC-1dfc9902649bfb4f02340644a0589fe139a3322a.tar.bz2
opensim-SC-1dfc9902649bfb4f02340644a0589fe139a3322a.tar.xz
Add a position parameter to region crossing of objects. This avoids the
potential bad update that places an object at the opposite side of the origin sim for a moment before actually crossing it. Especially important in grids like OSG where lag between sims is high.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs10
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs3
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
8 files changed, 25 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 8f047ea..f6e4dbf 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1704,14 +1704,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1704 1704
1705 // Offset the positions for the new region across the border 1705 // Offset the positions for the new region across the border
1706 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 1706 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
1707 grp.RootPart.GroupPosition = pos;
1708 1707
1709 // If we fail to cross the border, then reset the position of the scene object on that border. 1708 // If we fail to cross the border, then reset the position of the scene object on that border.
1710 uint x = 0, y = 0; 1709 uint x = 0, y = 0;
1711 Utils.LongToUInts(newRegionHandle, out x, out y); 1710 Utils.LongToUInts(newRegionHandle, out x, out y);
1712 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 1711 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
1713 1712
1714 if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent)) 1713 if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
1715 { 1714 {
1716 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); 1715 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
1717 1716
@@ -1741,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1741 /// true if the crossing itself was successful, false on failure 1740 /// true if the crossing itself was successful, false on failure
1742 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region 1741 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
1743 /// </returns> 1742 /// </returns>
1744 protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent) 1743 protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent)
1745 { 1744 {
1746 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); 1745 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
1747 1746
@@ -1766,7 +1765,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1766 //if (m_interregionCommsOut != null) 1765 //if (m_interregionCommsOut != null)
1767 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); 1766 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
1768 if (m_aScene.SimulationService != null) 1767 if (m_aScene.SimulationService != null)
1769 successYN = m_aScene.SimulationService.CreateObject(destination, grp, true); 1768 successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true);
1770 1769
1771 if (successYN) 1770 if (successYN)
1772 { 1771 {
@@ -1825,7 +1824,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1825 gobj.IsAttachment = false; 1824 gobj.IsAttachment = false;
1826 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 1825 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1827 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); 1826 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
1828 CrossPrimGroupIntoNewRegion(destination, gobj, silent); 1827 CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent);
1829 } 1828 }
1830 } 1829 }
1831 1830
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index a17c6ae..85e7e94 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
315 * Object-related communications 315 * Object-related communications
316 */ 316 */
317 317
318 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 318 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
319 { 319 {
320 if (destination == null) 320 if (destination == null)
321 return false; 321 return false;
@@ -330,12 +330,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
330 // We need to make a local copy of the object 330 // We need to make a local copy of the object
331 ISceneObject sogClone = sog.CloneForNewScene(); 331 ISceneObject sogClone = sog.CloneForNewScene();
332 sogClone.SetState(sog.GetStateSnapshot(), s); 332 sogClone.SetState(sog.GetStateSnapshot(), s);
333 return s.IncomingCreateObject(sogClone); 333 return s.IncomingCreateObject(newPosition, sogClone);
334 } 334 }
335 else 335 else
336 { 336 {
337 // Use the object as it came through the wire 337 // Use the object as it came through the wire
338 return s.IncomingCreateObject(sog); 338 return s.IncomingCreateObject(newPosition, sog);
339 } 339 }
340 } 340 }
341 } 341 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index f8cea71..eaf9506 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -282,13 +282,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
282 * Object-related communications 282 * Object-related communications
283 */ 283 */
284 284
285 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 285 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
286 { 286 {
287 if (destination == null) 287 if (destination == null)
288 return false; 288 return false;
289 289
290 // Try local first 290 // Try local first
291 if (m_localBackend.CreateObject(destination, sog, isLocalCall)) 291 if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
292 { 292 {
293 //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); 293 //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
294 return true; 294 return true;
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
296 296
297 // else do the remote thing 297 // else do the remote thing
298 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 298 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
299 return m_remoteConnector.CreateObject(destination, sog, isLocalCall); 299 return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
300 300
301 return false; 301 return false;
302 } 302 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e7f835c..7b79732 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2317,7 +2317,7 @@ namespace OpenSim.Region.Framework.Scenes
2317 /// </summary> 2317 /// </summary>
2318 /// <param name="sog"></param> 2318 /// <param name="sog"></param>
2319 /// <returns></returns> 2319 /// <returns></returns>
2320 public bool IncomingCreateObject(ISceneObject sog) 2320 public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
2321 { 2321 {
2322 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition, 2322 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
2323 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment); 2323 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
@@ -2333,6 +2333,9 @@ namespace OpenSim.Region.Framework.Scenes
2333 return false; 2333 return false;
2334 } 2334 }
2335 2335
2336 if (newPosition != Vector3.Zero)
2337 newObject.RootPart.GroupPosition = newPosition;
2338
2336 if (!AddSceneObject(newObject)) 2339 if (!AddSceneObject(newObject))
2337 { 2340 {
2338 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); 2341 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index daf711c..9cfdf9f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3223,7 +3223,7 @@ namespace OpenSim.Region.Framework.Scenes
3223 ((SceneObjectGroup)so).LocalId = 0; 3223 ((SceneObjectGroup)so).LocalId = 0;
3224 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); 3224 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
3225 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene); 3225 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
3226 m_scene.IncomingCreateObject(so); 3226 m_scene.IncomingCreateObject(Vector3.Zero, so);
3227 } 3227 }
3228 } 3228 }
3229 } 3229 }
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
index 984b843..f0d8f69 100644
--- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
@@ -136,6 +136,8 @@ namespace OpenSim.Server.Handlers.Simulation
136 int x = 0, y = 0; 136 int x = 0, y = 0;
137 UUID uuid = UUID.Zero; 137 UUID uuid = UUID.Zero;
138 string regionname = string.Empty; 138 string regionname = string.Empty;
139 Vector3 newPosition = Vector3.Zero;
140
139 if (args.ContainsKey("destination_x") && args["destination_x"] != null) 141 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
140 Int32.TryParse(args["destination_x"].AsString(), out x); 142 Int32.TryParse(args["destination_x"].AsString(), out x);
141 if (args.ContainsKey("destination_y") && args["destination_y"] != null) 143 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
@@ -144,6 +146,8 @@ namespace OpenSim.Server.Handlers.Simulation
144 UUID.TryParse(args["destination_uuid"].AsString(), out uuid); 146 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
145 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 147 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
146 regionname = args["destination_name"].ToString(); 148 regionname = args["destination_name"].ToString();
149 if (args.ContainsKey("new_position") && args["new_position"] != null)
150 Vector3.TryParse(args["new_position"], out newPosition);
147 151
148 GridRegion destination = new GridRegion(); 152 GridRegion destination = new GridRegion();
149 destination.RegionID = uuid; 153 destination.RegionID = uuid;
@@ -199,7 +203,7 @@ namespace OpenSim.Server.Handlers.Simulation
199 try 203 try
200 { 204 {
201 // This is the meaning of POST object 205 // This is the meaning of POST object
202 result = CreateObject(destination, sog); 206 result = CreateObject(destination, newPosition, sog);
203 } 207 }
204 catch (Exception e) 208 catch (Exception e)
205 { 209 {
@@ -211,9 +215,9 @@ namespace OpenSim.Server.Handlers.Simulation
211 } 215 }
212 216
213 // subclasses can override this 217 // subclasses can override this
214 protected virtual bool CreateObject(GridRegion destination, ISceneObject sog) 218 protected virtual bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog)
215 { 219 {
216 return m_SimulationService.CreateObject(destination, sog, false); 220 return m_SimulationService.CreateObject(destination, newPosition, sog, false);
217 } 221 }
218 222
219 protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) 223 protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID)
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 65f01b3..cb003d1 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -408,7 +408,7 @@ namespace OpenSim.Services.Connectors.Simulation
408 /// <summary> 408 /// <summary>
409 /// 409 ///
410 /// </summary> 410 /// </summary>
411 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 411 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
412 { 412 {
413 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start"); 413 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start");
414 414
@@ -421,6 +421,7 @@ namespace OpenSim.Services.Connectors.Simulation
421 args["sog"] = OSD.FromString(sog.ToXml2()); 421 args["sog"] = OSD.FromString(sog.ToXml2());
422 args["extra"] = OSD.FromString(sog.ExtraToXmlString()); 422 args["extra"] = OSD.FromString(sog.ExtraToXmlString());
423 args["modified"] = OSD.FromBoolean(sog.HasGroupChanged); 423 args["modified"] = OSD.FromBoolean(sog.HasGroupChanged);
424 args["new_position"] = newPosition.ToString();
424 425
425 string state = sog.GetStateSnapshot(); 426 string state = sog.GetStateSnapshot();
426 if (state.Length > 0) 427 if (state.Length > 0)
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 5f9ce6d..36fd6fc 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Services.Interfaces
98 /// <param name="sog"></param> 98 /// <param name="sog"></param>
99 /// <param name="isLocalCall"></param> 99 /// <param name="isLocalCall"></param>
100 /// <returns></returns> 100 /// <returns></returns>
101 bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall); 101 bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall);
102 102
103 /// <summary> 103 /// <summary>
104 /// Create an object from the user's inventory in the destination region. 104 /// Create an object from the user's inventory in the destination region.