From b4a91f5dde928154675da227ae70444bdc12a8bc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Nov 2014 16:43:56 +0000 Subject: [PATCH 1/4] return bbox and offsetHeight to RezObject --- OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 ++++-- .../Region/Framework/Scenes/SceneObjectPartInventory.cs | 9 ++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index eba881fddb..b85fd8bfc3 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -246,7 +246,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The scene objects /// Relative offsets for each object /// true = success, false = the scene object asset couldn't be found - bool GetRezReadySceneObjects(TaskInventoryItem item, out List objlist, out List veclist); + bool GetRezReadySceneObjects(TaskInventoryItem item, out List objlist, out List veclist, out Vector3 bbox, out float offsetHeight); /// /// Update an existing inventory item. diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 746a5cedc9..abf19d86e6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2470,8 +2470,10 @@ namespace OpenSim.Region.Framework.Scenes List objlist; List veclist; - - bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist); + Vector3 bbox; + float offsetHeight; + + bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist,out bbox, out offsetHeight); if (!success) return null; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 2fa91398d6..b9f3f94209 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -871,7 +871,7 @@ namespace OpenSim.Region.Framework.Scenes return items; } - public bool GetRezReadySceneObjects(TaskInventoryItem item, out List objlist, out List veclist) + public bool GetRezReadySceneObjects(TaskInventoryItem item, out List objlist, out List veclist, out Vector3 bbox, out float offsetHeight) { AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); @@ -882,12 +882,11 @@ namespace OpenSim.Region.Framework.Scenes item.AssetID, item.Name, m_part.Name); objlist = null; veclist = null; + bbox = Vector3.Zero; + offsetHeight = 0; return false; } - - Vector3 bbox; - float offsetHeight; - + bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); for (int i = 0; i < objlist.Count; i++) From 7bcb68d7c496cdf2979918a12cb9dc4929bfcdc3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Nov 2014 16:59:11 +0000 Subject: [PATCH 2/4] some steps to rez center or root of prim inventory object at requested position ( does nothing diferent still ) --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 +++-- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 12 +++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index abf19d86e6..9721edb5c5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2447,7 +2447,7 @@ namespace OpenSim.Region.Framework.Scenes RayStart, RayEnd, RayTargetID, Quaternion.Identity, BypassRayCast, bRayEndIsIntersection, true, scale, false); - RezObject(part, item, pos, null, Vector3.Zero, 0); + RezObject(part, item, pos, null, Vector3.Zero, 0, false); } } @@ -2463,7 +2463,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// The SceneObjectGroup(s) rezzed, or null if rez was unsuccessful public virtual List RezObject( - SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param) + SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param, bool atRoot) { if (null == item) return null; @@ -2474,6 +2474,7 @@ namespace OpenSim.Region.Framework.Scenes float offsetHeight; bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist,out bbox, out offsetHeight); + if (!success) return null; diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 6e0ea7d869..020bb6c808 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Tests Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f); Vector3 rezVel = new Vector3(2, 2, 2); - scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0); + scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0,false); SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5141e0ed6e..667a5621d6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3233,6 +3233,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) + { + doObjectRez(inventory, pos, vel, rot, param, true); + } + + public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot) { m_host.AddScriptLPS(1); @@ -3260,10 +3265,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - // need the magnitude later - // float velmag = (float)Util.GetMagnitude(llvel); - - List new_groups = World.RezObject(m_host, item, pos, rot, vel, param); + List new_groups = World.RezObject(m_host, item, pos, rot, vel, param, atRoot); // If either of these are null, then there was an unknown error. if (new_groups == null) @@ -3311,7 +3313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) { - llRezAtRoot(inventory, pos, vel, rot, param); + doObjectRez(inventory, pos, vel, rot, param, false); } public void llLookAt(LSL_Vector target, double strength, double damping) From bb5ab05482c2eb3b8d6c0ae41f54866f41105033 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Nov 2014 18:20:30 +0000 Subject: [PATCH 3/4] fix rez position being for root or center for a single object case --- .../Framework/Scenes/Scene.Inventory.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9721edb5c5..1dd3d2f081 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2491,6 +2491,28 @@ namespace OpenSim.Region.Framework.Scenes sourcePart.Inventory.RemoveInventoryItem(item.ItemID); } + SceneObjectGroup sog; + // position adjust + if (totalPrims > 1) // nothing to do on a single prim + { + if (objlist.Count == 1) + { + // current object position is root position + if(!atRoot) + { + sog = objlist[0]; + Quaternion orot; + if (rot == null) + orot = sog.RootPart.GetWorldRotation(); + else + orot = rot.Value; + Vector3 off = sog.GetGeometricCenter(); + off *= orot; + pos -= off; + } + } + } + for (int i = 0; i < objlist.Count; i++) { SceneObjectGroup group = objlist[i]; From 6bebb9206cc0ec966f75ab52c76c66b4546d730f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Nov 2014 20:11:16 +0000 Subject: [PATCH 4/4] fix stopMoveToTarget in attachments case ( similar to core fix) --- .../Framework/Scenes/SceneObjectGroup.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9a2707b0f5..89c7a1a3e1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2468,12 +2468,23 @@ namespace OpenSim.Region.Framework.Scenes public void stopMoveToTarget() { - PhysicsActor pa = RootPart.PhysActor; + if (IsAttachment) + { + ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); + if (avatar != null) + { + avatar.ResetMoveToTarget(); + } + } + else + { + PhysicsActor pa = RootPart.PhysActor; - if (pa != null) - pa.PIDActive = false; + if (pa != null) + pa.PIDActive = false; - RootPart.ScheduleTerseUpdate(); // send a stop information + RootPart.ScheduleTerseUpdate(); // send a stop information + } } public void rotLookAt(Quaternion target, float strength, float damping)