aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDan Lake2013-02-06 16:45:47 -0800
committerDan Lake2013-02-06 16:45:47 -0800
commit7590ebc934477d0c410cae1bbc40664453d57001 (patch)
treeabcb69bf2b26d23454a37af8609711376b6f1dee /OpenSim
parentWebStats will now use actual logfile as specified in OpenSim.exe.config rathe... (diff)
parentminor: add method doc to DAMap.ValidateKey() (diff)
downloadopensim-SC_OLD-7590ebc934477d0c410cae1bbc40664453d57001.zip
opensim-SC_OLD-7590ebc934477d0c410cae1bbc40664453d57001.tar.gz
opensim-SC_OLD-7590ebc934477d0c410cae1bbc40664453d57001.tar.bz2
opensim-SC_OLD-7590ebc934477d0c410cae1bbc40664453d57001.tar.xz
Merge branch 'master' of git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs54
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations13
-rw-r--r--OpenSim/Framework/DAMap.cs7
-rw-r--r--OpenSim/Framework/ExtraPhysicsData.cs (renamed from OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs)26
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs98
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs119
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs107
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs43
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs26
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs77
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs120
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs11
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs3
20 files changed, 431 insertions, 429 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index c95311e..41174f4 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Data.MySQL
52 private string m_connectionString; 52 private string m_connectionString;
53 private object m_dbLock = new object(); 53 private object m_dbLock = new object();
54 54
55 protected virtual Assembly Assembly 55 protected Assembly Assembly
56 { 56 {
57 get { return GetType().Assembly; } 57 get { return GetType().Assembly; }
58 } 58 }
@@ -119,8 +119,10 @@ namespace OpenSim.Data.MySQL
119 119
120 // Eligibility check 120 // Eligibility check
121 // 121 //
122 if ((flags & (uint)PrimFlags.Temporary) != 0) 122 // PrimFlags.Temporary is not used in OpenSim code and cannot
123 return; 123 // be guaranteed to always be clear. Don't check it.
124// if ((flags & (uint)PrimFlags.Temporary) != 0)
125// return;
124 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) 126 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
125 return; 127 return;
126 128
@@ -135,7 +137,7 @@ namespace OpenSim.Data.MySQL
135 foreach (SceneObjectPart prim in obj.Parts) 137 foreach (SceneObjectPart prim in obj.Parts)
136 { 138 {
137 cmd.Parameters.Clear(); 139 cmd.Parameters.Clear();
138 140
139 cmd.CommandText = "replace into prims (" + 141 cmd.CommandText = "replace into prims (" +
140 "UUID, CreationDate, " + 142 "UUID, CreationDate, " +
141 "Name, Text, Description, " + 143 "Name, Text, Description, " +
@@ -171,8 +173,10 @@ namespace OpenSim.Data.MySQL
171 "ParticleSystem, ClickAction, Material, " + 173 "ParticleSystem, ClickAction, Material, " +
172 "CollisionSound, CollisionSoundVolume, " + 174 "CollisionSound, CollisionSoundVolume, " +
173 "PassTouches, " + 175 "PassTouches, " +
174 "LinkNumber, MediaURL, DynAttrs) " + 176 "LinkNumber, MediaURL, " +
175 "values (?UUID, " + 177 "PhysicsShapeType, Density, GravityModifier, " +
178 "Friction, Restitution, DynAttrs " +
179 ") values (" + "?UUID, " +
176 "?CreationDate, ?Name, ?Text, " + 180 "?CreationDate, ?Name, ?Text, " +
177 "?Description, ?SitName, ?TouchName, " + 181 "?Description, ?SitName, ?TouchName, " +
178 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + 182 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
@@ -203,15 +207,17 @@ namespace OpenSim.Data.MySQL
203 "?SaleType, ?ColorR, ?ColorG, " + 207 "?SaleType, ?ColorR, ?ColorG, " +
204 "?ColorB, ?ColorA, ?ParticleSystem, " + 208 "?ColorB, ?ColorA, ?ParticleSystem, " +
205 "?ClickAction, ?Material, ?CollisionSound, " + 209 "?ClickAction, ?Material, ?CollisionSound, " +
206 "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, " + 210 "?CollisionSoundVolume, ?PassTouches, " +
207 "?MediaURL, ?DynAttrs)"; 211 "?LinkNumber, ?MediaURL, " +
208 212 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
213 "?Friction, ?Restitution, ?DynAttrs)";
214
209 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 215 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
210 216
211 ExecuteNonQuery(cmd); 217 ExecuteNonQuery(cmd);
212 218
213 cmd.Parameters.Clear(); 219 cmd.Parameters.Clear();
214 220
215 cmd.CommandText = "replace into primshapes (" + 221 cmd.CommandText = "replace into primshapes (" +
216 "UUID, Shape, ScaleX, ScaleY, " + 222 "UUID, Shape, ScaleX, ScaleY, " +
217 "ScaleZ, PCode, PathBegin, PathEnd, " + 223 "ScaleZ, PCode, PathBegin, PathEnd, " +
@@ -234,9 +240,9 @@ namespace OpenSim.Data.MySQL
234 "?ProfileEnd, ?ProfileCurve, " + 240 "?ProfileEnd, ?ProfileCurve, " +
235 "?ProfileHollow, ?Texture, ?ExtraParams, " + 241 "?ProfileHollow, ?Texture, ?ExtraParams, " +
236 "?State, ?Media)"; 242 "?State, ?Media)";
237 243
238 FillShapeCommand(cmd, prim); 244 FillShapeCommand(cmd, prim);
239 245
240 ExecuteNonQuery(cmd); 246 ExecuteNonQuery(cmd);
241 } 247 }
242 } 248 }
@@ -582,7 +588,7 @@ namespace OpenSim.Data.MySQL
582 cmd.CommandText = "insert into terrain (RegionUUID, " + 588 cmd.CommandText = "insert into terrain (RegionUUID, " +
583 "Revision, Heightfield) values (?RegionUUID, " + 589 "Revision, Heightfield) values (?RegionUUID, " +
584 "1, ?Heightfield)"; 590 "1, ?Heightfield)";
585 591
586 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); 592 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter));
587 593
588 ExecuteNonQuery(cmd); 594 ExecuteNonQuery(cmd);
@@ -741,7 +747,7 @@ namespace OpenSim.Data.MySQL
741 { 747 {
742 //No result, so store our default windlight profile and return it 748 //No result, so store our default windlight profile and return it
743 nWP.regionID = regionUUID; 749 nWP.regionID = regionUUID;
744 StoreRegionWindlightSettings(nWP); 750// StoreRegionWindlightSettings(nWP);
745 return nWP; 751 return nWP;
746 } 752 }
747 else 753 else
@@ -1097,7 +1103,8 @@ namespace OpenSim.Data.MySQL
1097 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + 1103 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1098 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1104 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1099 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1105 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1100 "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; 1106 "?TerrainImageID, " +
1107 "?TelehubObject, ?ParcelImageID)";
1101 1108
1102 FillRegionSettingsCommand(cmd, rs); 1109 FillRegionSettingsCommand(cmd, rs);
1103 1110
@@ -1300,6 +1307,12 @@ namespace OpenSim.Data.MySQL
1300 else 1307 else
1301 prim.DynAttrs = new DAMap(); 1308 prim.DynAttrs = new DAMap();
1302 1309
1310 prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
1311 prim.Density = (float)(double)row["Density"];
1312 prim.GravityModifier = (float)(double)row["GravityModifier"];
1313 prim.Friction = (float)(double)row["Friction"];
1314 prim.Bounciness = (float)(double)row["Restitution"];
1315
1303 return prim; 1316 return prim;
1304 } 1317 }
1305 1318
@@ -1646,6 +1659,12 @@ namespace OpenSim.Data.MySQL
1646 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1659 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1647 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1660 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1648 1661
1662 cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
1663 cmd.Parameters.AddWithValue("Density", (double)prim.Density);
1664 cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
1665 cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
1666 cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness);
1667
1649 if (prim.DynAttrs.Count > 0) 1668 if (prim.DynAttrs.Count > 0)
1650 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); 1669 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1651 else 1670 else
@@ -1728,6 +1747,7 @@ namespace OpenSim.Data.MySQL
1728 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1747 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1729 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1748 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1730 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1749 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1750
1731 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1751 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1732 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1752 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
1733 } 1753 }
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index c48aec2..48cd60b 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -910,3 +910,16 @@ BEGIN;
910ALTER TABLE prims ADD COLUMN DynAttrs TEXT; 910ALTER TABLE prims ADD COLUMN DynAttrs TEXT;
911 911
912COMMIT; 912COMMIT;
913
914:VERSION 47 #---------------- Extra prim params
915
916BEGIN;
917
918ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0';
919ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000';
920ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1';
921ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6';
922ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5';
923
924COMMIT;
925
diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs
index 291c8b8..24e0895 100644
--- a/OpenSim/Framework/DAMap.cs
+++ b/OpenSim/Framework/DAMap.cs
@@ -168,6 +168,10 @@ namespace OpenSim.Framework
168 } 168 }
169 } 169 }
170 170
171 /// <summary>
172 /// Validate the key used for storing separate data stores.
173 /// </summary>
174 /// <param name='key'></param>
171 private static void ValidateKey(string key) 175 private static void ValidateKey(string key)
172 { 176 {
173 if (key.Length < MIN_STORE_NAME_LENGTH) 177 if (key.Length < MIN_STORE_NAME_LENGTH)
@@ -188,7 +192,8 @@ namespace OpenSim.Framework
188 } 192 }
189 193
190 public void Add(KeyValuePair<string, OSDMap> kvp) 194 public void Add(KeyValuePair<string, OSDMap> kvp)
191 { 195 {
196 ValidateKey(kvp.Key);
192 lock (this) 197 lock (this)
193 m_map.Add(kvp.Key, kvp.Value); 198 m_map.Add(kvp.Key, kvp.Value);
194 } 199 }
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs b/OpenSim/Framework/ExtraPhysicsData.cs
index f3be028..9e7334f 100644
--- a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs
+++ b/OpenSim/Framework/ExtraPhysicsData.cs
@@ -27,20 +27,24 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Scenes.Scripting 30namespace OpenSim.Framework
31{ 31{
32 public interface IScriptHost 32 public enum PhysShapeType : byte
33 { 33 {
34 string Name { get; set; } 34 prim = 0,
35 string Description { get; set; } 35 none = 1,
36 convex = 2,
36 37
37 UUID UUID { get; } 38 invalid = 255 // use to mark invalid data in ExtraPhysicsData
38 UUID OwnerID { get; } 39 }
39 UUID CreatorID { get; } 40
40 Vector3 AbsolutePosition { get; } 41 public struct ExtraPhysicsData
42 {
43 public float Density;
44 public float GravitationModifier;
45 public float Friction;
46 public float Bounce;
47 public PhysShapeType PhysShapeType;
41 48
42 string SitName { get; set; }
43 string TouchName { get; set; }
44 void SetText(string text, Vector3 color, double alpha);
45 } 49 }
46} 50}
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index f5c06df..3c8e199 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -714,7 +714,7 @@ namespace OpenSim
714 714
715 return new Scene( 715 return new Scene(
716 regionInfo, circuitManager, sceneGridService, 716 regionInfo, circuitManager, sceneGridService,
717 simDataService, estateDataService, false, 717 simDataService, estateDataService,
718 Config, m_version); 718 Config, m_version);
719 } 719 }
720 720
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f8d84e3..de3978c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -720,7 +720,6 @@ namespace OpenSim.Region.Framework.Scenes
720 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 720 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
721 SceneCommunicationService sceneGridService, 721 SceneCommunicationService sceneGridService,
722 ISimulationDataService simDataService, IEstateDataService estateDataService, 722 ISimulationDataService simDataService, IEstateDataService estateDataService,
723 bool dumpAssetsToFile,
724 IConfigSource config, string simulatorVersion) 723 IConfigSource config, string simulatorVersion)
725 : this(regInfo) 724 : this(regInfo)
726 { 725 {
@@ -811,8 +810,6 @@ namespace OpenSim.Region.Framework.Scenes
811 810
812 RegisterDefaultSceneEvents(); 811 RegisterDefaultSceneEvents();
813 812
814 DumpAssetsToFile = dumpAssetsToFile;
815
816 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled 813 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
817 // better in the future. 814 // better in the future.
818 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 815 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
@@ -4482,19 +4479,6 @@ namespace OpenSim.Region.Framework.Scenes
4482 4479
4483 #region Script Engine 4480 #region Script Engine
4484 4481
4485 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
4486 public bool DumpAssetsToFile;
4487
4488 /// <summary>
4489 ///
4490 /// </summary>
4491 /// <param name="scriptEngine"></param>
4492 public void AddScriptEngine(ScriptEngineInterface scriptEngine)
4493 {
4494 ScriptEngines.Add(scriptEngine);
4495 scriptEngine.InitializeEngine(this);
4496 }
4497
4498 private bool ScriptDanger(SceneObjectPart part,Vector3 pos) 4482 private bool ScriptDanger(SceneObjectPart part,Vector3 pos)
4499 { 4483 {
4500 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); 4484 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 189d298..55b5462 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
116 116
117 #endregion Enumerations 117 #endregion Enumerations
118 118
119 public class SceneObjectPart : IScriptHost, ISceneEntity 119 public class SceneObjectPart : ISceneEntity
120 { 120 {
121 /// <value> 121 /// <value>
122 /// Denote all sides of the prim 122 /// Denote all sides of the prim
@@ -302,6 +302,13 @@ namespace OpenSim.Region.Framework.Scenes
302 protected Vector3 m_lastAcceleration; 302 protected Vector3 m_lastAcceleration;
303 protected Vector3 m_lastAngularVelocity; 303 protected Vector3 m_lastAngularVelocity;
304 protected int m_lastTerseSent; 304 protected int m_lastTerseSent;
305
306 protected byte m_physicsShapeType = (byte)PhysShapeType.prim;
307 // TODO: Implement these
308 //protected float m_density = 1000.0f; // in kg/m^3
309 //protected float m_gravitymod = 1.0f;
310 //protected float m_friction = 0.6f; // wood
311 //protected float m_bounce = 0.5f; // wood
305 312
306 /// <summary> 313 /// <summary>
307 /// Stores media texture data 314 /// Stores media texture data
@@ -1322,6 +1329,69 @@ namespace OpenSim.Region.Framework.Scenes
1322 set { m_collisionSoundVolume = value; } 1329 set { m_collisionSoundVolume = value; }
1323 } 1330 }
1324 1331
1332 public byte DefaultPhysicsShapeType()
1333 {
1334 byte type;
1335
1336 if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh))
1337 type = (byte)PhysShapeType.convex;
1338 else
1339 type = (byte)PhysShapeType.prim;
1340
1341 return type;
1342 }
1343
1344 public byte PhysicsShapeType
1345 {
1346 get { return m_physicsShapeType; }
1347 set
1348 {
1349 byte oldv = m_physicsShapeType;
1350
1351 if (value >= 0 && value <= (byte)PhysShapeType.convex)
1352 {
1353 if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this)
1354 m_physicsShapeType = DefaultPhysicsShapeType();
1355 else
1356 m_physicsShapeType = value;
1357 }
1358 else
1359 m_physicsShapeType = DefaultPhysicsShapeType();
1360
1361 if (m_physicsShapeType != oldv && ParentGroup != null)
1362 {
1363 if (m_physicsShapeType == (byte)PhysShapeType.none)
1364 {
1365 if (PhysActor != null)
1366 {
1367 Velocity = new Vector3(0, 0, 0);
1368 Acceleration = new Vector3(0, 0, 0);
1369 if (ParentGroup.RootPart == this)
1370 AngularVelocity = new Vector3(0, 0, 0);
1371 ParentGroup.Scene.RemovePhysicalPrim(1);
1372 RemoveFromPhysics();
1373 }
1374 }
1375 else if (PhysActor == null)
1376 {
1377 ApplyPhysics((uint)Flags, VolumeDetectActive);
1378 }
1379 else
1380 {
1381 // TODO: Update physics actor
1382 }
1383
1384 if (ParentGroup != null)
1385 ParentGroup.HasGroupChanged = true;
1386 }
1387 }
1388 }
1389
1390 public float Density { get; set; }
1391 public float GravityModifier { get; set; }
1392 public float Friction { get; set; }
1393 public float Bounciness { get; set; }
1394
1325 #endregion Public Properties with only Get 1395 #endregion Public Properties with only Get
1326 1396
1327 private uint ApplyMask(uint val, bool set, uint mask) 1397 private uint ApplyMask(uint val, bool set, uint mask)
@@ -1523,9 +1593,8 @@ namespace OpenSim.Region.Framework.Scenes
1523 if (!ParentGroup.Scene.CollidablePrims) 1593 if (!ParentGroup.Scene.CollidablePrims)
1524 return; 1594 return;
1525 1595
1526// m_log.DebugFormat( 1596 if (PhysicsShapeType == (byte)PhysShapeType.none)
1527// "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}", 1597 return;
1528// Name, LocalId, UUID, m_physicalPrim);
1529 1598
1530 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; 1599 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0;
1531 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; 1600 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0;
@@ -3878,6 +3947,26 @@ namespace OpenSim.Region.Framework.Scenes
3878 } 3947 }
3879 } 3948 }
3880 3949
3950 public void UpdateExtraPhysics(ExtraPhysicsData physdata)
3951 {
3952 if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null)
3953 return;
3954
3955 if (PhysicsShapeType != (byte)physdata.PhysShapeType)
3956 {
3957 PhysicsShapeType = (byte)physdata.PhysShapeType;
3958
3959 }
3960
3961 if(Density != physdata.Density)
3962 Density = physdata.Density;
3963 if(GravityModifier != physdata.GravitationModifier)
3964 GravityModifier = physdata.GravitationModifier;
3965 if(Friction != physdata.Friction)
3966 Friction = physdata.Friction;
3967 if(Bounciness != physdata.Bounce)
3968 Bounciness = physdata.Bounce;
3969 }
3881 /// <summary> 3970 /// <summary>
3882 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. 3971 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.
3883 /// </summary> 3972 /// </summary>
@@ -3949,6 +4038,7 @@ namespace OpenSim.Region.Framework.Scenes
3949 4038
3950 if (SetPhantom 4039 if (SetPhantom
3951 || ParentGroup.IsAttachment 4040 || ParentGroup.IsAttachment
4041 || PhysicsShapeType == (byte)PhysShapeType.none
3952 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints 4042 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
3953 { 4043 {
3954 AddFlag(PrimFlags.Phantom); 4044 AddFlag(PrimFlags.Phantom);
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs
deleted file mode 100644
index d7198f0..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using log4net;
31using System.Reflection;
32using OpenSim.Framework;
33
34namespace OpenSim.Region.Framework.Scenes.Scripting
35{
36 public class NullScriptHost : IScriptHost
37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 private Vector3 m_pos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30);
41
42 public string Name
43 {
44 get { return "Object"; }
45 set { }
46 }
47
48 public string SitName
49 {
50 get { return String.Empty; }
51 set { }
52 }
53
54 public string TouchName
55 {
56 get { return String.Empty; }
57 set { }
58 }
59
60 public string Description
61 {
62 get { return String.Empty; }
63 set { }
64 }
65
66 public UUID UUID
67 {
68 get { return UUID.Zero; }
69 }
70
71 public UUID OwnerID
72 {
73 get { return UUID.Zero; }
74 }
75
76 public UUID CreatorID
77 {
78 get { return UUID.Zero; }
79 }
80
81 public Vector3 AbsolutePosition
82 {
83 get { return m_pos; }
84 }
85
86 public void SetText(string text, Vector3 color, double alpha)
87 {
88 m_log.Warn("Tried to SetText "+text+" on NullScriptHost");
89 }
90 }
91}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs
deleted file mode 100644
index 812a21c..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28//TODO: WHERE TO PLACE THIS?
29
30namespace OpenSim.Region.Framework.Scenes.Scripting
31{
32 public interface ScriptEngineInterface
33 {
34 void InitializeEngine(Scene Sceneworld);
35 void Shutdown();
36// void StartScript(string ScriptID, IScriptHost ObjectID);
37 }
38}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs
deleted file mode 100644
index c58ccc5..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.IO;
31using System.Reflection;
32using log4net;
33
34namespace OpenSim.Region.Framework.Scenes.Scripting
35{
36 public class ScriptEngineLoader
37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 public ScriptEngineInterface LoadScriptEngine(string EngineName)
41 {
42 ScriptEngineInterface ret = null;
43 try
44 {
45 ret =
46 LoadAndInitAssembly(
47 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
48 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
49 }
50 catch (Exception e)
51 {
52 m_log.Error("[ScriptEngine]: " +
53 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
54 e.StackTrace.ToString());
55 }
56 return ret;
57 }
58
59 /// <summary>
60 /// Does actual loading and initialization of script Assembly
61 /// </summary>
62 /// <param name="FreeAppDomain">AppDomain to load script into</param>
63 /// <param name="FileName">FileName of script assembly (.dll)</param>
64 /// <returns></returns>
65 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
66 {
67 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
68 // Load .Net Assembly (.dll)
69 // Initialize and return it
70
71 // TODO: Add error handling
72
73 Assembly a;
74 //try
75 //{
76
77
78 // Load to default appdomain (temporary)
79 a = Assembly.LoadFrom(FileName);
80 // Load to specified appdomain
81 // TODO: Insert security
82 //a = FreeAppDomain.Load(FileName);
83 //}
84 //catch (Exception e)
85 //{
86 // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString());
87 //}
88
89
90 //m_log.Debug("Loading: " + FileName);
91 //foreach (Type _t in a.GetTypes())
92 //{
93 // m_log.Debug("Type: " + _t.ToString());
94 //}
95
96 Type t;
97 //try
98 //{
99 t = a.GetType(NameSpace, true);
100 //}
101 //catch (Exception e)
102 //{
103 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
104 //}
105
106 ScriptEngineInterface ret;
107 //try
108 //{
109 ret = (ScriptEngineInterface) Activator.CreateInstance(t);
110 //}
111 //catch (Exception e)
112 //{
113 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
114 //}
115
116 return ret;
117 }
118 }
119}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs
new file mode 100644
index 0000000..f08ba59
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs
@@ -0,0 +1,107 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.Framework.Scenes.Scripting
34{
35 /// <summary>
36 /// Utility functions for use by scripts manipulating the scene.
37 /// </summary>
38 public static class ScriptUtils
39 {
40 /// <summary>
41 /// Get an asset id given an item name and an item type.
42 /// </summary>
43 /// <returns>UUID.Zero if the name and type did not match any item.</returns>
44 /// <param name='part'></param>
45 /// <param name='name'></param>
46 /// <param name='type'></param>
47 public static UUID GetAssetIdFromItemName(SceneObjectPart part, string name, int type)
48 {
49 TaskInventoryItem item = part.Inventory.GetInventoryItem(name);
50
51 if (item != null && item.Type == type)
52 return item.AssetID;
53 else
54 return UUID.Zero;
55 }
56
57 /// <summary>
58 /// accepts a valid UUID, -or- a name of an inventory item.
59 /// Returns a valid UUID or UUID.Zero if key invalid and item not found
60 /// in prim inventory.
61 /// </summary>
62 /// <param name="part">Scene object part to search for inventory item</param>
63 /// <param name="key"></param>
64 /// <returns></returns>
65 public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier)
66 {
67 UUID key;
68
69 // if we can parse the string as a key, use it.
70 // else try to locate the name in inventory of object. found returns key,
71 // not found returns UUID.Zero
72 if (!UUID.TryParse(identifier, out key))
73 {
74 TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
75
76 if (item != null)
77 key = item.AssetID;
78 else
79 key = UUID.Zero;
80 }
81
82 return key;
83 }
84
85 /// <summary>
86 /// Return the UUID of the asset matching the specified key or name
87 /// and asset type.
88 /// </summary>
89 /// <param name="part">Scene object part to search for inventory item</param>
90 /// <param name="identifier"></param>
91 /// <param name="type"></param>
92 /// <returns></returns>
93 public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type)
94 {
95 UUID key;
96
97 if (!UUID.TryParse(identifier, out key))
98 {
99 TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
100 if (item != null && item.Type == (int)type)
101 key = item.AssetID;
102 }
103
104 return key;
105 }
106 }
107} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 4a2a47e..78229fe 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -367,6 +367,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
367 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); 367 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
368 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 368 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
369 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 369 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
370
371 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
372 m_SOPXmlProcessors.Add("Density", ProcessDensity);
373 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
374 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
375 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
376
370 #endregion 377 #endregion
371 378
372 #region TaskInventoryXmlProcessors initialization 379 #region TaskInventoryXmlProcessors initialization
@@ -594,6 +601,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
594 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 601 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
595 } 602 }
596 603
604 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader)
605 {
606 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
607 }
608
609 private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
610 {
611 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
612 }
613
614 private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
615 {
616 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
617 }
618
619 private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
620 {
621 obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty);
622 }
623
624 private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
625 {
626 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
627 }
628
597 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 629 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
598 { 630 {
599 List<string> errorNodeNames; 631 List<string> errorNodeNames;
@@ -1257,6 +1289,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1257 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1289 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1258 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1290 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1259 1291
1292 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
1293 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1294 if (sop.Density != 1000.0f)
1295 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1296 if (sop.Friction != 0.6f)
1297 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
1298 if (sop.Bounciness != 0.5f)
1299 writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower());
1300 if (sop.GravityModifier != 1.0f)
1301 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1302
1260 writer.WriteEndElement(); 1303 writer.WriteEndElement();
1261 } 1304 }
1262 1305
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index 5b7a79d..ec880a7 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -39,6 +39,7 @@ using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Scripting;
42using System.Collections.Generic; 43using System.Collections.Generic;
43using System.Text.RegularExpressions; 44using System.Text.RegularExpressions;
44 45
@@ -256,10 +257,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
256 /// </summary> 257 /// </summary>
257 // ----------------------------------------------------------------- 258 // -----------------------------------------------------------------
258 [ScriptInvocation] 259 [ScriptInvocation]
259 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) 260 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
260 { 261 {
261 UUID reqID = UUID.Random(); 262 UUID reqID = UUID.Random();
262 Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); }); 263 Util.FireAndForget(o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier));
263 return reqID; 264 return reqID;
264 } 265 }
265 266
@@ -463,14 +464,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
463 /// 464 ///
464 /// </summary> 465 /// </summary>
465 // ----------------------------------------------------------------- 466 // -----------------------------------------------------------------
466 private void DoJsonReadNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) 467 private void DoJsonReadNotecard(
468 UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
467 { 469 {
470 UUID assetID;
471
472 if (!UUID.TryParse(notecardIdentifier, out assetID))
473 {
474 SceneObjectPart part = m_scene.GetSceneObjectPart(hostID);
475 assetID = ScriptUtils.GetAssetIdFromItemName(part, notecardIdentifier, (int)AssetType.Notecard);
476 }
477
468 AssetBase a = m_scene.AssetService.Get(assetID.ToString()); 478 AssetBase a = m_scene.AssetService.Get(assetID.ToString());
469 if (a == null) 479 if (a == null)
470 GenerateRuntimeError(String.Format("Unable to find notecard asset {0}",assetID)); 480 GenerateRuntimeError(String.Format("Unable to find notecard asset {0}", assetID));
471 481
472 if (a.Type != (sbyte)AssetType.Notecard) 482 if (a.Type != (sbyte)AssetType.Notecard)
473 GenerateRuntimeError(String.Format("Invalid notecard asset {0}",assetID)); 483 GenerateRuntimeError(String.Format("Invalid notecard asset {0}", assetID));
474 484
475 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID); 485 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID);
476 486
@@ -483,11 +493,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
483 } 493 }
484 catch (Exception e) 494 catch (Exception e)
485 { 495 {
486 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}",e.Message); 496 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message);
487 } 497 }
488 498
489 GenerateRuntimeError(String.Format("Json parsing failed for {0}",assetID.ToString())); 499 GenerateRuntimeError(String.Format("Json parsing failed for {0}", assetID));
490 m_comms.DispatchReply(scriptID,0,"",reqID.ToString()); 500 m_comms.DispatchReply(scriptID, 0, "", reqID.ToString());
491 } 501 }
492 502
493 // ----------------------------------------------------------------- 503 // -----------------------------------------------------------------
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index bdd9ce4..965c382 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -62,6 +62,7 @@ public static class BSParam
62 public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed 62 public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed
63 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes 63 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes
64 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects 64 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects
65 public static bool ShouldRemoveZeroWidthTriangles { get; private set; }
65 66
66 public static float TerrainImplementation { get; private set; } 67 public static float TerrainImplementation { get; private set; }
67 public static float TerrainFriction { get; private set; } 68 public static float TerrainFriction { get; private set; }
@@ -218,6 +219,11 @@ public static class BSParam
218 (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 219 (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
219 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, 220 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); },
220 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), 221 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ),
222 new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
223 ConfigurationParameters.numericTrue,
224 (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
225 (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); },
226 (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ),
221 227
222 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 228 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
223 32f, 229 32f,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 823402b..ec25aa9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -75,6 +75,7 @@ public abstract class BSPhysObject : PhysicsActor
75 PhysicsScene = parentScene; 75 PhysicsScene = parentScene;
76 LocalID = localID; 76 LocalID = localID;
77 PhysObjectName = name; 77 PhysObjectName = name;
78 Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
78 TypeName = typeName; 79 TypeName = typeName;
79 80
80 // We don't have any physical representation yet. 81 // We don't have any physical representation yet.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index f17e513..15747c9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -608,7 +608,7 @@ public sealed class BSShapeCollection : IDisposable
608 // Since we're recreating new, get rid of the reference to the previous shape 608 // Since we're recreating new, get rid of the reference to the previous shape
609 DereferenceShape(prim.PhysShape, shapeCallback); 609 DereferenceShape(prim.PhysShape, shapeCallback);
610 610
611 newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, prim.BaseShape, prim.Size, lod); 611 newShape = CreatePhysicalMesh(prim, newMeshKey, prim.BaseShape, prim.Size, lod);
612 // Take evasive action if the mesh was not constructed. 612 // Take evasive action if the mesh was not constructed.
613 newShape = VerifyMeshCreated(newShape, prim); 613 newShape = VerifyMeshCreated(newShape, prim);
614 614
@@ -619,7 +619,7 @@ public sealed class BSShapeCollection : IDisposable
619 return true; // 'true' means a new shape has been added to this prim 619 return true; // 'true' means a new shape has been added to this prim
620 } 620 }
621 621
622 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 622 private BulletShape CreatePhysicalMesh(BSPhysObject prim, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
623 { 623 {
624 BulletShape newShape = new BulletShape(); 624 BulletShape newShape = new BulletShape();
625 625
@@ -631,7 +631,7 @@ public sealed class BSShapeCollection : IDisposable
631 } 631 }
632 else 632 else
633 { 633 {
634 IMesh meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, 634 IMesh meshData = PhysicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod,
635 false, // say it is not physical so a bounding box is not built 635 false, // say it is not physical so a bounding box is not built
636 false // do not cache the mesh and do not use previously built versions 636 false // do not cache the mesh and do not use previously built versions
637 ); 637 );
@@ -640,41 +640,54 @@ public sealed class BSShapeCollection : IDisposable
640 { 640 {
641 641
642 int[] indices = meshData.getIndexListAsInt(); 642 int[] indices = meshData.getIndexListAsInt();
643 // int realIndicesIndex = indices.Length; 643 int realIndicesIndex = indices.Length;
644 float[] verticesAsFloats = meshData.getVertexListAsFloat(); 644 float[] verticesAsFloats = meshData.getVertexListAsFloat();
645 645
646 // Remove degenerate triangles. These are triangles with two of the vertices 646 if (BSParam.ShouldRemoveZeroWidthTriangles)
647 // are the same. This is complicated by the problem that vertices are not
648 // made unique in sculpties so we have to compare the values in the vertex.
649 int realIndicesIndex = 0;
650 for (int tri = 0; tri < indices.Length; tri += 3)
651 { 647 {
652 int v1 = indices[tri + 0] * 3; 648 // Remove degenerate triangles. These are triangles with two of the vertices
653 int v2 = indices[tri + 1] * 3; 649 // are the same. This is complicated by the problem that vertices are not
654 int v3 = indices[tri + 2] * 3; 650 // made unique in sculpties so we have to compare the values in the vertex.
655 if (!( ( verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0] 651 realIndicesIndex = 0;
656 && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1] 652 for (int tri = 0; tri < indices.Length; tri += 3)
657 && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2] )
658 || ( verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0]
659 && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1]
660 && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2] )
661 || ( verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0]
662 && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1]
663 && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2] ) )
664 )
665 { 653 {
666 // None of the vertices of the triangles are the same. This is a good triangle; 654 // Compute displacements into vertex array for each vertex of the triangle
667 indices[realIndicesIndex + 0] = indices[tri + 0]; 655 int v1 = indices[tri + 0] * 3;
668 indices[realIndicesIndex + 1] = indices[tri + 1]; 656 int v2 = indices[tri + 1] * 3;
669 indices[realIndicesIndex + 2] = indices[tri + 2]; 657 int v3 = indices[tri + 2] * 3;
670 realIndicesIndex += 3; 658 // Check to see if any two of the vertices are the same
659 if (!( ( verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0]
660 && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1]
661 && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2])
662 || ( verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0]
663 && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1]
664 && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2])
665 || ( verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0]
666 && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1]
667 && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2]) )
668 )
669 {
670 // None of the vertices of the triangles are the same. This is a good triangle;
671 indices[realIndicesIndex + 0] = indices[tri + 0];
672 indices[realIndicesIndex + 1] = indices[tri + 1];
673 indices[realIndicesIndex + 2] = indices[tri + 2];
674 realIndicesIndex += 3;
675 }
671 } 676 }
672 } 677 }
673 DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}", 678 DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}",
674 BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3); 679 BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3);
675 680
676 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, 681 if (realIndicesIndex != 0)
677 realIndicesIndex, indices, verticesAsFloats.Length/3, verticesAsFloats); 682 {
683 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World,
684 realIndicesIndex, indices, verticesAsFloats.Length / 3, verticesAsFloats);
685 }
686 else
687 {
688 PhysicsScene.Logger.ErrorFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
689 LogHeader, prim.PhysObjectName, prim.RawPosition, PhysicsScene.Name);
690 }
678 } 691 }
679 } 692 }
680 newShape.shapeKey = newMeshKey; 693 newShape.shapeKey = newMeshKey;
@@ -892,9 +905,11 @@ public sealed class BSShapeCollection : IDisposable
892 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset 905 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
893 if (prim.BaseShape.SculptEntry && !prim.LastAssetBuildFailed && prim.BaseShape.SculptTexture != OMV.UUID.Zero) 906 if (prim.BaseShape.SculptEntry && !prim.LastAssetBuildFailed && prim.BaseShape.SculptTexture != OMV.UUID.Zero)
894 { 907 {
908 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed);
909 // This will prevent looping through this code as we keep trying to get the failed shape
895 prim.LastAssetBuildFailed = true; 910 prim.LastAssetBuildFailed = true;
911
896 BSPhysObject xprim = prim; 912 BSPhysObject xprim = prim;
897 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed);
898 Util.FireAndForget(delegate 913 Util.FireAndForget(delegate
899 { 914 {
900 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; 915 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod;
@@ -905,7 +920,7 @@ public sealed class BSShapeCollection : IDisposable
905 { 920 {
906 bool assetFound = false; // DEBUG DEBUG 921 bool assetFound = false; // DEBUG DEBUG
907 string mismatchIDs = String.Empty; // DEBUG DEBUG 922 string mismatchIDs = String.Empty; // DEBUG DEBUG
908 if (yprim.BaseShape.SculptEntry) 923 if (asset != null && yprim.BaseShape.SculptEntry)
909 { 924 {
910 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) 925 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
911 { 926 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0db6fe3..64052ae 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.World.Terrain;
45using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Framework.Scenes.Animation; 47using OpenSim.Region.Framework.Scenes.Animation;
48using OpenSim.Region.Framework.Scenes.Scripting;
48using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.Physics.Manager;
49using OpenSim.Region.ScriptEngine.Shared; 50using OpenSim.Region.ScriptEngine.Shared;
50using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; 51using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
@@ -333,79 +334,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
333 } 334 }
334 } 335 }
335 336
336 protected UUID InventoryKey(string name, int type)
337 {
338 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
339
340 if (item != null && item.Type == type)
341 return item.AssetID;
342 else
343 return UUID.Zero;
344 }
345
346 /// <summary>
347 /// accepts a valid UUID, -or- a name of an inventory item.
348 /// Returns a valid UUID or UUID.Zero if key invalid and item not found
349 /// in prim inventory.
350 /// </summary>
351 /// <param name="k"></param>
352 /// <returns></returns>
353 protected UUID KeyOrName(string k)
354 {
355 UUID key;
356
357 // if we can parse the string as a key, use it.
358 // else try to locate the name in inventory of object. found returns key,
359 // not found returns UUID.Zero
360 if (!UUID.TryParse(k, out key))
361 {
362 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
363
364 if (item != null)
365 key = item.AssetID;
366 else
367 key = UUID.Zero;
368 }
369
370 return key;
371 }
372
373 /// <summary>
374 /// Return the UUID of the asset matching the specified key or name
375 /// and asset type.
376 /// </summary>
377 /// <param name="k"></param>
378 /// <param name="type"></param>
379 /// <returns></returns>
380 protected UUID KeyOrName(string k, AssetType type)
381 {
382 UUID key;
383
384 if (!UUID.TryParse(k, out key))
385 {
386 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
387 if (item != null && item.Type == (int)type)
388 key = item.AssetID;
389 }
390 else
391 {
392 lock (m_host.TaskInventory)
393 {
394 foreach (KeyValuePair<UUID, TaskInventoryItem> item in m_host.TaskInventory)
395 {
396 if (item.Value.Type == (int)type && item.Value.Name == k)
397 {
398 key = item.Value.ItemID;
399 break;
400 }
401 }
402 }
403 }
404
405
406 return key;
407 }
408
409 //These are the implementations of the various ll-functions used by the LSL scripts. 337 //These are the implementations of the various ll-functions used by the LSL scripts.
410 public LSL_Float llSin(double f) 338 public LSL_Float llSin(double f)
411 { 339 {
@@ -1816,7 +1744,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1816 { 1744 {
1817 UUID textureID = new UUID(); 1745 UUID textureID = new UUID();
1818 1746
1819 textureID = InventoryKey(texture, (int)AssetType.Texture); 1747 textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
1820 if (textureID == UUID.Zero) 1748 if (textureID == UUID.Zero)
1821 { 1749 {
1822 if (!UUID.TryParse(texture, out textureID)) 1750 if (!UUID.TryParse(texture, out textureID))
@@ -2450,7 +2378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2450 if (m_SoundModule != null) 2378 if (m_SoundModule != null)
2451 { 2379 {
2452 m_SoundModule.SendSound(m_host.UUID, 2380 m_SoundModule.SendSound(m_host.UUID,
2453 KeyOrName(sound, AssetType.Sound), volume, false, 0, 2381 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, false, 0,
2454 0, false, false); 2382 0, false, false);
2455 } 2383 }
2456 } 2384 }
@@ -2460,7 +2388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2460 m_host.AddScriptLPS(1); 2388 m_host.AddScriptLPS(1);
2461 if (m_SoundModule != null) 2389 if (m_SoundModule != null)
2462 { 2390 {
2463 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), 2391 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
2464 volume, 20, false); 2392 volume, 20, false);
2465 } 2393 }
2466 } 2394 }
@@ -2470,7 +2398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2470 m_host.AddScriptLPS(1); 2398 m_host.AddScriptLPS(1);
2471 if (m_SoundModule != null) 2399 if (m_SoundModule != null)
2472 { 2400 {
2473 m_SoundModule.LoopSound(m_host.UUID, KeyOrName(sound), 2401 m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
2474 volume, 20, true); 2402 volume, 20, true);
2475 } 2403 }
2476 } 2404 }
@@ -2492,7 +2420,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2492 if (m_SoundModule != null) 2420 if (m_SoundModule != null)
2493 { 2421 {
2494 m_SoundModule.SendSound(m_host.UUID, 2422 m_SoundModule.SendSound(m_host.UUID,
2495 KeyOrName(sound, AssetType.Sound), volume, false, 0, 2423 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, false, 0,
2496 0, true, false); 2424 0, true, false);
2497 } 2425 }
2498 } 2426 }
@@ -2504,7 +2432,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2504 if (m_SoundModule != null) 2432 if (m_SoundModule != null)
2505 { 2433 {
2506 m_SoundModule.SendSound(m_host.UUID, 2434 m_SoundModule.SendSound(m_host.UUID,
2507 KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, 2435 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, true, 0, 0,
2508 false, false); 2436 false, false);
2509 } 2437 }
2510 } 2438 }
@@ -2521,7 +2449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2521 { 2449 {
2522 m_host.AddScriptLPS(1); 2450 m_host.AddScriptLPS(1);
2523 if (m_SoundModule != null) 2451 if (m_SoundModule != null)
2524 m_SoundModule.PreloadSound(m_host.UUID, KeyOrName(sound), 0); 2452 m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
2525 ScriptSleep(1000); 2453 ScriptSleep(1000);
2526 } 2454 }
2527 2455
@@ -3352,7 +3280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3352 if (presence != null) 3280 if (presence != null)
3353 { 3281 {
3354 // Do NOT try to parse UUID, animations cannot be triggered by ID 3282 // Do NOT try to parse UUID, animations cannot be triggered by ID
3355 UUID animID = InventoryKey(anim, (int)AssetType.Animation); 3283 UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation);
3356 if (animID == UUID.Zero) 3284 if (animID == UUID.Zero)
3357 presence.Animator.AddAnimation(anim, m_host.UUID); 3285 presence.Animator.AddAnimation(anim, m_host.UUID);
3358 else 3286 else
@@ -3374,7 +3302,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3374 3302
3375 if (presence != null) 3303 if (presence != null)
3376 { 3304 {
3377 UUID animID = KeyOrName(anim); 3305 UUID animID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, anim);
3378 3306
3379 if (animID == UUID.Zero) 3307 if (animID == UUID.Zero)
3380 presence.Animator.RemoveAnimation(anim); 3308 presence.Animator.RemoveAnimation(anim);
@@ -4319,7 +4247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4319 4247
4320 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt) 4248 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt)
4321 { 4249 {
4322 UUID assetID = KeyOrName(destination); 4250 UUID assetID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, destination);
4323 4251
4324 // The destinaion is not an asset ID and also doesn't name a landmark. 4252 // The destinaion is not an asset ID and also doesn't name a landmark.
4325 // Use it as a sim name 4253 // Use it as a sim name
@@ -4386,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4386 m_host.AddScriptLPS(1); 4314 m_host.AddScriptLPS(1);
4387 4315
4388 // TODO: Parameter check logic required. 4316 // TODO: Parameter check logic required.
4389 m_host.CollisionSound = KeyOrName(impact_sound, AssetType.Sound); 4317 m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
4390 m_host.CollisionSoundVolume = (float)impact_volume; 4318 m_host.CollisionSoundVolume = (float)impact_volume;
4391 } 4319 }
4392 4320
@@ -5912,7 +5840,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5912 if (m_SoundModule != null) 5840 if (m_SoundModule != null)
5913 { 5841 {
5914 m_SoundModule.TriggerSoundLimited(m_host.UUID, 5842 m_SoundModule.TriggerSoundLimited(m_host.UUID,
5915 KeyOrName(sound, AssetType.Sound), volume, 5843 ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume,
5916 bottom_south_west, top_north_east); 5844 bottom_south_west, top_north_east);
5917 } 5845 }
5918 } 5846 }
@@ -6346,7 +6274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6346 break; 6274 break;
6347 6275
6348 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: 6276 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
6349 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1)); 6277 prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
6350 break; 6278 break;
6351 6279
6352 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: 6280 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
@@ -7269,9 +7197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7269 UUID sculptId; 7197 UUID sculptId;
7270 7198
7271 if (!UUID.TryParse(map, out sculptId)) 7199 if (!UUID.TryParse(map, out sculptId))
7272 { 7200 sculptId = ScriptUtils.GetAssetIdFromItemName(m_host, map, (int)AssetType.Texture);
7273 sculptId = InventoryKey(map, (int)AssetType.Texture);
7274 }
7275 7201
7276 if (sculptId == UUID.Zero) 7202 if (sculptId == UUID.Zero)
7277 return; 7203 return;
@@ -7668,6 +7594,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7668 part.ScriptSetPhysicsStatus(physics); 7594 part.ScriptSetPhysicsStatus(physics);
7669 break; 7595 break;
7670 7596
7597 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
7598 if (remain < 1)
7599 return null;
7600
7601 int shape_type = rules.GetLSLIntegerItem(idx++);
7602
7603 ExtraPhysicsData physdata = new ExtraPhysicsData();
7604 physdata.Density = part.Density;
7605 physdata.Bounce = part.Bounciness;
7606 physdata.GravitationModifier = part.GravityModifier;
7607 physdata.PhysShapeType = (PhysShapeType)shape_type;
7608
7609 part.UpdateExtraPhysics(physdata);
7610
7611 break;
7612
7671 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 7613 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7672 if (remain < 1) 7614 if (remain < 1)
7673 return null; 7615 return null;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 9bf1a64..bd66ba3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -661,6 +661,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
661 public const int PRIM_MEDIA_PERM_GROUP = 2; 661 public const int PRIM_MEDIA_PERM_GROUP = 2;
662 public const int PRIM_MEDIA_PERM_ANYONE = 4; 662 public const int PRIM_MEDIA_PERM_ANYONE = 4;
663 663
664 public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
665 public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
666 public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
667 public const int PRIM_PHYSICS_SHAPE_NONE = 1;
668
669 public const int PRIM_PHYSICS_MATERIAL = 31;
670 public const int DENSITY = 1;
671 public const int FRICTION = 2;
672 public const int RESTITUTION = 4;
673 public const int GRAVITY_MULTIPLIER = 8;
674
664 // extra constants for llSetPrimMediaParams 675 // extra constants for llSetPrimMediaParams
665 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0); 676 public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
666 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000); 677 public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000);
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index ea3e348..dc20f13 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Tests.Common
139 SceneCommunicationService scs = new SceneCommunicationService(); 139 SceneCommunicationService scs = new SceneCommunicationService();
140 140
141 TestScene testScene = new TestScene( 141 TestScene testScene = new TestScene(
142 regInfo, m_acm, scs, m_simDataService, m_estateDataService, false, configSource, null); 142 regInfo, m_acm, scs, m_simDataService, m_estateDataService, configSource, null);
143 143
144 INonSharedRegionModule godsModule = new GodsModule(); 144 INonSharedRegionModule godsModule = new GodsModule();
145 godsModule.Initialise(new IniConfigSource()); 145 godsModule.Initialise(new IniConfigSource());
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index d4b5648..a7e0dfb 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -41,10 +41,9 @@ namespace OpenSim.Tests.Common.Mock
41 public TestScene( 41 public TestScene(
42 RegionInfo regInfo, AgentCircuitManager authen, 42 RegionInfo regInfo, AgentCircuitManager authen,
43 SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, 43 SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService,
44 bool dumpAssetsToFile,
45 IConfigSource config, string simulatorVersion) 44 IConfigSource config, string simulatorVersion)
46 : base(regInfo, authen, sceneGridService, simDataService, estateDataService, 45 : base(regInfo, authen, sceneGridService, simDataService, estateDataService,
47 dumpAssetsToFile, config, simulatorVersion) 46 config, simulatorVersion)
48 { 47 {
49 } 48 }
50 49