aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-07-18 13:40:07 +0000
committerMW2007-07-18 13:40:07 +0000
commit04ece84d6b3aa442ed7413f23b0daa30ff6d3ee8 (patch)
treee457adc88cfa763d6e3fb3734b253f94b2aa775b
parent* Added a FileSystemObject to SimpleApp (diff)
downloadopensim-SC-04ece84d6b3aa442ed7413f23b0daa30ff6d3ee8.zip
opensim-SC-04ece84d6b3aa442ed7413f23b0daa30ff6d3ee8.tar.gz
opensim-SC-04ece84d6b3aa442ed7413f23b0daa30ff6d3ee8.tar.bz2
opensim-SC-04ece84d6b3aa442ed7413f23b0daa30ff6d3ee8.tar.xz
few small changes
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/General/NullClientAPI.cs130
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs5
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup.cs244
-rw-r--r--OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart.cs258
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs3
9 files changed, 662 insertions, 9 deletions
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
new file mode 100644
index 0000000..44bc588
--- /dev/null
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -0,0 +1,130 @@
1using System.Collections.Generic;
2using System.Net;
3using OpenSim.Framework.Interfaces;
4using OpenSim.Framework.Types;
5using OpenSim.Framework.Data;
6using libsecondlife;
7using libsecondlife.Packets;
8
9
10namespace OpenSim.Framework
11{
12 public class NullClientAPI : IClientAPI
13 {
14#pragma warning disable 67
15 public event ImprovedInstantMessage OnInstantMessage;
16 public event ChatFromViewer OnChatFromViewer;
17 public event RezObject OnRezObject;
18 public event ModifyTerrain OnModifyTerrain;
19 public event SetAppearance OnSetAppearance;
20 public event StartAnim OnStartAnim;
21 public event LinkObjects OnLinkObjects;
22 public event RequestMapBlocks OnRequestMapBlocks;
23 public event TeleportLocationRequest OnTeleportLocationRequest;
24
25 public event GenericCall4 OnDeRezObject;
26 public event GenericCall OnRegionHandShakeReply;
27 public event GenericCall OnRequestWearables;
28 public event GenericCall2 OnCompleteMovementToRegion;
29 public event UpdateAgent OnAgentUpdate;
30 public event GenericCall OnRequestAvatarsData;
31 public event AddNewPrim OnAddPrim;
32 public event ObjectDuplicate OnObjectDuplicate;
33 public event UpdateVector OnGrapObject;
34 public event ObjectSelect OnDeGrapObject;
35 public event MoveObject OnGrapUpdate;
36
37 public event UpdateShape OnUpdatePrimShape;
38 public event ObjectSelect OnObjectSelect;
39 public event GenericCall7 OnObjectDescription;
40 public event GenericCall7 OnObjectName;
41 public event UpdatePrimFlags OnUpdatePrimFlags;
42 public event UpdatePrimTexture OnUpdatePrimTexture;
43 public event UpdateVector OnUpdatePrimGroupPosition;
44 public event UpdateVector OnUpdatePrimSinglePosition;
45 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
46 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
47 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
48 public event UpdateVector OnUpdatePrimScale;
49 public event StatusChange OnChildAgentStatus;
50 public event GenericCall2 OnStopMovement;
51 public event NewAvatar OnNewAvatar;
52 public event GenericCall6 OnRemoveAvatar;
53
54 public event UUIDNameRequest OnNameFromUUIDRequest;
55
56 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
57 public event ParcelDivideRequest OnParcelDivideRequest;
58 public event ParcelJoinRequest OnParcelJoinRequest;
59 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
60 public event ParcelSelectObjects OnParcelSelectObjects;
61 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
62 public event ObjectDeselect OnObjectDeselect;
63
64
65 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
66#pragma warning restore 67
67
68 private LLUUID m_uuid = LLUUID.Random();
69 public virtual LLVector3 StartPos
70 {
71 get { return new LLVector3(); }
72 set { }
73 }
74
75 public virtual LLUUID AgentId
76 {
77 get { return m_uuid; }
78 }
79
80 public virtual string FirstName
81 {
82 get { return ""; }
83 }
84
85 public virtual string LastName
86 {
87 get { return ""; }
88 }
89
90 public NullClientAPI()
91 {
92 }
93
94 public virtual void OutPacket(Packet newPack){}
95 public virtual void SendWearables(AvatarWearable[] wearables){}
96 public virtual void SendStartPingCheck(byte seq){}
97 public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID){}
98 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){}
99 public virtual void SendRegionHandshake(RegionInfo regionInfo){}
100 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){}
101 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){}
102 public virtual void SendInstantMessage(string message, LLUUID target, string fromName){}
103 public virtual void SendLayerData(float[] map){}
104 public virtual void SendLayerData(int px, int py, float[] map){}
105 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look){}
106 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint){}
107 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); }
108 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint){}
109 public virtual void SendMapBlock(List<MapBlockData> mapBlocks){}
110 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags){}
111 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags){}
112 public virtual void SendTeleportCancel(){}
113 public virtual void SendTeleportLocationStart(){}
114 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance){}
115
116 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry){}
117 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity){}
118
119 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint){}
120 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags){}
121 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags){}
122 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){}
123 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){}
124 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){}
125
126 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){}
127 public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){}
128 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
129 }
130}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 13a37dd..317a0ba 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -354,7 +354,6 @@ namespace OpenSim.Region.Communications.OGS1
354 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); 354 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions");
355 if (remObject != null) 355 if (remObject != null)
356 { 356 {
357
358 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); 357 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData);
359 } 358 }
360 else 359 else
@@ -396,14 +395,11 @@ namespace OpenSim.Region.Communications.OGS1
396 if (regInfo != null) 395 if (regInfo != null)
397 { 396 {
398 bool retValue = false; 397 bool retValue = false;
399
400
401 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 398 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
402 typeof(OGS1InterRegionRemoting), 399 typeof(OGS1InterRegionRemoting),
403 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); 400 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions");
404 if (remObject != null) 401 if (remObject != null)
405 { 402 {
406
407 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position); 403 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position);
408 } 404 }
409 else 405 else
@@ -412,7 +408,6 @@ namespace OpenSim.Region.Communications.OGS1
412 } 408 }
413 remObject = null; 409 remObject = null;
414 410
415
416 return retValue; 411 return retValue;
417 } 412 }
418 //TODO need to see if we know about where this region is and use .net remoting 413 //TODO need to see if we know about where this region is and use .net remoting
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 0847148..a1f31bb 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -69,7 +69,6 @@ namespace OpenSim.Region.Communications.OGS1
69 { 69 {
70 try 70 try
71 { 71 {
72
73 Hashtable param = new Hashtable(); 72 Hashtable param = new Hashtable();
74 param["avatar_uuid"] = avatarID.ToString(); 73 param["avatar_uuid"] = avatarID.ToString();
75 IList parameters = new ArrayList(); 74 IList parameters = new ArrayList();
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup.cs
new file mode 100644
index 0000000..b04340a
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup.cs
@@ -0,0 +1,244 @@
1using System.Collections.Generic;
2using System.Text;
3using Axiom.Math;
4using libsecondlife;
5using libsecondlife.Packets;
6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types;
8using OpenSim.Physics.Manager;
9
10namespace OpenSim.Region.Environment.Scenes
11{
12 public delegate void PrimCountTaintedDelegate();
13
14 public class AllNewSceneObjectGroup : EntityBase
15 {
16 private Encoding enc = Encoding.ASCII;
17
18 protected AllNewSceneObjectPart m_rootPart;
19 protected Dictionary<LLUUID, AllNewSceneObjectPart> m_parts = new Dictionary<LLUUID, AllNewSceneObjectPart>();
20
21 public event PrimCountTaintedDelegate OnPrimCountTainted;
22
23 /// <summary>
24 ///
25 /// </summary>
26 public int primCount
27 {
28 get
29 {
30 return 1;
31 }
32 }
33
34 /// <summary>
35 ///
36 /// </summary>
37 public LLVector3 GroupCentrePoint
38 {
39 get
40 {
41 return new LLVector3(0, 0, 0);
42 }
43 }
44
45 /// <summary>
46 ///
47 /// </summary>
48 public AllNewSceneObjectGroup()
49 {
50
51 }
52
53 /// <summary>
54 ///
55 /// </summary>
56 public void FlagGroupForFullUpdate()
57 {
58
59 }
60
61 /// <summary>
62 ///
63 /// </summary>
64 public void FlagGroupForTerseUpdate()
65 {
66
67 }
68
69 /// <summary>
70 ///
71 /// </summary>
72 /// <param name="objectGroup"></param>
73 public void LinkToGroup(AllNewSceneObjectGroup objectGroup)
74 {
75
76 }
77
78 /// <summary>
79 ///
80 /// </summary>
81 /// <param name="primID"></param>
82 /// <returns></returns>
83 public AllNewSceneObjectPart HasChildPrim(LLUUID primID)
84 {
85 AllNewSceneObjectPart childPart = null;
86 if (this.m_parts.ContainsKey(primID))
87 {
88 childPart = this.m_parts[primID];
89 }
90 return childPart;
91 }
92
93 /// <summary>
94 ///
95 /// </summary>
96 /// <param name="localID"></param>
97 /// <returns></returns>
98 public AllNewSceneObjectPart HasChildPrim(uint localID)
99 {
100 foreach (AllNewSceneObjectPart part in this.m_parts.Values)
101 {
102 if (part.m_localID == localID)
103 {
104 return part;
105 }
106 }
107 return null;
108 }
109
110 public void TriggerTainted()
111 {
112 if (OnPrimCountTainted != null)
113 {
114 this.OnPrimCountTainted();
115 }
116 }
117
118 /// <summary>
119 ///
120 /// </summary>
121 /// <param name="offset"></param>
122 /// <param name="pos"></param>
123 /// <param name="remoteClient"></param>
124 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
125 {
126 this.Pos = pos;
127 }
128
129 /// <summary>
130 ///
131 /// </summary>
132 /// <param name="client"></param>
133 public void GetProperites(IClientAPI client)
134 {
135 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
136 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
137 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
138 proper.ObjectData[0].ItemID = LLUUID.Zero;
139 proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate;
140 proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID;
141 proper.ObjectData[0].FolderID = LLUUID.Zero;
142 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
143 proper.ObjectData[0].GroupID = LLUUID.Zero;
144 proper.ObjectData[0].InventorySerial = 0;
145 proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID;
146 proper.ObjectData[0].ObjectID = this.m_uuid;
147 proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID;
148 proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0");
149 proper.ObjectData[0].TextureID = new byte[0];
150 proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0");
151 proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0");
152 proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0");
153 proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask;
154 proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask;
155 proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask;
156 proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask;
157 proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask;
158
159 client.OutPacket(proper);
160 }
161
162 /// <summary>
163 ///
164 /// </summary>
165 /// <param name="part"></param>
166 private void SetPartAsRoot(AllNewSceneObjectPart part)
167 {
168 this.m_rootPart = part;
169 this.m_uuid = part.uuid;
170 this.m_localId = part.m_localID;
171 part.ParentID = 0;
172 part.UpdateHandler = delegate(ref LLVector3 pos, UpdateType direction, AllNewSceneObjectPart objectPart)
173 {
174 switch (direction)
175 {
176 case UpdateType.InComingNewPosition:
177 this.m_pos = new LLVector3(pos.X, pos.Y, pos.Z);
178 pos.X = 0;
179 pos.Y = 0;
180 pos.Z = 0;
181 break;
182
183 case UpdateType.SinglePositionEdit:
184 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
185 LLVector3 oldPos = new LLVector3(this.Pos.X + objectPart.OffsetPosition.X, this.Pos.Y + objectPart.OffsetPosition.Y, this.Pos.Z + objectPart.OffsetPosition.Z);
186 LLVector3 diff = oldPos - newPos;
187 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
188 Axiom.Math.Quaternion partRotation = new Quaternion(objectPart.RotationOffset.W, objectPart.RotationOffset.X, objectPart.RotationOffset.Y, objectPart.RotationOffset.Z);
189 axDiff = partRotation.Inverse() * axDiff;
190 diff.X = axDiff.x;
191 diff.Y = axDiff.y;
192 diff.Z = axDiff.z;
193
194 foreach (AllNewSceneObjectPart obPart in this.m_parts.Values)
195 {
196 if (obPart.uuid == objectPart.uuid)
197 {
198 obPart.OffsetPosition = obPart.OffsetPosition + diff;
199 }
200 }
201 this.Pos = newPos;
202 pos.X = newPos.X;
203 pos.Y = newPos.Y;
204 pos.Z = newPos.Z;
205 break;
206
207 case UpdateType.ResizeOffset:
208 this.Pos += pos;
209 LLVector3 offset = new LLVector3(-pos.X, -pos.Y, -pos.Z);
210 foreach (AllNewSceneObjectPart obPart2 in this.m_parts.Values)
211 {
212 if (obPart2.uuid == objectPart.uuid)
213 {
214 obPart2.OffsetPosition = obPart2.OffsetPosition + offset;
215 }
216 }
217 pos.X = 0;
218 pos.Y = 0;
219 pos.Z = 0;
220 break;
221
222 case UpdateType.SingleRotationEdit:
223 break;
224 }
225
226
227 return pos;
228 };
229 }
230
231 /// <summary>
232 ///
233 /// </summary>
234 /// <param name="part"></param>
235 private void SetPartAsNonRoot(AllNewSceneObjectPart part)
236 {
237 part.ParentID = this.m_rootPart.m_localID;
238 part.UpdateHandler = delegate(ref LLVector3 pos, UpdateType direction, AllNewSceneObjectPart objectPart)
239 {
240 return pos;
241 };
242 }
243 }
244}
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart.cs
new file mode 100644
index 0000000..21659c4
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart.cs
@@ -0,0 +1,258 @@
1using System.Collections.Generic;
2using System.Text;
3using System;
4using Axiom.Math;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types;
9
10namespace OpenSim.Region.Environment.Scenes
11{
12 public enum UpdateType
13 {
14 OutGoingOffset,
15 InComingNewPosition,
16 SinglePositionEdit,
17 ResizeOffset,
18 SingleRotationEdit
19 }
20
21 public delegate LLVector3 HandleUpdate(ref LLVector3 pos, UpdateType updateType, AllNewSceneObjectPart objectPart);
22
23 public class AllNewSceneObjectPart
24 {
25 private const uint FULL_MASK_PERMISSIONS = 2147483647;
26
27 private ulong m_regionHandle;
28 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
29 //private Dictionary<LLUUID, InventoryItem> inventoryItems;
30
31 public string SitName = "";
32 public string TouchName = "";
33 public string Text = "";
34
35 public LLUUID CreatorID;
36 public LLUUID OwnerID;
37 public LLUUID LastOwnerID;
38 public Int32 CreationDate;
39
40 public LLUUID uuid;
41 public uint m_localID;
42
43 public uint ParentID = 0;
44
45 public uint OwnerMask = FULL_MASK_PERMISSIONS;
46 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
47 public uint GroupMask = FULL_MASK_PERMISSIONS;
48 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
49 public uint BaseMask = FULL_MASK_PERMISSIONS;
50
51 protected PrimitiveBaseShape m_Shape;
52
53 protected AllNewSceneObjectGroup m_parentGroup;
54
55 public HandleUpdate UpdateHandler;
56
57 #region Properties
58 protected string m_name;
59 /// <summary>
60 ///
61 /// </summary>
62 public virtual string Name
63 {
64 get { return m_name; }
65 set { m_name = value; }
66 }
67
68 protected LLVector3 m_offset;
69 public LLVector3 OffsetPosition
70 {
71 get
72 {
73 return m_offset;
74 }
75 set
76 {
77 m_offset = value;
78 }
79 }
80
81 protected LLQuaternion m_rotationOffset;
82 public LLQuaternion RotationOffset
83 {
84 get
85 {
86 return m_rotationOffset;
87 }
88 set
89 {
90 m_rotationOffset = value;
91 }
92 }
93
94 private string m_description = "";
95 public string Description
96 {
97 get
98 {
99 return this.m_description;
100 }
101 set
102 {
103 this.m_description = value;
104 }
105 }
106
107 public PrimitiveBaseShape Shape
108 {
109 get
110 {
111 return this.m_Shape;
112 }
113 }
114
115 public LLVector3 Scale
116 {
117 set
118 {
119 this.m_Shape.Scale = value;
120 }
121 get
122 {
123 return this.m_Shape.Scale;
124 }
125 }
126 #endregion
127
128 #region Constructors
129 public AllNewSceneObjectPart(ulong regionHandle, AllNewSceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 position)
130 {
131 this.m_regionHandle = regionHandle;
132 this.m_parentGroup = parent;
133
134 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
135 this.OwnerID = ownerID;
136 this.CreatorID = this.OwnerID;
137 this.LastOwnerID = LLUUID.Zero;
138 this.uuid = LLUUID.Random();
139 this.m_localID = (uint)(localID);
140 this.m_Shape = shape;
141
142 this.UpdateHandler(ref position, UpdateType.InComingNewPosition, this);
143 this.OffsetPosition = position;
144 }
145 #endregion
146
147 #region Shape
148 /// <summary>
149 ///
150 /// </summary>
151 /// <param name="shapeBlock"></param>
152 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
153 {
154 this.m_Shape.PathBegin = shapeBlock.PathBegin;
155 this.m_Shape.PathEnd = shapeBlock.PathEnd;
156 this.m_Shape.PathScaleX = shapeBlock.PathScaleX;
157 this.m_Shape.PathScaleY = shapeBlock.PathScaleY;
158 this.m_Shape.PathShearX = shapeBlock.PathShearX;
159 this.m_Shape.PathShearY = shapeBlock.PathShearY;
160 this.m_Shape.PathSkew = shapeBlock.PathSkew;
161 this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin;
162 this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd;
163 this.m_Shape.PathCurve = shapeBlock.PathCurve;
164 this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve;
165 this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow;
166 this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
167 this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions;
168 this.m_Shape.PathTaperX = shapeBlock.PathTaperX;
169 this.m_Shape.PathTaperY = shapeBlock.PathTaperY;
170 this.m_Shape.PathTwist = shapeBlock.PathTwist;
171 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin;
172 }
173 #endregion
174
175 #region Texture
176 /// <summary>
177 ///
178 /// </summary>
179 /// <param name="textureEntry"></param>
180 public void UpdateTextureEntry(byte[] textureEntry)
181 {
182 this.m_Shape.TextureEntry = textureEntry;
183 }
184 #endregion
185
186 #region Position
187 /// <summary>
188 ///
189 /// </summary>
190 /// <param name="pos"></param>
191 public void UpdateGroupPosition(LLVector3 pos)
192 {
193 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
194 this.UpdateHandler(ref newPos, UpdateType.InComingNewPosition, this);
195 this.OffsetPosition = newPos;
196 }
197
198 public void UpdateSinglePosition(LLVector3 pos)
199 {
200 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
201 this.UpdateHandler(ref newPos, UpdateType.SinglePositionEdit, this);
202 this.OffsetPosition = newPos;
203 }
204 #endregion
205
206 #region rotation
207 public void UpdateGroupRotation(LLQuaternion rot)
208 {
209 this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W);
210 }
211
212 /// <summary>
213 ///
214 /// </summary>
215 /// <param name="pos"></param>
216 /// <param name="rot"></param>
217 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
218 {
219 this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W);
220 this.UpdateHandler(ref pos, UpdateType.InComingNewPosition, this);
221 this.OffsetPosition = pos;
222 }
223
224 /// <summary>
225 ///
226 /// </summary>
227 /// <param name="rot"></param>
228 public void UpdateSingleRotation(LLQuaternion rot)
229 {
230 //Console.WriteLine("updating single prim rotation");
231 Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
232 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.RotationOffset.W, this.RotationOffset.X, this.RotationOffset.Y, this.RotationOffset.Z);
233 this.RotationOffset = new LLQuaternion(axRot.x, axRot.y, axRot.z, axRot.w);
234
235 LLVector3 offset = this.OffsetPosition;
236 this.UpdateHandler(ref offset, UpdateType.SingleRotationEdit, this);
237 }
238 #endregion
239
240 #region Resizing/Scale
241 /// <summary>
242 ///
243 /// </summary>
244 /// <param name="scale"></param>
245 public void ResizeGoup(LLVector3 scale)
246 {
247 LLVector3 offset = (scale - this.m_Shape.Scale);
248 offset.X /= 2;
249 offset.Y /= 2;
250 offset.Z /= 2;
251
252 this.UpdateHandler(ref offset, UpdateType.ResizeOffset, this);
253 this.OffsetPosition += offset;
254 this.m_Shape.Scale = scale;
255 }
256 #endregion
257 }
258}
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index fc75bdc..0d1e3fc 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -7,9 +7,10 @@ namespace OpenSim.Region.Environment.Scenes
7 public abstract class EntityBase 7 public abstract class EntityBase
8 { 8 {
9 public LLUUID m_uuid; 9 public LLUUID m_uuid;
10 10
11 protected List<EntityBase> m_children; 11 protected List<EntityBase> m_children;
12 12
13
13 protected Scene m_world; 14 protected Scene m_world;
14 protected string m_name; 15 protected string m_name;
15 16
@@ -88,7 +89,9 @@ namespace OpenSim.Region.Environment.Scenes
88 m_velocity = new LLVector3(); 89 m_velocity = new LLVector3();
89 Rotation = new Quaternion(); 90 Rotation = new Quaternion();
90 m_name = "(basic entity)"; 91 m_name = "(basic entity)";
92
91 m_children = new List<EntityBase>(); 93 m_children = new List<EntityBase>();
94
92 } 95 }
93 96
94 /// <summary> 97 /// <summary>
@@ -96,7 +99,9 @@ namespace OpenSim.Region.Environment.Scenes
96 /// </summary> 99 /// </summary>
97 public virtual void updateMovement() 100 public virtual void updateMovement()
98 { 101 {
102
99 foreach (EntityBase child in m_children) 103 foreach (EntityBase child in m_children)
104
100 { 105 {
101 child.updateMovement(); 106 child.updateMovement();
102 } 107 }
@@ -108,6 +113,7 @@ namespace OpenSim.Region.Environment.Scenes
108 public virtual void Update() 113 public virtual void Update()
109 { 114 {
110 // Do any per-frame updates needed that are applicable to every type of entity 115 // Do any per-frame updates needed that are applicable to every type of entity
116
111 foreach (EntityBase child in m_children) 117 foreach (EntityBase child in m_children)
112 { 118 {
113 child.Update(); 119 child.Update();
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 5b6b13d..4818348 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -9,7 +9,7 @@ using OpenSim.Framework.Types;
9 9
10namespace OpenSim.Region.Environment.Scenes 10namespace OpenSim.Region.Environment.Scenes
11{ 11{
12 public delegate void PrimCountTaintedDelegate(); 12 // public delegate void PrimCountTaintedDelegate();
13 13
14 public class Primitive : EntityBase 14 public class Primitive : EntityBase
15 { 15 {
@@ -198,12 +198,14 @@ namespace OpenSim.Region.Environment.Scenes
198 dupe.m_RootParent = rootParent; 198 dupe.m_RootParent = rootParent;
199 199
200 // TODO: Copy this properly. 200 // TODO: Copy this properly.
201
201 dupe.m_inventoryItems = m_inventoryItems; 202 dupe.m_inventoryItems = m_inventoryItems;
202 dupe.m_children = new List<EntityBase>(); 203 dupe.m_children = new List<EntityBase>();
203 dupe.m_Shape = m_Shape.Copy(); 204 dupe.m_Shape = m_Shape.Copy();
204 dupe.m_regionHandle = m_regionHandle; 205 dupe.m_regionHandle = m_regionHandle;
205 dupe.m_world = m_world; 206 dupe.m_world = m_world;
206 207
208
207 uint newLocalID = m_world.PrimIDAllocate(); 209 uint newLocalID = m_world.PrimIDAllocate();
208 dupe.m_uuid = LLUUID.Random(); 210 dupe.m_uuid = LLUUID.Random();
209 dupe.LocalId = newLocalID; 211 dupe.LocalId = newLocalID;
@@ -227,9 +229,11 @@ namespace OpenSim.Region.Environment.Scenes
227 m_world.AcknowledgeNewPrim(dupe); 229 m_world.AcknowledgeNewPrim(dupe);
228 dupe.TriggerOnPrimCountTainted(); 230 dupe.TriggerOnPrimCountTainted();
229 231
232
230 foreach (Primitive prim in m_children) 233 foreach (Primitive prim in m_children)
231 { 234 {
232 Primitive primClone = prim.Copy(dupe, rootParent); 235 Primitive primClone = prim.Copy(dupe, rootParent);
236
233 dupe.m_children.Add(primClone); 237 dupe.m_children.Add(primClone);
234 } 238 }
235 239
@@ -320,6 +324,7 @@ namespace OpenSim.Region.Environment.Scenes
320 { 324 {
321 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); 325 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
322 //TODO check permissions 326 //TODO check permissions
327
323 m_children.Add(linkObject.rootPrimitive); 328 m_children.Add(linkObject.rootPrimitive);
324 linkObject.rootPrimitive.SetNewParent(this, m_RootParent); 329 linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
325 330
@@ -350,11 +355,14 @@ namespace OpenSim.Region.Environment.Scenes
350 Rotation = m_Parent.Rotation.Inverse() * Rotation; 355 Rotation = m_Parent.Rotation.Inverse() * Rotation;
351 ScheduleFullUpdate(); 356 ScheduleFullUpdate();
352 357
358
353 foreach (Primitive child in m_children) 359 foreach (Primitive child in m_children)
354 { 360 {
355 child.SetRootParent(rootParent, newParent, oldPos, oldRot); 361 child.SetRootParent(rootParent, newParent, oldPos, oldRot);
356 } 362 }
363
357 m_children.Clear(); 364 m_children.Clear();
365
358 } 366 }
359 367
360 /// <summary> 368 /// <summary>
@@ -374,6 +382,7 @@ namespace OpenSim.Region.Environment.Scenes
374 m_Parent = newParent; 382 m_Parent = newParent;
375 ParentID = newParent.LocalId; 383 ParentID = newParent.LocalId;
376 newParent.AddToChildrenList(this); 384 newParent.AddToChildrenList(this);
385
377 m_RootParent = newRoot; 386 m_RootParent = newRoot;
378 m_RootParent.AddChildToList(this); 387 m_RootParent.AddChildToList(this);
379 Pos = oldPos; 388 Pos = oldPos;
@@ -387,7 +396,9 @@ namespace OpenSim.Region.Environment.Scenes
387 { 396 {
388 child.SetRootParent(newRoot, newParent, oldPos, oldRot); 397 child.SetRootParent(newRoot, newParent, oldPos, oldRot);
389 } 398 }
399
390 m_children.Clear(); 400 m_children.Clear();
401
391 } 402 }
392 403
393 /// <summary> 404 /// <summary>
@@ -527,6 +538,7 @@ namespace OpenSim.Region.Environment.Scenes
527 public void UpdateSingleRotation(LLQuaternion rot) 538 public void UpdateSingleRotation(LLQuaternion rot)
528 { 539 {
529 //Console.WriteLine("updating single prim rotation"); 540 //Console.WriteLine("updating single prim rotation");
541
530 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); 542 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
531 Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z); 543 Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
532 Rotation = axRot; 544 Rotation = axRot;
@@ -598,9 +610,12 @@ namespace OpenSim.Region.Environment.Scenes
598 /// <param name="remoteClient"></param> 610 /// <param name="remoteClient"></param>
599 public void SendFullUpdateForAllChildren(IClientAPI remoteClient) 611 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
600 { 612 {
613
601 SendFullUpdateToClient(remoteClient); 614 SendFullUpdateToClient(remoteClient);
602 for (int i = 0; i < m_children.Count; i++) 615 for (int i = 0; i < m_children.Count; i++)
616
603 { 617 {
618
604 if (m_children[i] is Primitive) 619 if (m_children[i] is Primitive)
605 { 620 {
606 ((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient); 621 ((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient);
@@ -641,6 +656,7 @@ namespace OpenSim.Region.Environment.Scenes
641 /// <param name="remoteClient"></param> 656 /// <param name="remoteClient"></param>
642 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient) 657 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
643 { 658 {
659
644 SendTerseUpdateToClient(remoteClient); 660 SendTerseUpdateToClient(remoteClient);
645 for (int i = 0; i < m_children.Count; i++) 661 for (int i = 0; i < m_children.Count; i++)
646 { 662 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index b6a2a34..70d2c6a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -707,6 +707,10 @@ namespace OpenSim.Region.Environment.Scenes
707 return null; 707 return null;
708 } 708 }
709 709
710 /// <summary>
711 ///
712 /// </summary>
713 /// <param name="whatToDo"></param>
710 public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo) 714 public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo)
711 { 715 {
712 foreach (ScenePresence presence in Avatars.Values) 716 foreach (ScenePresence presence in Avatars.Values)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index ed27fa9..926f1a4 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -150,8 +150,8 @@ namespace OpenSim.Region.Environment.Scenes
150 { 150 {
151 151
152 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); 152 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
153
154 this.m_children.Add(rootPrimitive); 153 this.m_children.Add(rootPrimitive);
154
155 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); 155 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
156 } 156 }
157 157
@@ -177,6 +177,7 @@ namespace OpenSim.Region.Environment.Scenes
177 dupe.m_regionHandle = this.m_regionHandle; 177 dupe.m_regionHandle = this.m_regionHandle;
178 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe); 178 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
179 dupe.rootPrimitive = newRoot; 179 dupe.rootPrimitive = newRoot;
180
180 dupe.m_children.Add(dupe.rootPrimitive); 181 dupe.m_children.Add(dupe.rootPrimitive);
181 dupe.rootPrimitive.Pos = this.Pos; 182 dupe.rootPrimitive.Pos = this.Pos;
182 dupe.Rotation = this.Rotation; 183 dupe.Rotation = this.Rotation;