aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMW2007-08-21 16:25:57 +0000
committerMW2007-08-21 16:25:57 +0000
commitb7134c834c9e44802debc10671acbece1e94aa95 (patch)
treef3989ef8f89c70f39a40961c94651b9d446e54f3 /OpenSim/Region/Environment
parentCan now turn on/off server side permission checking (on prim editing etc) fro... (diff)
downloadopensim-SC-b7134c834c9e44802debc10671acbece1e94aa95.zip
opensim-SC-b7134c834c9e44802debc10671acbece1e94aa95.tar.gz
opensim-SC-b7134c834c9e44802debc10671acbece1e94aa95.tar.bz2
opensim-SC-b7134c834c9e44802debc10671acbece1e94aa95.tar.xz
Shift and Drag copying should now work correctly. [This was one of those stupid little one line bugs that was so much fun to track down that I decided to spend a few hours on it)
Linking groups should now work better than it did, but still a bit of work to do on getting the rotations of all the parts after linking right. Added part of dalien's #301 patch (xml loading/saving related parts with some small changes)
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs50
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs10
4 files changed, 57 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 1db9d29..0180e14 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Scenes
132 ScenePresence fromAvatar = this.Avatars[fromAgentID]; 132 ScenePresence fromAvatar = this.Avatars[fromAgentID];
133 ScenePresence toAvatar = this.Avatars[toAgentID]; 133 ScenePresence toAvatar = this.Avatars[toAgentID];
134 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname; 134 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
135 toAvatar.ControllingClient.SendInstantMessage( fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromName, dialog, timestamp); 135 toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromName, dialog, timestamp);
136 } 136 }
137 else 137 else
138 { 138 {
@@ -508,15 +508,15 @@ namespace OpenSim.Region.Environment.Scenes
508 508
509 public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient) 509 public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
510 { 510 {
511 Primitive prim = null; 511 bool hasPrim = false;
512 foreach (EntityBase ent in Entities.Values) 512 foreach (EntityBase ent in Entities.Values)
513 { 513 {
514 if (ent is SceneObjectGroup) 514 if (ent is SceneObjectGroup)
515 { 515 {
516 //prim = ((SceneObject)ent).HasChildPrim(localID); 516 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
517 if (prim != null) 517 if (hasPrim != false)
518 { 518 {
519 prim.UpdateSinglePosition(pos); 519 ((SceneObjectGroup)ent).UpdateSinglePosition(pos, localID);
520 break; 520 break;
521 } 521 }
522 } 522 }
@@ -653,7 +653,7 @@ namespace OpenSim.Region.Environment.Scenes
653 }*/ 653 }*/
654 } 654 }
655 655
656 656
657 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 657 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
658 { 658 {
659 this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); 659 this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 537ab8c..02a035d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -610,6 +610,8 @@ namespace OpenSim.Region.Environment.Scenes
610 { 610 {
611 SceneObjectGroup obj = new SceneObjectGroup(this, 611 SceneObjectGroup obj = new SceneObjectGroup(this,
612 this.m_regionHandle, aPrimNode.OuterXml); 612 this.m_regionHandle, aPrimNode.OuterXml);
613 //if we want this to be a import method then we need new uuids for the object to avoid any clashes
614 //obj.RegenerateFullIDs();
613 AddEntity(obj); 615 AddEntity(obj);
614 primCount++; 616 primCount++;
615 } 617 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 33f41e9..cd38b23 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -251,11 +251,11 @@ namespace OpenSim.Region.Environment.Scenes
251 public new SceneObjectGroup Copy() 251 public new SceneObjectGroup Copy()
252 { 252 {
253 SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); 253 SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone();
254 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
254 dupe.m_parts.Clear(); 255 dupe.m_parts.Clear();
255 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 256 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
256 dupe.m_scene = m_scene; 257 dupe.m_scene = m_scene;
257 dupe.m_regionHandle = this.m_regionHandle; 258 dupe.m_regionHandle = this.m_regionHandle;
258
259 dupe.CopyRootPart(this.m_rootPart); 259 dupe.CopyRootPart(this.m_rootPart);
260 260
261 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values); 261 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values);
@@ -291,6 +291,7 @@ namespace OpenSim.Region.Environment.Scenes
291 public void CopyPart(SceneObjectPart part) 291 public void CopyPart(SceneObjectPart part)
292 { 292 {
293 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); 293 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
294 newPart.SetParent(this);
294 this.m_parts.Add(newPart.UUID, newPart); 295 this.m_parts.Add(newPart.UUID, newPart);
295 this.SetPartAsNonRoot(newPart); 296 this.SetPartAsNonRoot(newPart);
296 } 297 }
@@ -431,6 +432,9 @@ namespace OpenSim.Region.Environment.Scenes
431 public void LinkToGroup(SceneObjectGroup objectGroup) 432 public void LinkToGroup(SceneObjectGroup objectGroup)
432 { 433 {
433 SceneObjectPart linkPart = objectGroup.m_rootPart; 434 SceneObjectPart linkPart = objectGroup.m_rootPart;
435 Axiom.Math.Vector3 oldGroupPosition = new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z);
436 Axiom.Math.Quaternion oldRootRotation = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z);
437
434 linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition; 438 linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition;
435 linkPart.GroupPosition = this.AbsolutePosition; 439 linkPart.GroupPosition = this.AbsolutePosition;
436 440
@@ -450,20 +454,39 @@ namespace OpenSim.Region.Environment.Scenes
450 { 454 {
451 if (part.UUID != objectGroup.m_rootPart.UUID) 455 if (part.UUID != objectGroup.m_rootPart.UUID)
452 { 456 {
453 this.LinkNonRootPart(part); 457 this.LinkNonRootPart(part, oldGroupPosition, oldRootRotation);
454 } 458 }
455 } 459 }
456 460
457 m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; 461 m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup;
458 m_scene.DeleteEntity(objectGroup.UUID); 462 m_scene.DeleteEntity(objectGroup.UUID);
463 objectGroup.DeleteParts();
459 this.ScheduleGroupForFullUpdate(); 464 this.ScheduleGroupForFullUpdate();
460 } 465 }
461 466
462 private void LinkNonRootPart(SceneObjectPart part) 467 private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
463 { 468 {
464 part.SetParent(this); 469 part.SetParent(this);
465 part.ParentID = this.m_rootPart.LocalID; 470 part.ParentID = this.m_rootPart.LocalID;
466 this.m_parts.Add(part.UUID, part); 471 this.m_parts.Add(part.UUID, part);
472
473 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
474 axiomOldPos = oldGroupRotation * axiomOldPos;
475 axiomOldPos += oldGroupPosition;
476 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
477 part.OffsetPosition = oldAbsolutePosition - this.AbsolutePosition;
478
479 Quaternion axiomRootRotation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
480
481 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
482 axiomPos = axiomRootRotation.Inverse() * axiomPos;
483 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z);
484
485 Quaternion axiomPartRotation = new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z);
486
487 axiomPartRotation = oldGroupRotation * axiomPartRotation;
488 axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation;
489 part.RotationOffset = new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
467 } 490 }
468 491
469 /// <summary> 492 /// <summary>
@@ -669,7 +692,7 @@ namespace OpenSim.Region.Environment.Scenes
669 public void UpdateGroupPosition(LLVector3 pos) 692 public void UpdateGroupPosition(LLVector3 pos)
670 { 693 {
671 this.AbsolutePosition = pos; 694 this.AbsolutePosition = pos;
672 695 this.ScheduleGroupForTerseUpdate();
673 } 696 }
674 697
675 /// <summary> 698 /// <summary>
@@ -720,6 +743,7 @@ namespace OpenSim.Region.Environment.Scenes
720 pos.X = newPos.X; 743 pos.X = newPos.X;
721 pos.Y = newPos.Y; 744 pos.Y = newPos.Y;
722 pos.Z = newPos.Z; 745 pos.Z = newPos.Z;
746 this.ScheduleGroupForTerseUpdate();
723 } 747 }
724 #endregion 748 #endregion
725 749
@@ -859,7 +883,7 @@ namespace OpenSim.Region.Environment.Scenes
859 /// <param name="part"></param> 883 /// <param name="part"></param>
860 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part) 884 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part)
861 { 885 {
862 if (m_rootPart == part) 886 if (m_rootPart.UUID == part.UUID)
863 { 887 {
864 part.SendFullUpdateToClient(remoteClient, AbsolutePosition); 888 part.SendFullUpdateToClient(remoteClient, AbsolutePosition);
865 } 889 }
@@ -876,7 +900,7 @@ namespace OpenSim.Region.Environment.Scenes
876 /// <param name="part"></param> 900 /// <param name="part"></param>
877 internal void SendPartTerseUpdate(IClientAPI remoteClient, SceneObjectPart part) 901 internal void SendPartTerseUpdate(IClientAPI remoteClient, SceneObjectPart part)
878 { 902 {
879 if (m_rootPart == part) 903 if (m_rootPart.UUID == part.UUID)
880 { 904 {
881 part.SendTerseUpdateToClient(remoteClient, AbsolutePosition); 905 part.SendTerseUpdateToClient(remoteClient, AbsolutePosition);
882 } 906 }
@@ -932,6 +956,14 @@ namespace OpenSim.Region.Environment.Scenes
932 } 956 }
933 } 957 }
934 958
959 public void RegenerateFullIDs()
960 {
961 foreach (SceneObjectPart part in this.m_parts.Values)
962 {
963 part.UUID = LLUUID.Random();
964 }
965 }
966
935 public LLUUID GetPartsFullID(uint localID) 967 public LLUUID GetPartsFullID(uint localID)
936 { 968 {
937 SceneObjectPart part = this.GetChildPrim(localID); 969 SceneObjectPart part = this.GetChildPrim(localID);
@@ -984,6 +1016,12 @@ namespace OpenSim.Region.Environment.Scenes
984 } 1016 }
985 } 1017 }
986 1018
1019 public void DeleteParts()
1020 {
1021 this.m_rootPart = null;
1022 this.m_parts.Clear();
1023 }
1024
987 public override void SetText(string text, Vector3 color, double alpha) 1025 public override void SetText(string text, Vector3 color, double alpha)
988 { 1026 {
989 Text = text; 1027 Text = text;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 8cf55ad..de3ad38 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Environment.Scenes
64 set { m_name = value; } 64 set { m_name = value; }
65 } 65 }
66 66
67 protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 +4 +8 + 268435456 + 128; 67 protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 268435456 + 128;
68 public uint ObjectFlags 68 public uint ObjectFlags
69 { 69 {
70 get { return (uint)m_flags; } 70 get { return (uint)m_flags; }
@@ -405,7 +405,7 @@ namespace OpenSim.Region.Environment.Scenes
405 { 405 {
406 if (localID == this.m_localID) 406 if (localID == this.m_localID)
407 { 407 {
408 //client.SendTaskInventory(this.m_uuid, 1, Helpers.StringToField("primInventory2")); 408 //client.SendTaskInventory(this.m_uuid, 1, Helpers.StringToField("primInventory2"));
409 client.SendTaskInventory(this.m_uuid, 0, new byte[0]); 409 client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
410 } 410 }
411 } 411 }
@@ -421,7 +421,7 @@ namespace OpenSim.Region.Environment.Scenes
421 InventoryStringBuilder invString = new InventoryStringBuilder(); 421 InventoryStringBuilder invString = new InventoryStringBuilder();
422 invString.AddItemStart(); 422 invString.AddItemStart();
423 invString.AddNameValueLine("item_id", LLUUID.Random().ToStringHyphenated()); 423 invString.AddNameValueLine("item_id", LLUUID.Random().ToStringHyphenated());
424 invString.AddNameValueLine("parent_id",LLUUID.Zero.ToStringHyphenated()); 424 invString.AddNameValueLine("parent_id", LLUUID.Zero.ToStringHyphenated());
425 425
426 invString.AddPermissionsStart(); 426 invString.AddPermissionsStart();
427 invString.AddNameValueLine("base_mask", "0x7FFFFFFF"); 427 invString.AddNameValueLine("base_mask", "0x7FFFFFFF");
@@ -437,7 +437,7 @@ namespace OpenSim.Region.Environment.Scenes
437 437
438 invString.AddNameValueLine("asset_id", "00000000-0000-2222-3333-000000000001"); 438 invString.AddNameValueLine("asset_id", "00000000-0000-2222-3333-000000000001");
439 invString.AddNameValueLine("type", "lsltext"); 439 invString.AddNameValueLine("type", "lsltext");
440 invString.AddNameValueLine("inv_type" , "lsltext"); 440 invString.AddNameValueLine("inv_type", "lsltext");
441 invString.AddNameValueLine("flags", "0x00"); 441 invString.AddNameValueLine("flags", "0x00");
442 invString.AddNameValueLine("name", "Test inventory" + "|"); 442 invString.AddNameValueLine("name", "Test inventory" + "|");
443 invString.AddNameValueLine("desc", "test description" + "|"); 443 invString.AddNameValueLine("desc", "test description" + "|");
@@ -447,7 +447,7 @@ namespace OpenSim.Region.Environment.Scenes
447 byte[] fileInv = Helpers.StringToField(invString.BuildString); 447 byte[] fileInv = Helpers.StringToField(invString.BuildString);
448 byte[] data = new byte[fileInv.Length + 4]; 448 byte[] data = new byte[fileInv.Length + 4];
449 Array.Copy(Helpers.IntToBytes(fileInv.Length), 0, data, 0, 4); 449 Array.Copy(Helpers.IntToBytes(fileInv.Length), 0, data, 0, 4);
450 Array.Copy(fileInv, 0,data , 4, fileInv.Length); 450 Array.Copy(fileInv, 0, data, 4, fileInv.Length);
451 client.SendXferPacket(xferID, 0 + 0x80000000, data); 451 client.SendXferPacket(xferID, 0 + 0x80000000, data);
452 } 452 }
453 #endregion 453 #endregion