From 5c53660a7f055be9ed41f30893de673acac8a0f1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Mar 2013 22:59:06 +0000 Subject: Add prototype dynamic objects map for scene object parts This allows region modules to add dynamic objects to SOPs rather than having to continually push and pull OSD dynamic attributes. This is to explore the original MOAP use case for dynamic attributes where it could be very awkward and possibly time-consuming to keep reconstructing MediaEntrys from stored DynamicAttributes. This commit adds a DOExampleModule to demonstrate/evolve this code. Dynamic objects involve no storage or persistence changes - the 'backing store' for any data that does need to be saved will remain the DAMap. DOExampleModule in this commit only attaches a fresh dynamic object. Actually constructing this from stored dynamic attributes and handling persistence is left for later. These changes should affect no existing functionality, though it may or may not reveal necessary changes in DAMap down the road. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3e9a6fa..ee7c4f4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -129,6 +129,27 @@ namespace OpenSim.Region.Framework.Scenes /// Dynamic attributes can be created and deleted as required. /// public DAMap DynAttrs { get; set; } + + private DOMap m_dynObjs; + + /// + /// Dynamic objects that can be created and deleted as required. + /// + public DOMap DynObjs + { + get + { + if (m_dynObjs == null) + m_dynObjs = new DOMap(); + + return m_dynObjs; + } + + set + { + m_dynObjs = value; + } + } /// /// Is this a root part? @@ -348,6 +369,7 @@ namespace OpenSim.Region.Framework.Scenes Rezzed = DateTime.UtcNow; Description = String.Empty; DynAttrs = new DAMap(); + DynObjs = new DOMap(); // 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 -- cgit v1.1 From 48d41ef3076eb4c2a8c4a67d811630ab7b498469 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Mar 2013 23:25:56 +0000 Subject: Remove unnecessary instation of DOMap() in SOP from commit 5c53660 since this is being done lazily --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ee7c4f4..a8b63fe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -369,7 +369,6 @@ namespace OpenSim.Region.Framework.Scenes Rezzed = DateTime.UtcNow; Description = String.Empty; DynAttrs = new DAMap(); - DynObjs = new DOMap(); // 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 -- cgit v1.1 From e9c394fb4ed56ffb931a0161b8c6fdc929b38058 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 14 Mar 2013 21:23:48 +0000 Subject: Make llGetObjectDetails() return the correct world rotation for a sitting avatar This addresses http://opensimulator.org/mantis/view.php?id=6567 This creates a ScenePresence.GetWorldRotation() with the same semantics as SOP.GetWorldRotation() SP.Rotation can't be used since it's relative to the sat upon prim if the avatar is sitting. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 +++++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a7c7539..82bb759 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -559,16 +559,28 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_bodyRot = Quaternion.Identity; + /// + /// The rotation of the avatar. + /// + /// + /// If the avatar is not sitting, this is with respect to the world + /// If the avatar is sitting, this is a with respect to the part that it's sitting upon (a local rotation). + /// If you always want the world rotation, use GetWorldRotation() + /// public Quaternion Rotation { - get { return m_bodyRot; } + get + { + return m_bodyRot; + } + set { m_bodyRot = value; + if (PhysicsActor != null) - { PhysicsActor.Orientation = m_bodyRot; - } + // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); } } @@ -608,6 +620,26 @@ namespace OpenSim.Region.Framework.Scenes set { m_health = value; } } + /// + /// Gets the world rotation of this presence. + /// + /// + /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not. + /// + /// + public Quaternion GetWorldRotation() + { + if (IsSatOnObject) + { + SceneObjectPart sitPart = ParentPart; + + if (sitPart != null) + return sitPart.GetWorldRotation() * Rotation; + } + + return Rotation; + } + public void AdjustKnownSeeds() { Dictionary seeds; @@ -709,8 +741,6 @@ namespace OpenSim.Region.Framework.Scenes #endregion - - #region Constructor(s) public ScenePresence( -- cgit v1.1