diff options
author | Justin Clarke Casey | 2008-06-17 17:23:00 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-06-17 17:23:00 +0000 |
commit | 33d32355a1712e53f402eab1aa4818712f6f5f2c (patch) | |
tree | 67196be9550d26bad6deeff5e485094dc8619e44 | |
parent | Update svn properties. (diff) | |
download | opensim-SC-33d32355a1712e53f402eab1aa4818712f6f5f2c.zip opensim-SC-33d32355a1712e53f402eab1aa4818712f6f5f2c.tar.gz opensim-SC-33d32355a1712e53f402eab1aa4818712f6f5f2c.tar.bz2 opensim-SC-33d32355a1712e53f402eab1aa4818712f6f5f2c.tar.xz |
* refactor: Remove largely duplicate code from SceneXmlLoader.CreatePrimFromXml2()
4 files changed, 18 insertions, 29 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index 69f1902..5591ddc 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | |||
@@ -195,33 +195,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
195 | { | 195 | { |
196 | SceneObjectGroup obj = new SceneObjectGroup(xmlData); | 196 | SceneObjectGroup obj = new SceneObjectGroup(xmlData); |
197 | 197 | ||
198 | LLVector3 receivedVelocity = obj.RootPart.Velocity; | ||
199 | //System.Console.WriteLine(obj.RootPart.Velocity.ToString()); | ||
200 | scene.AddSceneObjectFromStorage(obj); | 198 | scene.AddSceneObjectFromStorage(obj); |
201 | 199 | ||
202 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); | 200 | obj.ApplyPhysics(scene.m_physicalPrim); |
203 | bool UsePhysics = (((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) > 0) && | ||
204 | scene.m_physicalPrim); | ||
205 | if ((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Phantom) == 0) | ||
206 | { | ||
207 | rootPart.PhysActor = scene.PhysicsScene.AddPrimShape( | ||
208 | rootPart.Name, | ||
209 | rootPart.Shape, | ||
210 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | ||
211 | rootPart.AbsolutePosition.Z), | ||
212 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | ||
213 | new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | ||
214 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); | ||
215 | |||
216 | // to quote from SceneObjectPart: Basic | ||
217 | // Physics returns null.. joy joy joy. | ||
218 | if (rootPart.PhysActor != null) | ||
219 | { | ||
220 | rootPart.PhysActor.LocalID = rootPart.LocalId; | ||
221 | rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | ||
222 | } | ||
223 | rootPart.Velocity = receivedVelocity; | ||
224 | } | ||
225 | 201 | ||
226 | obj.ScheduleGroupForFullUpdate(); | 202 | obj.ScheduleGroupForFullUpdate(); |
227 | } | 203 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e274139..b39e08d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -79,7 +79,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
79 | private int m_timePhase = 24; | 79 | private int m_timePhase = 24; |
80 | 80 | ||
81 | private readonly Mutex updateLock; | 81 | private readonly Mutex updateLock; |
82 | |||
83 | /// <summary> | ||
84 | /// Are we applying physics to any of the prims in this scene? | ||
85 | /// </summary> | ||
82 | public bool m_physicalPrim; | 86 | public bool m_physicalPrim; |
87 | |||
83 | public bool m_seeIntoRegionFromNeighbor; | 88 | public bool m_seeIntoRegionFromNeighbor; |
84 | public int MaxUndoCount = 5; | 89 | public int MaxUndoCount = 5; |
85 | private int m_RestartTimerCounter; | 90 | private int m_RestartTimerCounter; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index f750200..877f196 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1052,6 +1052,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1052 | m_rootPart.ScheduleFullUpdate(); | 1052 | m_rootPart.ScheduleFullUpdate(); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | /// <summary> | ||
1056 | /// Apply physics to this group | ||
1057 | /// </summary> | ||
1058 | /// <param name="m_physicalPrim"></param> | ||
1055 | public void ApplyPhysics(bool m_physicalPrim) | 1059 | public void ApplyPhysics(bool m_physicalPrim) |
1056 | { | 1060 | { |
1057 | lock (m_parts) | 1061 | lock (m_parts) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 42df746..85351f4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -494,8 +494,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
494 | 494 | ||
495 | return m_velocity; | 495 | return m_velocity; |
496 | } | 496 | } |
497 | set { | 497 | |
498 | 498 | set | |
499 | { | ||
499 | m_velocity = value; | 500 | m_velocity = value; |
500 | if (PhysActor != null) | 501 | if (PhysActor != null) |
501 | { | 502 | { |
@@ -505,7 +506,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
505 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 506 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
506 | } | 507 | } |
507 | } | 508 | } |
508 | |||
509 | } | 509 | } |
510 | } | 510 | } |
511 | 511 | ||
@@ -913,9 +913,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
913 | return newobject; | 913 | return newobject; |
914 | } | 914 | } |
915 | 915 | ||
916 | /// <summary> | ||
917 | /// Apply physics to this part. | ||
918 | /// </summary> | ||
919 | /// <param name="rootObjectFlags"></param> | ||
920 | /// <param name="m_physicalPrim"></param> | ||
916 | public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) | 921 | public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) |
917 | { | 922 | { |
918 | |||
919 | bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); | 923 | bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); |
920 | bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); | 924 | bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); |
921 | 925 | ||