From e0887944a0fe1fa6d695a3dd7ca536ede9968de2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Nov 2011 17:47:30 +0000 Subject: Remove unused PhysicsActor.SOPDescription --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4e79311..d2b4fb2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -909,15 +909,7 @@ namespace OpenSim.Region.Framework.Scenes public string Description { get { return m_description; } - set - { - m_description = value; - PhysicsActor actor = PhysActor; - if (actor != null) - { - actor.SOPDescription = value; - } - } + set { m_description = value; } } /// @@ -1543,8 +1535,7 @@ namespace OpenSim.Region.Framework.Scenes // Basic Physics returns null.. joy joy joy. if (PhysActor != null) { - PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info - PhysActor.SOPDescription = this.Description; + PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info PhysActor.SetMaterial(Material); DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); -- cgit v1.1 From 58a114787096df901d7d8dbf1370089771f91cf3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Nov 2011 17:51:38 +0000 Subject: refactor: Make SOP.Description an automatic property --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d2b4fb2..b97efc4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -242,7 +242,6 @@ namespace OpenSim.Region.Framework.Scenes private byte[] m_TextureAnimation; private byte m_clickAction; private Color m_color = Color.Black; - private string m_description = String.Empty; private readonly List m_lastColliders = new List(); private int m_linkNum; @@ -323,6 +322,7 @@ namespace OpenSim.Region.Framework.Scenes m_TextureAnimation = Utils.EmptyBytes; m_particleSystem = Utils.EmptyBytes; Rezzed = DateTime.UtcNow; + Description = String.Empty; m_inventory = new SceneObjectPartInventory(this); } @@ -342,6 +342,7 @@ namespace OpenSim.Region.Framework.Scenes m_name = "Primitive"; Rezzed = DateTime.UtcNow; + Description = String.Empty; CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed); LastOwnerID = CreatorID = OwnerID = ownerID; UUID = UUID.Random(); @@ -906,11 +907,7 @@ namespace OpenSim.Region.Framework.Scenes set { m_acceleration = value; } } - public string Description - { - get { return m_description; } - set { m_description = value; } - } + public string Description { get; set; } /// /// Text color. -- cgit v1.1 From 39c1ae2408f0e93362894b3b45ebc8f965a6d7c5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Nov 2011 17:55:10 +0000 Subject: Chain SOP constructors together rather than having copy/paste code --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b97efc4..24322a1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -318,12 +318,14 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectPart() { - // It's not necessary to persist this m_TextureAnimation = Utils.EmptyBytes; m_particleSystem = Utils.EmptyBytes; Rezzed = DateTime.UtcNow; Description = String.Empty; - + + // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, + // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from + // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log m_inventory = new SceneObjectPartInventory(this); } @@ -337,12 +339,10 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectPart( UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, - Quaternion rotationOffset, Vector3 offsetPosition) + Quaternion rotationOffset, Vector3 offsetPosition) : this() { m_name = "Primitive"; - Rezzed = DateTime.UtcNow; - Description = String.Empty; CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed); LastOwnerID = CreatorID = OwnerID = ownerID; UUID = UUID.Random(); @@ -357,19 +357,10 @@ namespace OpenSim.Region.Framework.Scenes Velocity = Vector3.Zero; AngularVelocity = Vector3.Zero; Acceleration = Vector3.Zero; - m_TextureAnimation = Utils.EmptyBytes; - m_particleSystem = Utils.EmptyBytes; - - // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, - // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from - // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log - Flags = 0; CreateSelected = true; TrimPermissions(); - - m_inventory = new SceneObjectPartInventory(this); } #endregion Constructors -- cgit v1.1 From b0fe0464af9a11dda184d3613eca734cd8c9f21e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 22 Nov 2011 22:13:57 +0000 Subject: Stop an exception being thrown and a teleport/border cross failing if the desintation sim has no active script engines. This involves getting IScene.RequestModuleInterfaces() to return an empty array (as was stated in the method doc) rather than an array containing one null entry. Callers adjusted to stop checking for the list reference being null (which never happened anyway) --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 13 +++-------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- .../Framework/Scenes/SceneObjectPartInventory.cs | 10 ++++----- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 26 +++++++++++----------- 4 files changed, 22 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 663aa22..26eb729 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -82,16 +82,9 @@ namespace OpenSim.Region.Framework.Scenes m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); IScriptModule[] engines = RequestModuleInterfaces(); - if (engines != null) - { - foreach (IScriptModule engine in engines) - { - if (engine != null) - { - engine.StartProcessing(); - } - } - } + + foreach (IScriptModule engine in engines) + engine.StartProcessing(); } public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index dee2ecb..0336fe5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -449,7 +449,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - return new T[] { default(T) }; + return new T[] {}; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 9446741..d80944b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -232,8 +232,6 @@ namespace OpenSim.Region.Framework.Scenes ArrayList ret = new ArrayList(); IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) // No engine at all - return ret; foreach (IScriptModule e in engines) { @@ -329,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes private void RestoreSavedScriptState(UUID oldID, UUID newID) { IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) // No engine at all + if (engines.Length == 0) // No engine at all return; if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) @@ -369,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; } + foreach (IScriptModule e in engines) { if (e != null) @@ -377,6 +376,7 @@ namespace OpenSim.Region.Framework.Scenes break; } } + m_part.ParentGroup.m_savedScriptState.Remove(oldID); } } @@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) // No engine at all + if (engines.Length == 0) // No engine at all return ret; List scripts = GetInventoryScripts(); @@ -1157,7 +1157,7 @@ namespace OpenSim.Region.Framework.Scenes public void ResumeScripts() { IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) + if (engines.Length == 0) return; List scripts = GetInventoryScripts(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7d901c9..c2d3501 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3525,23 +3525,23 @@ namespace OpenSim.Region.Framework.Scenes /// The arguments for the event public void SendScriptEventToAttachments(string eventName, Object[] args) { - if (m_scriptEngines != null) + if (m_scriptEngines.Length == 0) + return; + + lock (m_attachments) { - lock (m_attachments) + foreach (SceneObjectGroup grp in m_attachments) { - foreach (SceneObjectGroup grp in m_attachments) + // 16384 is CHANGED_ANIMATION + // + // Send this to all attachment root prims + // + foreach (IScriptModule m in m_scriptEngines) { - // 16384 is CHANGED_ANIMATION - // - // Send this to all attachment root prims - // - foreach (IScriptModule m in m_scriptEngines) - { - if (m == null) // No script engine loaded - continue; + if (m == null) // No script engine loaded + continue; - m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION }); - } + m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION }); } } } -- cgit v1.1