From ef4122213c440c55d32c097c08e52170f4b4346a Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Mon, 6 Aug 2012 15:35:40 +0100
Subject: enables configurable minimum sizes for physical & non-physical prims
---
OpenSim/Region/Framework/Scenes/Scene.cs | 31 ++++++++++-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 9 ++--
.../Region/Framework/Scenes/SceneObjectGroup.cs | 60 +++++++++++++++++++---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 13 +++--
.../Shared/Api/Implementation/LSL_Api.cs | 28 +++-------
5 files changed, 101 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0e5ddfd..d2d6aba 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -103,8 +103,26 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool CollidablePrims { get; private set; }
+ ///
+ /// Minimum value of the size of a non-physical prim in each axis
+ ///
+ public float m_minNonphys = 0.01f;
+
+ ///
+ /// Maximum value of the size of a non-physical prim in each axis
+ ///
public float m_maxNonphys = 256;
+
+ ///
+ /// Minimum value of the size of a physical prim in each axis
+ ///
+ public float m_minPhys = 0.01f;
+
+ ///
+ /// Maximum value of the size of a physical prim in each axis
+ ///
public float m_maxPhys = 10;
+
public bool m_clampPrimSize;
public bool m_trustBinaries;
public bool m_allowScriptCrossings;
@@ -721,14 +739,25 @@ namespace OpenSim.Region.Framework.Scenes
PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
+ m_minNonphys = startupConfig.GetFloat("NonphysicalPrimMin", m_minNonphys);
+ if (RegionInfo.NonphysPrimMin > 0)
+ {
+ m_minNonphys = RegionInfo.NonphysPrimMin;
+ }
+
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0)
{
m_maxNonphys = RegionInfo.NonphysPrimMax;
}
- m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
+ m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
+ if (RegionInfo.PhysPrimMin > 0)
+ {
+ m_minPhys = RegionInfo.PhysPrimMin;
+ }
+ m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
if (RegionInfo.PhysPrimMax > 0)
{
m_maxPhys = RegionInfo.PhysPrimMax;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 13842ad..b6339fb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -375,12 +375,9 @@ namespace OpenSim.Region.Framework.Scenes
{
Vector3 scale = part.Shape.Scale;
- if (scale.X > m_parentScene.m_maxNonphys)
- scale.X = m_parentScene.m_maxNonphys;
- if (scale.Y > m_parentScene.m_maxNonphys)
- scale.Y = m_parentScene.m_maxNonphys;
- if (scale.Z > m_parentScene.m_maxNonphys)
- scale.Z = m_parentScene.m_maxNonphys;
+ scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X));
+ scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y));
+ scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z));
part.Shape.Scale = scale;
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5f90035..f6c725b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2674,17 +2674,17 @@ namespace OpenSim.Region.Framework.Scenes
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);
+ scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
+ scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
+ scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null && pa.IsPhysical)
{
- 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);
+ scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X));
+ scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y));
+ scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z));
}
float x = (scale.X / RootPart.Scale.X);
@@ -2716,6 +2716,14 @@ namespace OpenSim.Region.Framework.Scenes
y *= a;
z *= a;
}
+ else if (oldSize.X * x < m_scene.m_minPhys)
+ {
+ f = m_scene.m_minPhys / oldSize.X;
+ a = f / x;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
if (oldSize.Y * y > m_scene.m_maxPhys)
{
@@ -2725,6 +2733,14 @@ namespace OpenSim.Region.Framework.Scenes
y *= a;
z *= a;
}
+ else if (oldSize.Y * y < m_scene.m_minPhys)
+ {
+ f = m_scene.m_minPhys / oldSize.Y;
+ a = f / y;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
if (oldSize.Z * z > m_scene.m_maxPhys)
{
@@ -2734,6 +2750,14 @@ namespace OpenSim.Region.Framework.Scenes
y *= a;
z *= a;
}
+ else if (oldSize.Z * z < m_scene.m_minPhys)
+ {
+ f = m_scene.m_minPhys / oldSize.Z;
+ a = f / z;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
}
else
{
@@ -2745,6 +2769,14 @@ namespace OpenSim.Region.Framework.Scenes
y *= a;
z *= a;
}
+ else if (oldSize.X * x < m_scene.m_minNonphys)
+ {
+ f = m_scene.m_minNonphys / oldSize.X;
+ a = f / x;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
if (oldSize.Y * y > m_scene.m_maxNonphys)
{
@@ -2754,6 +2786,14 @@ namespace OpenSim.Region.Framework.Scenes
y *= a;
z *= a;
}
+ else if (oldSize.Y * y < m_scene.m_minNonphys)
+ {
+ f = m_scene.m_minNonphys / oldSize.Y;
+ a = f / y;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
if (oldSize.Z * z > m_scene.m_maxNonphys)
{
@@ -2763,6 +2803,14 @@ namespace OpenSim.Region.Framework.Scenes
y *= a;
z *= a;
}
+ else if (oldSize.Z * z < m_scene.m_minNonphys)
+ {
+ f = m_scene.m_minNonphys / oldSize.Z;
+ a = f / z;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
}
// obPart.IgnoreUndoUpdate = false;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4c87639..cd75224 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2368,17 +2368,16 @@ namespace OpenSim.Region.Framework.Scenes
///
public void Resize(Vector3 scale)
{
- 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);
+ scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
+ scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
+ scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
PhysicsActor pa = PhysActor;
-
if (pa != null && pa.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.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
+ scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
+ scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
}
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 55567d1..a7852ec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1343,31 +1343,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part == null || part.ParentGroup.IsDeleted)
return;
- if (scale.x < 0.01)
- scale.x = 0.01;
- if (scale.y < 0.01)
- scale.y = 0.01;
- if (scale.z < 0.01)
- scale.z = 0.01;
-
+ // First we need to check whether or not we need to clamp the size of a physics-enabled prim
PhysicsActor pa = part.ParentGroup.RootPart.PhysActor;
-
if (pa != null && pa.IsPhysical)
{
- if (scale.x > World.m_maxPhys)
- scale.x = World.m_maxPhys;
- if (scale.y > World.m_maxPhys)
- scale.y = World.m_maxPhys;
- if (scale.z > World.m_maxPhys)
- scale.z = World.m_maxPhys;
+ scale.x = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.x));
+ scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y));
+ scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z));
}
- if (scale.x > World.m_maxNonphys)
- scale.x = World.m_maxNonphys;
- if (scale.y > World.m_maxNonphys)
- scale.y = World.m_maxNonphys;
- if (scale.z > World.m_maxNonphys)
- scale.z = World.m_maxNonphys;
+ // Next we clamp the scale to the non-physical min/max
+ scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x));
+ scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y));
+ scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z));
Vector3 tmp = part.Scale;
tmp.X = (float)scale.x;
--
cgit v1.1
From 376441e5507052b36279279f64896542d44ec12a Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Wed, 15 Aug 2012 16:27:30 -0700
Subject: BulletSim: make it so objects in a linkset do not generate collisions
with each other.
---
OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 7 +++++++
OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 10 ++++++++++
OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 12 ++++++++++--
3 files changed, 27 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 087b9bb..1b3ba3f 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -42,6 +42,9 @@ public class BSLinkset
private BSScene m_physicsScene;
public BSScene PhysicsScene { get { return m_physicsScene; } }
+ static int m_nextLinksetID = 1;
+ public int LinksetID { get; private set; }
+
// The children under the root in this linkset
private List m_children;
@@ -74,6 +77,10 @@ public class BSLinkset
public BSLinkset(BSScene scene, BSPrim parent)
{
// A simple linkset of one (no children)
+ LinksetID = m_nextLinksetID++;
+ // We create LOTS of linksets.
+ if (m_nextLinksetID < 0)
+ m_nextLinksetID = 1;
m_physicsScene = scene;
m_linksetRoot = parent;
m_children = new List();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 9c20004..c157669 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1353,6 +1353,7 @@ public sealed class BSPrim : PhysicsActor
}
// I've collided with something
+ // Called at taint time from within the Step() function
CollisionEventUpdate collisionCollection;
public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
{
@@ -1366,6 +1367,15 @@ public sealed class BSPrim : PhysicsActor
}
// DetailLog("{0},BSPrim.Collison,call,with={1}", LocalID, collidingWith);
+ BSPrim collidingWithPrim;
+ if (_scene.Prims.TryGetValue(collidingWith, out collidingWithPrim))
+ {
+ // prims in the same linkset cannot collide with each other
+ if (this.Linkset.LinksetID == collidingWithPrim.Linkset.LinksetID)
+ {
+ return;
+ }
+ }
// if someone is subscribed to collision events....
if (_subscribedEventsMs != 0) {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index a31c578..0a0e27e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -78,10 +78,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters
public string BulletSimVersion = "?";
private Dictionary m_avatars = new Dictionary();
+ public Dictionary Characters { get { return m_avatars; } }
+
private Dictionary m_prims = new Dictionary();
+ public Dictionary Prims { get { return m_prims; } }
+
private HashSet m_avatarsWithCollisions = new HashSet();
private HashSet m_primsWithCollisions = new HashSet();
+
private List m_vehicles = new List();
+
private float[] m_heightMap;
private float m_waterLevel;
private uint m_worldID;
@@ -429,13 +435,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
{
numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep,
out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr);
- // DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount);
+ DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount);
}
catch (Exception e)
{
m_log.WarnFormat("{0},PhysicsStep Exception: substeps={1}, updates={2}, colliders={3}, e={4}", LogHeader, numSubSteps, updatedEntityCount, collidersCount, e);
// DetailLog("{0},PhysicsStepException,call, substeps={1}, updates={2}, colliders={3}", DetailLogZero, numSubSteps, updatedEntityCount, collidersCount);
- // updatedEntityCount = 0;
+ updatedEntityCount = 0;
collidersCount = 0;
}
@@ -534,6 +540,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
else if (m_avatars.ContainsKey(collidingWith))
type = ActorTypes.Agent;
+ DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
+
BSPrim prim;
if (m_prims.TryGetValue(localID, out prim)) {
prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
--
cgit v1.1
From 57a98796693cdd34efefbc9235b5d0aa765db095 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Wed, 15 Aug 2012 16:39:00 -0700
Subject: Correct an exception report in SceneObjectPart so it outputs the
stack.
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cd75224..bd6369c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -733,7 +733,7 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
- m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
+ m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
}
}
--
cgit v1.1
From e9ea911563362c4766d34cd948a2915beac06124 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Fri, 17 Aug 2012 16:53:36 +0100
Subject: adding a clip method to handle Vector3 objects to enable a minor
amount of refactoring
---
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a7852ec..b7b5e8e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4019,9 +4019,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetText(string text, LSL_Vector color, double alpha)
{
m_host.AddScriptLPS(1);
- Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
- Util.Clip((float)color.y, 0.0f, 1.0f),
- Util.Clip((float)color.z, 0.0f, 1.0f));
+ Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y,
+ (float)color.z), 0.0f, 1.0f);
m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
//m_host.ParentGroup.HasGroupChanged = true;
//m_host.ParentGroup.ScheduleGroupForFullUpdate();
@@ -7635,9 +7634,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string primText = rules.GetLSLStringItem(idx++);
LSL_Vector primTextColor = rules.GetVector3Item(idx++);
LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
- Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
- Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
- Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
+ Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x,
+ (float)primTextColor.y,
+ (float)primTextColor.z), 0.0f, 1.0f);
part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
break;
--
cgit v1.1
From e31e23d68d9935457ad86559bea37b2b4a63a8dc Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Wed, 15 Aug 2012 16:49:05 -0700
Subject: BulletSim: in BSDynamics, merge 'flags' and 'hoverFlags' as they are
defined for the same bits and it makes the code less complicated.
---
OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 178 +++------------------
1 file changed, 20 insertions(+), 158 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 5a9f135..78bfa05 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -74,7 +74,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// HOVER_UP_ONLY
// LIMIT_MOTOR_UP
// LIMIT_ROLL_ONLY
- private VehicleFlag m_Hoverflags = (VehicleFlag)0;
private Vector3 m_BlockingEndPoint = Vector3.Zero;
private Quaternion m_RollreferenceFrame = Quaternion.Identity;
// Linear properties
@@ -281,157 +280,20 @@ namespace OpenSim.Region.Physics.BulletSPlugin
internal void ProcessVehicleFlags(int pParam, bool remove)
{
DetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", m_prim.LocalID, pParam, remove);
+ VehicleFlag parm = (VehicleFlag)pParam;
if (remove)
{
if (pParam == -1)
{
m_flags = (VehicleFlag)0;
- m_Hoverflags = (VehicleFlag)0;
- return;
}
- if ((pParam & (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) == (int)VehicleFlag.HOVER_GLOBAL_HEIGHT)
- {
- if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != (VehicleFlag)0)
- m_Hoverflags &= ~(VehicleFlag.HOVER_GLOBAL_HEIGHT);
- }
- if ((pParam & (int)VehicleFlag.HOVER_TERRAIN_ONLY) == (int)VehicleFlag.HOVER_TERRAIN_ONLY)
- {
- if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != (VehicleFlag)0)
- m_Hoverflags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY);
- }
- if ((pParam & (int)VehicleFlag.HOVER_UP_ONLY) == (int)VehicleFlag.HOVER_UP_ONLY)
- {
- if ((m_Hoverflags & VehicleFlag.HOVER_UP_ONLY) != (VehicleFlag)0)
- m_Hoverflags &= ~(VehicleFlag.HOVER_UP_ONLY);
- }
- if ((pParam & (int)VehicleFlag.HOVER_WATER_ONLY) == (int)VehicleFlag.HOVER_WATER_ONLY)
- {
- if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != (VehicleFlag)0)
- m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY);
- }
- if ((pParam & (int)VehicleFlag.LIMIT_MOTOR_UP) == (int)VehicleFlag.LIMIT_MOTOR_UP)
- {
- if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.LIMIT_MOTOR_UP);
- }
- if ((pParam & (int)VehicleFlag.LIMIT_ROLL_ONLY) == (int)VehicleFlag.LIMIT_ROLL_ONLY)
- {
- if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.LIMIT_ROLL_ONLY);
- }
- if ((pParam & (int)VehicleFlag.MOUSELOOK_BANK) == (int)VehicleFlag.MOUSELOOK_BANK)
- {
- if ((m_flags & VehicleFlag.MOUSELOOK_BANK) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.MOUSELOOK_BANK);
- }
- if ((pParam & (int)VehicleFlag.MOUSELOOK_STEER) == (int)VehicleFlag.MOUSELOOK_STEER)
- {
- if ((m_flags & VehicleFlag.MOUSELOOK_STEER) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.MOUSELOOK_STEER);
- }
- if ((pParam & (int)VehicleFlag.NO_DEFLECTION_UP) == (int)VehicleFlag.NO_DEFLECTION_UP)
- {
- if ((m_flags & VehicleFlag.NO_DEFLECTION_UP) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP);
- }
- if ((pParam & (int)VehicleFlag.CAMERA_DECOUPLED) == (int)VehicleFlag.CAMERA_DECOUPLED)
- {
- if ((m_flags & VehicleFlag.CAMERA_DECOUPLED) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.CAMERA_DECOUPLED);
- }
- if ((pParam & (int)VehicleFlag.NO_X) == (int)VehicleFlag.NO_X)
- {
- if ((m_flags & VehicleFlag.NO_X) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.NO_X);
- }
- if ((pParam & (int)VehicleFlag.NO_Y) == (int)VehicleFlag.NO_Y)
- {
- if ((m_flags & VehicleFlag.NO_Y) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.NO_Y);
- }
- if ((pParam & (int)VehicleFlag.NO_Z) == (int)VehicleFlag.NO_Z)
- {
- if ((m_flags & VehicleFlag.NO_Z) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.NO_Z);
- }
- if ((pParam & (int)VehicleFlag.LOCK_HOVER_HEIGHT) == (int)VehicleFlag.LOCK_HOVER_HEIGHT)
- {
- if ((m_Hoverflags & VehicleFlag.LOCK_HOVER_HEIGHT) != (VehicleFlag)0)
- m_Hoverflags &= ~(VehicleFlag.LOCK_HOVER_HEIGHT);
- }
- if ((pParam & (int)VehicleFlag.NO_DEFLECTION) == (int)VehicleFlag.NO_DEFLECTION)
- {
- if ((m_flags & VehicleFlag.NO_DEFLECTION) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.NO_DEFLECTION);
- }
- if ((pParam & (int)VehicleFlag.LOCK_ROTATION) == (int)VehicleFlag.LOCK_ROTATION)
+ else
{
- if ((m_flags & VehicleFlag.LOCK_ROTATION) != (VehicleFlag)0)
- m_flags &= ~(VehicleFlag.LOCK_ROTATION);
+ m_flags &= ~parm;
}
}
- else
- {
- if ((pParam & (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) == (int)VehicleFlag.HOVER_GLOBAL_HEIGHT)
- {
- m_Hoverflags |= (VehicleFlag.HOVER_GLOBAL_HEIGHT | m_flags);
- }
- if ((pParam & (int)VehicleFlag.HOVER_TERRAIN_ONLY) == (int)VehicleFlag.HOVER_TERRAIN_ONLY)
- {
- m_Hoverflags |= (VehicleFlag.HOVER_TERRAIN_ONLY | m_flags);
- }
- if ((pParam & (int)VehicleFlag.HOVER_UP_ONLY) == (int)VehicleFlag.HOVER_UP_ONLY)
- {
- m_Hoverflags |= (VehicleFlag.HOVER_UP_ONLY | m_flags);
- }
- if ((pParam & (int)VehicleFlag.HOVER_WATER_ONLY) == (int)VehicleFlag.HOVER_WATER_ONLY)
- {
- m_Hoverflags |= (VehicleFlag.HOVER_WATER_ONLY | m_flags);
- }
- if ((pParam & (int)VehicleFlag.LIMIT_MOTOR_UP) == (int)VehicleFlag.LIMIT_MOTOR_UP)
- {
- m_flags |= (VehicleFlag.LIMIT_MOTOR_UP | m_flags);
- }
- if ((pParam & (int)VehicleFlag.MOUSELOOK_BANK) == (int)VehicleFlag.MOUSELOOK_BANK)
- {
- m_flags |= (VehicleFlag.MOUSELOOK_BANK | m_flags);
- }
- if ((pParam & (int)VehicleFlag.MOUSELOOK_STEER) == (int)VehicleFlag.MOUSELOOK_STEER)
- {
- m_flags |= (VehicleFlag.MOUSELOOK_STEER | m_flags);
- }
- if ((pParam & (int)VehicleFlag.NO_DEFLECTION_UP) == (int)VehicleFlag.NO_DEFLECTION_UP)
- {
- m_flags |= (VehicleFlag.NO_DEFLECTION_UP | m_flags);
- }
- if ((pParam & (int)VehicleFlag.CAMERA_DECOUPLED) == (int)VehicleFlag.CAMERA_DECOUPLED)
- {
- m_flags |= (VehicleFlag.CAMERA_DECOUPLED | m_flags);
- }
- if ((pParam & (int)VehicleFlag.NO_X) == (int)VehicleFlag.NO_X)
- {
- m_flags |= (VehicleFlag.NO_X);
- }
- if ((pParam & (int)VehicleFlag.NO_Y) == (int)VehicleFlag.NO_Y)
- {
- m_flags |= (VehicleFlag.NO_Y);
- }
- if ((pParam & (int)VehicleFlag.NO_Z) == (int)VehicleFlag.NO_Z)
- {
- m_flags |= (VehicleFlag.NO_Z);
- }
- if ((pParam & (int)VehicleFlag.LOCK_HOVER_HEIGHT) == (int)VehicleFlag.LOCK_HOVER_HEIGHT)
- {
- m_Hoverflags |= (VehicleFlag.LOCK_HOVER_HEIGHT);
- }
- if ((pParam & (int)VehicleFlag.NO_DEFLECTION) == (int)VehicleFlag.NO_DEFLECTION)
- {
- m_flags |= (VehicleFlag.NO_DEFLECTION);
- }
- if ((pParam & (int)VehicleFlag.LOCK_ROTATION) == (int)VehicleFlag.LOCK_ROTATION)
- {
- m_flags |= (VehicleFlag.LOCK_ROTATION);
- }
+ else {
+ m_flags |= parm;
}
}//end ProcessVehicleFlags
@@ -478,10 +340,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// m_bankingMix = 1;
// m_bankingTimescale = 10;
// m_referenceFrame = Quaternion.Identity;
- m_Hoverflags &=
+ m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
+ m_flags &=
~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
- m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
break;
case Vehicle.TYPE_CAR:
m_linearFrictionTimescale = new Vector3(100, 2, 1000);
@@ -506,10 +368,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// m_bankingMix = 1;
// m_bankingTimescale = 1;
// m_referenceFrame = Quaternion.Identity;
- m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY |
VehicleFlag.LIMIT_MOTOR_UP);
- m_Hoverflags |= (VehicleFlag.HOVER_UP_ONLY);
+ m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
+ m_flags |= (VehicleFlag.HOVER_UP_ONLY);
break;
case Vehicle.TYPE_BOAT:
m_linearFrictionTimescale = new Vector3(10, 3, 2);
@@ -534,12 +396,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// m_bankingMix = 0.8f;
// m_bankingTimescale = 1;
// m_referenceFrame = Quaternion.Identity;
- m_Hoverflags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY |
+ m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY |
VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
m_flags &= ~(VehicleFlag.LIMIT_ROLL_ONLY);
m_flags |= (VehicleFlag.NO_DEFLECTION_UP |
VehicleFlag.LIMIT_MOTOR_UP);
- m_Hoverflags |= (VehicleFlag.HOVER_WATER_ONLY);
+ m_flags |= (VehicleFlag.HOVER_WATER_ONLY);
break;
case Vehicle.TYPE_AIRPLANE:
m_linearFrictionTimescale = new Vector3(200, 10, 5);
@@ -564,7 +426,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// m_bankingMix = 0.7f;
// m_bankingTimescale = 2;
// m_referenceFrame = Quaternion.Identity;
- m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
+ m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_MOTOR_UP);
m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
@@ -592,11 +454,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// m_bankingMix = 0.7f;
// m_bankingTimescale = 5;
// m_referenceFrame = Quaternion.Identity;
- m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
+ m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
VehicleFlag.HOVER_UP_ONLY);
m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_MOTOR_UP);
m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
- m_Hoverflags |= (VehicleFlag.HOVER_GLOBAL_HEIGHT);
+ m_flags |= (VehicleFlag.HOVER_GLOBAL_HEIGHT);
break;
}
}//end SetDefaultsForType
@@ -736,28 +598,28 @@ namespace OpenSim.Region.Physics.BulletSPlugin
}
// Check if hovering
- if ((m_Hoverflags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0)
+ if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0)
{
// We should hover, get the target height
- if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != 0)
+ if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0)
{
m_VhoverTargetHeight = m_prim.Scene.GetWaterLevel() + m_VhoverHeight;
}
- if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
+ if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
{
m_VhoverTargetHeight = m_prim.Scene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight;
}
- if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0)
+ if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0)
{
m_VhoverTargetHeight = m_VhoverHeight;
}
- if ((m_Hoverflags & VehicleFlag.HOVER_UP_ONLY) != 0)
+ if ((m_flags & VehicleFlag.HOVER_UP_ONLY) != 0)
{
// If body is aready heigher, use its height as target height
if (pos.Z > m_VhoverTargetHeight) m_VhoverTargetHeight = pos.Z;
}
- if ((m_Hoverflags & VehicleFlag.LOCK_HOVER_HEIGHT) != 0)
+ if ((m_flags & VehicleFlag.LOCK_HOVER_HEIGHT) != 0)
{
if ((pos.Z - m_VhoverTargetHeight) > .2 || (pos.Z - m_VhoverTargetHeight) < -.2)
{
--
cgit v1.1
From 8eda290262bb7049aa55a7df2bdb1565bad85a99 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Fri, 17 Aug 2012 09:37:02 -0700
Subject: BulletSim: comments and parameter changes in dynamics engine.
---
OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 50 ++++++++++++----------
OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 6 +--
2 files changed, 30 insertions(+), 26 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 78bfa05..d7213fc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
private int frcount = 0; // Used to limit dynamics debug output to
// every 100th frame
+ private BSScene m_physicsScene;
private BSPrim m_prim; // the prim this dynamic controller belongs to
// Vehicle properties
@@ -123,15 +124,16 @@ namespace OpenSim.Region.Physics.BulletSPlugin
private float m_verticalAttractionEfficiency = 1.0f; // damped
private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor.
- public BSDynamics(BSPrim myPrim)
+ public BSDynamics(BSScene myScene, BSPrim myPrim)
{
+ m_physicsScene = myScene;
m_prim = myPrim;
m_type = Vehicle.TYPE_NONE;
}
internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue, float timestep)
{
- DetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
+ VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
switch (pParam)
{
case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
@@ -230,7 +232,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue, float timestep)
{
- DetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
+ VDetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
switch (pParam)
{
case Vehicle.ANGULAR_FRICTION_TIMESCALE:
@@ -265,7 +267,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
internal void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue)
{
- DetailLog("{0},ProcessRotationalVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
+ VDetailLog("{0},ProcessRotationalVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue);
switch (pParam)
{
case Vehicle.REFERENCE_FRAME:
@@ -279,7 +281,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
internal void ProcessVehicleFlags(int pParam, bool remove)
{
- DetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", m_prim.LocalID, pParam, remove);
+ VDetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", m_prim.LocalID, pParam, remove);
VehicleFlag parm = (VehicleFlag)pParam;
if (remove)
{
@@ -297,9 +299,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
}
}//end ProcessVehicleFlags
- internal void ProcessTypeChange(Vehicle pType)
+ internal void ProcessTypeChange(Vehicle pType, float stepSize)
{
- DetailLog("{0},ProcessTypeChange,type={1}", m_prim.LocalID, pType);
+ VDetailLog("{0},ProcessTypeChange,type={1}", m_prim.LocalID, pType);
// Set Defaults For Type
m_type = pType;
switch (pType)
@@ -475,7 +477,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
MoveAngular(pTimestep);
LimitRotation(pTimestep);
- DetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}",
+ VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}",
m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity);
}// end Step
@@ -519,7 +521,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
*/
- DetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},decay={4},dir={5},vel={6}",
+ VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},decay={4},dir={5},vel={6}",
m_prim.LocalID, origDir, origVel, addAmount, decayfraction, m_linearMotorDirection, m_lastLinearVelocityVector);
}
else
@@ -531,7 +533,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
m_lastLinearVelocityVector = Vector3.Zero;
}
- // convert requested object velocity to world-referenced vector
+ // convert requested object velocity to object relative vector
Quaternion rotq = m_prim.Orientation;
m_dir = m_lastLinearVelocityVector * rotq;
@@ -584,7 +586,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
if (changed)
{
m_prim.Position = pos;
- DetailLog("{0},MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}",
+ VDetailLog("{0},MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}",
m_prim.LocalID, m_BlockingEndPoint, posChange, pos);
}
}
@@ -594,7 +596,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{
pos.Z = m_prim.Scene.GetTerrainHeightAtXYZ(pos) + 2;
m_prim.Position = pos;
- DetailLog("{0},MoveLinear,terrainHeight,pos={1}", m_prim.LocalID, pos);
+ VDetailLog("{0},MoveLinear,terrainHeight,pos={1}", m_prim.LocalID, pos);
}
// Check if hovering
@@ -641,7 +643,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
}
}
- DetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", m_prim.LocalID, pos, m_dir, m_VhoverHeight, m_VhoverTargetHeight);
+ VDetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", m_prim.LocalID, pos, m_dir, m_VhoverHeight, m_VhoverTargetHeight);
// m_VhoverEfficiency = 0f; // 0=boucy, 1=Crit.damped
// m_VhoverTimescale = 0f; // time to acheive height
@@ -677,7 +679,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{
grav.Z = (float)(grav.Z * 1.037125);
}
- DetailLog("{0},MoveLinear,limitMotorUp,grav={1}", m_prim.LocalID, grav);
+ VDetailLog("{0},MoveLinear,limitMotorUp,grav={1}", m_prim.LocalID, grav);
//End Experimental Values
}
if ((m_flags & (VehicleFlag.NO_X)) != 0)
@@ -706,7 +708,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
Vector3 decayamount = Vector3.One / (m_linearFrictionTimescale / pTimestep);
m_lastLinearVelocityVector -= m_lastLinearVelocityVector * decayamount;
- DetailLog("{0},MoveLinear,done,pos={1},vel={2},force={3},decay={4}",
+ VDetailLog("{0},MoveLinear,done,pos={1},vel={2},force={3},decay={4}",
m_prim.LocalID, m_lastPositionVector, m_dir, grav, decayamount);
} // end MoveLinear()
@@ -732,13 +734,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// There are m_angularMotorApply steps.
Vector3 origAngularVelocity = m_angularMotorVelocity;
// ramp up to new value
- // current velocity += error / (time to get there / step interval)
+ // current velocity += error / (time to get there / step interval)
// requested speed - last motor speed
m_angularMotorVelocity.X += (m_angularMotorDirection.X - m_angularMotorVelocity.X) / (m_angularMotorTimescale / pTimestep);
m_angularMotorVelocity.Y += (m_angularMotorDirection.Y - m_angularMotorVelocity.Y) / (m_angularMotorTimescale / pTimestep);
m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep);
- DetailLog("{0},MoveAngular,angularMotorApply,apply={1},origvel={2},dir={3},vel={4}",
+ VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},origvel={2},dir={3},vel={4}",
m_prim.LocalID,m_angularMotorApply,origAngularVelocity, m_angularMotorDirection, m_angularMotorVelocity);
m_angularMotorApply--; // This is done so that if script request rate is less than phys frame rate the expected
@@ -749,6 +751,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// No motor recently applied, keep the body velocity
// and decay the velocity
m_angularMotorVelocity -= m_angularMotorVelocity / (m_angularMotorDecayTimescale / pTimestep);
+ if (m_angularMotorVelocity.LengthSquared() < 0.00001)
+ m_angularMotorVelocity = Vector3.Zero;
} // end motor section
// Vertical attractor section
@@ -786,7 +790,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
vertattr.X += bounce * angularVelocity.X;
vertattr.Y += bounce * angularVelocity.Y;
- DetailLog("{0},MoveAngular,verticalAttraction,verterr={1},bounce={2},vertattr={3}",
+ VDetailLog("{0},MoveAngular,verticalAttraction,verterr={1},bounce={2},vertattr={3}",
m_prim.LocalID, verterr, bounce, vertattr);
} // else vertical attractor is off
@@ -804,13 +808,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{
m_lastAngularVelocity.X = 0;
m_lastAngularVelocity.Y = 0;
- DetailLog("{0},MoveAngular,noDeflectionUp,lastAngular={1}", m_prim.LocalID, m_lastAngularVelocity);
+ VDetailLog("{0},MoveAngular,noDeflectionUp,lastAngular={1}", m_prim.LocalID, m_lastAngularVelocity);
}
if (m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
{
m_lastAngularVelocity = Vector3.Zero; // Reduce small value to zero.
- DetailLog("{0},MoveAngular,zeroSmallValues,lastAngular={1}", m_prim.LocalID, m_lastAngularVelocity);
+ VDetailLog("{0},MoveAngular,zeroSmallValues,lastAngular={1}", m_prim.LocalID, m_lastAngularVelocity);
}
// apply friction
@@ -820,7 +824,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Apply to the body
m_prim.RotationalVelocity = m_lastAngularVelocity;
- DetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", m_prim.LocalID, decayamount, m_lastAngularVelocity);
+ VDetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", m_prim.LocalID, decayamount, m_lastAngularVelocity);
} //end MoveAngular
internal void LimitRotation(float timestep)
@@ -867,11 +871,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
if (changed)
m_prim.Orientation = m_rot;
- DetailLog("{0},LimitRotation,done,changed={1},orig={2},new={3}", m_prim.LocalID, changed, rotq, m_rot);
+ VDetailLog("{0},LimitRotation,done,changed={1},orig={2},new={3}", m_prim.LocalID, changed, rotq, m_rot);
}
// Invoke the detailed logger and output something if it's enabled.
- private void DetailLog(string msg, params Object[] args)
+ private void VDetailLog(string msg, params Object[] args)
{
if (m_prim.Scene.VehicleLoggingEnabled)
m_prim.Scene.PhysicsLogging.Write(msg, args);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index c157669..b918f84 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -141,8 +141,8 @@ public sealed class BSPrim : PhysicsActor
_friction = _scene.Params.defaultFriction; // TODO: compute based on object material
_density = _scene.Params.defaultDensity; // TODO: compute based on object material
_restitution = _scene.Params.defaultRestitution;
- _linkset = new BSLinkset(_scene, this); // a linkset of one
- _vehicle = new BSDynamics(this); // add vehicleness
+ _linkset = new BSLinkset(Scene, this); // a linkset of one
+ _vehicle = new BSDynamics(Scene, this); // add vehicleness
_mass = CalculateMass();
// do the actual object creation at taint time
DetailLog("{0},BSPrim.constructor,call", LocalID);
@@ -354,7 +354,7 @@ public sealed class BSPrim : PhysicsActor
{
// Done at taint time so we're sure the physics engine is not using the variables
// Vehicle code changes the parameters for this vehicle type.
- _vehicle.ProcessTypeChange(type);
+ _vehicle.ProcessTypeChange(type, Scene.LastSimulatedTimestep);
// Tell the scene about the vehicle so it will get processing each frame.
_scene.VehicleInSceneTypeChanged(this, type);
});
--
cgit v1.1
From ccc69d66a135e149dbe9c6b70df0c8efe1265f65 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Fri, 17 Aug 2012 10:40:34 -0700
Subject: BulletSim: add parameters and functionality to specify the mesh
level of detail for large meshes. Remove parameter and code for DetailLog
(conditional logging into regular log file).
---
OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 14 ------
OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 14 +++---
OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 54 +++++++++++------------
3 files changed, 34 insertions(+), 48 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 1b3ba3f..a075995 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -265,7 +265,6 @@ public class BSLinkset
BSPrim childx = child;
m_physicsScene.TaintedObject("AddChildToLinkset", delegate()
{
- // DebugLog("{0}: AddChildToLinkset: adding child {1} to {2}", LogHeader, child.LocalID, m_linksetRoot.LocalID);
// DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
PhysicallyLinkAChildToRoot(rootx, childx); // build the physical binding between me and the child
});
@@ -294,7 +293,6 @@ public class BSLinkset
BSPrim childx = child;
m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate()
{
- // DebugLog("{0}: RemoveChildFromLinkset: Removing constraint to {1}", LogHeader, child.LocalID);
// DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
PhysicallyUnlinkAChildFromRoot(rootx, childx);
@@ -326,7 +324,6 @@ public class BSLinkset
// create a constraint that allows no freedom of movement between the two objects
// http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
- // DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID);
DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2},rLoc={3},cLoc={4},midLoc={5}",
rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID, rootPrim.Position, childPrim.Position, midPoint);
BS6DofConstraint constrain = new BS6DofConstraint(
@@ -350,7 +347,6 @@ public class BSLinkset
// create a constraint that allows no freedom of movement between the two objects
// http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
- // DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID);
DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
BS6DofConstraint constrain = new BS6DofConstraint(
PhysicsScene.World, rootPrim.Body, childPrim.Body,
@@ -389,8 +385,6 @@ public class BSLinkset
// Called at taint time!
private void PhysicallyUnlinkAChildFromRoot(BSPrim rootPrim, BSPrim childPrim)
{
- // DebugLog("{0}: PhysicallyUnlinkAChildFromRoot: RemoveConstraint between root prim {1} and child prim {2}",
- // LogHeader, rootPrim.LocalID, childPrim.LocalID);
DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
// Find the constraint for this link and get rid of it from the overall collection and from my list
@@ -404,20 +398,12 @@ public class BSLinkset
// Called at taint time!
private void PhysicallyUnlinkAllChildrenFromRoot(BSPrim rootPrim)
{
- // DebugLog("{0}: PhysicallyUnlinkAllChildren:", LogHeader);
DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID);
m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.Body);
}
// Invoke the detailed logger and output something if it's enabled.
- private void DebugLog(string msg, params Object[] args)
- {
- if (m_physicsScene.ShouldDebugLog)
- m_physicsScene.Logger.DebugFormat(msg, args);
- }
-
- // Invoke the detailed logger and output something if it's enabled.
private void DetailLog(string msg, params Object[] args)
{
m_physicsScene.PhysicsLogging.Write(msg, args);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index b918f84..48cd89b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -42,8 +42,6 @@ public sealed class BSPrim : PhysicsActor
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[BULLETS PRIM]";
- private void DebugLog(string mm, params Object[] xx) { if (_scene.ShouldDebugLog) m_log.DebugFormat(mm, xx); }
-
private IMesh _mesh;
private PrimitiveBaseShape _pbs;
private ShapeData.PhysicsShapeType _shapeType;
@@ -232,7 +230,6 @@ public sealed class BSPrim : PhysicsActor
BSPrim parent = obj as BSPrim;
if (parent != null)
{
- DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, parent.LocalID);
BSPrim parentBefore = _linkset.LinksetRoot;
int childrenBefore = _linkset.NumberOfChildren;
@@ -248,8 +245,6 @@ public sealed class BSPrim : PhysicsActor
public override void delink() {
// TODO: decide if this parent checking needs to happen at taint time
// Race condition here: if link() and delink() in same simulation tick, the delink will not happen
- DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID,
- _linkset.LinksetRoot._avName+"/"+_linkset.LinksetRoot.LocalID.ToString());
BSPrim parentBefore = _linkset.LinksetRoot;
int childrenBefore = _linkset.NumberOfChildren;
@@ -1042,7 +1037,14 @@ public sealed class BSPrim : PhysicsActor
// No locking here because this is done when we know physics is not simulating
private void CreateGeomMesh()
{
- float lod = _pbs.SculptEntry ? _scene.SculptLOD : _scene.MeshLOD;
+ // level of detail based on size and type of the object
+ float lod = _scene.MeshLOD;
+ if (_pbs.SculptEntry)
+ lod = _scene.SculptLOD;
+ float maxAxis = Math.Max(_size.X, Math.Max(_size.Y, _size.Z));
+ if (maxAxis > _scene.MeshMegaPrimThreshold)
+ lod = _scene.MeshMegaPrimLOD;
+
ulong newMeshKey = (ulong)_pbs.GetMeshKey(_size, lod);
// m_log.DebugFormat("{0}: CreateGeomMesh: lID={1}, oldKey={2}, newKey={3}", LogHeader, _localID, _meshKey, newMeshKey);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 0a0e27e..d901ff0 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -73,8 +73,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[BULLETS SCENE]";
- public void DebugLog(string mm, params Object[] xx) { if (ShouldDebugLog) m_log.DebugFormat(mm, xx); }
-
public string BulletSimVersion = "?";
private Dictionary m_avatars = new Dictionary();
@@ -101,16 +99,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters
private int m_detailedStatsStep = 0;
public IMesher mesher;
- private float m_meshLOD;
- public float MeshLOD
- {
- get { return m_meshLOD; }
- }
- private float m_sculptLOD;
- public float SculptLOD
- {
- get { return m_sculptLOD; }
- }
+ // Level of Detail values kept as float because that's what the Meshmerizer wants
+ public float MeshLOD { get; private set; }
+ public float MeshMegaPrimLOD { get; private set; }
+ public float MeshMegaPrimThreshold { get; private set; }
+ public float SculptLOD { get; private set; }
private BulletSim m_worldSim;
public BulletSim World
@@ -185,8 +178,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
ConfigurationParameters[] m_params;
GCHandle m_paramsHandle;
- public bool ShouldDebugLog { get; private set; }
-
+ // Handle to the callback used by the unmanaged code to call into the managed code.
+ // Used for debug logging.
+ // Need to store the handle in a persistant variable so it won't be freed.
private BulletSimAPI.DebugLogCallback m_DebugLogCallbackHandle;
// Sometimes you just have to log everything.
@@ -905,16 +899,26 @@ public class BSScene : PhysicsScene, IPhysicsParameters
(s) => { return s.NumericBool(s._forceSimplePrimMeshing); },
(s,p,l,v) => { s._forceSimplePrimMeshing = s.BoolNumeric(v); } ),
- new ParameterDefn("MeshLOD", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
+ new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
8f,
- (s,cf,p,v) => { s.m_meshLOD = cf.GetInt(p, (int)v); },
- (s) => { return (float)s.m_meshLOD; },
- (s,p,l,v) => { s.m_meshLOD = (int)v; } ),
- new ParameterDefn("SculptLOD", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
+ (s,cf,p,v) => { s.MeshLOD = (float)cf.GetInt(p, (int)v); },
+ (s) => { return s.MeshLOD; },
+ (s,p,l,v) => { s.MeshLOD = v; } ),
+ new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters",
+ 16f,
+ (s,cf,p,v) => { s.MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); },
+ (s) => { return s.MeshMegaPrimLOD; },
+ (s,p,l,v) => { s.MeshMegaPrimLOD = v; } ),
+ new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD",
+ 10f,
+ (s,cf,p,v) => { s.MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); },
+ (s) => { return s.MeshMegaPrimThreshold; },
+ (s,p,l,v) => { s.MeshMegaPrimThreshold = v; } ),
+ new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
32f,
- (s,cf,p,v) => { s.m_sculptLOD = cf.GetInt(p, (int)v); },
- (s) => { return (float)s.m_sculptLOD; },
- (s,p,l,v) => { s.m_sculptLOD = (int)v; } ),
+ (s,cf,p,v) => { s.SculptLOD = (float)cf.GetInt(p, (int)v); },
+ (s) => { return s.SculptLOD; },
+ (s,p,l,v) => { s.SculptLOD = v; } ),
new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps",
10f,
@@ -1145,12 +1149,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
(s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); },
(s) => { return (float)s.m_detailedStatsStep; },
(s,p,l,v) => { s.m_detailedStatsStep = (int)v; } ),
- new ParameterDefn("ShouldDebugLog", "Enables detailed DEBUG log statements",
- ConfigurationParameters.numericFalse,
- (s,cf,p,v) => { s.ShouldDebugLog = cf.GetBoolean(p, s.BoolNumeric(v)); },
- (s) => { return s.NumericBool(s.ShouldDebugLog); },
- (s,p,l,v) => { s.ShouldDebugLog = s.BoolNumeric(v); } ),
-
};
// Convert a boolean to our numeric true and false values
--
cgit v1.1
From 5c192b9bab4eb3e921f54a94125215c3683f2eca Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Fri, 17 Aug 2012 13:26:18 -0700
Subject: Modify order of code so SOP doesn't set the physics actor flying
property multiple times every time Update is called. This eliminates zillions
of settings which is better for BulletSim. The should be no functionality
change.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 548dfd3..98afb75 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1385,17 +1385,22 @@ namespace OpenSim.Region.Framework.Scenes
bool DCFlagKeyPressed = false;
Vector3 agent_control_v3 = Vector3.Zero;
- bool oldflying = Flying;
+ bool newFlying = actor.Flying;
if (ForceFly)
- actor.Flying = true;
+ newFlying = true;
else if (FlyDisabled)
- actor.Flying = false;
+ newFlying = false;
else
- actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
-
- if (actor.Flying != oldflying)
- update_movementflag = true;
+ newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
+
+ if (actor.Flying != newFlying)
+ {
+ // Note: ScenePresence.Flying is actually fetched from the physical actor
+ // so setting PhysActor.Flying here also sets the ScenePresence's value.
+ actor.Flying = newFlying;
+ update_movementflag = true;
+ }
if (ParentID == 0)
{
--
cgit v1.1
From 03d76e94034bbaa82d1872284d1fadbaa263411d Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Fri, 17 Aug 2012 13:30:46 -0700
Subject: BulletSim: restore most of the Detail logging statements. Will have
no effect on non-logging running. Capture region name that is passed to the
physics engine and use it for detail logging file name prefix. Fix
problem with avatars dropping when flying across region boundries.
---
.../Region/Physics/BulletSPlugin/BSCharacter.cs | 21 +++++-----
OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 8 ++--
OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 46 +++++++++++-----------
OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 16 ++++++--
4 files changed, 51 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index e2f7af9..1b23a36 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -124,10 +124,14 @@ public class BSCharacter : PhysicsActor
// do actual create at taint time
_scene.TaintedObject("BSCharacter.create", delegate()
{
+ DetailLog("{0},BSCharacter.create", _localID);
BulletSimAPI.CreateObject(parent_scene.WorldID, shapeData);
+ // Set the buoyancy for flying. This will be refactored when all the settings happen in C#
+ BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, LocalID, _buoyancy);
+
m_body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID));
- // avatars get all collisions no matter what
+ // avatars get all collisions no matter what (makes walking on ground and such work)
BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
});
@@ -137,7 +141,7 @@ public class BSCharacter : PhysicsActor
// called when this character is being destroyed and the resources should be released
public void Destroy()
{
- // DetailLog("{0},BSCharacter.Destroy", LocalID);
+ DetailLog("{0},BSCharacter.Destroy", LocalID);
_scene.TaintedObject("BSCharacter.destroy", delegate()
{
BulletSimAPI.DestroyObject(_scene.WorldID, _localID);
@@ -319,14 +323,13 @@ public class BSCharacter : PhysicsActor
public override bool Flying {
get { return _flying; }
set {
- if (_flying != value)
- {
- _flying = value;
- // simulate flying by changing the effect of gravity
- this.Buoyancy = ComputeBuoyancyFromFlying(_flying);
- }
+ _flying = value;
+ // simulate flying by changing the effect of gravity
+ this.Buoyancy = ComputeBuoyancyFromFlying(_flying);
}
}
+ // Flying is implimented by changing the avatar's buoyancy.
+ // Would this be done better with a vehicle type?
private float ComputeBuoyancyFromFlying(bool ifFlying) {
return ifFlying ? 1f : 0f;
}
@@ -488,11 +491,9 @@ public class BSCharacter : PhysicsActor
// Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop.
// base.RequestPhysicsterseUpdate();
- /*
DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
LocalID, entprop.Position, entprop.Rotation, entprop.Velocity,
entprop.Acceleration, entprop.RotationalVelocity);
- */
}
// Called by the scene when a collision with this object is reported
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index a075995..9e3f0db 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -265,7 +265,7 @@ public class BSLinkset
BSPrim childx = child;
m_physicsScene.TaintedObject("AddChildToLinkset", delegate()
{
- // DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
+ DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
PhysicallyLinkAChildToRoot(rootx, childx); // build the physical binding between me and the child
});
}
@@ -293,7 +293,7 @@ public class BSLinkset
BSPrim childx = child;
m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate()
{
- // DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
+ DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
PhysicallyUnlinkAChildFromRoot(rootx, childx);
});
@@ -332,10 +332,10 @@ public class BSLinkset
true,
true
);
- /* NOTE: attempt to build constraint with full frame computation, etc.
+ /* NOTE: below is an attempt to build constraint with full frame computation, etc.
* Using the midpoint is easier since it lets the Bullet code use the transforms
* of the objects.
- * Code left here as an example.
+ * Code left as a warning to future programmers.
// ==================================================================================
// relative position normalized to the root prim
OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(rootPrim.Orientation);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 48cd89b..a6bc8e2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -191,7 +191,7 @@ public sealed class BSPrim : PhysicsActor
{
_mass = CalculateMass(); // changing size changes the mass
BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical);
- // DetailLog("{0}: BSPrim.setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical);
+ DetailLog("{0}: BSPrim.setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical);
RecreateGeomAndObject();
});
}
@@ -275,7 +275,7 @@ public sealed class BSPrim : PhysicsActor
public override void LockAngularMotion(OMV.Vector3 axis)
{
- // DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis);
+ DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis);
return;
}
@@ -294,7 +294,7 @@ public sealed class BSPrim : PhysicsActor
// TODO: what does it mean to set the position of a child prim?? Rebuild the constraint?
_scene.TaintedObject("BSPrim.setPosition", delegate()
{
- // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
+ DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation);
});
}
@@ -331,7 +331,7 @@ public sealed class BSPrim : PhysicsActor
_force = value;
_scene.TaintedObject("BSPrim.setForce", delegate()
{
- // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
+ DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
// BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
BulletSimAPI.SetObjectForce2(Body.Ptr, _force);
});
@@ -409,7 +409,7 @@ public sealed class BSPrim : PhysicsActor
_velocity = value;
_scene.TaintedObject("BSPrim.setVelocity", delegate()
{
- // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity);
+ DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity);
BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity);
});
}
@@ -417,7 +417,7 @@ public sealed class BSPrim : PhysicsActor
public override OMV.Vector3 Torque {
get { return _torque; }
set { _torque = value;
- // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque);
+ DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque);
}
}
public override float CollisionScore {
@@ -444,7 +444,7 @@ public sealed class BSPrim : PhysicsActor
_scene.TaintedObject("BSPrim.setOrientation", delegate()
{
// _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID);
- // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
+ DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation);
});
}
@@ -496,13 +496,15 @@ public sealed class BSPrim : PhysicsActor
_linkset.Refresh(this);
CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr);
- // DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf);
+ DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf);
}
// prims don't fly
public override bool Flying {
get { return _flying; }
- set { _flying = value; }
+ set {
+ _flying = value;
+ }
}
public override bool SetAlwaysRun {
get { return _setAlwaysRun; }
@@ -553,7 +555,7 @@ public sealed class BSPrim : PhysicsActor
// m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
_scene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
{
- // DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
+ DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity);
});
}
@@ -570,7 +572,7 @@ public sealed class BSPrim : PhysicsActor
_buoyancy = value;
_scene.TaintedObject("BSPrim.setBuoyancy", delegate()
{
- // DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
+ DetailLog("{0},BSPrim.SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy);
});
}
@@ -633,17 +635,17 @@ public sealed class BSPrim : PhysicsActor
}
m_accumulatedForces.Clear();
}
- // DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force);
+ DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force);
BulletSimAPI.AddObjectForce2(Body.Ptr, fSum);
});
}
public override void AddAngularForce(OMV.Vector3 force, bool pushforce) {
- // DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce);
+ DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce);
// m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce);
}
public override void SetMomentum(OMV.Vector3 momentum) {
- // DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum);
+ DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum);
}
public override void SubscribeEvents(int ms) {
_subscribedEventsMs = ms;
@@ -987,7 +989,7 @@ public sealed class BSPrim : PhysicsActor
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size);
if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE))
{
- // DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild);
+ DetailLog("{0},BSPrim.CreateGeom,sphere (force={1}", LocalID, forceRebuild);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE;
// Bullet native objects are scaled by the Bullet engine so pass the size in
_scale = _size;
@@ -1001,7 +1003,7 @@ public sealed class BSPrim : PhysicsActor
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size);
if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX))
{
- // DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild);
+ DetailLog("{0},BSPrim.CreateGeom,box (force={1})", LocalID, forceRebuild);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX;
_scale = _size;
// TODO: do we need to check for and destroy a mesh or hull that might have been left from before?
@@ -1051,12 +1053,12 @@ public sealed class BSPrim : PhysicsActor
// if this new shape is the same as last time, don't recreate the mesh
if (_meshKey == newMeshKey) return;
- // DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey);
+ DetailLog("{0},BSPrim.CreateGeomMesh,create,key={1}", LocalID, newMeshKey);
// Since we're recreating new, get rid of any previously generated shape
if (_meshKey != 0)
{
// m_log.DebugFormat("{0}: CreateGeom: deleting old mesh. lID={1}, Key={2}", LogHeader, _localID, _meshKey);
- // DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey);
+ DetailLog("{0},BSPrim.CreateGeomMesh,deleteOld,key={1}", LocalID, _meshKey);
BulletSimAPI.DestroyMesh(_scene.WorldID, _meshKey);
_mesh = null;
_meshKey = 0;
@@ -1086,7 +1088,7 @@ public sealed class BSPrim : PhysicsActor
_shapeType = ShapeData.PhysicsShapeType.SHAPE_MESH;
// meshes are already scaled by the meshmerizer
_scale = new OMV.Vector3(1f, 1f, 1f);
- // DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID);
+ DetailLog("{0},BSPrim.CreateGeomMesh,done", LocalID);
return;
}
@@ -1100,13 +1102,13 @@ public sealed class BSPrim : PhysicsActor
// if the hull hasn't changed, don't rebuild it
if (newHullKey == _hullKey) return;
- // DetailLog("{0},BSPrim.CreateGeomHull,create,oldKey={1},newKey={2}", LocalID, _hullKey, newHullKey);
+ DetailLog("{0},BSPrim.CreateGeomHull,create,oldKey={1},newKey={2}", LocalID, _hullKey, newHullKey);
// Since we're recreating new, get rid of any previously generated shape
if (_hullKey != 0)
{
// m_log.DebugFormat("{0}: CreateGeom: deleting old hull. Key={1}", LogHeader, _hullKey);
- // DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _hullKey);
+ DetailLog("{0},BSPrim.CreateGeomHull,deleteOldHull,key={1}", LocalID, _hullKey);
BulletSimAPI.DestroyHull(_scene.WorldID, _hullKey);
_hullKey = 0;
}
@@ -1200,7 +1202,7 @@ public sealed class BSPrim : PhysicsActor
_shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL;
// meshes are already scaled by the meshmerizer
_scale = new OMV.Vector3(1f, 1f, 1f);
- // DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID);
+ DetailLog("{0},BSPrim.CreateGeomHull,done", LocalID);
return;
}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index d901ff0..56924aa 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -73,6 +73,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[BULLETS SCENE]";
+ // The name of the region we're working for.
+ public string RegionName { get; private set; }
+
public string BulletSimVersion = "?";
private Dictionary m_avatars = new Dictionary();
@@ -196,6 +199,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
public BSScene(string identifier)
{
m_initialized = false;
+ // we are passed the name of the region we're working for.
+ RegionName = identifier;
}
public override void Initialise(IMesher meshmerizer, IConfigSource config)
@@ -281,10 +286,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
// Very detailed logging for physics debugging
m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", ".");
- m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-");
+ m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
// Very detailed logging for vehicle debugging
m_vehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
+
+ // Do any replacements in the parameters
+ m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
}
}
}
@@ -362,7 +370,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
BSPrim bsprim = prim as BSPrim;
if (bsprim != null)
{
- // DetailLog("{0},RemovePrim,call", bsprim.LocalID);
+ DetailLog("{0},RemovePrim,call", bsprim.LocalID);
// m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID);
try
{
@@ -388,7 +396,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
if (!m_initialized) return null;
- // DetailLog("{0},AddPrimShape,call", localID);
+ DetailLog("{0},AddPrimShape,call", localID);
BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical);
lock (m_prims) m_prims.Add(localID, prim);
@@ -534,7 +542,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
else if (m_avatars.ContainsKey(collidingWith))
type = ActorTypes.Agent;
- DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
+ // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
BSPrim prim;
if (m_prims.TryGetValue(localID, out prim)) {
--
cgit v1.1
From 0860a0d856ee667bf20db074b778f2518c4d061c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 17 Aug 2012 22:30:01 +0100
Subject: minor: Make xengine debug message on script load a scripting loading
message instead.
This is more useful if compilation fails due to an uncatchable exception since we know what was being compiled.
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 2dba029..1571fb4 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -982,10 +982,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
- UUID assetID = item.AssetID;
+ m_log.DebugFormat(
+ "[XEngine] Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
+ part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
+ part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
- //m_log.DebugFormat("[XEngine] Compiling script {0} ({1} on object {2})",
- // item.Name, itemID.ToString(), part.ParentGroup.RootPart.Name);
+ UUID assetID = item.AssetID;
ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID);
@@ -1164,10 +1166,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
stateSource, m_MaxScriptQueue);
// if (DebugLevel >= 1)
- m_log.DebugFormat(
- "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
- part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
- part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
+// m_log.DebugFormat(
+// "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
+// part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
+// part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
if (presence != null)
{
--
cgit v1.1
From 7243d4f84248092eb5fe4ebe3673501bc84ce250 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Fri, 17 Aug 2012 14:45:18 -0700
Subject: BulletSim: Properly regenerate hulls when objects made physical.
This fixes the problem of non-base shapes (cubes and spheres) falling
through the terrain.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 16 +++++------
OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 34 +++++++++++++++++-------
2 files changed, 33 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 98afb75..65d526f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1392,14 +1392,14 @@ namespace OpenSim.Region.Framework.Scenes
else if (FlyDisabled)
newFlying = false;
else
- newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
-
- if (actor.Flying != newFlying)
- {
- // Note: ScenePresence.Flying is actually fetched from the physical actor
- // so setting PhysActor.Flying here also sets the ScenePresence's value.
- actor.Flying = newFlying;
- update_movementflag = true;
+ newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
+
+ if (actor.Flying != newFlying)
+ {
+ // Note: ScenePresence.Flying is actually fetched from the physical actor
+ // so setting PhysActor.Flying here also sets the ScenePresence's value.
+ actor.Flying = newFlying;
+ update_movementflag = true;
}
if (ParentID == 0)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index a6bc8e2..d3f1e9c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -481,11 +481,8 @@ public sealed class BSPrim : PhysicsActor
// No locking here because only called when it is safe
private void SetObjectDynamic()
{
- // RA: remove this for the moment.
- // The problem is that dynamic objects are hulls so if we are becoming physical
- // the shape has to be checked and possibly built.
- // Maybe a VerifyCorrectPhysicalShape() routine?
- // RecreateGeomAndObject();
+ // If it's becoming dynamic, it will need hullness
+ VerifyCorrectPhysicalShape();
// Bullet wants static objects to have a mass of zero
float mass = IsStatic ? 0f : _mass;
@@ -1214,6 +1211,27 @@ public sealed class BSPrim : PhysicsActor
return;
}
+ private void VerifyCorrectPhysicalShape()
+ {
+ if (IsStatic)
+ {
+ // if static, we don't need a hull so, if there is one, rebuild without it
+ if (_hullKey != 0)
+ {
+ RecreateGeomAndObject();
+ }
+ }
+ else
+ {
+ // if not static, it will need a hull to efficiently collide with things
+ if (_hullKey == 0)
+ {
+ RecreateGeomAndObject();
+ }
+
+ }
+ }
+
// Create an object in Bullet if it has not already been created
// No locking here because this is done when the physics engine is not simulating
// Returns 'true' if an object was actually created.
@@ -1338,10 +1356,8 @@ public sealed class BSPrim : PhysicsActor
_acceleration = entprop.Acceleration;
_rotationalVelocity = entprop.RotationalVelocity;
- // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}",
- // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
- // DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
- // LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
+ DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
+ LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
base.RequestPhysicsterseUpdate();
}
--
cgit v1.1
From 74f5253a366cefa5222a813f4ed349db93c08acc Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Thu, 16 Aug 2012 15:32:20 +0100
Subject: attempt to handle InvalidCastException in a manner similar to Second
Life
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++++
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 15 +++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b7b5e8e..255fc8e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7674,6 +7674,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
+ catch (InvalidCastException e)
+ {
+ ShoutError(e.Message);
+ }
finally
{
if (positionChanged)
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index d848b2a..562433d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -560,12 +560,23 @@ namespace OpenSim.Region.ScriptEngine.Shared
else if (m_data[itemIndex] is LSL_Types.LSLString)
return new LSLInteger(m_data[itemIndex].ToString());
else
- throw new InvalidCastException();
+ throw new InvalidCastException(string.Format(
+ "{0} expected but {1} given",
+ typeof(LSL_Types.LSLInteger).Name,
+ m_data[itemIndex] != null ?
+ m_data[itemIndex].GetType().Name : "null"));
}
public LSL_Types.Vector3 GetVector3Item(int itemIndex)
{
- return (LSL_Types.Vector3)m_data[itemIndex];
+ if(m_data[itemIndex] is LSL_Types.Vector3)
+ return (LSL_Types.Vector3)m_data[itemIndex];
+ else
+ throw new InvalidCastException(string.Format(
+ "{0} expected but {1} given",
+ typeof(LSL_Types.Vector3).Name,
+ m_data[itemIndex] != null ?
+ m_data[itemIndex].GetType().Name : "null"));
}
public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
--
cgit v1.1
From 466d684fbe26b4ea24a0003120d7a875fbbca037 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Wed, 1 Aug 2012 15:18:02 +0100
Subject: implemented
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 50 ++++++++++++++++++++++
.../Shared/Api/Implementation/LSL_Api.cs | 13 ++++++
.../Shared/Api/Runtime/LSL_Constants.cs | 1 +
3 files changed, 64 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index bd6369c..e84ab05 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4236,6 +4236,56 @@ namespace OpenSim.Region.Framework.Scenes
ScheduleFullUpdate();
}
+ public void UpdateSlice(float begin, float end)
+ {
+ if (end < begin)
+ {
+ float temp = begin;
+ begin = end;
+ end = temp;
+ }
+ end = Math.Min(1f, Math.Max(0f, end));
+ begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f);
+ if (begin < 0.02f && end < 0.02f)
+ {
+ begin = 0f;
+ end = 0.02f;
+ }
+
+ ushort uBegin = (ushort)(50000.0 * begin);
+ ushort uEnd = (ushort)(50000.0 * (1f - end));
+ bool updatePossiblyNeeded = false;
+ if (GetPrimType() == PrimType.SPHERE)
+ {
+ if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
+ {
+ m_shape.ProfileBegin = uBegin;
+ m_shape.ProfileEnd = uEnd;
+ updatePossiblyNeeded = true;
+ }
+ }
+ else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd)
+ {
+ m_shape.PathBegin = uBegin;
+ m_shape.PathEnd = uEnd;
+ updatePossiblyNeeded = true;
+ }
+
+ if (updatePossiblyNeeded && ParentGroup != null)
+ {
+ ParentGroup.HasGroupChanged = true;
+ }
+ if (updatePossiblyNeeded && PhysActor != null)
+ {
+ PhysActor.Shape = m_shape;
+ ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
+ }
+ if (updatePossiblyNeeded)
+ {
+ ScheduleFullUpdate();
+ }
+ }
+
///
/// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
/// engine can use it.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 255fc8e..75491da 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7666,6 +7666,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Float gain = rules.GetLSLFloatItem(idx++);
TargetOmega(part, axis, (double)spinrate, (double)gain);
break;
+ case (int)ScriptBaseClass.PRIM_SLICE:
+ if (remain < 1)
+ return;
+ LSL_Vector slice = rules.GetVector3Item(idx++);
+ part.UpdateSlice((float)slice.x, (float)slice.y);
+ break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return null;
@@ -8340,6 +8346,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
res.Add(new LSL_Vector(GetPartLocalPos(part)));
break;
+ case (int)ScriptBaseClass.PRIM_SLICE:
+ res.Add(new LSL_Vector(
+ (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
+ 1 - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
+ 0
+ ));
+ break;
}
}
return res;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index e1c054d..cad8518 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -328,6 +328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_OMEGA = 32;
public const int PRIM_POS_LOCAL = 33;
public const int PRIM_LINK_TARGET = 34;
+ public const int PRIM_SLICE = 35;
public const int PRIM_TEXGEN_DEFAULT = 0;
public const int PRIM_TEXGEN_PLANAR = 1;
--
cgit v1.1
From 7068fddd2fffe356869171ed67be473f7a701470 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Thu, 2 Aug 2012 09:28:32 +0100
Subject: fixing bug that get/set the wrong property for prim types other than
sphere & box
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++-
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e84ab05..53b4f7e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4255,7 +4255,8 @@ namespace OpenSim.Region.Framework.Scenes
ushort uBegin = (ushort)(50000.0 * begin);
ushort uEnd = (ushort)(50000.0 * (1f - end));
bool updatePossiblyNeeded = false;
- if (GetPrimType() == PrimType.SPHERE)
+ PrimType primType = GetPrimType();
+ if (primType == PrimType.SPHERE || primType == PrimType.TORUS || primType == PrimType.TUBE || primType == PrimType.RING)
{
if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 75491da..31d1660 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8347,9 +8347,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Vector(GetPartLocalPos(part)));
break;
case (int)ScriptBaseClass.PRIM_SLICE:
+ PrimType prim_type = part.GetPrimType();
+ bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING);
res.Add(new LSL_Vector(
- (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
- 1 - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
+ (useProfileBeginEnd ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
+ 1 - (useProfileBeginEnd ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
0
));
break;
--
cgit v1.1
From 28d0aff2e395ae3ef85586cf65bd90395eb5c895 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Thu, 16 Aug 2012 09:35:27 +0100
Subject: adding null return to fix building
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 31d1660..6a2b829 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7668,7 +7668,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_SLICE:
if (remain < 1)
- return;
+ return null;
LSL_Vector slice = rules.GetVector3Item(idx++);
part.UpdateSlice((float)slice.x, (float)slice.y);
break;
--
cgit v1.1
From 5d7751da891360c665622562f06a15e02fea4922 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 18 Aug 2012 01:17:01 +0100
Subject: refactoring for Vector3 operator & constructor tweaks
---
.../Shared/Api/Implementation/LSL_Api.cs | 107 +++++++++------------
.../Shared/Api/Implementation/LS_Api.cs | 8 +-
.../Shared/Api/Implementation/MOD_Api.cs | 7 +-
.../Shared/Api/Implementation/OSSL_Api.cs | 22 ++---
.../Api/Implementation/Plugins/SensorRepeat.cs | 9 +-
OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 28 ++----
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 39 ++++++++
.../Region/ScriptEngine/XEngine/EventManager.cs | 20 ++--
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 4 +-
9 files changed, 119 insertions(+), 125 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fceae02..bca9a75 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1097,9 +1097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGround(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
- Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x,
- (float)offset.y,
- (float)offset.z);
+ Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
//Get the slope normal. This gives us the equation of the plane tangent to the slope.
LSL_Vector vsn = llGroundNormal(offset);
@@ -1387,7 +1385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face == ScriptBaseClass.ALL_SIDES)
face = SceneObjectPart.ALL_SIDES;
- m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
+ m_host.SetFaceColor(color, face);
}
public void SetTexGen(SceneObjectPart part, int face,int style)
@@ -1974,7 +1972,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bool sameParcel = here.GlobalID == there.GlobalID;
- if (!sameParcel && !World.Permissions.CanRezObject(m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)))
+ if (!sameParcel && !World.Permissions.CanRezObject(
+ m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos))
{
return 0;
}
@@ -2034,13 +2033,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
targetPos.z = ground;
SceneObjectGroup parent = part.ParentGroup;
- LSL_Vector real_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos);
- parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
+ parent.UpdateGroupPosition(!adjust ? targetPos :
+ SetPosAdjust(currentPos, targetPos));
}
else
{
- LSL_Vector rel_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos);
- part.OffsetPosition = new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z);
+ part.OffsetPosition = !adjust ? targetPos : SetPosAdjust(
+ currentPos, targetPos);
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
@@ -2084,7 +2083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
- return new LSL_Vector(pos.X, pos.Y, pos.Z);
+ return new LSL_Vector(pos);
}
public void llSetRot(LSL_Rotation rot)
@@ -2198,7 +2197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (local != 0)
force *= llGetRot();
- m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
+ m_host.ParentGroup.RootPart.SetForce(force);
}
}
@@ -2210,10 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_host.ParentGroup.IsDeleted)
{
- Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
- force.x = tmpForce.X;
- force.y = tmpForce.Y;
- force.z = tmpForce.Z;
+ force = m_host.ParentGroup.RootPart.GetForce();
}
return force;
@@ -2222,8 +2218,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llTarget(LSL_Vector position, double range)
{
m_host.AddScriptLPS(1);
- return m_host.ParentGroup.registerTargetWaypoint(
- new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range);
+ return m_host.ParentGroup.registerTargetWaypoint(position,
+ (float)range);
}
public void llTargetRemove(int number)
@@ -2248,7 +2244,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llMoveToTarget(LSL_Vector target, double tau)
{
m_host.AddScriptLPS(1);
- m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau);
+ m_host.MoveToTarget(target, (float)tau);
}
public void llStopMoveToTarget()
@@ -2261,7 +2257,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
//No energy force yet
- Vector3 v = new Vector3((float)force.x, (float)force.y, (float)force.z);
+ Vector3 v = force;
if (v.Length() > 20000.0f)
{
v.Normalize();
@@ -2273,13 +2269,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llApplyRotationalImpulse(LSL_Vector force, int local)
{
m_host.AddScriptLPS(1);
- m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0);
+ m_host.ApplyAngularImpulse(force, local != 0);
}
public void llSetTorque(LSL_Vector torque, int local)
{
m_host.AddScriptLPS(1);
- m_host.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0);
+ m_host.SetAngularImpulse(torque, local != 0);
}
public LSL_Vector llGetTorque()
@@ -2830,13 +2826,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
- Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
- Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
-
// need the magnitude later
// float velmag = (float)Util.GetMagnitude(llvel);
- SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param);
+ SceneObjectGroup new_group = World.RezObject(m_host, item, pos, Rot2Quaternion(rot), vel, param);
// If either of these are null, then there was an unknown error.
if (new_group == null)
@@ -2857,10 +2850,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
PhysicsActor pa = new_group.RootPart.PhysActor;
- if (pa != null && pa.IsPhysical && llvel != Vector3.Zero)
+ if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
{
//Recoil.
- llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
+ llApplyImpulse(vel * groupmass, 0);
}
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
});
@@ -3381,7 +3374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain)
{
- part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)));
+ part.UpdateAngularVelocity(axis * spinrate);
}
public LSL_Integer llGetStartParameter()
@@ -3588,7 +3581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
List parts = GetLinkParts(linknumber);
foreach (SceneObjectPart part in parts)
- part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
+ part.SetFaceColor(color, face);
}
public void llCreateLink(string target, int parent)
@@ -4019,8 +4012,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetText(string text, LSL_Vector color, double alpha)
{
m_host.AddScriptLPS(1);
- Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y,
- (float)color.z), 0.0f, 1.0f);
+ Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
//m_host.ParentGroup.HasGroupChanged = true;
//m_host.ParentGroup.ScheduleGroupForFullUpdate();
@@ -4217,14 +4209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(5000);
}
- public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt)
+ public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
{
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
- Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
- Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
-
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
@@ -4253,15 +4242,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
- public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt)
+ public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt)
{
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
- Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
- Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
@@ -4545,7 +4532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
distance_attenuation = 1f / normalized_units;
}
- Vector3 applied_linear_impulse = new Vector3((float)impulse.x, (float)impulse.y, (float)impulse.z);
+ Vector3 applied_linear_impulse = impulse;
{
float impulse_length = applied_linear_impulse.Length();
@@ -6044,9 +6031,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//Plug the x,y coordinates of the slope normal into the equation of the plane to get
//the height of that point on the plane. The resulting vector gives the slope.
- Vector3 vsl = new Vector3();
- vsl.X = (float)vsn.x;
- vsl.Y = (float)vsn.y;
+ Vector3 vsl = vsn;
vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z));
vsl.Normalize();
//Normalization might be overkill here
@@ -6057,9 +6042,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGroundNormal(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
- Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x,
- (float)offset.y,
- (float)offset.z);
+ Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
// Clamp to valid position
if (pos.X < 0)
pos.X = 0;
@@ -6512,8 +6495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_host.ParentGroup.IsDeleted)
{
- m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
- new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
+ m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec);
}
}
@@ -6555,7 +6537,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
rot.z = 1; // ZERO_ROTATION = 0,0,0,1
- part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
+ part.SitTargetPosition = offset;
part.SitTargetOrientation = Rot2Quaternion(rot);
part.ParentGroup.HasGroupChanged = true;
}
@@ -6659,13 +6641,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetCameraEyeOffset(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
- m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
+ m_host.SetCameraEyeOffset(offset);
}
public void llSetCameraAtOffset(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
- m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
+ m_host.SetCameraAtOffset(offset);
}
public LSL_String llDumpList2String(LSL_List src, string seperator)
@@ -6687,7 +6669,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llScriptDanger(LSL_Vector pos)
{
m_host.AddScriptLPS(1);
- bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
+ bool result = World.ScriptDanger(m_host.LocalId, pos);
if (result)
{
return 1;
@@ -7515,7 +7497,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector color=rules.GetVector3Item(idx++);
double alpha=(double)rules.GetLSLFloatItem(idx++);
- part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
+ part.SetFaceColor(color, face);
SetAlpha(part, alpha, face);
break;
@@ -7634,9 +7616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string primText = rules.GetLSLStringItem(idx++);
LSL_Vector primTextColor = rules.GetVector3Item(idx++);
LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
- Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x,
- (float)primTextColor.y,
- (float)primTextColor.z), 0.0f, 1.0f);
+ Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f);
part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
break;
@@ -7691,11 +7671,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part.ParentGroup.RootPart == part)
{
SceneObjectGroup parent = part.ParentGroup;
- parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
+ parent.UpdateGroupPosition(currentPosition);
}
else
{
- part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z);
+ part.OffsetPosition = currentPosition;
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
@@ -7932,8 +7912,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part != null)
{
Vector3 halfSize = part.Scale / 2.0f;
- LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f);
- LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z);
+ LSL_Vector lower = (new LSL_Vector(halfSize)) * -1.0f;
+ LSL_Vector upper = new LSL_Vector(halfSize);
result.Add(lower);
result.Add(upper);
return result;
@@ -9943,9 +9923,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
if (avatar != null)
{
- avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname,
- new Vector3((float)pos.x, (float)pos.y, (float)pos.z),
- new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z));
+ avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
+ simname, pos, lookAt);
}
ScriptSleep(1000);
}
@@ -11143,8 +11122,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
- Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z);
- Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z);
+ Vector3 rayStart = start;
+ Vector3 rayEnd = end;
Vector3 dir = rayEnd - rayStart;
float dist = Vector3.Mag(dir);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 795de80..ceb4660 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
idx++;
iV = rules.GetVector3Item(idx);
- wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ wl.cloudDetailXYDensity = iV;
break;
case (int)ScriptBaseClass.WL_CLOUD_SCALE:
idx++;
@@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
idx++;
iV = rules.GetVector3Item(idx);
- wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ wl.cloudXYDensity = iV;
break;
case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
idx++;
@@ -384,7 +384,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
idx++;
iV = rules.GetVector3Item(idx);
- wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ wl.reflectionWaveletScale = iV;
break;
case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
idx++;
@@ -422,7 +422,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_WATER_COLOR:
idx++;
iV = rules.GetVector3Item(idx);
- wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ wl.waterColor = iV;
break;
case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
idx++;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 7844c75..929948b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -343,8 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (type == typeof(OpenMetaverse.Vector3))
{
- LSL_Vector vect = (LSL_Vector)lslparm;
- return new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
+ return (OpenMetaverse.Vector3)((LSL_Vector)lslparm);
}
}
@@ -372,8 +371,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (plist[i] is LSL_Vector)
{
- LSL_Vector vect = (LSL_Vector)plist[i];
- result[i] = new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
+ result[i] = (OpenMetaverse.Vector3)(
+ (LSL_Vector)plist[i]);
}
else
MODError("unknown LSL list element type");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 859ee93..eff1598 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -773,10 +773,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// We will launch the teleport on a new thread so that when the script threads are terminated
// before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
- Util.FireAndForget(
- o => World.RequestTeleportLocation(presence.ControllingClient, regionName,
- new Vector3((float)position.x, (float)position.y, (float)position.z),
- new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
+ Util.FireAndForget(o => World.RequestTeleportLocation(
+ presence.ControllingClient, regionName, position,
+ lookat, (uint)TPFlags.ViaLocation));
ScriptSleep(5000);
@@ -819,10 +818,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// We will launch the teleport on a new thread so that when the script threads are terminated
// before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
- Util.FireAndForget(
- o => World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
- new Vector3((float)position.x, (float)position.y, (float)position.z),
- new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
+ Util.FireAndForget(o => World.RequestTeleportLocation(
+ presence.ControllingClient, regionHandle,
+ position, lookat, (uint)TPFlags.ViaLocation));
ScriptSleep(5000);
@@ -2329,7 +2327,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ownerID = m_host.OwnerID;
UUID x = module.CreateNPC(firstname,
lastname,
- new Vector3((float) position.x, (float) position.y, (float) position.z),
+ position,
ownerID,
senseAsAgent,
World,
@@ -2446,7 +2444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Vector(0, 0, 0);
}
- public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
+ public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
{
CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
m_host.AddScriptLPS(1);
@@ -2461,7 +2459,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!module.CheckPermissions(npcId, m_host.OwnerID))
return;
- Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
module.MoveToTarget(npcId, World, pos, false, true, false);
}
}
@@ -2481,11 +2478,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!module.CheckPermissions(npcId, m_host.OwnerID))
return;
- Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z);
module.MoveToTarget(
new UUID(npc.m_string),
World,
- pos,
+ target,
(options & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
(options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0,
(options & ScriptBaseClass.OS_NPC_RUNNING) != 0);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index a626be8..7162226 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -428,9 +428,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
try
{
Vector3 diff = toRegionPos - fromRegionPos;
- LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z);
- double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
- double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
+ double dot = LSL_Types.Vector3.Dot(forward_dir, diff);
+ double mag_obj = LSL_Types.Vector3.Mag(diff);
ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));
}
catch
@@ -560,8 +559,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
double ang_obj = 0;
try
{
- Vector3 diff = toRegionPos - fromRegionPos;
- LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z);
+ LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(
+ toRegionPos - fromRegionPos);
double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 0108f44..5a58f73 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -160,11 +160,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
else
{
// Set the values from the touch data provided by the client
- touchST = new LSL_Types.Vector3(value.STCoord.X, value.STCoord.Y, value.STCoord.Z);
- touchUV = new LSL_Types.Vector3(value.UVCoord.X, value.UVCoord.Y, value.UVCoord.Z);
- touchNormal = new LSL_Types.Vector3(value.Normal.X, value.Normal.Y, value.Normal.Z);
- touchBinormal = new LSL_Types.Vector3(value.Binormal.X, value.Binormal.Y, value.Binormal.Z);
- touchPos = new LSL_Types.Vector3(value.Position.X, value.Position.Y, value.Position.Z);
+ touchST = new LSL_Types.Vector3(value.STCoord);
+ touchUV = new LSL_Types.Vector3(value.UVCoord);
+ touchNormal = new LSL_Types.Vector3(value.Normal);
+ touchBinormal = new LSL_Types.Vector3(value.Binormal);
+ touchPos = new LSL_Types.Vector3(value.Position);
touchFace = value.FaceIndex;
}
}
@@ -181,19 +181,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
Name = presence.Firstname + " " + presence.Lastname;
Owner = Key;
- Position = new LSL_Types.Vector3(
- presence.AbsolutePosition.X,
- presence.AbsolutePosition.Y,
- presence.AbsolutePosition.Z);
+ Position = new LSL_Types.Vector3(presence.AbsolutePosition);
Rotation = new LSL_Types.Quaternion(
presence.Rotation.X,
presence.Rotation.Y,
presence.Rotation.Z,
presence.Rotation.W);
- Velocity = new LSL_Types.Vector3(
- presence.Velocity.X,
- presence.Velocity.Y,
- presence.Velocity.Z);
+ Velocity = new LSL_Types.Vector3(presence.Velocity);
if (presence.PresenceType != PresenceType.Npc)
{
@@ -241,16 +235,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
- Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
- part.AbsolutePosition.Y,
- part.AbsolutePosition.Z);
+ Position = new LSL_Types.Vector3(part.AbsolutePosition);
Quaternion wr = part.ParentGroup.GroupRotation;
Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
- Velocity = new LSL_Types.Vector3(part.Velocity.X,
- part.Velocity.Y,
- part.Velocity.Z);
+ Velocity = new LSL_Types.Vector3(part.Velocity);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 562433d..d18efe0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -31,6 +31,11 @@ using System.Globalization;
using System.Text.RegularExpressions;
using OpenSim.Framework;
+using OpenMetaverse;
+using OMV_Vector3 = OpenMetaverse.Vector3;
+using OMV_Vector3d = OpenMetaverse.Vector3d;
+using OMV_Quaternion = OpenMetaverse.Quaternion;
+
namespace OpenSim.Region.ScriptEngine.Shared
{
[Serializable]
@@ -54,6 +59,20 @@ namespace OpenSim.Region.ScriptEngine.Shared
z = (float)vector.z;
}
+ public Vector3(OMV_Vector3 vector)
+ {
+ x = vector.X;
+ y = vector.Y;
+ z = vector.Z;
+ }
+
+ public Vector3(OMV_Vector3d vector)
+ {
+ x = vector.X;
+ y = vector.Y;
+ z = vector.Z;
+ }
+
public Vector3(double X, double Y, double Z)
{
x = X;
@@ -109,6 +128,26 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new list(new object[] { vec });
}
+ public static implicit operator OMV_Vector3(Vector3 vec)
+ {
+ return new OMV_Vector3((float)vec.x, (float)vec.y, (float)vec.z);
+ }
+
+ public static implicit operator Vector3(OMV_Vector3 vec)
+ {
+ return new Vector3(vec);
+ }
+
+ public static implicit operator OMV_Vector3d(Vector3 vec)
+ {
+ return new OMV_Vector3d(vec.x, vec.y, vec.z);
+ }
+
+ public static implicit operator Vector3(OMV_Vector3d vec)
+ {
+ return new Vector3(vec);
+ }
+
public static bool operator ==(Vector3 lhs, Vector3 rhs)
{
return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 5c4174e..a1ad07d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -152,9 +152,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det[0] = new DetectParams();
det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World);
- det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X,
- offsetPos.Y,
- offsetPos.Z);
+ det[0].OffsetPos = offsetPos;
if (originalID == 0)
{
@@ -298,9 +296,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
- d.Position = new LSL_Types.Vector3(detobj.posVector.X,
- detobj.posVector.Y,
- detobj.posVector.Z);
+ d.Position = detobj.posVector;
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -318,9 +314,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
- d.Position = new LSL_Types.Vector3(detobj.posVector.X,
- detobj.posVector.Y,
- detobj.posVector.Z);
+ d.Position = detobj.posVector;
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -337,9 +331,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
- d.Position = new LSL_Types.Vector3(detobj.posVector.X,
- detobj.posVector.Y,
- detobj.posVector.Z);
+ d.Position = detobj.posVector;
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
@@ -381,8 +373,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.PostObjectEvent(localID, new EventParams(
"at_target", new object[] {
new LSL_Types.LSLInteger(handle),
- new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z),
- new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) },
+ new LSL_Types.Vector3(targetpos),
+ new LSL_Types.Vector3(atpos) },
new DetectParams[0]));
}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 1571fb4..a05650a 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1467,7 +1467,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
else if (p[i] is string)
lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
else if (p[i] is Vector3)
- lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
+ lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
else if (p[i] is Quaternion)
lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
else if (p[i] is float)
@@ -1493,7 +1493,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
else if (p[i] is string)
lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
else if (p[i] is Vector3)
- lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
+ lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
else if (p[i] is Quaternion)
lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
else if (p[i] is float)
--
cgit v1.1
From 2a70afeca2a1ba452660ee2669aa4033a91143bb Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 18 Aug 2012 14:00:10 +0100
Subject: Fix the whitespace formatting error introduced by the last patch
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index bca9a75..7671e54 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2038,8 +2038,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- part.OffsetPosition = !adjust ? targetPos : SetPosAdjust(
- currentPos, targetPos);
+ part.OffsetPosition = !adjust ? targetPos :
+ SetPosAdjust(currentPos, targetPos);
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
--
cgit v1.1
From 2b0c8bc48008b8ce38c99d5c3135633b0d4f8e87 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 18 Aug 2012 14:49:10 +0100
Subject: Implementing operators & constructors for Quaternion
---
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index d18efe0..bdc7d70 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -361,6 +361,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
s = 1;
}
+ public Quaternion(OMV_Quaternion rot)
+ {
+ x = rot.X;
+ y = rot.Y;
+ z = rot.Z;
+ s = rot.W;
+ }
+
#endregion
#region Overriders
@@ -407,6 +415,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new list(new object[] { r });
}
+ public static implicit operator OMV_Quaternion(Quaternion rot)
+ {
+ return new OMV_Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
+ }
+
+ public static implicit operator Quaternion(OMV_Quaternion rot)
+ {
+ return new Quaternion(rot);
+ }
+
public static bool operator ==(Quaternion lhs, Quaternion rhs)
{
// Return true if the fields match:
--
cgit v1.1
From 52d7af05bcc5141eef42115e0ac5bca53163717f Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 18 Aug 2012 14:54:13 +0100
Subject: adding missing refactor for LSL_Vector
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7671e54..4d542d50 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10536,7 +10536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
case ScriptBaseClass.OBJECT_VELOCITY:
- ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z));
+ ret.Add(new LSL_Vector(obj.Velocity));
break;
case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(obj.OwnerID.ToString()));
--
cgit v1.1
From fb84ff96a9ac7df564fb8f8242e0ff0d2638b438 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 18 Aug 2012 15:04:07 +0100
Subject: implicit operators mean one does not need to instantiate new objects
manually
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 ++---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 7 +++----
2 files changed, 5 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4d542d50..87298e3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2231,8 +2231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
{
m_host.AddScriptLPS(1);
- return m_host.ParentGroup.registerRotTargetWaypoint(
- new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error);
+ return m_host.ParentGroup.registerRotTargetWaypoint(rot, (float)error);
}
public void llRotTargetRemove(int number)
@@ -10531,7 +10530,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else
rot = obj.GetWorldRotation();
- LSL_Rotation objrot = new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
+ LSL_Rotation objrot = new LSL_Rotation(rot);
ret.Add(objrot);
}
break;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 929948b..84cf6ca 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -333,8 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (type == typeof(OpenMetaverse.Quaternion))
{
- LSL_Rotation rot = (LSL_Rotation)lslparm;
- return new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s);
+ return (OpenMetaverse.Quaternion)((LSL_Rotation)lslparm);
}
}
@@ -366,8 +365,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
result[i] = new UUID((LSL_Key)plist[i]);
else if (plist[i] is LSL_Rotation)
{
- LSL_Rotation rot = (LSL_Rotation)plist[i];
- result[i] = new OpenMetaverse.Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s);
+ result[i] = (OpenMetaverse.Quaternion)(
+ (LSL_Rotation)plist[i]);
}
else if (plist[i] is LSL_Vector)
{
--
cgit v1.1
From ffdde05bb7d3d2ca71807c3197411bf66c29aa45 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 18 Aug 2012 15:10:44 +0100
Subject: constructor means not having to manually refer to individual
properties
---
.../ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 ++--
OpenSim/Region/ScriptEngine/XEngine/EventManager.cs | 4 ++--
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 7162226..24cceea 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -351,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
q = avatar.Rotation * q;
}
- LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
+ LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
@@ -478,7 +478,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
q = avatar.Rotation * q;
}
- LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
+ LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index a1ad07d..cee10df 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -391,8 +391,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.PostObjectEvent(localID, new EventParams(
"at_rot_target", new object[] {
new LSL_Types.LSLInteger(handle),
- new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W),
- new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) },
+ new LSL_Types.Quaternion(targetrot),
+ new LSL_Types.Quaternion(atrot) },
new DetectParams[0]));
}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a05650a..53f899a 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1469,7 +1469,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
else if (p[i] is Vector3)
lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
else if (p[i] is Quaternion)
- lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
+ lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]);
else if (p[i] is float)
lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
else
@@ -1495,7 +1495,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
else if (p[i] is Vector3)
lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
else if (p[i] is Quaternion)
- lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
+ lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]);
else if (p[i] is float)
lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
else
--
cgit v1.1
From ca33619e11d6b370793ffd70dd8a0baefa88f5d1 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 18 Aug 2012 15:18:31 +0100
Subject: Rot2Quaternion is now redundant
---
.../Shared/Api/Implementation/LSL_Api.cs | 21 ++++++++++-----------
.../Shared/Api/Implementation/OSSL_Api.cs | 2 +-
2 files changed, 11 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 87298e3..7009548 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2094,7 +2094,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.ParentID == 0)
{
// special case: If we are root, rotate complete SOG to new rotation
- SetRot(m_host, Rot2Quaternion(rot));
+ SetRot(m_host, rot);
}
else
{
@@ -2102,7 +2102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectPart rootPart = m_host.ParentGroup.RootPart;
if (rootPart != null) // better safe than sorry
{
- SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
+ SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot);
}
}
@@ -2112,7 +2112,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLocalRot(LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
- SetRot(m_host, Rot2Quaternion(rot));
+ SetRot(m_host, rot);
ScriptSleep(200);
}
@@ -2828,7 +2828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// need the magnitude later
// float velmag = (float)Util.GetMagnitude(llvel);
- SceneObjectGroup new_group = World.RezObject(m_host, item, pos, Rot2Quaternion(rot), vel, param);
+ SceneObjectGroup new_group = World.RezObject(m_host, item, pos, rot, vel, param);
// If either of these are null, then there was an unknown error.
if (new_group == null)
@@ -2897,7 +2897,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- m_host.StartLookAt(Rot2Quaternion(rot), (float)strength, (float)damping);
+ m_host.StartLookAt(rot, (float)strength, (float)damping);
}
}
@@ -3292,7 +3292,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping);
+ m_host.RotLookAt(target, (float)strength, (float)damping);
}
}
@@ -6506,7 +6506,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_host.ParentGroup.IsDeleted)
{
- m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot));
+ m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, rot);
}
}
@@ -7316,13 +7316,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part.ParentID == 0)
{
// special case: If we are root, rotate complete SOG to new rotation
- SetRot(part, Rot2Quaternion(q));
+ SetRot(part, q);
}
else
{
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
SceneObjectPart rootPart = part.ParentGroup.RootPart;
- SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
+ SetRot(part, rootPart.RotationOffset * (Quaternion)q);
}
break;
@@ -7634,8 +7634,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
if (remain < 1)
return null;
- LSL_Rotation lr = rules.GetQuaternionItem(idx++);
- SetRot(part, Rot2Quaternion(lr));
+ SetRot(part, rules.GetQuaternionItem(idx++));
break;
case (int)ScriptBaseClass.PRIM_OMEGA:
if (remain < 3)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index eff1598..8936cb2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2533,7 +2533,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence sp = World.GetScenePresence(npcId);
if (sp != null)
- sp.Rotation = LSL_Api.Rot2Quaternion(rotation);
+ sp.Rotation = rotation;
}
}
--
cgit v1.1
From d72d59905668d881c98f35c7f0c9783d6744084d Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Sat, 18 Aug 2012 15:19:15 +0100
Subject: integrating redundant code into operator
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +-------------
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 7 ++++++-
2 files changed, 7 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7009548..4645e7a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -330,14 +330,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return key;
}
- // convert a LSL_Rotation to a Quaternion
- public static Quaternion Rot2Quaternion(LSL_Rotation r)
- {
- Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
- q.Normalize();
- return q;
- }
-
//These are the implementations of the various ll-functions used by the LSL scripts.
public LSL_Float llSin(double f)
{
@@ -6532,12 +6524,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
{
- // LSL quaternions can normalize to 0, normal Quaternions can't.
- if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
- rot.z = 1; // ZERO_ROTATION = 0,0,0,1
-
part.SitTargetPosition = offset;
- part.SitTargetOrientation = Rot2Quaternion(rot);
+ part.SitTargetOrientation = rot;
part.ParentGroup.HasGroupChanged = true;
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index bdc7d70..9d9df9c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -417,7 +417,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
public static implicit operator OMV_Quaternion(Quaternion rot)
{
- return new OMV_Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
+ // LSL quaternions can normalize to 0, normal Quaternions can't.
+ if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
+ rot.z = 1; // ZERO_ROTATION = 0,0,0,1
+ OMV_Quaternion omvrot = new OMV_Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
+ omvrot.Normalize();
+ return omvrot;
}
public static implicit operator Quaternion(OMV_Quaternion rot)
--
cgit v1.1
From 8769e4ee731cfc83afec7ca4994113c2b04d7ba4 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 18 Aug 2012 19:08:38 +0100
Subject: Add a reference to OpenMetaverseType.dll to compiled script
assemblies.
---
OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 2 ++
1 file changed, 2 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 17a0d69..03be2ab 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -546,6 +546,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
"OpenSim.Region.ScriptEngine.Shared.dll"));
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath,
"OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
+ parameters.ReferencedAssemblies.Add(Path.Combine(rootPath,
+ "OpenMetaverseTypes.dll"));
if (lang == enumCompileType.yp)
{
--
cgit v1.1
From dd0556abc9a88121ac91cd86c60a51aac9c726e5 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 19 Aug 2012 22:05:38 +0100
Subject: Fix llDialog responses so that they can be heard throughout the
region. This now conforms to the behaviour in SL.
---
OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 01ceeed..22b3d35 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5810,7 +5810,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
args.Channel = ch;
args.From = String.Empty;
args.Message = Utils.BytesToString(msg);
- args.Type = ChatTypeEnum.Shout;
+ args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
args.Position = new Vector3();
args.Scene = Scene;
args.Sender = this;
--
cgit v1.1
From 9aec62f0ac7ce0e074ee77e687d26c5414190162 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 20 Aug 2012 15:35:06 +0200
Subject: Fix scripted detach of temp attachments
---
.../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f107be1..d6ad07e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -458,10 +458,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so)
{
- // As per Linden spec, detach (take) is disabled for temp attachs
- if (so.FromItemID == UUID.Zero)
- return;
-
lock (sp.AttachmentsSyncLock)
{
// Save avatar attachment information
@@ -976,7 +972,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
- if (sp != null && group != null)
+ if (sp != null && group != null && group.FromItemID != UUID.Zero)
DetachSingleAttachmentToInv(sp, group);
}
@@ -994,7 +990,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
foreach (SceneObjectGroup group in attachments)
{
- if (group.FromItemID == itemID)
+ if (group.FromItemID == itemID && group.FromItemID != UUID.Zero)
{
DetachSingleAttachmentToInv(sp, group);
return;
--
cgit v1.1
From bcbd450fe441e94d6c0f547055b4e95f75a5b0d0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 20 Aug 2012 20:24:54 +0100
Subject: Add --force flag to "kick user" console command to allow bypassing of
recent race condition checks.
This is to allow a second attempt to remove an avatar even if "show connections" shows them as already inactive (i.e. close has already been attempted once).
You should only attempt --force if a normal kick fails.
This is partly for diagnostics as we have seen some connections occasionally remain on lbsa plaza even if they are registered as inactive.
This is not a permanent solution and may not work anyway - the ultimate solution is to stop this problem from happening in the first place.
---
OpenSim/Region/Application/OpenSim.cs | 24 +++++++++++++++-------
.../Caps/EventQueue/Tests/EventQueueTests.cs | 2 +-
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++-----
.../Attachments/Tests/AttachmentsModuleTests.cs | 2 +-
.../EntityTransfer/EntityTransferModule.cs | 2 +-
.../Simulation/LocalSimulationConnector.cs | 2 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++---
.../Scenes/Tests/ScenePresenceAgentTests.cs | 2 +-
.../Server/IRCClientView.cs | 5 +++++
.../Region/OptionalModules/World/NPC/NPCAvatar.cs | 5 +++++
.../Shared/Api/Implementation/OSSL_Api.cs | 4 ++--
11 files changed, 49 insertions(+), 22 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 6bbab35..1fc11f5 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -35,6 +35,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Timers;
using log4net;
+using NDesk.Options;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
@@ -310,8 +311,11 @@ namespace OpenSim
"Change the scale of a named prim", HandleEditScale);
m_console.Commands.AddCommand("Users", false, "kick user",
- "kick user [message]",
- "Kick a user off the simulator", KickUserCommand);
+ "kick user [--force] [message]",
+ "Kick a user off the simulator",
+ "The --force option will kick the user without any checks to see whether it's already in the process of closing\n"
+ + "Only use this option if you are sure the avatar is inactive and a normal kick user operation does not removed them",
+ KickUserCommand);
m_console.Commands.AddCommand("Users", false, "show users",
"show users [full]",
@@ -453,11 +457,17 @@ namespace OpenSim
/// name of avatar to kick
private void KickUserCommand(string module, string[] cmdparams)
{
- if (cmdparams.Length < 4)
+ bool force = false;
+
+ OptionSet options = new OptionSet().Add("f|force", delegate (string v) { force = v != null; });
+
+ List mainParams = options.Parse(cmdparams);
+
+ if (mainParams.Count < 4)
return;
string alert = null;
- if (cmdparams.Length > 4)
+ if (mainParams.Count > 4)
alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
IList agents = SceneManager.GetCurrentSceneAvatars();
@@ -466,8 +476,8 @@ namespace OpenSim
{
RegionInfo regionInfo = presence.Scene.RegionInfo;
- if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
- presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
+ if (presence.Firstname.ToLower().Contains(mainParams[2].ToLower()) &&
+ presence.Lastname.ToLower().Contains(mainParams[3].ToLower()))
{
MainConsole.Instance.Output(
String.Format(
@@ -480,7 +490,7 @@ namespace OpenSim
else
presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n");
- presence.Scene.IncomingCloseAgent(presence.UUID);
+ presence.Scene.IncomingCloseAgent(presence.UUID, force);
}
}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
index cd70410..d604cf6 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
UUID spId = TestHelpers.ParseTail(0x1);
SceneHelpers.AddScenePresence(m_scene, spId);
- m_scene.IncomingCloseAgent(spId);
+ m_scene.IncomingCloseAgent(spId, false);
// TODO: Add more assertions for the other aspects of event queues
Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0));
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 22b3d35..148d0e0 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -487,16 +487,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Client Methods
- ///
- /// Close down the client view
- ///
public void Close()
{
+ Close(false);
+ }
+
+ public void Close(bool force)
+ {
// We lock here to prevent race conditions between two threads calling close simultaneously (e.g.
// a simultaneous relog just as a client is being closed out due to no packet ack from the old connection.
lock (CloseSyncLock)
{
- if (!IsActive)
+ // We still perform a force close inside the sync lock since this is intended to attempt close where
+ // there is some unidentified connection problem, not where we have issues due to deadlock
+ if (!IsActive && !force)
return;
IsActive = false;
@@ -11989,7 +11993,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
Kick(reason);
Thread.Sleep(1000);
- Close();
+ Disconnect();
}
public void Disconnect()
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 1d13f75..82c6390 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -461,7 +461,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
- scene.IncomingCloseAgent(presence.UUID);
+ scene.IncomingCloseAgent(presence.UUID, false);
// Check that we can't retrieve this attachment from the scene.
Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 46738f6..c63b0a4 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -644,7 +644,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// an agent cannot teleport back to this region if it has teleported away.
Thread.Sleep(2000);
- sp.Scene.IncomingCloseAgent(sp.UUID);
+ sp.Scene.IncomingCloseAgent(sp.UUID, false);
}
else
{
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 09a3bd6..1e52d37 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -312,7 +312,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
- Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id); });
+ Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id, false); });
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d2d6aba..ad74189 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4116,16 +4116,19 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Tell a single agent to disconnect from the region.
///
- ///
///
- public bool IncomingCloseAgent(UUID agentID)
+ ///
+ /// Force the agent to close even if it might be in the middle of some other operation. You do not want to
+ /// force unless you are absolutely sure that the agent is dead and a normal close is not working.
+ ///
+ public bool IncomingCloseAgent(UUID agentID, bool force)
{
//m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
if (presence != null)
{
- presence.ControllingClient.Close();
+ presence.ControllingClient.Close(force);
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 5758869..5faf131 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -141,7 +141,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene scene = new SceneHelpers().SetupScene();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
- scene.IncomingCloseAgent(sp.UUID);
+ scene.IncomingCloseAgent(sp.UUID, false);
Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index bae25cd..e93bd7c 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -886,6 +886,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public void Close()
{
+ Close(false);
+ }
+
+ public void Close(bool force)
+ {
Disconnect();
}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 67989ba..a8e4d90 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -901,6 +901,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void Close()
{
+ Close(false);
+ }
+
+ public void Close(bool force)
+ {
// Remove ourselves from the scene
m_scene.RemoveClient(AgentId, false);
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8936cb2..1e8b51b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2877,7 +2877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
avatar.SpeedModifier = (float)SpeedModifier;
}
- public void osKickAvatar(string FirstName,string SurName,string alert)
+ public void osKickAvatar(string FirstName, string SurName, string alert)
{
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
m_host.AddScriptLPS(1);
@@ -2891,7 +2891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
sp.ControllingClient.Kick(alert);
// ...and close on our side
- sp.Scene.IncomingCloseAgent(sp.UUID);
+ sp.Scene.IncomingCloseAgent(sp.UUID, false);
}
});
}
--
cgit v1.1
From 812c498ef4da06d8c842e53e16e22c45e2fecbc2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 20 Aug 2012 21:58:18 +0100
Subject: When loading an OAR, validate any group UUIDs and properly
reconstruct parcel access lists.
If a group UUID is present that is not on this simulator then the object or parcel is no longer group owned.
This is a change from previous behaviour where such invalid UUIDs were kept.
This is an adaptation of patch 0002 from http://opensimulator.org/mantis/view.php?id=6105 by Oren Hurvitz of Kitely.
My adaptations are formatting only, apart from the notices about parcel owner IDs not being saved since this has now been fixed.
Thanks Oren.
---
.../World/Archiver/ArchiveReadRequest.cs | 63 +++++++++++++++++++++-
1 file changed, 62 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 2b61800..433166d 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -97,6 +97,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
}
+ ///
+ /// Used to cache lookups for valid groups.
+ ///
+ private IDictionary m_validGroupUuids = new Dictionary();
+
+ private IGroupsModule m_groupsModule;
+
public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId)
{
m_scene = scene;
@@ -120,6 +127,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Zero can never be a valid user id
m_validUserUuids[UUID.Zero] = false;
+
+ m_groupsModule = m_scene.RequestModuleInterface();
}
public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
@@ -132,6 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Zero can never be a valid user id
m_validUserUuids[UUID.Zero] = false;
+
+ m_groupsModule = m_scene.RequestModuleInterface();
}
///
@@ -302,6 +313,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (!ResolveUserUuid(part.LastOwnerID))
part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
+ if (!ResolveGroupUuid(part.GroupID))
+ part.GroupID = UUID.Zero;
+
// And zap any troublesome sit target information
// part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
// part.SitTargetPosition = new Vector3(0, 0, 0);
@@ -318,13 +332,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
}
+
if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty)
{
if (!ResolveUserUuid(kvp.Value.CreatorID))
kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
}
+
if (UserManager != null)
UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
+
+ if (!ResolveGroupUuid(kvp.Value.GroupID))
+ kvp.Value.GroupID = UUID.Zero;
}
}
}
@@ -364,9 +383,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver
foreach (string serialisedParcel in serialisedParcels)
{
LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
+
+ // Validate User and Group UUID's
+
if (!ResolveUserUuid(parcel.OwnerID))
parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
-
+
+ if (!ResolveGroupUuid(parcel.GroupID))
+ {
+ parcel.GroupID = UUID.Zero;
+ parcel.IsGroupOwned = false;
+ }
+
+ List accessList = new List();
+ foreach (LandAccessEntry entry in parcel.ParcelAccessList)
+ {
+ if (ResolveUserUuid(entry.AgentID))
+ accessList.Add(entry);
+ // else, drop this access rule
+ }
+ parcel.ParcelAccessList = accessList;
+
// m_log.DebugFormat(
// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
// parcel.Name, parcel.LocalID, parcel.Area);
@@ -401,6 +438,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
///
+ /// Look up the given group id to check whether it's one that is valid for this grid.
+ ///
+ ///
+ ///
+ private bool ResolveGroupUuid(UUID uuid)
+ {
+ if (uuid == UUID.Zero)
+ return true; // this means the object has no group
+
+ if (!m_validGroupUuids.ContainsKey(uuid))
+ {
+ bool exists;
+
+ if (m_groupsModule == null)
+ exists = false;
+ else
+ exists = (m_groupsModule.GetGroupRecord(uuid) != null);
+
+ m_validGroupUuids.Add(uuid, exists);
+ }
+
+ return m_validGroupUuids[uuid];
+ }
+
/// Load an asset
///
///
--
cgit v1.1
From e6fb45859775d0c53de0bcdfc48fad51866d318b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 20 Aug 2012 22:18:29 +0100
Subject: no-op change for cia.vc test
---
OpenSim/Region/Application/OpenSim.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 1fc11f5..769eea8 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -420,6 +420,7 @@ namespace OpenSim
{
RunCommandScript(m_shutdownCommandsFile);
}
+
base.ShutdownSpecific();
}
--
cgit v1.1
From aee4353e9cf811bd66a17f292c6f17c9495831fc Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Fri, 17 Aug 2012 14:47:53 +0100
Subject: fix typo
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 53b4f7e..0535dcb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2858,7 +2858,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SetFaceColor(Vector3 color, int face)
{
// The only way to get a deep copy/ If we don't do this, we can
- // mever detect color changes further down.
+ // never detect color changes further down.
Byte[] buf = Shape.Textures.GetBytes();
Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
Color4 texcolor;
--
cgit v1.1
From b863a15a820be7c3b86b27ef24944d6a85fa5360 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Fri, 17 Aug 2012 15:09:52 +0100
Subject: single operation for PRIM_COLOR
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 49 ++++++++++++++++++++++
.../Shared/Api/Implementation/LSL_Api.cs | 3 +-
2 files changed, 50 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0535dcb..6741e5e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2896,6 +2896,55 @@ namespace OpenSim.Region.Framework.Scenes
}
///
+ /// Set the color & alpha of prim faces
+ ///
+ ///
+ ///
+ ///
+ public void SetFaceColorAlpha(int face, Vector3 color, double alpha)
+ {
+ // The only way to get a deep copy/ If we don't do this, we can
+ // never detect color changes further down.
+ Byte[] buf = Shape.Textures.GetBytes();
+ Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
+ Color4 texcolor;
+ if (face >= 0 && face < GetNumberOfSides())
+ {
+ texcolor = tex.CreateFace((uint)face).RGBA;
+ texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
+ tex.FaceTextures[face].RGBA = texcolor;
+ UpdateTextureEntry(tex.GetBytes());
+ return;
+ }
+ else if (face == ALL_SIDES)
+ {
+ for (uint i = 0; i < GetNumberOfSides(); i++)
+ {
+ if (tex.FaceTextures[i] != null)
+ {
+ texcolor = tex.FaceTextures[i].RGBA;
+ texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
+ tex.FaceTextures[i].RGBA = texcolor;
+ }
+ texcolor = tex.DefaultTexture.RGBA;
+ texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
+ tex.DefaultTexture.RGBA = texcolor;
+ }
+ UpdateTextureEntry(tex.GetBytes());
+ return;
+ }
+ }
+
+ ///
/// Get the number of sides that this part has.
///
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4645e7a..dbbfbd3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7484,8 +7484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector color=rules.GetVector3Item(idx++);
double alpha=(double)rules.GetLSLFloatItem(idx++);
- part.SetFaceColor(color, face);
- SetAlpha(part, alpha, face);
+ part.SetFaceColorAlpha(face, new Vector3((float)color.x, (float)color.y, (float)color.z), alpha);
break;
--
cgit v1.1
From ede3b9ab07dc1ed4a51684b7257cbb4d76e9bdfd Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Mon, 20 Aug 2012 09:26:26 +0100
Subject: making use of implicit operators and Util.Clip handling of Vector3
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 47 ++++++++++++----------
.../Shared/Api/Implementation/LSL_Api.cs | 2 +-
2 files changed, 27 insertions(+), 22 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6741e5e..098b2d9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2857,6 +2857,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SetFaceColor(Vector3 color, int face)
{
+ Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
+
// The only way to get a deep copy/ If we don't do this, we can
// never detect color changes further down.
Byte[] buf = Shape.Textures.GetBytes();
@@ -2865,9 +2867,9 @@ namespace OpenSim.Region.Framework.Scenes
if (face >= 0 && face < GetNumberOfSides())
{
texcolor = tex.CreateFace((uint)face).RGBA;
- texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
- texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
- texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ texcolor.R = clippedColor.X;
+ texcolor.G = clippedColor.Y;
+ texcolor.B = clippedColor.Z;
tex.FaceTextures[face].RGBA = texcolor;
UpdateTextureEntry(tex.GetBytes());
return;
@@ -2879,15 +2881,15 @@ namespace OpenSim.Region.Framework.Scenes
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
- texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
- texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
- texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ texcolor.R = clippedColor.X;
+ texcolor.G = clippedColor.Y;
+ texcolor.B = clippedColor.Z;
tex.FaceTextures[i].RGBA = texcolor;
}
texcolor = tex.DefaultTexture.RGBA;
- texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
- texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
- texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ texcolor.R = clippedColor.X;
+ texcolor.G = clippedColor.Y;
+ texcolor.B = clippedColor.Z;
tex.DefaultTexture.RGBA = texcolor;
}
UpdateTextureEntry(tex.GetBytes());
@@ -2903,6 +2905,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SetFaceColorAlpha(int face, Vector3 color, double alpha)
{
+ Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
+ float clippedAlpha = Util.Clip((float)alpha, 0.0f, 1.0f);
+
// The only way to get a deep copy/ If we don't do this, we can
// never detect color changes further down.
Byte[] buf = Shape.Textures.GetBytes();
@@ -2911,10 +2916,10 @@ namespace OpenSim.Region.Framework.Scenes
if (face >= 0 && face < GetNumberOfSides())
{
texcolor = tex.CreateFace((uint)face).RGBA;
- texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
- texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
- texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
- texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
+ texcolor.R = clippedColor.X;
+ texcolor.G = clippedColor.Y;
+ texcolor.B = clippedColor.Z;
+ texcolor.A = clippedAlpha;
tex.FaceTextures[face].RGBA = texcolor;
UpdateTextureEntry(tex.GetBytes());
return;
@@ -2926,17 +2931,17 @@ namespace OpenSim.Region.Framework.Scenes
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
- texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
- texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
- texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
- texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
+ texcolor.R = clippedColor.X;
+ texcolor.G = clippedColor.Y;
+ texcolor.B = clippedColor.Z;
+ texcolor.A = clippedAlpha;
tex.FaceTextures[i].RGBA = texcolor;
}
texcolor = tex.DefaultTexture.RGBA;
- texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
- texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
- texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
- texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
+ texcolor.R = clippedColor.X;
+ texcolor.G = clippedColor.Y;
+ texcolor.B = clippedColor.Z;
+ texcolor.A = clippedAlpha;
tex.DefaultTexture.RGBA = texcolor;
}
UpdateTextureEntry(tex.GetBytes());
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index dbbfbd3..0cbb317 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7484,7 +7484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector color=rules.GetVector3Item(idx++);
double alpha=(double)rules.GetLSLFloatItem(idx++);
- part.SetFaceColorAlpha(face, new Vector3((float)color.x, (float)color.y, (float)color.z), alpha);
+ part.SetFaceColorAlpha(face, color, alpha);
break;
--
cgit v1.1
From 481c00f50a1961ac77e800d64a68e9c30a4b69de Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Mon, 20 Aug 2012 09:31:29 +0100
Subject: refactoring out SetFaceColor
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 67 +++++-----------------
.../Shared/Api/Implementation/LSL_Api.cs | 4 +-
2 files changed, 17 insertions(+), 54 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 098b2d9..2a9ee3a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2851,62 +2851,16 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Set the color of prim faces
- ///
- ///
- ///
- public void SetFaceColor(Vector3 color, int face)
- {
- Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
-
- // The only way to get a deep copy/ If we don't do this, we can
- // never detect color changes further down.
- Byte[] buf = Shape.Textures.GetBytes();
- Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
- Color4 texcolor;
- if (face >= 0 && face < GetNumberOfSides())
- {
- texcolor = tex.CreateFace((uint)face).RGBA;
- texcolor.R = clippedColor.X;
- texcolor.G = clippedColor.Y;
- texcolor.B = clippedColor.Z;
- tex.FaceTextures[face].RGBA = texcolor;
- UpdateTextureEntry(tex.GetBytes());
- return;
- }
- else if (face == ALL_SIDES)
- {
- for (uint i = 0; i < GetNumberOfSides(); i++)
- {
- if (tex.FaceTextures[i] != null)
- {
- texcolor = tex.FaceTextures[i].RGBA;
- texcolor.R = clippedColor.X;
- texcolor.G = clippedColor.Y;
- texcolor.B = clippedColor.Z;
- tex.FaceTextures[i].RGBA = texcolor;
- }
- texcolor = tex.DefaultTexture.RGBA;
- texcolor.R = clippedColor.X;
- texcolor.G = clippedColor.Y;
- texcolor.B = clippedColor.Z;
- tex.DefaultTexture.RGBA = texcolor;
- }
- UpdateTextureEntry(tex.GetBytes());
- return;
- }
- }
-
- ///
/// Set the color & alpha of prim faces
///
///
///
///
- public void SetFaceColorAlpha(int face, Vector3 color, double alpha)
+ public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha)
{
Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
- float clippedAlpha = Util.Clip((float)alpha, 0.0f, 1.0f);
+ float clippedAlpha = alpha.HasValue ?
+ Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0;
// The only way to get a deep copy/ If we don't do this, we can
// never detect color changes further down.
@@ -2919,7 +2873,10 @@ namespace OpenSim.Region.Framework.Scenes
texcolor.R = clippedColor.X;
texcolor.G = clippedColor.Y;
texcolor.B = clippedColor.Z;
- texcolor.A = clippedAlpha;
+ if (alpha.HasValue)
+ {
+ texcolor.A = clippedAlpha;
+ }
tex.FaceTextures[face].RGBA = texcolor;
UpdateTextureEntry(tex.GetBytes());
return;
@@ -2934,14 +2891,20 @@ namespace OpenSim.Region.Framework.Scenes
texcolor.R = clippedColor.X;
texcolor.G = clippedColor.Y;
texcolor.B = clippedColor.Z;
- texcolor.A = clippedAlpha;
+ if (alpha.HasValue)
+ {
+ texcolor.A = clippedAlpha;
+ }
tex.FaceTextures[i].RGBA = texcolor;
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = clippedColor.X;
texcolor.G = clippedColor.Y;
texcolor.B = clippedColor.Z;
- texcolor.A = clippedAlpha;
+ if (alpha.HasValue)
+ {
+ texcolor.A = clippedAlpha;
+ }
tex.DefaultTexture.RGBA = texcolor;
}
UpdateTextureEntry(tex.GetBytes());
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0cbb317..8140416 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1377,7 +1377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face == ScriptBaseClass.ALL_SIDES)
face = SceneObjectPart.ALL_SIDES;
- m_host.SetFaceColor(color, face);
+ m_host.SetFaceColorAlpha(face, color, null);
}
public void SetTexGen(SceneObjectPart part, int face,int style)
@@ -3572,7 +3572,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
List parts = GetLinkParts(linknumber);
foreach (SceneObjectPart part in parts)
- part.SetFaceColor(color, face);
+ part.SetFaceColorAlpha(face, color, null);
}
public void llCreateLink(string target, int parent)
--
cgit v1.1
From 9925317239b9b7cfe90d682aaf4657cb70ff3b7d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 21 Aug 2012 22:21:35 +0100
Subject: Fix bug in SoundModule.PlayAttachedSound() where every sound update
to an avatar would base its gain calculation on the previous avatar's gain,
instead of the original input gain
This is similar to commit d89faa which fixed the same kind of bug in TriggerSound()
---
OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 14c1a39..a2f0950 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -85,13 +85,15 @@ namespace OpenSim.Region.CoreModules.World.Sound
dis = 0;
}
+ float thisSpGain;
+
// Scale by distance
if (radius == 0)
- gain = (float)((double)gain * ((100.0 - dis) / 100.0));
+ thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0));
else
- gain = (float)((double)gain * ((radius - dis) / radius));
+ thisSpGain = (float)((double)gain * ((radius - dis) / radius));
- sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
+ sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags);
});
}
--
cgit v1.1
From 1369058280c4cf399d46df1508b80cad99f1247e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 22 Aug 2012 23:04:17 +0100
Subject: Lock disposal of separate gdi+ objects under different threads since
this prevents malloc heap corruption seen under Ubuntu 10.04.1 and 11.04 -
probably a libcairo issue
In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously,
the native malloc heap can become corrupted, possibly due to a double free(). This may be due to
bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were
seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed
under lock.
---
.../Scripting/VectorRender/VectorRenderModule.cs | 68 +++++++++++++---------
1 file changed, 42 insertions(+), 26 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index ca320e1..c48a703 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -308,36 +308,44 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
try
{
- if (alpha == 256)
- bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
- else
- bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
-
- graph = Graphics.FromImage(bitmap);
-
- // this is really just to save people filling the
- // background color in their scripts, only do when fully opaque
- if (alpha >= 255)
+ // XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously,
+ // the native malloc heap can become corrupted, possibly due to a double free(). This may be due to
+ // bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were
+ // seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed
+ // under lock.
+ lock (this)
{
- using (SolidBrush bgFillBrush = new SolidBrush(bgColor))
+ if (alpha == 256)
+ bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
+ else
+ bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
+
+ graph = Graphics.FromImage(bitmap);
+
+ // this is really just to save people filling the
+ // background color in their scripts, only do when fully opaque
+ if (alpha >= 255)
{
- graph.FillRectangle(bgFillBrush, 0, 0, width, height);
+ using (SolidBrush bgFillBrush = new SolidBrush(bgColor))
+ {
+ graph.FillRectangle(bgFillBrush, 0, 0, width, height);
+ }
}
- }
-
- for (int w = 0; w < bitmap.Width; w++)
- {
- if (alpha <= 255)
+
+ for (int w = 0; w < bitmap.Width; w++)
{
- for (int h = 0; h < bitmap.Height; h++)
+ if (alpha <= 255)
{
- bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h)));
+ for (int h = 0; h < bitmap.Height; h++)
+ {
+ bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h)));
+ }
}
}
+
+ GDIDraw(data, graph, altDataDelim);
}
- GDIDraw(data, graph, altDataDelim);
-
byte[] imageJ2000 = new byte[0];
try
@@ -355,11 +363,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
}
finally
{
- if (graph != null)
- graph.Dispose();
-
- if (bitmap != null)
- bitmap.Dispose();
+ // XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously,
+ // the native malloc heap can become corrupted, possibly due to a double free(). This may be due to
+ // bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were
+ // seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed
+ // under lock.
+ lock (this)
+ {
+ if (graph != null)
+ graph.Dispose();
+
+ if (bitmap != null)
+ bitmap.Dispose();
+ }
}
}
--
cgit v1.1
From 4820dfd733a5b6dae54e120cfb1486643765bb3e Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Tue, 21 Aug 2012 12:30:47 +0100
Subject: this should be an if-else block in case the non-phys min/max are
smaller than the physical min/max
---
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8140416..0d275f7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1341,11 +1341,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y));
scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z));
}
-
- // Next we clamp the scale to the non-physical min/max
- scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x));
- scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y));
- scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z));
+ else
+ {
+ // If not physical, then we clamp the scale to the non-physical min/max
+ scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x));
+ scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y));
+ scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z));
+ }
Vector3 tmp = part.Scale;
tmp.X = (float)scale.x;
--
cgit v1.1
From aede42b87559aa1f8f3197b53b9bf5c2b547701a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 23 Aug 2012 23:13:53 +0100
Subject: If a script state save fails for some reason on shutdown/region
removal, get xengine to spit out some useful information and continue to save
other script states
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 27 ++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 53f899a..5a3f002 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -589,7 +589,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (m_Assemblies.ContainsKey(instance.AssetID))
{
string assembly = m_Assemblies[instance.AssetID];
- instance.SaveState(assembly);
+
+ try
+ {
+ instance.SaveState(assembly);
+ }
+ catch (Exception e)
+ {
+ m_log.Error(
+ string.Format(
+ "[XEngine]: Failed final state save for script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ",
+ instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name)
+ , e);
+ }
}
// Clear the event queue and abort the instance thread
@@ -707,7 +719,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
assembly = m_Assemblies[i.AssetID];
}
- i.SaveState(assembly);
+ try
+ {
+ i.SaveState(assembly);
+ }
+ catch (Exception e)
+ {
+ m_log.Error(
+ string.Format(
+ "[XEngine]: Failed to save state of script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ",
+ i.PrimName, i.ScriptName, i.ItemID, i.ObjectID, World.Name)
+ , e);
+ }
}
instances.Clear();
--
cgit v1.1
From 4f3fabae5bec8a71f9953ef9f4c247e086e4757f Mon Sep 17 00:00:00 2001
From: TBG Renfold
Date: Thu, 9 Aug 2012 18:03:26 +0100
Subject: Adds osGetHealth.
Returns the amount of health (in an integer) that an avatar has left in the scene.
If an avatar is not found or safe is enabled on a region, -1 is returned.
Example usage:
default
{
touch_end(integer _t)
{
key agentID = llDetectedKey(0);
osCauseDamage(agentID, 50);
llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
}
}
---
.../Shared/Api/Implementation/OSSL_Api.cs | 21 +++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 7 ++++++-
3 files changed, 28 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 1e8b51b..3d233d7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2895,6 +2895,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
});
}
+
+ public LSL_Float osGetHealth(string avatar)
+ {
+ CheckThreatLevel(ThreatLevel.None, "osGetHealth");
+ m_host.AddScriptLPS(1);
+
+ UUID avatarId = new UUID(avatar);
+ Vector3 pos = m_host.GetWorldPosition();
+
+ LSL_Float health = new LSL_Float(-1);
+ ScenePresence presence = World.GetScenePresence(avatarId);
+ if (presence != null)
+ {
+ LandData land = World.GetLandData((float)pos.X, (float)pos.Y);
+ if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
+ {
+ health = presence.Health;
+ }
+ }
+ return health;
+ }
public void osCauseDamage(string avatar, double damage)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 1f000a3..9ad1c22 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -258,6 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
int osGetSimulatorMemory();
void osKickAvatar(string FirstName,string SurName,string alert);
void osSetSpeed(string UUID, LSL_Float SpeedModifier);
+ LSL_Float osGetHealth(string avatar);
void osCauseHealing(string avatar, double healing);
void osCauseDamage(string avatar, double damage);
LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 94405d2..e9131e4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -865,7 +865,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
}
-
+
+ public LSL_Float osGetHealth(string avatar)
+ {
+ return m_OSSL_Functions.osGetHealth(avatar);
+ }
+
public void osCauseDamage(string avatar, double damage)
{
m_OSSL_Functions.osCauseDamage(avatar, damage);
--
cgit v1.1
From a3cbda0d74a14c05acf04adaaa5b9ff30c6d9fa5 Mon Sep 17 00:00:00 2001
From: TBG Renfold
Date: Fri, 10 Aug 2012 01:29:41 +0100
Subject: Removed land checking as suggested by SignpostMarv.
Now whatever remaining health the avatar has is displayed (float).
This will be 100% (100.000000) if no damage has occurred (as what the viewer should really be seeing anyway).
Returns -1.000000 if the avatar is not found.
---
.../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 3d233d7..5e7c2d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2901,19 +2901,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.None, "osGetHealth");
m_host.AddScriptLPS(1);
- UUID avatarId = new UUID(avatar);
- Vector3 pos = m_host.GetWorldPosition();
-
LSL_Float health = new LSL_Float(-1);
- ScenePresence presence = World.GetScenePresence(avatarId);
- if (presence != null)
- {
- LandData land = World.GetLandData((float)pos.X, (float)pos.Y);
- if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
- {
- health = presence.Health;
- }
- }
+ ScenePresence presence = World.GetScenePresence(new UUID(avatar));
+ if (presence != null) health = presence.Health;
return health;
}
--
cgit v1.1
From c55768466626336849c650349b335365c41359e5 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Fri, 24 Aug 2012 00:15:30 +0100
Subject: Fix bad child prim permissions that can make objects change perms
after rezzing
Port from Avination
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 +++
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 18 +++++++++++++++---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 21 +++++++++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 7e31d60..675c64d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1943,6 +1943,9 @@ namespace OpenSim.Region.Framework.Scenes
deleteIDs.Add(localID);
deleteGroups.Add(grp);
+ // If child prims have invalid perms, fix them
+ grp.AdjustChildPrimPermissions();
+
if (remoteClient == null)
{
// Autoreturn has a null client. Nothing else does. So
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f6c725b..b4a155e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2131,6 +2131,9 @@ namespace OpenSim.Region.Framework.Scenes
// Can't do this yet since backup still makes use of the root part without any synchronization
// objectGroup.m_rootPart = null;
+ // If linking prims with different permissions, fix them
+ AdjustChildPrimPermissions();
+
AttachToBackup();
// Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
@@ -2622,12 +2625,21 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public void AdjustChildPrimPermissions()
+ {
+ ForEachPart(part =>
+ {
+ if (part != RootPart)
+ part.ClonePermissions(RootPart);
+ });
+ }
+
public void UpdatePermissions(UUID AgentID, byte field, uint localID,
uint mask, byte addRemTF)
{
- SceneObjectPart[] parts = m_parts.GetArray();
- for (int i = 0; i < parts.Length; i++)
- parts[i].UpdatePermissions(AgentID, field, localID, mask, addRemTF);
+ RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
+
+ AdjustChildPrimPermissions();
HasGroupChanged = true;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2a9ee3a..411dcc7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3890,6 +3890,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public void ClonePermissions(SceneObjectPart source)
+ {
+ bool update = false;
+
+ if (BaseMask != source.BaseMask ||
+ OwnerMask != source.OwnerMask ||
+ GroupMask != source.GroupMask ||
+ EveryoneMask != source.EveryoneMask ||
+ NextOwnerMask != source.NextOwnerMask)
+ update = true;
+
+ BaseMask = source.BaseMask;
+ OwnerMask = source.OwnerMask;
+ GroupMask = source.GroupMask;
+ EveryoneMask = source.EveryoneMask;
+ NextOwnerMask = source.NextOwnerMask;
+
+ if (update)
+ SendFullUpdateToAllClients();
+ }
+
public bool IsHingeJoint()
{
// For now, we use the NINJA naming scheme for identifying joints.
--
cgit v1.1
From 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Fri, 10 Aug 2012 15:58:29 +0100
Subject: implementing function to allow scripts to self-replicate as if the
owner duplicated them, using the same script delay as llRezObject()
---
.../Shared/Api/Implementation/OSSL_Api.cs | 50 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 +++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++
3 files changed, 62 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 5e7c2d9..119c2ac 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3344,5 +3344,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Key(m_host.ParentGroup.FromPartID.ToString());
}
+
+ public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot)
+ {
+ CheckThreatLevel(ThreatLevel.High, "osRezDuplicate");
+ m_host.AddScriptLPS(1);
+
+ Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
+ Quaternion r = new Quaternion(
+ (float)rot.x,
+ (float)rot.y,
+ (float)rot.z,
+ (float)rot.s
+ );
+
+ Vector3 destination = m_host.ParentGroup.AbsolutePosition + v;
+
+ if (!World.Permissions.CanRezObject(
+ m_host.ParentGroup.PrimCount,
+ m_host.OwnerID,
+ destination
+ ))
+ {
+ OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel.");
+
+ ScriptSleep(100);
+ }
+ else
+ {
+ SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject(
+ m_host.ParentGroup.LocalId,
+ v,
+ m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(),
+ m_host.OwnerID,
+ m_host.GroupID,
+ r
+ );
+
+ m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
+ "object_rez", new Object[] {
+ new LSL_String(
+ duplicate.RootPart.UUID.ToString()) },
+ new DetectParams[0]));
+
+ ScriptSleep(100);
+ m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams(
+ "on_rez", new Object[]{
+ new LSL_Integer(0)},
+ new DetectParams[0]));
+ }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 9ad1c22..8c90df4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -306,5 +306,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
///
/// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.
LSL_Key osGetRezzingObject();
+
+ ///
+ /// Duplicates an object as if the owner duplicated it.
+ ///
+ ///
+ ///
+ void osRezDuplicate(vector offset, rotation rot);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index e9131e4..9a2f859 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -955,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetRezzingObject();
}
+
+ public void osRezDuplicate(vector offset, rotation rot)
+ {
+ m_OSSL_Functions.osRezDuplicate(offset, rot);
+ }
}
}
--
cgit v1.1
From a08687aef35079f6c2884d3ae6fd8307ca8a6b0d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 24 Aug 2012 01:18:35 +0100
Subject: Revert "implementing function to allow scripts to self-replicate as
if the owner duplicated them, using the same script delay as llRezObject()"
This reverts commit 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8.
Reverted pending consideration of associated issues.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 50 ----------------------
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 ---
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ---
3 files changed, 62 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 119c2ac..5e7c2d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3344,55 +3344,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Key(m_host.ParentGroup.FromPartID.ToString());
}
-
- public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot)
- {
- CheckThreatLevel(ThreatLevel.High, "osRezDuplicate");
- m_host.AddScriptLPS(1);
-
- Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
- Quaternion r = new Quaternion(
- (float)rot.x,
- (float)rot.y,
- (float)rot.z,
- (float)rot.s
- );
-
- Vector3 destination = m_host.ParentGroup.AbsolutePosition + v;
-
- if (!World.Permissions.CanRezObject(
- m_host.ParentGroup.PrimCount,
- m_host.OwnerID,
- destination
- ))
- {
- OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel.");
-
- ScriptSleep(100);
- }
- else
- {
- SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject(
- m_host.ParentGroup.LocalId,
- v,
- m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(),
- m_host.OwnerID,
- m_host.GroupID,
- r
- );
-
- m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
- "object_rez", new Object[] {
- new LSL_String(
- duplicate.RootPart.UUID.ToString()) },
- new DetectParams[0]));
-
- ScriptSleep(100);
- m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams(
- "on_rez", new Object[]{
- new LSL_Integer(0)},
- new DetectParams[0]));
- }
- }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 8c90df4..9ad1c22 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -306,12 +306,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
///
/// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.
LSL_Key osGetRezzingObject();
-
- ///
- /// Duplicates an object as if the owner duplicated it.
- ///
- ///
- ///
- void osRezDuplicate(vector offset, rotation rot);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 9a2f859..e9131e4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -955,10 +955,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetRezzingObject();
}
-
- public void osRezDuplicate(vector offset, rotation rot)
- {
- m_OSSL_Functions.osRezDuplicate(offset, rot);
- }
}
}
--
cgit v1.1
From d188272462f2c8d3e67aead26bb5b15ab243cdab Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Fri, 24 Aug 2012 13:52:30 +0100
Subject: refactoring using List.ConvertAll
---
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0d275f7..a98fb04 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5170,17 +5170,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
string ret = String.Empty;
- int x = 0;
m_host.AddScriptLPS(1);
if (src.Data.Length > 0)
{
- ret = src.Data[x++].ToString();
- for (; x < src.Data.Length; x++)
- {
- ret += ", "+src.Data[x].ToString();
- }
+ ret = string.Join(", ",
+ (new List