diff options
Diffstat (limited to '')
5 files changed, 28 insertions, 63 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index aca82c3..508ddd4 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -784,10 +784,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
784 | /// <returns>null if no scene object group containing that prim is found</returns> | 784 | /// <returns>null if no scene object group containing that prim is found</returns> |
785 | private SceneObjectGroup GetGroupByPrim(uint localID) | 785 | private SceneObjectGroup GetGroupByPrim(uint localID) |
786 | { | 786 | { |
787 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); | ||
787 | List<EntityBase> EntityList = GetEntities(); | 788 | List<EntityBase> EntityList = GetEntities(); |
788 | |||
789 | foreach (EntityBase ent in EntityList) | 789 | foreach (EntityBase ent in EntityList) |
790 | { | 790 | { |
791 | //m_log.DebugFormat("Looking at entity {0}", ent.UUID); | ||
791 | if (ent is SceneObjectGroup) | 792 | if (ent is SceneObjectGroup) |
792 | { | 793 | { |
793 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) | 794 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) |
@@ -891,6 +892,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
891 | protected internal SceneObjectPart GetSceneObjectPart(UUID fullID) | 892 | protected internal SceneObjectPart GetSceneObjectPart(UUID fullID) |
892 | { | 893 | { |
893 | SceneObjectGroup group = GetGroupByPrim(fullID); | 894 | SceneObjectGroup group = GetGroupByPrim(fullID); |
895 | |||
894 | if (group != null) | 896 | if (group != null) |
895 | return group.GetChildPart(fullID); | 897 | return group.GetChildPart(fullID); |
896 | else | 898 | else |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f1c4c6c..7de6fd1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
164 | private Thread HeartbeatThread; | 164 | private Thread HeartbeatThread; |
165 | private volatile bool shuttingdown = false; | 165 | private volatile bool shuttingdown = false; |
166 | 166 | ||
167 | private object m_deleting_scene_object = new object(); | 167 | private object m_deleting_scene_object = new object(); |
168 | 168 | ||
169 | #endregion | 169 | #endregion |
170 | 170 | ||
@@ -4009,7 +4009,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
4009 | } | 4009 | } |
4010 | 4010 | ||
4011 | /// <summary> | 4011 | /// <summary> |
4012 | /// | 4012 | /// Get a prim via its local id |
4013 | /// </summary> | 4013 | /// </summary> |
4014 | /// <param name="localID"></param> | 4014 | /// <param name="localID"></param> |
4015 | /// <returns></returns> | 4015 | /// <returns></returns> |
@@ -4019,7 +4019,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
4019 | } | 4019 | } |
4020 | 4020 | ||
4021 | /// <summary> | 4021 | /// <summary> |
4022 | /// | 4022 | /// Get a prim via its UUID |
4023 | /// </summary> | 4023 | /// </summary> |
4024 | /// <param name="fullID"></param> | 4024 | /// <param name="fullID"></param> |
4025 | /// <returns></returns> | 4025 | /// <returns></returns> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 28fba65..39615c0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -507,9 +507,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
507 | public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) | 507 | public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) |
508 | { | 508 | { |
509 | Vector3 rootOffset = new Vector3(0, 0, 0); | 509 | Vector3 rootOffset = new Vector3(0, 0, 0); |
510 | SceneObjectPart newPart = new SceneObjectPart(this, ownerID, shape, pos, rot, rootOffset); | 510 | SceneObjectPart newPart = new SceneObjectPart(ownerID, shape, pos, rot, rootOffset); |
511 | newPart.LinkNum = 0; | 511 | newPart.LinkNum = 0; |
512 | m_parts.Add(newPart.UUID, newPart); | 512 | AddPart(newPart); |
513 | SetPartAsRoot(newPart); | 513 | SetPartAsRoot(newPart); |
514 | } | 514 | } |
515 | 515 | ||
@@ -904,7 +904,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
904 | try | 904 | try |
905 | { | 905 | { |
906 | m_parts.Add(part.UUID, part); | 906 | m_parts.Add(part.UUID, part); |
907 | |||
908 | } | 907 | } |
909 | catch (Exception e) | 908 | catch (Exception e) |
910 | { | 909 | { |
@@ -1757,10 +1756,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1757 | /// <returns>null if a child part with the local ID was not found</returns> | 1756 | /// <returns>null if a child part with the local ID was not found</returns> |
1758 | public SceneObjectPart GetChildPart(uint localID) | 1757 | public SceneObjectPart GetChildPart(uint localID) |
1759 | { | 1758 | { |
1759 | //m_log.DebugFormat("Entered looking for {0}", localID); | ||
1760 | lock (m_parts) | 1760 | lock (m_parts) |
1761 | { | 1761 | { |
1762 | foreach (SceneObjectPart part in m_parts.Values) | 1762 | foreach (SceneObjectPart part in m_parts.Values) |
1763 | { | 1763 | { |
1764 | //m_log.DebugFormat("Found {0}", part.LocalId); | ||
1764 | if (part.LocalId == localID) | 1765 | if (part.LocalId == localID) |
1765 | { | 1766 | { |
1766 | return part; | 1767 | return part; |
@@ -1795,10 +1796,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1795 | /// <returns></returns> | 1796 | /// <returns></returns> |
1796 | public bool HasChildPrim(uint localID) | 1797 | public bool HasChildPrim(uint localID) |
1797 | { | 1798 | { |
1799 | //m_log.DebugFormat("Entered HasChildPrim looking for {0}", localID); | ||
1798 | lock (m_parts) | 1800 | lock (m_parts) |
1799 | { | 1801 | { |
1800 | foreach (SceneObjectPart part in m_parts.Values) | 1802 | foreach (SceneObjectPart part in m_parts.Values) |
1801 | { | 1803 | { |
1804 | //m_log.DebugFormat("Found {0}", part.LocalId); | ||
1802 | if (part.LocalId == localID) | 1805 | if (part.LocalId == localID) |
1803 | { | 1806 | { |
1804 | return true; | 1807 | return true; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 3501224..4d54634 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -216,28 +216,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | Rezzed = DateTime.Now; | 216 | Rezzed = DateTime.Now; |
217 | } | 217 | } |
218 | 218 | ||
219 | public SceneObjectPart(SceneObjectGroup parent, UUID ownerID, | ||
220 | PrimitiveBaseShape shape, Vector3 groupPosition, Vector3 offsetPosition) | ||
221 | : this(parent, ownerID, shape, groupPosition, Quaternion.Identity, offsetPosition) | ||
222 | { | ||
223 | } | ||
224 | |||
225 | /// <summary> | 219 | /// <summary> |
226 | /// Create a completely new SceneObjectPart (prim) | 220 | /// Create a completely new SceneObjectPart (prim). This will need to be added separately to a SceneObjectGroup |
227 | /// </summary> | 221 | /// </summary> |
228 | /// <param name="regionHandle"></param> | ||
229 | /// <param name="parent"></param> | ||
230 | /// <param name="ownerID"></param> | 222 | /// <param name="ownerID"></param> |
231 | /// <param name="shape"></param> | 223 | /// <param name="shape"></param> |
232 | /// <param name="position"></param> | 224 | /// <param name="position"></param> |
233 | /// <param name="rotationOffset"></param> | 225 | /// <param name="rotationOffset"></param> |
234 | /// <param name="offsetPosition"></param> | 226 | /// <param name="offsetPosition"></param> |
235 | public SceneObjectPart( | 227 | public SceneObjectPart( |
236 | SceneObjectGroup parent, UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 228 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
237 | Quaternion rotationOffset, Vector3 offsetPosition) | 229 | Quaternion rotationOffset, Vector3 offsetPosition) |
238 | { | 230 | { |
239 | m_name = "Primitive"; | 231 | m_name = "Primitive"; |
240 | m_parentGroup = parent; | ||
241 | 232 | ||
242 | Rezzed = DateTime.Now; | 233 | Rezzed = DateTime.Now; |
243 | _creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 234 | _creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
@@ -273,49 +264,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
273 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); | 264 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); |
274 | } | 265 | } |
275 | 266 | ||
276 | /// <summary> | ||
277 | /// Re/create a SceneObjectPart (prim) | ||
278 | /// currently not used, and maybe won't be | ||
279 | /// </summary> | ||
280 | /// <param name="regionHandle"></param> | ||
281 | /// <param name="parent"></param> | ||
282 | /// <param name="ownerID"></param> | ||
283 | /// <param name="localID"></param> | ||
284 | /// <param name="shape"></param> | ||
285 | /// <param name="position"></param> | ||
286 | public SceneObjectPart(SceneObjectGroup parent, int creationDate, UUID ownerID, | ||
287 | UUID creatorID, UUID lastOwnerID, PrimitiveBaseShape shape, | ||
288 | Vector3 position, Quaternion rotation, uint flags) | ||
289 | { | ||
290 | m_parentGroup = parent; | ||
291 | TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); | ||
292 | _creationDate = creationDate; | ||
293 | _ownerID = ownerID; | ||
294 | _creatorID = creatorID; | ||
295 | _lastOwnerID = lastOwnerID; | ||
296 | UUID = UUID.Random(); | ||
297 | Shape = shape; | ||
298 | _ownershipCost = 0; | ||
299 | _objectSaleType = (byte) 0; | ||
300 | _salePrice = 0; | ||
301 | _category = (uint) 0; | ||
302 | _lastOwnerID = _creatorID; | ||
303 | OffsetPosition = position; | ||
304 | RotationOffset = rotation; | ||
305 | ObjectFlags = flags; | ||
306 | |||
307 | Rezzed = DateTime.Now; | ||
308 | |||
309 | m_TextureAnimation = new byte[0]; | ||
310 | m_particleSystem = new byte[0]; | ||
311 | // Since we don't store script state, this is only a 'temporary' objectflag now | ||
312 | // If the object is scripted, the script will get loaded and this will be set again | ||
313 | ObjectFlags &= ~(uint)(PrimFlags.Scripted | PrimFlags.Touch); | ||
314 | |||
315 | TrimPermissions(); | ||
316 | // ApplyPhysics(); | ||
317 | } | ||
318 | |||
319 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | 267 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) |
320 | { | 268 | { |
321 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); | 269 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); |
@@ -3056,7 +3004,6 @@ if (m_shape != null) { | |||
3056 | 3004 | ||
3057 | public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom) | 3005 | public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom) |
3058 | { | 3006 | { |
3059 | |||
3060 | bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0); | 3007 | bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0); |
3061 | bool wasTemporary = ((ObjectFlags & (uint)PrimFlags.TemporaryOnRez) != 0); | 3008 | bool wasTemporary = ((ObjectFlags & (uint)PrimFlags.TemporaryOnRez) != 0); |
3062 | bool wasPhantom = ((ObjectFlags & (uint)PrimFlags.Phantom) != 0); | 3009 | bool wasPhantom = ((ObjectFlags & (uint)PrimFlags.Phantom) != 0); |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs index 9d48802..4a038e2 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
@@ -74,9 +75,21 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
74 | = new Scene(regInfo, acm, cm, scs, null, sm, null, null, false, false, false, configSource, null); | 75 | = new Scene(regInfo, acm, cm, scs, null, sm, null, null, false, false, false, configSource, null); |
75 | 76 | ||
76 | SceneObjectGroup sceneObject = new SceneObjectGroup(); | 77 | SceneObjectGroup sceneObject = new SceneObjectGroup(); |
77 | new SceneObjectPart(sceneObject, UUID.Zero, null, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | 78 | SceneObjectPart part |
79 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | ||
80 | //part.UpdatePrimFlags(false, false, true); | ||
81 | part.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
82 | |||
83 | sceneObject.RootPart = part; | ||
84 | sceneObject.AddPart(part); | ||
78 | 85 | ||
79 | scene.AddNewSceneObject(sceneObject, false); | 86 | scene.AddNewSceneObject(sceneObject, false); |
87 | |||
88 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
89 | |||
90 | //System.Console.WriteLine("retrievedPart : {0}", retrievedPart); | ||
91 | // If the parts have the same UUID then we will consider them as one and the same | ||
92 | Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); | ||
80 | } | 93 | } |
81 | } | 94 | } |
82 | } \ No newline at end of file | 95 | } \ No newline at end of file |