aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorAleric Inglewood2013-08-04 19:19:11 +0200
committerteravus2013-09-22 21:10:01 -0500
commit2dc92e7de11086c7649d3ee0f8adc974efce6805 (patch)
treee69a633127525a5967ddadeef723a99f38e5d4aa /OpenSim/Region
parentminor: Recomment out log message uncommented in previous cbdfe969 (diff)
downloadopensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.zip
opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.gz
opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.bz2
opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.xz
Preserve attachment point & position when attachment is rezzed in world
Patch taken from http://opensimulator.org/mantis/view.php?id=4905 originally by Greg C. Fixed to apply to r/23314 commit ba9daf849e7c8db48e7c03e7cdedb77776b2052f (cherry picked from commit 4ff9fbca441110cc2b93edc7286e0e9339e61cbe)
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs14
7 files changed, 52 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
index 92805e2..94f8bc1 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
@@ -155,6 +155,7 @@ namespace OpenSim.Region.ClientStack.Linden
155 Quaternion rotation = Quaternion.Identity; 155 Quaternion rotation = Quaternion.Identity;
156 Vector3 scale = Vector3.Zero; 156 Vector3 scale = Vector3.Zero;
157 int state = 0; 157 int state = 0;
158 int lastattach = 0;
158 159
159 if (r.Type != OSDType.Map) // not a proper req 160 if (r.Type != OSDType.Map) // not a proper req
160 return responsedata; 161 return responsedata;
@@ -224,6 +225,7 @@ namespace OpenSim.Region.ClientStack.Linden
224 225
225 ray_target_id = ObjMap["RayTargetId"].AsUUID(); 226 ray_target_id = ObjMap["RayTargetId"].AsUUID();
226 state = ObjMap["State"].AsInteger(); 227 state = ObjMap["State"].AsInteger();
228 lastattach = ObjMap["LastAttachPoint"].AsInteger();
227 try 229 try
228 { 230 {
229 ray_end = ((OSDArray)ObjMap["RayEnd"]).AsVector3(); 231 ray_end = ((OSDArray)ObjMap["RayEnd"]).AsVector3();
@@ -290,6 +292,7 @@ namespace OpenSim.Region.ClientStack.Linden
290 292
291 //session_id = rm["session_id"].AsUUID(); 293 //session_id = rm["session_id"].AsUUID();
292 state = rm["state"].AsInteger(); 294 state = rm["state"].AsInteger();
295 lastattach = rm["last_attach_point"].AsInteger();
293 try 296 try
294 { 297 {
295 ray_end = ((OSDArray)rm["ray_end"]).AsVector3(); 298 ray_end = ((OSDArray)rm["ray_end"]).AsVector3();
@@ -331,6 +334,7 @@ namespace OpenSim.Region.ClientStack.Linden
331 pbs.ProfileEnd = (ushort)profile_end; 334 pbs.ProfileEnd = (ushort)profile_end;
332 pbs.Scale = scale; 335 pbs.Scale = scale;
333 pbs.State = (byte)state; 336 pbs.State = (byte)state;
337 pbs.LastAttachPoint = (byte)lastattach;
334 338
335 SceneObjectGroup obj = null; ; 339 SceneObjectGroup obj = null; ;
336 340
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index 55a503e..769fe28 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -277,6 +277,7 @@ namespace OpenSim.Region.ClientStack.Linden
277 pbs.ProfileEnd = (ushort) obj.ProfileEnd; 277 pbs.ProfileEnd = (ushort) obj.ProfileEnd;
278 pbs.Scale = obj.Scale; 278 pbs.Scale = obj.Scale;
279 pbs.State = (byte) 0; 279 pbs.State = (byte) 0;
280 pbs.LastAttachPoint = (byte) 0;
280 SceneObjectPart prim = new SceneObjectPart(); 281 SceneObjectPart prim = new SceneObjectPart();
281 prim.UUID = UUID.Random(); 282 prim.UUID = UUID.Random();
282 prim.CreatorID = AgentId; 283 prim.CreatorID = AgentId;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 1b091bf..3609ec1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -12188,6 +12188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12188 12188
12189 shape.PCode = addPacket.ObjectData.PCode; 12189 shape.PCode = addPacket.ObjectData.PCode;
12190 shape.State = addPacket.ObjectData.State; 12190 shape.State = addPacket.ObjectData.State;
12191 shape.LastAttachPoint = addPacket.ObjectData.State;
12191 shape.PathBegin = addPacket.ObjectData.PathBegin; 12192 shape.PathBegin = addPacket.ObjectData.PathBegin;
12192 shape.PathEnd = addPacket.ObjectData.PathEnd; 12193 shape.PathEnd = addPacket.ObjectData.PathEnd;
12193 shape.PathScaleX = addPacket.ObjectData.PathScaleX; 12194 shape.PathScaleX = addPacket.ObjectData.PathScaleX;
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2818712..d0e0b35 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -422,6 +422,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
422 attachPos = Vector3.Zero; 422 attachPos = Vector3.Zero;
423 } 423 }
424 424
425 // if the attachment point is the same as previous, make sure we get the saved
426 // position info.
427 if (attachmentPt != 0 && attachmentPt == group.RootPart.Shape.LastAttachPoint)
428 {
429 attachPos = group.RootPart.AttachedPos;
430 }
431
425 // AttachmentPt 0 means the client chose to 'wear' the attachment. 432 // AttachmentPt 0 means the client chose to 'wear' the attachment.
426 if (attachmentPt == (uint)AttachmentPoint.Default) 433 if (attachmentPt == (uint)AttachmentPoint.Default)
427 { 434 {
@@ -429,6 +436,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
429 attachmentPt = group.AttachmentPoint; 436 attachmentPt = group.AttachmentPoint;
430 } 437 }
431 438
439 // if we didn't find an attach point, look for where it was last attached
440 if (attachmentPt == 0)
441 {
442 attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
443 attachPos = group.RootPart.AttachedPos;
444 group.HasGroupChanged = true;
445 }
446
432 // if we still didn't find a suitable attachment point....... 447 // if we still didn't find a suitable attachment point.......
433 if (attachmentPt == 0) 448 if (attachmentPt == 0)
434 { 449 {
@@ -619,6 +634,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
619 so.ClearPartAttachmentData(); 634 so.ClearPartAttachmentData();
620 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive); 635 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive);
621 so.HasGroupChanged = true; 636 so.HasGroupChanged = true;
637 so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint;
622 rootPart.Rezzed = DateTime.Now; 638 rootPart.Rezzed = DateTime.Now;
623 rootPart.RemFlag(PrimFlags.TemporaryOnRez); 639 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
624 so.AttachToBackup(); 640 so.AttachToBackup();
@@ -1210,4 +1226,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1210 1226
1211 #endregion 1227 #endregion
1212 } 1228 }
1213} \ No newline at end of file 1229}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 68e4e26..0ec9575 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -836,6 +836,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
836 m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3"); 836 m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3");
837 } 837 }
838 838
839 // if this was previously an attachment and is now being rezzed,
840 // save the old attachment info.
841 if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
842 {
843 group.RootPart.AttachedPos = group.AbsolutePosition;
844 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
845 }
846
839 foreach (SceneObjectPart part in group.Parts) 847 foreach (SceneObjectPart part in group.Parts)
840 { 848 {
841 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. 849 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 69b5f43..4bebbe8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2230,6 +2230,13 @@ namespace OpenSim.Region.Framework.Scenes
2230 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2230 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2231 } 2231 }
2232 2232
2233
2234 if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
2235 {
2236 group.RootPart.AttachedPos = group.AbsolutePosition;
2237 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
2238 }
2239
2233 group.FromPartID = sourcePart.UUID; 2240 group.FromPartID = sourcePart.UUID;
2234 AddNewSceneObject(group, true, pos, rot, vel); 2241 AddNewSceneObject(group, true, pos, rot, vel);
2235 2242
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 945745e..3ea936c 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -365,6 +365,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
365 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); 365 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
366 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); 366 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
367 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); 367 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
368 m_SOPXmlProcessors.Add("AttachedPos", ProcessAttachedPos);
368 m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs); 369 m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs);
369 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); 370 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
370 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); 371 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
@@ -433,6 +434,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
433 m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd); 434 m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd);
434 m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow); 435 m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow);
435 m_ShapeXmlProcessors.Add("Scale", ProcessShpScale); 436 m_ShapeXmlProcessors.Add("Scale", ProcessShpScale);
437 m_ShapeXmlProcessors.Add("LastAttachPoint", ProcessShpLastAttach);
436 m_ShapeXmlProcessors.Add("State", ProcessShpState); 438 m_ShapeXmlProcessors.Add("State", ProcessShpState);
437 m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape); 439 m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape);
438 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); 440 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape);
@@ -761,6 +763,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
761 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); 763 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
762 } 764 }
763 765
766 private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader)
767 {
768 obj.AttachedPos = Util.ReadVector(reader, "AttachedPos");
769 }
770
764 private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) 771 private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader)
765 { 772 {
766 obj.DynAttrs.ReadXml(reader); 773 obj.DynAttrs.ReadXml(reader);
@@ -1043,6 +1050,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1043 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); 1050 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty);
1044 } 1051 }
1045 1052
1053 private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlTextReader reader)
1054 {
1055 shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty);
1056 }
1057
1046 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) 1058 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
1047 { 1059 {
1048 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); 1060 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
@@ -1289,6 +1301,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1289 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1301 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1290 if (sop.MediaUrl != null) 1302 if (sop.MediaUrl != null)
1291 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1303 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1304 WriteVector(writer, "AttachedPos", sop.AttachedPos);
1292 1305
1293 if (sop.DynAttrs.CountNamespaces > 0) 1306 if (sop.DynAttrs.CountNamespaces > 0)
1294 { 1307 {
@@ -1471,6 +1484,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1471 writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString()); 1484 writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString());
1472 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); 1485 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1473 writer.WriteElementString("State", shp.State.ToString()); 1486 writer.WriteElementString("State", shp.State.ToString());
1487 writer.WriteElementString("LastAttachPoint", shp.LastAttachPoint.ToString());
1474 1488
1475 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); 1489 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
1476 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options); 1490 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);