diff options
author | Justin Clark-Casey (justincc) | 2011-09-01 01:22:28 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-01 01:22:28 +0100 |
commit | 095b3e5756bb3160b30c9c5670ba008fa13d2e66 (patch) | |
tree | 0052b92cf46d42d714740bb4c7404edbdbaea0de /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Fix a bug where the non-root parts of rezzed objects that had previously been... (diff) | |
download | opensim-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 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 82 |
1 files changed, 38 insertions, 44 deletions
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 | ||