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.
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-01 01:22:28 +01:00
parent 083ba72b28
commit 095b3e5756
16 changed files with 278 additions and 428 deletions

View File

@ -4756,10 +4756,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
SceneObjectPart part = (SceneObjectPart)entity; SceneObjectPart part = (SceneObjectPart)entity;
if (part.ParentGroup != null) attachPoint = part.ParentGroup.AttachmentPoint;
attachPoint = part.ParentGroup.AttachmentPoint;
else
attachPoint = 0;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}", // "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}",
@ -4921,7 +4918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//update.JointType = 0; //update.JointType = 0;
update.Material = data.Material; update.Material = data.Material;
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
if (data.ParentGroup != null && data.ParentGroup.IsAttachment) if (data.ParentGroup.IsAttachment)
{ {
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID); update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16)); update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));

View File

@ -851,41 +851,35 @@ namespace OpenSim.Region.CoreModules.World.Estate
SceneObjectPart prt = Scene.GetSceneObjectPart(obj); SceneObjectPart prt = Scene.GetSceneObjectPart(obj);
if (prt != null) if (prt != null)
{ {
if (prt.ParentGroup != null) SceneObjectGroup sog = prt.ParentGroup;
LandStatReportItem lsri = new LandStatReportItem();
lsri.LocationX = sog.AbsolutePosition.X;
lsri.LocationY = sog.AbsolutePosition.Y;
lsri.LocationZ = sog.AbsolutePosition.Z;
lsri.Score = SceneData[obj];
lsri.TaskID = sog.UUID;
lsri.TaskLocalID = sog.LocalId;
lsri.TaskName = sog.GetPartName(obj);
lsri.OwnerName = "waiting";
lock (uuidNameLookupList)
uuidNameLookupList.Add(sog.OwnerID);
if (filter.Length != 0)
{ {
SceneObjectGroup sog = prt.ParentGroup; if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
if (sog != null)
{ {
LandStatReportItem lsri = new LandStatReportItem(); }
lsri.LocationX = sog.AbsolutePosition.X; else
lsri.LocationY = sog.AbsolutePosition.Y; {
lsri.LocationZ = sog.AbsolutePosition.Z; continue;
lsri.Score = SceneData[obj];
lsri.TaskID = sog.UUID;
lsri.TaskLocalID = sog.LocalId;
lsri.TaskName = sog.GetPartName(obj);
lsri.OwnerName = "waiting";
lock (uuidNameLookupList)
uuidNameLookupList.Add(sog.OwnerID);
if (filter.Length != 0)
{
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
{
}
else
{
continue;
}
}
SceneReport.Add(lsri);
} }
} }
}
SceneReport.Add(lsri);
}
} }
} }
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
if (uuidNameLookupList.Count > 0) if (uuidNameLookupList.Count > 0)

View File

@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
{ {
SceneObjectPart part = m_scene.GetSceneObjectPart(localID); SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
if (part == null || part.ParentGroup == null) if (part == null)
return; return;
if (part.ParentGroup.IsDeleted) if (part.ParentGroup.IsDeleted)
@ -111,9 +111,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
if (part == null) if (part == null)
return false; return false;
if (part.ParentGroup == null)
return false;
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
switch (saleType) switch (saleType)

View File

@ -1131,7 +1131,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
SceneObjectPart part = scene.GetSceneObjectPart(objectID); SceneObjectPart part = scene.GetSceneObjectPart(objectID);
if (part.OwnerID != moverID) if (part.OwnerID != moverID)
{ {
if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) if (!part.ParentGroup.IsDeleted)
{ {
if (part.ParentGroup.IsAttachment) if (part.ParentGroup.IsAttachment)
return false; return false;

View File

@ -208,8 +208,7 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
{ {
SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
if (group != null) entityPos = group.AbsolutePosition;
entityPos = group.AbsolutePosition;
} }
// Use the camera position for local agents and avatar position for remote agents // Use the camera position for local agents and avatar position for remote agents

View File

@ -225,16 +225,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetSceneObjectPart(primId); SceneObjectPart part = GetSceneObjectPart(primId);
if (part == null) if (part == null)
return new ArrayList(); return new ArrayList();
SceneObjectGroup group = part.ParentGroup;
if (null == group)
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
itemId, primId);
return new ArrayList(); SceneObjectGroup group = part.ParentGroup;
}
// Retrieve item // Retrieve item
TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId);
@ -971,33 +963,23 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null) if (part == null)
return; return;
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
if (group != null) if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
return;
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
if (item == null)
return;
if (item.Type == 10)
{ {
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) part.RemoveScriptEvents(itemID);
return; EventManager.TriggerRemoveScript(localID, itemID);
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
if (item == null)
return;
if (item.Type == 10)
{
part.RemoveScriptEvents(itemID);
EventManager.TriggerRemoveScript(localID, itemID);
}
group.RemoveInventoryItem(localID, itemID);
part.GetProperties(remoteClient);
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Removal of item {0} requested of prim {1} but this prim does not exist",
itemID,
localID);
} }
group.RemoveInventoryItem(localID, itemID);
part.GetProperties(remoteClient);
} }
private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
@ -1770,7 +1752,7 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
// Already deleted by someone else // Already deleted by someone else
if (part.ParentGroup == null || part.ParentGroup.IsDeleted) if (part.ParentGroup.IsDeleted)
continue; continue;
// Can't delete child prims // Can't delete child prims
@ -2034,6 +2016,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null) if (part == null)
continue; continue;
if (!groups.Contains(part.ParentGroup)) if (!groups.Contains(part.ParentGroup))
groups.Add(part.ParentGroup); groups.Add(part.ParentGroup);
} }

View File

@ -3012,58 +3012,51 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z);
Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z);
if (target2.ParentGroup != null) pos = target2.AbsolutePosition;
//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());
// TODO: Raytrace better here
//EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection));
Ray NewRay = new Ray(AXOrigin, AXdirection);
// Ray Trace against target here
EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters);
// Un-comment out the following line to Get Raytrace results printed to the console.
//m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
float ScaleOffset = 0.5f;
// If we hit something
if (ei.HitTF)
{ {
pos = target2.AbsolutePosition; Vector3 scale = target.Scale;
//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()); Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z);
if (scaleComponent.X != 0) ScaleOffset = scale.X;
if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
ScaleOffset = Math.Abs(ScaleOffset);
Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z);
Vector3 offset = normal * (ScaleOffset / 2f);
pos = intersectionpoint + offset;
// TODO: Raytrace better here // stick in offset format from the original prim
pos = pos - target.ParentGroup.AbsolutePosition;
//EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); if (CopyRotates)
Ray NewRay = new Ray(AXOrigin, AXdirection);
// Ray Trace against target here
EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters);
// Un-comment out the following line to Get Raytrace results printed to the console.
//m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
float ScaleOffset = 0.5f;
// If we hit something
if (ei.HitTF)
{ {
Vector3 scale = target.Scale; Quaternion worldRot = target2.GetWorldRotation();
Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z);
if (scaleComponent.X != 0) ScaleOffset = scale.X;
if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
ScaleOffset = Math.Abs(ScaleOffset);
Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z);
Vector3 offset = normal * (ScaleOffset / 2f);
pos = intersectionpoint + offset;
// stick in offset format from the original prim // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
pos = pos - target.ParentGroup.AbsolutePosition; m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
if (CopyRotates) //obj.Rotation = worldRot;
{ //obj.UpdateGroupRotationR(worldRot);
Quaternion worldRot = target2.GetWorldRotation(); }
else
// SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); {
m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID);
//obj.Rotation = worldRot;
//obj.UpdateGroupRotationR(worldRot);
}
else
{
m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID);
}
} }
return;
} }
return;
} }
} }
@ -3233,12 +3226,13 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null) // It is a prim if (part != null) // It is a prim
{ {
if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid if (!part.ParentGroup.IsDeleted) // Valid
{ {
if (part.ParentGroup.RootPart != part) // Child part if (part.ParentGroup.RootPart != part) // Child part
return; return;
} }
} }
ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
} }

View File

@ -1630,27 +1630,18 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup parentGroup = root.ParentGroup; SceneObjectGroup parentGroup = root.ParentGroup;
List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
if (parentGroup != null)
{
// We do this in reverse to get the link order of the prims correct
for (int i = children.Count - 1; i >= 0; i--)
{
SceneObjectGroup child = children[i].ParentGroup;
if (child != null) // We do this in reverse to get the link order of the prims correct
{ for (int i = children.Count - 1; i >= 0; i--)
// Make sure no child prim is set for sale
// So that, on delink, no prims are unwittingly
// left for sale and sold off
child.RootPart.ObjectSaleType = 0;
child.RootPart.SalePrice = 10;
childGroups.Add(child);
}
}
}
else
{ {
return; // parent is null so not in this region SceneObjectGroup child = children[i].ParentGroup;
// Make sure no child prim is set for sale
// So that, on delink, no prims are unwittingly
// left for sale and sold off
child.RootPart.ObjectSaleType = 0;
child.RootPart.SalePrice = 10;
childGroups.Add(child);
} }
foreach (SceneObjectGroup child in childGroups) foreach (SceneObjectGroup child in childGroups)

View File

@ -302,7 +302,6 @@ namespace OpenSim.Region.Framework.Scenes
protected string m_name; protected string m_name;
protected Vector3 m_offsetPosition; protected Vector3 m_offsetPosition;
// FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
protected SceneObjectGroup m_parentGroup; protected SceneObjectGroup m_parentGroup;
protected byte[] m_particleSystem = Utils.EmptyBytes; protected byte[] m_particleSystem = Utils.EmptyBytes;
protected ulong m_regionHandle; protected ulong m_regionHandle;
@ -592,6 +591,7 @@ namespace OpenSim.Region.Framework.Scenes
set set
{ {
m_passTouches = value; m_passTouches = value;
if (ParentGroup != null) if (ParentGroup != null)
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
} }
@ -759,13 +759,10 @@ namespace OpenSim.Region.Framework.Scenes
// TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
if (m_sitTargetAvatar != UUID.Zero) if (m_sitTargetAvatar != UUID.Zero)
{ {
if (m_parentGroup != null) // TODO can there be a SOP without a SOG? ScenePresence avatar;
if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
{ {
ScenePresence avatar; avatar.ParentPosition = GetWorldPosition();
if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
{
avatar.ParentPosition = GetWorldPosition();
}
} }
} }
} }
@ -854,7 +851,9 @@ namespace OpenSim.Region.Framework.Scenes
actor.Orientation = resultingrotation; actor.Orientation = resultingrotation;
//m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
} }
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
if (m_parentGroup != null)
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
//} //}
} }
catch (Exception ex) catch (Exception ex)
@ -862,7 +861,6 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
} }
} }
} }
} }
@ -1018,7 +1016,7 @@ namespace OpenSim.Region.Framework.Scenes
m_shape.Scale = value; m_shape.Scale = value;
PhysicsActor actor = PhysActor; PhysicsActor actor = PhysActor;
if (actor != null && m_parentGroup != null) if (actor != null)
{ {
if (m_parentGroup.Scene != null) if (m_parentGroup.Scene != null)
{ {
@ -1107,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sitTargetOrientation = value; } set { m_sitTargetOrientation = value; }
} }
public Vector3 SitTargetPosition public Vector3 SitTargetPosition
{ {
get { return m_sitTargetPosition; } get { return m_sitTargetPosition; }
@ -1262,7 +1259,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
if (ParentGroup != null && ParentGroup.Scene != null) if (ParentGroup.Scene != null)
return ParentGroup.Scene.RegionInfo.RegionID; return ParentGroup.Scene.RegionInfo.RegionID;
else else
return UUID.Zero; return UUID.Zero;
@ -1277,15 +1274,14 @@ namespace OpenSim.Region.Framework.Scenes
get get
{ {
if (ParentGroup != null) if (ParentGroup != null)
{
_parentUUID = ParentGroup.UUID; _parentUUID = ParentGroup.UUID;
}
return _parentUUID; return _parentUUID;
} }
set { _parentUUID = value; } set { _parentUUID = value; }
} }
public string SitAnimation public string SitAnimation
{ {
get { return m_sitAnimation; } get { return m_sitAnimation; }
@ -1514,10 +1510,7 @@ namespace OpenSim.Region.Framework.Scenes
impulse = newimpulse; impulse = newimpulse;
} }
if (m_parentGroup != null) m_parentGroup.applyAngularImpulse(impulse);
{
m_parentGroup.applyAngularImpulse(impulse);
}
} }
/// <summary> /// <summary>
@ -1540,10 +1533,7 @@ namespace OpenSim.Region.Framework.Scenes
impulse = newimpulse; impulse = newimpulse;
} }
if (m_parentGroup != null) m_parentGroup.setAngularImpulse(impulse);
{
m_parentGroup.setAngularImpulse(impulse);
}
} }
public Vector3 GetTorque() public Vector3 GetTorque()
@ -1951,8 +1941,6 @@ namespace OpenSim.Region.Framework.Scenes
public bool GetDieAtEdge() public bool GetDieAtEdge()
{ {
if (m_parentGroup == null)
return false;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return false; return false;
@ -1961,8 +1949,6 @@ namespace OpenSim.Region.Framework.Scenes
public bool GetReturnAtEdge() public bool GetReturnAtEdge()
{ {
if (m_parentGroup == null)
return false;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return false; return false;
@ -1971,8 +1957,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SetReturnAtEdge(bool p) public void SetReturnAtEdge(bool p)
{ {
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return; return;
@ -1981,8 +1965,6 @@ namespace OpenSim.Region.Framework.Scenes
public bool GetBlockGrab() public bool GetBlockGrab()
{ {
if (m_parentGroup == null)
return false;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return false; return false;
@ -1991,8 +1973,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SetBlockGrab(bool p) public void SetBlockGrab(bool p)
{ {
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return; return;
@ -2001,8 +1981,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SetStatusSandbox(bool p) public void SetStatusSandbox(bool p)
{ {
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return; return;
StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition;
@ -2011,8 +1989,6 @@ namespace OpenSim.Region.Framework.Scenes
public bool GetStatusSandbox() public bool GetStatusSandbox()
{ {
if (m_parentGroup == null)
return false;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return false; return false;
@ -2090,11 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
public UUID GetRootPartUUID() public UUID GetRootPartUUID()
{ {
if (m_parentGroup != null) return m_parentGroup.UUID;
{
return m_parentGroup.UUID;
}
return UUID.Zero;
} }
/// <summary> /// <summary>
@ -2220,8 +2192,6 @@ namespace OpenSim.Region.Framework.Scenes
m_lastColliders.Remove(localID); m_lastColliders.Remove(localID);
} }
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return; return;
@ -2242,9 +2212,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (localId == 0) if (localId == 0)
continue; continue;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
@ -2253,7 +2220,8 @@ namespace OpenSim.Region.Framework.Scenes
string data = ""; string data = "";
if (obj != null) if (obj != null)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString())
|| m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{ {
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object //If it is 1, it is to accept ONLY collisions from this object
@ -2300,7 +2268,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
|| m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
{ {
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
//If it is 1, it is to accept ONLY collisions from this avatar //If it is 1, it is to accept ONLY collisions from this avatar
@ -2348,12 +2317,10 @@ namespace OpenSim.Region.Framework.Scenes
if (colliding.Count > 0) if (colliding.Count > 0)
{ {
StartCollidingMessage.Colliders = colliding; StartCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
if (m_parentGroup.PassCollision == true) if (m_parentGroup.PassCollision == true)
{ {
//TODO: Add pass to root prim! //TODO: Add pass to root prim!
@ -2375,9 +2342,6 @@ namespace OpenSim.Region.Framework.Scenes
if (localId == 0) if (localId == 0)
continue; continue;
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
@ -2385,7 +2349,8 @@ namespace OpenSim.Region.Framework.Scenes
string data = ""; string data = "";
if (obj != null) if (obj != null)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString())
|| m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{ {
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
//If it is 1, it is to accept ONLY collisions from this object //If it is 1, it is to accept ONLY collisions from this object
@ -2432,7 +2397,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
|| m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
{ {
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
//If it is 1, it is to accept ONLY collisions from this avatar //If it is 1, it is to accept ONLY collisions from this avatar
@ -2480,9 +2446,6 @@ namespace OpenSim.Region.Framework.Scenes
if (colliding.Count > 0) if (colliding.Count > 0)
{ {
CollidingMessage.Colliders = colliding; CollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
@ -2503,11 +2466,9 @@ namespace OpenSim.Region.Framework.Scenes
if (localId == 0) if (localId == 0)
continue; continue;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = ""; string data = "";
if (obj != null) if (obj != null)
@ -2559,7 +2520,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
|| m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
{ {
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
//If it is 1, it is to accept ONLY collisions from this avatar //If it is 1, it is to accept ONLY collisions from this avatar
@ -2608,9 +2570,6 @@ namespace OpenSim.Region.Framework.Scenes
if (colliding.Count > 0) if (colliding.Count > 0)
{ {
EndCollidingMessage.Colliders = colliding; EndCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
@ -2619,6 +2578,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
{ {
if (startedColliders.Count > 0) if (startedColliders.Count > 0)
@ -2646,9 +2606,6 @@ namespace OpenSim.Region.Framework.Scenes
if (colliding.Count > 0) if (colliding.Count > 0)
{ {
LandStartCollidingMessage.Colliders = colliding; LandStartCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
@ -2657,6 +2614,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
{ {
if (m_lastColliders.Count > 0) if (m_lastColliders.Count > 0)
@ -2684,9 +2642,6 @@ namespace OpenSim.Region.Framework.Scenes
if (colliding.Count > 0) if (colliding.Count > 0)
{ {
LandCollidingMessage.Colliders = colliding; LandCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
@ -2695,6 +2650,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
{ {
if (endedColliders.Count > 0) if (endedColliders.Count > 0)
@ -2722,9 +2678,6 @@ namespace OpenSim.Region.Framework.Scenes
if (colliding.Count > 0) if (colliding.Count > 0)
{ {
LandEndCollidingMessage.Colliders = colliding; LandEndCollidingMessage.Colliders = colliding;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null) if (m_parentGroup.Scene == null)
return; return;
@ -2748,10 +2701,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (PhysActor != null) if (PhysActor != null)
{ {
Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
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)) 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))
{ {
m_parentGroup.AbsolutePosition = newpos; m_parentGroup.AbsolutePosition = newpos;
return; return;
@ -2910,10 +2865,10 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId);
if (m_parentGroup != null) if (m_parentGroup == null)
{ return;
m_parentGroup.QueueForUpdateCheck();
} m_parentGroup.QueueForUpdateCheck();
int timeNow = Util.UnixTimeSinceEpoch(); int timeNow = Util.UnixTimeSinceEpoch();
@ -2942,13 +2897,14 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleTerseUpdate() public void ScheduleTerseUpdate()
{ {
if (m_parentGroup == null)
return;
if (m_updateFlag < 1) if (m_updateFlag < 1)
{ {
if (m_parentGroup != null) m_parentGroup.HasGroupChanged = true;
{ m_parentGroup.QueueForUpdateCheck();
m_parentGroup.HasGroupChanged = true;
m_parentGroup.QueueForUpdateCheck();
}
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 1; m_updateFlag = 1;
@ -2960,10 +2916,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ScriptSetPhysicsStatus(bool UsePhysics) public void ScriptSetPhysicsStatus(bool UsePhysics)
{ {
if (m_parentGroup == null) m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
DoPhysicsPropertyUpdate(UsePhysics, false);
else
m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
} }
/// <summary> /// <summary>
@ -3003,6 +2956,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="clientFlags"></param> /// <param name="clientFlags"></param>
protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
{ {
if (m_parentGroup == null)
return;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); // "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
@ -3028,6 +2984,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
{ {
if (m_parentGroup == null)
return;
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{ {
SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID));
@ -3040,6 +2999,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="agentID"></param> /// <param name="agentID"></param>
public void SendFullUpdateToAllClientsExcept(UUID agentID) public void SendFullUpdateToAllClientsExcept(UUID agentID)
{ {
if (m_parentGroup == null)
return;
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{ {
// Ugly reference :( // Ugly reference :(
@ -3068,6 +3030,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="clientFlags"></param> /// <param name="clientFlags"></param>
public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags) public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
{ {
if (ParentGroup == null)
return;
// Suppress full updates during attachment editing // Suppress full updates during attachment editing
// //
if (ParentGroup.IsSelected && ParentGroup.IsAttachment) if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
@ -3250,10 +3215,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SetAxisRotation(int axis, int rotate) public void SetAxisRotation(int axis, int rotate)
{ {
if (m_parentGroup != null) m_parentGroup.SetAxisRotation(axis, rotate);
{
m_parentGroup.SetAxisRotation(axis, rotate);
}
//Cannot use ScriptBaseClass constants as no referance to it currently. //Cannot use ScriptBaseClass constants as no referance to it currently.
if (axis == 2)//STATUS_ROTATE_X if (axis == 2)//STATUS_ROTATE_X
@ -3276,8 +3238,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SetDieAtEdge(bool p) public void SetDieAtEdge(bool p)
{ {
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)
return; return;
@ -3530,7 +3490,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// /// Set the parent group of this prim.
/// </summary> /// </summary>
public void SetParent(SceneObjectGroup parent) public void SetParent(SceneObjectGroup parent)
{ {
@ -3587,8 +3547,11 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Text = text; Text = text;
ParentGroup.HasGroupChanged = true; if (ParentGroup != null)
ScheduleFullUpdate(); {
ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate();
}
} }
public void StopLookAt() public void StopLookAt()
@ -3632,7 +3595,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (!IgnoreUndoUpdate) if (!IgnoreUndoUpdate)
{ {
if (m_parentGroup != null) if (ParentGroup != null)
{ {
lock (m_undo) lock (m_undo)
{ {
@ -3644,18 +3607,18 @@ namespace OpenSim.Region.Framework.Scenes
// TODO: May need to fix for group comparison // TODO: May need to fix for group comparison
if (last.Compare(this)) if (last.Compare(this))
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
// Name, LocalId, m_undo.Count); // Name, LocalId, m_undo.Count);
return; return;
} }
} }
} }
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
// Name, LocalId, forGroup, m_undo.Count); // Name, LocalId, forGroup, m_undo.Count);
if (m_parentGroup.GetSceneMaxUndo() > 0) if (m_parentGroup.GetSceneMaxUndo() > 0)
{ {
@ -3666,9 +3629,9 @@ namespace OpenSim.Region.Framework.Scenes
if (m_redo.Count > 0) if (m_redo.Count > 0)
m_redo.Clear(); m_redo.Clear();
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
// Name, LocalId, forGroup, m_undo.Count); // Name, LocalId, forGroup, m_undo.Count);
} }
} }
} }
@ -4245,8 +4208,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
ParentGroup.HasGroupChanged = true; if (ParentGroup != null)
ScheduleFullUpdate(); {
ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate();
}
} }
public void UpdateGroupPosition(Vector3 pos) public void UpdateGroupPosition(Vector3 pos)
@ -4450,14 +4416,12 @@ namespace OpenSim.Region.Framework.Scenes
if (!wasUsingPhysics) if (!wasUsingPhysics)
{ {
DoPhysicsPropertyUpdate(UsePhysics, false); DoPhysicsPropertyUpdate(UsePhysics, false);
if (m_parentGroup != null)
if (!m_parentGroup.IsDeleted)
{ {
if (!m_parentGroup.IsDeleted) if (LocalId == m_parentGroup.RootPart.LocalId)
{ {
if (LocalId == m_parentGroup.RootPart.LocalId) m_parentGroup.CheckSculptAndLoad();
{
m_parentGroup.CheckSculptAndLoad();
}
} }
} }
} }
@ -4510,14 +4474,11 @@ namespace OpenSim.Region.Framework.Scenes
PhysActor.SetMaterial(Material); PhysActor.SetMaterial(Material);
DoPhysicsPropertyUpdate(UsePhysics, true); DoPhysicsPropertyUpdate(UsePhysics, true);
if (m_parentGroup != null) if (!m_parentGroup.IsDeleted)
{ {
if (!m_parentGroup.IsDeleted) if (LocalId == m_parentGroup.RootPart.LocalId)
{ {
if (LocalId == m_parentGroup.RootPart.LocalId) m_parentGroup.CheckSculptAndLoad();
{
m_parentGroup.CheckSculptAndLoad();
}
} }
} }
@ -4541,14 +4502,12 @@ namespace OpenSim.Region.Framework.Scenes
pa.IsPhysical = UsePhysics; pa.IsPhysical = UsePhysics;
DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim
if (m_parentGroup != null)
if (!m_parentGroup.IsDeleted)
{ {
if (!m_parentGroup.IsDeleted) if (LocalId == m_parentGroup.RootPart.LocalId)
{ {
if (LocalId == m_parentGroup.RootPart.LocalId) m_parentGroup.CheckSculptAndLoad();
{
m_parentGroup.CheckSculptAndLoad();
}
} }
} }
} }
@ -4591,8 +4550,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
// m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
ParentGroup.HasGroupChanged = true; if (ParentGroup != null)
ScheduleFullUpdate(); {
ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate();
}
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
} }
@ -4605,8 +4567,12 @@ namespace OpenSim.Region.Framework.Scenes
(rot.W != RotationOffset.W)) (rot.W != RotationOffset.W))
{ {
RotationOffset = rot; RotationOffset = rot;
ParentGroup.HasGroupChanged = true;
ScheduleTerseUpdate(); if (ParentGroup != null)
{
ParentGroup.HasGroupChanged = true;
ScheduleTerseUpdate();
}
} }
} }
@ -4797,14 +4763,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
if (m_parentGroup == null)
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId);
ScheduleFullUpdate();
return;
}
//if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
//{ //{
// m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; // m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
@ -4830,36 +4788,22 @@ namespace OpenSim.Region.Framework.Scenes
public int registerTargetWaypoint(Vector3 target, float tolerance) public int registerTargetWaypoint(Vector3 target, float tolerance)
{ {
if (m_parentGroup != null) return m_parentGroup.registerTargetWaypoint(target, tolerance);
{
return m_parentGroup.registerTargetWaypoint(target, tolerance);
}
return 0;
} }
public void unregisterTargetWaypoint(int handle) public void unregisterTargetWaypoint(int handle)
{ {
if (m_parentGroup != null) m_parentGroup.unregisterTargetWaypoint(handle);
{
m_parentGroup.unregisterTargetWaypoint(handle);
}
} }
public int registerRotTargetWaypoint(Quaternion target, float tolerance) public int registerRotTargetWaypoint(Quaternion target, float tolerance)
{ {
if (m_parentGroup != null) return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
{
return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
}
return 0;
} }
public void unregisterRotTargetWaypoint(int handle) public void unregisterRotTargetWaypoint(int handle)
{ {
if (m_parentGroup != null) m_parentGroup.unregisterRotTargetWaypoint(handle);
{
m_parentGroup.unregisterRotTargetWaypoint(handle);
}
} }
public void SetCameraAtOffset(Vector3 v) public void SetCameraAtOffset(Vector3 v)
@ -4901,7 +4845,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendTerseUpdateToClient(IClientAPI remoteClient) public void SendTerseUpdateToClient(IClientAPI remoteClient)
{ {
if (ParentGroup == null || ParentGroup.IsDeleted) if (ParentGroup.IsDeleted)
return; return;
if (ParentGroup.IsAttachment && ParentGroup.RootPart != this) if (ParentGroup.IsAttachment && ParentGroup.RootPart != this)

View File

@ -112,15 +112,17 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// Reset UUIDs for all the items in the prim's inventory. This involves either generating /// Reset UUIDs for all the items in the prim's inventory.
/// </summary>
/// <remarks>
/// This involves either generating
/// new ones or setting existing UUIDs to the correct parent UUIDs. /// new ones or setting existing UUIDs to the correct parent UUIDs.
/// ///
/// If this method is called and there are inventory items, then we regard the inventory as having changed. /// If this method is called and there are inventory items, then we regard the inventory as having changed.
/// </summary> /// </remarks>
/// <param name="linkNum">Link number for the part</param>
public void ResetInventoryIDs() public void ResetInventoryIDs()
{ {
if (null == m_part || null == m_part.ParentGroup) if (null == m_part)
return; return;
lock (m_items) lock (m_items)

View File

@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectPart part = m_partsUpdateQueue.Dequeue(); SceneObjectPart part = m_partsUpdateQueue.Dequeue();
if (part.ParentGroup == null || part.ParentGroup.IsDeleted) if (part.ParentGroup.IsDeleted)
continue; continue;
if (m_updateTimes.ContainsKey(part.UUID)) if (m_updateTimes.ContainsKey(part.UUID))

View File

@ -234,35 +234,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (linkType) switch (linkType)
{ {
case ScriptBaseClass.LINK_SET: case ScriptBaseClass.LINK_SET:
if (m_host.ParentGroup != null) return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
{
return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
}
return ret;
case ScriptBaseClass.LINK_ROOT: case ScriptBaseClass.LINK_ROOT:
if (m_host.ParentGroup != null) ret = new List<SceneObjectPart>();
{ ret.Add(m_host.ParentGroup.RootPart);
ret = new List<SceneObjectPart>();
ret.Add(m_host.ParentGroup.RootPart);
return ret;
}
return ret; return ret;
case ScriptBaseClass.LINK_ALL_OTHERS: case ScriptBaseClass.LINK_ALL_OTHERS:
if (m_host.ParentGroup == null)
return new List<SceneObjectPart>();
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
if (ret.Contains(m_host)) if (ret.Contains(m_host))
ret.Remove(m_host); ret.Remove(m_host);
return ret; return ret;
case ScriptBaseClass.LINK_ALL_CHILDREN: case ScriptBaseClass.LINK_ALL_CHILDREN:
if (m_host.ParentGroup == null)
return new List<SceneObjectPart>();
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
if (ret.Contains(m_host.ParentGroup.RootPart)) if (ret.Contains(m_host.ParentGroup.RootPart))
@ -273,15 +260,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret; return ret;
default: default:
if (linkType < 0 || m_host.ParentGroup == null) if (linkType < 0)
return new List<SceneObjectPart>(); return new List<SceneObjectPart>();
SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType); SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType);
if (target == null) if (target == null)
return new List<SceneObjectPart>(); return new List<SceneObjectPart>();
ret = new List<SceneObjectPart>(); ret = new List<SceneObjectPart>();
ret.Add(target); ret.Add(target);
return ret; return ret;
} }
} }
@ -1199,8 +1186,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (value != 0) if (value != 0)
{ {
SceneObjectGroup group = m_host.ParentGroup; SceneObjectGroup group = m_host.ParentGroup;
if (group == null)
return;
bool allow = true; bool allow = true;
foreach (SceneObjectPart part in group.Parts) foreach (SceneObjectPart part in group.Parts)
@ -1214,16 +1199,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!allow) if (!allow)
return; return;
m_host.ScriptSetPhysicsStatus(true); m_host.ScriptSetPhysicsStatus(true);
} }
else else
{
m_host.ScriptSetPhysicsStatus(false); m_host.ScriptSetPhysicsStatus(false);
}
} }
if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM)
{ {
if (m_host.ParentGroup != null) m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
} }
if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS)
@ -1365,8 +1352,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void SetScale(SceneObjectPart part, LSL_Vector scale) protected void SetScale(SceneObjectPart part, LSL_Vector scale)
{ {
// TODO: this needs to trigger a persistance save as well // TODO: this needs to trigger a persistance save as well
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) if (part == null || part.ParentGroup.IsDeleted)
return; return;
if (scale.x < 0.01) if (scale.x < 0.01)
scale.x = 0.01; scale.x = 0.01;
if (scale.y < 0.01) if (scale.y < 0.01)
@ -1409,7 +1397,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
m_host.ClickAction = (byte)action; m_host.ClickAction = (byte)action;
if (m_host.ParentGroup != null) m_host.ParentGroup.HasGroupChanged = true; m_host.ParentGroup.HasGroupChanged = true;
m_host.ScheduleFullUpdate(); m_host.ScheduleFullUpdate();
return; return;
} }
@ -2033,14 +2021,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else else
{ {
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
SceneObjectGroup group = m_host.ParentGroup; SceneObjectPart rootPart = m_host.ParentGroup.RootPart;
if (group != null) // a bit paranoid, maybe if (rootPart != null) // better safe than sorry
{ {
SceneObjectPart rootPart = group.RootPart; SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
if (rootPart != null) // again, better safe than sorry
{
SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
}
} }
} }
@ -2128,15 +2112,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null) if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) if (local != 0)
{ force *= llGetRot();
if (local != 0)
force *= llGetRot();
m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
}
} }
} }
@ -2146,15 +2127,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null) if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
{ force.x = tmpForce.X;
Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); force.y = tmpForce.Y;
force.x = tmpForce.X; force.z = tmpForce.Z;
force.y = tmpForce.Y;
force.z = tmpForce.Z;
}
} }
return force; return force;
@ -3163,12 +3141,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetBuoyancy(double buoyancy) public void llSetBuoyancy(double buoyancy)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
{
m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
}
} }
} }
@ -6238,12 +6214,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetVehicleType(int type) public void llSetVehicleType(int type)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.RootPart.SetVehicleType(type);
{
m_host.ParentGroup.RootPart.SetVehicleType(type);
}
} }
} }
@ -6253,12 +6227,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null) if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
{
m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
}
} }
} }
@ -6267,13 +6238,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetVehicleVectorParam(int param, LSL_Vector vec) public void llSetVehicleVectorParam(int param, LSL_Vector vec)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
{ new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
}
} }
} }
@ -6282,37 +6251,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetVehicleRotationParam(int param, LSL_Rotation rot) public void llSetVehicleRotationParam(int param, LSL_Rotation rot)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot));
{
m_host.ParentGroup.RootPart.SetVehicleRotationParam(param,
Rot2Quaternion(rot));
}
} }
} }
public void llSetVehicleFlags(int flags) public void llSetVehicleFlags(int flags)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
{
m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
}
} }
} }
public void llRemoveVehicleFlags(int flags) public void llRemoveVehicleFlags(int flags)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
if (!m_host.ParentGroup.IsDeleted)
{ {
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
{
m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
}
} }
} }
@ -6467,11 +6429,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llVolumeDetect(int detect) public void llVolumeDetect(int detect)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
{ if (!m_host.ParentGroup.IsDeleted)
if (!m_host.ParentGroup.IsDeleted) m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
}
} }
/// <summary> /// <summary>
@ -7022,14 +6982,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else else
{ {
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
SceneObjectGroup group = part.ParentGroup; SceneObjectPart rootPart = part.ParentGroup.RootPart;
if (group != null) // a bit paranoid, maybe if (rootPart != null) // better safe than sorry
{ {
SceneObjectPart rootPart = group.RootPart; SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
if (rootPart != null) // again, better safe than sorry
{
SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
}
} }
} }
@ -7278,13 +7234,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break; break;
case (int)ScriptBaseClass.PRIM_PHANTOM: case (int)ScriptBaseClass.PRIM_PHANTOM:
if (remain < 1) if (remain < 1)
return; return;
string ph = rules.Data[idx++].ToString(); string ph = rules.Data[idx++].ToString();
m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
if (m_host.ParentGroup != null)
m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
break; break;
@ -7307,8 +7261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
string temp = rules.Data[idx++].ToString(); string temp = rules.Data[idx++].ToString();
if (m_host.ParentGroup != null) m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
break; break;

View File

@ -672,13 +672,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup != null)
{ if (m_host.ParentGroup.RootPart != null)
if (m_host.ParentGroup.RootPart != null) m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
{
m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
}
}
} }
// Teleport functions // Teleport functions

View File

@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
return; return;
} }
part=part.ParentGroup.RootPart; // We detect objects only part = part.ParentGroup.RootPart; // We detect objects only
LinkNum = 0; // Not relevant LinkNum = 0; // Not relevant

View File

@ -766,13 +766,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
{ {
m_InSelfDelete = true; m_InSelfDelete = true;
if (part != null && part.ParentGroup != null) if (part != null)
m_Engine.World.DeleteSceneObject(part.ParentGroup, false); m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
} }
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
{ {
m_InSelfDelete = true; m_InSelfDelete = true;
if (part != null && part.ParentGroup != null) if (part != null)
part.Inventory.RemoveInventoryItem(m_ItemID); part.Inventory.RemoveInventoryItem(m_ItemID);
} }
} }

View File

@ -97,8 +97,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return; return;
m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount); m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount);
if (part.ParentGroup != null)
part = part.ParentGroup.RootPart; part = part.ParentGroup.RootPart;
if (part != null) if (part != null)
{ {