From 795acaa6aa8e32ad0281226208a6b1bbc2292bf5 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 10 Jun 2013 14:12:45 -0700 Subject: BulletSim: add failure flag for meshing failure vs asset fetch failure so error messages make more sense. Change some BulletSim status log messages from WARN to INFO. Update TODO list. --- .../Region/Physics/BulletSPlugin/BSPhysObject.cs | 2 +- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 4 +- OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 35 ++++++++++++----- .../Region/Physics/BulletSPlugin/BulletSimTODO.txt | 44 +++++++++++----------- 4 files changed, 51 insertions(+), 34 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index cca887a..a4c5e08 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -148,7 +148,7 @@ public abstract class BSPhysObject : PhysicsActor // The asset state is first 'Unknown' then 'Waiting' then either 'Failed' or 'Fetched'. public enum PrimAssetCondition { - Unknown, Waiting, Failed, Fetched + Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched } public PrimAssetCondition PrimAssetState { get; set; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 423c389..dec6b6f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -249,7 +249,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters TerrainManager.CreateInitialGroundPlaneAndTerrain(); // Put some informational messages into the log file. - m_log.WarnFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); + m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); InTaintTime = false; m_initialized = true; @@ -374,7 +374,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters } else { - m_log.WarnFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); + m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); } return ret; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 867d2ab..202a4ce 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs @@ -167,7 +167,7 @@ public abstract class BSShape // Prevent trying to keep fetching the mesh by declaring failure. if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) { - prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; + prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}", @@ -177,7 +177,8 @@ public abstract class BSShape { // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset if (prim.BaseShape.SculptEntry - && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed + && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedAssetFetch + && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedMeshing && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting && prim.BaseShape.SculptTexture != OMV.UUID.Zero ) @@ -219,7 +220,7 @@ public abstract class BSShape } if (!assetFound) { - yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; + yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; } physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}", yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); @@ -227,7 +228,7 @@ public abstract class BSShape } else { - xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; + xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", LogHeader, physicsScene.Name); } @@ -235,13 +236,20 @@ public abstract class BSShape } else { - if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) + if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) { physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}", prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); } + if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing) + { + physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}", + LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); + physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}", + prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); + } } } @@ -374,7 +382,9 @@ public class BSShapeMesh : BSShape // Check to see if mesh was created (might require an asset). newShape = VerifyMeshCreated(physicsScene, newShape, prim); - if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) + if (!newShape.isNativeShape + || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing + || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) { // If a mesh was what was created, remember the built shape for later sharing. // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh. @@ -517,7 +527,7 @@ public class BSShapeMesh : BSShape else { // Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh. - prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; + prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name); physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey); @@ -559,7 +569,9 @@ public class BSShapeHull : BSShape // Check to see if hull was created (might require an asset). newShape = VerifyMeshCreated(physicsScene, newShape, prim); - if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) + if (!newShape.isNativeShape + || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing + || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) { // If a mesh was what was created, remember the built shape for later sharing. Hulls.Add(newHullKey, retHull); @@ -1079,10 +1091,13 @@ public class BSShapeGImpact : BSShape // Check to see if mesh was created (might require an asset). newShape = VerifyMeshCreated(physicsScene, newShape, prim); newShape.shapeKey = newMeshKey; - if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) + if (!newShape.isNativeShape + || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing + || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) { // If a mesh was what was created, remember the built shape for later sharing. - // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh. + // Also note that if meshing failed we put it in the mesh list as there is nothing + // else to do about the mesh. GImpacts.Add(newMeshKey, retGImpact); } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index df1da63..1e01526 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -2,11 +2,6 @@ CURRENT PROBLEMS TO FIX AND/OR LOOK AT ================================================= Script changing rotation of child prim while vehicle moving (eg turning wheel) causes the wheel to appear to jump back. Looks like sending position from previous update. -Vehicle ride, get up, ride again. Second time vehicle does not act correctly. - Have to rez new vehicle and delete the old to fix situation. -Hitting RESET on Nebadon's vehicle while riding causes vehicle to get into odd - position state where it will not settle onto ground properly, etc -Two of Nebadon vehicles in a sim max the CPU. This is new. Enable vehicle border crossings (at least as poorly as ODE) Terrain skirts Avatar created in previous region and not new region when crossing border @@ -23,24 +18,17 @@ vehicle angular banking Center-of-gravity Vehicle angular deflection Preferred orientation angular correction fix -when should angular and linear motor targets be zeroed? when selected? - Need a vehicle.clear()? Or an 'else' in prestep if not physical. Teravus llMoveToTarget script debug Mixing of hover, buoyancy/gravity, moveToTarget, into one force Setting hover height to zero disables hover even if hover flags are on (from SL wiki) limitMotorUp calibration (more down?) llRotLookAt llLookAt -Avatars walking up stairs (HALF DONE) -Avatar movement - flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) - walking up stairs is not calibrated correctly (stairs out of Kepler cabin) (DONE) - avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) +Convert to avatar mesh capsule. Include rotation of capsule. Vehicle script tuning/debugging Avanti speed script Weapon shooter script Move material definitions (friction, ...) into simulator. -Add material densities to the material types. One sided meshes? Should terrain be built into a closed shape? When meshes get partially wedged into the terrain, they cannot push themselves out. It is possible that Bullet processes collisions whether entering or leaving a mesh. @@ -53,12 +41,8 @@ LINEAR_MOTOR_DIRECTION values should be clamped to reasonable numbers. Same for other velocity settings. UBit improvements to remove rubber-banding of avatars sitting on vehicle child prims: https://github.com/UbitUmarov/Ubit-opensim -Border crossing with linked vehicle causes crash - 20121129.1411: editting/moving phys object across region boundries causes crash - getPos-> btRigidBody::upcast -> getBodyType -> BOOM Vehicles (Move smoothly) Some vehicles should not be able to turn if no speed or off ground. -What to do if vehicle and prim buoyancy differ? Cannot edit/move a vehicle being ridden: it jumps back to the origional position. Neb car jiggling left and right Happens on terrain and any other mesh object. Flat cubes are much smoother. @@ -68,8 +52,6 @@ For limitMotorUp, use raycast down to find if vehicle is in the air. Verify llGetVel() is returning a smooth and good value for vehicle movement. llGetVel() should return the root's velocity if requested in a child prim. Implement function efficiency for lineaar and angular motion. -After getting off a vehicle, the root prim is phantom (can be walked through) - Need to force a position update for the root prim after compound shape destruction Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint) Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties(). A kludge that isn't fixing the real problem of Bullet adding extra motion. @@ -78,11 +60,10 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl creates over-correction and over-shoot and wabbling. Vehicle attributes are not restored when a vehicle is rezzed on region creation Create vehicle, setup vehicle properties, restart region, vehicle is not reinitialized. +What to do if vehicle and prim buoyancy differ? GENERAL TODO LIST: ================================================= -Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects. - Regular triangle meshes don't do physical collisions. Resitution of a prim works on another prim but not on terrain. The dropped prim doesn't bounce properly on the terrain. Add a sanity check for PIDTarget location. @@ -359,4 +340,25 @@ Lock axis (DONE 20130401) Terrain detail: double terrain mesh detail (DONE) Use the HACD convex hull routine in Bullet rather than the C# version. Speed up hullifying large meshes. (DONE) +Vehicle ride, get up, ride again. Second time vehicle does not act correctly. + Have to rez new vehicle and delete the old to fix situation. + (DONE 20130520: normalize rotations) +Hitting RESET on Nebadon's vehicle while riding causes vehicle to get into odd + position state where it will not settle onto ground properly, etc + (DONE 20130520: normalize rotations) +Two of Nebadon vehicles in a sim max the CPU. This is new. + (DONE 20130520: two problems: if asset failed to mesh, constantly refetched + asset; vehicle was sending too many messages to all linkset members) +Add material densities to the material types. (WILL NOT BE DONE: not how it is done) +Avatars walking up stairs (DONE) +Avatar movement + flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) + walking up stairs is not calibrated correctly (stairs out of Kepler cabin) (DONE) + avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) +After getting off a vehicle, the root prim is phantom (can be walked through) + Need to force a position update for the root prim after compound shape destruction + (DONE) +Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects. + Regular triangle meshes don't do physical collisions. + (DONE: discovered GImpact is VERY CPU intensive) -- cgit v1.1 From 82e3b9a6e0f0e1731df9080e4de63bc7c7079ec4 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 10 Jun 2013 15:14:55 -0700 Subject: Fix test for adding temporary assets. Code for non-local temporary assets is there but commented out. --- .../Asset/Tests/AssetConnectorTests.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs index 1982473..7073433 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs @@ -93,7 +93,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); lasc.Initialise(config); + // If it is local, it should not be stored AssetBase a1 = AssetHelpers.CreateNotecardAsset(); + a1.Local = true; a1.Temporary = true; lasc.Store(a1); @@ -102,6 +104,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests Assert.That(lasc.GetData(a1.ID), Is.Null); Assert.That(lasc.GetMetadata(a1.ID), Is.Null); + // If it is remote, it should be stored + // AssetBase a2 = AssetHelpers.CreateNotecardAsset(); + // a2.Local = false; + // a2.Temporary = true; + + // lasc.Store(a2); + + // AssetBase retreivedA2 = lasc.Get(a2.ID); + // Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); + // Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); + // Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); + + // AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); + // Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); + + // byte[] retrievedA2Data = lasc.GetData(a2.ID); + // Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); + // TODO: Add cache and check that this does receive a copy of the asset } -- cgit v1.1 From 32d1e50565787eaf8fac8b5f0bd899b6e3b3b303 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 10 Jun 2013 23:30:35 +0100 Subject: Reinstate explicit starting and stopping of PollServiceRequestManager added in 3eee991 but removed in 7c0bfca Do not rely on destructors to stop things. These fire at unpredictable times and cause problems such as http://opensimulator.org/mantis/view.php?id=6503 and most probably http://opensimulator.org/mantis/view.php?id=6668 --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 3 ++- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index eb7c578..96a030b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1805,6 +1805,7 @@ namespace OpenSim.Framework.Servers.HttpServer // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); + m_PollServiceManager.Start(); HTTPDRunning = true; //HttpListenerContext context; @@ -1855,7 +1856,7 @@ namespace OpenSim.Framework.Servers.HttpServer HTTPDRunning = false; try { -// m_PollServiceManager.Stop(); + m_PollServiceManager.Stop(); m_httpListener2.ExceptionThrown -= httpServerException; //m_httpListener2.DisconnectHandler = null; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index a5380c1..ef35886 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -66,7 +66,10 @@ namespace OpenSim.Framework.Servers.HttpServer m_server = pSrv; m_WorkerThreadCount = pWorkerThreadCount; m_workerThreads = new Thread[m_WorkerThreadCount]; + } + public void Start() + { //startup worker threads for (uint i = 0; i < m_WorkerThreadCount; i++) { @@ -91,7 +94,6 @@ namespace OpenSim.Framework.Servers.HttpServer 1000 * 60 * 10); } - private void ReQueueEvent(PollServiceHttpRequest req) { if (m_running) @@ -142,14 +144,14 @@ namespace OpenSim.Framework.Servers.HttpServer } } - ~PollServiceRequestManager() + public void Stop() { m_running = false; // m_timeout = -10000; // cause all to expire Thread.Sleep(1000); // let the world move foreach (Thread t in m_workerThreads) - Watchdog.AbortThread(t.ManagedThreadId); + Watchdog.AbortThread(t.ManagedThreadId); try { -- cgit v1.1 From 7af97f88b7f493b830b46c01acc92934852cabae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 10 Jun 2013 23:39:17 +0100 Subject: Add port numbers to poll service thread names so that we can tell which belong to which HttpServer --- OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index ef35886..aee3e3c 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -76,7 +76,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_workerThreads[i] = Watchdog.StartThread( PoolWorkerJob, - String.Format("PollServiceWorkerThread{0}", i), + string.Format("PollServiceWorkerThread{0}:{1}", i, m_server.Port), ThreadPriority.Normal, false, false, @@ -86,7 +86,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_retrysThread = Watchdog.StartThread( this.CheckRetries, - "PollServiceWatcherThread", + string.Format("PollServiceWatcherThread:{0}", m_server.Port), ThreadPriority.Normal, false, true, -- cgit v1.1 From a949556c4ea74c993fc15bcfdcbc672d9f971897 Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 10 Jun 2013 16:42:49 -0700 Subject: add a Normalize() method for LSL_Rotation --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 9ca5ca9..f6d94a3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -371,6 +371,31 @@ namespace OpenSim.Region.ScriptEngine.Shared #endregion + #region Methods + public Quaternion Normalize() + { + double length = Math.Sqrt(x * x + y * y + z * z + s * s); + if (length < float.Epsilon) + { + x = 1; + y = 0; + z = 0; + s = 0; + } + else + { + + double invLength = 1.0 / length; + x *= invLength; + y *= invLength; + z *= invLength; + s *= invLength; + } + + return this; + } + #endregion + #region Overriders public override int GetHashCode() -- cgit v1.1 From 1c7fbb86c21f79938e4ea9dafef1e8d8f4a29a8d Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 10 Jun 2013 18:47:08 -0500 Subject: Check For NaN and Infinity in llRot2Axis/Angle Fixes mantis #6669 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 ec5aa49..9427061 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4692,7 +4692,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api y = rot.y / s; z = rot.z / s; } - + if ((double.IsNaN(x)) || double.IsInfinity(x)) x = 0; + if ((double.IsNaN(y)) || double.IsInfinity(y)) y = 0; + if ((double.IsNaN(z)) || double.IsInfinity(z)) z = 0; return new LSL_Vector(x,y,z); } @@ -4714,7 +4716,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } double angle = 2 * Math.Acos(rot.s); - + if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0; return angle; } -- cgit v1.1 From b242ead6df06f013f507a4a15495a2720ec5d089 Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 10 Jun 2013 17:10:04 -0700 Subject: llRot2Axis now checks absolute value of s rotation component before normalizing. Also removed some excessive division and cleaned up a bit --- .../Shared/Api/Implementation/LSL_Api.cs | 28 +++++----------------- 1 file changed, 6 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 9427061..c48285a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4665,37 +4665,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llRot2Axis(LSL_Rotation rot) { m_host.AddScriptLPS(1); - double x,y,z; + double x, y, z; - if (rot.s > 1) // normalization needed - { - double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y + - rot.z * rot.z + rot.s * rot.s); - - rot.x /= length; - rot.y /= length; - rot.z /= length; - rot.s /= length; - - } + if (Math.Abs(rot.s) > 1) // normalization needed + rot.Normalize(); - // double angle = 2 * Math.Acos(rot.s); double s = Math.Sqrt(1 - rot.s * rot.s); if (s < 0.001) { - x = 1; - y = z = 0; + return new LSL_Vector(1, 0, 0); } else { - x = rot.x / s; // normalise axis - y = rot.y / s; - z = rot.z / s; + double invS = 1.0 / s; + return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS); } - if ((double.IsNaN(x)) || double.IsInfinity(x)) x = 0; - if ((double.IsNaN(y)) || double.IsInfinity(y)) y = 0; - if ((double.IsNaN(z)) || double.IsInfinity(z)) z = 0; - return new LSL_Vector(x,y,z); } -- cgit v1.1 From 9d9b9d4938687f97ac82fc22917471f22198ef12 Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 10 Jun 2013 17:11:49 -0700 Subject: llRot2Angle now checks absolute value of s rotation component before normalizing --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 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 c48285a..39bac82 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4688,19 +4688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if (rot.s > 1) // normalization needed - { - double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y + - rot.z * rot.z + rot.s * rot.s); - - rot.x /= length; - rot.y /= length; - rot.z /= length; - rot.s /= length; - } + if (Math.Abs(rot.s) > 1) // normalization needed + rot.Normalize(); double angle = 2 * Math.Acos(rot.s); - if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0; + return angle; } -- cgit v1.1 From ba84074468e0805e0a378bf31fc580437e7ce015 Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 10 Jun 2013 17:54:14 -0700 Subject: LSL_Rotation.Normalize() now returns 0,0,0,1 for x,y,z,s when normalization fails --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index f6d94a3..50f9377 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -377,10 +377,10 @@ namespace OpenSim.Region.ScriptEngine.Shared double length = Math.Sqrt(x * x + y * y + z * z + s * s); if (length < float.Epsilon) { - x = 1; + x = 0; y = 0; z = 0; - s = 0; + s = 1; } else { -- cgit v1.1 From ed950e6c7444510c7171c1b7829eedbf731e218a Mon Sep 17 00:00:00 2001 From: dahlia Date: Tue, 11 Jun 2013 00:29:40 -0700 Subject: Adjust output of llRot2Axis and llRot2Angle to match domains SL(tm) uses. Addresses Mantis #0006671 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +++ 1 file changed, 3 insertions(+) (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 39bac82..e1630b3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4678,6 +4678,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else { double invS = 1.0 / s; + if (rot.s < 0) invS = -invS; return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS); } } @@ -4692,6 +4693,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api rot.Normalize(); double angle = 2 * Math.Acos(rot.s); + if (angle > Math.PI) + angle = 2 * Math.PI - angle; return angle; } -- cgit v1.1 From d47a18fd09cfa7abc5fbd646a7a8edbec12c870c Mon Sep 17 00:00:00 2001 From: teravus Date: Tue, 11 Jun 2013 08:56:20 -0500 Subject: * Adds KeyFrameMotion storage support to SQLite, just a note, seems that there's still something wrong with keyframed motion starting when the sim starts up, you have to 'select' and 'deselect' the prim again to get it to appear to move. Not sure what this is but maybe melanie_t can comment on this. * Has a prim table migration.. that might take a while, hold on to your hats. * Fixes a null-ref when shutting down while keyframed motion is active. --- .../Data/SQLite/Resources/RegionStore.migrations | 8 ++++++++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 24 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++-- 3 files changed, 35 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index c6f4b48..bff039d 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -592,3 +592,11 @@ ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; COMMIT; + +:VERSION 29 #---------------- Keyframes + +BEGIN; + +ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; + +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index d4734a6..70b76c9 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -732,6 +732,8 @@ namespace OpenSim.Data.SQLite } SceneObjectGroup group = new SceneObjectGroup(prim); + if (prim.KeyframeMotion != null) + prim.KeyframeMotion.UpdateSceneObject(group); createdObjects.Add(group.UUID, group); retvals.Add(group); LoadItems(prim); @@ -1241,6 +1243,7 @@ namespace OpenSim.Data.SQLite createCol(prims, "Friction", typeof(Double)); createCol(prims, "Restitution", typeof(Double)); + createCol(prims, "KeyframeMotion", typeof(Byte[])); // Add in contraints prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; @@ -1736,6 +1739,20 @@ namespace OpenSim.Data.SQLite prim.Friction = Convert.ToSingle(row["Friction"]); prim.Restitution = Convert.ToSingle(row["Restitution"]); + + if (!(row["KeyframeMotion"] is DBNull)) + { + Byte[] data = (byte[])row["KeyframeMotion"]; + if (data.Length > 0) + prim.KeyframeMotion = KeyframeMotion.FromData(null, data); + else + prim.KeyframeMotion = null; + } + else + { + prim.KeyframeMotion = null; + } + return prim; } @@ -2168,6 +2185,13 @@ namespace OpenSim.Data.SQLite row["GravityModifier"] = (double)prim.GravityModifier; row["Friction"] = (double)prim.Friction; row["Restitution"] = (double)prim.Restitution; + + if (prim.KeyframeMotion != null) + row["KeyframeMotion"] = prim.KeyframeMotion.Serialize(); + else + row["KeyframeMotion"] = new Byte[0]; + + } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ff3f738..482d958 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -779,7 +779,8 @@ namespace OpenSim.Region.Framework.Scenes } // Tell the physics engines that this prim changed. - ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); + if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null) + ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } catch (Exception e) { @@ -892,7 +893,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); } - if (ParentGroup != null) + if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null) ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); //} } -- cgit v1.1 From 26b66c730e85744c365512a8c0a2a3cc64f5695c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 11 Jun 2013 20:39:09 +0200 Subject: Put the "script saved" and "notecard saved" messages back into the bottom right corner. --- .../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 880205a..1203192 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return UUID.Zero; } - remoteClient.SendAgentAlertMessage("Notecard saved", false); + remoteClient.SendAlertMessage("Notecard saved"); } else if ((InventoryType)item.InvType == InventoryType.LSL) { @@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return UUID.Zero; } - remoteClient.SendAgentAlertMessage("Script saved", false); + remoteClient.SendAlertMessage("Script saved"); } AssetBase asset = -- cgit v1.1