aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-09-01 01:22:28 +0100
committerJustin Clark-Casey (justincc)2011-09-01 01:22:28 +0100
commit095b3e5756bb3160b30c9c5670ba008fa13d2e66 (patch)
tree0052b92cf46d42d714740bb4c7404edbdbaea0de /OpenSim/Region/Framework
parentFix a bug where the non-root parts of rezzed objects that had previously been... (diff)
downloadopensim-SC_OLD-095b3e5756bb3160b30c9c5670ba008fa13d2e66.zip
opensim-SC_OLD-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.gz
opensim-SC_OLD-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.bz2
opensim-SC_OLD-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.xz
Remove pointless cluttering SOP.ParentGroup != null checks.
The only times when ParentGroup might be null is during regression tests (which might not be a valid thing) and when scene objects are being constructed from the database. At all other times it's not possible for a SOP not to have a SOG parent.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs282
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs2
7 files changed, 185 insertions, 272 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 33407ec..1b10e3c 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -208,8 +208,7 @@ namespace OpenSim.Region.Framework.Scenes
208 if (entity is SceneObjectPart) 208 if (entity is SceneObjectPart)
209 { 209 {
210 SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; 210 SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
211 if (group != null) 211 entityPos = group.AbsolutePosition;
212 entityPos = group.AbsolutePosition;
213 } 212 }
214 213
215 // Use the camera position for local agents and avatar position for remote agents 214 // Use the camera position for local agents and avatar position for remote agents
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index addc20c..4700c3b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -225,16 +225,8 @@ namespace OpenSim.Region.Framework.Scenes
225 SceneObjectPart part = GetSceneObjectPart(primId); 225 SceneObjectPart part = GetSceneObjectPart(primId);
226 if (part == null) 226 if (part == null)
227 return new ArrayList(); 227 return new ArrayList();
228 SceneObjectGroup group = part.ParentGroup;
229 if (null == group)
230 {
231 m_log.ErrorFormat(
232 "[PRIM INVENTORY]: " +
233 "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
234 itemId, primId);
235 228
236 return new ArrayList(); 229 SceneObjectGroup group = part.ParentGroup;
237 }
238 230
239 // Retrieve item 231 // Retrieve item
240 TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); 232 TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId);
@@ -971,33 +963,23 @@ namespace OpenSim.Region.Framework.Scenes
971 SceneObjectPart part = GetSceneObjectPart(localID); 963 SceneObjectPart part = GetSceneObjectPart(localID);
972 if (part == null) 964 if (part == null)
973 return; 965 return;
966
974 SceneObjectGroup group = part.ParentGroup; 967 SceneObjectGroup group = part.ParentGroup;
975 if (group != null) 968 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
976 { 969 return;
977 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) 970
978 return; 971 TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
979 972 if (item == null)
980 TaskInventoryItem item = group.GetInventoryItem(localID, itemID); 973 return;
981 if (item == null)
982 return;
983 974
984 if (item.Type == 10) 975 if (item.Type == 10)
985 {
986 part.RemoveScriptEvents(itemID);
987 EventManager.TriggerRemoveScript(localID, itemID);
988 }
989
990 group.RemoveInventoryItem(localID, itemID);
991 part.GetProperties(remoteClient);
992 }
993 else
994 { 976 {
995 m_log.ErrorFormat( 977 part.RemoveScriptEvents(itemID);
996 "[PRIM INVENTORY]: " + 978 EventManager.TriggerRemoveScript(localID, itemID);
997 "Removal of item {0} requested of prim {1} but this prim does not exist",
998 itemID,
999 localID);
1000 } 979 }
980
981 group.RemoveInventoryItem(localID, itemID);
982 part.GetProperties(remoteClient);
1001 } 983 }
1002 984
1003 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) 985 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
@@ -1770,7 +1752,7 @@ namespace OpenSim.Region.Framework.Scenes
1770 continue; 1752 continue;
1771 1753
1772 // Already deleted by someone else 1754 // Already deleted by someone else
1773 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 1755 if (part.ParentGroup.IsDeleted)
1774 continue; 1756 continue;
1775 1757
1776 // Can't delete child prims 1758 // Can't delete child prims
@@ -2034,6 +2016,7 @@ namespace OpenSim.Region.Framework.Scenes
2034 SceneObjectPart part = GetSceneObjectPart(localID); 2016 SceneObjectPart part = GetSceneObjectPart(localID);
2035 if (part == null) 2017 if (part == null)
2036 continue; 2018 continue;
2019
2037 if (!groups.Contains(part.ParentGroup)) 2020 if (!groups.Contains(part.ParentGroup))
2038 groups.Add(part.ParentGroup); 2021 groups.Add(part.ParentGroup);
2039 } 2022 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9368285..7f5aea7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3012,58 +3012,51 @@ namespace OpenSim.Region.Framework.Scenes
3012 Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); 3012 Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z);
3013 Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); 3013 Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z);
3014 3014
3015 if (target2.ParentGroup != null) 3015 pos = target2.AbsolutePosition;
3016 { 3016 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
3017 pos = target2.AbsolutePosition;
3018 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
3019 3017
3020 // TODO: Raytrace better here 3018 // TODO: Raytrace better here
3021 3019
3022 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); 3020 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection));
3023 Ray NewRay = new Ray(AXOrigin, AXdirection); 3021 Ray NewRay = new Ray(AXOrigin, AXdirection);
3024 3022
3025 // Ray Trace against target here 3023 // Ray Trace against target here
3026 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); 3024 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters);
3027 3025
3028 // Un-comment out the following line to Get Raytrace results printed to the console. 3026 // Un-comment out the following line to Get Raytrace results printed to the console.
3029 //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 3027 //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
3030 float ScaleOffset = 0.5f; 3028 float ScaleOffset = 0.5f;
3031 3029
3032 // If we hit something 3030 // If we hit something
3033 if (ei.HitTF) 3031 if (ei.HitTF)
3032 {
3033 Vector3 scale = target.Scale;
3034 Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z);
3035 if (scaleComponent.X != 0) ScaleOffset = scale.X;
3036 if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
3037 if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
3038 ScaleOffset = Math.Abs(ScaleOffset);
3039 Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
3040 Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z);
3041 Vector3 offset = normal * (ScaleOffset / 2f);
3042 pos = intersectionpoint + offset;
3043
3044 // stick in offset format from the original prim
3045 pos = pos - target.ParentGroup.AbsolutePosition;
3046 if (CopyRotates)
3034 { 3047 {
3035 Vector3 scale = target.Scale; 3048 Quaternion worldRot = target2.GetWorldRotation();
3036 Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z);
3037 if (scaleComponent.X != 0) ScaleOffset = scale.X;
3038 if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
3039 if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
3040 ScaleOffset = Math.Abs(ScaleOffset);
3041 Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
3042 Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z);
3043 Vector3 offset = normal * (ScaleOffset / 2f);
3044 pos = intersectionpoint + offset;
3045
3046 // stick in offset format from the original prim
3047 pos = pos - target.ParentGroup.AbsolutePosition;
3048 if (CopyRotates)
3049 {
3050 Quaternion worldRot = target2.GetWorldRotation();
3051 3049
3052 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 3050 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
3053 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 3051 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
3054 //obj.Rotation = worldRot; 3052 //obj.Rotation = worldRot;
3055 //obj.UpdateGroupRotationR(worldRot); 3053 //obj.UpdateGroupRotationR(worldRot);
3056 } 3054 }
3057 else 3055 else
3058 { 3056 {
3059 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); 3057 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID);
3060 }
3061 } 3058 }
3062
3063 return;
3064 } 3059 }
3065
3066 return;
3067 } 3060 }
3068 } 3061 }
3069 3062
@@ -3233,12 +3226,13 @@ namespace OpenSim.Region.Framework.Scenes
3233 SceneObjectPart part = GetSceneObjectPart(localID); 3226 SceneObjectPart part = GetSceneObjectPart(localID);
3234 if (part != null) // It is a prim 3227 if (part != null) // It is a prim
3235 { 3228 {
3236 if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid 3229 if (!part.ParentGroup.IsDeleted) // Valid
3237 { 3230 {
3238 if (part.ParentGroup.RootPart != part) // Child part 3231 if (part.ParentGroup.RootPart != part) // Child part
3239 return; 3232 return;
3240 } 3233 }
3241 } 3234 }
3235
3242 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); 3236 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
3243 } 3237 }
3244 3238
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 76ed55c..17a1bcc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1630,27 +1630,18 @@ namespace OpenSim.Region.Framework.Scenes
1630 SceneObjectGroup parentGroup = root.ParentGroup; 1630 SceneObjectGroup parentGroup = root.ParentGroup;
1631 1631
1632 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1632 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1633 if (parentGroup != null)
1634 {
1635 // We do this in reverse to get the link order of the prims correct
1636 for (int i = children.Count - 1; i >= 0; i--)
1637 {
1638 SceneObjectGroup child = children[i].ParentGroup;
1639 1633
1640 if (child != null) 1634 // We do this in reverse to get the link order of the prims correct
1641 { 1635 for (int i = children.Count - 1; i >= 0; i--)
1642 // Make sure no child prim is set for sale
1643 // So that, on delink, no prims are unwittingly
1644 // left for sale and sold off
1645 child.RootPart.ObjectSaleType = 0;
1646 child.RootPart.SalePrice = 10;
1647 childGroups.Add(child);
1648 }
1649 }
1650 }
1651 else
1652 { 1636 {
1653 return; // parent is null so not in this region 1637 SceneObjectGroup child = children[i].ParentGroup;
1638
1639 // Make sure no child prim is set for sale
1640 // So that, on delink, no prims are unwittingly
1641 // left for sale and sold off
1642 child.RootPart.ObjectSaleType = 0;
1643 child.RootPart.SalePrice = 10;
1644 childGroups.Add(child);
1654 } 1645 }
1655 1646
1656 foreach (SceneObjectGroup child in childGroups) 1647 foreach (SceneObjectGroup child in childGroups)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 71023a9..4e7504a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -302,7 +302,6 @@ namespace OpenSim.Region.Framework.Scenes
302 protected string m_name; 302 protected string m_name;
303 protected Vector3 m_offsetPosition; 303 protected Vector3 m_offsetPosition;
304 304
305 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
306 protected SceneObjectGroup m_parentGroup; 305 protected SceneObjectGroup m_parentGroup;
307 protected byte[] m_particleSystem = Utils.EmptyBytes; 306 protected byte[] m_particleSystem = Utils.EmptyBytes;
308 protected ulong m_regionHandle; 307 protected ulong m_regionHandle;
@@ -592,6 +591,7 @@ namespace OpenSim.Region.Framework.Scenes
592 set 591 set
593 { 592 {
594 m_passTouches = value; 593 m_passTouches = value;
594
595 if (ParentGroup != null) 595 if (ParentGroup != null)
596 ParentGroup.HasGroupChanged = true; 596 ParentGroup.HasGroupChanged = true;
597 } 597 }
@@ -759,13 +759,10 @@ namespace OpenSim.Region.Framework.Scenes
759 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too 759 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
760 if (m_sitTargetAvatar != UUID.Zero) 760 if (m_sitTargetAvatar != UUID.Zero)
761 { 761 {
762 if (m_parentGroup != null) // TODO can there be a SOP without a SOG? 762 ScenePresence avatar;
763 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
763 { 764 {
764 ScenePresence avatar; 765 avatar.ParentPosition = GetWorldPosition();
765 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
766 {
767 avatar.ParentPosition = GetWorldPosition();
768 }
769 } 766 }
770 } 767 }
771 } 768 }
@@ -854,7 +851,9 @@ namespace OpenSim.Region.Framework.Scenes
854 actor.Orientation = resultingrotation; 851 actor.Orientation = resultingrotation;
855 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); 852 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
856 } 853 }
857 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 854
855 if (m_parentGroup != null)
856 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
858 //} 857 //}
859 } 858 }
860 catch (Exception ex) 859 catch (Exception ex)
@@ -862,7 +861,6 @@ namespace OpenSim.Region.Framework.Scenes
862 m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); 861 m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
863 } 862 }
864 } 863 }
865
866 } 864 }
867 } 865 }
868 866
@@ -1018,7 +1016,7 @@ namespace OpenSim.Region.Framework.Scenes
1018 m_shape.Scale = value; 1016 m_shape.Scale = value;
1019 1017
1020 PhysicsActor actor = PhysActor; 1018 PhysicsActor actor = PhysActor;
1021 if (actor != null && m_parentGroup != null) 1019 if (actor != null)
1022 { 1020 {
1023 if (m_parentGroup.Scene != null) 1021 if (m_parentGroup.Scene != null)
1024 { 1022 {
@@ -1059,7 +1057,7 @@ namespace OpenSim.Region.Framework.Scenes
1059 set 1057 set
1060 { 1058 {
1061 m_mediaUrl = value; 1059 m_mediaUrl = value;
1062 1060
1063 if (ParentGroup != null) 1061 if (ParentGroup != null)
1064 ParentGroup.HasGroupChanged = true; 1062 ParentGroup.HasGroupChanged = true;
1065 } 1063 }
@@ -1107,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes
1107 set { m_sitTargetOrientation = value; } 1105 set { m_sitTargetOrientation = value; }
1108 } 1106 }
1109 1107
1110
1111 public Vector3 SitTargetPosition 1108 public Vector3 SitTargetPosition
1112 { 1109 {
1113 get { return m_sitTargetPosition; } 1110 get { return m_sitTargetPosition; }
@@ -1262,7 +1259,7 @@ namespace OpenSim.Region.Framework.Scenes
1262 { 1259 {
1263 get 1260 get
1264 { 1261 {
1265 if (ParentGroup != null && ParentGroup.Scene != null) 1262 if (ParentGroup.Scene != null)
1266 return ParentGroup.Scene.RegionInfo.RegionID; 1263 return ParentGroup.Scene.RegionInfo.RegionID;
1267 else 1264 else
1268 return UUID.Zero; 1265 return UUID.Zero;
@@ -1277,14 +1274,13 @@ namespace OpenSim.Region.Framework.Scenes
1277 get 1274 get
1278 { 1275 {
1279 if (ParentGroup != null) 1276 if (ParentGroup != null)
1280 {
1281 _parentUUID = ParentGroup.UUID; 1277 _parentUUID = ParentGroup.UUID;
1282 } 1278
1283 return _parentUUID; 1279 return _parentUUID;
1284 } 1280 }
1281
1285 set { _parentUUID = value; } 1282 set { _parentUUID = value; }
1286 } 1283 }
1287
1288 1284
1289 public string SitAnimation 1285 public string SitAnimation
1290 { 1286 {
@@ -1514,10 +1510,7 @@ namespace OpenSim.Region.Framework.Scenes
1514 impulse = newimpulse; 1510 impulse = newimpulse;
1515 } 1511 }
1516 1512
1517 if (m_parentGroup != null) 1513 m_parentGroup.applyAngularImpulse(impulse);
1518 {
1519 m_parentGroup.applyAngularImpulse(impulse);
1520 }
1521 } 1514 }
1522 1515
1523 /// <summary> 1516 /// <summary>
@@ -1540,10 +1533,7 @@ namespace OpenSim.Region.Framework.Scenes
1540 impulse = newimpulse; 1533 impulse = newimpulse;
1541 } 1534 }
1542 1535
1543 if (m_parentGroup != null) 1536 m_parentGroup.setAngularImpulse(impulse);
1544 {
1545 m_parentGroup.setAngularImpulse(impulse);
1546 }
1547 } 1537 }
1548 1538
1549 public Vector3 GetTorque() 1539 public Vector3 GetTorque()
@@ -1951,8 +1941,6 @@ namespace OpenSim.Region.Framework.Scenes
1951 1941
1952 public bool GetDieAtEdge() 1942 public bool GetDieAtEdge()
1953 { 1943 {
1954 if (m_parentGroup == null)
1955 return false;
1956 if (m_parentGroup.IsDeleted) 1944 if (m_parentGroup.IsDeleted)
1957 return false; 1945 return false;
1958 1946
@@ -1961,8 +1949,6 @@ namespace OpenSim.Region.Framework.Scenes
1961 1949
1962 public bool GetReturnAtEdge() 1950 public bool GetReturnAtEdge()
1963 { 1951 {
1964 if (m_parentGroup == null)
1965 return false;
1966 if (m_parentGroup.IsDeleted) 1952 if (m_parentGroup.IsDeleted)
1967 return false; 1953 return false;
1968 1954
@@ -1971,8 +1957,6 @@ namespace OpenSim.Region.Framework.Scenes
1971 1957
1972 public void SetReturnAtEdge(bool p) 1958 public void SetReturnAtEdge(bool p)
1973 { 1959 {
1974 if (m_parentGroup == null)
1975 return;
1976 if (m_parentGroup.IsDeleted) 1960 if (m_parentGroup.IsDeleted)
1977 return; 1961 return;
1978 1962
@@ -1981,8 +1965,6 @@ namespace OpenSim.Region.Framework.Scenes
1981 1965
1982 public bool GetBlockGrab() 1966 public bool GetBlockGrab()
1983 { 1967 {
1984 if (m_parentGroup == null)
1985 return false;
1986 if (m_parentGroup.IsDeleted) 1968 if (m_parentGroup.IsDeleted)
1987 return false; 1969 return false;
1988 1970
@@ -1991,8 +1973,6 @@ namespace OpenSim.Region.Framework.Scenes
1991 1973
1992 public void SetBlockGrab(bool p) 1974 public void SetBlockGrab(bool p)
1993 { 1975 {
1994 if (m_parentGroup == null)
1995 return;
1996 if (m_parentGroup.IsDeleted) 1976 if (m_parentGroup.IsDeleted)
1997 return; 1977 return;
1998 1978
@@ -2001,8 +1981,6 @@ namespace OpenSim.Region.Framework.Scenes
2001 1981
2002 public void SetStatusSandbox(bool p) 1982 public void SetStatusSandbox(bool p)
2003 { 1983 {
2004 if (m_parentGroup == null)
2005 return;
2006 if (m_parentGroup.IsDeleted) 1984 if (m_parentGroup.IsDeleted)
2007 return; 1985 return;
2008 StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; 1986 StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition;
@@ -2011,8 +1989,6 @@ namespace OpenSim.Region.Framework.Scenes
2011 1989
2012 public bool GetStatusSandbox() 1990 public bool GetStatusSandbox()
2013 { 1991 {
2014 if (m_parentGroup == null)
2015 return false;
2016 if (m_parentGroup.IsDeleted) 1992 if (m_parentGroup.IsDeleted)
2017 return false; 1993 return false;
2018 1994
@@ -2090,11 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
2090 2066
2091 public UUID GetRootPartUUID() 2067 public UUID GetRootPartUUID()
2092 { 2068 {
2093 if (m_parentGroup != null) 2069 return m_parentGroup.UUID;
2094 {
2095 return m_parentGroup.UUID;
2096 }
2097 return UUID.Zero;
2098 } 2070 }
2099 2071
2100 /// <summary> 2072 /// <summary>
@@ -2220,8 +2192,6 @@ namespace OpenSim.Region.Framework.Scenes
2220 m_lastColliders.Remove(localID); 2192 m_lastColliders.Remove(localID);
2221 } 2193 }
2222 2194
2223 if (m_parentGroup == null)
2224 return;
2225 if (m_parentGroup.IsDeleted) 2195 if (m_parentGroup.IsDeleted)
2226 return; 2196 return;
2227 2197
@@ -2242,9 +2212,6 @@ namespace OpenSim.Region.Framework.Scenes
2242 { 2212 {
2243 if (localId == 0) 2213 if (localId == 0)
2244 continue; 2214 continue;
2245 // always running this check because if the user deletes the object it would return a null reference.
2246 if (m_parentGroup == null)
2247 return;
2248 2215
2249 if (m_parentGroup.Scene == null) 2216 if (m_parentGroup.Scene == null)
2250 return; 2217 return;
@@ -2253,7 +2220,8 @@ namespace OpenSim.Region.Framework.Scenes
2253 string data = ""; 2220 string data = "";
2254 if (obj != null) 2221 if (obj != null)
2255 { 2222 {
2256 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2223 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString())
2224 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2257 { 2225 {
2258 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2226 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2259 //If it is 1, it is to accept ONLY collisions from this object 2227 //If it is 1, it is to accept ONLY collisions from this object
@@ -2300,7 +2268,8 @@ namespace OpenSim.Region.Framework.Scenes
2300 { 2268 {
2301 if (av.LocalId == localId) 2269 if (av.LocalId == localId)
2302 { 2270 {
2303 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2271 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
2272 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2304 { 2273 {
2305 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); 2274 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
2306 //If it is 1, it is to accept ONLY collisions from this avatar 2275 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2348,12 +2317,10 @@ namespace OpenSim.Region.Framework.Scenes
2348 if (colliding.Count > 0) 2317 if (colliding.Count > 0)
2349 { 2318 {
2350 StartCollidingMessage.Colliders = colliding; 2319 StartCollidingMessage.Colliders = colliding;
2351 // always running this check because if the user deletes the object it would return a null reference.
2352 if (m_parentGroup == null)
2353 return;
2354 2320
2355 if (m_parentGroup.Scene == null) 2321 if (m_parentGroup.Scene == null)
2356 return; 2322 return;
2323
2357 if (m_parentGroup.PassCollision == true) 2324 if (m_parentGroup.PassCollision == true)
2358 { 2325 {
2359 //TODO: Add pass to root prim! 2326 //TODO: Add pass to root prim!
@@ -2374,9 +2341,6 @@ namespace OpenSim.Region.Framework.Scenes
2374 // always running this check because if the user deletes the object it would return a null reference. 2341 // always running this check because if the user deletes the object it would return a null reference.
2375 if (localId == 0) 2342 if (localId == 0)
2376 continue; 2343 continue;
2377
2378 if (m_parentGroup == null)
2379 return;
2380 2344
2381 if (m_parentGroup.Scene == null) 2345 if (m_parentGroup.Scene == null)
2382 return; 2346 return;
@@ -2385,7 +2349,8 @@ namespace OpenSim.Region.Framework.Scenes
2385 string data = ""; 2349 string data = "";
2386 if (obj != null) 2350 if (obj != null)
2387 { 2351 {
2388 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2352 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString())
2353 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2389 { 2354 {
2390 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2355 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2391 //If it is 1, it is to accept ONLY collisions from this object 2356 //If it is 1, it is to accept ONLY collisions from this object
@@ -2432,7 +2397,8 @@ namespace OpenSim.Region.Framework.Scenes
2432 { 2397 {
2433 if (av.LocalId == localId) 2398 if (av.LocalId == localId)
2434 { 2399 {
2435 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2400 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
2401 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2436 { 2402 {
2437 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); 2403 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
2438 //If it is 1, it is to accept ONLY collisions from this avatar 2404 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2480,9 +2446,6 @@ namespace OpenSim.Region.Framework.Scenes
2480 if (colliding.Count > 0) 2446 if (colliding.Count > 0)
2481 { 2447 {
2482 CollidingMessage.Colliders = colliding; 2448 CollidingMessage.Colliders = colliding;
2483 // always running this check because if the user deletes the object it would return a null reference.
2484 if (m_parentGroup == null)
2485 return;
2486 2449
2487 if (m_parentGroup.Scene == null) 2450 if (m_parentGroup.Scene == null)
2488 return; 2451 return;
@@ -2503,11 +2466,9 @@ namespace OpenSim.Region.Framework.Scenes
2503 if (localId == 0) 2466 if (localId == 0)
2504 continue; 2467 continue;
2505 2468
2506 // always running this check because if the user deletes the object it would return a null reference.
2507 if (m_parentGroup == null)
2508 return;
2509 if (m_parentGroup.Scene == null) 2469 if (m_parentGroup.Scene == null)
2510 return; 2470 return;
2471
2511 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2472 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
2512 string data = ""; 2473 string data = "";
2513 if (obj != null) 2474 if (obj != null)
@@ -2559,7 +2520,8 @@ namespace OpenSim.Region.Framework.Scenes
2559 { 2520 {
2560 if (av.LocalId == localId) 2521 if (av.LocalId == localId)
2561 { 2522 {
2562 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2523 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
2524 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2563 { 2525 {
2564 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); 2526 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
2565 //If it is 1, it is to accept ONLY collisions from this avatar 2527 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2608,9 +2570,6 @@ namespace OpenSim.Region.Framework.Scenes
2608 if (colliding.Count > 0) 2570 if (colliding.Count > 0)
2609 { 2571 {
2610 EndCollidingMessage.Colliders = colliding; 2572 EndCollidingMessage.Colliders = colliding;
2611 // always running this check because if the user deletes the object it would return a null reference.
2612 if (m_parentGroup == null)
2613 return;
2614 2573
2615 if (m_parentGroup.Scene == null) 2574 if (m_parentGroup.Scene == null)
2616 return; 2575 return;
@@ -2619,6 +2578,7 @@ namespace OpenSim.Region.Framework.Scenes
2619 } 2578 }
2620 } 2579 }
2621 } 2580 }
2581
2622 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) 2582 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
2623 { 2583 {
2624 if (startedColliders.Count > 0) 2584 if (startedColliders.Count > 0)
@@ -2646,9 +2606,6 @@ namespace OpenSim.Region.Framework.Scenes
2646 if (colliding.Count > 0) 2606 if (colliding.Count > 0)
2647 { 2607 {
2648 LandStartCollidingMessage.Colliders = colliding; 2608 LandStartCollidingMessage.Colliders = colliding;
2649 // always running this check because if the user deletes the object it would return a null reference.
2650 if (m_parentGroup == null)
2651 return;
2652 2609
2653 if (m_parentGroup.Scene == null) 2610 if (m_parentGroup.Scene == null)
2654 return; 2611 return;
@@ -2657,6 +2614,7 @@ namespace OpenSim.Region.Framework.Scenes
2657 } 2614 }
2658 } 2615 }
2659 } 2616 }
2617
2660 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) 2618 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
2661 { 2619 {
2662 if (m_lastColliders.Count > 0) 2620 if (m_lastColliders.Count > 0)
@@ -2684,9 +2642,6 @@ namespace OpenSim.Region.Framework.Scenes
2684 if (colliding.Count > 0) 2642 if (colliding.Count > 0)
2685 { 2643 {
2686 LandCollidingMessage.Colliders = colliding; 2644 LandCollidingMessage.Colliders = colliding;
2687 // always running this check because if the user deletes the object it would return a null reference.
2688 if (m_parentGroup == null)
2689 return;
2690 2645
2691 if (m_parentGroup.Scene == null) 2646 if (m_parentGroup.Scene == null)
2692 return; 2647 return;
@@ -2695,6 +2650,7 @@ namespace OpenSim.Region.Framework.Scenes
2695 } 2650 }
2696 } 2651 }
2697 } 2652 }
2653
2698 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) 2654 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
2699 { 2655 {
2700 if (endedColliders.Count > 0) 2656 if (endedColliders.Count > 0)
@@ -2722,9 +2678,6 @@ namespace OpenSim.Region.Framework.Scenes
2722 if (colliding.Count > 0) 2678 if (colliding.Count > 0)
2723 { 2679 {
2724 LandEndCollidingMessage.Colliders = colliding; 2680 LandEndCollidingMessage.Colliders = colliding;
2725 // always running this check because if the user deletes the object it would return a null reference.
2726 if (m_parentGroup == null)
2727 return;
2728 2681
2729 if (m_parentGroup.Scene == null) 2682 if (m_parentGroup.Scene == null)
2730 return; 2683 return;
@@ -2748,10 +2701,12 @@ namespace OpenSim.Region.Framework.Scenes
2748 { 2701 {
2749 if (PhysActor != null) 2702 if (PhysActor != null)
2750 { 2703 {
2751
2752 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); 2704 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
2753 2705
2754 if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) 2706 if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N)
2707 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S)
2708 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E)
2709 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W))
2755 { 2710 {
2756 m_parentGroup.AbsolutePosition = newpos; 2711 m_parentGroup.AbsolutePosition = newpos;
2757 return; 2712 return;
@@ -2909,11 +2864,11 @@ namespace OpenSim.Region.Framework.Scenes
2909 public void ScheduleFullUpdate() 2864 public void ScheduleFullUpdate()
2910 { 2865 {
2911// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); 2866// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId);
2912 2867
2913 if (m_parentGroup != null) 2868 if (m_parentGroup == null)
2914 { 2869 return;
2915 m_parentGroup.QueueForUpdateCheck(); 2870
2916 } 2871 m_parentGroup.QueueForUpdateCheck();
2917 2872
2918 int timeNow = Util.UnixTimeSinceEpoch(); 2873 int timeNow = Util.UnixTimeSinceEpoch();
2919 2874
@@ -2942,13 +2897,14 @@ namespace OpenSim.Region.Framework.Scenes
2942 /// </summary> 2897 /// </summary>
2943 public void ScheduleTerseUpdate() 2898 public void ScheduleTerseUpdate()
2944 { 2899 {
2900 if (m_parentGroup == null)
2901 return;
2902
2945 if (m_updateFlag < 1) 2903 if (m_updateFlag < 1)
2946 { 2904 {
2947 if (m_parentGroup != null) 2905 m_parentGroup.HasGroupChanged = true;
2948 { 2906 m_parentGroup.QueueForUpdateCheck();
2949 m_parentGroup.HasGroupChanged = true; 2907
2950 m_parentGroup.QueueForUpdateCheck();
2951 }
2952 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); 2908 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
2953 m_updateFlag = 1; 2909 m_updateFlag = 1;
2954 2910
@@ -2960,10 +2916,7 @@ namespace OpenSim.Region.Framework.Scenes
2960 2916
2961 public void ScriptSetPhysicsStatus(bool UsePhysics) 2917 public void ScriptSetPhysicsStatus(bool UsePhysics)
2962 { 2918 {
2963 if (m_parentGroup == null) 2919 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
2964 DoPhysicsPropertyUpdate(UsePhysics, false);
2965 else
2966 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
2967 } 2920 }
2968 2921
2969 /// <summary> 2922 /// <summary>
@@ -3003,6 +2956,9 @@ namespace OpenSim.Region.Framework.Scenes
3003 /// <param name="clientFlags"></param> 2956 /// <param name="clientFlags"></param>
3004 protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) 2957 protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
3005 { 2958 {
2959 if (m_parentGroup == null)
2960 return;
2961
3006// m_log.DebugFormat( 2962// m_log.DebugFormat(
3007// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); 2963// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
3008 2964
@@ -3028,6 +2984,9 @@ namespace OpenSim.Region.Framework.Scenes
3028 /// </summary> 2984 /// </summary>
3029 public void SendFullUpdateToAllClients() 2985 public void SendFullUpdateToAllClients()
3030 { 2986 {
2987 if (m_parentGroup == null)
2988 return;
2989
3031 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 2990 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
3032 { 2991 {
3033 SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); 2992 SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID));
@@ -3040,6 +2999,9 @@ namespace OpenSim.Region.Framework.Scenes
3040 /// <param name="agentID"></param> 2999 /// <param name="agentID"></param>
3041 public void SendFullUpdateToAllClientsExcept(UUID agentID) 3000 public void SendFullUpdateToAllClientsExcept(UUID agentID)
3042 { 3001 {
3002 if (m_parentGroup == null)
3003 return;
3004
3043 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 3005 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
3044 { 3006 {
3045 // Ugly reference :( 3007 // Ugly reference :(
@@ -3068,6 +3030,9 @@ namespace OpenSim.Region.Framework.Scenes
3068 /// <param name="clientFlags"></param> 3030 /// <param name="clientFlags"></param>
3069 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags) 3031 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
3070 { 3032 {
3033 if (ParentGroup == null)
3034 return;
3035
3071 // Suppress full updates during attachment editing 3036 // Suppress full updates during attachment editing
3072 // 3037 //
3073 if (ParentGroup.IsSelected && ParentGroup.IsAttachment) 3038 if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
@@ -3250,10 +3215,7 @@ namespace OpenSim.Region.Framework.Scenes
3250 3215
3251 public void SetAxisRotation(int axis, int rotate) 3216 public void SetAxisRotation(int axis, int rotate)
3252 { 3217 {
3253 if (m_parentGroup != null) 3218 m_parentGroup.SetAxisRotation(axis, rotate);
3254 {
3255 m_parentGroup.SetAxisRotation(axis, rotate);
3256 }
3257 3219
3258 //Cannot use ScriptBaseClass constants as no referance to it currently. 3220 //Cannot use ScriptBaseClass constants as no referance to it currently.
3259 if (axis == 2)//STATUS_ROTATE_X 3221 if (axis == 2)//STATUS_ROTATE_X
@@ -3276,8 +3238,6 @@ namespace OpenSim.Region.Framework.Scenes
3276 3238
3277 public void SetDieAtEdge(bool p) 3239 public void SetDieAtEdge(bool p)
3278 { 3240 {
3279 if (m_parentGroup == null)
3280 return;
3281 if (m_parentGroup.IsDeleted) 3241 if (m_parentGroup.IsDeleted)
3282 return; 3242 return;
3283 3243
@@ -3530,7 +3490,7 @@ namespace OpenSim.Region.Framework.Scenes
3530 } 3490 }
3531 3491
3532 /// <summary> 3492 /// <summary>
3533 /// 3493 /// Set the parent group of this prim.
3534 /// </summary> 3494 /// </summary>
3535 public void SetParent(SceneObjectGroup parent) 3495 public void SetParent(SceneObjectGroup parent)
3536 { 3496 {
@@ -3587,8 +3547,11 @@ namespace OpenSim.Region.Framework.Scenes
3587 { 3547 {
3588 Text = text; 3548 Text = text;
3589 3549
3590 ParentGroup.HasGroupChanged = true; 3550 if (ParentGroup != null)
3591 ScheduleFullUpdate(); 3551 {
3552 ParentGroup.HasGroupChanged = true;
3553 ScheduleFullUpdate();
3554 }
3592 } 3555 }
3593 3556
3594 public void StopLookAt() 3557 public void StopLookAt()
@@ -3632,7 +3595,7 @@ namespace OpenSim.Region.Framework.Scenes
3632 { 3595 {
3633 if (!IgnoreUndoUpdate) 3596 if (!IgnoreUndoUpdate)
3634 { 3597 {
3635 if (m_parentGroup != null) 3598 if (ParentGroup != null)
3636 { 3599 {
3637 lock (m_undo) 3600 lock (m_undo)
3638 { 3601 {
@@ -3644,31 +3607,31 @@ namespace OpenSim.Region.Framework.Scenes
3644 // TODO: May need to fix for group comparison 3607 // TODO: May need to fix for group comparison
3645 if (last.Compare(this)) 3608 if (last.Compare(this))
3646 { 3609 {
3647// m_log.DebugFormat( 3610 // m_log.DebugFormat(
3648// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", 3611 // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
3649// Name, LocalId, m_undo.Count); 3612 // Name, LocalId, m_undo.Count);
3650 3613
3651 return; 3614 return;
3652 } 3615 }
3653 } 3616 }
3654 } 3617 }
3655 3618
3656// m_log.DebugFormat( 3619 // m_log.DebugFormat(
3657// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", 3620 // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
3658// Name, LocalId, forGroup, m_undo.Count); 3621 // Name, LocalId, forGroup, m_undo.Count);
3659 3622
3660 if (m_parentGroup.GetSceneMaxUndo() > 0) 3623 if (m_parentGroup.GetSceneMaxUndo() > 0)
3661 { 3624 {
3662 UndoState nUndo = new UndoState(this, forGroup); 3625 UndoState nUndo = new UndoState(this, forGroup);
3663 3626
3664 m_undo.Push(nUndo); 3627 m_undo.Push(nUndo);
3665 3628
3666 if (m_redo.Count > 0) 3629 if (m_redo.Count > 0)
3667 m_redo.Clear(); 3630 m_redo.Clear();
3668 3631
3669// m_log.DebugFormat( 3632 // m_log.DebugFormat(
3670// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", 3633 // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
3671// Name, LocalId, forGroup, m_undo.Count); 3634 // Name, LocalId, forGroup, m_undo.Count);
3672 } 3635 }
3673 } 3636 }
3674 } 3637 }
@@ -4245,8 +4208,11 @@ namespace OpenSim.Region.Framework.Scenes
4245 } 4208 }
4246 } 4209 }
4247 4210
4248 ParentGroup.HasGroupChanged = true; 4211 if (ParentGroup != null)
4249 ScheduleFullUpdate(); 4212 {
4213 ParentGroup.HasGroupChanged = true;
4214 ScheduleFullUpdate();
4215 }
4250 } 4216 }
4251 4217
4252 public void UpdateGroupPosition(Vector3 pos) 4218 public void UpdateGroupPosition(Vector3 pos)
@@ -4450,14 +4416,12 @@ namespace OpenSim.Region.Framework.Scenes
4450 if (!wasUsingPhysics) 4416 if (!wasUsingPhysics)
4451 { 4417 {
4452 DoPhysicsPropertyUpdate(UsePhysics, false); 4418 DoPhysicsPropertyUpdate(UsePhysics, false);
4453 if (m_parentGroup != null) 4419
4420 if (!m_parentGroup.IsDeleted)
4454 { 4421 {
4455 if (!m_parentGroup.IsDeleted) 4422 if (LocalId == m_parentGroup.RootPart.LocalId)
4456 { 4423 {
4457 if (LocalId == m_parentGroup.RootPart.LocalId) 4424 m_parentGroup.CheckSculptAndLoad();
4458 {
4459 m_parentGroup.CheckSculptAndLoad();
4460 }
4461 } 4425 }
4462 } 4426 }
4463 } 4427 }
@@ -4510,14 +4474,11 @@ namespace OpenSim.Region.Framework.Scenes
4510 PhysActor.SetMaterial(Material); 4474 PhysActor.SetMaterial(Material);
4511 DoPhysicsPropertyUpdate(UsePhysics, true); 4475 DoPhysicsPropertyUpdate(UsePhysics, true);
4512 4476
4513 if (m_parentGroup != null) 4477 if (!m_parentGroup.IsDeleted)
4514 { 4478 {
4515 if (!m_parentGroup.IsDeleted) 4479 if (LocalId == m_parentGroup.RootPart.LocalId)
4516 { 4480 {
4517 if (LocalId == m_parentGroup.RootPart.LocalId) 4481 m_parentGroup.CheckSculptAndLoad();
4518 {
4519 m_parentGroup.CheckSculptAndLoad();
4520 }
4521 } 4482 }
4522 } 4483 }
4523 4484
@@ -4541,14 +4502,12 @@ namespace OpenSim.Region.Framework.Scenes
4541 pa.IsPhysical = UsePhysics; 4502 pa.IsPhysical = UsePhysics;
4542 4503
4543 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim 4504 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim
4544 if (m_parentGroup != null) 4505
4506 if (!m_parentGroup.IsDeleted)
4545 { 4507 {
4546 if (!m_parentGroup.IsDeleted) 4508 if (LocalId == m_parentGroup.RootPart.LocalId)
4547 { 4509 {
4548 if (LocalId == m_parentGroup.RootPart.LocalId) 4510 m_parentGroup.CheckSculptAndLoad();
4549 {
4550 m_parentGroup.CheckSculptAndLoad();
4551 }
4552 } 4511 }
4553 } 4512 }
4554 } 4513 }
@@ -4591,8 +4550,11 @@ namespace OpenSim.Region.Framework.Scenes
4591 } 4550 }
4592 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 4551 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
4593 4552
4594 ParentGroup.HasGroupChanged = true; 4553 if (ParentGroup != null)
4595 ScheduleFullUpdate(); 4554 {
4555 ParentGroup.HasGroupChanged = true;
4556 ScheduleFullUpdate();
4557 }
4596 4558
4597// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); 4559// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
4598 } 4560 }
@@ -4605,8 +4567,12 @@ namespace OpenSim.Region.Framework.Scenes
4605 (rot.W != RotationOffset.W)) 4567 (rot.W != RotationOffset.W))
4606 { 4568 {
4607 RotationOffset = rot; 4569 RotationOffset = rot;
4608 ParentGroup.HasGroupChanged = true; 4570
4609 ScheduleTerseUpdate(); 4571 if (ParentGroup != null)
4572 {
4573 ParentGroup.HasGroupChanged = true;
4574 ScheduleTerseUpdate();
4575 }
4610 } 4576 }
4611 } 4577 }
4612 4578
@@ -4797,14 +4763,6 @@ namespace OpenSim.Region.Framework.Scenes
4797 } 4763 }
4798 } 4764 }
4799 4765
4800 if (m_parentGroup == null)
4801 {
4802// m_log.DebugFormat(
4803// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId);
4804 ScheduleFullUpdate();
4805 return;
4806 }
4807
4808 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) 4766 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
4809 //{ 4767 //{
4810 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; 4768 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
@@ -4830,36 +4788,22 @@ namespace OpenSim.Region.Framework.Scenes
4830 4788
4831 public int registerTargetWaypoint(Vector3 target, float tolerance) 4789 public int registerTargetWaypoint(Vector3 target, float tolerance)
4832 { 4790 {
4833 if (m_parentGroup != null) 4791 return m_parentGroup.registerTargetWaypoint(target, tolerance);
4834 {
4835 return m_parentGroup.registerTargetWaypoint(target, tolerance);
4836 }
4837 return 0;
4838 } 4792 }
4839 4793
4840 public void unregisterTargetWaypoint(int handle) 4794 public void unregisterTargetWaypoint(int handle)
4841 { 4795 {
4842 if (m_parentGroup != null) 4796 m_parentGroup.unregisterTargetWaypoint(handle);
4843 {
4844 m_parentGroup.unregisterTargetWaypoint(handle);
4845 }
4846 } 4797 }
4847 4798
4848 public int registerRotTargetWaypoint(Quaternion target, float tolerance) 4799 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
4849 { 4800 {
4850 if (m_parentGroup != null) 4801 return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
4851 {
4852 return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
4853 }
4854 return 0;
4855 } 4802 }
4856 4803
4857 public void unregisterRotTargetWaypoint(int handle) 4804 public void unregisterRotTargetWaypoint(int handle)
4858 { 4805 {
4859 if (m_parentGroup != null) 4806 m_parentGroup.unregisterRotTargetWaypoint(handle);
4860 {
4861 m_parentGroup.unregisterRotTargetWaypoint(handle);
4862 }
4863 } 4807 }
4864 4808
4865 public void SetCameraAtOffset(Vector3 v) 4809 public void SetCameraAtOffset(Vector3 v)
@@ -4901,7 +4845,7 @@ namespace OpenSim.Region.Framework.Scenes
4901 4845
4902 public void SendTerseUpdateToClient(IClientAPI remoteClient) 4846 public void SendTerseUpdateToClient(IClientAPI remoteClient)
4903 { 4847 {
4904 if (ParentGroup == null || ParentGroup.IsDeleted) 4848 if (ParentGroup.IsDeleted)
4905 return; 4849 return;
4906 4850
4907 if (ParentGroup.IsAttachment && ParentGroup.RootPart != this) 4851 if (ParentGroup.IsAttachment && ParentGroup.RootPart != this)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 108089e..e40e57d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -112,15 +112,17 @@ namespace OpenSim.Region.Framework.Scenes
112 } 112 }
113 113
114 /// <summary> 114 /// <summary>
115 /// Reset UUIDs for all the items in the prim's inventory. This involves either generating 115 /// Reset UUIDs for all the items in the prim's inventory.
116 /// </summary>
117 /// <remarks>
118 /// This involves either generating
116 /// new ones or setting existing UUIDs to the correct parent UUIDs. 119 /// new ones or setting existing UUIDs to the correct parent UUIDs.
117 /// 120 ///
118 /// If this method is called and there are inventory items, then we regard the inventory as having changed. 121 /// If this method is called and there are inventory items, then we regard the inventory as having changed.
119 /// </summary> 122 /// </remarks>
120 /// <param name="linkNum">Link number for the part</param>
121 public void ResetInventoryIDs() 123 public void ResetInventoryIDs()
122 { 124 {
123 if (null == m_part || null == m_part.ParentGroup) 125 if (null == m_part)
124 return; 126 return;
125 127
126 lock (m_items) 128 lock (m_items)
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 997845b..e2ea830 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes
110 { 110 {
111 SceneObjectPart part = m_partsUpdateQueue.Dequeue(); 111 SceneObjectPart part = m_partsUpdateQueue.Dequeue();
112 112
113 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 113 if (part.ParentGroup.IsDeleted)
114 continue; 114 continue;
115 115
116 if (m_updateTimes.ContainsKey(part.UUID)) 116 if (m_updateTimes.ContainsKey(part.UUID))