aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
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/Scenes/SceneObjectPart.cs
parentFix a bug where the non-root parts of rezzed objects that had previously been... (diff)
downloadopensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.zip
opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.gz
opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.bz2
opensim-SC-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 '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs282
1 files changed, 113 insertions, 169 deletions
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)