diff options
More work on SceneObject/Primitive and building (Linking is a work in progress as is all). Committing now as I've finished for the night and will be continued tomorrow.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Primitive.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Primitive.cs | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 97e7974..dd8bb02 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs | |||
@@ -22,8 +22,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
22 | private Dictionary<LLUUID, InventoryItem> inventoryItems; | 22 | private Dictionary<LLUUID, InventoryItem> inventoryItems; |
23 | 23 | ||
24 | private string description = ""; | 24 | private string description = ""; |
25 | |||
26 | public string SitName = ""; | ||
27 | public string TouchName = ""; | ||
28 | public string Text = ""; | ||
29 | |||
30 | public LLUUID CreatorID; | ||
25 | public LLUUID OwnerID; | 31 | public LLUUID OwnerID; |
32 | public LLUUID LastOwnerID; | ||
26 | public Int32 CreationDate; | 33 | public Int32 CreationDate; |
34 | |||
35 | public uint ParentID = 0; | ||
36 | |||
27 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | 37 | public uint OwnerMask = FULL_MASK_PERMISSIONS; |
28 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | 38 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; |
29 | public uint GroupMask = FULL_MASK_PERMISSIONS; | 39 | public uint GroupMask = FULL_MASK_PERMISSIONS; |
@@ -32,9 +42,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
32 | 42 | ||
33 | private PrimitiveBaseShape m_Shape; | 43 | private PrimitiveBaseShape m_Shape; |
34 | 44 | ||
35 | private SceneObject m_RootParent; | 45 | public SceneObject m_RootParent; |
36 | private bool isRootPrim; | 46 | public bool isRootPrim; |
37 | private EntityBase m_Parent; | 47 | public EntityBase m_Parent; |
38 | 48 | ||
39 | public override LLVector3 Pos | 49 | public override LLVector3 Pos |
40 | { | 50 | { |
@@ -51,7 +61,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
51 | } | 61 | } |
52 | set | 62 | set |
53 | { | 63 | { |
54 | this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position | 64 | this.m_pos = m_Parent.Pos - value; //should we being subtracting the parent position |
55 | } | 65 | } |
56 | 66 | ||
57 | } | 67 | } |
@@ -108,6 +118,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
108 | { | 118 | { |
109 | this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 119 | this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
110 | this.OwnerID = ownerID; | 120 | this.OwnerID = ownerID; |
121 | this.CreatorID = this.OwnerID; | ||
122 | this.LastOwnerID = LLUUID.Zero; | ||
111 | this.Pos = addPacket.ObjectData.RayEnd; | 123 | this.Pos = addPacket.ObjectData.RayEnd; |
112 | this.uuid = LLUUID.Random(); | 124 | this.uuid = LLUUID.Random(); |
113 | this.m_localId = (uint)(localID); | 125 | this.m_localId = (uint)(localID); |
@@ -128,7 +140,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
128 | pShape.Scale = addPacket.ObjectData.Scale; | 140 | pShape.Scale = addPacket.ObjectData.Scale; |
129 | pShape.PathCurve = addPacket.ObjectData.PathCurve; | 141 | pShape.PathCurve = addPacket.ObjectData.PathCurve; |
130 | pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve; | 142 | pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve; |
131 | pShape.ParentID = 0; | ||
132 | pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow; | 143 | pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow; |
133 | pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | 144 | pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; |
134 | pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions; | 145 | pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions; |
@@ -142,7 +153,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
142 | 153 | ||
143 | public void AddToChildren(SceneObject linkObject) | 154 | public void AddToChildren(SceneObject linkObject) |
144 | { | 155 | { |
156 | // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); | ||
157 | //TODO check permissions | ||
158 | this.children.Add(linkObject.rootPrimitive); | ||
159 | linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); | ||
160 | |||
161 | this.m_world.DeleteEntity(linkObject.rootUUID); | ||
162 | linkObject.rootPrimitive = null; | ||
163 | } | ||
164 | |||
165 | public void SetNewParent(Primitive newParent, SceneObject rootParent) | ||
166 | { | ||
167 | LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); | ||
168 | //Console.WriteLine("have a new parent and my old position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z); | ||
169 | this.isRootPrim = false; | ||
170 | this.m_Parent = newParent; | ||
171 | this.ParentID = newParent.LocalId; | ||
172 | this.SetRootParent(rootParent); | ||
173 | // Console.WriteLine("have a new parent and its position is " + this.m_Parent.Pos.X + " , " + this.m_Parent.Pos.Y + " , " + this.m_Parent.Pos.Z); | ||
174 | this.Pos = oldPos; | ||
175 | // Console.WriteLine("have a new parent so my new offset position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z); | ||
176 | this.updateFlag = 1; | ||
177 | |||
178 | } | ||
145 | 179 | ||
180 | public void SetRootParent(SceneObject newRoot) | ||
181 | { | ||
182 | this.m_RootParent = newRoot; | ||
183 | foreach (Primitive child in children) | ||
184 | { | ||
185 | child.SetRootParent(newRoot); | ||
186 | } | ||
146 | } | 187 | } |
147 | 188 | ||
148 | /// <summary> | 189 | /// <summary> |
@@ -187,7 +228,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
187 | LLVector3 lPos; | 228 | LLVector3 lPos; |
188 | lPos = this.Pos; | 229 | lPos = this.Pos; |
189 | 230 | ||
190 | remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID); | 231 | remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID); |
191 | } | 232 | } |
192 | 233 | ||
193 | /// <summary> | 234 | /// <summary> |