aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-17 20:36:21 +0000
committerJustin Clarke Casey2008-06-17 20:36:21 +0000
commit16d0a895cb817f96a55091fadbbd4cfb2d909204 (patch)
tree30c2c790f64284dbce988554b0bb0c1ae3417307 /OpenSim/Region/Environment/Modules
parent* refactor: Remove largely duplicate code from SceneXmlLoader.CreatePrimFromX... (diff)
downloadopensim-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 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs33
1 files changed, 1 insertions, 32 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index 5591ddc..db16601 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Scenes
45 { 45 {
46 XmlDocument doc = new XmlDocument(); 46 XmlDocument doc = new XmlDocument();
47 XmlNode rootNode; 47 XmlNode rootNode;
48 int primCount = 0; 48
49 if (fileName.StartsWith("http:") || File.Exists(fileName)) 49 if (fileName.StartsWith("http:") || File.Exists(fileName))
50 { 50 {
51 XmlTextReader reader = new XmlTextReader(fileName); 51 XmlTextReader reader = new XmlTextReader(fileName);
@@ -65,33 +65,6 @@ namespace OpenSim.Region.Environment.Scenes
65 //obj.RegenerateFullIDs(); 65 //obj.RegenerateFullIDs();
66 66
67 scene.AddSceneObject(obj, true); 67 scene.AddSceneObject(obj, true);
68
69 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
70 // Apply loadOffsets for load/import and move combinations
71 rootPart.GroupPosition = rootPart.AbsolutePosition + loadOffset;
72 bool UsePhysics = (((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) > 0) &&
73 scene.m_physicalPrim);
74 if ((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Phantom) == 0)
75 {
76 rootPart.PhysActor = scene.PhysicsScene.AddPrimShape(
77 rootPart.Name,
78 rootPart.Shape,
79 new PhysicsVector(rootPart.AbsolutePosition.X + loadOffset.X,
80 rootPart.AbsolutePosition.Y + loadOffset.Y,
81 rootPart.AbsolutePosition.Z + loadOffset.Z),
82 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
83 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
84 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
85
86 // to quote from SceneObjectPart: Basic
87 // Physics returns null.. joy joy joy.
88 if (rootPart.PhysActor != null)
89 {
90 rootPart.PhysActor.LocalID = rootPart.LocalId;
91 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
92 }
93 }
94 primCount++;
95 } 68 }
96 } 69 }
97 else 70 else
@@ -196,10 +169,6 @@ namespace OpenSim.Region.Environment.Scenes
196 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 169 SceneObjectGroup obj = new SceneObjectGroup(xmlData);
197 170
198 scene.AddSceneObjectFromStorage(obj); 171 scene.AddSceneObjectFromStorage(obj);
199
200 obj.ApplyPhysics(scene.m_physicalPrim);
201
202 obj.ScheduleGroupForFullUpdate();
203 } 172 }
204 173
205 public static void SavePrimsToXml2(Scene scene, string fileName) 174 public static void SavePrimsToXml2(Scene scene, string fileName)