aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
authorAleric Inglewood2013-08-04 19:19:11 +0200
committerteravus2013-09-22 21:10:01 -0500
commit2dc92e7de11086c7649d3ee0f8adc974efce6805 (patch)
treee69a633127525a5967ddadeef723a99f38e5d4aa /OpenSim/Data/MySQL
parentminor: Recomment out log message uncommented in previous cbdfe969 (diff)
downloadopensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.zip
opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.gz
opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.bz2
opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.xz
Preserve attachment point & position when attachment is rezzed in world
Patch taken from http://opensimulator.org/mantis/view.php?id=4905 originally by Greg C. Fixed to apply to r/23314 commit ba9daf849e7c8db48e7c03e7cdedb77776b2052f (cherry picked from commit 4ff9fbca441110cc2b93edc7286e0e9339e61cbe)
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs29
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations10
2 files changed, 34 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index cf367ef..b03a904 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -173,7 +173,8 @@ namespace OpenSim.Data.MySQL
173 "ParticleSystem, ClickAction, Material, " + 173 "ParticleSystem, ClickAction, Material, " +
174 "CollisionSound, CollisionSoundVolume, " + 174 "CollisionSound, CollisionSoundVolume, " +
175 "PassTouches, " + 175 "PassTouches, " +
176 "LinkNumber, MediaURL, KeyframeMotion, " + 176 "LinkNumber, MediaURL, AttachedPosX, " +
177 "AttachedPosY, AttachedPosZ, KeyframeMotion, " +
177 "PhysicsShapeType, Density, GravityModifier, " + 178 "PhysicsShapeType, Density, GravityModifier, " +
178 "Friction, Restitution, DynAttrs " + 179 "Friction, Restitution, DynAttrs " +
179 ") values (" + "?UUID, " + 180 ") values (" + "?UUID, " +
@@ -208,7 +209,8 @@ namespace OpenSim.Data.MySQL
208 "?ColorB, ?ColorA, ?ParticleSystem, " + 209 "?ColorB, ?ColorA, ?ParticleSystem, " +
209 "?ClickAction, ?Material, ?CollisionSound, " + 210 "?ClickAction, ?Material, ?CollisionSound, " +
210 "?CollisionSoundVolume, ?PassTouches, " + 211 "?CollisionSoundVolume, ?PassTouches, " +
211 "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + 212 "?LinkNumber, ?MediaURL, ?AttachedPosX, " +
213 "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " +
212 "?PhysicsShapeType, ?Density, ?GravityModifier, " + 214 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
213 "?Friction, ?Restitution, ?DynAttrs)"; 215 "?Friction, ?Restitution, ?DynAttrs)";
214 216
@@ -227,7 +229,7 @@ namespace OpenSim.Data.MySQL
227 "PathTaperX, PathTaperY, PathTwist, " + 229 "PathTaperX, PathTaperY, PathTwist, " +
228 "PathTwistBegin, ProfileBegin, ProfileEnd, " + 230 "PathTwistBegin, ProfileBegin, ProfileEnd, " +
229 "ProfileCurve, ProfileHollow, Texture, " + 231 "ProfileCurve, ProfileHollow, Texture, " +
230 "ExtraParams, State, Media) " + 232 "ExtraParams, State, LastAttachPoint, Media) " +
231 "values (?UUID, " + 233 "values (?UUID, " +
232 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + 234 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
233 "?PCode, ?PathBegin, ?PathEnd, " + 235 "?PCode, ?PathBegin, ?PathEnd, " +
@@ -239,7 +241,7 @@ namespace OpenSim.Data.MySQL
239 "?PathTwistBegin, ?ProfileBegin, " + 241 "?PathTwistBegin, ?ProfileBegin, " +
240 "?ProfileEnd, ?ProfileCurve, " + 242 "?ProfileEnd, ?ProfileCurve, " +
241 "?ProfileHollow, ?Texture, ?ExtraParams, " + 243 "?ProfileHollow, ?Texture, ?ExtraParams, " +
242 "?State, ?Media)"; 244 "?State, ?LastAttachPoint, ?Media)";
243 245
244 FillShapeCommand(cmd, prim); 246 FillShapeCommand(cmd, prim);
245 247
@@ -1303,7 +1305,16 @@ namespace OpenSim.Data.MySQL
1303 1305
1304 if (!(row["MediaURL"] is System.DBNull)) 1306 if (!(row["MediaURL"] is System.DBNull))
1305 prim.MediaUrl = (string)row["MediaURL"]; 1307 prim.MediaUrl = (string)row["MediaURL"];
1306 1308
1309 if (!(row["AttachedPosX"] is System.DBNull))
1310 {
1311 prim.AttachedPos = new Vector3(
1312 (float)(double)row["AttachedPosX"],
1313 (float)(double)row["AttachedPosY"],
1314 (float)(double)row["AttachedPosZ"]
1315 );
1316 }
1317
1307 if (!(row["DynAttrs"] is System.DBNull)) 1318 if (!(row["DynAttrs"] is System.DBNull))
1308 prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); 1319 prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]);
1309 else 1320 else
@@ -1673,6 +1684,12 @@ namespace OpenSim.Data.MySQL
1673 1684
1674 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1685 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1675 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1686 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1687 if (prim.AttachedPos != null)
1688 {
1689 cmd.Parameters.AddWithValue("AttachedPosX", (double)prim.AttachedPos.X);
1690 cmd.Parameters.AddWithValue("AttachedPosY", (double)prim.AttachedPos.Y);
1691 cmd.Parameters.AddWithValue("AttachedPosZ", (double)prim.AttachedPos.Z);
1692 }
1676 1693
1677 if (prim.KeyframeMotion != null) 1694 if (prim.KeyframeMotion != null)
1678 cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize()); 1695 cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
@@ -1879,6 +1896,7 @@ namespace OpenSim.Data.MySQL
1879 s.ExtraParams = (byte[])row["ExtraParams"]; 1896 s.ExtraParams = (byte[])row["ExtraParams"];
1880 1897
1881 s.State = (byte)(int)row["State"]; 1898 s.State = (byte)(int)row["State"];
1899 s.LastAttachPoint = (byte)(int)row["LastAttachPoint"];
1882 1900
1883 if (!(row["Media"] is System.DBNull)) 1901 if (!(row["Media"] is System.DBNull))
1884 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 1902 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
@@ -1925,6 +1943,7 @@ namespace OpenSim.Data.MySQL
1925 cmd.Parameters.AddWithValue("Texture", s.TextureEntry); 1943 cmd.Parameters.AddWithValue("Texture", s.TextureEntry);
1926 cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); 1944 cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams);
1927 cmd.Parameters.AddWithValue("State", s.State); 1945 cmd.Parameters.AddWithValue("State", s.State);
1946 cmd.Parameters.AddWithValue("LastAttachPoint", s.LastAttachPoint);
1928 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); 1947 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
1929 } 1948 }
1930 1949
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index 70b9558..a77e44d 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -930,3 +930,13 @@ BEGIN;
930ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; 930ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob;
931 931
932COMMIT; 932COMMIT;
933
934:VERSION 49 #--------------------- Save attachment info
935
936BEGIN;
937ALTER TABLE prims ADD COLUMN AttachedPosX double default 0;
938ALTER TABLE prims ADD COLUMN AttachedPosY double default 0;
939ALTER TABLE prims ADD COLUMN AttachedPosZ double default 0;
940ALTER TABLE primshapes ADD COLUMN LastAttachPoint int(4) not null default '0';
941COMMIT;
942