diff options
author | Justin Clarke Casey | 2008-06-17 20:36:21 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-06-17 20:36:21 +0000 |
commit | 16d0a895cb817f96a55091fadbbd4cfb2d909204 (patch) | |
tree | 30c2c790f64284dbce988554b0bb0c1ae3417307 /OpenSim/Region/Environment/Scenes | |
parent | * refactor: Remove largely duplicate code from SceneXmlLoader.CreatePrimFromX... (diff) | |
download | opensim-SC_OLD-16d0a895cb817f96a55091fadbbd4cfb2d909204.zip opensim-SC_OLD-16d0a895cb817f96a55091fadbbd4cfb2d909204.tar.gz opensim-SC_OLD-16d0a895cb817f96a55091fadbbd4cfb2d909204.tar.bz2 opensim-SC_OLD-16d0a895cb817f96a55091fadbbd4cfb2d909204.tar.xz |
* Refactor: Move the responsibility for applying physics and sending the initial client update to Scene.AddSceneObject() from some of the SceneObjectGroup constructors
* I think this has been done cleanly from inspection and testing, but if prim creation or load suddenly starts playing up more than usual, please open a mantis
* This also has the effect of stopping the archiver generating ghost in-world prims
* Some code dupliction also removed
Diffstat (limited to '')
4 files changed, 15 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 9bbfc3d..e803122 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -197,15 +197,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
197 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 197 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
198 | { | 198 | { |
199 | part.LocalId = m_parentScene.PrimIDAllocate(); | 199 | part.LocalId = m_parentScene.PrimIDAllocate(); |
200 | |||
201 | } | 200 | } |
201 | |||
202 | sceneObject.UpdateParentIDs(); | 202 | sceneObject.UpdateParentIDs(); |
203 | 203 | ||
204 | AddSceneObject(sceneObject, true); | 204 | AddSceneObject(sceneObject, true); |
205 | } | 205 | } |
206 | 206 | ||
207 | /// <summary> | 207 | /// <summary> |
208 | /// Add an object to the scene. | 208 | /// Add an object to the scene. This will both update the scene, and send information about the |
209 | /// new object to all clients interested in the scene. | ||
209 | /// </summary> | 210 | /// </summary> |
210 | /// <param name="sceneObject"></param> | 211 | /// <param name="sceneObject"></param> |
211 | /// <param name="attachToBackup"> | 212 | /// <param name="attachToBackup"> |
@@ -216,6 +217,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | /// </returns> | 217 | /// </returns> |
217 | protected internal bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) | 218 | protected internal bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) |
218 | { | 219 | { |
220 | sceneObject.ApplyPhysics(m_parentScene.m_physicalPrim); | ||
221 | sceneObject.ScheduleGroupForFullUpdate(); | ||
222 | |||
219 | lock (Entities) | 223 | lock (Entities) |
220 | { | 224 | { |
221 | if (!Entities.ContainsKey(sceneObject.UUID)) | 225 | if (!Entities.ContainsKey(sceneObject.UUID)) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index ebc721f..ff62a3b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1499,7 +1499,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1499 | { | 1499 | { |
1500 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | 1500 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); |
1501 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 1501 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
1502 | if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count,remoteClient.AgentId, pos) && !attachment) | 1502 | if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count, remoteClient.AgentId, pos) && !attachment) |
1503 | { | 1503 | { |
1504 | return null; | 1504 | return null; |
1505 | } | 1505 | } |
@@ -1513,8 +1513,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1513 | if (!attachment) | 1513 | if (!attachment) |
1514 | { | 1514 | { |
1515 | pos = GetNewRezLocation( | 1515 | pos = GetNewRezLocation( |
1516 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), | 1516 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), |
1517 | BypassRayCast, bRayEndIsIntersection, true, group.GroupScale(), false); | 1517 | BypassRayCast, bRayEndIsIntersection, true, group.GroupScale(), false); |
1518 | group.AbsolutePosition = pos; | 1518 | group.AbsolutePosition = pos; |
1519 | } | 1519 | } |
1520 | else | 1520 | else |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b39e08d..7adfeca 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1460,7 +1460,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1460 | rootPart.ObjectFlags &= ~(uint)LLObject.ObjectFlags.Scripted; | 1460 | rootPart.ObjectFlags &= ~(uint)LLObject.ObjectFlags.Scripted; |
1461 | rootPart.TrimPermissions(); | 1461 | rootPart.TrimPermissions(); |
1462 | group.CheckSculptAndLoad(); | 1462 | group.CheckSculptAndLoad(); |
1463 | group.ApplyPhysics(m_physicalPrim); | ||
1464 | //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | 1463 | //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); |
1465 | } | 1464 | } |
1466 | 1465 | ||
@@ -1578,9 +1577,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1578 | 1577 | ||
1579 | public virtual SceneObjectGroup AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) | 1578 | public virtual SceneObjectGroup AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) |
1580 | { | 1579 | { |
1580 | //m_log.DebugFormat( | ||
1581 | // "[SCENE]: Scene.AddNewPrim() called for agent {0} in {1}", ownerID, RegionInfo.RegionName); | ||
1582 | |||
1581 | SceneObjectGroup sceneOb = | 1583 | SceneObjectGroup sceneOb = |
1582 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); | 1584 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); |
1583 | AddSceneObject(sceneOb, true); | 1585 | |
1584 | SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); | 1586 | SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); |
1585 | // if grass or tree, make phantom | 1587 | // if grass or tree, make phantom |
1586 | //rootPart.TrimPermissions(); | 1588 | //rootPart.TrimPermissions(); |
@@ -1591,9 +1593,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1591 | if (rootPart.Shape.PCode != (byte)PCode.Grass) | 1593 | if (rootPart.Shape.PCode != (byte)PCode.Grass) |
1592 | AdaptTree(ref shape); | 1594 | AdaptTree(ref shape); |
1593 | } | 1595 | } |
1594 | // if not phantom, add to physics | 1596 | |
1595 | sceneOb.ApplyPhysics(m_physicalPrim); | 1597 | AddSceneObject(sceneOb, true); |
1596 | m_innerScene.AddToUpdateList(sceneOb); | ||
1597 | 1598 | ||
1598 | return sceneOb; | 1599 | return sceneOb; |
1599 | } | 1600 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 877f196..f94830e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -350,10 +350,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
350 | SetPartAsRoot(part); | 350 | SetPartAsRoot(part); |
351 | 351 | ||
352 | RegionHandle = regionHandle; | 352 | RegionHandle = regionHandle; |
353 | |||
354 | ApplyPhysics(scene.m_physicalPrim); | ||
355 | |||
356 | ScheduleGroupForFullUpdate(); | ||
357 | } | 353 | } |
358 | 354 | ||
359 | /// <summary> | 355 | /// <summary> |
@@ -412,10 +408,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
412 | m_rootPart.ParentID = 0; | 408 | m_rootPart.ParentID = 0; |
413 | m_rootPart.RegionHandle = m_regionHandle; | 409 | m_rootPart.RegionHandle = m_regionHandle; |
414 | UpdateParentIDs(); | 410 | UpdateParentIDs(); |
415 | |||
416 | ApplyPhysics(scene.m_physicalPrim); | ||
417 | |||
418 | ScheduleGroupForFullUpdate(); | ||
419 | } | 411 | } |
420 | 412 | ||
421 | /// <summary> | 413 | /// <summary> |
@@ -854,7 +846,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
854 | if (part.UUID != m_rootPart.UUID) | 846 | if (part.UUID != m_rootPart.UUID) |
855 | { | 847 | { |
856 | part.ParentID = m_rootPart.LocalId; | 848 | part.ParentID = m_rootPart.LocalId; |
857 | |||
858 | } | 849 | } |
859 | } | 850 | } |
860 | } | 851 | } |