From dbd954d701027c417d8f468d19b735f46596cc8c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Jul 2011 22:56:14 +0100 Subject: Fix permissions problem where newly uploaded meshes rezzed from inventory could not be copied by owner. --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs | 2 +- .../Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index d3bb0bc..b11210a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -687,7 +687,7 @@ namespace OpenSim.Region.ClientStack.Linden item.CurrentPermissions = (uint)PermissionMask.All; item.BasePermissions = (uint)PermissionMask.All; item.EveryOnePermissions = 0; - item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); + item.NextPermissions = (uint)PermissionMask.All; item.CreationDate = Util.UnixTimeSinceEpoch(); if (AddNewInventoryItem != null) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index c9d7ae1..29a9199 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs @@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) { - m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request"); +// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request"); OSDMap data = new OSDMap(); ScenePresence sp = m_scene.GetScenePresence(m_agentID); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index b7e79cc..b2f04f9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs @@ -160,8 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden } } // } - - string assetName = llsdRequest.name; string assetDes = llsdRequest.description; @@ -208,12 +206,10 @@ namespace OpenSim.Region.ClientStack.Linden return uploadResponse; } - public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType,UUID AgentID) { - sbyte assType = 0; sbyte inType = 0; @@ -266,10 +262,10 @@ namespace OpenSim.Region.ClientStack.Linden item.CurrentPermissions = (uint)PermissionMask.All; item.BasePermissions = (uint)PermissionMask.All; item.EveryOnePermissions = 0; - item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); + item.NextPermissions = (uint)PermissionMask.All; item.CreationDate = Util.UnixTimeSinceEpoch(); m_scene.AddInventoryItem(item); } } -} +} \ No newline at end of file -- cgit v1.1 From df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 02:33:09 +0100 Subject: When a mesh object is added to a scene, delay adding the physics actor until the sculpt data has been added to the shape (possibly via an async asset service request) This prevents spurious 'no asset data' for meshes added on startup. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++-- .../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++++- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 21 +++++++------- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 33 ++++++++++++---------- 5 files changed, 39 insertions(+), 29 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8195a0d..0104a96 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1751,8 +1751,9 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart rootPart = group.GetChildPart(group.UUID); rootPart.Flags &= ~PrimFlags.Scripted; rootPart.TrimPermissions(); - group.CheckSculptAndLoad(); - //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); + + // Don't do this here - it will get done later on when sculpt data is loaded. +// group.CheckSculptAndLoad(); } m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fa23fcd..905acd6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -584,7 +584,7 @@ namespace OpenSim.Region.Framework.Scenes part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } - + ApplyPhysics(m_scene.m_physicalPrim); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2026c53..e9571aa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1896,7 +1896,12 @@ namespace OpenSim.Region.Framework.Scenes } } - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + // If this part is a sculpt then delay the physics update until we've asynchronously loaded the + // mesh data. + if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) + CheckSculptAndLoad(); + else + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); } } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 123c8ff..56e3b7e 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -638,7 +638,7 @@ namespace OpenSim.Region.Physics.OdePlugin float profileEnd; if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible) - { + { taperX1 = _pbs.PathScaleX * 0.01f; if (taperX1 > 1.0f) taperX1 = 2.0f - taperX1; @@ -648,9 +648,9 @@ namespace OpenSim.Region.Physics.OdePlugin if (taperY1 > 1.0f) taperY1 = 2.0f - taperY1; taperY = 1.0f - taperY1; - } + } else - { + { taperX = _pbs.PathTaperX * 0.01f; if (taperX < 0.0f) taperX = -taperX; @@ -660,9 +660,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (taperY < 0.0f) taperY = -taperY; taperY1 = 1.0f - taperY; - - } - + } volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY); @@ -859,7 +857,9 @@ namespace OpenSim.Region.Physics.OdePlugin public void ProcessTaints(float timestep) { -//Console.WriteLine("ProcessTaints for " + Name); +#if SPAM +Console.WriteLine("ZProcessTaints for " + Name); +#endif if (m_taintadd) { changeadd(timestep); @@ -1323,7 +1323,9 @@ namespace OpenSim.Region.Physics.OdePlugin public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) { -//Console.WriteLine("CreateGeom:"); +#if SPAM +Console.WriteLine("CreateGeom:"); +#endif if (_mesh != null) { setMesh(_parent_scene, _mesh); @@ -1944,7 +1946,6 @@ Console.WriteLine(" JointCreateFixed"); if (_parent_scene.needsMeshing(_pbs)) mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); - //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); #if SPAM Console.WriteLine("changesize 1"); #endif @@ -2056,8 +2057,8 @@ Console.WriteLine("changesize 2"); if (IsPhysical) meshlod = _parent_scene.MeshSculptphysicalLOD; - IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); // createmesh returns null when it doesn't mesh. + IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); #if SPAM Console.WriteLine("changeshape needed meshing"); #endif diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 99392cc..7b8a80c 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1723,20 +1723,21 @@ namespace OpenSim.Region.Physics.OdePlugin PhysicsActor result; IMesh mesh = null; - if (needsMeshing(pbs)) - { - try - { - mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); - } - catch(Exception e) - { - m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); - m_log.Debug(e.ToString()); - mesh = null; - return null; - } - } + // Don't create the mesh here - wait until the mesh data is loaded from the asset store. +// if (needsMeshing(pbs)) +// { +// try +// { +// mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); +// } +// catch(Exception e) +// { +// m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); +// m_log.Debug(e.ToString()); +// mesh = null; +// return null; +// } +// } result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); @@ -2590,7 +2591,9 @@ namespace OpenSim.Region.Physics.OdePlugin { if (!(_taintedPrimH.Contains(taintedprim))) { -//Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); +#if SPAM +Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); +#endif _taintedPrimH.Add(taintedprim); // HashSet for searching _taintedPrimL.Add(taintedprim); // List for ordered readout } -- cgit v1.1 From f75f906e3560b076105ab9551263617e084d6393 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 03:13:05 +0100 Subject: minor: remove whitespace to trigger another build --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 56e3b7e..27bf942 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -844,7 +844,6 @@ namespace OpenSim.Region.Physics.OdePlugin return; } - // if (IsPhysical && Body == (IntPtr) 0) // { // Recreate the body -- cgit v1.1 From d31e0a67f7d7c2b1882a2030fe01d5d2ee32ad2a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 03:26:22 +0100 Subject: temporarily fix the build break with building the OdePlugin tests assembly. This needs to be fixed properly. --- OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index a7f8baa..fbd1574 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -31,17 +31,18 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Physics.OdePlugin; using log4net; using System.Reflection; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.Physics.OdePlugin.Tests { [TestFixture] public class ODETestClass { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OdePlugin cbt; + private OpenSim.Region.Physics.OdePlugin.OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; -- cgit v1.1 From 3e456163dd284fa04ab17465041a1a27f7b632b9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 22:13:15 +0100 Subject: Port implementation of llCastRay() from Aurora. I haven't been able to test this since the viewer won't parse the llCastRay() function. Maybe some activation cap is missing. Could wait until it is activated by default in the viewer. --- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 24 ++- .../Physics/OdePlugin/ODERayCastRequestManager.cs | 92 +++++++++--- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 28 ++++ .../Shared/Api/Implementation/LSL_Api.cs | 166 +++++++++++++++++++-- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 5 +- .../Shared/Api/Runtime/LSL_Constants.cs | 16 ++ 6 files changed, 298 insertions(+), 33 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 13ea084..0de4626 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -37,6 +37,18 @@ namespace OpenSim.Region.Physics.Manager public delegate void physicsCrash(); public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); + public delegate void RayCallback(List list); + + /// + /// Contact result from a raycast. + /// + public struct ContactResult + { + public Vector3 Pos; + public float Depth; + public uint ConsumerID; + public Vector3 Normal; + } public abstract class PhysicsScene { @@ -61,7 +73,6 @@ namespace OpenSim.Region.Physics.Manager } } - public abstract void Initialise(IMesher meshmerizer, IConfigSource config); public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); @@ -225,6 +236,17 @@ namespace OpenSim.Region.Physics.Manager retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); } + public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) + { + if (retMethod != null) + retMethod(new List()); + } + + public virtual List RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) + { + return new List(); + } + private class NullPhysicsScene : PhysicsScene { private static int m_workIndicator; diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs index ba77dae..6c2bdde 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs @@ -45,11 +45,16 @@ namespace OpenSim.Region.Physics.OdePlugin public class ODERayCastRequestManager { /// - /// Pending Raycast Requests + /// Pending raycast requests /// protected List m_PendingRequests = new List(); /// + /// Pending ray requests + /// + protected List m_PendingRayRequests = new List(); + + /// /// Scene that created this object. /// private OdeScene m_scene; @@ -96,6 +101,29 @@ namespace OpenSim.Region.Physics.OdePlugin } /// + /// Queues a raycast + /// + /// Origin of Ray + /// Ray normal + /// Ray length + /// + /// Return method to send the results + public void QueueRequest(Vector3 position, Vector3 direction, float length, int count, RayCallback retMethod) + { + lock (m_PendingRequests) + { + ODERayRequest req = new ODERayRequest(); + req.callbackMethod = retMethod; + req.length = length; + req.Normal = direction; + req.Origin = position; + req.Count = count; + + m_PendingRayRequests.Add(req); + } + } + + /// /// Process all queued raycast requests /// /// Time in MS the raycasts took to process. @@ -112,15 +140,23 @@ namespace OpenSim.Region.Physics.OdePlugin if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast RayCast(reqs[i]); // if there isn't anyone to send results } - /* - foreach (ODERayCastRequest req in m_PendingRequests) + + m_PendingRequests.Clear(); + } + } + + lock (m_PendingRayRequests) + { + if (m_PendingRayRequests.Count > 0) + { + ODERayRequest[] reqs = m_PendingRayRequests.ToArray(); + for (int i = 0; i < reqs.Length; i++) { - if (req.callbackMethod != null) // quick optimization here, don't raycast - RayCast(req); // if there isn't anyone to send results to - + if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast + RayCast(reqs[i]); // if there isn't anyone to send results } - */ - m_PendingRequests.Clear(); + + m_PendingRayRequests.Clear(); } } @@ -146,7 +182,6 @@ namespace OpenSim.Region.Physics.OdePlugin // Remove Ray d.GeomDestroy(ray); - // Define default results bool hitYN = false; uint hitConsumerID = 0; @@ -177,6 +212,31 @@ namespace OpenSim.Region.Physics.OdePlugin req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal); } + /// + /// Method that actually initiates the raycast + /// + /// + private void RayCast(ODERayRequest req) + { + // Create the ray + IntPtr ray = d.CreateRay(m_scene.space, req.length); + d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); + + // Collide test + d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback); + + // Remove Ray + d.GeomDestroy(ray); + + // Find closest contact and object. + lock (m_contactResults) + { + // Return results + if (req.callbackMethod != null) + req.callbackMethod(m_contactResults); + } + } + // This is the standard Near. Uses space AABBs to speed up detection. private void near(IntPtr space, IntPtr g1, IntPtr g2) { @@ -342,10 +402,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_contactResults.Add(collisionresult); } } - - } - } /// @@ -365,11 +422,12 @@ namespace OpenSim.Region.Physics.OdePlugin public RaycastCallback callbackMethod; } - public struct ContactResult + public struct ODERayRequest { - public Vector3 Pos; - public float Depth; - public uint ConsumerID; + public Vector3 Origin; public Vector3 Normal; + public int Count; + public float length; + public RayCallback callbackMethod; } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 7b8a80c..ba8cba4 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -3736,6 +3736,34 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); } } + public override void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) + { + if (retMethod != null) + { + m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod); + } + } + + public override List RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) + { + ContactResult[] ourResults = null; + RayCallback retMethod = delegate(List results) + { + ourResults = new ContactResult[results.Count]; + results.CopyTo(ourResults, 0); + }; + int waitTime = 0; + m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod); + while (ourResults == null && waitTime < 1000) + { + Thread.Sleep(1); + waitTime++; + } + if (ourResults == null) + return new List (); + return new List(ourResults); + } + #if USE_DRAWSTUFF // Keyboard callback public void command(int cmd) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fd6d64c..c8bce60 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10309,51 +10309,191 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return rq.ToString(); } + public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options) + { + m_host.AddScriptLPS(1); + + Vector3 dir = new Vector3((float)(end-start).x, (float)(end-start).y, (float)(end-start).z); + Vector3 startvector = new Vector3((float)start.x, (float)start.y, (float)start.z); + Vector3 endvector = new Vector3((float)end.x, (float)end.y, (float)end.z); + + int count = 0; +// int detectPhantom = 0; + int dataFlags = 0; + int rejectTypes = 0; + + for (int i = 0; i < options.Length; i += 2) + { + if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS) + { + count = options.GetLSLIntegerItem(i + 1); + } +// else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM) +// { +// detectPhantom = options.GetLSLIntegerItem(i + 1); +// } + else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS) + { + dataFlags = options.GetLSLIntegerItem(i + 1); + } + else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES) + { + rejectTypes = options.GetLSLIntegerItem(i + 1); + } + } + + LSL_List list = new LSL_List(); + List results = World.PhysicsScene.RaycastWorld(startvector, dir, dir.Length(), count); + + double distance = Util.GetDistanceTo(startvector, endvector); + + if (distance == 0) + distance = 0.001; + + Vector3 posToCheck = startvector; + ITerrainChannel channel = World.RequestModuleInterface(); + + bool checkTerrain = !((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) == ScriptBaseClass.RC_REJECT_LAND); + bool checkAgents = !((rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) == ScriptBaseClass.RC_REJECT_AGENTS); + bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL); + bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); + + for (float i = 0; i <= distance; i += 0.1f) + { + posToCheck = startvector + (dir * (i / (float)distance)); + + if (checkTerrain && channel[(int)(posToCheck.X + startvector.X), (int)(posToCheck.Y + startvector.Y)] < posToCheck.Z) + { + ContactResult result = new ContactResult(); + result.ConsumerID = 0; + result.Depth = 0; + result.Normal = Vector3.Zero; + result.Pos = posToCheck; + results.Add(result); + checkTerrain = false; + } + + if (checkAgents) + { + World.ForEachScenePresence(delegate(ScenePresence sp) + { + if (sp.AbsolutePosition.ApproxEquals(posToCheck, sp.PhysicsActor.Size.X)) + { + ContactResult result = new ContactResult (); + result.ConsumerID = sp.LocalId; + result.Depth = 0; + result.Normal = Vector3.Zero; + result.Pos = posToCheck; + results.Add(result); + } + }); + } + } + + int refcount = 0; + foreach (ContactResult result in results) + { + if ((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) + == ScriptBaseClass.RC_REJECT_LAND && result.ConsumerID == 0) + continue; + + ISceneEntity entity = World.GetSceneObjectPart(result.ConsumerID); + + if (entity == null && (rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) != ScriptBaseClass.RC_REJECT_AGENTS) + entity = World.GetScenePresence(result.ConsumerID); //Only check if we should be looking for agents + + if (entity == null) + { + list.Add(UUID.Zero); + + if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM) + list.Add(0); + + list.Add(result.Pos); + + if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) + list.Add(result.Normal); + + continue; //Can't find it, so add UUID.Zero + } + + /*if (detectPhantom == 0 && intersection.obj is ISceneChildEntity && + ((ISceneChildEntity)intersection.obj).PhysActor == null) + continue;*/ //Can't do this ATM, physics engine knows only of non phantom objects + + if (entity is SceneObjectPart) + { + if (((SceneObjectPart)entity).PhysActor != null && ((SceneObjectPart)entity).PhysActor.IsPhysical) + { + if (!checkPhysical) + continue; + } + else + { + if (!checkNonPhysical) + continue; + } + } + + refcount++; + if ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) == ScriptBaseClass.RC_GET_ROOT_KEY && entity is SceneObjectPart) + list.Add(((SceneObjectPart)entity).ParentGroup.UUID); + else + list.Add(entity.UUID); + + if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM) + { + if (entity is SceneObjectPart) + list.Add(((SceneObjectPart)entity).LinkNum); + else + list.Add(0); + } + + list.Add(result.Pos); + + if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) + list.Add(result.Normal); + } + + list.Add(refcount); //The status code, either the # of contacts, RCERR_SIM_PERF_LOW, or RCERR_CAST_TIME_EXCEEDED + + return list; + } + #region Not Implemented // // Listing the unimplemented lsl functions here, please move // them from this region as they are completed // - public void llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options) - { - m_host.AddScriptLPS(1); - NotImplemented("llCastRay"); - - } public void llGetEnv(LSL_String name) { m_host.AddScriptLPS(1); NotImplemented("llGetEnv"); - } public void llGetSPMaxMemory() { m_host.AddScriptLPS(1); NotImplemented("llGetSPMaxMemory"); - } public void llGetUsedMemory() { m_host.AddScriptLPS(1); NotImplemented("llGetUsedMemory"); - } - public void llRegionSayTo( LSL_Key target, LSL_Integer channel, LSL_String msg ) + public void llRegionSayTo(LSL_Key target, LSL_Integer channel, LSL_String msg) { m_host.AddScriptLPS(1); NotImplemented("llRegionSayTo"); - } - public void llScriptProfiler( LSL_Integer flags ) + public void llScriptProfiler(LSL_Integer flags) { m_host.AddScriptLPS(1); NotImplemented("llScriptProfiler"); - } public void llSetSoundQueueing(int queue) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 654ea81..27f9c84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -60,6 +60,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llBase64ToString(string str); void llBreakAllLinks(); void llBreakLink(int linknum); + LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); LSL_Integer llCeil(double f); void llClearCameraParams(); LSL_Integer llClearPrimMedia(LSL_Integer face); @@ -404,7 +405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llXorBase64StringsCorrect(string str1, string str2); void print(string str); - void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); - LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); + void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); + LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 9377cda..3f90788 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -593,5 +593,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; + + public static readonly LSLInteger RC_REJECT_TYPES = 2; + public static readonly LSLInteger RC_DATA_FLAGS = 4; + public static readonly LSLInteger RC_MAX_HITS = 8; + public static readonly LSLInteger RC_DETECT_PHANTOM = 16; + + public static readonly LSLInteger RC_REJECT_AGENTS = 2; + public static readonly LSLInteger RC_REJECT_PHYSICAL = 4; + public static readonly LSLInteger RC_REJECT_NONPHYSICAL = 8; + public static readonly LSLInteger RC_REJECT_LAND = 16; + + public static readonly LSLInteger RC_GET_NORMAL = 2; + public static readonly LSLInteger RC_GET_ROOT_KEY = 4; + public static readonly LSLInteger RC_GET_LINK_NUM = 8; + + public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 1; } } -- cgit v1.1 From bf1b8397bb6a8dad5eba89b44c46412bbb948edd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 23:35:06 +0100 Subject: Add a warning to URI config in GridCommon.ini.example not to add a slash to the end. Tidy up GridCommon.ini.example --- OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index f15f8f6..b5cbcbb 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs @@ -68,7 +68,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring { m_scene = scene; - m_scene.AddCommand(this, "monitor report", "monitor report", "Returns a variety of statistics about the current region and/or simulator", -- cgit v1.1 From 5158ec0913357261dfa6db821c3b19a788b88266 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jul 2011 00:24:55 +0100 Subject: Add experimental module to check status of services that the simulator is connected to. Currently disabled. --- .../Framework/Monitoring/MonitorServicesModule.cs | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 OpenSim/Region/OptionalModules/Framework/Monitoring/MonitorServicesModule.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Framework/Monitoring/MonitorServicesModule.cs b/OpenSim/Region/OptionalModules/Framework/Monitoring/MonitorServicesModule.cs new file mode 100644 index 0000000..d49face --- /dev/null +++ b/OpenSim/Region/OptionalModules/Framework/Monitoring/MonitorServicesModule.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using System.Text; +using log4net; +using Mono.Addins; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Framework.Monitoring +{ + /// + /// An experimental module to return data on services used by the simulator. + /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MonitorServicesModule")] + public class MonitorServicesModule : ISharedRegionModule + { + protected Scene m_scene; + + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public string Name { get { return "Services Health Monitoring Module"; } } + + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) + { + } + + public void PostInitialise() + { + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (m_scene == null) + { + m_scene = scene; + +// m_scene.AddCommand(this, "monitor services", +// "monitor services", +// "Returns the status of services used by the simulator. Experimental.", +// HandleMonitorServices); + } + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { + } + + protected void HandleMonitorServices(string module, string[] args) + { + MainConsole.Instance.Output(GenerateServicesReport()); + } + + protected string GenerateServicesReport() + { + StringBuilder sb = new StringBuilder(); + sb.Append("This is an experimental module. Please don't rely on these results\n"); + sb.Append("Asset service: "); + + try + { + CheckAssetService(); + sb.Append("OK"); + } + catch (Exception e) + { + sb.AppendFormat("FAIL ({0})", e.Message); + } + + return sb.ToString(); + } + + protected void CheckAssetService() + { + // Try to fetch an asset that will not exist (and hence avoid hitting cache) + m_scene.AssetService.Get(UUID.Random().ToString()); + } + } +} \ No newline at end of file -- cgit v1.1 From 08dc07dc7691ce8ee3c81528bb45b9fdfc603a68 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jul 2011 00:48:36 +0100 Subject: refactor: Move all callers of the obsoleted SychronousRestObjectPoster.BeginPostObject() to the identical SynchronousRestObjectRequester.MakeRequest() --- .../CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 7 ++++--- .../Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs | 4 ++-- OpenSim/Services/HypergridService/HGInstantMessageService.cs | 8 +++----- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 321b38b..8d055d4 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -173,9 +173,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { if (m_RestURL != "") { - m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); + m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId); - List msglist = SynchronousRestObjectPoster.BeginPostObject>( + List msglist + = SynchronousRestObjectRequester.MakeRequest>( "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); if (msglist == null) @@ -203,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if ((im.offline != 0) && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { - bool success = SynchronousRestObjectPoster.BeginPostObject( + bool success = SynchronousRestObjectRequester.MakeRequest( "POST", m_RestURL+"/SaveMessage/", im); if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index d18ac0a..2187449 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule info.channel = channel; info.uri = uri; - bool success = SynchronousRestObjectPoster.BeginPostObject( + bool success = SynchronousRestObjectRequester.MakeRequest( "POST", m_ServerURI+"/RegisterChannel/", info); if (!success) @@ -125,7 +125,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule if (m_Channels.ContainsKey(itemID)) { - bool success = SynchronousRestObjectPoster.BeginPostObject( + bool success = SynchronousRestObjectRequester.MakeRequest( "POST", m_ServerURI+"/RemoveChannel/", m_Channels[itemID]); if (!success) diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index ded589d..bb31fc9 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -326,7 +326,6 @@ namespace OpenSim.Services.HypergridService // This is recursive!!!!! return TrySendInstantMessage(im, url, false, foreigner); } - } private bool UndeliveredMessage(GridInstantMessage im) @@ -335,15 +334,14 @@ namespace OpenSim.Services.HypergridService && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { m_log.DebugFormat("[HG IM SERVICE]: Message saved"); - return SynchronousRestObjectPoster.BeginPostObject( - "POST", m_RestURL + "/SaveMessage/", im); + return SynchronousRestObjectRequester.MakeRequest( + "POST", m_RestURL + "/SaveMessage/", im); } - else { return false; } } } -} +} \ No newline at end of file -- cgit v1.1 From e434ba5e8e912965e54f7b7afafde9dec04777ed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jul 2011 00:52:32 +0100 Subject: Remove the obsoleted SynchronousRestObjectPoster --- OpenSim/Framework/WebUtil.cs | 9 --------- 1 file changed, 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 147a011..f33b7a2 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -907,15 +907,6 @@ namespace OpenSim.Framework } } - public class SynchronousRestObjectPoster - { - [Obsolete] - public static TResponse BeginPostObject(string verb, string requestUrl, TRequest obj) - { - return SynchronousRestObjectRequester.MakeRequest(verb, requestUrl, obj); - } - } - public class SynchronousRestObjectRequester { private static readonly ILog m_log = -- cgit v1.1 From 938b4f8bf84cac689538817263bfb3d79755c903 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jul 2011 01:19:12 +0100 Subject: if a SynchronousRestObjectRequester request fails, then unless it's due to a 404, log the exception for diagnostic purposes This is instead of logging "Invalid XML" for all failures, even if they weren't a result of invalid xml. A default TReponse is returned in the event of a 404, which is the same behaviour as previously. --- OpenSim/Framework/WebUtil.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index f33b7a2..87eeeb6 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -987,6 +987,17 @@ namespace OpenSim.Framework } } + catch (WebException e) + { + HttpWebResponse hwr = (HttpWebResponse)e.Response; + + if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) + return deserial; + else + m_log.ErrorFormat( + "[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}", + requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); + } catch (System.InvalidOperationException) { // This is what happens when there is invalid XML -- cgit v1.1 From 0d64155bb5cc61145b92fd84b3f459cc213aae01 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jul 2011 01:24:22 +0100 Subject: Remove an unused 404 checker since on a 404, GetResponse() throws a WebException rather than proceeding. --- OpenSim/Framework/WebUtil.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 87eeeb6..f417801 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -972,9 +972,6 @@ namespace OpenSim.Framework { using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) { - if (resp.StatusCode == HttpStatusCode.NotFound) - return deserial; - if (resp.ContentLength != 0) { Stream respStream = resp.GetResponseStream(); -- cgit v1.1 From c7e85291221b85393be04be02795059f424efa1c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jul 2011 01:25:17 +0100 Subject: minor: remove whitespace --- OpenSim/Framework/WebUtil.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index f417801..be7504f 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -981,7 +981,6 @@ namespace OpenSim.Framework } else m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); - } } catch (WebException e) -- cgit v1.1 From b55076990c3ba27bc9a0ca716031928fae887deb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 14 Jul 2011 12:38:35 -0700 Subject: fix duplication of physical objects for physics engines that care about the initial value of localID --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 905acd6..343a8fd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1463,16 +1463,16 @@ namespace OpenSim.Region.Framework.Scenes // Need to duplicate the physics actor as well if (part.PhysActor != null && userExposed) { - PrimitiveBaseShape pbs = part.Shape; + PrimitiveBaseShape pbs = newPart.Shape; newPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( - part.LocalId, - string.Format("{0}/{1}", part.Name, part.UUID), + newPart.LocalId, + string.Format("{0}/{1}", newPart.Name, newPart.UUID), pbs, - part.AbsolutePosition, - part.Scale, - part.RotationOffset, + newPart.AbsolutePosition, + newPart.Scale, + newPart.RotationOffset, part.PhysActor.IsPhysical); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); -- cgit v1.1 From e9dbe54ab1217e4310b0e7e014516363237e2a21 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 15 Jul 2011 20:07:59 +0100 Subject: Fix some local id issues in physics glue --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 4 +-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 32 ++++++++++++++-------- .../BasicPhysicsPlugin/BasicPhysicsScene.cs | 8 +----- .../BulletDotNETPlugin/BulletDotNETScene.cs | 7 +---- .../Region/Physics/BulletXPlugin/BulletXPlugin.cs | 8 +----- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 19 +++++-------- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 8 +----- .../Region/Physics/OdePlugin/Tests/ODETestClass.cs | 2 +- OpenSim/Region/Physics/POSPlugin/POSScene.cs | 8 +----- OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs | 8 +----- 10 files changed, 36 insertions(+), 68 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 343a8fd..0fbd746 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1467,13 +1467,13 @@ namespace OpenSim.Region.Framework.Scenes newPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( - newPart.LocalId, string.Format("{0}/{1}", newPart.Name, newPart.UUID), pbs, newPart.AbsolutePosition, newPart.Scale, newPart.RotationOffset, - part.PhysActor.IsPhysical); + part.PhysActor.IsPhysical, + newPart.LocalId); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e9571aa..7604510 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1588,17 +1588,23 @@ namespace OpenSim.Region.Framework.Scenes // or flexible if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) { -// m_log.DebugFormat("[SCENE OBJECT PART]: Creating PhysActor for {0} {1} {2}", Name, LocalId, UUID); - - PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( - LocalId, - string.Format("{0}/{1}", Name, UUID), - Shape, - AbsolutePosition, - Scale, - RotationOffset, - RigidBody); - + try + { + PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( + string.Format("{0}/{1}", Name, UUID), + Shape, + AbsolutePosition, + Scale, + RotationOffset, + RigidBody, + m_localId); + PhysActor.SetMaterial(Material); + } + catch + { + m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); + PhysActor = null; + } // Basic Physics returns null.. joy joy joy. if (PhysActor != null) { @@ -4446,7 +4452,9 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition, Scale, RotationOffset, - UsePhysics); + UsePhysics, + m_localId); + PhysActor.SetMaterial(Material); pa = PhysActor; if (pa != null) diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index b6e1cb4..6c9d9ab 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs @@ -84,13 +84,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin */ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { return null; } diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs index 6df213d..0d1bd82 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs @@ -213,12 +213,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin return newPrim; } - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical) + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { PhysicsActor result; IMesh mesh = null; diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index e2a6a2e..df62dbc 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -626,13 +626,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin } public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, - OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, - OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical) + OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical, uint localid) { PhysicsActor result; diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 0de4626..28ace34 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -88,15 +88,16 @@ namespace OpenSim.Region.Physics.Manager public abstract void RemovePrim(PhysicsActor prim); + //public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + // Vector3 size, Quaternion rotation); //To be removed - Actually removed! + public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation); //To be removed - public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical); + Vector3 size, Quaternion rotation, bool isPhysical, uint localid); public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { - PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical); + PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); if (ret != null) ret.LocalID = localID; @@ -284,13 +285,7 @@ namespace OpenSim.Region.Physics.Manager */ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) //To be removed - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); return PhysicsActor.Null; diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index ba8cba4..6fda32d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1708,13 +1708,7 @@ namespace OpenSim.Region.Physics.OdePlugin } public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) //To be removed - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { #if SPAM m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName); diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index fbd1574..2ea810f 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -84,7 +84,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); Quaternion rot = Quaternion.Identity; - PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); + PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); OdePrim oprim = (OdePrim)prim; OdeScene pscene = (OdeScene) ps; diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index c3f5040..2f24a50 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs @@ -91,13 +91,7 @@ namespace OpenSim.Region.Physics.POSPlugin */ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { POSPrim prim = new POSPrim(); prim.Position = position; diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs index 4de4b01..beb3404 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs @@ -108,13 +108,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin } public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation) //To be removed - { - return AddPrimShape(primName, pbs, position, size, rotation, false); - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical) + Vector3 size, Quaternion rotation, bool isPhysical, uint localid) { return AddPrim(position, size, rotation); } -- cgit v1.1 From 3e5b2d52ff7e9fd0c968608c4a705740f51b9bc2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Jul 2011 22:58:29 +0100 Subject: minor: method doc for baked texture uploading --- .../ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 17 +++++++++++++++-- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 ++- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index b11210a..8db4e67 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -331,14 +331,22 @@ namespace OpenSim.Region.ClientStack.Linden } } + /// + /// Handle a request from the client for a Uri to upload a baked texture. + /// + /// + /// + /// + /// + /// + /// The upload response if the request is successful, null otherwise. public string UploadBakedTexture(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { try { - // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + - // m_regionName); +// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName); string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); @@ -374,6 +382,11 @@ namespace OpenSim.Region.ClientStack.Linden return null; } + /// + /// Called when a baked texture has been successfully uploaded by a client. + /// + /// + /// public void BakedTextureUploaded(UUID assetID, byte[] data) { // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 1955e5b..75dbeb8 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -180,8 +180,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } /// - /// Set appearance data (textureentry and slider settings) received from the client + /// Set appearance data (texture asset IDs and slider settings) received from the client /// + /// /// /// public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) -- cgit v1.1 From 0ee7a5ee81437f7fb81814b1694c00cb5a206bda Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Jul 2011 23:36:32 +0100 Subject: If object is an attachment, make llGetVel() return the avatar's speed rather than the object's own zero speed. As per http://opensimulator.org/mantis/view.php?id=5575 --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 1 - .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 520d794..1e09610 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -566,7 +566,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c8bce60..7759b0a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2214,7 +2214,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetVel() { m_host.AddScriptLPS(1); - return new LSL_Vector(m_host.Velocity.X, m_host.Velocity.Y, m_host.Velocity.Z); + + Vector3 vel; + + if (m_host.IsAttachment) + { + ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.AttachedAvatar); + vel = avatar.Velocity; + } + else + { + vel = m_host.Velocity; + } + + return new LSL_Vector(vel.X, vel.Y, vel.Z); } public LSL_Vector llGetAccel() @@ -10021,8 +10034,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } } + return ret; } + SceneObjectPart obj = World.GetSceneObjectPart(key); if (obj != null) { -- cgit v1.1 From a9ba9d4a9ee2515d2541fc536525ebed3d101606 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Jul 2011 23:51:55 +0100 Subject: change async parameter name in AddLocalPacketHandler since it becomes a reserved keyword in .net 5 Also adds some method doc. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c176c2b..8414f8b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -574,22 +574,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP return result; } + /// + /// Add a handler for the given packet type. + /// + /// The packet is handled on its own thread. If packets must be handled in the order in which thye + /// are received then please us ethe synchronous version of this method. + /// + /// + /// true if the handler was added. This is currently always the case. public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler) { return AddLocalPacketHandler(packetType, handler, true); } - public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool async) + /// + /// Add a handler for the given packet type. + /// + /// + /// + /// + /// If true, when the packet is received it is handled on its own thread rather than on the main inward bound + /// packet handler thread. This vastly increases respnosiveness but some packets need to be handled + /// synchronously. + /// + /// true if the handler was added. This is currently always the case. + public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync) { bool result = false; lock (m_packetHandlers) { if (!m_packetHandlers.ContainsKey(packetType)) { - m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = async }); + m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = doAsync }); result = true; } } + return result; } -- cgit v1.1 From 7247ca16447e962d0f8281e0ed4f163ea4e06b96 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 00:08:11 +0100 Subject: use constants in llGetObjectDetails() rather than magic numbers --- .../Shared/Api/Implementation/LSL_Api.cs | 43 +++++++++++----------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7759b0a..26969a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2523,10 +2523,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// negative (indicating end-relative) and may be inverted, /// i.e. end < start. /// - public LSL_String llDeleteSubString(string src, int start, int end) { - m_host.AddScriptLPS(1); // Normalize indices (if negative). @@ -2606,10 +2604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// which case it is end-relative. The index may exceed either /// string bound, with the result being a concatenation. /// - public LSL_String llInsertString(string dest, int index, string src) { - m_host.AddScriptLPS(1); // Normalize indices (if negative). @@ -9996,6 +9992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetObjectDetails(string id, LSL_List args) { m_host.AddScriptLPS(1); + LSL_List ret = new LSL_List(); UUID key = new UUID(); if (UUID.TryParse(id, out key)) @@ -10006,30 +10003,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (object o in args.Data) { - switch (o.ToString()) + switch (int.Parse(o.ToString())) { - case "1": + case ScriptBaseClass.OBJECT_NAME: ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); break; - case "2": + case ScriptBaseClass.OBJECT_DESC: ret.Add(new LSL_String("")); break; - case "3": + case ScriptBaseClass.OBJECT_POS: ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); break; - case "4": + case ScriptBaseClass.OBJECT_ROT: ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); break; - case "5": + case ScriptBaseClass.OBJECT_VELOCITY: ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); break; - case "6": + case ScriptBaseClass.OBJECT_OWNER: ret.Add(new LSL_String(id)); break; - case "7": + case ScriptBaseClass.OBJECT_GROUP: ret.Add(new LSL_String(UUID.Zero.ToString())); break; - case "8": + case ScriptBaseClass.OBJECT_CREATOR: ret.Add(new LSL_String(UUID.Zero.ToString())); break; } @@ -10043,37 +10040,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (object o in args.Data) { - switch (o.ToString()) + switch (int.Parse(o.ToString())) { - case "1": + case ScriptBaseClass.OBJECT_NAME: ret.Add(new LSL_String(obj.Name)); break; - case "2": + case ScriptBaseClass.OBJECT_DESC: ret.Add(new LSL_String(obj.Description)); break; - case "3": + case ScriptBaseClass.OBJECT_POS: ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); break; - case "4": + case ScriptBaseClass.OBJECT_ROT: ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); break; - case "5": + case ScriptBaseClass.OBJECT_VELOCITY: ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); break; - case "6": + case ScriptBaseClass.OBJECT_OWNER: ret.Add(new LSL_String(obj.OwnerID.ToString())); break; - case "7": + case ScriptBaseClass.OBJECT_GROUP: ret.Add(new LSL_String(obj.GroupID.ToString())); break; - case "8": + case ScriptBaseClass.OBJECT_CREATOR: ret.Add(new LSL_String(obj.CreatorID.ToString())); break; } } + return ret; } } + return new LSL_List(); } -- cgit v1.1 From 18652eb87ef0613b66664059581f991448d76af4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 01:36:27 +0100 Subject: Fix physics proxy regeneration when a mesh with more than one submesh is resized Addresses http://opensimulator.org/mantis/view.php?id=5584 --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 12 ++++++++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 ++++++++- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 5 ++++- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0fbd746..fd5f1b0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2662,13 +2662,18 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetChildPart(localID); if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, part.Scale, scale); + part.IgnoreUndoUpdate = true; + if (scale.X > m_scene.m_maxNonphys) scale.X = m_scene.m_maxNonphys; if (scale.Y > m_scene.m_maxNonphys) scale.Y = m_scene.m_maxNonphys; if (scale.Z > m_scene.m_maxNonphys) scale.Z = m_scene.m_maxNonphys; + if (part.PhysActor != null && part.PhysActor.IsPhysical) { if (scale.X > m_scene.m_maxPhys) @@ -2780,7 +2785,14 @@ namespace OpenSim.Region.Framework.Scenes newSize.Z *= z; obPart.Resize(newSize); obPart.UpdateOffSet(currentpos); + + if (obPart.PhysActor != null) + { + obPart.PhysActor.Size = newSize; + m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); + } } + obPart.IgnoreUndoUpdate = false; obPart.StoreUndoState(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7604510..96dc82b8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2839,6 +2839,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { +// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); + StoreUndoState(); m_shape.Scale = scale; @@ -2976,6 +2978,11 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Sets sculpt and mesh data, and tells the physics engine to process the change. + /// + /// Texture id of the mesh. XXX: Redundant since this is also in AssetBase + /// The mesh itself. public void SculptTextureCallback(UUID textureID, AssetBase texture) { if (m_shape.SculptEntry) @@ -4613,7 +4620,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void CheckSculptAndLoad() { -// m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); +// m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); if (ParentGroup.IsDeleted) return; diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 5ca5f20..5413aa8 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -303,6 +303,10 @@ namespace OpenSim.Region.Physics.Meshing private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod) { +// m_log.DebugFormat( +// "[MESH]: Creating physics proxy for {0}, shape {1}", +// primName, (OpenMetaverse.SculptType)primShape.SculptType); + PrimMesh primMesh; PrimMesher.SculptMesh sculptMesh; @@ -668,7 +672,6 @@ namespace OpenSim.Region.Physics.Meshing // If this mesh has been created already, return it instead of creating another copy // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory - key = GetMeshKey(primShape, size, lod); if (m_uniqueMeshes.TryGetValue(key, out mesh)) return mesh; diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 27bf942..b3045bd 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2284,6 +2284,7 @@ Console.WriteLine("changeshape not need meshing"); if (value.IsFinite()) { _size = value; +// m_log.DebugFormat("[PHYSICS]: Set size on {0} to {1}", Name, value); } else { -- cgit v1.1 From da7340b9fb6a6f4468310958671f429f133e8424 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 01:42:56 +0100 Subject: If resized shape is a mesh/sculpt, leave it to the mesh asset callback to trigger the physics actor taint. In the last commit, the fix was made by updating all the child prim physics actors with the new size rather than just the root part. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fd5f1b0..9c307a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2789,7 +2789,10 @@ namespace OpenSim.Region.Framework.Scenes if (obPart.PhysActor != null) { obPart.PhysActor.Size = newSize; - m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); + + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); } } @@ -2800,7 +2803,10 @@ namespace OpenSim.Region.Framework.Scenes if (part.PhysActor != null) { part.PhysActor.Size = prevScale; - m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); + + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)part.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); } part.IgnoreUndoUpdate = false; -- cgit v1.1 From 61798793086e29eecca495b0163124fe51f1ba3c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 01:53:25 +0100 Subject: minor: remove mono compiler warnings --- .../Hypergrid/UserAgentServiceConnector.cs | 71 +++++++++++----------- 1 file changed, 36 insertions(+), 35 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 6265bcd..08a3876 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -244,6 +244,7 @@ namespace OpenSim.Services.Connectors.Hypergrid { m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); } + // Add the input arguments args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); @@ -429,7 +430,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("status_notification", paramList); - string reason = string.Empty; +// string reason = string.Empty; // Send and get reply List friendsOnline = new List(); @@ -438,17 +439,17 @@ namespace OpenSim.Services.Connectors.Hypergrid { response = request.Send(m_ServerURL, 6000); } - catch (Exception e) + catch { m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; return friendsOnline; } if (response.IsFault) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); - reason = "XMLRPC Fault"; +// reason = "XMLRPC Fault"; return friendsOnline; } @@ -460,7 +461,7 @@ namespace OpenSim.Services.Connectors.Hypergrid if (hash == null) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); - reason = "Internal error 1"; +// reason = "Internal error 1"; return friendsOnline; } @@ -476,10 +477,10 @@ namespace OpenSim.Services.Connectors.Hypergrid } } - catch (Exception e) + catch { m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; } return friendsOnline; @@ -500,7 +501,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_online_friends", paramList); - string reason = string.Empty; +// string reason = string.Empty; // Send and get reply List online = new List(); @@ -509,17 +510,17 @@ namespace OpenSim.Services.Connectors.Hypergrid { response = request.Send(m_ServerURL, 10000); } - catch (Exception e) + catch { m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; return online; } if (response.IsFault) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); - reason = "XMLRPC Fault"; +// reason = "XMLRPC Fault"; return online; } @@ -531,7 +532,7 @@ namespace OpenSim.Services.Connectors.Hypergrid if (hash == null) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); - reason = "Internal error 1"; +// reason = "Internal error 1"; return online; } @@ -547,10 +548,10 @@ namespace OpenSim.Services.Connectors.Hypergrid } } - catch (Exception e) + catch { m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; } return online; @@ -565,7 +566,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList); - string reason = string.Empty; +// string reason = string.Empty; // Send and get reply Dictionary serverURLs = new Dictionary(); @@ -574,17 +575,17 @@ namespace OpenSim.Services.Connectors.Hypergrid { response = request.Send(m_ServerURL, 10000); } - catch (Exception e) + catch { m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; return serverURLs; } if (response.IsFault) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); - reason = "XMLRPC Fault"; +// reason = "XMLRPC Fault"; return serverURLs; } @@ -596,7 +597,7 @@ namespace OpenSim.Services.Connectors.Hypergrid if (hash == null) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL); - reason = "Internal error 1"; +// reason = "Internal error 1"; return serverURLs; } @@ -611,10 +612,10 @@ namespace OpenSim.Services.Connectors.Hypergrid } } - catch (Exception e) + catch { m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; } return serverURLs; @@ -629,7 +630,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("locate_user", paramList); - string reason = string.Empty; +// string reason = string.Empty; // Send and get reply string url = string.Empty; @@ -638,17 +639,17 @@ namespace OpenSim.Services.Connectors.Hypergrid { response = request.Send(m_ServerURL, 10000); } - catch (Exception e) + catch { m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; return url; } if (response.IsFault) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); - reason = "XMLRPC Fault"; +// reason = "XMLRPC Fault"; return url; } @@ -660,7 +661,7 @@ namespace OpenSim.Services.Connectors.Hypergrid if (hash == null) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: LocateUser Got null response from {0}! THIS IS BAAAAD", m_ServerURL); - reason = "Internal error 1"; +// reason = "Internal error 1"; return url; } @@ -669,10 +670,10 @@ namespace OpenSim.Services.Connectors.Hypergrid url = hash["URL"].ToString(); } - catch (Exception e) + catch { m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; } return url; @@ -688,7 +689,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList); - string reason = string.Empty; +// string reason = string.Empty; // Send and get reply string uui = string.Empty; @@ -697,17 +698,17 @@ namespace OpenSim.Services.Connectors.Hypergrid { response = request.Send(m_ServerURL, 10000); } - catch (Exception e) + catch { m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; return uui; } if (response.IsFault) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); - reason = "XMLRPC Fault"; +// reason = "XMLRPC Fault"; return uui; } @@ -719,7 +720,7 @@ namespace OpenSim.Services.Connectors.Hypergrid if (hash == null) { m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); - reason = "Internal error 1"; +// reason = "Internal error 1"; return uui; } @@ -728,10 +729,10 @@ namespace OpenSim.Services.Connectors.Hypergrid uui = hash["UUI"].ToString(); } - catch (Exception e) + catch { m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); - reason = "Exception: " + e.Message; +// reason = "Exception: " + e.Message; } return uui; -- cgit v1.1 From 50bd48542c379f0ce0cec85eb412ded16c819434 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 02:44:00 +0100 Subject: Add very basic test for resizing a scene object with one prim --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 3 +- .../Scenes/Tests/SceneObjectResizeTests.cs | 67 ++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9c307a3..34e44e5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -617,9 +617,10 @@ namespace OpenSim.Region.Framework.Scenes finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; - return finalScale; + return finalScale; } + public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) { // We got a request from the inner_scene to raytrace along the Ray hRay diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs new file mode 100644 index 0000000..3865329 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Basic scene object resize tests + /// + [TestFixture] + public class SceneObjectResizeTests + { + /// + /// Test resizing an object + /// + [Test] + public void TestResizeSceneObject() + { + TestHelper.InMethod(); + //log4net.Config.XmlConfigurator.Configure(); + + Scene scene = SceneSetupHelpers.SetupScene(); + SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; + + g1.GroupResize(new Vector3(2, 3, 4), g1.LocalId); + + SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); + + Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2)); + Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); + Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); + } + } +} \ No newline at end of file -- cgit v1.1 From 27fae36a21ff39e9bd413a3f4a4bb544f40bb4e1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 02:53:36 +0100 Subject: remove the need to supply SceneObjectGroup.GroupResize() with a localId. This is utterly pointless scene we already know which sog we're dealing with. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 261 +++++++++++---------- .../Scenes/Tests/SceneObjectResizeTests.cs | 2 +- 3 files changed, 133 insertions(+), 132 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 7ec7ea3..0e5ffc0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1234,7 +1234,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) { - group.GroupResize(scale, localID); + group.GroupResize(scale); } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 34e44e5..f7ef0b4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2658,164 +2658,165 @@ namespace OpenSim.Region.Framework.Scenes } } - public void GroupResize(Vector3 scale, uint localID) + /// + /// Resize the entire group of prims. + /// + /// + public void GroupResize(Vector3 scale) { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { // m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, part.Scale, scale); +// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, RootPart.Scale, scale); + + RootPart.IgnoreUndoUpdate = true; - part.IgnoreUndoUpdate = true; + if (scale.X > m_scene.m_maxNonphys) + scale.X = m_scene.m_maxNonphys; + if (scale.Y > m_scene.m_maxNonphys) + scale.Y = m_scene.m_maxNonphys; + if (scale.Z > m_scene.m_maxNonphys) + scale.Z = m_scene.m_maxNonphys; - if (scale.X > m_scene.m_maxNonphys) - scale.X = m_scene.m_maxNonphys; - if (scale.Y > m_scene.m_maxNonphys) - scale.Y = m_scene.m_maxNonphys; - if (scale.Z > m_scene.m_maxNonphys) - scale.Z = m_scene.m_maxNonphys; + if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) + { + if (scale.X > m_scene.m_maxPhys) + scale.X = m_scene.m_maxPhys; + if (scale.Y > m_scene.m_maxPhys) + scale.Y = m_scene.m_maxPhys; + if (scale.Z > m_scene.m_maxPhys) + scale.Z = m_scene.m_maxPhys; + } - if (part.PhysActor != null && part.PhysActor.IsPhysical) - { - if (scale.X > m_scene.m_maxPhys) - scale.X = m_scene.m_maxPhys; - if (scale.Y > m_scene.m_maxPhys) - scale.Y = m_scene.m_maxPhys; - if (scale.Z > m_scene.m_maxPhys) - scale.Z = m_scene.m_maxPhys; - } - float x = (scale.X / part.Scale.X); - float y = (scale.Y / part.Scale.Y); - float z = (scale.Z / part.Scale.Z); + float x = (scale.X / RootPart.Scale.X); + float y = (scale.Y / RootPart.Scale.Y); + float z = (scale.Z / RootPart.Scale.Z); - SceneObjectPart[] parts; - if (x > 1.0f || y > 1.0f || z > 1.0f) + SceneObjectPart[] parts; + if (x > 1.0f || y > 1.0f || z > 1.0f) + { + parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) { - parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) + SceneObjectPart obPart = parts[i]; + if (obPart.UUID != m_rootPart.UUID) { - SceneObjectPart obPart = parts[i]; - if (obPart.UUID != m_rootPart.UUID) - { - obPart.IgnoreUndoUpdate = true; - Vector3 oldSize = new Vector3(obPart.Scale); + obPart.IgnoreUndoUpdate = true; + Vector3 oldSize = new Vector3(obPart.Scale); - float f = 1.0f; - float a = 1.0f; + float f = 1.0f; + float a = 1.0f; - if (part.PhysActor != null && part.PhysActor.IsPhysical) + if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) + { + if (oldSize.X * x > m_scene.m_maxPhys) { - if (oldSize.X * x > m_scene.m_maxPhys) - { - f = m_scene.m_maxPhys / oldSize.X; - a = f / x; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Y * y > m_scene.m_maxPhys) - { - f = m_scene.m_maxPhys / oldSize.Y; - a = f / y; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Z * z > m_scene.m_maxPhys) - { - f = m_scene.m_maxPhys / oldSize.Z; - a = f / z; - x *= a; - y *= a; - z *= a; - } + f = m_scene.m_maxPhys / oldSize.X; + a = f / x; + x *= a; + y *= a; + z *= a; } - else + if (oldSize.Y * y > m_scene.m_maxPhys) { - if (oldSize.X * x > m_scene.m_maxNonphys) - { - f = m_scene.m_maxNonphys / oldSize.X; - a = f / x; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Y * y > m_scene.m_maxNonphys) - { - f = m_scene.m_maxNonphys / oldSize.Y; - a = f / y; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Z * z > m_scene.m_maxNonphys) - { - f = m_scene.m_maxNonphys / oldSize.Z; - a = f / z; - x *= a; - y *= a; - z *= a; - } + f = m_scene.m_maxPhys / oldSize.Y; + a = f / y; + x *= a; + y *= a; + z *= a; + } + if (oldSize.Z * z > m_scene.m_maxPhys) + { + f = m_scene.m_maxPhys / oldSize.Z; + a = f / z; + x *= a; + y *= a; + z *= a; + } + } + else + { + if (oldSize.X * x > m_scene.m_maxNonphys) + { + f = m_scene.m_maxNonphys / oldSize.X; + a = f / x; + x *= a; + y *= a; + z *= a; + } + if (oldSize.Y * y > m_scene.m_maxNonphys) + { + f = m_scene.m_maxNonphys / oldSize.Y; + a = f / y; + x *= a; + y *= a; + z *= a; + } + if (oldSize.Z * z > m_scene.m_maxNonphys) + { + f = m_scene.m_maxNonphys / oldSize.Z; + a = f / z; + x *= a; + y *= a; + z *= a; } - obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); } + obPart.IgnoreUndoUpdate = false; + obPart.StoreUndoState(); } } + } - Vector3 prevScale = part.Scale; - prevScale.X *= x; - prevScale.Y *= y; - prevScale.Z *= z; - part.Resize(prevScale); + Vector3 prevScale = RootPart.Scale; + prevScale.X *= x; + prevScale.Y *= y; + prevScale.Z *= z; + RootPart.Resize(prevScale); - parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) + parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart obPart = parts[i]; + obPart.IgnoreUndoUpdate = true; + if (obPart.UUID != m_rootPart.UUID) { - SceneObjectPart obPart = parts[i]; - obPart.IgnoreUndoUpdate = true; - if (obPart.UUID != m_rootPart.UUID) + Vector3 currentpos = new Vector3(obPart.OffsetPosition); + currentpos.X *= x; + currentpos.Y *= y; + currentpos.Z *= z; + Vector3 newSize = new Vector3(obPart.Scale); + newSize.X *= x; + newSize.Y *= y; + newSize.Z *= z; + obPart.Resize(newSize); + obPart.UpdateOffSet(currentpos); + + if (obPart.PhysActor != null) { - Vector3 currentpos = new Vector3(obPart.OffsetPosition); - currentpos.X *= x; - currentpos.Y *= y; - currentpos.Z *= z; - Vector3 newSize = new Vector3(obPart.Scale); - newSize.X *= x; - newSize.Y *= y; - newSize.Z *= z; - obPart.Resize(newSize); - obPart.UpdateOffSet(currentpos); - - if (obPart.PhysActor != null) - { - obPart.PhysActor.Size = newSize; + obPart.PhysActor.Size = newSize; - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); - } + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); } - - obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); } - if (part.PhysActor != null) - { - part.PhysActor.Size = prevScale; + obPart.IgnoreUndoUpdate = false; + obPart.StoreUndoState(); + } - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)part.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); - } + if (RootPart.PhysActor != null) + { + RootPart.PhysActor.Size = prevScale; - part.IgnoreUndoUpdate = false; - part.StoreUndoState(); - HasGroupChanged = true; - m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); - ScheduleGroupForTerseUpdate(); + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)RootPart.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); } + + RootPart.IgnoreUndoUpdate = false; + RootPart.StoreUndoState(); + HasGroupChanged = true; + RootPart.TriggerScriptChangedEvent(Changed.SCALE); + ScheduleGroupForTerseUpdate(); } #endregion diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 3865329..627f294 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Scene scene = SceneSetupHelpers.SetupScene(); SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; - g1.GroupResize(new Vector3(2, 3, 4), g1.LocalId); + g1.GroupResize(new Vector3(2, 3, 4)); SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); -- cgit v1.1 From 2b339b7d2b1e860af2ea2a873797a70bc257bf6f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 02:56:54 +0100 Subject: minor: remove mono compiler warnings --- OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | 2 +- OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | 2 +- .../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index c82cfd2..d687e6a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs @@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure if (!(client.Scene is Scene)) return; - Scene scene = (Scene)(client.Scene); +// Scene scene = (Scene)(client.Scene); GridInstantMessage im = null; if (m_PendingLures.TryGetValue(lureID, out im)) diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index 079e1b6..dee0ad4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs @@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile if (!(s is Scene)) return; - Scene scene = (Scene)s; +// Scene scene = (Scene)s; string profileUrl = String.Empty; string aboutText = String.Empty; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 66fbcb9..b714f2b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -810,18 +810,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) remoteClient.SendBulkUpdateInventory(item); + return null; } - for (int i = 0 ; i < objlist.Count ; i++ ) + for (int i = 0 ; i < objlist.Count; i++) { group = objlist[i]; - Vector3 storedPosition = group.AbsolutePosition; +// Vector3 storedPosition = group.AbsolutePosition; if (group.UUID == UUID.Zero) { m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3"); } + group.RootPart.FromFolderID = item.Folder; // If it's rezzed in world, select it. Much easier to @@ -833,6 +835,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess foreach (SceneObjectPart child in group.Parts) child.CreateSelected = true; } + group.ResetIDs(); if (attachment) -- cgit v1.1 From 3fc12e72245c81075fb7a584c40aa49a10a3b458 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:02:28 +0100 Subject: Eliminate the pointless textured id argument to SculptTextureCallback --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 96dc82b8..a55e07a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1731,7 +1731,7 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart sop = (SceneObjectPart)sender; if (sop != null) - sop.SculptTextureCallback(asset.FullID, asset); + sop.SculptTextureCallback(asset); } } @@ -2979,11 +2979,10 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Sets sculpt and mesh data, and tells the physics engine to process the change. + /// Set sculpt and mesh data, and tell the physics engine to process the change. /// - /// Texture id of the mesh. XXX: Redundant since this is also in AssetBase /// The mesh itself. - public void SculptTextureCallback(UUID textureID, AssetBase texture) + public void SculptTextureCallback(AssetBase texture) { if (m_shape.SculptEntry) { @@ -3009,16 +3008,6 @@ namespace OpenSim.Region.Framework.Scenes } } -// /// -// /// -// /// -// /// -// public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) -// { -// m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); -// } - - /// /// Send a full update to the client for the given part /// @@ -4631,9 +4620,11 @@ namespace OpenSim.Region.Framework.Scenes if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero) { // check if a previously decoded sculpt map has been cached + // We don't read the file here - the meshmerizer will do that later. + // TODO: Could we simplify the meshmerizer code by reading and setting the data here? if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString()))) { - SculptTextureCallback(Shape.SculptTexture, null); + SculptTextureCallback(null); } else { -- cgit v1.1 From c82f19e41cbfcf4eb8bb3691d1653eeceaa6a8ad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:06:30 +0100 Subject: fix build break from last commit --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f7ef0b4..0b474b5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3345,7 +3345,7 @@ namespace OpenSim.Region.Framework.Scenes if (sop != null) { if (asset != null) - sop.SculptTextureCallback(asset.FullID, asset); + sop.SculptTextureCallback(asset); } } -- cgit v1.1 From 982e71b6b88ccbb884044d4b1c350b27c4877060 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:08:28 +0100 Subject: eliminate unused and redundant SceneObjectGroup.AssetReceived() --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0b474b5..8ffe84b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3333,23 +3333,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Handle an asset received asynchronously from the asset service. - /// - /// - /// - /// - protected void AssetReceived(string id, Object sender, AssetBase asset) - { - SceneObjectPart sop = (SceneObjectPart)sender; - - if (sop != null) - { - if (asset != null) - sop.SculptTextureCallback(asset); - } - } - - /// /// Set the user group to which this scene object belongs. /// /// -- cgit v1.1 From 6f9b8557192ea5fe65e4dc7416809a4d1affa954 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:16:24 +0100 Subject: refactor: remove pointless sender != null tests, etc, in AssetReceived, since the method called always belongs to the object that generated the request --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a55e07a..697dd0e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1711,7 +1711,8 @@ namespace OpenSim.Region.Framework.Scenes { if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) { - m_parentGroup.Scene.AssetService.Get(dupe.m_shape.SculptTexture.ToString(), dupe, AssetReceived); + ParentGroup.Scene.AssetService.Get( + dupe.m_shape.SculptTexture.ToString(), dupe, dupe.AssetReceived); } bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); @@ -1725,14 +1726,16 @@ namespace OpenSim.Region.Framework.Scenes return dupe; } + /// + /// Called back by asynchronous asset fetch. + /// + /// ID of asset received + /// Register + /// protected void AssetReceived(string id, Object sender, AssetBase asset) { if (asset != null) - { - SceneObjectPart sop = (SceneObjectPart)sender; - if (sop != null) - sop.SculptTextureCallback(asset); - } + SculptTextureCallback(asset); } public static SceneObjectPart Create() -- cgit v1.1 From 0f9882db5b6708864924218f713863ff7b9ded47 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:24:36 +0100 Subject: minor: add a log warning if a sculpt/mesh async asset request returns no data --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 697dd0e..5035317 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1736,6 +1736,10 @@ namespace OpenSim.Region.Framework.Scenes { if (asset != null) SculptTextureCallback(asset); + else + m_log.WarnFormat( + "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", + Name, LocalId, id); } public static SceneObjectPart Create() -- cgit v1.1 From df2a59d31b1ae21f99c1b18976b8d799b935a762 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:30:14 +0100 Subject: refactor: make SceneObjectGroup.GroupScale() a property rather than a mehod --- .../Caps/ObjectCaps/UploadObjectAssetModule.cs | 10 ++-- .../Region/Framework/Scenes/SceneObjectGroup.cs | 61 ++++++++++++---------- 2 files changed, 38 insertions(+), 33 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 15ed3b3..8189518 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs @@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden /// - /// Parses ad request + /// Parses add request /// /// /// @@ -312,11 +312,11 @@ namespace OpenSim.Region.ClientStack.Linden primFace.RepeatV = face.ScaleT; primFace.TexMapType = (MappingType) (face.MediaFlags & 6); } + pbs.TextureEntry = tmp.GetBytes(); prim.Shape = pbs; prim.Scale = obj.Scale; - SceneObjectGroup grp = new SceneObjectGroup(); grp.SetRootPart(prim); @@ -339,8 +339,8 @@ namespace OpenSim.Region.ClientStack.Linden m_scene.AddSceneObject(grp); grp.AbsolutePosition = obj.Position; } + allparts[i] = grp; - } for (int j = 1; j < allparts.Length; j++) @@ -351,7 +351,9 @@ namespace OpenSim.Region.ClientStack.Linden } rootGroup.ScheduleGroupForFullUpdate(); - pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false); + pos + = m_scene.GetNewRezLocation( + Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false); responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["content_type"] = "text/plain"; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8ffe84b..7aa7831 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -236,6 +236,38 @@ namespace OpenSim.Region.Framework.Scenes get { return m_rootPart.RotationOffset; } } + public Vector3 GroupScale + { + get + { + Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); + Vector3 maxScale = Vector3.Zero; + Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); + + SceneObjectPart[] parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + Vector3 partscale = part.Scale; + Vector3 partoffset = part.OffsetPosition; + + minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; + minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; + minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; + + maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; + maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; + maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; + } + + finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; + finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; + finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; + + return finalScale; + } + } + public UUID GroupID { get { return m_rootPart.GroupID; } @@ -592,35 +624,6 @@ namespace OpenSim.Region.Framework.Scenes //ScheduleGroupForFullUpdate(); } - public Vector3 GroupScale() - { - Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); - Vector3 maxScale = Vector3.Zero; - Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); - - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart part = parts[i]; - Vector3 partscale = part.Scale; - Vector3 partoffset = part.OffsetPosition; - - minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; - minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; - minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; - - maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; - maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; - maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; - } - - finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; - finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; - finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; - - return finalScale; - } - public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) { // We got a request from the inner_scene to raytrace along the Ray hRay -- cgit v1.1 From 4b5a6b655becd5162054bc53365fdcd9c7ed1772 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:52:30 +0100 Subject: add test for resizing one part in a group --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Scenes/Tests/SceneObjectResizeTests.cs | 35 ++++++++++++++++++++++ .../MapImage/MapImageServiceConnector.cs | 1 - 3 files changed, 36 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0e5ffc0..df6908a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1210,7 +1210,7 @@ namespace OpenSim.Region.Framework.Scenes #region Client Event handlers /// - /// + /// Update the scale of an individual prim. /// /// /// diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 627f294..95ecfc6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -63,5 +63,40 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); } + + /// + /// Test resizing an individual part in a scene object. + /// + [Test] + public void TestResizeSceneObjectPart() + { + TestHelper.InMethod(); + //log4net.Config.XmlConfigurator.Configure(); + + Scene scene = SceneSetupHelpers.SetupScene(); + + SceneObjectGroup g1 = SceneSetupHelpers.CreateSceneObject(2, UUID.Zero); + g1.RootPart.Scale = new Vector3(2, 3, 4); + g1.Parts[1].Scale = new Vector3(5, 6, 7); + + scene.AddSceneObject(g1); + + SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); + + g1Post.Resize(new Vector3(8, 9, 10), g1Post.Parts[1].LocalId); + + SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID); + + SceneObjectPart g1RootPart = g1PostPost.RootPart; + SceneObjectPart g1ChildPart = g1PostPost.Parts[1]; + + Assert.That(g1RootPart.Scale.X, Is.EqualTo(2)); + Assert.That(g1RootPart.Scale.Y, Is.EqualTo(3)); + Assert.That(g1RootPart.Scale.Z, Is.EqualTo(4)); + + Assert.That(g1ChildPart.Scale.X, Is.EqualTo(8)); + Assert.That(g1ChildPart.Scale.Y, Is.EqualTo(9)); + Assert.That(g1ChildPart.Scale.Z, Is.EqualTo(10)); + } } } \ No newline at end of file diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs index 520d639..69e2d17 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs @@ -50,7 +50,6 @@ namespace OpenSim.Services.Connectors MethodBase.GetCurrentMethod().DeclaringType); private string m_ServerURI = String.Empty; - private IImprovedAssetCache m_Cache = null; public MapImageServicesConnector() { -- cgit v1.1 From 2b68ac4ba31205a55f53f1b69629dd9ebbd66ef6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 04:22:57 +0100 Subject: refactor: Push all part resize code down into SceneObjectPart.Resize() --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 9 ++-- .../Region/Framework/Scenes/SceneObjectGroup.cs | 50 ---------------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 27 +++++++++++- .../Scenes/Tests/SceneObjectResizeTests.cs | 2 +- 4 files changed, 32 insertions(+), 56 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index df6908a..00d25c2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1217,12 +1217,13 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) { - SceneObjectGroup group = GetGroupByPrim(localID); - if (group != null) + SceneObjectPart part = GetSceneObjectPart(localID); + + if (part != null) { - if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) { - group.Resize(scale, localID); + part.Resize(scale); } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7aa7831..477b3e3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2612,56 +2612,6 @@ namespace OpenSim.Region.Framework.Scenes #region Resize /// - /// Resize the given part - /// - /// - /// - public void Resize(Vector3 scale, uint localID) - { - if (scale.X > m_scene.m_maxNonphys) - scale.X = m_scene.m_maxNonphys; - if (scale.Y > m_scene.m_maxNonphys) - scale.Y = m_scene.m_maxNonphys; - if (scale.Z > m_scene.m_maxNonphys) - scale.Z = m_scene.m_maxNonphys; - - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - part.Resize(scale); - if (part.PhysActor != null) - { - if (part.PhysActor.IsPhysical) - { - if (scale.X > m_scene.m_maxPhys) - scale.X = m_scene.m_maxPhys; - if (scale.Y > m_scene.m_maxPhys) - scale.Y = m_scene.m_maxPhys; - if (scale.Z > m_scene.m_maxPhys) - scale.Z = m_scene.m_maxPhys; - } - part.PhysActor.Size = scale; - m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); - } - //if (part.UUID != m_rootPart.UUID) - - HasGroupChanged = true; - part.TriggerScriptChangedEvent(Changed.SCALE); - ScheduleGroupForFullUpdate(); - - //if (part.UUID == m_rootPart.UUID) - //{ - //if (m_rootPart.PhysActor != null) - //{ - //m_rootPart.PhysActor.Size = - //new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); - //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); - //} - //} - } - } - - /// /// Resize the entire group of prims. /// /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5035317..ffde68e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2846,6 +2846,13 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { + if (scale.X > ParentGroup.Scene.m_maxNonphys) + scale.X = ParentGroup.Scene.m_maxNonphys; + if (scale.Y > ParentGroup.Scene.m_maxNonphys) + scale.Y = ParentGroup.Scene.m_maxNonphys; + if (scale.Z > ParentGroup.Scene.m_maxNonphys) + scale.Z = ParentGroup.Scene.m_maxNonphys; + // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); StoreUndoState(); @@ -2855,9 +2862,27 @@ namespace OpenSim.Region.Framework.Scenes // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to // save memory if (PhysActor != null) - CheckSculptAndLoad(); + { + if (PhysActor.IsPhysical) + { + if (scale.X > ParentGroup.Scene.m_maxPhys) + scale.X = ParentGroup.Scene.m_maxPhys; + if (scale.Y > ParentGroup.Scene.m_maxPhys) + scale.Y = ParentGroup.Scene.m_maxPhys; + if (scale.Z > ParentGroup.Scene.m_maxPhys) + scale.Z = ParentGroup.Scene.m_maxPhys; + } + + PhysActor.Size = scale; + + if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) + CheckSculptAndLoad(); + else + ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + } ParentGroup.HasGroupChanged = true; + TriggerScriptChangedEvent(Changed.SCALE); ScheduleFullUpdate(); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 95ecfc6..7ec36b8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); - g1Post.Resize(new Vector3(8, 9, 10), g1Post.Parts[1].LocalId); + g1Post.Parts[1].Resize(new Vector3(8, 9, 10)); SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID); -- cgit v1.1 From 122745fe1c17ff0862f5a0cb2f97e8abf8d67cb6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 04:28:49 +0100 Subject: refactor: replace scale limiting code with more elegant Math.Min calls --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ffde68e..f5b8daf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2846,12 +2846,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { - if (scale.X > ParentGroup.Scene.m_maxNonphys) - scale.X = ParentGroup.Scene.m_maxNonphys; - if (scale.Y > ParentGroup.Scene.m_maxNonphys) - scale.Y = ParentGroup.Scene.m_maxNonphys; - if (scale.Z > ParentGroup.Scene.m_maxNonphys) - scale.Z = ParentGroup.Scene.m_maxNonphys; + scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); + scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); + scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); @@ -2865,12 +2862,9 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysActor.IsPhysical) { - if (scale.X > ParentGroup.Scene.m_maxPhys) - scale.X = ParentGroup.Scene.m_maxPhys; - if (scale.Y > ParentGroup.Scene.m_maxPhys) - scale.Y = ParentGroup.Scene.m_maxPhys; - if (scale.Z > ParentGroup.Scene.m_maxPhys) - scale.Z = ParentGroup.Scene.m_maxPhys; + scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); } PhysActor.Size = scale; -- cgit v1.1 From 9a80adf33ae0d255d923d33f5b6abac540efcd52 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 04:49:21 +0100 Subject: remove now unncessary parts of SceneObjectGroup.Resize() --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 26 +++++----------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 477b3e3..7662874 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2611,6 +2611,7 @@ namespace OpenSim.Region.Framework.Scenes #region Resize + /// /// Resize the entire group of prims. /// @@ -2712,6 +2713,7 @@ namespace OpenSim.Region.Framework.Scenes z *= a; } } + obPart.IgnoreUndoUpdate = false; obPart.StoreUndoState(); } @@ -2729,47 +2731,29 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart obPart = parts[i]; obPart.IgnoreUndoUpdate = true; + if (obPart.UUID != m_rootPart.UUID) { Vector3 currentpos = new Vector3(obPart.OffsetPosition); currentpos.X *= x; currentpos.Y *= y; currentpos.Z *= z; + Vector3 newSize = new Vector3(obPart.Scale); newSize.X *= x; newSize.Y *= y; newSize.Z *= z; + obPart.Resize(newSize); obPart.UpdateOffSet(currentpos); - - if (obPart.PhysActor != null) - { - obPart.PhysActor.Size = newSize; - - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); - } } obPart.IgnoreUndoUpdate = false; obPart.StoreUndoState(); } - if (RootPart.PhysActor != null) - { - RootPart.PhysActor.Size = prevScale; - - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)RootPart.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); - } - RootPart.IgnoreUndoUpdate = false; RootPart.StoreUndoState(); - HasGroupChanged = true; - RootPart.TriggerScriptChangedEvent(Changed.SCALE); - ScheduleGroupForTerseUpdate(); } #endregion -- cgit v1.1 From f5ddf37112d4881243e3350d5df898c6b2bb02ae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 05:23:21 +0100 Subject: Replace ifs in SOG.GroupResize() with Math.Min() Also fiddle a bit with undo. This is not currently working properly, though to be fair it also didn't appear to work in 0.7.1.1 either (at least for resize). Will get some more attention soon. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 1 + OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 20 +++++++------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 00d25c2..bdb7f95 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -569,6 +569,7 @@ namespace OpenSim.Region.Framework.Scenes if (primId != UUID.Zero) { SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); + if (part != null) part.Redo(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7662874..ce5db5f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2623,21 +2623,15 @@ namespace OpenSim.Region.Framework.Scenes RootPart.IgnoreUndoUpdate = true; - if (scale.X > m_scene.m_maxNonphys) - scale.X = m_scene.m_maxNonphys; - if (scale.Y > m_scene.m_maxNonphys) - scale.Y = m_scene.m_maxNonphys; - if (scale.Z > m_scene.m_maxNonphys) - scale.Z = m_scene.m_maxNonphys; + scale.X = Math.Min(scale.X, Scene.m_maxNonphys); + scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); + scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) { - if (scale.X > m_scene.m_maxPhys) - scale.X = m_scene.m_maxPhys; - if (scale.Y > m_scene.m_maxPhys) - scale.Y = m_scene.m_maxPhys; - if (scale.Z > m_scene.m_maxPhys) - scale.Z = m_scene.m_maxPhys; + scale.X = Math.Min(scale.X, Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); } float x = (scale.X / RootPart.Scale.X); @@ -2715,7 +2709,6 @@ namespace OpenSim.Region.Framework.Scenes } obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); } } } @@ -2753,6 +2746,7 @@ namespace OpenSim.Region.Framework.Scenes } RootPart.IgnoreUndoUpdate = false; + RootPart.StoreUndoState(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f5b8daf..6b9607c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3687,6 +3687,8 @@ namespace OpenSim.Region.Framework.Scenes { if (m_parentGroup != null) { +// m_log.DebugFormat("[SCENE OBJECT PART]: Storing undo state for {0} {1}", Name, LocalId); + lock (m_undo) { if (m_undo.Count > 0) @@ -3705,11 +3707,18 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); } - } } } +// else +// { +// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); +// } } +// else +// { +// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); +// } } public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) @@ -4179,11 +4188,14 @@ namespace OpenSim.Region.Framework.Scenes if (m_undo.Count > 0) { UndoState nUndo = null; + if (m_parentGroup.GetSceneMaxUndo() > 0) { nUndo = new UndoState(this); } + UndoState goback = m_undo.Pop(); + if (goback != null) { goback.PlaybackState(this); @@ -4196,6 +4208,8 @@ namespace OpenSim.Region.Framework.Scenes public void Redo() { +// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId); + lock (m_redo) { if (m_parentGroup.GetSceneMaxUndo() > 0) @@ -4204,7 +4218,9 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); } + UndoState gofwd = m_redo.Pop(); + if (gofwd != null) gofwd.PlayfwdState(this); } -- cgit v1.1 From dd2564d7ecd4fa628daaacfd612c1a8c3e0ef309 Mon Sep 17 00:00:00 2001 From: Marck Date: Thu, 30 Jun 2011 20:05:02 +0200 Subject: refactor: Pull up Assembly of the SQLite classes as a protected property, so that it can be overwritten in subclasses. That way extensions can decide in which assembly migration resources should be looked up. This is a refactor similar to commit 9923a2ff1002d722ccebea8bf4d71718ed4e2a03 for MySQL -- no functional changes. --- OpenSim/Data/SQLite/SQLiteAssetData.cs | 8 ++++++-- OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | 7 ++++++- OpenSim/Data/SQLite/SQLiteEstateData.cs | 8 ++++++-- OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | 10 +++++++--- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 8 ++++++-- OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 2 +- 6 files changed, 32 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 5b71897..bb23fc1 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -57,6 +57,11 @@ namespace OpenSim.Data.SQLite private SqliteConnection m_conn; + protected virtual Assembly Assembly + { + get { return GetType().Assembly; } + } + override public void Dispose() { if (m_conn != null) @@ -83,8 +88,7 @@ namespace OpenSim.Data.SQLite m_conn = new SqliteConnection(dbconnect); m_conn.Open(); - Assembly assem = GetType().Assembly; - Migration m = new Migration(m_conn, assem, "AssetStore"); + Migration m = new Migration(m_conn, Assembly, "AssetStore"); m.Update(); return; diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs index c3b65bb..f51aa28 100644 --- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs @@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite protected static SqliteConnection m_Connection; private static bool m_initialized = false; + protected virtual Assembly Assembly + { + get { return GetType().Assembly; } + } + public SQLiteAuthenticationData(string connectionString, string realm) : base(connectionString) { @@ -63,7 +68,7 @@ namespace OpenSim.Data.SQLite m_Connection = new SqliteConnection(connectionString); m_Connection.Open(); - Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore"); + Migration m = new Migration(m_Connection, Assembly, "AuthStore"); m.Update(); m_initialized = true; diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 2f05a6e..65719a6 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite private Dictionary m_FieldMap = new Dictionary(); + protected virtual Assembly Assembly + { + get { return GetType().Assembly; } + } + public SQLiteEstateStore() { } @@ -71,8 +76,7 @@ namespace OpenSim.Data.SQLite m_connection = new SqliteConnection(m_connectionString); m_connection.Open(); - Assembly assem = GetType().Assembly; - Migration m = new Migration(m_connection, assem, "EstateStore"); + Migration m = new Migration(m_connection, Assembly, "EstateStore"); m.Update(); //m_connection.Close(); diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs index 0d7ae1f..4f977a8 100644 --- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs +++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs @@ -55,6 +55,11 @@ namespace OpenSim.Data.SQLite protected static SqliteConnection m_Connection; private static bool m_initialized; + protected virtual Assembly Assembly + { + get { return GetType().Assembly; } + } + public SQLiteGenericTableHandler(string connectionString, string realm, string storeName) : base(connectionString) { @@ -68,13 +73,12 @@ namespace OpenSim.Data.SQLite if (storeName != String.Empty) { - Assembly assem = GetType().Assembly; //SqliteConnection newConnection = // (SqliteConnection)((ICloneable)m_Connection).Clone(); //newConnection.Open(); - //Migration m = new Migration(newConnection, assem, storeName); - Migration m = new Migration(m_Connection, assem, storeName); + //Migration m = new Migration(newConnection, Assembly, storeName); + Migration m = new Migration(m_Connection, Assembly, storeName); m.Update(); //newConnection.Close(); //newConnection.Dispose(); diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 377c680..5618772 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -74,6 +74,11 @@ namespace OpenSim.Data.SQLite private String m_connectionString; + protected virtual Assembly Assembly + { + get { return GetType().Assembly; } + } + public SQLiteSimulationData() { } @@ -132,8 +137,7 @@ namespace OpenSim.Data.SQLite SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); // This actually does the roll forward assembly stuff - Assembly assem = GetType().Assembly; - Migration m = new Migration(m_conn, assem, "RegionStore"); + Migration m = new Migration(m_conn, Assembly, "RegionStore"); m.Update(); lock (ds) diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 02edc30..16f9046 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -41,7 +41,7 @@ using OpenSim.Framework; namespace OpenSim.Data.SQLite { /// - /// A MySQL Interface for the Asset Server + /// A SQLite Interface for the Asset Server /// public class SQLiteXInventoryData : IXInventoryData { -- cgit v1.1 From e9a739f45fdc464b19ad520c3efcb202d8bd5458 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 18 Jul 2011 01:33:57 +0100 Subject: refactor: group all the undo/redo code in SOP into one place for easier code reading --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 121 +++++++++++---------- 1 file changed, 62 insertions(+), 59 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6b9607c..253326e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -414,7 +414,6 @@ namespace OpenSim.Region.Framework.Scenes CreateSelected = true; TrimPermissions(); - //m_undo = new UndoStack(ParentGroup.GetSceneMaxUndo()); m_inventory = new SceneObjectPartInventory(this); } @@ -1621,19 +1620,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void ClearUndoState() - { - lock (m_undo) - { - m_undo.Clear(); - } - lock (m_redo) - { - m_redo.Clear(); - } - StoreUndoState(); - } - public byte ConvertScriptUintToByte(uint indata) { byte outdata = (byte)TextureAnimFlags.NONE; @@ -3721,6 +3707,68 @@ namespace OpenSim.Region.Framework.Scenes // } } + public void Undo() + { +// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId); + + lock (m_undo) + { + if (m_undo.Count > 0) + { + UndoState nUndo = null; + + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + nUndo = new UndoState(this); + } + + UndoState goback = m_undo.Pop(); + + if (goback != null) + { + goback.PlaybackState(this); + if (nUndo != null) + m_redo.Push(nUndo); + } + } + } + } + + public void Redo() + { +// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId); + + lock (m_redo) + { + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this); + + m_undo.Push(nUndo); + } + + UndoState gofwd = m_redo.Pop(); + + if (gofwd != null) + gofwd.PlayfwdState(this); + } + } + + public void ClearUndoState() + { + lock (m_undo) + { + m_undo.Clear(); + } + + lock (m_redo) + { + m_redo.Clear(); + } + + StoreUndoState(); + } + public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) { // In this case we're using a sphere with a radius of the largest dimension of the prim @@ -4181,51 +4229,6 @@ namespace OpenSim.Region.Framework.Scenes _nextOwnerMask &= (uint)PermissionMask.All; } - public void Undo() - { - lock (m_undo) - { - if (m_undo.Count > 0) - { - UndoState nUndo = null; - - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - nUndo = new UndoState(this); - } - - UndoState goback = m_undo.Pop(); - - if (goback != null) - { - goback.PlaybackState(this); - if (nUndo != null) - m_redo.Push(nUndo); - } - } - } - } - - public void Redo() - { -// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId); - - lock (m_redo) - { - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this); - - m_undo.Push(nUndo); - } - - UndoState gofwd = m_redo.Pop(); - - if (gofwd != null) - gofwd.PlayfwdState(this); - } - } - public void UpdateExtraParam(ushort type, bool inUse, byte[] data) { m_shape.ReadInUpdateExtraParam(type, inUse, data); -- cgit v1.1 From 3f8e571b7887758514645c46b2b26d7c3fc82e45 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 18 Jul 2011 02:01:12 +0100 Subject: Use a standard generic system stack for the undo/redo stacks instead of our own homebrew. system stack also uses an array, so no performance penalty. Also exposes undo count and adds a test assertion for correct undo count after resize --- OpenSim/Framework/UndoStack.cs | 40 +++++++++++++++++++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 +++++++-- .../Scenes/Tests/SceneObjectResizeTests.cs | 2 ++ 3 files changed, 55 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs index fde63b1..8f8849d 100644 --- a/OpenSim/Framework/UndoStack.cs +++ b/OpenSim/Framework/UndoStack.cs @@ -45,59 +45,96 @@ namespace OpenSim.Framework m_Undos = new T[capacity + 1]; } + /// + /// Is the stack full? + /// public bool IsFull { - get { return m_new == m_old; } + get + { + // If the old and new pointers are in the same place then all stack slots are occupied. + return m_new == m_old; + } } + /// + /// Capacity of the stack. + /// public int Capacity { get { return m_Undos.Length - 1; } } + /// + /// Return the number of undos on the stack. + /// public int Count { get { int count = m_new - m_old - 1; + if (count < 0) count += m_Undos.Length; + return count; } } + /// + /// Push a new undo onto the stack. + /// + /// public void Push(T item) { if (IsFull) { m_old++; + if (m_old >= m_Undos.Length) m_old -= m_Undos.Length; } + if (++m_new >= m_Undos.Length) m_new -= m_Undos.Length; + m_Undos[m_new] = item; } + /// + /// Pop and item from the top of the undo stack. + /// + /// public T Pop() { if (Count > 0) { T deleted = m_Undos[m_new]; m_Undos[m_new--] = default(T); + if (m_new < 0) m_new += m_Undos.Length; + return deleted; } else + { throw new InvalidOperationException("Cannot pop from empty stack"); + } } + /// + /// Peek at the undo on the top of the stack. + /// + /// public T Peek() { return m_Undos[m_new]; } + /// + /// Clear the stack. + /// public void Clear() { if (Count > 0) @@ -106,6 +143,7 @@ namespace OpenSim.Framework { m_Undos[i] = default(T); } + m_new = 1; m_old = 0; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 253326e..a1200ee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -287,8 +287,8 @@ namespace OpenSim.Region.Framework.Scenes private string m_sitAnimation = "SIT"; private string m_text = String.Empty; private string m_touchName = String.Empty; - private readonly UndoStack m_undo = new UndoStack(5); - private readonly UndoStack m_redo = new UndoStack(5); + private readonly Stack m_undo = new Stack(5); + private readonly Stack m_redo = new Stack(5); private UUID _creatorID; private bool m_passTouches; @@ -3707,6 +3707,18 @@ namespace OpenSim.Region.Framework.Scenes // } } + /// + /// Return number of undos on the stack. Here temporarily pending a refactor. + /// + public int UndoCount + { + get + { + lock (m_undo) + return m_undo.Count; + } + } + public void Undo() { // m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 7ec36b8..6dbac3c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -62,6 +62,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2)); Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); + + Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1)); } /// -- cgit v1.1 From aec3b58a5775b70de278c950f300a0f7e6787ec2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 18 Jul 2011 02:06:06 +0100 Subject: use standard sdk stack in terrain model rather than OpenSim.Framework.UndoStack. remove OpenSim.Framework.UndoStack --- OpenSim/Framework/UndoStack.cs | 152 --------------------- .../CoreModules/World/Terrain/TerrainModule.cs | 2 +- 2 files changed, 1 insertion(+), 153 deletions(-) delete mode 100644 OpenSim/Framework/UndoStack.cs (limited to 'OpenSim') diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs deleted file mode 100644 index 8f8849d..0000000 --- a/OpenSim/Framework/UndoStack.cs +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Framework -{ - /// - /// Undo stack. Deletes entries beyond a certain capacity - /// - /// - [Serializable] - public class UndoStack - { - private int m_new = 1; - private int m_old = 0; - private T[] m_Undos; - - public UndoStack(int capacity) - { - m_Undos = new T[capacity + 1]; - } - - /// - /// Is the stack full? - /// - public bool IsFull - { - get - { - // If the old and new pointers are in the same place then all stack slots are occupied. - return m_new == m_old; - } - } - - /// - /// Capacity of the stack. - /// - public int Capacity - { - get { return m_Undos.Length - 1; } - } - - /// - /// Return the number of undos on the stack. - /// - public int Count - { - get - { - int count = m_new - m_old - 1; - - if (count < 0) - count += m_Undos.Length; - - return count; - } - } - - /// - /// Push a new undo onto the stack. - /// - /// - public void Push(T item) - { - if (IsFull) - { - m_old++; - - if (m_old >= m_Undos.Length) - m_old -= m_Undos.Length; - } - - if (++m_new >= m_Undos.Length) - m_new -= m_Undos.Length; - - m_Undos[m_new] = item; - } - - /// - /// Pop and item from the top of the undo stack. - /// - /// - public T Pop() - { - if (Count > 0) - { - T deleted = m_Undos[m_new]; - m_Undos[m_new--] = default(T); - - if (m_new < 0) - m_new += m_Undos.Length; - - return deleted; - } - else - { - throw new InvalidOperationException("Cannot pop from empty stack"); - } - } - - /// - /// Peek at the undo on the top of the stack. - /// - /// - public T Peek() - { - return m_Undos[m_new]; - } - - /// - /// Clear the stack. - /// - public void Clear() - { - if (Count > 0) - { - for (int i = 0; i < m_Undos.Length; i++) - { - m_Undos[i] = default(T); - } - - m_new = 1; - m_old = 0; - } - } - } -} diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 9c7b2fa..c832520 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain private ITerrainChannel m_revert; private Scene m_scene; private volatile bool m_tainted; - private readonly UndoStack m_undo = new UndoStack(5); + private readonly Stack m_undo = new Stack(5); #region ICommandableModule Members -- cgit v1.1 From 6fc74b36d1d0f7dcd6f013893c3189a3f989431c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 18 Jul 2011 04:54:21 +0100 Subject: Make various tweaks to undo code in an effort to get things working better. Undo rotation and position appear to be working. Resizing a single prim appears to be working, though the undo has to be done twice. Resizing a group of prims still does not work properly - possibly because in the UndoState we don't store a knowledge of when we're resizing a whole group rather than individual prims. This needs to be addressed. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 ++++++- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 1 + .../Region/Framework/Scenes/SceneObjectGroup.cs | 58 +++++++++++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 92 +++++++++++++-------- .../Scenes/Tests/SceneObjectResizeTests.cs | 2 +- OpenSim/Region/Framework/Scenes/UndoState.cs | 93 ++++++++++++++++++++-- 6 files changed, 217 insertions(+), 56 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8414f8b..fa35bd8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11242,6 +11242,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { + // Do this once since fetch parts creates a new array. + SceneObjectPart[] parts = part.ParentGroup.Parts; + for (int j = 0; j < parts.Length; j++) + { + part.StoreUndoState(); + parts[j].IgnoreUndoUpdate = true; + } + // UUID partId = part.UUID; UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; @@ -11257,6 +11265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdatePrimSinglePosition(localId, pos1, this); } break; + case 2: Quaternion rot1 = new Quaternion(block.Data, 0, true); @@ -11267,6 +11276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdatePrimSingleRotation(localId, rot1, this); } break; + case 3: Vector3 rotPos = new Vector3(block.Data, 0); Quaternion rot2 = new Quaternion(block.Data, 12, true); @@ -11279,6 +11289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); } break; + case 4: case 20: Vector3 scale4 = new Vector3(block.Data, 0); @@ -11290,8 +11301,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdatePrimScale(localId, scale4, this); } break; - case 5: + case 5: Vector3 scale1 = new Vector3(block.Data, 12); Vector3 pos11 = new Vector3(block.Data, 0); @@ -11308,6 +11319,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; + case 9: Vector3 pos2 = new Vector3(block.Data, 0); @@ -11315,10 +11327,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerUpdateVector != null) { - handlerUpdateVector(localId, pos2, this); } break; + case 10: Quaternion rot3 = new Quaternion(block.Data, 0, true); @@ -11329,6 +11341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdatePrimRotation(localId, rot3, this); } break; + case 11: Vector3 pos3 = new Vector3(block.Data, 0); Quaternion rot4 = new Quaternion(block.Data, 12, true); @@ -11352,6 +11365,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdatePrimGroupScale(localId, scale7, this); } break; + case 13: Vector3 scale2 = new Vector3(block.Data, 12); Vector3 pos4 = new Vector3(block.Data, 0); @@ -11371,6 +11385,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; + case 29: Vector3 scale5 = new Vector3(block.Data, 12); Vector3 pos5 = new Vector3(block.Data, 0); @@ -11388,6 +11403,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; + case 21: Vector3 scale6 = new Vector3(block.Data, 12); Vector3 pos6 = new Vector3(block.Data, 0); @@ -11404,13 +11420,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; + default: - m_log.Debug("[CLIENT] MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); + m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); break; } + + for (int j = 0; j < parts.Length; j++) + parts[j].IgnoreUndoUpdate = false; } } } + return true; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index bdb7f95..0a0bde8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -564,6 +564,7 @@ namespace OpenSim.Region.Framework.Scenes part.Undo(); } } + protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) { if (primId != UUID.Zero) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ce5db5f..7254992 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1145,6 +1145,10 @@ namespace OpenSim.Region.Framework.Scenes public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Processing OnGrabPart for {0} on {1} {2}, offsetPos {3}", +// remoteClient.Name, part.Name, part.LocalId, offsetPos); + part.StoreUndoState(); part.OnGrab(offsetPos, remoteClient); } @@ -2611,17 +2615,14 @@ namespace OpenSim.Region.Framework.Scenes #region Resize - /// /// Resize the entire group of prims. /// /// public void GroupResize(Vector3 scale) { -// m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, RootPart.Scale, scale); - - RootPart.IgnoreUndoUpdate = true; +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); scale.X = Math.Min(scale.X, Scene.m_maxNonphys); scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); @@ -2647,7 +2648,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart obPart = parts[i]; if (obPart.UUID != m_rootPart.UUID) { - obPart.IgnoreUndoUpdate = true; +// obPart.IgnoreUndoUpdate = true; Vector3 oldSize = new Vector3(obPart.Scale); float f = 1.0f; @@ -2663,6 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Y * y > m_scene.m_maxPhys) { f = m_scene.m_maxPhys / oldSize.Y; @@ -2671,6 +2673,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Z * z > m_scene.m_maxPhys) { f = m_scene.m_maxPhys / oldSize.Z; @@ -2690,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Y * y > m_scene.m_maxNonphys) { f = m_scene.m_maxNonphys / oldSize.Y; @@ -2698,6 +2702,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Z * z > m_scene.m_maxNonphys) { f = m_scene.m_maxNonphys / oldSize.Z; @@ -2708,7 +2713,7 @@ namespace OpenSim.Region.Framework.Scenes } } - obPart.IgnoreUndoUpdate = false; +// obPart.IgnoreUndoUpdate = false; } } } @@ -2723,7 +2728,7 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; - obPart.IgnoreUndoUpdate = true; +// obPart.IgnoreUndoUpdate = true; if (obPart.UUID != m_rootPart.UUID) { @@ -2738,16 +2743,18 @@ namespace OpenSim.Region.Framework.Scenes newSize.Z *= z; obPart.Resize(newSize); + + obPart.IgnoreUndoUpdate = true; obPart.UpdateOffSet(currentpos); + obPart.IgnoreUndoUpdate = false; } - obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); +// obPart.IgnoreUndoUpdate = false; +// obPart.StoreUndoState(); } - RootPart.IgnoreUndoUpdate = false; - - RootPart.StoreUndoState(); +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale); } #endregion @@ -2760,6 +2767,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupPosition(Vector3 pos) { +// m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2805,6 +2814,9 @@ namespace OpenSim.Region.Framework.Scenes if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); + if (part.UUID == m_rootPart.UUID) { UpdateRootPosition(pos); @@ -2824,6 +2836,9 @@ namespace OpenSim.Region.Framework.Scenes /// private void UpdateRootPosition(Vector3 pos) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2868,6 +2883,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupRotationR(Quaternion rot) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2892,6 +2910,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2926,6 +2947,9 @@ namespace OpenSim.Region.Framework.Scenes if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot); + if (part.UUID == m_rootPart.UUID) { UpdateRootRotation(rot); @@ -2947,6 +2971,10 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetChildPart(localID); if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}", +// part.Name, part.LocalId, rot); + if (part.UUID == m_rootPart.UUID) { UpdateRootRotation(rot); @@ -2969,6 +2997,10 @@ namespace OpenSim.Region.Framework.Scenes /// private void UpdateRootRotation(Quaternion rot) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", +// Name, LocalId, rot); + Quaternion axRot = rot; Quaternion oldParentRot = m_rootPart.RotationOffset; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a1200ee..aab83b8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1014,15 +1014,19 @@ namespace OpenSim.Region.Framework.Scenes get { return m_shape; } set { m_shape = value; } } - + + /// + /// Change the scale of this part. + /// public Vector3 Scale { get { return m_shape.Scale; } set { - StoreUndoState(); if (m_shape != null) { + StoreUndoState(); + m_shape.Scale = value; PhysicsActor actor = PhysActor; @@ -1033,11 +1037,16 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup.Scene.PhysicsScene != null) { actor.Size = m_shape.Scale; - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); + + if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) + CheckSculptAndLoad(); + else + ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); } } } } + TriggerScriptChangedEvent(Changed.SCALE); } } @@ -2827,8 +2836,12 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Resize this part. + /// Set the scale of this part. /// + /// + /// Unlike the scale property, this checks the new size against scene limits and schedules a full property + /// update to viewers. + /// /// public void Resize(Vector3 scale) { @@ -2836,33 +2849,18 @@ namespace OpenSim.Region.Framework.Scenes scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); -// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); - - StoreUndoState(); - m_shape.Scale = scale; - - // If we're a mesh/sculpt, then we need to tell the physics engine about our new size. To do this, we - // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to - // save memory - if (PhysActor != null) + if (PhysActor != null && PhysActor.IsPhysical) { - if (PhysActor.IsPhysical) - { - scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); - scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); - scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); - } + scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); + } - PhysActor.Size = scale; +// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); - if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) - CheckSculptAndLoad(); - else - ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); - } + Scale = scale; ParentGroup.HasGroupChanged = true; - TriggerScriptChangedEvent(Changed.SCALE); ScheduleFullUpdate(); } @@ -3673,8 +3671,6 @@ namespace OpenSim.Region.Framework.Scenes { if (m_parentGroup != null) { -// m_log.DebugFormat("[SCENE OBJECT PART]: Storing undo state for {0} {1}", Name, LocalId); - lock (m_undo) { if (m_undo.Count > 0) @@ -3683,15 +3679,29 @@ namespace OpenSim.Region.Framework.Scenes if (last != null) { if (last.Compare(this)) + { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", +// Name, LocalId, m_undo.Count); + return; + } } } +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, initial stack size {2}", +// Name, LocalId, m_undo.Count); + if (m_parentGroup.GetSceneMaxUndo() > 0) { UndoState nUndo = new UndoState(this); m_undo.Push(nUndo); + +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}", +// Name, LocalId, m_undo.Count); } } } @@ -3703,7 +3713,8 @@ namespace OpenSim.Region.Framework.Scenes } // else // { -// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); // } } @@ -3721,10 +3732,12 @@ namespace OpenSim.Region.Framework.Scenes public void Undo() { -// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId); - lock (m_undo) { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", +// Name, LocalId, m_undo.Count); + if (m_undo.Count > 0) { UndoState nUndo = null; @@ -3739,19 +3752,26 @@ namespace OpenSim.Region.Framework.Scenes if (goback != null) { goback.PlaybackState(this); + if (nUndo != null) m_redo.Push(nUndo); } } + +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}", +// Name, LocalId, m_undo.Count); } } public void Redo() { -// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId); - lock (m_redo) { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", +// Name, LocalId, m_redo.Count); + if (m_parentGroup.GetSceneMaxUndo() > 0) { UndoState nUndo = new UndoState(this); @@ -3763,11 +3783,17 @@ namespace OpenSim.Region.Framework.Scenes if (gofwd != null) gofwd.PlayfwdState(this); + +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", +// Name, LocalId, m_redo.Count); } } public void ClearUndoState() { +// m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId); + lock (m_undo) { m_undo.Clear(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 6dbac3c..c4047ee 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestResizeSceneObject() { TestHelper.InMethod(); - //log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneSetupHelpers.SetupScene(); SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 55e407e..38bbeb0 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -25,6 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; +using System.Reflection; +using log4net; using OpenMetaverse; using OpenSim.Region.Framework.Interfaces; @@ -32,49 +35,80 @@ namespace OpenSim.Region.Framework.Scenes { public class UndoState { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public Vector3 Position = Vector3.Zero; public Vector3 Scale = Vector3.Zero; public Quaternion Rotation = Quaternion.Identity; + /// + /// Constructor. + /// + /// public UndoState(SceneObjectPart part) { if (part != null) { if (part.ParentID == 0) { +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo position {0} for root part", part.ParentGroup.AbsolutePosition); Position = part.ParentGroup.AbsolutePosition; + +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo rotation {0} for root part", part.RotationOffset); Rotation = part.RotationOffset; + +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale); Scale = part.Shape.Scale; } else { +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo position {0} for child part", part.OffsetPosition); Position = part.OffsetPosition; + +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo rotation {0} for child part", part.RotationOffset); Rotation = part.RotationOffset; + +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo scale {0} for child part", part.Shape.Scale); Scale = part.Shape.Scale; } } } + /// + /// Compare the relevant state in the given part to this state. + /// + /// + /// true if both the part's position, rotation and scale match those in this undo state. False otherwise. public bool Compare(SceneObjectPart part) { if (part != null) { if (part.ParentID == 0) { - if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation) + if (Position == part.ParentGroup.AbsolutePosition + && Rotation == part.RotationOffset + && Scale == part.Shape.Scale) return true; else return false; } else { - if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale) + if (Position == part.OffsetPosition + && Rotation == part.RotationOffset + && Scale == part.Shape.Scale) return true; else return false; - } } + return false; } @@ -87,24 +121,64 @@ namespace OpenSim.Region.Framework.Scenes if (part.ParentID == 0) { if (Position != Vector3.Zero) + { +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing position {0} to {1} for root part {2} {3}", +// part.ParentGroup.AbsolutePosition, Position, part.Name, part.LocalId); + part.ParentGroup.AbsolutePosition = Position; + } + +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", +// part.RotationOffset, Rotation, part.Name, part.LocalId); + part.RotationOffset = Rotation; + if (Scale != Vector3.Zero) + { +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", +// part.Shape.Scale, Scale, part.Name, part.LocalId); + part.Resize(Scale); + } + part.ParentGroup.ScheduleGroupForTerseUpdate(); } else { if (Position != Vector3.Zero) + { +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", +// part.OffsetPosition, Position, part.Name, part.LocalId); + part.OffsetPosition = Position; + } + +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", +// part.RotationOffset, Rotation, part.Name, part.LocalId); + part.UpdateRotation(Rotation); + if (Scale != Vector3.Zero) - part.Resize(Scale); part.ScheduleTerseUpdate(); + { +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", +// part.Shape.Scale, Scale, part.Name, part.LocalId); + + part.Resize(Scale); + } + + part.ScheduleTerseUpdate(); } - part.Undoing = false; + part.Undoing = false; } } + public void PlayfwdState(SceneObjectPart part) { if (part != null) @@ -115,27 +189,34 @@ namespace OpenSim.Region.Framework.Scenes { if (Position != Vector3.Zero) part.ParentGroup.AbsolutePosition = Position; + if (Rotation != Quaternion.Identity) part.UpdateRotation(Rotation); + if (Scale != Vector3.Zero) part.Resize(Scale); + part.ParentGroup.ScheduleGroupForTerseUpdate(); } else { if (Position != Vector3.Zero) part.OffsetPosition = Position; + if (Rotation != Quaternion.Identity) part.UpdateRotation(Rotation); + if (Scale != Vector3.Zero) part.Resize(Scale); + part.ScheduleTerseUpdate(); } - part.Undoing = false; + part.Undoing = false; } } } + public class LandUndoState { public ITerrainModule m_terrainModule; -- cgit v1.1 From 86f45f6fe716541647e628bc6a29df63330813f8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 01:24:43 +0100 Subject: remove undo state storage in a few places where it's pointless no functional effect - existing bugs still remain --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 -- .../Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index aab83b8..44d7ce3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3803,8 +3803,6 @@ namespace OpenSim.Region.Framework.Scenes { m_redo.Clear(); } - - StoreUndoState(); } public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index c18c93a..8fb9fad 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -102,7 +102,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization sceneObject.AddPart(part); part.LinkNum = linkNum; part.TrimPermissions(); - part.StoreUndoState(); reader.Close(); sr.Close(); } @@ -236,15 +235,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (originalLinkNum != 0) part.LinkNum = originalLinkNum; - part.StoreUndoState(); reader.Close(); sr.Close(); } // Script state may, or may not, exist. Not having any, is NOT // ever a problem. - sceneObject.LoadScriptState(doc); + return sceneObject; } catch (Exception e) -- cgit v1.1 From 430a4aeba8e98b8285ea3ebdf264baf429a55e22 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 03:01:54 +0100 Subject: Fix undo for resizing linksets This involves implementing a boolean in UndoState to signal whether the undo needs to be done for an entire group/linkset or just a single prim Resizing individual components of linksets is still dodgy. Resizing still has to be down twice, since for some reason the client is sending two multiobjectupdate packets on every resize except the very first. This applies to single prims and linksets. Need to look into this. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 37 ++++++++++++------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 23 +++++++----- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 42 +++++++++++++--------- OpenSim/Region/Framework/Scenes/UndoState.cs | 24 ++++++++++--- 4 files changed, 85 insertions(+), 41 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fa35bd8..4c0b53c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11220,8 +11220,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet) { MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; - if (multipleupdate.AgentData.SessionID != SessionId) return false; - // m_log.Debug("new multi update packet " + multipleupdate.ToString()); + + if (multipleupdate.AgentData.SessionID != SessionId) + return false; + +// m_log.DebugFormat( +// "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length); + Scene tScene = (Scene)m_scene; for (int i = 0; i < multipleupdate.ObjectData.Length; i++) @@ -11242,15 +11247,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - // Do this once since fetch parts creates a new array. - SceneObjectPart[] parts = part.ParentGroup.Parts; - for (int j = 0; j < parts.Length; j++) - { - part.StoreUndoState(); - parts[j].IgnoreUndoUpdate = true; - } +// m_log.DebugFormat( +// "[CLIENT]: Processing block {0} type {1} for {2} {3}", +// i, block.Type, part.Name, part.LocalId); + +// // Do this once since fetch parts creates a new array. +// SceneObjectPart[] parts = part.ParentGroup.Parts; +// for (int j = 0; j < parts.Length; j++) +// { +// part.StoreUndoState(); +// parts[j].IgnoreUndoUpdate = true; +// } - // UUID partId = part.UUID; UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; switch (block.Type) @@ -11394,6 +11402,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerUpdatePrimGroupScale != null) { // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + part.StoreUndoState(true); + part.IgnoreUndoUpdate = true; handlerUpdatePrimGroupScale(localId, scale5, this); handlerUpdateVector = OnUpdatePrimGroupPosition; @@ -11401,7 +11411,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { handlerUpdateVector(localId, pos5, this); } + + part.IgnoreUndoUpdate = false; } + break; case 21: @@ -11426,8 +11439,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; } - for (int j = 0; j < parts.Length; j++) - parts[j].IgnoreUndoUpdate = false; +// for (int j = 0; j < parts.Length; j++) +// parts[j].IgnoreUndoUpdate = false; } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7254992..3bbf76c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2624,6 +2624,8 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); + RootPart.StoreUndoState(true); + scale.X = Math.Min(scale.X, Scene.m_maxNonphys); scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); @@ -2722,16 +2724,20 @@ namespace OpenSim.Region.Framework.Scenes prevScale.X *= x; prevScale.Y *= y; prevScale.Z *= z; + +// RootPart.IgnoreUndoUpdate = true; RootPart.Resize(prevScale); +// RootPart.IgnoreUndoUpdate = false; parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; -// obPart.IgnoreUndoUpdate = true; if (obPart.UUID != m_rootPart.UUID) { + obPart.IgnoreUndoUpdate = true; + Vector3 currentpos = new Vector3(obPart.OffsetPosition); currentpos.X *= x; currentpos.Y *= y; @@ -2741,12 +2747,11 @@ namespace OpenSim.Region.Framework.Scenes newSize.X *= x; newSize.Y *= y; newSize.Z *= z; - - obPart.Resize(newSize); - obPart.IgnoreUndoUpdate = true; + obPart.Resize(newSize); obPart.UpdateOffSet(currentpos); - obPart.IgnoreUndoUpdate = false; + + obPart.IgnoreUndoUpdate = false; } // obPart.IgnoreUndoUpdate = false; @@ -2769,9 +2774,11 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); + RootPart.StoreUndoState(true); + +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 44d7ce3..5414cf2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3665,6 +3665,11 @@ namespace OpenSim.Region.Framework.Scenes public void StoreUndoState() { + StoreUndoState(false); + } + + public void StoreUndoState(bool forGroup) + { if (!Undoing) { if (!IgnoreUndoUpdate) @@ -3678,6 +3683,7 @@ namespace OpenSim.Region.Framework.Scenes UndoState last = m_undo.Peek(); if (last != null) { + // TODO: May need to fix for group comparison if (last.Compare(this)) { // m_log.DebugFormat( @@ -3690,12 +3696,12 @@ namespace OpenSim.Region.Framework.Scenes } // m_log.DebugFormat( -// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, initial stack size {2}", -// Name, LocalId, m_undo.Count); +// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", +// Name, LocalId, forGroup, m_undo.Count); if (m_parentGroup.GetSceneMaxUndo() > 0) { - UndoState nUndo = new UndoState(this); + UndoState nUndo = new UndoState(this, forGroup); m_undo.Push(nUndo); @@ -3740,17 +3746,17 @@ namespace OpenSim.Region.Framework.Scenes if (m_undo.Count > 0) { - UndoState nUndo = null; - - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - nUndo = new UndoState(this); - } - UndoState goback = m_undo.Pop(); if (goback != null) { + UndoState nUndo = null; + + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + nUndo = new UndoState(this, goback.ForGroup); + } + goback.PlaybackState(this); if (nUndo != null) @@ -3772,17 +3778,19 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", // Name, LocalId, m_redo.Count); - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this); - - m_undo.Push(nUndo); - } - UndoState gofwd = m_redo.Pop(); if (gofwd != null) + { + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this, gofwd.ForGroup); + + m_undo.Push(nUndo); + } + gofwd.PlayfwdState(this); + } // m_log.DebugFormat( // "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 38bbeb0..1fa8ee2 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -42,10 +42,16 @@ namespace OpenSim.Region.Framework.Scenes public Quaternion Rotation = Quaternion.Identity; /// + /// Is this undo state for an entire group? + /// + public bool ForGroup; + + /// /// Constructor. /// /// - public UndoState(SceneObjectPart part) + /// True if the undo is for an entire group + public UndoState(SceneObjectPart part, bool forGroup) { if (part != null) { @@ -62,6 +68,8 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale); Scale = part.Shape.Scale; + + ForGroup = forGroup; } else { @@ -141,7 +149,10 @@ namespace OpenSim.Region.Framework.Scenes // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", // part.Shape.Scale, Scale, part.Name, part.LocalId); - part.Resize(Scale); + if (ForGroup) + part.ParentGroup.GroupResize(Scale); + else + part.Resize(Scale); } part.ParentGroup.ScheduleGroupForTerseUpdate(); @@ -194,7 +205,12 @@ namespace OpenSim.Region.Framework.Scenes part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) - part.Resize(Scale); + { + if (ForGroup) + part.ParentGroup.GroupResize(Scale); + else + part.Resize(Scale); + } part.ParentGroup.ScheduleGroupForTerseUpdate(); } @@ -241,4 +257,4 @@ namespace OpenSim.Region.Framework.Scenes m_terrainModule.UndoTerrain(m_terrainChannel); } } -} +} \ No newline at end of file -- cgit v1.1 From c94dc95844c5a43483a30807353aaebf658b015e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 03:27:16 +0100 Subject: fix undo when resizing of non-root individual prims in a linkset undo resize, rotation and position still needs fixing when only editing root prim of a linkset --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +++++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 +++++--- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4c0b53c..a34ad62 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11424,6 +11424,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { + part.StoreUndoState(false); + part.IgnoreUndoUpdate = true; + // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); handlerUpdatePrimScale(localId, scale6, this); handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; @@ -11431,6 +11434,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { handlerUpdatePrimSinglePosition(localId, pos6, this); } + + part.IgnoreUndoUpdate = false; } break; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0a0bde8..8e174f5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1291,7 +1291,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) { - group.UpdateSingleRotation(rot,pos, localID); + group.UpdateSingleRotation(rot, pos, localID); } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3bbf76c..3adeef1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2815,15 +2815,17 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = GetChildPart(localID); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); if (part != null) { // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); + part.StoreUndoState(false); + if (part.UUID == m_rootPart.UUID) { UpdateRootPosition(pos); -- cgit v1.1 From 7c468cda360b9a9382986c3a029b799fd49bf898 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 03:38:22 +0100 Subject: Stop undo of just the root prim position in the linkset from shifting the whole linkset. However, what happens now is that undo just doesn't do anything when the root prim is selected on its own. This requires more code than just fiddling with undo states. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++----- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 1 - OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 ++++++------ OpenSim/Region/Framework/Scenes/UndoState.cs | 11 +++++++++-- 4 files changed, 20 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a34ad62..00115cc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11224,8 +11224,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (multipleupdate.AgentData.SessionID != SessionId) return false; -// m_log.DebugFormat( -// "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length); + m_log.DebugFormat( + "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length); Scene tScene = (Scene)m_scene; @@ -11247,9 +11247,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { -// m_log.DebugFormat( -// "[CLIENT]: Processing block {0} type {1} for {2} {3}", -// i, block.Type, part.Name, part.LocalId); + m_log.DebugFormat( + "[CLIENT]: Processing block {0} type {1} for {2} {3}", + i, block.Type, part.Name, part.LocalId); // // Do this once since fetch parts creates a new array. // SceneObjectPart[] parts = part.ParentGroup.Parts; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 8e174f5..26857c2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1296,7 +1296,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// /// /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5414cf2..af836f6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3705,9 +3705,9 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}", -// Name, LocalId, m_undo.Count); + m_log.DebugFormat( + "[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}", + Name, LocalId, m_undo.Count); } } } @@ -3740,9 +3740,9 @@ namespace OpenSim.Region.Framework.Scenes { lock (m_undo) { -// m_log.DebugFormat( -// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", -// Name, LocalId, m_undo.Count); + m_log.DebugFormat( + "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", + Name, LocalId, m_undo.Count); if (m_undo.Count > 0) { diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 1fa8ee2..faa1f9e 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -59,7 +59,11 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat( // "[UNDO STATE]: Storing undo position {0} for root part", part.ParentGroup.AbsolutePosition); - Position = part.ParentGroup.AbsolutePosition; + + if (ForGroup) + Position = part.ParentGroup.AbsolutePosition; + else + Position = part.OffsetPosition; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo rotation {0} for root part", part.RotationOffset); @@ -134,7 +138,10 @@ namespace OpenSim.Region.Framework.Scenes // "[UNDO STATE]: Undoing position {0} to {1} for root part {2} {3}", // part.ParentGroup.AbsolutePosition, Position, part.Name, part.LocalId); - part.ParentGroup.AbsolutePosition = Position; + if (ForGroup) + part.ParentGroup.AbsolutePosition = Position; + else + part.OffsetPosition = Position; } // m_log.DebugFormat( -- cgit v1.1 From 4b9ef4f39c420b99568b853b627ad83d253ac2c9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 03:44:49 +0100 Subject: Rename UpdatePrimRotation() to UpdatePrimGroupRotation() since this is what it actually does and is more consistent with other method names. --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++---- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0104a96..2c71c70 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2718,10 +2718,12 @@ namespace OpenSim.Region.Framework.Scenes { client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; - client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; - client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation; + + client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; + client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; + client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; @@ -2845,10 +2847,12 @@ namespace OpenSim.Region.Framework.Scenes { client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; - client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation; - client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation; + + client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; + client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; + client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 26857c2..d5e0bbb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1297,12 +1297,12 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update the rotation of a whole group. /// /// /// /// - protected internal void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient) + protected internal void UpdatePrimGroupRotation(uint localID, Quaternion rot, IClientAPI remoteClient) { SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) @@ -1321,7 +1321,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - protected internal void UpdatePrimRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient) + protected internal void UpdatePrimGroupRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient) { SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) -- cgit v1.1 From 97f1edfd95176415d0e0b3169467655522334804 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 04:15:27 +0100 Subject: Fix undo of prim group rotation. This isn't that great since I think I broke it a few commits earlier. Undo of rotation of individual prims in a linkset is still broken --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 19 ++++++++---- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 +-- OpenSim/Region/Framework/Scenes/UndoState.cs | 35 ++++++++++++---------- 3 files changed, 34 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3adeef1..aa1f7bc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2895,9 +2895,11 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); + + m_rootPart.StoreUndoState(true); m_rootPart.UpdateRotation(rot); @@ -2922,9 +2924,12 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); + + RootPart.StoreUndoState(true); + RootPart.IgnoreUndoUpdate = true; m_rootPart.UpdateRotation(rot); @@ -2939,6 +2944,8 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; ScheduleGroupForTerseUpdate(); + + RootPart.IgnoreUndoUpdate = false; } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index af836f6..c3aca15 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3706,8 +3706,8 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); m_log.DebugFormat( - "[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}", - Name, LocalId, m_undo.Count); + "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", + Name, LocalId, forGroup, m_undo.Count); } } } diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index faa1f9e..6f6504c 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Scenes { public class UndoState { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public Vector3 Position = Vector3.Zero; public Vector3 Scale = Vector3.Zero; @@ -57,23 +57,25 @@ namespace OpenSim.Region.Framework.Scenes { if (part.ParentID == 0) { -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo position {0} for root part", part.ParentGroup.AbsolutePosition); + ForGroup = forGroup; if (ForGroup) Position = part.ParentGroup.AbsolutePosition; else Position = part.OffsetPosition; -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo rotation {0} for root part", part.RotationOffset); + m_log.DebugFormat( + "[UNDO STATE]: Storing undo position {0} for root part", Position); + Rotation = part.RotationOffset; -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale); + m_log.DebugFormat( + "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); + Scale = part.Shape.Scale; - ForGroup = forGroup; + m_log.DebugFormat( + "[UNDO STATE]: Storing undo scale {0} for root part", Scale); } else { @@ -132,23 +134,24 @@ namespace OpenSim.Region.Framework.Scenes if (part.ParentID == 0) { + m_log.DebugFormat( + "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", + Position, part.Name, part.LocalId); + if (Position != Vector3.Zero) { -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing position {0} to {1} for root part {2} {3}", -// part.ParentGroup.AbsolutePosition, Position, part.Name, part.LocalId); - if (ForGroup) part.ParentGroup.AbsolutePosition = Position; else part.OffsetPosition = Position; } -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", -// part.RotationOffset, Rotation, part.Name, part.LocalId); + m_log.DebugFormat( + "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", + part.RotationOffset, Rotation, part.Name, part.LocalId); - part.RotationOffset = Rotation; + part.UpdateRotation(Rotation); + //part.RotationOffset = Rotation; if (Scale != Vector3.Zero) { -- cgit v1.1 From b2722e984ab99deb01d55cd4c4e9f1a7cb563709 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 04:40:02 +0100 Subject: Fix undo of rotation of single prims in a linkset --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 +++++--- OpenSim/Region/Framework/Scenes/UndoState.cs | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index aa1f7bc..9076d73 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2991,6 +2991,9 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}", // part.Name, part.LocalId, rot); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + if (part.UUID == m_rootPart.UUID) { UpdateRootRotation(rot); @@ -2998,12 +3001,11 @@ namespace OpenSim.Region.Framework.Scenes } else { - part.IgnoreUndoUpdate = true; part.UpdateRotation(rot); part.OffsetPosition = pos; - part.IgnoreUndoUpdate = false; - part.StoreUndoState(); } + + part.IgnoreUndoUpdate = false; } } diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 6f6504c..68d4cb4 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -79,17 +79,17 @@ namespace OpenSim.Region.Framework.Scenes } else { -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo position {0} for child part", part.OffsetPosition); Position = part.OffsetPosition; + m_log.DebugFormat( + "[UNDO STATE]: Storing undo position {0} for child part", Position); -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo rotation {0} for child part", part.RotationOffset); Rotation = part.RotationOffset; + m_log.DebugFormat( + "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo scale {0} for child part", part.Shape.Scale); Scale = part.Shape.Scale; + m_log.DebugFormat( + "[UNDO STATE]: Storing undo scale {0} for child part", Scale); } } } -- cgit v1.1 From 1fdb16f1cdf6e2722a763cdc0e9b7af9fed27a29 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:05:50 +0100 Subject: Fix undo for rotation of the root prim in a linkset on its own. The only obviously broken things right now are the undo of the position of just a root prim (stays in place) and the fact that resizes need two undoes. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 17 +++++++++++------ OpenSim/Region/Framework/Scenes/UndoState.cs | 6 ++++-- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9076d73..d653e66 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3013,11 +3013,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - private void UpdateRootRotation(Quaternion rot) + public void UpdateRootRotation(Quaternion rot) { -// m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", -// Name, LocalId, rot); + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", + Name, LocalId, rot); Quaternion axRot = rot; Quaternion oldParentRot = m_rootPart.RotationOffset; @@ -3046,6 +3046,7 @@ namespace OpenSim.Region.Framework.Scenes newRot *= Quaternion.Inverse(axRot); prim.RotationOffset = newRot; prim.ScheduleTerseUpdate(); + prim.IgnoreUndoUpdate = false; } } @@ -3054,12 +3055,16 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart childpart = parts[i]; if (childpart != m_rootPart) { - childpart.IgnoreUndoUpdate = false; - childpart.StoreUndoState(); +// childpart.IgnoreUndoUpdate = false; +// childpart.StoreUndoState(); } } m_rootPart.ScheduleTerseUpdate(); + + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}", + Name, LocalId, rot); } #endregion diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 68d4cb4..dc509d9 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -150,8 +150,10 @@ namespace OpenSim.Region.Framework.Scenes "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", part.RotationOffset, Rotation, part.Name, part.LocalId); - part.UpdateRotation(Rotation); - //part.RotationOffset = Rotation; + if (ForGroup) + part.UpdateRotation(Rotation); + else + part.ParentGroup.UpdateRootRotation(Rotation); if (Scale != Vector3.Zero) { -- cgit v1.1 From 62325829ecab7d956416ff0450faa3f90f267e6c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:14:58 +0100 Subject: comment out all kinds of debugging guff --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 30 +++++++++--------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 ++++---- OpenSim/Region/Framework/Scenes/UndoState.cs | 36 +++++++++++----------- 4 files changed, 44 insertions(+), 44 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 00115cc..a34ad62 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11224,8 +11224,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (multipleupdate.AgentData.SessionID != SessionId) return false; - m_log.DebugFormat( - "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length); +// m_log.DebugFormat( +// "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length); Scene tScene = (Scene)m_scene; @@ -11247,9 +11247,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_log.DebugFormat( - "[CLIENT]: Processing block {0} type {1} for {2} {3}", - i, block.Type, part.Name, part.LocalId); +// m_log.DebugFormat( +// "[CLIENT]: Processing block {0} type {1} for {2} {3}", +// i, block.Type, part.Name, part.LocalId); // // Do this once since fetch parts creates a new array. // SceneObjectPart[] parts = part.ParentGroup.Parts; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d653e66..0eaed91 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3015,9 +3015,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateRootRotation(Quaternion rot) { - m_log.DebugFormat( - "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", - Name, LocalId, rot); +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", +// Name, LocalId, rot); Quaternion axRot = rot; Quaternion oldParentRot = m_rootPart.RotationOffset; @@ -3050,21 +3050,21 @@ namespace OpenSim.Region.Framework.Scenes } } - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart childpart = parts[i]; - if (childpart != m_rootPart) - { -// childpart.IgnoreUndoUpdate = false; -// childpart.StoreUndoState(); - } - } +// for (int i = 0; i < parts.Length; i++) +// { +// SceneObjectPart childpart = parts[i]; +// if (childpart != m_rootPart) +// { +//// childpart.IgnoreUndoUpdate = false; +//// childpart.StoreUndoState(); +// } +// } m_rootPart.ScheduleTerseUpdate(); - m_log.DebugFormat( - "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}", - Name, LocalId, rot); +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}", +// Name, LocalId, rot); } #endregion diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c3aca15..0357cf9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3705,9 +3705,9 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); - m_log.DebugFormat( - "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", - Name, LocalId, forGroup, m_undo.Count); +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", +// Name, LocalId, forGroup, m_undo.Count); } } } @@ -3740,9 +3740,9 @@ namespace OpenSim.Region.Framework.Scenes { lock (m_undo) { - m_log.DebugFormat( - "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", - Name, LocalId, m_undo.Count); +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", +// Name, LocalId, m_undo.Count); if (m_undo.Count > 0) { diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index dc509d9..b013d68 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -64,32 +64,32 @@ namespace OpenSim.Region.Framework.Scenes else Position = part.OffsetPosition; - m_log.DebugFormat( - "[UNDO STATE]: Storing undo position {0} for root part", Position); +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo position {0} for root part", Position); Rotation = part.RotationOffset; - m_log.DebugFormat( - "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); Scale = part.Shape.Scale; - m_log.DebugFormat( - "[UNDO STATE]: Storing undo scale {0} for root part", Scale); +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo scale {0} for root part", Scale); } else { Position = part.OffsetPosition; - m_log.DebugFormat( - "[UNDO STATE]: Storing undo position {0} for child part", Position); +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo position {0} for child part", Position); Rotation = part.RotationOffset; - m_log.DebugFormat( - "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); Scale = part.Shape.Scale; - m_log.DebugFormat( - "[UNDO STATE]: Storing undo scale {0} for child part", Scale); +// m_log.DebugFormat( +// "[UNDO STATE]: Storing undo scale {0} for child part", Scale); } } } @@ -134,9 +134,9 @@ namespace OpenSim.Region.Framework.Scenes if (part.ParentID == 0) { - m_log.DebugFormat( - "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", - Position, part.Name, part.LocalId); +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", +// Position, part.Name, part.LocalId); if (Position != Vector3.Zero) { @@ -146,9 +146,9 @@ namespace OpenSim.Region.Framework.Scenes part.OffsetPosition = Position; } - m_log.DebugFormat( - "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", - part.RotationOffset, Rotation, part.Name, part.LocalId); +// m_log.DebugFormat( +// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", +// part.RotationOffset, Rotation, part.Name, part.LocalId); if (ForGroup) part.UpdateRotation(Rotation); -- cgit v1.1 From 0ef29da9b2844e567928fe6fe5e13da3ee1a37ad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:20:04 +0100 Subject: refactor: rename UpdatePrimPosition() to UpdatePrimGroupPosition() for consistency --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 ++-- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2c71c70..6e66632 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2716,7 +2716,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void SubscribeToClientPrimEvents(IClientAPI client) { - client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; + client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; @@ -2845,7 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) { - client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; + client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index d5e0bbb..65dc2c9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1352,12 +1352,12 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Update the position of the given part + /// Update the position of the given group. /// /// /// /// - public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) + public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient) { SceneObjectGroup group = GetGroupByPrim(localID); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0eaed91..26b35a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2840,10 +2840,10 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update just the root prim position in a linkset /// /// - private void UpdateRootPosition(Vector3 pos) + public void UpdateRootPosition(Vector3 pos) { // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); -- cgit v1.1 From bc3679b67dc074a9ef1e0e6ffb07bca844eb93c9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:46:17 +0100 Subject: Fix undo when changing just the root prim's position in a linkset. I think (ha ha) this largely fixes undo, except for the fact that rotation a set of prims with 'edit linked parts' selected doesn't quite work properly (though this works fine if the checkbox isn't selected). Also, the double undo bug for resize is still present. Redo might be incredibly buggy, haven't even looked at that yet. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 ++++++---- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- OpenSim/Region/Framework/Scenes/UndoState.cs | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 26b35a3..b6fb5a4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2825,6 +2825,7 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); part.StoreUndoState(false); + part.IgnoreUndoUpdate = true; if (part.UUID == m_rootPart.UUID) { @@ -2836,6 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes } HasGroupChanged = true; + part.IgnoreUndoUpdate = false; } } @@ -2848,9 +2850,9 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); Vector3 oldPos = @@ -2863,7 +2865,7 @@ namespace OpenSim.Region.Framework.Scenes axDiff *= Quaternion.Inverse(partRotation); diff = axDiff; - parts = m_parts.GetArray(); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0357cf9..9d7f87a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -788,7 +788,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_offsetPosition; } set { - StoreUndoState(); +// StoreUndoState(); m_offsetPosition = value; if (ParentGroup != null && !ParentGroup.IsDeleted) diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index b013d68..6bf89c5 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -59,10 +59,10 @@ namespace OpenSim.Region.Framework.Scenes { ForGroup = forGroup; - if (ForGroup) +// if (ForGroup) Position = part.ParentGroup.AbsolutePosition; - else - Position = part.OffsetPosition; +// else +// Position = part.OffsetPosition; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo position {0} for root part", Position); @@ -143,7 +143,7 @@ namespace OpenSim.Region.Framework.Scenes if (ForGroup) part.ParentGroup.AbsolutePosition = Position; else - part.OffsetPosition = Position; + part.ParentGroup.UpdateRootPosition(Position); } // m_log.DebugFormat( -- cgit v1.1 From 9dd5a2449575d671075c673e5e39ef3e1a108a76 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:51:19 +0100 Subject: rip out pointless null checks in UndoState where part can never be null --- OpenSim/Region/Framework/Scenes/UndoState.cs | 153 +++++++++++++-------------- 1 file changed, 72 insertions(+), 81 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 6bf89c5..f7bed5a 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -53,44 +53,41 @@ namespace OpenSim.Region.Framework.Scenes /// True if the undo is for an entire group public UndoState(SceneObjectPart part, bool forGroup) { - if (part != null) + if (part.ParentID == 0) { - if (part.ParentID == 0) - { - ForGroup = forGroup; + ForGroup = forGroup; // if (ForGroup) - Position = part.ParentGroup.AbsolutePosition; + Position = part.ParentGroup.AbsolutePosition; // else // Position = part.OffsetPosition; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo position {0} for root part", Position); - Rotation = part.RotationOffset; + Rotation = part.RotationOffset; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); - Scale = part.Shape.Scale; + Scale = part.Shape.Scale; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); - } - else - { - Position = part.OffsetPosition; + } + else + { + Position = part.OffsetPosition; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo position {0} for child part", Position); - Rotation = part.RotationOffset; + Rotation = part.RotationOffset; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); - Scale = part.Shape.Scale; + Scale = part.Shape.Scale; // m_log.DebugFormat( // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); - } } } @@ -128,120 +125,114 @@ namespace OpenSim.Region.Framework.Scenes public void PlaybackState(SceneObjectPart part) { - if (part != null) - { - part.Undoing = true; + part.Undoing = true; - if (part.ParentID == 0) - { + if (part.ParentID == 0) + { // m_log.DebugFormat( // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", // Position, part.Name, part.LocalId); - if (Position != Vector3.Zero) - { - if (ForGroup) - part.ParentGroup.AbsolutePosition = Position; - else - part.ParentGroup.UpdateRootPosition(Position); - } + if (Position != Vector3.Zero) + { + if (ForGroup) + part.ParentGroup.AbsolutePosition = Position; + else + part.ParentGroup.UpdateRootPosition(Position); + } // m_log.DebugFormat( // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", // part.RotationOffset, Rotation, part.Name, part.LocalId); - if (ForGroup) - part.UpdateRotation(Rotation); - else - part.ParentGroup.UpdateRootRotation(Rotation); + if (ForGroup) + part.UpdateRotation(Rotation); + else + part.ParentGroup.UpdateRootRotation(Rotation); - if (Scale != Vector3.Zero) - { + if (Scale != Vector3.Zero) + { // m_log.DebugFormat( // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", // part.Shape.Scale, Scale, part.Name, part.LocalId); - if (ForGroup) - part.ParentGroup.GroupResize(Scale); - else - part.Resize(Scale); - } - - part.ParentGroup.ScheduleGroupForTerseUpdate(); + if (ForGroup) + part.ParentGroup.GroupResize(Scale); + else + part.Resize(Scale); } - else + + part.ParentGroup.ScheduleGroupForTerseUpdate(); + } + else + { + if (Position != Vector3.Zero) { - if (Position != Vector3.Zero) - { // m_log.DebugFormat( // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", // part.OffsetPosition, Position, part.Name, part.LocalId); - part.OffsetPosition = Position; - } + part.OffsetPosition = Position; + } // m_log.DebugFormat( // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", // part.RotationOffset, Rotation, part.Name, part.LocalId); - part.UpdateRotation(Rotation); + part.UpdateRotation(Rotation); - if (Scale != Vector3.Zero) - { + if (Scale != Vector3.Zero) + { // m_log.DebugFormat( // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", // part.Shape.Scale, Scale, part.Name, part.LocalId); - part.Resize(Scale); - } - - part.ScheduleTerseUpdate(); + part.Resize(Scale); } - part.Undoing = false; + part.ScheduleTerseUpdate(); } + + part.Undoing = false; } public void PlayfwdState(SceneObjectPart part) { - if (part != null) - { - part.Undoing = true; - - if (part.ParentID == 0) - { - if (Position != Vector3.Zero) - part.ParentGroup.AbsolutePosition = Position; + part.Undoing = true; - if (Rotation != Quaternion.Identity) - part.UpdateRotation(Rotation); + if (part.ParentID == 0) + { + if (Position != Vector3.Zero) + part.ParentGroup.AbsolutePosition = Position; - if (Scale != Vector3.Zero) - { - if (ForGroup) - part.ParentGroup.GroupResize(Scale); - else - part.Resize(Scale); - } + if (Rotation != Quaternion.Identity) + part.UpdateRotation(Rotation); - part.ParentGroup.ScheduleGroupForTerseUpdate(); - } - else + if (Scale != Vector3.Zero) { - if (Position != Vector3.Zero) - part.OffsetPosition = Position; + if (ForGroup) + part.ParentGroup.GroupResize(Scale); + else + part.Resize(Scale); + } - if (Rotation != Quaternion.Identity) - part.UpdateRotation(Rotation); + part.ParentGroup.ScheduleGroupForTerseUpdate(); + } + else + { + if (Position != Vector3.Zero) + part.OffsetPosition = Position; - if (Scale != Vector3.Zero) - part.Resize(Scale); + if (Rotation != Quaternion.Identity) + part.UpdateRotation(Rotation); - part.ScheduleTerseUpdate(); - } + if (Scale != Vector3.Zero) + part.Resize(Scale); - part.Undoing = false; + part.ScheduleTerseUpdate(); } + + part.Undoing = false; } } -- cgit v1.1 From 25c532f2ec0c747eb9c9b6f8fff477a4fb375894 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:58:52 +0100 Subject: refator: simplify UndoState.Compare() code --- OpenSim/Region/Framework/Scenes/UndoState.cs | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index f7bed5a..393f42d 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -101,23 +101,15 @@ namespace OpenSim.Region.Framework.Scenes if (part != null) { if (part.ParentID == 0) - { - if (Position == part.ParentGroup.AbsolutePosition - && Rotation == part.RotationOffset - && Scale == part.Shape.Scale) - return true; - else - return false; - } + return + Position == part.ParentGroup.AbsolutePosition + && Rotation == part.RotationOffset + && Scale == part.Shape.Scale; else - { - if (Position == part.OffsetPosition - && Rotation == part.RotationOffset - && Scale == part.Shape.Scale) - return true; - else - return false; - } + return + Position == part.OffsetPosition + && Rotation == part.RotationOffset + && Scale == part.Shape.Scale; } return false; @@ -249,10 +241,7 @@ namespace OpenSim.Region.Framework.Scenes public bool Compare(ITerrainChannel terrainChannel) { - if (m_terrainChannel != terrainChannel) - return false; - else - return false; + return m_terrainChannel == terrainChannel; } public void PlaybackState() -- cgit v1.1 From ec1ecd363317fd83fd30f45d9c033873f4c35bc2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 06:05:23 +0100 Subject: stop redo throwing an exception if there is nothing to redo --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9d7f87a..ccf8a25 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3778,23 +3778,26 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", // Name, LocalId, m_redo.Count); - UndoState gofwd = m_redo.Pop(); - - if (gofwd != null) + if (m_redo.Count > 0) { - if (m_parentGroup.GetSceneMaxUndo() > 0) + UndoState gofwd = m_redo.Pop(); + + if (gofwd != null) { - UndoState nUndo = new UndoState(this, gofwd.ForGroup); - - m_undo.Push(nUndo); + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this, gofwd.ForGroup); + + m_undo.Push(nUndo); + } + + gofwd.PlayfwdState(this); } - gofwd.PlayfwdState(this); - } - // m_log.DebugFormat( // "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", // Name, LocalId, m_redo.Count); + } } } -- cgit v1.1 From c50533659a9c7627cd6b24820078192b18c662f0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 06:11:16 +0100 Subject: If we store an undo, wipe anything already present on the redo stack This stops problems when we undo a few steps and start off down another path. Surprisingly, apart from this now fixed problem, redo appears to be working too. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ccf8a25..e8097fa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3705,6 +3705,9 @@ namespace OpenSim.Region.Framework.Scenes m_undo.Push(nUndo); + if (m_redo.Count > 0) + m_redo.Clear(); + // m_log.DebugFormat( // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", // Name, LocalId, forGroup, m_undo.Count); -- cgit v1.1 From ee829a71c2e42d4434d8cec2cfc1d048d50904f0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 06:13:05 +0100 Subject: On all undo/redo operations, consistently lock the undo object for everything, in order to avoid any deadlock issues. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e8097fa..f74f263 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3775,7 +3775,7 @@ namespace OpenSim.Region.Framework.Scenes public void Redo() { - lock (m_redo) + lock (m_undo) { // m_log.DebugFormat( // "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", @@ -3811,10 +3811,6 @@ namespace OpenSim.Region.Framework.Scenes lock (m_undo) { m_undo.Clear(); - } - - lock (m_redo) - { m_redo.Clear(); } } -- cgit v1.1 From 51c47677a15bd41eeab2f36ac71384984712362b Mon Sep 17 00:00:00 2001 From: Careminster Team Date: Tue, 19 Jul 2011 10:15:34 -0700 Subject: Tidy up a superfluous AddPrimShape override in PhysicsScene --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f74f263..4629757 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4533,7 +4533,6 @@ namespace OpenSim.Region.Framework.Scenes { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( - LocalId, string.Format("{0}/{1}", Name, UUID), Shape, AbsolutePosition, -- cgit v1.1 From 9fc7d65df7a094649eaa34921827ed1316ab67a5 Mon Sep 17 00:00:00 2001 From: Careminster Team Date: Tue, 19 Jul 2011 10:25:49 -0700 Subject: Apply the localID to the Physics actor to prevent null calls later --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 6fda32d..a307469 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1677,7 +1677,7 @@ namespace OpenSim.Region.Physics.OdePlugin } private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, - IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) + IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, uint localID) { Vector3 pos = position; Vector3 siz = size; @@ -1691,7 +1691,7 @@ namespace OpenSim.Region.Physics.OdePlugin lock (_prims) _prims.Add(newPrim); } - + newPrim.LocalID = localID; return newPrim; } @@ -1733,7 +1733,7 @@ namespace OpenSim.Region.Physics.OdePlugin // } // } - result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); + result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, localid); return result; } -- cgit v1.1 From 3270bd560e29fcc871cab6e99a504903eef7af0e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Wed, 20 Jul 2011 14:34:02 -0700 Subject: Removed unused AddPrimShape methods in PhysicsScene caused by merge conflicts --- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 28ace34..3870411 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -88,23 +88,9 @@ namespace OpenSim.Region.Physics.Manager public abstract void RemovePrim(PhysicsActor prim); - //public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - // Vector3 size, Quaternion rotation); //To be removed - Actually removed! - public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, uint localid); - public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localid) - { - PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); - - if (ret != null) - ret.LocalID = localID; - - return ret; - } - public virtual float TimeDilation { get { return 1.0f; } -- cgit v1.1