diff options
author | Melanie | 2012-02-19 14:20:53 +0100 |
---|---|---|
committer | Melanie | 2012-02-19 14:20:53 +0100 |
commit | 185bf55804af69390f54650f238d126614062e87 (patch) | |
tree | 3371a66f758745ae0694f8199054c3fa3d8548e6 /OpenSim/Region/Framework/Scenes | |
parent | Now if chode prim.cs detects out of bounds it requests a update and blocks mo... (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.zip opensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.tar.gz opensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.tar.bz2 opensim-SC_OLD-185bf55804af69390f54650f238d126614062e87.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
8 files changed, 199 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 57db4d6..9fcd5fe 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -177,6 +177,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
177 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); | 177 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); |
178 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; | 178 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; |
179 | 179 | ||
180 | public delegate void AvatarAppearanceChange(ScenePresence avatar); | ||
181 | public event AvatarAppearanceChange OnAvatarAppearanceChange; | ||
182 | |||
180 | public event Action<ScenePresence> OnSignificantClientMovement; | 183 | public event Action<ScenePresence> OnSignificantClientMovement; |
181 | 184 | ||
182 | public delegate void IncomingInstantMessage(GridInstantMessage message); | 185 | public delegate void IncomingInstantMessage(GridInstantMessage message); |
@@ -188,10 +191,62 @@ namespace OpenSim.Region.Framework.Scenes | |||
188 | 191 | ||
189 | public event ClientClosed OnClientClosed; | 192 | public event ClientClosed OnClientClosed; |
190 | 193 | ||
194 | // Fired when a script is created | ||
195 | // The indication that a new script exists in this region. | ||
196 | public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); | ||
197 | public event NewScript OnNewScript; | ||
198 | public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) | ||
199 | { | ||
200 | NewScript handlerNewScript = OnNewScript; | ||
201 | if (handlerNewScript != null) | ||
202 | { | ||
203 | foreach (NewScript d in handlerNewScript.GetInvocationList()) | ||
204 | { | ||
205 | try | ||
206 | { | ||
207 | d(clientID, part, itemID); | ||
208 | } | ||
209 | catch (Exception e) | ||
210 | { | ||
211 | m_log.ErrorFormat( | ||
212 | "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}", | ||
213 | e.Message, e.StackTrace); | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | } | ||
218 | |||
219 | //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset | ||
220 | // An indication that the script has changed. | ||
221 | public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); | ||
222 | public event UpdateScript OnUpdateScript; | ||
223 | public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) | ||
224 | { | ||
225 | UpdateScript handlerUpdateScript = OnUpdateScript; | ||
226 | if (handlerUpdateScript != null) | ||
227 | { | ||
228 | foreach (UpdateScript d in handlerUpdateScript.GetInvocationList()) | ||
229 | { | ||
230 | try | ||
231 | { | ||
232 | d(clientId, itemId, primId, isScriptRunning, newAssetID); | ||
233 | } | ||
234 | catch (Exception e) | ||
235 | { | ||
236 | m_log.ErrorFormat( | ||
237 | "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}", | ||
238 | e.Message, e.StackTrace); | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | |||
191 | /// <summary> | 244 | /// <summary> |
192 | /// This is fired when a scene object property that a script might be interested in (such as color, scale or | 245 | /// ScriptChangedEvent is fired when a scene object property that a script might be interested |
193 | /// inventory) changes. Only enough information is sent for the LSL changed event | 246 | /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. |
194 | /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed) | 247 | /// This is not an indication that the script has changed (see OnUpdateScript for that). |
248 | /// This event is sent to a script to tell it that some property changed on | ||
249 | /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . | ||
195 | /// </summary> | 250 | /// </summary> |
196 | public event ScriptChangedEvent OnScriptChangedEvent; | 251 | public event ScriptChangedEvent OnScriptChangedEvent; |
197 | public delegate void ScriptChangedEvent(uint localID, uint change); | 252 | public delegate void ScriptChangedEvent(uint localID, uint change); |
@@ -1262,6 +1317,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1262 | } | 1317 | } |
1263 | } | 1318 | } |
1264 | 1319 | ||
1320 | public void TriggerAvatarAppearanceChanged(ScenePresence avatar) | ||
1321 | { | ||
1322 | AvatarAppearanceChange handler = OnAvatarAppearanceChange; | ||
1323 | if (handler != null) | ||
1324 | { | ||
1325 | foreach (AvatarAppearanceChange d in handler.GetInvocationList()) | ||
1326 | { | ||
1327 | try | ||
1328 | { | ||
1329 | d(avatar); | ||
1330 | } | ||
1331 | catch (Exception e) | ||
1332 | { | ||
1333 | m_log.ErrorFormat( | ||
1334 | "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}", | ||
1335 | e.Message, e.StackTrace); | ||
1336 | } | ||
1337 | } | ||
1338 | } | ||
1339 | } | ||
1340 | |||
1265 | public void TriggerIncomingInstantMessage(GridInstantMessage message) | 1341 | public void TriggerIncomingInstantMessage(GridInstantMessage message) |
1266 | { | 1342 | { |
1267 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; | 1343 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index fff39fb..e7a3b42 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
265 | // | 265 | // |
266 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); | 266 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); |
267 | } | 267 | } |
268 | |||
269 | // Tell anyone managing scripts that a script has been reloaded/changed | ||
270 | EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID); | ||
271 | |||
268 | part.ParentGroup.ResumeScripts(); | 272 | part.ParentGroup.ResumeScripts(); |
269 | return errors; | 273 | return errors; |
270 | } | 274 | } |
@@ -1643,9 +1647,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1643 | // have state in inventory | 1647 | // have state in inventory |
1644 | part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); | 1648 | part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); |
1645 | 1649 | ||
1650 | // tell anyone watching that there is a new script in town | ||
1651 | EventManager.TriggerNewScript(agentID, part, copyID); | ||
1652 | |||
1646 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 1653 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
1647 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 1654 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
1648 | // item.inventoryName, localID, remoteClient.Name); | 1655 | // item.inventoryName, localID, remoteClient.Name); |
1656 | |||
1649 | part.ParentGroup.ResumeScripts(); | 1657 | part.ParentGroup.ResumeScripts(); |
1650 | 1658 | ||
1651 | return part; | 1659 | return part; |
@@ -1726,6 +1734,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1726 | 1734 | ||
1727 | part.Inventory.AddInventoryItem(taskItem, false); | 1735 | part.Inventory.AddInventoryItem(taskItem, false); |
1728 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); | 1736 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); |
1737 | |||
1738 | // tell anyone managing scripts that a new script exists | ||
1739 | EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); | ||
1740 | |||
1729 | part.ParentGroup.ResumeScripts(); | 1741 | part.ParentGroup.ResumeScripts(); |
1730 | 1742 | ||
1731 | return part; | 1743 | return part; |
@@ -1954,7 +1966,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1954 | permissionToTake = true; | 1966 | permissionToTake = true; |
1955 | permissionToDelete = true; | 1967 | permissionToDelete = true; |
1956 | 1968 | ||
1957 | AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); | 1969 | AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); |
1958 | } | 1970 | } |
1959 | } | 1971 | } |
1960 | else // Auto return passes through here with null agent | 1972 | else // Auto return passes through here with null agent |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bbdf35d..7b1ef40 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3397,6 +3397,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3397 | { | 3397 | { |
3398 | bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || | 3398 | bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || |
3399 | (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); | 3399 | (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); |
3400 | bool viahome = ((teleportFlags & (uint)Constants.TeleportFlags.ViaHome) != 0); | ||
3401 | bool godlike = ((teleportFlags & (uint)Constants.TeleportFlags.Godlike) != 0); | ||
3402 | |||
3400 | reason = String.Empty; | 3403 | reason = String.Empty; |
3401 | 3404 | ||
3402 | //Teleport flags: | 3405 | //Teleport flags: |
@@ -3571,6 +3574,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3571 | agent.startpos.Z = 720; | 3574 | agent.startpos.Z = 720; |
3572 | } | 3575 | } |
3573 | } | 3576 | } |
3577 | |||
3578 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags | ||
3579 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && | ||
3580 | RegionInfo.EstateSettings.AllowDirectTeleport == false && | ||
3581 | !viahome && !godlike) | ||
3582 | { | ||
3583 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | ||
3584 | // Can have multiple SpawnPoints | ||
3585 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); | ||
3586 | if ( spawnpoints.Count > 1) | ||
3587 | { | ||
3588 | // We have multiple SpawnPoints, Route the agent to a random one | ||
3589 | agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
3590 | } | ||
3591 | else | ||
3592 | { | ||
3593 | // We have a single SpawnPoint and will route the agent to it | ||
3594 | agent.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
3595 | } | ||
3596 | |||
3597 | return true; | ||
3598 | } | ||
3599 | |||
3574 | // Honor parcel landing type and position. | 3600 | // Honor parcel landing type and position. |
3575 | /* | 3601 | /* |
3576 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3602 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 6dd42dd..5a7f124 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -406,7 +406,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
406 | m_log.ErrorFormat( | 406 | m_log.ErrorFormat( |
407 | "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", | 407 | "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", |
408 | sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); | 408 | sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); |
409 | 409 | ||
410 | return false; | 410 | return false; |
411 | } | 411 | } |
412 | 412 | ||
@@ -415,12 +415,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
415 | // m_log.DebugFormat( | 415 | // m_log.DebugFormat( |
416 | // "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", | 416 | // "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", |
417 | // m_parentScene.RegionInfo.RegionName, sceneObject.UUID); | 417 | // m_parentScene.RegionInfo.RegionName, sceneObject.UUID); |
418 | 418 | ||
419 | return false; | 419 | return false; |
420 | } | 420 | } |
421 | 421 | ||
422 | // m_log.DebugFormat( | 422 | // m_log.DebugFormat( |
423 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", | 423 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", |
424 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); | 424 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); |
425 | 425 | ||
426 | SceneObjectPart[] parts = sceneObject.Parts; | 426 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -456,7 +456,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
456 | 456 | ||
457 | lock (SceneObjectGroupsByFullID) | 457 | lock (SceneObjectGroupsByFullID) |
458 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 458 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
459 | 459 | ||
460 | lock (SceneObjectGroupsByFullPartID) | 460 | lock (SceneObjectGroupsByFullPartID) |
461 | { | 461 | { |
462 | foreach (SceneObjectPart part in parts) | 462 | foreach (SceneObjectPart part in parts) |
@@ -1678,7 +1678,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1678 | 1678 | ||
1679 | if (group != null) | 1679 | if (group != null) |
1680 | { | 1680 | { |
1681 | if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID)) | 1681 | if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID)) |
1682 | { | 1682 | { |
1683 | group.UpdateExtraParam(primLocalID, type, inUse, data); | 1683 | group.UpdateExtraParam(primLocalID, type, inUse, data); |
1684 | } | 1684 | } |
@@ -1695,7 +1695,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1695 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1695 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1696 | if (group != null) | 1696 | if (group != null) |
1697 | { | 1697 | { |
1698 | if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID)) | 1698 | if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID)) |
1699 | { | 1699 | { |
1700 | ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); | 1700 | ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); |
1701 | shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; | 1701 | shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e7c6ee8..cbd45c3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1764,7 +1764,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1764 | m_log.DebugFormat( | 1764 | m_log.DebugFormat( |
1765 | "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", | 1765 | "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", |
1766 | RootPart.UUID); | 1766 | RootPart.UUID); |
1767 | m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn"); | 1767 | m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); |
1768 | m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, | 1768 | m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, |
1769 | DeRezAction.Return, UUID.Zero); | 1769 | DeRezAction.Return, UUID.Zero); |
1770 | 1770 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f9e61be..d6d04b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -314,6 +314,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
314 | 314 | ||
315 | // ~SceneObjectPart() | 315 | // ~SceneObjectPart() |
316 | // { | 316 | // { |
317 | // Console.WriteLine( | ||
318 | // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", | ||
319 | // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); | ||
317 | // m_log.DebugFormat( | 320 | // m_log.DebugFormat( |
318 | // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", | 321 | // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", |
319 | // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); | 322 | // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); |
@@ -1601,9 +1604,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1601 | dupe.GroupPosition = GroupPosition; | 1604 | dupe.GroupPosition = GroupPosition; |
1602 | dupe.OffsetPosition = OffsetPosition; | 1605 | dupe.OffsetPosition = OffsetPosition; |
1603 | dupe.RotationOffset = RotationOffset; | 1606 | dupe.RotationOffset = RotationOffset; |
1604 | dupe.Velocity = new Vector3(0, 0, 0); | 1607 | dupe.Velocity = Velocity; |
1605 | dupe.Acceleration = new Vector3(0, 0, 0); | 1608 | dupe.Acceleration = Acceleration; |
1606 | dupe.AngularVelocity = new Vector3(0, 0, 0); | 1609 | dupe.AngularVelocity = AngularVelocity; |
1607 | dupe.Flags = Flags; | 1610 | dupe.Flags = Flags; |
1608 | 1611 | ||
1609 | dupe.OwnershipCost = OwnershipCost; | 1612 | dupe.OwnershipCost = OwnershipCost; |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 4b80e37..19cb9fb 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Linq; | ||
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using System.Xml; | 34 | using System.Xml; |
34 | using log4net; | 35 | using log4net; |
@@ -573,13 +574,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
573 | 574 | ||
574 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 575 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
575 | { | 576 | { |
576 | bool errors = false; | 577 | List<string> errorNodeNames; |
577 | obj.Shape = ReadShape(reader, "Shape", out errors); | 578 | obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); |
578 | 579 | ||
579 | if (errors) | 580 | if (errorNodeNames != null) |
581 | { | ||
580 | m_log.DebugFormat( | 582 | m_log.DebugFormat( |
581 | "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.", | 583 | "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors in properties {2}.", |
582 | obj.Name, obj.UUID); | 584 | obj.Name, obj.UUID, string.Join(", ", errorNodeNames.ToArray())); |
585 | } | ||
583 | } | 586 | } |
584 | 587 | ||
585 | private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) | 588 | private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) |
@@ -1529,31 +1532,44 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1529 | /// </summary> | 1532 | /// </summary> |
1530 | /// <param name="reader"></param> | 1533 | /// <param name="reader"></param> |
1531 | /// <param name="name">The name of the xml element containing the shape</param> | 1534 | /// <param name="name">The name of the xml element containing the shape</param> |
1532 | /// <param name="errors">true if any errors were encountered during parsing, false otherwise</param> | 1535 | /// <param name="errors">a list containing the failing node names. If no failures then null.</param> |
1533 | /// <returns>The shape parsed</returns> | 1536 | /// <returns>The shape parsed</returns> |
1534 | public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) | 1537 | public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames) |
1535 | { | 1538 | { |
1536 | errors = false; | 1539 | List<string> internalErrorNodeNames = null; |
1537 | 1540 | ||
1538 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); | 1541 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); |
1539 | 1542 | ||
1543 | if (reader.IsEmptyElement) | ||
1544 | { | ||
1545 | reader.Read(); | ||
1546 | errorNodeNames = null; | ||
1547 | return shape; | ||
1548 | } | ||
1549 | |||
1540 | reader.ReadStartElement(name, String.Empty); // Shape | 1550 | reader.ReadStartElement(name, String.Empty); // Shape |
1541 | 1551 | ||
1542 | errors = ExternalRepresentationUtils.ExecuteReadProcessors( | 1552 | ExternalRepresentationUtils.ExecuteReadProcessors( |
1543 | shape, | 1553 | shape, |
1544 | m_ShapeXmlProcessors, | 1554 | m_ShapeXmlProcessors, |
1545 | reader, | 1555 | reader, |
1546 | (o, nodeName, e) | 1556 | (o, nodeName, e) |
1547 | => | 1557 | => |
1548 | { | 1558 | { |
1549 | m_log.DebugFormat( | 1559 | // m_log.DebugFormat( |
1550 | "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", | 1560 | // "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", |
1551 | nodeName, e.Message, e.StackTrace); | 1561 | // nodeName, e.Message, e.StackTrace); |
1562 | if (internalErrorNodeNames == null) | ||
1563 | internalErrorNodeNames = new List<string>(); | ||
1564 | |||
1565 | internalErrorNodeNames.Add(nodeName); | ||
1552 | } | 1566 | } |
1553 | ); | 1567 | ); |
1554 | 1568 | ||
1555 | reader.ReadEndElement(); // Shape | 1569 | reader.ReadEndElement(); // Shape |
1556 | 1570 | ||
1571 | errorNodeNames = internalErrorNodeNames; | ||
1572 | |||
1557 | return shape; | 1573 | return shape; |
1558 | } | 1574 | } |
1559 | 1575 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 80f198d..7737d8e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Threading; | ||
30 | using NUnit.Framework; | 31 | using NUnit.Framework; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -43,6 +44,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
43 | [TestFixture] | 44 | [TestFixture] |
44 | public class SceneObjectBasicTests | 45 | public class SceneObjectBasicTests |
45 | { | 46 | { |
47 | // [TearDown] | ||
48 | // public void TearDown() | ||
49 | // { | ||
50 | // Console.WriteLine("TearDown"); | ||
51 | // GC.Collect(); | ||
52 | // Thread.Sleep(3000); | ||
53 | // } | ||
54 | |||
55 | // public class GcNotify | ||
56 | // { | ||
57 | // public static AutoResetEvent gcEvent = new AutoResetEvent(false); | ||
58 | // private static bool _initialized = false; | ||
59 | // | ||
60 | // public static void Initialize() | ||
61 | // { | ||
62 | // if (!_initialized) | ||
63 | // { | ||
64 | // _initialized = true; | ||
65 | // new GcNotify(); | ||
66 | // } | ||
67 | // } | ||
68 | // | ||
69 | // private GcNotify(){} | ||
70 | // | ||
71 | // ~GcNotify() | ||
72 | // { | ||
73 | // if (!Environment.HasShutdownStarted && | ||
74 | // !AppDomain.CurrentDomain.IsFinalizingForUnload()) | ||
75 | // { | ||
76 | // Console.WriteLine("GcNotify called"); | ||
77 | // gcEvent.Set(); | ||
78 | // new GcNotify(); | ||
79 | // } | ||
80 | // } | ||
81 | // } | ||
82 | |||
46 | /// <summary> | 83 | /// <summary> |
47 | /// Test adding an object to a scene. | 84 | /// Test adding an object to a scene. |
48 | /// </summary> | 85 | /// </summary> |
@@ -147,11 +184,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
147 | public void TestDeleteSceneObject() | 184 | public void TestDeleteSceneObject() |
148 | { | 185 | { |
149 | TestHelpers.InMethod(); | 186 | TestHelpers.InMethod(); |
150 | 187 | ||
151 | TestScene scene = SceneHelpers.SetupScene(); | 188 | TestScene scene = SceneHelpers.SetupScene(); |
152 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
153 | scene.DeleteSceneObject(part.ParentGroup, false); | 190 | scene.DeleteSceneObject(part.ParentGroup, false); |
154 | 191 | ||
155 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 192 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
156 | Assert.That(retrievedPart, Is.Null); | 193 | Assert.That(retrievedPart, Is.Null); |
157 | } | 194 | } |