aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorAleric Inglewood2013-08-04 19:19:11 +0200
committerteravus2013-09-22 21:10:01 -0500
commit2dc92e7de11086c7649d3ee0f8adc974efce6805 (patch)
treee69a633127525a5967ddadeef723a99f38e5d4aa /OpenSim
parentminor: Recomment out log message uncommented in previous cbdfe969 (diff)
downloadopensim-SC-2dc92e7de11086c7649d3ee0f8adc974efce6805.zip
opensim-SC-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.gz
opensim-SC-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.bz2
opensim-SC-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')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLSimulationData.cs17
-rw-r--r--OpenSim/Data/MSSQL/Resources/RegionStore.migrations12
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs29
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations10
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations12
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs16
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs11
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs14
14 files changed, 150 insertions, 10 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index 5135050..f41f60c 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -351,7 +351,7 @@ IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID)
351 ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice, 351 ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice,
352 SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem, 352 SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem,
353 ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches, 353 ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches,
354 LinkNumber = @LinkNumber, MediaURL = @MediaURL, DynAttrs = @DynAttrs, 354 LinkNumber = @LinkNumber, MediaURL = @MediaURL, AttachedPosX = @AttachedPosX, AttachedPosY = @AttachedPosY, AttachedPosZ = @AttachedPosZ, DynAttrs = @DynAttrs,
355 PhysicsShapeType = @PhysicsShapeType, Density = @Density, GravityModifier = @GravityModifier, Friction = @Friction, Restitution = @Restitution 355 PhysicsShapeType = @PhysicsShapeType, Density = @Density, GravityModifier = @GravityModifier, Friction = @Friction, Restitution = @Restitution
356 WHERE UUID = @UUID 356 WHERE UUID = @UUID
357 END 357 END
@@ -367,7 +367,7 @@ ELSE
367 PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, 367 PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX,
368 OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, 368 OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ,
369 ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, 369 ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA,
370 ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL, DynAttrs, 370 ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL, AttachedPosX, AttachedPosY, AttachedPosZ, DynAttrs,
371 PhysicsShapeType, Density, GravityModifier, Friction, Restitution 371 PhysicsShapeType, Density, GravityModifier, Friction, Restitution
372 ) VALUES ( 372 ) VALUES (
373 @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask, 373 @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask,
@@ -378,7 +378,7 @@ ELSE
378 @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX, 378 @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX,
379 @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ, 379 @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ,
380 @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA, 380 @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA,
381 @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL, @DynAttrs, 381 @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL, @AttachedPosX, @AttachedPosY, @AttachedPosZ, @DynAttrs,
382 @PhysicsShapeType, @Density, @GravityModifier, @Friction, @Restitution 382 @PhysicsShapeType, @Density, @GravityModifier, @Friction, @Restitution
383 ) 383 )
384 END"; 384 END";
@@ -1695,6 +1695,12 @@ VALUES
1695 if (!(primRow["MediaURL"] is System.DBNull)) 1695 if (!(primRow["MediaURL"] is System.DBNull))
1696 prim.MediaUrl = (string)primRow["MediaURL"]; 1696 prim.MediaUrl = (string)primRow["MediaURL"];
1697 1697
1698 if (!(primRow["AttachedPosX"] is System.DBNull))
1699 prim.AttachedPos = new Vector3(
1700 Convert.ToSingle(primRow["AttachedPosX"]),
1701 Convert.ToSingle(primRow["AttachedPosY"]),
1702 Convert.ToSingle(primRow["AttachedPosZ"]));
1703
1698 if (!(primRow["DynAttrs"] is System.DBNull)) 1704 if (!(primRow["DynAttrs"] is System.DBNull))
1699 prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]); 1705 prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]);
1700 else 1706 else
@@ -2099,7 +2105,10 @@ VALUES
2099 parameters.Add(_Database.CreateParameter("PassTouches", 0)); 2105 parameters.Add(_Database.CreateParameter("PassTouches", 0));
2100 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); 2106 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
2101 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); 2107 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
2102 2108 parameters.Add(_Database.CreateParameter("AttachedPosX", prim.AttachedPos.X));
2109 parameters.Add(_Database.CreateParameter("AttachedPosY", prim.AttachedPos.Y));
2110 parameters.Add(_Database.CreateParameter("AttachedPosZ", prim.AttachedPos.Z));
2111
2103 if (prim.DynAttrs.CountNamespaces > 0) 2112 if (prim.DynAttrs.CountNamespaces > 0)
2104 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); 2113 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
2105 else 2114 else
diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
index 4549801..bb89884 100644
--- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
@@ -1168,3 +1168,15 @@ ALTER TABLE prims ADD `Friction` double NOT NULL default '0.6';
1168ALTER TABLE prims ADD `Restitution` double NOT NULL default '0.5'; 1168ALTER TABLE prims ADD `Restitution` double NOT NULL default '0.5';
1169 1169
1170COMMIT 1170COMMIT
1171
1172:VERSION 40 #---------------- Save Attachment info
1173
1174BEGIN TRANSACTION
1175
1176ALTER TABLE prims ADD AttachedPosX float(53) default 0.0;
1177ALTER TABLE prims ADD AttachedPosY float(53) default 0.0;
1178ALTER TABLE prims ADD AttachedPosZ float(53) default 0.0;
1179ALTER TABLE primshapes ADD LastAttachPoint int not null default 0;
1180
1181COMMIT
1182
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
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index bff039d..901068f 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -600,3 +600,15 @@ BEGIN;
600ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; 600ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob;
601 601
602COMMIT; 602COMMIT;
603
604:VERSION 30 #---------------- Save Attachment info
605
606BEGIN;
607
608ALTER TABLE prims ADD COLUMN AttachedPosX double default '0';
609ALTER TABLE prims ADD COLUMN AttachedPosY double default '0';
610ALTER TABLE prims ADD COLUMN AttachedPosZ double default '0';
611ALTER TABLE primshapes ADD COLUMN LastAttachPoint int not null default '0';
612
613COMMIT;
614
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index eba6612..d938b6b 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -1236,6 +1236,10 @@ namespace OpenSim.Data.SQLite
1236 1236
1237 createCol(prims, "MediaURL", typeof(String)); 1237 createCol(prims, "MediaURL", typeof(String));
1238 1238
1239 createCol(prims, "AttachedPosX", typeof(Double));
1240 createCol(prims, "AttachedPosY", typeof(Double));
1241 createCol(prims, "AttachedPosZ", typeof(Double));
1242
1239 createCol(prims, "DynAttrs", typeof(String)); 1243 createCol(prims, "DynAttrs", typeof(String));
1240 1244
1241 createCol(prims, "PhysicsShapeType", typeof(Byte)); 1245 createCol(prims, "PhysicsShapeType", typeof(Byte));
@@ -1724,6 +1728,12 @@ namespace OpenSim.Data.SQLite
1724 prim.MediaUrl = (string)row["MediaURL"]; 1728 prim.MediaUrl = (string)row["MediaURL"];
1725 } 1729 }
1726 1730
1731 prim.AttachedPos = new Vector3(
1732 Convert.ToSingle(row["AttachedPosX"]),
1733 Convert.ToSingle(row["AttachedPosY"]),
1734 Convert.ToSingle(row["AttachedPosZ"])
1735 );
1736
1727 if (!(row["DynAttrs"] is System.DBNull)) 1737 if (!(row["DynAttrs"] is System.DBNull))
1728 { 1738 {
1729 //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType()); 1739 //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType());
@@ -2176,6 +2186,10 @@ namespace OpenSim.Data.SQLite
2176 2186
2177 row["MediaURL"] = prim.MediaUrl; 2187 row["MediaURL"] = prim.MediaUrl;
2178 2188
2189 row["AttachedPosX"] = prim.AttachedPos.X;
2190 row["AttachedPosY"] = prim.AttachedPos.Y;
2191 row["AttachedPosZ"] = prim.AttachedPos.Z;
2192
2179 if (prim.DynAttrs.CountNamespaces > 0) 2193 if (prim.DynAttrs.CountNamespaces > 0)
2180 row["DynAttrs"] = prim.DynAttrs.ToXml(); 2194 row["DynAttrs"] = prim.DynAttrs.ToXml();
2181 else 2195 else
@@ -2444,6 +2458,7 @@ namespace OpenSim.Data.SQLite
2444 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); 2458 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
2445 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 2459 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
2446 s.State = Convert.ToByte(row["State"]); 2460 s.State = Convert.ToByte(row["State"]);
2461 s.LastAttachPoint = Convert.ToByte(row["LastAttachPoint"]);
2447 2462
2448 byte[] textureEntry = (byte[])row["Texture"]; 2463 byte[] textureEntry = (byte[])row["Texture"];
2449 s.TextureEntry = textureEntry; 2464 s.TextureEntry = textureEntry;
@@ -2493,6 +2508,7 @@ namespace OpenSim.Data.SQLite
2493 row["ProfileCurve"] = s.ProfileCurve; 2508 row["ProfileCurve"] = s.ProfileCurve;
2494 row["ProfileHollow"] = s.ProfileHollow; 2509 row["ProfileHollow"] = s.ProfileHollow;
2495 row["State"] = s.State; 2510 row["State"] = s.State;
2511 row["LastAttachPoint"] = s.LastAttachPoint;
2496 2512
2497 row["Texture"] = s.TextureEntry; 2513 row["Texture"] = s.TextureEntry;
2498 row["ExtraParams"] = s.ExtraParams; 2514 row["ExtraParams"] = s.ExtraParams;
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index c1e1a4f..c8a5376 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -105,6 +105,7 @@ namespace OpenSim.Framework
105 private ushort _profileHollow; 105 private ushort _profileHollow;
106 private Vector3 _scale; 106 private Vector3 _scale;
107 private byte _state; 107 private byte _state;
108 private byte _lastattach;
108 private ProfileShape _profileShape; 109 private ProfileShape _profileShape;
109 private HollowShape _hollowShape; 110 private HollowShape _hollowShape;
110 111
@@ -207,6 +208,7 @@ namespace OpenSim.Framework
207 PCode = (byte)prim.PrimData.PCode; 208 PCode = (byte)prim.PrimData.PCode;
208 209
209 State = prim.PrimData.State; 210 State = prim.PrimData.State;
211 LastAttachPoint = prim.PrimData.State;
210 PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin); 212 PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin);
211 PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd); 213 PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd);
212 PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX); 214 PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX);
@@ -583,6 +585,15 @@ namespace OpenSim.Framework
583 } 585 }
584 } 586 }
585 587
588 public byte LastAttachPoint {
589 get {
590 return _lastattach;
591 }
592 set {
593 _lastattach = value;
594 }
595 }
596
586 public ProfileShape ProfileShape { 597 public ProfileShape ProfileShape {
587 get { 598 get {
588 return _profileShape; 599 return _profileShape;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
index 92805e2..94f8bc1 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
@@ -155,6 +155,7 @@ namespace OpenSim.Region.ClientStack.Linden
155 Quaternion rotation = Quaternion.Identity; 155 Quaternion rotation = Quaternion.Identity;
156 Vector3 scale = Vector3.Zero; 156 Vector3 scale = Vector3.Zero;
157 int state = 0; 157 int state = 0;
158 int lastattach = 0;
158 159
159 if (r.Type != OSDType.Map) // not a proper req 160 if (r.Type != OSDType.Map) // not a proper req
160 return responsedata; 161 return responsedata;
@@ -224,6 +225,7 @@ namespace OpenSim.Region.ClientStack.Linden
224 225
225 ray_target_id = ObjMap["RayTargetId"].AsUUID(); 226 ray_target_id = ObjMap["RayTargetId"].AsUUID();
226 state = ObjMap["State"].AsInteger(); 227 state = ObjMap["State"].AsInteger();
228 lastattach = ObjMap["LastAttachPoint"].AsInteger();
227 try 229 try
228 { 230 {
229 ray_end = ((OSDArray)ObjMap["RayEnd"]).AsVector3(); 231 ray_end = ((OSDArray)ObjMap["RayEnd"]).AsVector3();
@@ -290,6 +292,7 @@ namespace OpenSim.Region.ClientStack.Linden
290 292
291 //session_id = rm["session_id"].AsUUID(); 293 //session_id = rm["session_id"].AsUUID();
292 state = rm["state"].AsInteger(); 294 state = rm["state"].AsInteger();
295 lastattach = rm["last_attach_point"].AsInteger();
293 try 296 try
294 { 297 {
295 ray_end = ((OSDArray)rm["ray_end"]).AsVector3(); 298 ray_end = ((OSDArray)rm["ray_end"]).AsVector3();
@@ -331,6 +334,7 @@ namespace OpenSim.Region.ClientStack.Linden
331 pbs.ProfileEnd = (ushort)profile_end; 334 pbs.ProfileEnd = (ushort)profile_end;
332 pbs.Scale = scale; 335 pbs.Scale = scale;
333 pbs.State = (byte)state; 336 pbs.State = (byte)state;
337 pbs.LastAttachPoint = (byte)lastattach;
334 338
335 SceneObjectGroup obj = null; ; 339 SceneObjectGroup obj = null; ;
336 340
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index 55a503e..769fe28 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -277,6 +277,7 @@ namespace OpenSim.Region.ClientStack.Linden
277 pbs.ProfileEnd = (ushort) obj.ProfileEnd; 277 pbs.ProfileEnd = (ushort) obj.ProfileEnd;
278 pbs.Scale = obj.Scale; 278 pbs.Scale = obj.Scale;
279 pbs.State = (byte) 0; 279 pbs.State = (byte) 0;
280 pbs.LastAttachPoint = (byte) 0;
280 SceneObjectPart prim = new SceneObjectPart(); 281 SceneObjectPart prim = new SceneObjectPart();
281 prim.UUID = UUID.Random(); 282 prim.UUID = UUID.Random();
282 prim.CreatorID = AgentId; 283 prim.CreatorID = AgentId;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 1b091bf..3609ec1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -12188,6 +12188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12188 12188
12189 shape.PCode = addPacket.ObjectData.PCode; 12189 shape.PCode = addPacket.ObjectData.PCode;
12190 shape.State = addPacket.ObjectData.State; 12190 shape.State = addPacket.ObjectData.State;
12191 shape.LastAttachPoint = addPacket.ObjectData.State;
12191 shape.PathBegin = addPacket.ObjectData.PathBegin; 12192 shape.PathBegin = addPacket.ObjectData.PathBegin;
12192 shape.PathEnd = addPacket.ObjectData.PathEnd; 12193 shape.PathEnd = addPacket.ObjectData.PathEnd;
12193 shape.PathScaleX = addPacket.ObjectData.PathScaleX; 12194 shape.PathScaleX = addPacket.ObjectData.PathScaleX;
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2818712..d0e0b35 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -422,6 +422,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
422 attachPos = Vector3.Zero; 422 attachPos = Vector3.Zero;
423 } 423 }
424 424
425 // if the attachment point is the same as previous, make sure we get the saved
426 // position info.
427 if (attachmentPt != 0 && attachmentPt == group.RootPart.Shape.LastAttachPoint)
428 {
429 attachPos = group.RootPart.AttachedPos;
430 }
431
425 // AttachmentPt 0 means the client chose to 'wear' the attachment. 432 // AttachmentPt 0 means the client chose to 'wear' the attachment.
426 if (attachmentPt == (uint)AttachmentPoint.Default) 433 if (attachmentPt == (uint)AttachmentPoint.Default)
427 { 434 {
@@ -429,6 +436,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
429 attachmentPt = group.AttachmentPoint; 436 attachmentPt = group.AttachmentPoint;
430 } 437 }
431 438
439 // if we didn't find an attach point, look for where it was last attached
440 if (attachmentPt == 0)
441 {
442 attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
443 attachPos = group.RootPart.AttachedPos;
444 group.HasGroupChanged = true;
445 }
446
432 // if we still didn't find a suitable attachment point....... 447 // if we still didn't find a suitable attachment point.......
433 if (attachmentPt == 0) 448 if (attachmentPt == 0)
434 { 449 {
@@ -619,6 +634,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
619 so.ClearPartAttachmentData(); 634 so.ClearPartAttachmentData();
620 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive); 635 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive);
621 so.HasGroupChanged = true; 636 so.HasGroupChanged = true;
637 so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint;
622 rootPart.Rezzed = DateTime.Now; 638 rootPart.Rezzed = DateTime.Now;
623 rootPart.RemFlag(PrimFlags.TemporaryOnRez); 639 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
624 so.AttachToBackup(); 640 so.AttachToBackup();
@@ -1210,4 +1226,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1210 1226
1211 #endregion 1227 #endregion
1212 } 1228 }
1213} \ No newline at end of file 1229}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 68e4e26..0ec9575 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -836,6 +836,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
836 m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3"); 836 m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3");
837 } 837 }
838 838
839 // if this was previously an attachment and is now being rezzed,
840 // save the old attachment info.
841 if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
842 {
843 group.RootPart.AttachedPos = group.AbsolutePosition;
844 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
845 }
846
839 foreach (SceneObjectPart part in group.Parts) 847 foreach (SceneObjectPart part in group.Parts)
840 { 848 {
841 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. 849 // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 69b5f43..4bebbe8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2230,6 +2230,13 @@ namespace OpenSim.Region.Framework.Scenes
2230 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2230 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2231 } 2231 }
2232 2232
2233
2234 if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
2235 {
2236 group.RootPart.AttachedPos = group.AbsolutePosition;
2237 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
2238 }
2239
2233 group.FromPartID = sourcePart.UUID; 2240 group.FromPartID = sourcePart.UUID;
2234 AddNewSceneObject(group, true, pos, rot, vel); 2241 AddNewSceneObject(group, true, pos, rot, vel);
2235 2242
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 945745e..3ea936c 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -365,6 +365,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
365 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); 365 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
366 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); 366 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
367 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); 367 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
368 m_SOPXmlProcessors.Add("AttachedPos", ProcessAttachedPos);
368 m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs); 369 m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs);
369 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); 370 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
370 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); 371 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
@@ -433,6 +434,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
433 m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd); 434 m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd);
434 m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow); 435 m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow);
435 m_ShapeXmlProcessors.Add("Scale", ProcessShpScale); 436 m_ShapeXmlProcessors.Add("Scale", ProcessShpScale);
437 m_ShapeXmlProcessors.Add("LastAttachPoint", ProcessShpLastAttach);
436 m_ShapeXmlProcessors.Add("State", ProcessShpState); 438 m_ShapeXmlProcessors.Add("State", ProcessShpState);
437 m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape); 439 m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape);
438 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); 440 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape);
@@ -761,6 +763,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
761 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); 763 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
762 } 764 }
763 765
766 private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader)
767 {
768 obj.AttachedPos = Util.ReadVector(reader, "AttachedPos");
769 }
770
764 private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) 771 private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader)
765 { 772 {
766 obj.DynAttrs.ReadXml(reader); 773 obj.DynAttrs.ReadXml(reader);
@@ -1043,6 +1050,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1043 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); 1050 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty);
1044 } 1051 }
1045 1052
1053 private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlTextReader reader)
1054 {
1055 shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty);
1056 }
1057
1046 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) 1058 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
1047 { 1059 {
1048 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); 1060 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
@@ -1289,6 +1301,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1289 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1301 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1290 if (sop.MediaUrl != null) 1302 if (sop.MediaUrl != null)
1291 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1303 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1304 WriteVector(writer, "AttachedPos", sop.AttachedPos);
1292 1305
1293 if (sop.DynAttrs.CountNamespaces > 0) 1306 if (sop.DynAttrs.CountNamespaces > 0)
1294 { 1307 {
@@ -1471,6 +1484,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1471 writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString()); 1484 writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString());
1472 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); 1485 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1473 writer.WriteElementString("State", shp.State.ToString()); 1486 writer.WriteElementString("State", shp.State.ToString());
1487 writer.WriteElementString("LastAttachPoint", shp.LastAttachPoint.ToString());
1474 1488
1475 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); 1489 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
1476 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options); 1490 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);