aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-08-26 23:39:20 +0100
committerMelanie2010-08-26 23:39:20 +0100
commit1f1d72eba5ca2b1e4115e93af1ed88950dce585a (patch)
tree2dfcb626f9eb5fc6244b9fe7dac4b46a9c587703 /OpenSim
parentSend a null result search packet when no results are passsed in (diff)
parentMore on mantis #4985 (diff)
downloadopensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.zip
opensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.tar.gz
opensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.tar.bz2
opensim-SC_OLD-1f1d72eba5ca2b1e4115e93af1ed88950dce585a.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs20
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs79
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs15
-rw-r--r--OpenSim/Region/DataSnapshot/SnapshotStore.cs48
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs8
14 files changed, 193 insertions, 131 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 17c051a..34cc7d9 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
327 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 327 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
328 /// ownerless phantom. 328 /// ownerless phantom.
329 /// 329 ///
330 /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock 330 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
331 /// 331 ///
332 /// </value> 332 /// </value>
333 protected HashSet<uint> m_killRecord; 333 protected HashSet<uint> m_killRecord;
@@ -382,18 +382,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
382 public string ActiveGroupName { get { return m_activeGroupName; } } 382 public string ActiveGroupName { get { return m_activeGroupName; } }
383 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } 383 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
384 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 384 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
385
385 /// <summary> 386 /// <summary>
386 /// First name of the agent/avatar represented by the client 387 /// First name of the agent/avatar represented by the client
387 /// </summary> 388 /// </summary>
388 public string FirstName { get { return m_firstName; } } 389 public string FirstName { get { return m_firstName; } }
390
389 /// <summary> 391 /// <summary>
390 /// Last name of the agent/avatar represented by the client 392 /// Last name of the agent/avatar represented by the client
391 /// </summary> 393 /// </summary>
392 public string LastName { get { return m_lastName; } } 394 public string LastName { get { return m_lastName; } }
395
393 /// <summary> 396 /// <summary>
394 /// Full name of the client (first name and last name) 397 /// Full name of the client (first name and last name)
395 /// </summary> 398 /// </summary>
396 public string Name { get { return FirstName + " " + LastName; } } 399 public string Name { get { return FirstName + " " + LastName; } }
400
397 public uint CircuitCode { get { return m_circuitCode; } } 401 public uint CircuitCode { get { return m_circuitCode; } }
398 public int MoneyBalance { get { return m_moneyBalance; } } 402 public int MoneyBalance { get { return m_moneyBalance; } }
399 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } 403 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@@ -3531,6 +3535,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3531 EntityUpdate update; 3535 EntityUpdate update;
3532 while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) 3536 while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
3533 { 3537 {
3538 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3539 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3540 // safety measure.
3541 //
3542 // Receiving updates after kills results in undeleteable prims that persist until relog and
3543 // currently occurs because prims can be deleted before all queued updates are sent.
3544 if (m_killRecord.Contains(update.Entity.LocalId))
3545 {
3546// m_log.WarnFormat(
3547// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted",
3548// update.Entity.LocalId, Name);
3549 continue;
3550 }
3551
3534 if (update.Entity is SceneObjectPart) 3552 if (update.Entity is SceneObjectPart)
3535 { 3553 {
3536 SceneObjectPart part = (SceneObjectPart)update.Entity; 3554 SceneObjectPart part = (SceneObjectPart)update.Entity;
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 847a999..d56145a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -37,6 +37,7 @@ using OpenSim.Framework;
37using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization;
40 41
41namespace OpenSim.Region.CoreModules.Avatar.Attachments 42namespace OpenSim.Region.CoreModules.Avatar.Attachments
42{ 43{
@@ -448,12 +449,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
448 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 449 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
449 group.DetachToInventoryPrep(); 450 group.DetachToInventoryPrep();
450 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 451 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
451 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); 452 UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
452 m_scene.DeleteSceneObject(group, false); 453 m_scene.DeleteSceneObject(group, false);
453 return; 454 return;
454 } 455 }
455 } 456 }
456 } 457 }
457 } 458 }
459
460 public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos)
461 {
462 // If this is an attachment, then we need to save the modified
463 // object back into the avatar's inventory. First we save the
464 // attachment point information, then we update the relative
465 // positioning (which caused this method to get driven in the
466 // first place. Then we have to mark the object as NOT an
467 // attachment. This is necessary in order to correctly save
468 // and retrieve GroupPosition information for the attachment.
469 // Then we save the asset back into the appropriate inventory
470 // entry. Finally, we restore the object's attachment status.
471 byte attachmentPoint = sog.GetAttachmentPoint();
472 sog.UpdateGroupPosition(pos);
473 sog.RootPart.IsAttachment = false;
474 sog.AbsolutePosition = sog.RootPart.AttachedPos;
475 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
476 sog.SetAttachmentPoint(attachmentPoint);
477 }
478
479 /// <summary>
480 /// Update the attachment asset for the new sog details if they have changed.
481 /// </summary>
482 ///
483 /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
484 /// these details are not stored on the region.
485 ///
486 /// <param name="remoteClient"></param>
487 /// <param name="grp"></param>
488 /// <param name="itemID"></param>
489 /// <param name="agentID"></param>
490 protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
491 {
492 if (grp != null)
493 {
494 if (!grp.HasGroupChanged)
495 {
496 m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
497 return;
498 }
499
500 m_log.DebugFormat(
501 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
502 grp.UUID, grp.GetAttachmentPoint());
503
504 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
505
506 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
507 item = m_scene.InventoryService.GetItem(item);
508
509 if (item != null)
510 {
511 AssetBase asset = m_scene.CreateAsset(
512 grp.GetPartName(grp.LocalId),
513 grp.GetPartDescription(grp.LocalId),
514 (sbyte)AssetType.Object,
515 Utils.StringToBytes(sceneObjectXml),
516 remoteClient.AgentId);
517 m_scene.AssetService.Store(asset);
518
519 item.AssetID = asset.FullID;
520 item.Description = asset.Description;
521 item.Name = asset.Name;
522 item.AssetType = asset.Type;
523 item.InvType = (int)InventoryType.Object;
524
525 m_scene.InventoryService.UpdateItem(item);
526
527 // this gets called when the agent logs off!
528 if (remoteClient != null)
529 remoteClient.SendInventoryItemCreateUpdate(item, 0);
530 }
531 }
532 }
458 } 533 }
459} 534} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 4117e86..d1274e9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
159 159
160 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 160 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
161 { 161 {
162 m_log.InfoFormat( 162 m_log.DebugFormat(
163 "[INVENTORY TRANSFER]: {0} IM type received from {1}", 163 "[INVENTORY TRANSFER]: {0} IM type received from {1}",
164 (InstantMessageDialog)im.dialog, client.Name); 164 (InstantMessageDialog)im.dialog, client.Name);
165 165
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index c489972..3c39f9e 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -142,9 +142,18 @@ namespace OpenSim.Region.DataSnapshot.Providers
142 node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString(); 142 node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString();
143 xmlobject.AppendChild(node); 143 xmlobject.AppendChild(node);
144 144
145 node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", ""); 145 if (land != null && land.LandData != null)
146 node.InnerText = land.LandData.GlobalID.ToString(); 146 {
147 xmlobject.AppendChild(node); 147 node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
148 node.InnerText = land.LandData.GlobalID.ToString();
149 xmlobject.AppendChild(node);
150 }
151 else
152 {
153 // Something is wrong with this object. Let's not list it.
154 m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName);
155 continue;
156 }
148 157
149 node = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); 158 node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
150 Vector3 loc = obj.AbsolutePosition; 159 Vector3 loc = obj.AbsolutePosition;
diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
index 70cb205..aa3d2ff 100644
--- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs
+++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Text.RegularExpressions;
33using System.Xml; 34using System.Xml;
34using log4net; 35using log4net;
35using OpenSim.Region.DataSnapshot.Interfaces; 36using OpenSim.Region.DataSnapshot.Interfaces;
@@ -98,13 +99,21 @@ namespace OpenSim.Region.DataSnapshot
98 { 99 {
99 String path = DataFileNameFragment(provider.GetParentScene, provider.Name); 100 String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
100 101
101 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) 102 try
102 { 103 {
103 snapXWriter.Formatting = Formatting.Indented; 104 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
104 snapXWriter.WriteStartDocument(); 105 {
105 data.WriteTo(snapXWriter); 106 snapXWriter.Formatting = Formatting.Indented;
106 snapXWriter.WriteEndDocument(); 107 snapXWriter.WriteStartDocument();
108 data.WriteTo(snapXWriter);
109 snapXWriter.WriteEndDocument();
110 }
111 }
112 catch (Exception e)
113 {
114 m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
107 } 115 }
116
108 } 117 }
109 118
110 //mark provider as not stale, parent scene as stale 119 //mark provider as not stale, parent scene as stale
@@ -185,12 +194,19 @@ namespace OpenSim.Region.DataSnapshot
185 //save snapshot 194 //save snapshot
186 String path = DataFileNameScene(scene); 195 String path = DataFileNameScene(scene);
187 196
188 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) 197 try
198 {
199 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
200 {
201 snapXWriter.Formatting = Formatting.Indented;
202 snapXWriter.WriteStartDocument();
203 regionElement.WriteTo(snapXWriter);
204 snapXWriter.WriteEndDocument();
205 }
206 }
207 catch (Exception e)
189 { 208 {
190 snapXWriter.Formatting = Formatting.Indented; 209 m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
191 snapXWriter.WriteStartDocument();
192 regionElement.WriteTo(snapXWriter);
193 snapXWriter.WriteEndDocument();
194 } 210 }
195 211
196 m_scenes[scene] = false; 212 m_scenes[scene] = false;
@@ -206,15 +222,23 @@ namespace OpenSim.Region.DataSnapshot
206 #region Helpers 222 #region Helpers
207 private string DataFileNameFragment(Scene scene, String fragmentName) 223 private string DataFileNameFragment(Scene scene, String fragmentName)
208 { 224 {
209 return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml")); 225 return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName + "_" + fragmentName), "xml"));
210 } 226 }
211 227
212 private string DataFileNameScene(Scene scene) 228 private string DataFileNameScene(Scene scene)
213 { 229 {
214 return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml")); 230 return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName), "xml"));
215 //return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml"); 231 //return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
216 } 232 }
217 233
234 private static string Sanitize(string name)
235 {
236 string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
237 string invalidReStr = string.Format(@"[{0}]", invalidChars);
238 string newname = Regex.Replace(name, invalidReStr, "_");
239 return newname.Replace('.', '_');
240 }
241
218 private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc) 242 private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
219 { 243 {
220 XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", ""); 244 XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 2af2548..05c1e00 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -131,5 +131,13 @@ namespace OpenSim.Region.Framework.Interfaces
131 /// A <see cref="IClientAPI"/> 131 /// A <see cref="IClientAPI"/>
132 /// </param> 132 /// </param>
133 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); 133 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
134
135 /// <summary>
136 /// Update the position of an attachment
137 /// </summary>
138 /// <param name="client"></param>
139 /// <param name="sog"></param>
140 /// <param name="pos"></param>
141 void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos);
134 } 142 }
135} \ No newline at end of file 143} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index de3c360..272f718 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Scenes
31 31
32 public class Prioritizer 32 public class Prioritizer
33 { 33 {
34 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 34// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
35 35
36 /// <summary> 36 /// <summary>
37 /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the 37 /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
@@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes
75 break; 75 break;
76 default: 76 default:
77 throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); 77 throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
78 break;
79 } 78 }
80 79
81 // Adjust priority so that root prims are sent to the viewer first. This is especially important for 80 // Adjust priority so that root prims are sent to the viewer first. This is especially important for
@@ -122,9 +121,16 @@ namespace OpenSim.Region.Framework.Scenes
122 // Use group position for child prims 121 // Use group position for child prims
123 Vector3 entityPos; 122 Vector3 entityPos;
124 if (entity is SceneObjectPart) 123 if (entity is SceneObjectPart)
125 entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; 124 {
125 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
126 // before its scheduled update was triggered
127 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
128 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
129 }
126 else 130 else
131 {
127 entityPos = entity.AbsolutePosition; 132 entityPos = entity.AbsolutePosition;
133 }
128 134
129 return Vector3.DistanceSquared(presencePos, entityPos); 135 return Vector3.DistanceSquared(presencePos, entityPos);
130 } 136 }
@@ -144,9 +150,16 @@ namespace OpenSim.Region.Framework.Scenes
144 // Use group position for child prims 150 // Use group position for child prims
145 Vector3 entityPos = entity.AbsolutePosition; 151 Vector3 entityPos = entity.AbsolutePosition;
146 if (entity is SceneObjectPart) 152 if (entity is SceneObjectPart)
147 entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; 153 {
154 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
155 // before its scheduled update was triggered
156 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
157 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
158 }
148 else 159 else
160 {
149 entityPos = entity.AbsolutePosition; 161 entityPos = entity.AbsolutePosition;
162 }
150 163
151 if (!presence.IsChildAgent) 164 if (!presence.IsChildAgent)
152 { 165 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 379128a..8ed8b96 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1799,53 +1799,6 @@ namespace OpenSim.Region.Framework.Scenes
1799 } 1799 }
1800 } 1800 }
1801 1801
1802 public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
1803 {
1804 SceneObjectGroup objectGroup = grp;
1805 if (objectGroup != null)
1806 {
1807 if (!grp.HasGroupChanged)
1808 {
1809 m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID);
1810 return;
1811 }
1812
1813 m_log.InfoFormat(
1814 "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}",
1815 grp.UUID, grp.GetAttachmentPoint());
1816
1817 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
1818
1819 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1820 item = InventoryService.GetItem(item);
1821
1822 if (item != null)
1823 {
1824 AssetBase asset = CreateAsset(
1825 objectGroup.GetPartName(objectGroup.LocalId),
1826 objectGroup.GetPartDescription(objectGroup.LocalId),
1827 (sbyte)AssetType.Object,
1828 Utils.StringToBytes(sceneObjectXml),
1829 remoteClient.AgentId);
1830 AssetService.Store(asset);
1831
1832 item.AssetID = asset.FullID;
1833 item.Description = asset.Description;
1834 item.Name = asset.Name;
1835 item.AssetType = asset.Type;
1836 item.InvType = (int)InventoryType.Object;
1837
1838 InventoryService.UpdateItem(item);
1839
1840 // this gets called when the agent loggs off!
1841 if (remoteClient != null)
1842 {
1843 remoteClient.SendInventoryItemCreateUpdate(item, 0);
1844 }
1845 }
1846 }
1847 }
1848
1849 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) 1802 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
1850 { 1803 {
1851 itemID = UUID.Zero; 1804 itemID = UUID.Zero;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1f4d022..5fe944d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3608,18 +3608,6 @@ namespace OpenSim.Region.Framework.Scenes
3608 return true; 3608 return true;
3609 } 3609 }
3610 3610
3611 private ILandObject GetParcelAtPoint(float x, float y)
3612 {
3613 foreach (var parcel in AllParcels())
3614 {
3615 if (parcel.ContainsPoint((int)x,(int)y))
3616 {
3617 return parcel;
3618 }
3619 }
3620 return null;
3621 }
3622
3623 /// <summary> 3611 /// <summary>
3624 /// Update an AgentCircuitData object with new information 3612 /// Update an AgentCircuitData object with new information
3625 /// </summary> 3613 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index c675322..88e084e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes
70 /// <summary> 70 /// <summary>
71 /// A user will arrive shortly, set up appropriate credentials so it can connect 71 /// A user will arrive shortly, set up appropriate credentials so it can connect
72 /// </summary> 72 /// </summary>
73 public event ExpectUserDelegate OnExpectUser; 73// public event ExpectUserDelegate OnExpectUser;
74 74
75 /// <summary> 75 /// <summary>
76 /// A Prim will arrive shortly 76 /// A Prim will arrive shortly
@@ -80,7 +80,7 @@ namespace OpenSim.Region.Framework.Scenes
80 /// <summary> 80 /// <summary>
81 /// A new prim has arrived 81 /// A new prim has arrived
82 /// </summary> 82 /// </summary>
83 public event PrimCrossing OnPrimCrossingIntoRegion; 83// public event PrimCrossing OnPrimCrossingIntoRegion;
84 84
85 ///// <summary> 85 ///// <summary>
86 ///// A New Region is up and available 86 ///// A New Region is up and available
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
90 /// <summary> 90 /// <summary>
91 /// We have a child agent for this avatar and we're getting a status update about it 91 /// We have a child agent for this avatar and we're getting a status update about it
92 /// </summary> 92 /// </summary>
93 public event ChildAgentUpdate OnChildAgentUpdate; 93// public event ChildAgentUpdate OnChildAgentUpdate;
94 //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; 94 //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
95 95
96 /// <summary> 96 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 1da4287..9db2691 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1289,37 +1289,21 @@ namespace OpenSim.Region.Framework.Scenes
1289 /// <param name="localID"></param> 1289 /// <param name="localID"></param>
1290 /// <param name="pos"></param> 1290 /// <param name="pos"></param>
1291 /// <param name="remoteClient"></param> 1291 /// <param name="remoteClient"></param>
1292 protected internal void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) 1292 public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
1293 { 1293 {
1294 SceneObjectGroup group = GetGroupByPrim(localID); 1294 SceneObjectGroup group = GetGroupByPrim(localID);
1295
1295 if (group != null) 1296 if (group != null)
1296 { 1297 {
1297
1298 // Vector3 oldPos = group.AbsolutePosition;
1299 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) 1298 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
1300 { 1299 {
1301 1300 if (m_parentScene.AttachmentsModule != null)
1302 // If this is an attachment, then we need to save the modified 1301 m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos);
1303 // object back into the avatar's inventory. First we save the
1304 // attachment point information, then we update the relative
1305 // positioning (which caused this method to get driven in the
1306 // first place. Then we have to mark the object as NOT an
1307 // attachment. This is necessary in order to correctly save
1308 // and retrieve GroupPosition information for the attachment.
1309 // Then we save the asset back into the appropriate inventory
1310 // entry. Finally, we restore the object's attachment status.
1311
1312 byte attachmentPoint = group.GetAttachmentPoint();
1313 group.UpdateGroupPosition(pos);
1314 group.RootPart.IsAttachment = false;
1315 group.AbsolutePosition = group.RootPart.AttachedPos;
1316 m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
1317 group.SetAttachmentPoint(attachmentPoint);
1318
1319 } 1302 }
1320 else 1303 else
1321 { 1304 {
1322 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) 1305 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)
1306 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
1323 { 1307 {
1324 group.UpdateGroupPosition(pos); 1308 group.UpdateGroupPosition(pos);
1325 } 1309 }
@@ -1328,14 +1312,19 @@ namespace OpenSim.Region.Framework.Scenes
1328 } 1312 }
1329 1313
1330 /// <summary> 1314 /// <summary>
1331 /// 1315 /// Update the texture entry of the given prim.
1332 /// </summary> 1316 /// </summary>
1317 ///
1318 /// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
1319 /// the texture is given in its byte serialized form.
1320 ///
1333 /// <param name="localID"></param> 1321 /// <param name="localID"></param>
1334 /// <param name="texture"></param> 1322 /// <param name="texture"></param>
1335 /// <param name="remoteClient"></param> 1323 /// <param name="remoteClient"></param>
1336 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) 1324 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
1337 { 1325 {
1338 SceneObjectGroup group = GetGroupByPrim(localID); 1326 SceneObjectGroup group = GetGroupByPrim(localID);
1327
1339 if (group != null) 1328 if (group != null)
1340 { 1329 {
1341 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) 1330 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
@@ -1700,8 +1689,6 @@ namespace OpenSim.Region.Framework.Scenes
1700 SceneObjectPart newRoot = newSet[0]; 1689 SceneObjectPart newRoot = newSet[0];
1701 newSet.RemoveAt(0); 1690 newSet.RemoveAt(0);
1702 1691
1703 List<uint> linkIDs = new List<uint>();
1704
1705 foreach (SceneObjectPart newChild in newSet) 1692 foreach (SceneObjectPart newChild in newSet)
1706 newChild.UpdateFlag = 0; 1693 newChild.UpdateFlag = 0;
1707 1694
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2ad4223..3ed74e1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4727,20 +4727,8 @@ namespace OpenSim.Region.Framework.Scenes
4727 if (ParentGroup == null || ParentGroup.IsDeleted) 4727 if (ParentGroup == null || ParentGroup.IsDeleted)
4728 return; 4728 return;
4729 4729
4730 Vector3 lPos = OffsetPosition; 4730 if (IsAttachment && ParentGroup.RootPart != this)
4731 4731 return;
4732 if (IsAttachment)
4733 {
4734 if (ParentGroup.RootPart != this)
4735 return;
4736
4737 lPos = ParentGroup.RootPart.AttachedPos;
4738 }
4739 else
4740 {
4741 if (ParentGroup.RootPart == this)
4742 lPos = AbsolutePosition;
4743 }
4744 4732
4745 // Causes this thread to dig into the Client Thread Data. 4733 // Causes this thread to dig into the Client Thread Data.
4746 // Remember your locking here! 4734 // Remember your locking here!
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index e08fa77..d7767bd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -576,8 +576,7 @@ namespace OpenSim.Region.Framework.Scenes
576 } 576 }
577 577
578 public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) 578 public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item)
579 { 579 {
580 UUID ownerID = item.OwnerID;
581 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); 580 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
582 581
583 if (null == rezAsset) 582 if (null == rezAsset)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 08c6e27..fbb3177 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2326,15 +2326,15 @@ namespace OpenSim.Region.Framework.Scenes
2326 { 2326 {
2327 m_perfMonMS = Util.EnvironmentTickCount(); 2327 m_perfMonMS = Util.EnvironmentTickCount();
2328 2328
2329 PhysicsActor actor = m_physicsActor;
2330 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
2331
2332 Vector3 pos = m_pos; 2329 Vector3 pos = m_pos;
2333 pos.Z += m_appearance.HipOffset; 2330 pos.Z += m_appearance.HipOffset;
2334 2331
2335 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2332 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
2336 2333
2337 remoteClient.SendPrimUpdate(this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); 2334 remoteClient.SendPrimUpdate(
2335 this,
2336 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
2337 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
2338 2338
2339 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2339 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2340 m_scene.StatsReporter.AddAgentUpdates(1); 2340 m_scene.StatsReporter.AddAgentUpdates(1);