aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs45
1 files changed, 37 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index a9f0bb3..c9b6e9f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -73,7 +73,11 @@ namespace OpenSim.Region.Environment.Scenes
73 { 73 {
74 get { return m_rootPart.RotationOffset; } 74 get { return m_rootPart.RotationOffset; }
75 } 75 }
76 76 public LLUUID GroupID
77 {
78 get { return m_rootPart.GroupID; }
79 set { m_rootPart.GroupID = value; }
80 }
77 /// <summary> 81 /// <summary>
78 /// 82 ///
79 /// </summary> 83 /// </summary>
@@ -165,6 +169,7 @@ namespace OpenSim.Region.Environment.Scenes
165 public LLUUID OwnerID 169 public LLUUID OwnerID
166 { 170 {
167 get { return m_rootPart.OwnerID; } 171 get { return m_rootPart.OwnerID; }
172 set { m_rootPart.OwnerID = value; }
168 } 173 }
169 174
170 public Color Color 175 public Color Color
@@ -447,15 +452,18 @@ namespace OpenSim.Region.Environment.Scenes
447 /// 452 ///
448 /// </summary> 453 /// </summary>
449 /// <returns></returns> 454 /// <returns></returns>
450 public new SceneObjectGroup Copy() 455 public new SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID)
451 { 456 {
452 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone(); 457 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
453 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); 458 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
454 dupe.m_parts.Clear(); 459 dupe.m_parts.Clear();
460 //dupe.OwnerID = AgentID;
461 //dupe.GroupID = GroupID;
455 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 462 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
456 dupe.m_scene = m_scene; 463 dupe.m_scene = m_scene;
457 dupe.m_regionHandle = m_regionHandle; 464 dupe.m_regionHandle = m_regionHandle;
458 dupe.CopyRootPart(m_rootPart); 465 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID);
466
459 467
460 /// may need to create a new Physics actor. 468 /// may need to create a new Physics actor.
461 if (dupe.RootPart.PhysActor != null) 469 if (dupe.RootPart.PhysActor != null)
@@ -472,18 +480,29 @@ namespace OpenSim.Region.Environment.Scenes
472 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z), 480 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z),
473 dupe.RootPart.PhysActor.IsPhysical); 481 dupe.RootPart.PhysActor.IsPhysical);
474 } 482 }
483 // Now we've made a copy that replaces this one, we need to
484 // switch the owner to the person who did the copying
485 // Second Life copies an object and duplicates the first one in it's place
486 // So, we have to make a copy of this one, set it in it's place then set the owner on this one
487
488 SetRootPartOwner(m_rootPart, cAgentID, cGroupID);
489 m_rootPart.ScheduleFullUpdate();
475 490
476 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); 491 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
477 foreach (SceneObjectPart part in partList) 492 foreach (SceneObjectPart part in partList)
478 { 493 {
479 if (part.UUID != m_rootPart.UUID) 494 if (part.UUID != m_rootPart.UUID)
480 { 495 {
481 dupe.CopyPart(part); 496 dupe.CopyPart(part,OwnerID, GroupID);
497 SetPartOwner(part, cAgentID, cGroupID);
498 part.ScheduleFullUpdate();
499
482 } 500 }
483 } 501 }
484 dupe.UpdateParentIDs(); 502 dupe.UpdateParentIDs();
485 503
486 dupe.AttachToBackup(); 504 dupe.AttachToBackup();
505 ScheduleGroupForFullUpdate();
487 506
488 return dupe; 507 return dupe;
489 } 508 }
@@ -492,25 +511,35 @@ namespace OpenSim.Region.Environment.Scenes
492 /// 511 ///
493 /// </summary> 512 /// </summary>
494 /// <param name="part"></param> 513 /// <param name="part"></param>
495 public void CopyRootPart(SceneObjectPart part) 514 public void CopyRootPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID)
496 { 515 {
497 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); 516 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID);
498 newPart.SetParent(this); 517 newPart.SetParent(this);
499 m_parts.Add(newPart.UUID, newPart); 518 m_parts.Add(newPart.UUID, newPart);
500 SetPartAsRoot(newPart); 519 SetPartAsRoot(newPart);
501 } 520 }
521 public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) {
522 part.OwnerID = cAgentID;
523 part.GroupID = cGroupID;
524 part.ScheduleFullUpdate();
525 }
502 526
503 /// <summary> 527 /// <summary>
504 /// 528 ///
505 /// </summary> 529 /// </summary>
506 /// <param name="part"></param> 530 /// <param name="part"></param>
507 public void CopyPart(SceneObjectPart part) 531 public void CopyPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID)
508 { 532 {
509 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); 533 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID);
510 newPart.SetParent(this); 534 newPart.SetParent(this);
511 m_parts.Add(newPart.UUID, newPart); 535 m_parts.Add(newPart.UUID, newPart);
512 SetPartAsNonRoot(newPart); 536 SetPartAsNonRoot(newPart);
513 } 537 }
538 public void SetPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID)
539 {
540 part.OwnerID = cAgentID;
541 part.GroupID = cGroupID;
542 }
514 543
515 #endregion 544 #endregion
516 545