diff options
author | Justin Clarke Casey | 2008-11-10 19:47:13 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-10 19:47:13 +0000 |
commit | 2d89e562d714a987b8a968abce861b24e3714afb (patch) | |
tree | 208c80fd945a0399b6892cab1680aa0575faa5de /OpenSim/Region/Environment | |
parent | * minor: Remove old dead and buried datastore code (diff) | |
download | opensim-SC-2d89e562d714a987b8a968abce861b24e3714afb.zip opensim-SC-2d89e562d714a987b8a968abce861b24e3714afb.tar.gz opensim-SC-2d89e562d714a987b8a968abce861b24e3714afb.tar.bz2 opensim-SC-2d89e562d714a987b8a968abce861b24e3714afb.tar.xz |
* Refactor the callers of SOG.SetPartAsRoot() to use common code
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 39615c0..8f88d8e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -365,13 +365,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
365 | /// </summary> | 365 | /// </summary> |
366 | public SceneObjectGroup(SceneObjectPart part) | 366 | public SceneObjectGroup(SceneObjectPart part) |
367 | { | 367 | { |
368 | part.SetParent(this); | 368 | SetRootPart(part); |
369 | part.ParentID = 0; | ||
370 | part.LinkNum = 0; | ||
371 | |||
372 | m_parts.Add(part.UUID, part); | ||
373 | |||
374 | SetPartAsRoot(part); | ||
375 | } | 369 | } |
376 | 370 | ||
377 | /// <summary> | 371 | /// <summary> |
@@ -506,11 +500,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
506 | /// </summary> | 500 | /// </summary> |
507 | public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) | 501 | public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) |
508 | { | 502 | { |
509 | Vector3 rootOffset = new Vector3(0, 0, 0); | 503 | Vector3 rootOffset = new Vector3(0, 0, 0); |
510 | SceneObjectPart newPart = new SceneObjectPart(ownerID, shape, pos, rot, rootOffset); | 504 | SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, rootOffset)); |
511 | newPart.LinkNum = 0; | ||
512 | AddPart(newPart); | ||
513 | SetPartAsRoot(newPart); | ||
514 | } | 505 | } |
515 | 506 | ||
516 | /// <summary> | 507 | /// <summary> |
@@ -735,15 +726,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
735 | } | 726 | } |
736 | 727 | ||
737 | /// <summary> | 728 | /// <summary> |
738 | /// | ||
739 | /// </summary> | ||
740 | /// <param name="part"></param> | ||
741 | private void SetPartAsRoot(SceneObjectPart part) | ||
742 | { | ||
743 | m_rootPart = part; | ||
744 | } | ||
745 | |||
746 | /// <summary> | ||
747 | /// Attach this scene object to the given avatar. | 729 | /// Attach this scene object to the given avatar. |
748 | /// </summary> | 730 | /// </summary> |
749 | /// <param name="agentID"></param> | 731 | /// <param name="agentID"></param> |
@@ -890,9 +872,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
890 | { | 872 | { |
891 | m_scene = scene; | 873 | m_scene = scene; |
892 | } | 874 | } |
875 | |||
876 | /// <summary> | ||
877 | /// Set a part to act as the root part for this scene object | ||
878 | /// </summary> | ||
879 | /// <param name="part"></param> | ||
880 | private void SetRootPart(SceneObjectPart part) | ||
881 | { | ||
882 | part.SetParent(this); | ||
883 | part.ParentID = 0; | ||
884 | part.LinkNum = 0; | ||
885 | m_rootPart = part; | ||
886 | m_parts.Add(m_rootPart.UUID, m_rootPart); | ||
887 | } | ||
893 | 888 | ||
894 | /// <summary> | 889 | /// <summary> |
895 | /// Add a new part to this scene object | 890 | /// Add a new part to this scene object. The part must already be correctly configured. |
896 | /// </summary> | 891 | /// </summary> |
897 | /// <param name="part"></param> | 892 | /// <param name="part"></param> |
898 | public void AddPart(SceneObjectPart part) | 893 | public void AddPart(SceneObjectPart part) |
@@ -1394,15 +1389,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1394 | /// <param name="cGroupID"></param> | 1389 | /// <param name="cGroupID"></param> |
1395 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) | 1390 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) |
1396 | { | 1391 | { |
1397 | SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); | 1392 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed)); |
1398 | newPart.SetParent(this); | ||
1399 | |||
1400 | lock (m_parts) | ||
1401 | { | ||
1402 | m_parts.Add(newPart.UUID, newPart); | ||
1403 | } | ||
1404 | |||
1405 | SetPartAsRoot(newPart); | ||
1406 | } | 1393 | } |
1407 | 1394 | ||
1408 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 1395 | public void ScriptSetPhysicsStatus(bool UsePhysics) |