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
ba9daf849e
(cherry picked from commit 4ff9fbca441110cc2b93edc7286e0e9339e61cbe)
This commit is contained in:
Aleric Inglewood
2013-08-04 19:19:11 +02:00
committed by teravus
parent a37c59b43e
commit 2dc92e7de1
14 changed files with 150 additions and 10 deletions

View File

@@ -600,3 +600,15 @@ BEGIN;
ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob;
COMMIT;
:VERSION 30 #---------------- Save Attachment info
BEGIN;
ALTER TABLE prims ADD COLUMN AttachedPosX double default '0';
ALTER TABLE prims ADD COLUMN AttachedPosY double default '0';
ALTER TABLE prims ADD COLUMN AttachedPosZ double default '0';
ALTER TABLE primshapes ADD COLUMN LastAttachPoint int not null default '0';
COMMIT;

View File

@@ -1236,6 +1236,10 @@ namespace OpenSim.Data.SQLite
createCol(prims, "MediaURL", typeof(String));
createCol(prims, "AttachedPosX", typeof(Double));
createCol(prims, "AttachedPosY", typeof(Double));
createCol(prims, "AttachedPosZ", typeof(Double));
createCol(prims, "DynAttrs", typeof(String));
createCol(prims, "PhysicsShapeType", typeof(Byte));
@@ -1724,6 +1728,12 @@ namespace OpenSim.Data.SQLite
prim.MediaUrl = (string)row["MediaURL"];
}
prim.AttachedPos = new Vector3(
Convert.ToSingle(row["AttachedPosX"]),
Convert.ToSingle(row["AttachedPosY"]),
Convert.ToSingle(row["AttachedPosZ"])
);
if (!(row["DynAttrs"] is System.DBNull))
{
//m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType());
@@ -2176,6 +2186,10 @@ namespace OpenSim.Data.SQLite
row["MediaURL"] = prim.MediaUrl;
row["AttachedPosX"] = prim.AttachedPos.X;
row["AttachedPosY"] = prim.AttachedPos.Y;
row["AttachedPosZ"] = prim.AttachedPos.Z;
if (prim.DynAttrs.CountNamespaces > 0)
row["DynAttrs"] = prim.DynAttrs.ToXml();
else
@@ -2444,6 +2458,7 @@ namespace OpenSim.Data.SQLite
s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
s.State = Convert.ToByte(row["State"]);
s.LastAttachPoint = Convert.ToByte(row["LastAttachPoint"]);
byte[] textureEntry = (byte[])row["Texture"];
s.TextureEntry = textureEntry;
@@ -2493,6 +2508,7 @@ namespace OpenSim.Data.SQLite
row["ProfileCurve"] = s.ProfileCurve;
row["ProfileHollow"] = s.ProfileHollow;
row["State"] = s.State;
row["LastAttachPoint"] = s.LastAttachPoint;
row["Texture"] = s.TextureEntry;
row["ExtraParams"] = s.ExtraParams;