aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
authorMelanie2013-02-06 08:03:04 +0000
committerMelanie2013-02-06 08:03:04 +0000
commite5beb480eaf23fa7454728724de80b2a67ded1e8 (patch)
tree232bfd14074cc3730ab02bdefa339b99a587f1dc /OpenSim/Data/MySQL
parentminor: Add explanation of MaptileStaticUUID setting in Regions.ini.example (diff)
downloadopensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.zip
opensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.tar.gz
opensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.tar.bz2
opensim-SC_OLD-e5beb480eaf23fa7454728724de80b2a67ded1e8.tar.xz
Partial port of Avination's support for the new physics parameters.
Implements the parameters as properties, the serialization and database storage (MySQL only). Implements llSetPrimitiveParams for prim physics shape and the other 4 extra params. Only the prim shape type "None" is currently functional. No support for the Viewer UI (yet), that will be ported in due course. Lots more to port, this is a large-ish changeset.
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs56
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations13
2 files changed, 51 insertions, 18 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index c95311e..2f471a0 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
@@ -1499,7 +1512,7 @@ namespace OpenSim.Data.MySQL
1499 for (int x = 0; x < (int)Constants.RegionSize; x++) 1512 for (int x = 0; x < (int)Constants.RegionSize; x++)
1500 for (int y = 0; y < (int)Constants.RegionSize; y++) 1513 for (int y = 0; y < (int)Constants.RegionSize; y++)
1501 { 1514 {
1502 double height = val[x, y]; 1515 double height = 20.0;
1503 if (height == 0.0) 1516 if (height == 0.0)
1504 height = double.Epsilon; 1517 height = double.Epsilon;
1505 1518
@@ -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