diff options
author | Adam Frisby | 2008-05-01 16:35:00 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 16:35:00 +0000 |
commit | 13526097f24b7a8ad63b1d482c44b44397fa055f (patch) | |
tree | 7a82c20ed7c63e2aea5ad3863325e37f64e1cbea /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | * Breaking all the code, breaking all the code..! (diff) | |
download | opensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.zip opensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.gz opensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.bz2 opensim-SC-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.xz |
* Spring cleaning on Region.Environment.
* Converted a large number of read-only fields to be actually, readonly.
* Reformatted code sections.
* Removed redundant code.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 1964 |
1 files changed, 967 insertions, 997 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 3dbd809..3a9e1c2 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -56,6 +56,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
56 | Something5 = 64, | 56 | Something5 = 64, |
57 | Something6 = 128 | 57 | Something6 = 128 |
58 | } | 58 | } |
59 | |||
59 | [Flags] | 60 | [Flags] |
60 | public enum Changed : uint | 61 | public enum Changed : uint |
61 | { | 62 | { |
@@ -68,6 +69,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
68 | ALLOWED_DROP = 64, | 69 | ALLOWED_DROP = 64, |
69 | OWNER = 128 | 70 | OWNER = 128 |
70 | } | 71 | } |
72 | |||
71 | [Flags] | 73 | [Flags] |
72 | public enum TextureAnimFlags : byte | 74 | public enum TextureAnimFlags : byte |
73 | { | 75 | { |
@@ -81,70 +83,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
81 | SCALE = 0x40 | 83 | SCALE = 0x40 |
82 | } | 84 | } |
83 | 85 | ||
84 | 86 | ||
85 | [Serializable] | 87 | [Serializable] |
86 | public partial class SceneObjectPart : IScriptHost, ISerializable | 88 | public partial class SceneObjectPart : IScriptHost, ISerializable |
87 | { | 89 | { |
88 | |||
89 | [XmlIgnore] public PhysicsActor PhysActor = null; | ||
90 | |||
91 | public LLUUID LastOwnerID; | ||
92 | public LLUUID OwnerID; | ||
93 | public LLUUID GroupID; | ||
94 | public int OwnershipCost; | ||
95 | public byte ObjectSaleType; | ||
96 | public int SalePrice; | ||
97 | public uint Category; | 90 | public uint Category; |
98 | 91 | public Int32 CreationDate; | |
92 | [XmlIgnore] public LLUUID fromAssetID = LLUUID.Zero; | ||
93 | public LLUUID GroupID; | ||
94 | public LLUUID LastOwnerID; | ||
95 | |||
99 | // TODO: This needs to be persisted in next XML version update! | 96 | // TODO: This needs to be persisted in next XML version update! |
100 | [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2}; | ||
101 | [XmlIgnore] private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); | ||
102 | [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0; | ||
103 | [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; | 97 | [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; |
98 | [XmlIgnore] public scriptEvents m_aggregateScriptEvents = 0; | ||
104 | 99 | ||
105 | 100 | ||
106 | [XmlIgnore] public bool m_IsAttachment = false; | ||
107 | [XmlIgnore] public uint m_attachmentPoint = (byte)0; | ||
108 | [XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero; | 101 | [XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero; |
109 | [XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero; | 102 | [XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero; |
110 | [XmlIgnore] public LLUUID fromAssetID = LLUUID.Zero; | 103 | [XmlIgnore] public uint m_attachmentPoint = 0; |
111 | 104 | [XmlIgnore] public bool m_IsAttachment; | |
112 | [XmlIgnore] public bool m_undoing = false; | ||
113 | |||
114 | public Int32 CreationDate; | ||
115 | public uint ParentID = 0; | ||
116 | 105 | ||
117 | private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero; | 106 | private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero; |
118 | private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); | 107 | protected SceneObjectGroup m_parentGroup; |
119 | private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
120 | public LLUUID m_sitTargetAvatar = LLUUID.Zero; | ||
121 | [XmlIgnore] public PhysicsVector m_rotationAxis = new PhysicsVector(1f,1f,1f); | ||
122 | |||
123 | #region Permissions | ||
124 | |||
125 | public uint BaseMask = (uint)PermissionMask.All; | ||
126 | public uint OwnerMask = (uint)PermissionMask.All; | ||
127 | public uint GroupMask = (uint)PermissionMask.None; | ||
128 | public uint EveryoneMask = (uint)PermissionMask.None; | ||
129 | public uint NextOwnerMask = (uint)PermissionMask.All; | ||
130 | |||
131 | private UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | ||
132 | |||
133 | public LLObject.ObjectFlags Flags = LLObject.ObjectFlags.None; | ||
134 | |||
135 | public uint ObjectFlags | ||
136 | { | ||
137 | get { return (uint)Flags; } | ||
138 | set { Flags = (LLObject.ObjectFlags)value; } | ||
139 | } | ||
140 | |||
141 | #endregion | ||
142 | 108 | ||
143 | protected byte[] m_particleSystem = new byte[0]; | 109 | protected byte[] m_particleSystem = new byte[0]; |
144 | 110 | [XmlIgnore] public PhysicsVector m_rotationAxis = new PhysicsVector(1f, 1f, 1f); | |
145 | [XmlIgnore] public uint TimeStampFull = 0; | 111 | [XmlIgnore] private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); |
146 | [XmlIgnore] public uint TimeStampTerse = 0; | 112 | public LLUUID m_sitTargetAvatar = LLUUID.Zero; |
147 | [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn | 113 | private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); |
114 | private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); | ||
115 | [XmlIgnore] public bool m_undoing; | ||
148 | 116 | ||
149 | /// <summary> | 117 | /// <summary> |
150 | /// Only used internally to schedule client updates. | 118 | /// Only used internally to schedule client updates. |
@@ -156,24 +124,44 @@ namespace OpenSim.Region.Environment.Scenes | |||
156 | /// </summary> | 124 | /// </summary> |
157 | private byte m_updateFlag; | 125 | private byte m_updateFlag; |
158 | 126 | ||
159 | #region Properties | 127 | public byte ObjectSaleType; |
160 | 128 | public LLUUID OwnerID; | |
161 | public LLUUID CreatorID; | 129 | public int OwnershipCost; |
130 | public uint ParentID; | ||
131 | [XmlIgnore] public int[] PayPrice = {-2, -2, -2, -2, -2}; | ||
132 | [XmlIgnore] public PhysicsActor PhysActor; | ||
133 | public int SalePrice; | ||
162 | 134 | ||
163 | public LLUUID ObjectCreator | 135 | [XmlIgnore] public uint TimeStampFull; |
164 | { | 136 | [XmlIgnore] public uint TimeStampLastActivity; // Will be used for AutoReturn |
165 | get { return CreatorID; } | 137 | [XmlIgnore] public uint TimeStampTerse; |
166 | } | ||
167 | 138 | ||
168 | protected LLUUID m_uuid; | 139 | #region Properties |
169 | 140 | ||
170 | public LLUUID UUID | 141 | public LLUUID CreatorID; |
171 | { | 142 | protected LLVector3 m_acceleration; |
172 | get { return m_uuid; } | 143 | protected LLVector3 m_angularVelocity; |
173 | set { m_uuid = value; } | 144 | private byte m_clickAction; |
174 | } | 145 | private Color m_color = Color.Black; |
146 | private string m_description = String.Empty; | ||
147 | protected LLVector3 m_groupPosition; | ||
148 | private int m_linkNum; | ||
175 | 149 | ||
176 | protected uint m_localId; | 150 | protected uint m_localId; |
151 | protected LLObject.MaterialType m_material = 0; | ||
152 | |||
153 | protected string m_name; | ||
154 | protected LLVector3 m_offsetPosition; | ||
155 | protected ulong m_regionHandle; | ||
156 | protected LLVector3 m_rotationalvelocity; | ||
157 | protected LLQuaternion m_rotationOffset; | ||
158 | protected PrimitiveBaseShape m_shape; | ||
159 | private string m_sitName = String.Empty; | ||
160 | private string m_text = String.Empty; | ||
161 | private byte[] m_TextureAnimation; | ||
162 | private string m_touchName = String.Empty; | ||
163 | protected LLUUID m_uuid; | ||
164 | protected LLVector3 m_velocity; | ||
177 | 165 | ||
178 | public uint LocalId | 166 | public uint LocalId |
179 | { | 167 | { |
@@ -181,145 +169,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
181 | set { m_localId = value; } | 169 | set { m_localId = value; } |
182 | } | 170 | } |
183 | 171 | ||
184 | protected string m_name; | 172 | public scriptEvents ScriptEvents |
185 | |||
186 | public virtual string Name | ||
187 | { | 173 | { |
188 | get { return m_name; } | 174 | get { return m_aggregateScriptEvents; } |
189 | set { m_name = value; } | ||
190 | } | 175 | } |
191 | 176 | ||
192 | public scriptEvents ScriptEvents | ||
193 | { | ||
194 | get { return m_aggregateScriptEvents; } | ||
195 | } | ||
196 | |||
197 | protected LLObject.MaterialType m_material = 0; | ||
198 | |||
199 | public byte Material | 177 | public byte Material |
200 | { | 178 | { |
201 | get { return (byte) m_material; } | 179 | get { return (byte) m_material; } |
202 | set { m_material = (LLObject.MaterialType) value; } | 180 | set { m_material = (LLObject.MaterialType) value; } |
203 | } | 181 | } |
204 | 182 | ||
205 | protected ulong m_regionHandle; | ||
206 | |||
207 | public ulong RegionHandle | 183 | public ulong RegionHandle |
208 | { | 184 | { |
209 | get { return m_regionHandle; } | 185 | get { return m_regionHandle; } |
210 | set { m_regionHandle = value; } | 186 | set { m_regionHandle = value; } |
211 | } | 187 | } |
212 | 188 | ||
213 | public uint GetEffectiveObjectFlags() | ||
214 | { | ||
215 | LLObject.ObjectFlags f=Flags; | ||
216 | if(m_parentGroup == null || m_parentGroup.RootPart == this) | ||
217 | f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); | ||
218 | |||
219 | return (uint)Flags | (uint)LocalFlags; | ||
220 | } | ||
221 | |||
222 | //unkown if this will be kept, added as a way of removing the group position from the group class | ||
223 | protected LLVector3 m_groupPosition; | ||
224 | |||
225 | /// <summary> | ||
226 | /// Method for a prim to get it's world position from the group. | ||
227 | /// Remember, the Group Position simply gives the position of the group itself | ||
228 | /// </summary> | ||
229 | /// <returns>A Linked Child Prim objects position in world</returns> | ||
230 | public LLVector3 GetWorldPosition() | ||
231 | { | ||
232 | |||
233 | Quaternion parentRot = new Quaternion( | ||
234 | ParentGroup.RootPart.RotationOffset.W, | ||
235 | ParentGroup.RootPart.RotationOffset.X, | ||
236 | ParentGroup.RootPart.RotationOffset.Y, | ||
237 | ParentGroup.RootPart.RotationOffset.Z); | ||
238 | |||
239 | Vector3 axPos | ||
240 | = new Vector3( | ||
241 | OffsetPosition.X, | ||
242 | OffsetPosition.Y, | ||
243 | OffsetPosition.Z); | ||
244 | |||
245 | axPos = parentRot * axPos; | ||
246 | LLVector3 translationOffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | ||
247 | return GroupPosition + translationOffsetPosition; | ||
248 | |||
249 | //return (new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z) + AbsolutePosition); | ||
250 | } | ||
251 | |||
252 | /// <summary> | ||
253 | /// Gets the rotation of this prim offset by the group rotation | ||
254 | /// </summary> | ||
255 | /// <returns></returns> | ||
256 | public LLQuaternion GetWorldRotation() | ||
257 | { | ||
258 | |||
259 | Quaternion newRot; | ||
260 | |||
261 | if (this.LinkNum == 0) | ||
262 | { | ||
263 | newRot = new Quaternion(RotationOffset.W,RotationOffset.X,RotationOffset.Y,RotationOffset.Z); | ||
264 | |||
265 | } | ||
266 | else | ||
267 | { | ||
268 | Quaternion parentRot = new Quaternion( | ||
269 | ParentGroup.RootPart.RotationOffset.W, | ||
270 | ParentGroup.RootPart.RotationOffset.X, | ||
271 | ParentGroup.RootPart.RotationOffset.Y, | ||
272 | ParentGroup.RootPart.RotationOffset.Z); | ||
273 | |||
274 | Quaternion oldRot | ||
275 | = new Quaternion( | ||
276 | RotationOffset.W, | ||
277 | RotationOffset.X, | ||
278 | RotationOffset.Y, | ||
279 | RotationOffset.Z); | ||
280 | |||
281 | newRot = parentRot * oldRot; | ||
282 | } | ||
283 | return new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | ||
284 | |||
285 | //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); | ||
286 | |||
287 | } | ||
288 | |||
289 | public void StoreUndoState() | ||
290 | { | ||
291 | if (!m_undoing) | ||
292 | { | ||
293 | if (m_parentGroup != null) | ||
294 | { | ||
295 | if (m_undo.Count > 0) | ||
296 | { | ||
297 | UndoState last = m_undo.Peek(); | ||
298 | if (last != null) | ||
299 | { | ||
300 | if (last.Compare(this)) | ||
301 | return; | ||
302 | } | ||
303 | } | ||
304 | |||
305 | |||
306 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
307 | { | ||
308 | UndoState nUndo = new UndoState(this); | ||
309 | |||
310 | m_undo.Push(nUndo); | ||
311 | |||
312 | } | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | public void ClearUndoState() | ||
318 | { | ||
319 | m_undo.Clear(); | ||
320 | StoreUndoState(); | ||
321 | } | ||
322 | |||
323 | public LLVector3 GroupPosition | 189 | public LLVector3 GroupPosition |
324 | { | 190 | { |
325 | get | 191 | get |
@@ -352,16 +218,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
352 | { | 218 | { |
353 | try | 219 | try |
354 | { | 220 | { |
355 | |||
356 | // Root prim actually goes at Position | 221 | // Root prim actually goes at Position |
357 | if (ParentID == 0) | 222 | if (ParentID == 0) |
358 | { | 223 | { |
359 | PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); | 224 | PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); |
360 | |||
361 | } | 225 | } |
362 | else | 226 | else |
363 | { | 227 | { |
364 | |||
365 | // To move the child prim in respect to the group position and rotation we have to calculate | 228 | // To move the child prim in respect to the group position and rotation we have to calculate |
366 | 229 | ||
367 | LLVector3 resultingposition = GetWorldPosition(); | 230 | LLVector3 resultingposition = GetWorldPosition(); |
@@ -369,7 +232,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
369 | LLQuaternion resultingrot = GetWorldRotation(); | 232 | LLQuaternion resultingrot = GetWorldRotation(); |
370 | PhysActor.Orientation = new Quaternion(resultingrot.W, resultingrot.X, resultingrot.Y, resultingrot.Z); | 233 | PhysActor.Orientation = new Quaternion(resultingrot.W, resultingrot.X, resultingrot.Y, resultingrot.Z); |
371 | } | 234 | } |
372 | 235 | ||
373 | // Tell the physics engines that this prim changed. | 236 | // Tell the physics engines that this prim changed. |
374 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 237 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
375 | } | 238 | } |
@@ -378,14 +241,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
378 | Console.WriteLine(e.Message); | 241 | Console.WriteLine(e.Message); |
379 | } | 242 | } |
380 | } | 243 | } |
381 | |||
382 | } | 244 | } |
383 | } | 245 | } |
384 | 246 | ||
385 | private byte[] m_TextureAnimation; | ||
386 | |||
387 | protected LLVector3 m_offsetPosition; | ||
388 | |||
389 | public LLVector3 OffsetPosition | 247 | public LLVector3 OffsetPosition |
390 | { | 248 | { |
391 | get { return m_offsetPosition; } | 249 | get { return m_offsetPosition; } |
@@ -393,31 +251,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
393 | { | 251 | { |
394 | StoreUndoState(); | 252 | StoreUndoState(); |
395 | m_offsetPosition = value; | 253 | m_offsetPosition = value; |
396 | try | 254 | try |
397 | { | 255 | { |
398 | // Hack to get the child prim to update world positions in the physics engine | 256 | // Hack to get the child prim to update world positions in the physics engine |
399 | ParentGroup.ResetChildPrimPhysicsPositions(); | 257 | ParentGroup.ResetChildPrimPhysicsPositions(); |
400 | 258 | } | |
401 | } | 259 | catch (NullReferenceException) |
402 | catch (NullReferenceException) | 260 | { |
403 | { | 261 | // Ignore, and skip over. |
404 | // Ignore, and skip over. | 262 | } |
405 | } | 263 | //m_log.Info("[PART]: OFFSET:" + m_offsetPosition.ToString()); |
406 | //m_log.Info("[PART]: OFFSET:" + m_offsetPosition.ToString()); | ||
407 | } | 264 | } |
408 | } | 265 | } |
409 | 266 | ||
410 | public LLVector3 AbsolutePosition | ||
411 | { | ||
412 | get { | ||
413 | if (m_IsAttachment) | ||
414 | return GroupPosition; | ||
415 | |||
416 | return m_offsetPosition + m_groupPosition; } | ||
417 | } | ||
418 | |||
419 | protected LLQuaternion m_rotationOffset; | ||
420 | |||
421 | public LLQuaternion RotationOffset | 267 | public LLQuaternion RotationOffset |
422 | { | 268 | { |
423 | get | 269 | get |
@@ -466,13 +312,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
466 | Console.WriteLine(ex.Message); | 312 | Console.WriteLine(ex.Message); |
467 | } | 313 | } |
468 | } | 314 | } |
469 | |||
470 | } | 315 | } |
471 | } | 316 | } |
472 | 317 | ||
473 | protected LLVector3 m_velocity; | ||
474 | protected LLVector3 m_rotationalvelocity; | ||
475 | |||
476 | /// <summary></summary> | 318 | /// <summary></summary> |
477 | public LLVector3 Velocity | 319 | public LLVector3 Velocity |
478 | { | 320 | { |
@@ -493,8 +335,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
493 | 335 | ||
494 | return m_velocity; | 336 | return m_velocity; |
495 | } | 337 | } |
496 | set { | 338 | set |
497 | 339 | { | |
498 | m_velocity = value; | 340 | m_velocity = value; |
499 | if (PhysActor != null) | 341 | if (PhysActor != null) |
500 | { | 342 | { |
@@ -504,7 +346,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
504 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 346 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
505 | } | 347 | } |
506 | } | 348 | } |
507 | |||
508 | } | 349 | } |
509 | } | 350 | } |
510 | 351 | ||
@@ -519,7 +360,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
519 | { | 360 | { |
520 | if (PhysActor.IsPhysical) | 361 | if (PhysActor.IsPhysical) |
521 | { | 362 | { |
522 | m_rotationalvelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(),0); | 363 | m_rotationalvelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0); |
523 | } | 364 | } |
524 | } | 365 | } |
525 | 366 | ||
@@ -529,8 +370,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
529 | } | 370 | } |
530 | 371 | ||
531 | 372 | ||
532 | protected LLVector3 m_angularVelocity; | ||
533 | |||
534 | /// <summary></summary> | 373 | /// <summary></summary> |
535 | public LLVector3 AngularVelocity | 374 | public LLVector3 AngularVelocity |
536 | { | 375 | { |
@@ -538,8 +377,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
538 | set { m_angularVelocity = value; } | 377 | set { m_angularVelocity = value; } |
539 | } | 378 | } |
540 | 379 | ||
541 | protected LLVector3 m_acceleration; | ||
542 | |||
543 | /// <summary></summary> | 380 | /// <summary></summary> |
544 | public LLVector3 Acceleration | 381 | public LLVector3 Acceleration |
545 | { | 382 | { |
@@ -547,16 +384,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
547 | set { m_acceleration = value; } | 384 | set { m_acceleration = value; } |
548 | } | 385 | } |
549 | 386 | ||
550 | private string m_description = String.Empty; | ||
551 | |||
552 | public string Description | ||
553 | { | ||
554 | get { return m_description; } | ||
555 | set { m_description = value; } | ||
556 | } | ||
557 | |||
558 | private Color m_color = Color.Black; | ||
559 | |||
560 | public Color Color | 387 | public Color Color |
561 | { | 388 | { |
562 | get { return m_color; } | 389 | get { return m_color; } |
@@ -564,7 +391,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
564 | { | 391 | { |
565 | m_color = value; | 392 | m_color = value; |
566 | TriggerScriptChangedEvent(Changed.COLOR); | 393 | TriggerScriptChangedEvent(Changed.COLOR); |
567 | 394 | ||
568 | /* ScheduleFullUpdate() need not be called b/c after | 395 | /* ScheduleFullUpdate() need not be called b/c after |
569 | * setting the color, the text will be set, so then | 396 | * setting the color, the text will be set, so then |
570 | * ScheduleFullUpdate() will be called. */ | 397 | * ScheduleFullUpdate() will be called. */ |
@@ -572,8 +399,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
572 | } | 399 | } |
573 | } | 400 | } |
574 | 401 | ||
575 | private string m_text = String.Empty; | ||
576 | |||
577 | public Vector3 SitTargetPosition | 402 | public Vector3 SitTargetPosition |
578 | { | 403 | { |
579 | get { return m_sitTargetPosition; } | 404 | get { return m_sitTargetPosition; } |
@@ -587,13 +412,93 @@ namespace OpenSim.Region.Environment.Scenes | |||
587 | public string Text | 412 | public string Text |
588 | { | 413 | { |
589 | get { return m_text; } | 414 | get { return m_text; } |
415 | set { m_text = value; } | ||
416 | } | ||
417 | |||
418 | public int LinkNum | ||
419 | { | ||
420 | get { return m_linkNum; } | ||
590 | set | 421 | set |
591 | { | 422 | { |
592 | m_text = value; | 423 | m_linkNum = value; |
424 | TriggerScriptChangedEvent(Changed.LINK); | ||
593 | } | 425 | } |
594 | } | 426 | } |
595 | 427 | ||
596 | private string m_sitName = String.Empty; | 428 | public byte ClickAction |
429 | { | ||
430 | get { return m_clickAction; } | ||
431 | set { m_clickAction = value; } | ||
432 | } | ||
433 | |||
434 | public PrimitiveBaseShape Shape | ||
435 | { | ||
436 | get { return m_shape; } | ||
437 | set | ||
438 | { | ||
439 | m_shape = value; | ||
440 | TriggerScriptChangedEvent(Changed.SHAPE); | ||
441 | } | ||
442 | } | ||
443 | |||
444 | public LLVector3 Scale | ||
445 | { | ||
446 | get { return m_shape.Scale; } | ||
447 | set | ||
448 | { | ||
449 | StoreUndoState(); | ||
450 | m_shape.Scale = value; | ||
451 | TriggerScriptChangedEvent(Changed.SCALE); | ||
452 | } | ||
453 | } | ||
454 | |||
455 | public bool Stopped | ||
456 | { | ||
457 | get | ||
458 | { | ||
459 | double threshold = 0.02; | ||
460 | return (Math.Abs(Velocity.X) < threshold && | ||
461 | Math.Abs(Velocity.Y) < threshold && | ||
462 | Math.Abs(Velocity.Z) < threshold && | ||
463 | Math.Abs(AngularVelocity.X) < threshold && | ||
464 | Math.Abs(AngularVelocity.Y) < threshold && | ||
465 | Math.Abs(AngularVelocity.Z) < threshold); | ||
466 | } | ||
467 | } | ||
468 | |||
469 | public LLUUID ObjectCreator | ||
470 | { | ||
471 | get { return CreatorID; } | ||
472 | } | ||
473 | |||
474 | public LLUUID UUID | ||
475 | { | ||
476 | get { return m_uuid; } | ||
477 | set { m_uuid = value; } | ||
478 | } | ||
479 | |||
480 | public virtual string Name | ||
481 | { | ||
482 | get { return m_name; } | ||
483 | set { m_name = value; } | ||
484 | } | ||
485 | |||
486 | public LLVector3 AbsolutePosition | ||
487 | { | ||
488 | get | ||
489 | { | ||
490 | if (m_IsAttachment) | ||
491 | return GroupPosition; | ||
492 | |||
493 | return m_offsetPosition + m_groupPosition; | ||
494 | } | ||
495 | } | ||
496 | |||
497 | public string Description | ||
498 | { | ||
499 | get { return m_description; } | ||
500 | set { m_description = value; } | ||
501 | } | ||
597 | 502 | ||
598 | public string SitName | 503 | public string SitName |
599 | { | 504 | { |
@@ -601,39 +506,113 @@ namespace OpenSim.Region.Environment.Scenes | |||
601 | set { m_sitName = value; } | 506 | set { m_sitName = value; } |
602 | } | 507 | } |
603 | 508 | ||
604 | private string m_touchName = String.Empty; | ||
605 | |||
606 | public string TouchName | 509 | public string TouchName |
607 | { | 510 | { |
608 | get { return m_touchName; } | 511 | get { return m_touchName; } |
609 | set { m_touchName = value; } | 512 | set { m_touchName = value; } |
610 | } | 513 | } |
611 | 514 | ||
612 | private int m_linkNum = 0; | 515 | public uint GetEffectiveObjectFlags() |
516 | { | ||
517 | LLObject.ObjectFlags f = Flags; | ||
518 | if (m_parentGroup == null || m_parentGroup.RootPart == this) | ||
519 | f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); | ||
613 | 520 | ||
614 | public int LinkNum | 521 | return (uint) Flags | (uint) LocalFlags; |
522 | } | ||
523 | |||
524 | /// <summary> | ||
525 | /// Method for a prim to get it's world position from the group. | ||
526 | /// Remember, the Group Position simply gives the position of the group itself | ||
527 | /// </summary> | ||
528 | /// <returns>A Linked Child Prim objects position in world</returns> | ||
529 | public LLVector3 GetWorldPosition() | ||
615 | { | 530 | { |
616 | get { return m_linkNum; } | 531 | Quaternion parentRot = new Quaternion( |
617 | set | 532 | ParentGroup.RootPart.RotationOffset.W, |
618 | { | 533 | ParentGroup.RootPart.RotationOffset.X, |
619 | m_linkNum = value; | 534 | ParentGroup.RootPart.RotationOffset.Y, |
620 | TriggerScriptChangedEvent(Changed.LINK); | 535 | ParentGroup.RootPart.RotationOffset.Z); |
621 | 536 | ||
622 | } | 537 | Vector3 axPos |
538 | = new Vector3( | ||
539 | OffsetPosition.X, | ||
540 | OffsetPosition.Y, | ||
541 | OffsetPosition.Z); | ||
542 | |||
543 | axPos = parentRot * axPos; | ||
544 | LLVector3 translationOffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | ||
545 | return GroupPosition + translationOffsetPosition; | ||
546 | |||
547 | //return (new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z) + AbsolutePosition); | ||
623 | } | 548 | } |
624 | 549 | ||
625 | private byte m_clickAction = 0; | 550 | /// <summary> |
551 | /// Gets the rotation of this prim offset by the group rotation | ||
552 | /// </summary> | ||
553 | /// <returns></returns> | ||
554 | public LLQuaternion GetWorldRotation() | ||
555 | { | ||
556 | Quaternion newRot; | ||
626 | 557 | ||
627 | public byte ClickAction | 558 | if (LinkNum == 0) |
559 | { | ||
560 | newRot = new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z); | ||
561 | } | ||
562 | else | ||
563 | { | ||
564 | Quaternion parentRot = new Quaternion( | ||
565 | ParentGroup.RootPart.RotationOffset.W, | ||
566 | ParentGroup.RootPart.RotationOffset.X, | ||
567 | ParentGroup.RootPart.RotationOffset.Y, | ||
568 | ParentGroup.RootPart.RotationOffset.Z); | ||
569 | |||
570 | Quaternion oldRot | ||
571 | = new Quaternion( | ||
572 | RotationOffset.W, | ||
573 | RotationOffset.X, | ||
574 | RotationOffset.Y, | ||
575 | RotationOffset.Z); | ||
576 | |||
577 | newRot = parentRot * oldRot; | ||
578 | } | ||
579 | return new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | ||
580 | |||
581 | //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); | ||
582 | } | ||
583 | |||
584 | public void StoreUndoState() | ||
628 | { | 585 | { |
629 | get { return m_clickAction; } | 586 | if (!m_undoing) |
630 | set | ||
631 | { | 587 | { |
632 | m_clickAction = value; | 588 | if (m_parentGroup != null) |
589 | { | ||
590 | if (m_undo.Count > 0) | ||
591 | { | ||
592 | UndoState last = m_undo.Peek(); | ||
593 | if (last != null) | ||
594 | { | ||
595 | if (last.Compare(this)) | ||
596 | return; | ||
597 | } | ||
598 | } | ||
599 | |||
600 | |||
601 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
602 | { | ||
603 | UndoState nUndo = new UndoState(this); | ||
604 | |||
605 | m_undo.Push(nUndo); | ||
606 | } | ||
607 | } | ||
633 | } | 608 | } |
634 | } | 609 | } |
635 | 610 | ||
636 | protected PrimitiveBaseShape m_shape; | 611 | public void ClearUndoState() |
612 | { | ||
613 | m_undo.Clear(); | ||
614 | StoreUndoState(); | ||
615 | } | ||
637 | 616 | ||
638 | /// <summary> | 617 | /// <summary> |
639 | /// hook to the physics scene to apply impulse | 618 | /// hook to the physics scene to apply impulse |
@@ -645,20 +624,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
645 | public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF) | 624 | public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF) |
646 | { | 625 | { |
647 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); | 626 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); |
648 | 627 | ||
649 | if (localGlobalTF) | 628 | if (localGlobalTF) |
650 | { | 629 | { |
651 | |||
652 | LLQuaternion grot = GetWorldRotation(); | 630 | LLQuaternion grot = GetWorldRotation(); |
653 | Quaternion AXgrot = new Quaternion(grot.W,grot.X,grot.Y,grot.Z); | 631 | Quaternion AXgrot = new Quaternion(grot.W, grot.X, grot.Y, grot.Z); |
654 | Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z); | 632 | Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z); |
655 | Vector3 newimpulse = AXgrot * AXimpulsei; | 633 | Vector3 newimpulse = AXgrot * AXimpulsei; |
656 | impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z); | 634 | impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z); |
657 | |||
658 | } | 635 | } |
659 | else | 636 | else |
660 | { | 637 | { |
661 | |||
662 | if (m_parentGroup != null) | 638 | if (m_parentGroup != null) |
663 | { | 639 | { |
664 | m_parentGroup.applyImpulse(impulse); | 640 | m_parentGroup.applyImpulse(impulse); |
@@ -676,7 +652,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
676 | { | 652 | { |
677 | StopMoveToTarget(); | 653 | StopMoveToTarget(); |
678 | } | 654 | } |
679 | |||
680 | } | 655 | } |
681 | 656 | ||
682 | public void StopMoveToTarget() | 657 | public void StopMoveToTarget() |
@@ -689,56 +664,48 @@ namespace OpenSim.Region.Environment.Scenes | |||
689 | if (m_parentGroup != null) | 664 | if (m_parentGroup != null) |
690 | { | 665 | { |
691 | if (m_parentGroup.Scene != null) | 666 | if (m_parentGroup.Scene != null) |
692 | m_parentGroup.Scene.TriggerObjectChanged(LocalId, (uint)val); | 667 | m_parentGroup.Scene.TriggerObjectChanged(LocalId, (uint) val); |
693 | } | 668 | } |
694 | |||
695 | } | 669 | } |
696 | 670 | ||
697 | public PrimitiveBaseShape Shape | 671 | #endregion |
672 | |||
673 | #region Permissions | ||
674 | |||
675 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | ||
676 | public uint BaseMask = (uint) PermissionMask.All; | ||
677 | public uint EveryoneMask = (uint) PermissionMask.None; | ||
678 | |||
679 | public LLObject.ObjectFlags Flags = LLObject.ObjectFlags.None; | ||
680 | public uint GroupMask = (uint) PermissionMask.None; | ||
681 | public uint NextOwnerMask = (uint) PermissionMask.All; | ||
682 | public uint OwnerMask = (uint) PermissionMask.All; | ||
683 | |||
684 | public uint ObjectFlags | ||
698 | { | 685 | { |
699 | get { return m_shape; } | 686 | get { return (uint) Flags; } |
700 | set | 687 | set { Flags = (LLObject.ObjectFlags) value; } |
701 | { | ||
702 | |||
703 | m_shape = value; | ||
704 | TriggerScriptChangedEvent(Changed.SHAPE); | ||
705 | } | ||
706 | } | 688 | } |
707 | 689 | ||
708 | public LLVector3 Scale | 690 | #endregion |
691 | |||
692 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | ||
709 | { | 693 | { |
710 | get { return m_shape.Scale; } | 694 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); |
711 | set | 695 | |
696 | if (info == null) | ||
712 | { | 697 | { |
713 | StoreUndoState(); | 698 | throw new ArgumentNullException("info"); |
714 | m_shape.Scale = value; | ||
715 | TriggerScriptChangedEvent(Changed.SCALE); | ||
716 | } | 699 | } |
717 | } | ||
718 | 700 | ||
719 | public bool Stopped | 701 | /* |
720 | { | 702 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); |
721 | get { | 703 | m_ids = (List<LLUUID>)info.GetValue("m_ids", typeof(List<LLUUID>)); |
722 | double threshold = 0.02; | 704 | */ |
723 | return (Math.Abs(Velocity.X) < threshold && | ||
724 | Math.Abs(Velocity.Y) < threshold && | ||
725 | Math.Abs(Velocity.Z) < threshold && | ||
726 | Math.Abs(AngularVelocity.X) < threshold && | ||
727 | Math.Abs(AngularVelocity.Y) < threshold && | ||
728 | Math.Abs(AngularVelocity.Z) < threshold); | ||
729 | } | ||
730 | } | ||
731 | 705 | ||
732 | #endregion | 706 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); |
733 | |||
734 | public LLUUID ObjectOwner | ||
735 | { | ||
736 | get { return OwnerID; } | ||
737 | } | 707 | } |
738 | 708 | ||
739 | // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. | ||
740 | protected SceneObjectGroup m_parentGroup; | ||
741 | |||
742 | public SceneObjectGroup ParentGroup | 709 | public SceneObjectGroup ParentGroup |
743 | { | 710 | { |
744 | get { return m_parentGroup; } | 711 | get { return m_parentGroup; } |
@@ -758,7 +725,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
758 | public SceneObjectPart() | 725 | public SceneObjectPart() |
759 | { | 726 | { |
760 | // It's not necessary to persist this | 727 | // It's not necessary to persist this |
761 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; | 728 | m_inventoryFileName = "inventory_" + LLUUID.Random() + ".tmp"; |
762 | m_TextureAnimation = new byte[0]; | 729 | m_TextureAnimation = new byte[0]; |
763 | } | 730 | } |
764 | 731 | ||
@@ -790,13 +757,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
790 | CreatorID = OwnerID; | 757 | CreatorID = OwnerID; |
791 | LastOwnerID = LLUUID.Zero; | 758 | LastOwnerID = LLUUID.Zero; |
792 | UUID = LLUUID.Random(); | 759 | UUID = LLUUID.Random(); |
793 | LocalId = (uint) (localID); | 760 | LocalId = (localID); |
794 | Shape = shape; | 761 | Shape = shape; |
795 | // Todo: Add More Object Parameter from above! | 762 | // Todo: Add More Object Parameter from above! |
796 | OwnershipCost = 0; | 763 | OwnershipCost = 0; |
797 | ObjectSaleType = (byte) 0; | 764 | ObjectSaleType = 0; |
798 | SalePrice = 0; | 765 | SalePrice = 0; |
799 | Category = (uint) 0; | 766 | Category = 0; |
800 | LastOwnerID = CreatorID; | 767 | LastOwnerID = CreatorID; |
801 | // End Todo: /// | 768 | // End Todo: /// |
802 | GroupPosition = groupPosition; | 769 | GroupPosition = groupPosition; |
@@ -807,20 +774,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
807 | AngularVelocity = new LLVector3(0, 0, 0); | 774 | AngularVelocity = new LLVector3(0, 0, 0); |
808 | Acceleration = new LLVector3(0, 0, 0); | 775 | Acceleration = new LLVector3(0, 0, 0); |
809 | m_TextureAnimation = new byte[0]; | 776 | m_TextureAnimation = new byte[0]; |
810 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; | 777 | m_inventoryFileName = "inventory_" + LLUUID.Random() + ".tmp"; |
811 | 778 | ||
812 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, | 779 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, |
813 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 780 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
814 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | 781 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log |
815 | m_folderID = UUID; | 782 | m_folderID = UUID; |
816 | 783 | ||
817 | Flags = 0; | 784 | Flags = 0; |
818 | Flags |= LLObject.ObjectFlags.AllowInventoryDrop | | 785 | Flags |= LLObject.ObjectFlags.AllowInventoryDrop | |
819 | LLObject.ObjectFlags.CreateSelected; | 786 | LLObject.ObjectFlags.CreateSelected; |
820 | 787 | ||
821 | TrimPermissions(); | 788 | TrimPermissions(); |
822 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); | 789 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); |
823 | 790 | ||
824 | ScheduleFullUpdate(); | 791 | ScheduleFullUpdate(); |
825 | } | 792 | } |
826 | 793 | ||
@@ -846,29 +813,149 @@ namespace OpenSim.Region.Environment.Scenes | |||
846 | CreatorID = creatorID; | 813 | CreatorID = creatorID; |
847 | LastOwnerID = lastOwnerID; | 814 | LastOwnerID = lastOwnerID; |
848 | UUID = LLUUID.Random(); | 815 | UUID = LLUUID.Random(); |
849 | LocalId = (uint) (localID); | 816 | LocalId = (localID); |
850 | Shape = shape; | 817 | Shape = shape; |
851 | OwnershipCost = 0; | 818 | OwnershipCost = 0; |
852 | ObjectSaleType = (byte) 0; | 819 | ObjectSaleType = 0; |
853 | SalePrice = 0; | 820 | SalePrice = 0; |
854 | Category = (uint) 0; | 821 | Category = 0; |
855 | LastOwnerID = CreatorID; | 822 | LastOwnerID = CreatorID; |
856 | OffsetPosition = position; | 823 | OffsetPosition = position; |
857 | RotationOffset = rotation; | 824 | RotationOffset = rotation; |
858 | ObjectFlags = flags; | 825 | ObjectFlags = flags; |
859 | 826 | ||
860 | // Since we don't store script state, this is only a 'temporary' objectflag now | 827 | // Since we don't store script state, this is only a 'temporary' objectflag now |
861 | // If the object is scripted, the script will get loaded and this will be set again | 828 | // If the object is scripted, the script will get loaded and this will be set again |
862 | ObjectFlags &= ~(uint)(LLObject.ObjectFlags.Scripted | LLObject.ObjectFlags.Touch); | 829 | ObjectFlags &= ~(uint) (LLObject.ObjectFlags.Scripted | LLObject.ObjectFlags.Touch); |
863 | 830 | ||
864 | TrimPermissions(); | 831 | TrimPermissions(); |
865 | // ApplyPhysics(); | 832 | // ApplyPhysics(); |
866 | 833 | ||
867 | ScheduleFullUpdate(); | 834 | ScheduleFullUpdate(); |
868 | } | 835 | } |
869 | 836 | ||
870 | #endregion | 837 | #endregion |
871 | 838 | ||
839 | #region IScriptHost Members | ||
840 | |||
841 | public LLUUID ObjectOwner | ||
842 | { | ||
843 | get { return OwnerID; } | ||
844 | } | ||
845 | |||
846 | public void SetText(string text, Vector3 color, double alpha) | ||
847 | { | ||
848 | Color = Color.FromArgb(0xff - (int) (alpha * 0xff), | ||
849 | (int) (color.x * 0xff), | ||
850 | (int) (color.y * 0xff), | ||
851 | (int) (color.z * 0xff)); | ||
852 | SetText(text); | ||
853 | } | ||
854 | |||
855 | #endregion | ||
856 | |||
857 | #region ISerializable Members | ||
858 | |||
859 | [SecurityPermission(SecurityAction.LinkDemand, | ||
860 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
861 | public virtual void GetObjectData( | ||
862 | SerializationInfo info, StreamingContext context) | ||
863 | { | ||
864 | if (info == null) | ||
865 | { | ||
866 | throw new ArgumentNullException("info"); | ||
867 | } | ||
868 | |||
869 | info.AddValue("m_inventoryFileName", m_inventoryFileName); | ||
870 | info.AddValue("m_folderID", m_folderID.UUID); | ||
871 | info.AddValue("PhysActor", PhysActor); | ||
872 | |||
873 | Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); | ||
874 | |||
875 | foreach (LLUUID id in TaskInventory.Keys) | ||
876 | { | ||
877 | TaskInventory_work.Add(id.UUID, TaskInventory[id]); | ||
878 | } | ||
879 | |||
880 | info.AddValue("TaskInventory", TaskInventory_work); | ||
881 | |||
882 | info.AddValue("LastOwnerID", LastOwnerID.UUID); | ||
883 | info.AddValue("OwnerID", OwnerID.UUID); | ||
884 | info.AddValue("GroupID", GroupID.UUID); | ||
885 | |||
886 | info.AddValue("OwnershipCost", OwnershipCost); | ||
887 | info.AddValue("ObjectSaleType", ObjectSaleType); | ||
888 | info.AddValue("SalePrice", SalePrice); | ||
889 | info.AddValue("Category", Category); | ||
890 | |||
891 | info.AddValue("CreationDate", CreationDate); | ||
892 | info.AddValue("ParentID", ParentID); | ||
893 | |||
894 | info.AddValue("OwnerMask", OwnerMask); | ||
895 | info.AddValue("NextOwnerMask", NextOwnerMask); | ||
896 | info.AddValue("GroupMask", GroupMask); | ||
897 | info.AddValue("EveryoneMask", EveryoneMask); | ||
898 | info.AddValue("BaseMask", BaseMask); | ||
899 | |||
900 | info.AddValue("m_particleSystem", m_particleSystem); | ||
901 | |||
902 | info.AddValue("TimeStampFull", TimeStampFull); | ||
903 | info.AddValue("TimeStampTerse", TimeStampTerse); | ||
904 | info.AddValue("TimeStampLastActivity", TimeStampLastActivity); | ||
905 | |||
906 | info.AddValue("m_updateFlag", m_updateFlag); | ||
907 | info.AddValue("CreatorID", CreatorID.UUID); | ||
908 | |||
909 | info.AddValue("m_inventorySerial", m_inventorySerial); | ||
910 | info.AddValue("m_uuid", m_uuid.UUID); | ||
911 | info.AddValue("m_localID", m_localId); | ||
912 | info.AddValue("m_name", m_name); | ||
913 | info.AddValue("m_flags", Flags); | ||
914 | info.AddValue("m_material", m_material); | ||
915 | info.AddValue("m_regionHandle", m_regionHandle); | ||
916 | |||
917 | info.AddValue("m_groupPosition.X", m_groupPosition.X); | ||
918 | info.AddValue("m_groupPosition.Y", m_groupPosition.Y); | ||
919 | info.AddValue("m_groupPosition.Z", m_groupPosition.Z); | ||
920 | |||
921 | info.AddValue("m_offsetPosition.X", m_offsetPosition.X); | ||
922 | info.AddValue("m_offsetPosition.Y", m_offsetPosition.Y); | ||
923 | info.AddValue("m_offsetPosition.Z", m_offsetPosition.Z); | ||
924 | |||
925 | info.AddValue("m_rotationOffset.W", m_rotationOffset.W); | ||
926 | info.AddValue("m_rotationOffset.X", m_rotationOffset.X); | ||
927 | info.AddValue("m_rotationOffset.Y", m_rotationOffset.Y); | ||
928 | info.AddValue("m_rotationOffset.Z", m_rotationOffset.Z); | ||
929 | |||
930 | info.AddValue("m_velocity.X", m_velocity.X); | ||
931 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
932 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
933 | |||
934 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
935 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
936 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
937 | |||
938 | info.AddValue("m_angularVelocity.X", m_angularVelocity.X); | ||
939 | info.AddValue("m_angularVelocity.Y", m_angularVelocity.Y); | ||
940 | info.AddValue("m_angularVelocity.Z", m_angularVelocity.Z); | ||
941 | |||
942 | info.AddValue("m_acceleration.X", m_acceleration.X); | ||
943 | info.AddValue("m_acceleration.Y", m_acceleration.Y); | ||
944 | info.AddValue("m_acceleration.Z", m_acceleration.Z); | ||
945 | |||
946 | info.AddValue("m_description", m_description); | ||
947 | info.AddValue("m_color", m_color); | ||
948 | info.AddValue("m_text", m_text); | ||
949 | info.AddValue("m_sitName", m_sitName); | ||
950 | info.AddValue("m_touchName", m_touchName); | ||
951 | info.AddValue("m_clickAction", m_clickAction); | ||
952 | info.AddValue("m_shape", m_shape); | ||
953 | info.AddValue("m_parentGroup", m_parentGroup); | ||
954 | info.AddValue("PayPrice", PayPrice); | ||
955 | } | ||
956 | |||
957 | #endregion | ||
958 | |||
872 | /// <summary> | 959 | /// <summary> |
873 | /// Restore this part from the serialized xml representation. | 960 | /// Restore this part from the serialized xml representation. |
874 | /// </summary> | 961 | /// </summary> |
@@ -881,10 +968,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
881 | 968 | ||
882 | return newobject; | 969 | return newobject; |
883 | } | 970 | } |
884 | 971 | ||
885 | public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) | 972 | public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) |
886 | { | 973 | { |
887 | |||
888 | bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); | 974 | bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); |
889 | bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); | 975 | bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); |
890 | 976 | ||
@@ -902,7 +988,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
902 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), | 988 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), |
903 | new Quaternion(RotationOffset.W, RotationOffset.X, | 989 | new Quaternion(RotationOffset.W, RotationOffset.X, |
904 | RotationOffset.Y, RotationOffset.Z), RigidBody); | 990 | RotationOffset.Y, RotationOffset.Z), RigidBody); |
905 | 991 | ||
906 | // Basic Physics returns null.. joy joy joy. | 992 | // Basic Physics returns null.. joy joy joy. |
907 | if (PhysActor != null) | 993 | if (PhysActor != null) |
908 | { | 994 | { |
@@ -918,18 +1004,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
918 | OwnerMask = NextOwnerMask; | 1004 | OwnerMask = NextOwnerMask; |
919 | 1005 | ||
920 | TriggerScriptChangedEvent(Changed.OWNER); | 1006 | TriggerScriptChangedEvent(Changed.OWNER); |
921 | |||
922 | } | 1007 | } |
923 | 1008 | ||
924 | public void TrimPermissions() | 1009 | public void TrimPermissions() |
925 | { | 1010 | { |
926 | 1011 | BaseMask &= (uint) PermissionMask.All; | |
927 | BaseMask &= (uint)PermissionMask.All; | 1012 | OwnerMask &= (uint) PermissionMask.All; |
928 | OwnerMask &= (uint)PermissionMask.All; | 1013 | GroupMask &= (uint) PermissionMask.All; |
929 | GroupMask &= (uint)PermissionMask.All; | 1014 | EveryoneMask &= (uint) PermissionMask.All; |
930 | EveryoneMask &= (uint)PermissionMask.All; | 1015 | NextOwnerMask &= (uint) PermissionMask.All; |
931 | NextOwnerMask &= (uint)PermissionMask.All; | ||
932 | |||
933 | } | 1016 | } |
934 | 1017 | ||
935 | /// <summary> | 1018 | /// <summary> |
@@ -963,25 +1046,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
963 | Vector3 rOrigin = iray.Origin; | 1046 | Vector3 rOrigin = iray.Origin; |
964 | Vector3 rDirection = iray.Direction; | 1047 | Vector3 rDirection = iray.Direction; |
965 | 1048 | ||
966 | |||
967 | 1049 | ||
968 | //rDirection = rDirection.Normalize(); | 1050 | //rDirection = rDirection.Normalize(); |
969 | // Buidling the first part of the Quadratic equation | 1051 | // Buidling the first part of the Quadratic equation |
970 | Vector3 r2ndDirection = rDirection*rDirection; | 1052 | Vector3 r2ndDirection = rDirection * rDirection; |
971 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; | 1053 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; |
972 | 1054 | ||
973 | // Buidling the second part of the Quadratic equation | 1055 | // Buidling the second part of the Quadratic equation |
974 | Vector3 tmVal2 = rOrigin - vAbsolutePosition; | 1056 | Vector3 tmVal2 = rOrigin - vAbsolutePosition; |
975 | Vector3 r2Direction = rDirection*2.0f; | 1057 | Vector3 r2Direction = rDirection * 2.0f; |
976 | Vector3 tmVal3 = r2Direction*tmVal2; | 1058 | Vector3 tmVal3 = r2Direction * tmVal2; |
977 | 1059 | ||
978 | float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z; | 1060 | float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z; |
979 | 1061 | ||
980 | // Buidling the third part of the Quadratic equation | 1062 | // Buidling the third part of the Quadratic equation |
981 | Vector3 tmVal4 = rOrigin*rOrigin; | 1063 | Vector3 tmVal4 = rOrigin * rOrigin; |
982 | Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition; | 1064 | Vector3 tmVal5 = vAbsolutePosition * vAbsolutePosition; |
983 | 1065 | ||
984 | Vector3 tmVal6 = vAbsolutePosition*rOrigin; | 1066 | Vector3 tmVal6 = vAbsolutePosition * rOrigin; |
985 | 1067 | ||
986 | 1068 | ||
987 | // Set Radius to the largest dimention of the prim | 1069 | // Set Radius to the largest dimention of the prim |
@@ -1003,21 +1085,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
1003 | //radius = radius; | 1085 | //radius = radius; |
1004 | 1086 | ||
1005 | float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - | 1087 | float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - |
1006 | (2.0f*(tmVal6.x + tmVal6.y + tmVal6.z + (radius*radius))); | 1088 | (2.0f * (tmVal6.x + tmVal6.y + tmVal6.z + (radius * radius))); |
1007 | 1089 | ||
1008 | // Yuk Quadradrics.. Solve first | 1090 | // Yuk Quadradrics.. Solve first |
1009 | float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3); | 1091 | float rootsqr = (itestPart2 * itestPart2) - (4.0f * itestPart1 * itestPart3); |
1010 | if (rootsqr < 0.0f) | 1092 | if (rootsqr < 0.0f) |
1011 | { | 1093 | { |
1012 | // No intersection | 1094 | // No intersection |
1013 | return returnresult; | 1095 | return returnresult; |
1014 | } | 1096 | } |
1015 | float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); | 1097 | float root = ((-itestPart2) - (float) Math.Sqrt(rootsqr)) / (itestPart1 * 2.0f); |
1016 | 1098 | ||
1017 | if (root < 0.0f) | 1099 | if (root < 0.0f) |
1018 | { | 1100 | { |
1019 | // perform second quadratic root solution | 1101 | // perform second quadratic root solution |
1020 | root = ((-itestPart2) + (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); | 1102 | root = ((-itestPart2) + (float) Math.Sqrt(rootsqr)) / (itestPart1 * 2.0f); |
1021 | 1103 | ||
1022 | // is there any intersection? | 1104 | // is there any intersection? |
1023 | if (root < 0.0f) | 1105 | if (root < 0.0f) |
@@ -1030,8 +1112,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1030 | // We got an intersection. putting together an EntityIntersection object with the | 1112 | // We got an intersection. putting together an EntityIntersection object with the |
1031 | // intersection information | 1113 | // intersection information |
1032 | Vector3 ipoint = | 1114 | Vector3 ipoint = |
1033 | new Vector3(iray.Origin.x + (iray.Direction.x*root), iray.Origin.y + (iray.Direction.y*root), | 1115 | new Vector3(iray.Origin.x + (iray.Direction.x * root), iray.Origin.y + (iray.Direction.y * root), |
1034 | iray.Origin.z + (iray.Direction.z*root)); | 1116 | iray.Origin.z + (iray.Direction.z * root)); |
1035 | 1117 | ||
1036 | returnresult.HitTF = true; | 1118 | returnresult.HitTF = true; |
1037 | returnresult.ipoint = ipoint; | 1119 | returnresult.ipoint = ipoint; |
@@ -1092,7 +1174,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1092 | 1174 | ||
1093 | // Variables prefixed with AX are Axiom.Math copies of the LL variety. | 1175 | // Variables prefixed with AX are Axiom.Math copies of the LL variety. |
1094 | 1176 | ||
1095 | Quaternion AXrot = new Quaternion(rot.W,rot.X,rot.Y,rot.Z); | 1177 | Quaternion AXrot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); |
1096 | AXrot.Normalize(); | 1178 | AXrot.Normalize(); |
1097 | 1179 | ||
1098 | Vector3 AXpos = new Vector3(pos.X, pos.Y, pos.Z); | 1180 | Vector3 AXpos = new Vector3(pos.X, pos.Y, pos.Z); |
@@ -1101,31 +1183,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
1101 | // it's different for each vertex because we've got to rotate it | 1183 | // it's different for each vertex because we've got to rotate it |
1102 | // to get the world position of the vertex to produce the Oriented Bounding Box | 1184 | // to get the world position of the vertex to produce the Oriented Bounding Box |
1103 | 1185 | ||
1104 | Vector3 tScale = new Vector3(); | 1186 | Vector3 tScale = new Vector3(); |
1105 | 1187 | ||
1106 | Vector3 AXscale = new Vector3(m_shape.Scale.X * 0.5f, m_shape.Scale.Y * 0.5f, m_shape.Scale.Z * 0.5f); | 1188 | Vector3 AXscale = new Vector3(m_shape.Scale.X * 0.5f, m_shape.Scale.Y * 0.5f, m_shape.Scale.Z * 0.5f); |
1107 | 1189 | ||
1108 | //Vector3 pScale = (AXscale) - (AXrot.Inverse() * (AXscale)); | 1190 | //Vector3 pScale = (AXscale) - (AXrot.Inverse() * (AXscale)); |
1109 | //Vector3 nScale = (AXscale * -1) - (AXrot.Inverse() * (AXscale * -1)); | 1191 | //Vector3 nScale = (AXscale * -1) - (AXrot.Inverse() * (AXscale * -1)); |
1110 | 1192 | ||
1111 | // rScale is the rotated offset to find a vertex based on the scale and the world rotation. | 1193 | // rScale is the rotated offset to find a vertex based on the scale and the world rotation. |
1112 | Vector3 rScale = new Vector3(); | 1194 | Vector3 rScale = new Vector3(); |
1113 | 1195 | ||
1114 | // Get Vertexes for Faces Stick them into ABCD for each Face | 1196 | // Get Vertexes for Faces Stick them into ABCD for each Face |
1115 | // Form: Face<vertex>[face] that corresponds to the below diagram | 1197 | // Form: Face<vertex>[face] that corresponds to the below diagram |
1198 | |||
1116 | #region ABCD Face Vertex Map Comment Diagram | 1199 | #region ABCD Face Vertex Map Comment Diagram |
1200 | |||
1117 | // A _________ B | 1201 | // A _________ B |
1118 | // | | | 1202 | // | | |
1119 | // | 4 top | | 1203 | // | 4 top | |
1120 | // |_________| | 1204 | // |_________| |
1121 | // C D | 1205 | // C D |
1122 | 1206 | ||
1123 | // A _________ B | 1207 | // A _________ B |
1124 | // | Back | | 1208 | // | Back | |
1125 | // | 3 | | 1209 | // | 3 | |
1126 | // |_________| | 1210 | // |_________| |
1127 | // C D | 1211 | // C D |
1128 | 1212 | ||
1129 | // A _________ B B _________ A | 1213 | // A _________ B B _________ A |
1130 | // | Left | | Right | | 1214 | // | Left | | Right | |
1131 | // | 0 | | 2 | | 1215 | // | 0 | | 2 | |
@@ -1143,13 +1227,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1143 | // | 5 bot | | 1227 | // | 5 bot | |
1144 | // |_________| | 1228 | // |_________| |
1145 | // A B | 1229 | // A B |
1230 | |||
1146 | #endregion | 1231 | #endregion |
1147 | 1232 | ||
1148 | #region Plane Decomposition of Oriented Bounding Box | 1233 | #region Plane Decomposition of Oriented Bounding Box |
1234 | |||
1149 | tScale = new Vector3(AXscale.x, -AXscale.y, AXscale.z); | 1235 | tScale = new Vector3(AXscale.x, -AXscale.y, AXscale.z); |
1150 | rScale = ((AXrot * tScale)); | 1236 | rScale = ((AXrot * tScale)); |
1151 | vertexes[0] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1237 | vertexes[0] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1152 | // vertexes[0].x = pos.X + vertexes[0].x; | 1238 | // vertexes[0].x = pos.X + vertexes[0].x; |
1153 | //vertexes[0].y = pos.Y + vertexes[0].y; | 1239 | //vertexes[0].y = pos.Y + vertexes[0].y; |
1154 | //vertexes[0].z = pos.Z + vertexes[0].z; | 1240 | //vertexes[0].z = pos.Z + vertexes[0].z; |
1155 | 1241 | ||
@@ -1161,8 +1247,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1161 | rScale = ((AXrot * tScale)); | 1247 | rScale = ((AXrot * tScale)); |
1162 | vertexes[1] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1248 | vertexes[1] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1163 | 1249 | ||
1164 | // vertexes[1].x = pos.X + vertexes[1].x; | 1250 | // vertexes[1].x = pos.X + vertexes[1].x; |
1165 | // vertexes[1].y = pos.Y + vertexes[1].y; | 1251 | // vertexes[1].y = pos.Y + vertexes[1].y; |
1166 | //vertexes[1].z = pos.Z + vertexes[1].z; | 1252 | //vertexes[1].z = pos.Z + vertexes[1].z; |
1167 | 1253 | ||
1168 | FaceB[0] = vertexes[1]; | 1254 | FaceB[0] = vertexes[1]; |
@@ -1187,8 +1273,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1187 | vertexes[3] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1273 | vertexes[3] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1188 | 1274 | ||
1189 | //vertexes[3].x = pos.X + vertexes[3].x; | 1275 | //vertexes[3].x = pos.X + vertexes[3].x; |
1190 | // vertexes[3].y = pos.Y + vertexes[3].y; | 1276 | // vertexes[3].y = pos.Y + vertexes[3].y; |
1191 | // vertexes[3].z = pos.Z + vertexes[3].z; | 1277 | // vertexes[3].z = pos.Z + vertexes[3].z; |
1192 | 1278 | ||
1193 | FaceD[0] = vertexes[3]; | 1279 | FaceD[0] = vertexes[3]; |
1194 | FaceC[1] = vertexes[3]; | 1280 | FaceC[1] = vertexes[3]; |
@@ -1198,9 +1284,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1198 | rScale = ((AXrot * tScale)); | 1284 | rScale = ((AXrot * tScale)); |
1199 | vertexes[4] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1285 | vertexes[4] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1200 | 1286 | ||
1201 | // vertexes[4].x = pos.X + vertexes[4].x; | 1287 | // vertexes[4].x = pos.X + vertexes[4].x; |
1202 | // vertexes[4].y = pos.Y + vertexes[4].y; | 1288 | // vertexes[4].y = pos.Y + vertexes[4].y; |
1203 | // vertexes[4].z = pos.Z + vertexes[4].z; | 1289 | // vertexes[4].z = pos.Z + vertexes[4].z; |
1204 | 1290 | ||
1205 | FaceB[1] = vertexes[4]; | 1291 | FaceB[1] = vertexes[4]; |
1206 | FaceA[2] = vertexes[4]; | 1292 | FaceA[2] = vertexes[4]; |
@@ -1210,9 +1296,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1210 | rScale = ((AXrot * tScale)); | 1296 | rScale = ((AXrot * tScale)); |
1211 | vertexes[5] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1297 | vertexes[5] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1212 | 1298 | ||
1213 | // vertexes[5].x = pos.X + vertexes[5].x; | 1299 | // vertexes[5].x = pos.X + vertexes[5].x; |
1214 | // vertexes[5].y = pos.Y + vertexes[5].y; | 1300 | // vertexes[5].y = pos.Y + vertexes[5].y; |
1215 | // vertexes[5].z = pos.Z + vertexes[5].z; | 1301 | // vertexes[5].z = pos.Z + vertexes[5].z; |
1216 | 1302 | ||
1217 | FaceD[1] = vertexes[5]; | 1303 | FaceD[1] = vertexes[5]; |
1218 | FaceC[2] = vertexes[5]; | 1304 | FaceC[2] = vertexes[5]; |
@@ -1222,9 +1308,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1222 | rScale = ((AXrot * tScale)); | 1308 | rScale = ((AXrot * tScale)); |
1223 | vertexes[6] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1309 | vertexes[6] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1224 | 1310 | ||
1225 | // vertexes[6].x = pos.X + vertexes[6].x; | 1311 | // vertexes[6].x = pos.X + vertexes[6].x; |
1226 | // vertexes[6].y = pos.Y + vertexes[6].y; | 1312 | // vertexes[6].y = pos.Y + vertexes[6].y; |
1227 | // vertexes[6].z = pos.Z + vertexes[6].z; | 1313 | // vertexes[6].z = pos.Z + vertexes[6].z; |
1228 | 1314 | ||
1229 | FaceB[2] = vertexes[6]; | 1315 | FaceB[2] = vertexes[6]; |
1230 | FaceA[3] = vertexes[6]; | 1316 | FaceA[3] = vertexes[6]; |
@@ -1234,35 +1320,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
1234 | rScale = ((AXrot * tScale)); | 1320 | rScale = ((AXrot * tScale)); |
1235 | vertexes[7] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); | 1321 | vertexes[7] = (new Vector3((pos.X + rScale.x), (pos.Y + rScale.y), (pos.Z + rScale.z))); |
1236 | 1322 | ||
1237 | // vertexes[7].x = pos.X + vertexes[7].x; | 1323 | // vertexes[7].x = pos.X + vertexes[7].x; |
1238 | // vertexes[7].y = pos.Y + vertexes[7].y; | 1324 | // vertexes[7].y = pos.Y + vertexes[7].y; |
1239 | // vertexes[7].z = pos.Z + vertexes[7].z; | 1325 | // vertexes[7].z = pos.Z + vertexes[7].z; |
1240 | 1326 | ||
1241 | FaceD[2] = vertexes[7]; | 1327 | FaceD[2] = vertexes[7]; |
1242 | FaceC[3] = vertexes[7]; | 1328 | FaceC[3] = vertexes[7]; |
1243 | FaceD[5] = vertexes[7]; | 1329 | FaceD[5] = vertexes[7]; |
1330 | |||
1244 | #endregion | 1331 | #endregion |
1245 | 1332 | ||
1246 | // Get our plane normals | 1333 | // Get our plane normals |
1247 | for (int i = 0; i < 6; i++) | 1334 | for (int i = 0; i < 6; i++) |
1248 | { | 1335 | { |
1249 | //m_log.Info("[FACECALCULATION]: FaceA[" + i + "]=" + FaceA[i] + " FaceB[" + i + "]=" + FaceB[i] + " FaceC[" + i + "]=" + FaceC[i] + " FaceD[" + i + "]=" + FaceD[i]); | 1336 | //m_log.Info("[FACECALCULATION]: FaceA[" + i + "]=" + FaceA[i] + " FaceB[" + i + "]=" + FaceB[i] + " FaceC[" + i + "]=" + FaceC[i] + " FaceD[" + i + "]=" + FaceD[i]); |
1250 | 1337 | ||
1251 | // Our Plane direction | 1338 | // Our Plane direction |
1252 | AmBa = FaceA[i] - FaceB[i]; | 1339 | AmBa = FaceA[i] - FaceB[i]; |
1253 | AmBb = FaceB[i] - FaceC[i]; | 1340 | AmBb = FaceB[i] - FaceC[i]; |
1254 | 1341 | ||
1255 | cross = AmBb.Cross(AmBa); | 1342 | cross = AmBb.Cross(AmBa); |
1256 | 1343 | ||
1257 | // normalize the cross product to get the normal. | 1344 | // normalize the cross product to get the normal. |
1258 | normals[i] = cross / cross.Length; | 1345 | normals[i] = cross / cross.Length; |
1259 | 1346 | ||
1260 | //m_log.Info("[NORMALS]: normals[ " + i + "]" + normals[i].ToString()); | 1347 | //m_log.Info("[NORMALS]: normals[ " + i + "]" + normals[i].ToString()); |
1261 | //distance[i] = (normals[i].x * AmBa.x + normals[i].y * AmBa.y + normals[i].z * AmBa.z) * -1; | 1348 | //distance[i] = (normals[i].x * AmBa.x + normals[i].y * AmBa.y + normals[i].z * AmBa.z) * -1; |
1262 | } | 1349 | } |
1263 | 1350 | ||
1264 | EntityIntersection returnresult = new EntityIntersection(); | 1351 | EntityIntersection returnresult = new EntityIntersection(); |
1265 | 1352 | ||
1266 | returnresult.distance = 1024; | 1353 | returnresult.distance = 1024; |
1267 | float c = 0; | 1354 | float c = 0; |
1268 | float a = 0; | 1355 | float a = 0; |
@@ -1270,57 +1357,59 @@ namespace OpenSim.Region.Environment.Scenes | |||
1270 | Vector3 q = new Vector3(); | 1357 | Vector3 q = new Vector3(); |
1271 | 1358 | ||
1272 | #region OBB Version 2 Experiment | 1359 | #region OBB Version 2 Experiment |
1360 | |||
1273 | //float fmin = 999999; | 1361 | //float fmin = 999999; |
1274 | //float fmax = -999999; | 1362 | //float fmax = -999999; |
1275 | //float s = 0; | 1363 | //float s = 0; |
1276 | 1364 | ||
1277 | //for (int i=0;i<6;i++) | 1365 | //for (int i=0;i<6;i++) |
1278 | //{ | 1366 | //{ |
1279 | //s = iray.Direction.Dot(normals[i]); | 1367 | //s = iray.Direction.Dot(normals[i]); |
1280 | //d = normals[i].Dot(FaceB[i]); | 1368 | //d = normals[i].Dot(FaceB[i]); |
1281 | 1369 | ||
1282 | //if (s == 0) | 1370 | //if (s == 0) |
1283 | //{ | 1371 | //{ |
1284 | //if (iray.Origin.Dot(normals[i]) > d) | 1372 | //if (iray.Origin.Dot(normals[i]) > d) |
1285 | //{ | 1373 | //{ |
1286 | //return returnresult; | 1374 | //return returnresult; |
1287 | //} | 1375 | //} |
1288 | // else | 1376 | // else |
1289 | //{ | 1377 | //{ |
1290 | //continue; | 1378 | //continue; |
1291 | //} | 1379 | //} |
1292 | //} | 1380 | //} |
1293 | //a = (d - iray.Origin.Dot(normals[i])) / s; | 1381 | //a = (d - iray.Origin.Dot(normals[i])) / s; |
1294 | //if ( iray.Direction.Dot(normals[i]) < 0) | 1382 | //if ( iray.Direction.Dot(normals[i]) < 0) |
1295 | //{ | 1383 | //{ |
1296 | //if (a > fmax) | 1384 | //if (a > fmax) |
1297 | //{ | 1385 | //{ |
1298 | //if (a > fmin) | 1386 | //if (a > fmin) |
1299 | //{ | 1387 | //{ |
1300 | //return returnresult; | 1388 | //return returnresult; |
1301 | //} | 1389 | //} |
1302 | //fmax = a; | 1390 | //fmax = a; |
1303 | //} | 1391 | //} |
1304 | 1392 | ||
1305 | //} | 1393 | //} |
1306 | //else | 1394 | //else |
1307 | //{ | 1395 | //{ |
1308 | //if (a < fmin) | 1396 | //if (a < fmin) |
1309 | //{ | 1397 | //{ |
1310 | //if (a < 0 || a < fmax) | 1398 | //if (a < 0 || a < fmax) |
1311 | //{ | 1399 | //{ |
1312 | //return returnresult; | 1400 | //return returnresult; |
1313 | //} | 1401 | //} |
1314 | //fmin = a; | 1402 | //fmin = a; |
1315 | //} | 1403 | //} |
1316 | //} | 1404 | //} |
1317 | //} | 1405 | //} |
1318 | //if (fmax > 0) | 1406 | //if (fmax > 0) |
1319 | // a= fmax; | 1407 | // a= fmax; |
1320 | //else | 1408 | //else |
1321 | // a=fmin; | 1409 | // a=fmin; |
1322 | 1410 | ||
1323 | //q = iray.Origin + a * iray.Direction; | 1411 | //q = iray.Origin + a * iray.Direction; |
1412 | |||
1324 | #endregion | 1413 | #endregion |
1325 | 1414 | ||
1326 | // Loop over faces (6 of them) | 1415 | // Loop over faces (6 of them) |
@@ -1341,7 +1430,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1341 | // If the normal is pointing outside the object | 1430 | // If the normal is pointing outside the object |
1342 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) | 1431 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) |
1343 | { | 1432 | { |
1344 | |||
1345 | if (faceCenters) | 1433 | if (faceCenters) |
1346 | { | 1434 | { |
1347 | q = AXpos + a * AAfacenormals[i]; //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; | 1435 | q = AXpos + a * AAfacenormals[i]; //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; |
@@ -1351,13 +1439,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1351 | q = iray.Origin + a * iray.Direction; | 1439 | q = iray.Origin + a * iray.Direction; |
1352 | } | 1440 | } |
1353 | 1441 | ||
1354 | float distance2 = (float)GetDistanceTo(q, AXpos); | 1442 | float distance2 = (float) GetDistanceTo(q, AXpos); |
1355 | // Is this the closest hit to the object's origin? | 1443 | // Is this the closest hit to the object's origin? |
1356 | if (faceCenters) | 1444 | if (faceCenters) |
1357 | { | 1445 | { |
1358 | distance2 = (float)GetDistanceTo(q, iray.Origin); | 1446 | distance2 = (float) GetDistanceTo(q, iray.Origin); |
1359 | } | 1447 | } |
1360 | 1448 | ||
1361 | 1449 | ||
1362 | if (distance2 < returnresult.distance) | 1450 | if (distance2 < returnresult.distance) |
1363 | { | 1451 | { |
@@ -1368,14 +1456,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1368 | //m_log.Info("[POINT]: " + q.ToString()); | 1456 | //m_log.Info("[POINT]: " + q.ToString()); |
1369 | returnresult.normal = normals[i]; | 1457 | returnresult.normal = normals[i]; |
1370 | returnresult.AAfaceNormal = AAfacenormals[i]; | 1458 | returnresult.AAfaceNormal = AAfacenormals[i]; |
1371 | |||
1372 | } | 1459 | } |
1373 | } | 1460 | } |
1374 | |||
1375 | } | 1461 | } |
1376 | return returnresult; | 1462 | return returnresult; |
1377 | } | 1463 | } |
1378 | 1464 | ||
1379 | // Use this for attachments! LocalID should be avatar's localid | 1465 | // Use this for attachments! LocalID should be avatar's localid |
1380 | public void SetParentLocalId(uint localID) | 1466 | public void SetParentLocalId(uint localID) |
1381 | { | 1467 | { |
@@ -1385,14 +1471,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1385 | public void SetAttachmentPoint(uint AttachmentPoint) | 1471 | public void SetAttachmentPoint(uint AttachmentPoint) |
1386 | { | 1472 | { |
1387 | m_attachmentPoint = AttachmentPoint; | 1473 | m_attachmentPoint = AttachmentPoint; |
1388 | 1474 | ||
1389 | // save the attachment point. | 1475 | // save the attachment point. |
1390 | //if (AttachmentPoint != 0) | 1476 | //if (AttachmentPoint != 0) |
1391 | //{ | 1477 | //{ |
1392 | m_shape.State = (byte)AttachmentPoint; | 1478 | m_shape.State = (byte) AttachmentPoint; |
1393 | //} | 1479 | //} |
1394 | |||
1395 | } | 1480 | } |
1481 | |||
1396 | /// <summary> | 1482 | /// <summary> |
1397 | /// | 1483 | /// |
1398 | /// </summary> | 1484 | /// </summary> |
@@ -1414,13 +1500,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1414 | PhysActor.Buoyancy = fvalue; | 1500 | PhysActor.Buoyancy = fvalue; |
1415 | } | 1501 | } |
1416 | } | 1502 | } |
1417 | 1503 | ||
1418 | public void SetAxisRotation(int axis, int rotate) | 1504 | public void SetAxisRotation(int axis, int rotate) |
1419 | { | 1505 | { |
1420 | if (m_parentGroup != null) | 1506 | if (m_parentGroup != null) |
1421 | { | 1507 | { |
1422 | m_parentGroup.SetAxisRotation(axis, rotate); | 1508 | m_parentGroup.SetAxisRotation(axis, rotate); |
1423 | |||
1424 | } | 1509 | } |
1425 | } | 1510 | } |
1426 | 1511 | ||
@@ -1442,10 +1527,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1442 | { | 1527 | { |
1443 | PhysActor.FloatOnWater = false; | 1528 | PhysActor.FloatOnWater = false; |
1444 | } | 1529 | } |
1445 | |||
1446 | } | 1530 | } |
1447 | } | 1531 | } |
1448 | 1532 | ||
1449 | 1533 | ||
1450 | public LLVector3 GetSitTargetPositionLL() | 1534 | public LLVector3 GetSitTargetPositionLL() |
1451 | { | 1535 | { |
@@ -1516,66 +1600,403 @@ namespace OpenSim.Region.Environment.Scenes | |||
1516 | return part; | 1600 | return part; |
1517 | } | 1601 | } |
1518 | 1602 | ||
1519 | #region Copying | ||
1520 | |||
1521 | /// <summary> | 1603 | /// <summary> |
1522 | /// Duplicates this part. | 1604 | /// Reset LLUUIDs for this part. This involves generate this part's own LLUUID and |
1605 | /// generating new LLUUIDs for all the items in the inventory. | ||
1523 | /// </summary> | 1606 | /// </summary> |
1524 | /// <returns></returns> | 1607 | /// <param name="linkNum">Link number for the part</param> |
1525 | public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID, int linkNum) | 1608 | public void ResetIDs(int linkNum) |
1526 | { | 1609 | { |
1527 | SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone(); | 1610 | UUID = LLUUID.Random(); |
1528 | dupe.m_shape = m_shape.Copy(); | 1611 | LinkNum = linkNum; |
1529 | dupe.m_regionHandle = m_regionHandle; | ||
1530 | dupe.UUID = LLUUID.Random(); | ||
1531 | dupe.LocalId = localID; | ||
1532 | dupe.OwnerID = AgentID; | ||
1533 | dupe.GroupID = GroupID; | ||
1534 | dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); | ||
1535 | dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); | ||
1536 | dupe.RotationOffset = | ||
1537 | new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); | ||
1538 | dupe.Velocity = new LLVector3(0, 0, 0); | ||
1539 | dupe.Acceleration = new LLVector3(0, 0, 0); | ||
1540 | dupe.AngularVelocity = new LLVector3(0, 0, 0); | ||
1541 | dupe.ObjectFlags = ObjectFlags; | ||
1542 | 1612 | ||
1543 | dupe.OwnershipCost = OwnershipCost; | 1613 | ResetInventoryIDs(); |
1544 | dupe.ObjectSaleType = ObjectSaleType; | 1614 | } |
1545 | dupe.SalePrice = SalePrice; | ||
1546 | dupe.Category = Category; | ||
1547 | |||
1548 | dupe.TaskInventory = (TaskInventoryDictionary)dupe.TaskInventory.Clone(); | ||
1549 | |||
1550 | dupe.ResetIDs(linkNum); | ||
1551 | 1615 | ||
1552 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1616 | public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) |
1553 | dupe.LastOwnerID = ObjectOwner; | 1617 | { |
1618 | bool set = addRemTF == 1; | ||
1554 | 1619 | ||
1555 | byte[] extraP = new byte[Shape.ExtraParams.Length]; | 1620 | // Are we the owner? |
1556 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 1621 | if (AgentID == OwnerID) |
1557 | dupe.Shape.ExtraParams = extraP; | 1622 | { |
1558 | bool UsePhysics = ((dupe.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); | 1623 | switch (field) |
1559 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); | 1624 | { |
1625 | case 2: | ||
1626 | OwnerMask = ApplyMask(OwnerMask, set, mask); | ||
1627 | break; | ||
1628 | case 4: | ||
1629 | GroupMask = ApplyMask(GroupMask, set, mask); | ||
1630 | break; | ||
1631 | case 8: | ||
1632 | EveryoneMask = ApplyMask(EveryoneMask, set, mask); | ||
1633 | break; | ||
1634 | case 16: | ||
1635 | NextOwnerMask = ApplyMask(NextOwnerMask, set, mask); | ||
1636 | break; | ||
1637 | } | ||
1638 | SendFullUpdateToAllClients(); | ||
1560 | 1639 | ||
1561 | return dupe; | 1640 | SendObjectPropertiesToClient(AgentID); |
1641 | } | ||
1642 | } | ||
1643 | |||
1644 | private void SendObjectPropertiesToClient(LLUUID AgentID) | ||
1645 | { | ||
1646 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1647 | for (int i = 0; i < avatars.Count; i++) | ||
1648 | { | ||
1649 | // Ugly reference :( | ||
1650 | if (avatars[i].UUID == AgentID) | ||
1651 | { | ||
1652 | m_parentGroup.GetProperties(avatars[i].ControllingClient); | ||
1653 | } | ||
1654 | } | ||
1655 | } | ||
1656 | |||
1657 | private uint ApplyMask(uint val, bool set, uint mask) | ||
1658 | { | ||
1659 | if (set) | ||
1660 | { | ||
1661 | return val |= mask; | ||
1662 | } | ||
1663 | else | ||
1664 | { | ||
1665 | return val &= ~mask; | ||
1666 | } | ||
1667 | } | ||
1668 | |||
1669 | public virtual void UpdateMovement() | ||
1670 | { | ||
1671 | } | ||
1672 | |||
1673 | public void PhysicsOutOfBounds(PhysicsVector pos) | ||
1674 | { | ||
1675 | m_log.Info("[PHYSICS]: Physical Object went out of bounds."); | ||
1676 | RemFlag(LLObject.ObjectFlags.Physics); | ||
1677 | DoPhysicsPropertyUpdate(false, true); | ||
1678 | //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
1679 | } | ||
1680 | |||
1681 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | ||
1682 | { | ||
1683 | } | ||
1684 | |||
1685 | |||
1686 | public void SetText(string text) | ||
1687 | { | ||
1688 | Text = text; | ||
1689 | ScheduleFullUpdate(); | ||
1690 | } | ||
1691 | |||
1692 | public int registerTargetWaypoint(LLVector3 target, float tolerance) | ||
1693 | { | ||
1694 | if (m_parentGroup != null) | ||
1695 | { | ||
1696 | return m_parentGroup.registerTargetWaypoint(target, tolerance); | ||
1697 | } | ||
1698 | return 0; | ||
1699 | } | ||
1700 | |||
1701 | public void unregisterTargetWaypoint(int handle) | ||
1702 | { | ||
1703 | if (m_parentGroup != null) | ||
1704 | { | ||
1705 | m_parentGroup.unregisterTargetWaypoint(handle); | ||
1706 | } | ||
1707 | } | ||
1708 | |||
1709 | |||
1710 | public void Undo() | ||
1711 | { | ||
1712 | if (m_undo.Count > 0) | ||
1713 | { | ||
1714 | UndoState goback = m_undo.Pop(); | ||
1715 | if (goback != null) | ||
1716 | goback.PlaybackState(this); | ||
1717 | } | ||
1718 | } | ||
1719 | |||
1720 | public void SetScriptEvents(LLUUID scriptid, int events) | ||
1721 | { | ||
1722 | scriptEvents oldparts; | ||
1723 | lock (m_scriptEvents) | ||
1724 | { | ||
1725 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
1726 | { | ||
1727 | oldparts = m_scriptEvents[scriptid]; | ||
1728 | |||
1729 | // remove values from aggregated script events | ||
1730 | m_scriptEvents[scriptid] = (scriptEvents) events; | ||
1731 | } | ||
1732 | else | ||
1733 | { | ||
1734 | m_scriptEvents.Add(scriptid, (scriptEvents) events); | ||
1735 | } | ||
1736 | } | ||
1737 | aggregateScriptEvents(); | ||
1738 | } | ||
1739 | |||
1740 | public void RemoveScriptEvents(LLUUID scriptid) | ||
1741 | { | ||
1742 | lock (m_scriptEvents) | ||
1743 | { | ||
1744 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
1745 | { | ||
1746 | scriptEvents oldparts = scriptEvents.None; | ||
1747 | oldparts = m_scriptEvents[scriptid]; | ||
1748 | |||
1749 | // remove values from aggregated script events | ||
1750 | m_aggregateScriptEvents &= ~oldparts; | ||
1751 | m_scriptEvents.Remove(scriptid); | ||
1752 | } | ||
1753 | } | ||
1754 | aggregateScriptEvents(); | ||
1755 | } | ||
1756 | |||
1757 | public void aggregateScriptEvents() | ||
1758 | { | ||
1759 | // Aggregate script events | ||
1760 | lock (m_scriptEvents) | ||
1761 | { | ||
1762 | foreach (scriptEvents s in m_scriptEvents.Values) | ||
1763 | { | ||
1764 | m_aggregateScriptEvents |= s; | ||
1765 | } | ||
1766 | } | ||
1767 | |||
1768 | uint objectflagupdate = 0; | ||
1769 | |||
1770 | if ( | ||
1771 | ((m_aggregateScriptEvents & scriptEvents.touch) != 0) || | ||
1772 | ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) || | ||
1773 | ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0) | ||
1774 | ) | ||
1775 | { | ||
1776 | objectflagupdate |= (uint) LLObject.ObjectFlags.Touch; | ||
1777 | } | ||
1778 | |||
1779 | if ((m_aggregateScriptEvents & scriptEvents.money) != 0) | ||
1780 | { | ||
1781 | objectflagupdate |= (uint) LLObject.ObjectFlags.Money; | ||
1782 | } | ||
1783 | |||
1784 | if ( | ||
1785 | ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || | ||
1786 | ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
1787 | ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0) | ||
1788 | ) | ||
1789 | { | ||
1790 | // subscribe to physics updates. | ||
1791 | } | ||
1792 | |||
1793 | LocalFlags = (LLObject.ObjectFlags) objectflagupdate; | ||
1794 | |||
1795 | if (m_parentGroup != null && m_parentGroup.RootPart == this) | ||
1796 | m_parentGroup.aggregateScriptEvents(); | ||
1797 | else | ||
1798 | ScheduleFullUpdate(); | ||
1799 | } | ||
1800 | |||
1801 | #region Events | ||
1802 | |||
1803 | public void PhysicsRequestingTerseUpdate() | ||
1804 | { | ||
1805 | if (PhysActor != null) | ||
1806 | { | ||
1807 | LLVector3 newpos = new LLVector3(PhysActor.Position.GetBytes(), 0); | ||
1808 | if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f) | ||
1809 | { | ||
1810 | m_parentGroup.AbsolutePosition = newpos; | ||
1811 | return; | ||
1812 | } | ||
1813 | } | ||
1814 | ScheduleTerseUpdate(); | ||
1815 | |||
1816 | //SendTerseUpdateToAllClients(); | ||
1562 | } | 1817 | } |
1563 | 1818 | ||
1564 | #endregion | 1819 | #endregion |
1565 | 1820 | ||
1821 | #region Client Update Methods | ||
1822 | |||
1566 | /// <summary> | 1823 | /// <summary> |
1567 | /// Reset LLUUIDs for this part. This involves generate this part's own LLUUID and | 1824 | /// Tell all scene presences that they should send updates for this part to their clients |
1568 | /// generating new LLUUIDs for all the items in the inventory. | ||
1569 | /// </summary> | 1825 | /// </summary> |
1570 | /// <param name="linkNum">Link number for the part</param> | 1826 | public void AddFullUpdateToAllAvatars() |
1571 | public void ResetIDs(int linkNum) | ||
1572 | { | 1827 | { |
1573 | UUID = LLUUID.Random(); | 1828 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
1574 | LinkNum = linkNum; | 1829 | for (int i = 0; i < avatars.Count; i++) |
1575 | 1830 | { | |
1576 | ResetInventoryIDs(); | 1831 | avatars[i].QueuePartForUpdate(this); |
1832 | } | ||
1833 | } | ||
1834 | |||
1835 | public void SendFullUpdateToAllClientsExcept(LLUUID agentID) | ||
1836 | { | ||
1837 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1838 | for (int i = 0; i < avatars.Count; i++) | ||
1839 | { | ||
1840 | // Ugly reference :( | ||
1841 | if (avatars[i].UUID != agentID) | ||
1842 | { | ||
1843 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
1844 | avatars[i].GenerateClientFlags(UUID)); | ||
1845 | } | ||
1846 | } | ||
1847 | } | ||
1848 | |||
1849 | |||
1850 | public void AddFullUpdateToAvatar(ScenePresence presence) | ||
1851 | { | ||
1852 | presence.QueuePartForUpdate(this); | ||
1853 | } | ||
1854 | |||
1855 | /// <summary> | ||
1856 | /// | ||
1857 | /// </summary> | ||
1858 | public void SendFullUpdateToAllClients() | ||
1859 | { | ||
1860 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1861 | for (int i = 0; i < avatars.Count; i++) | ||
1862 | { | ||
1863 | // Ugly reference :( | ||
1864 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
1865 | avatars[i].GenerateClientFlags(UUID)); | ||
1866 | } | ||
1867 | } | ||
1868 | |||
1869 | /// <summary> | ||
1870 | /// | ||
1871 | /// </summary> | ||
1872 | /// <param name="remoteClient"></param> | ||
1873 | public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) | ||
1874 | { | ||
1875 | m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); | ||
1876 | } | ||
1877 | |||
1878 | /// <summary> | ||
1879 | /// Sends a full update to the client | ||
1880 | /// </summary> | ||
1881 | /// <param name="remoteClient"></param> | ||
1882 | /// <param name="clientFlags"></param> | ||
1883 | public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags) | ||
1884 | { | ||
1885 | LLVector3 lPos; | ||
1886 | lPos = OffsetPosition; | ||
1887 | SendFullUpdateToClient(remoteClient, lPos, clientflags); | ||
1888 | } | ||
1889 | |||
1890 | /// <summary> | ||
1891 | /// Sends a full update to the client | ||
1892 | /// </summary> | ||
1893 | /// <param name="remoteClient"></param> | ||
1894 | /// <param name="lPos"></param> | ||
1895 | /// <param name="clientFlags"></param> | ||
1896 | public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags) | ||
1897 | { | ||
1898 | LLQuaternion lRot; | ||
1899 | lRot = RotationOffset; | ||
1900 | clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected; | ||
1901 | |||
1902 | if (remoteClient.AgentId == OwnerID) | ||
1903 | { | ||
1904 | if ((uint) (Flags & LLObject.ObjectFlags.CreateSelected) != 0) | ||
1905 | { | ||
1906 | clientFlags |= (uint) LLObject.ObjectFlags.CreateSelected; | ||
1907 | Flags &= ~LLObject.ObjectFlags.CreateSelected; | ||
1908 | } | ||
1909 | } | ||
1910 | |||
1911 | |||
1912 | byte[] color = new[] {m_color.R, m_color.G, m_color.B, m_color.A}; | ||
1913 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, m_shape, lPos, clientFlags, | ||
1914 | m_uuid, | ||
1915 | OwnerID, | ||
1916 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation, m_IsAttachment, | ||
1917 | m_attachmentPoint, fromAssetID); | ||
1918 | } | ||
1919 | |||
1920 | /// Terse updates | ||
1921 | public void AddTerseUpdateToAllAvatars() | ||
1922 | { | ||
1923 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1924 | for (int i = 0; i < avatars.Count; i++) | ||
1925 | { | ||
1926 | avatars[i].QueuePartForUpdate(this); | ||
1927 | } | ||
1928 | } | ||
1929 | |||
1930 | public void AddTerseUpdateToAvatar(ScenePresence presence) | ||
1931 | { | ||
1932 | presence.QueuePartForUpdate(this); | ||
1933 | } | ||
1934 | |||
1935 | /// <summary> | ||
1936 | /// | ||
1937 | /// </summary> | ||
1938 | public void SendTerseUpdateToAllClients() | ||
1939 | { | ||
1940 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
1941 | for (int i = 0; i < avatars.Count; i++) | ||
1942 | { | ||
1943 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); | ||
1944 | } | ||
1945 | } | ||
1946 | |||
1947 | /// <summary> | ||
1948 | /// Send a terse update to the client. | ||
1949 | /// </summary> | ||
1950 | /// <param name="remoteClient"></param> | ||
1951 | public void SendTerseUpdate(IClientAPI remoteClient) | ||
1952 | { | ||
1953 | m_parentGroup.SendPartTerseUpdate(remoteClient, this); | ||
1954 | } | ||
1955 | |||
1956 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | ||
1957 | { | ||
1958 | LLVector3 lPos; | ||
1959 | lPos = OffsetPosition; | ||
1960 | LLQuaternion mRot = RotationOffset; | ||
1961 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | ||
1962 | { | ||
1963 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, Shape.State, | ||
1964 | fromAssetID); | ||
1965 | } | ||
1966 | else | ||
1967 | { | ||
1968 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
1969 | RotationalVelocity); | ||
1970 | //System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
1971 | } | ||
1972 | } | ||
1973 | |||
1974 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | ||
1975 | { | ||
1976 | LLQuaternion mRot = RotationOffset; | ||
1977 | if (m_IsAttachment) | ||
1978 | { | ||
1979 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, | ||
1980 | (byte) ((m_attachmentPoint % 16) * 16 + (m_attachmentPoint / 16)), fromAssetID); | ||
1981 | } | ||
1982 | else | ||
1983 | { | ||
1984 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | ||
1985 | { | ||
1986 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, | ||
1987 | Shape.State, fromAssetID); | ||
1988 | } | ||
1989 | else | ||
1990 | { | ||
1991 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort) (m_parentGroup.GetTimeDilation() * ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
1992 | RotationalVelocity); | ||
1993 | //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
1994 | } | ||
1995 | } | ||
1577 | } | 1996 | } |
1578 | 1997 | ||
1998 | #endregion | ||
1999 | |||
1579 | #region Update Scheduling | 2000 | #region Update Scheduling |
1580 | 2001 | ||
1581 | /// <summary> | 2002 | /// <summary> |
@@ -1596,9 +2017,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1596 | m_parentGroup.HasGroupChanged = true; | 2017 | m_parentGroup.HasGroupChanged = true; |
1597 | m_parentGroup.QueueForUpdateCheck(); | 2018 | m_parentGroup.QueueForUpdateCheck(); |
1598 | } | 2019 | } |
1599 | 2020 | ||
1600 | int timeNow = Util.UnixTimeSinceEpoch(); | 2021 | int timeNow = Util.UnixTimeSinceEpoch(); |
1601 | 2022 | ||
1602 | // If multiple updates are scheduled on the same second, we still need to perform all of them | 2023 | // If multiple updates are scheduled on the same second, we still need to perform all of them |
1603 | // So we'll force the issue by bumping up the timestamp so that later processing sees these need | 2024 | // So we'll force the issue by bumping up the timestamp so that later processing sees these need |
1604 | // to be performed. | 2025 | // to be performed. |
@@ -1608,11 +2029,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1608 | } | 2029 | } |
1609 | else | 2030 | else |
1610 | { | 2031 | { |
1611 | TimeStampFull = (uint)timeNow; | 2032 | TimeStampFull = (uint) timeNow; |
1612 | } | 2033 | } |
1613 | 2034 | ||
1614 | m_updateFlag = 2; | 2035 | m_updateFlag = 2; |
1615 | 2036 | ||
1616 | // m_log.DebugFormat( | 2037 | // m_log.DebugFormat( |
1617 | // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", | 2038 | // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", |
1618 | // UUID, Name, TimeStampFull); | 2039 | // UUID, Name, TimeStampFull); |
@@ -1735,15 +2156,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1735 | 2156 | ||
1736 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) | 2157 | public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) |
1737 | { | 2158 | { |
1738 | |||
1739 | |||
1740 | //m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1)); | 2159 | //m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1)); |
1741 | //m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2)); | 2160 | //m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2)); |
1742 | //m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3)); | 2161 | //m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3)); |
1743 | //m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4)); | 2162 | //m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4)); |
1744 | //m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5)); | 2163 | //m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5)); |
1745 | //m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6)); | 2164 | //m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6)); |
1746 | 2165 | ||
1747 | bool usePhysics = false; | 2166 | bool usePhysics = false; |
1748 | bool IsTemporary = false; | 2167 | bool IsTemporary = false; |
1749 | bool IsPhantom = false; | 2168 | bool IsPhantom = false; |
@@ -1751,7 +2170,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1751 | bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); | 2170 | bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); |
1752 | //bool IsLocked = false; | 2171 | //bool IsLocked = false; |
1753 | int i = 0; | 2172 | int i = 0; |
1754 | 2173 | ||
1755 | 2174 | ||
1756 | try | 2175 | try |
1757 | { | 2176 | { |
@@ -1835,6 +2254,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1835 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 2254 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
1836 | ScheduleFullUpdate(); | 2255 | ScheduleFullUpdate(); |
1837 | } | 2256 | } |
2257 | |||
1838 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 2258 | public void ScriptSetPhysicsStatus(bool UsePhysics) |
1839 | { | 2259 | { |
1840 | if (m_parentGroup != null) | 2260 | if (m_parentGroup != null) |
@@ -1842,6 +2262,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1842 | m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); | 2262 | m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); |
1843 | } | 2263 | } |
1844 | } | 2264 | } |
2265 | |||
1845 | public void ScriptSetPhantomStatus(bool Phantom) | 2266 | public void ScriptSetPhantomStatus(bool Phantom) |
1846 | { | 2267 | { |
1847 | if (m_parentGroup != null) | 2268 | if (m_parentGroup != null) |
@@ -1849,6 +2270,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1849 | m_parentGroup.ScriptSetPhantomStatus(Phantom); | 2270 | m_parentGroup.ScriptSetPhantomStatus(Phantom); |
1850 | } | 2271 | } |
1851 | } | 2272 | } |
2273 | |||
1852 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 2274 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) |
1853 | { | 2275 | { |
1854 | if (PhysActor != null) | 2276 | if (PhysActor != null) |
@@ -1897,7 +2319,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1897 | PhysActor.link(ParentGroup.RootPart.PhysActor); | 2319 | PhysActor.link(ParentGroup.RootPart.PhysActor); |
1898 | } | 2320 | } |
1899 | } | 2321 | } |
1900 | |||
1901 | } | 2322 | } |
1902 | } | 2323 | } |
1903 | } | 2324 | } |
@@ -1911,13 +2332,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1911 | int i = 0; | 2332 | int i = 0; |
1912 | uint length = (uint) data.Length; | 2333 | uint length = (uint) data.Length; |
1913 | m_shape.ExtraParams[i++] = 1; | 2334 | m_shape.ExtraParams[i++] = 1; |
1914 | m_shape.ExtraParams[i++] = (byte) (type%256); | 2335 | m_shape.ExtraParams[i++] = (byte) (type % 256); |
1915 | m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256); | 2336 | m_shape.ExtraParams[i++] = (byte) ((type >> 8) % 256); |
1916 | 2337 | ||
1917 | m_shape.ExtraParams[i++] = (byte) (length%256); | 2338 | m_shape.ExtraParams[i++] = (byte) (length % 256); |
1918 | m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256); | 2339 | m_shape.ExtraParams[i++] = (byte) ((length >> 8) % 256); |
1919 | m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256); | 2340 | m_shape.ExtraParams[i++] = (byte) ((length >> 16) % 256); |
1920 | m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256); | 2341 | m_shape.ExtraParams[i++] = (byte) ((length >> 24) % 256); |
1921 | Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); | 2342 | Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); |
1922 | 2343 | ||
1923 | ScheduleFullUpdate(); | 2344 | ScheduleFullUpdate(); |
@@ -1995,14 +2416,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1995 | 2416 | ||
1996 | public byte ConvertScriptUintToByte(uint indata) | 2417 | public byte ConvertScriptUintToByte(uint indata) |
1997 | { | 2418 | { |
1998 | byte outdata = (byte)TextureAnimFlags.NONE; | 2419 | byte outdata = (byte) TextureAnimFlags.NONE; |
1999 | if ((indata & 1) != 0) outdata |= (byte)TextureAnimFlags.ANIM_ON; | 2420 | if ((indata & 1) != 0) outdata |= (byte) TextureAnimFlags.ANIM_ON; |
2000 | if ((indata & 2) != 0) outdata |= (byte)TextureAnimFlags.LOOP; | 2421 | if ((indata & 2) != 0) outdata |= (byte) TextureAnimFlags.LOOP; |
2001 | if ((indata & 4) != 0) outdata |= (byte)TextureAnimFlags.REVERSE; | 2422 | if ((indata & 4) != 0) outdata |= (byte) TextureAnimFlags.REVERSE; |
2002 | if ((indata & 8) != 0) outdata |= (byte)TextureAnimFlags.PING_PONG; | 2423 | if ((indata & 8) != 0) outdata |= (byte) TextureAnimFlags.PING_PONG; |
2003 | if ((indata & 16) != 0) outdata |= (byte)TextureAnimFlags.SMOOTH; | 2424 | if ((indata & 16) != 0) outdata |= (byte) TextureAnimFlags.SMOOTH; |
2004 | if ((indata & 32) != 0) outdata |= (byte)TextureAnimFlags.ROTATE; | 2425 | if ((indata & 32) != 0) outdata |= (byte) TextureAnimFlags.ROTATE; |
2005 | if ((indata & 64) != 0) outdata |= (byte)TextureAnimFlags.SCALE; | 2426 | if ((indata & 64) != 0) outdata |= (byte) TextureAnimFlags.SCALE; |
2006 | return outdata; | 2427 | return outdata; |
2007 | } | 2428 | } |
2008 | 2429 | ||
@@ -2014,13 +2435,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
2014 | // The flags don't like conversion from uint to byte, so we have to do | 2435 | // The flags don't like conversion from uint to byte, so we have to do |
2015 | // it the crappy way. See the above function :( | 2436 | // it the crappy way. See the above function :( |
2016 | 2437 | ||
2017 | data[pos] = ConvertScriptUintToByte(pTexAnim.Flags); pos++; | 2438 | data[pos] = ConvertScriptUintToByte(pTexAnim.Flags); |
2018 | data[pos] = (byte)pTexAnim.Face; pos++; | 2439 | pos++; |
2019 | data[pos] = (byte)pTexAnim.SizeX; pos++; | 2440 | data[pos] = (byte) pTexAnim.Face; |
2020 | data[pos] = (byte)pTexAnim.SizeY; pos++; | 2441 | pos++; |
2442 | data[pos] = (byte) pTexAnim.SizeX; | ||
2443 | pos++; | ||
2444 | data[pos] = (byte) pTexAnim.SizeY; | ||
2445 | pos++; | ||
2021 | 2446 | ||
2022 | Helpers.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); | 2447 | Helpers.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); |
2023 | Helpers.FloatToBytes(pTexAnim.Length ).CopyTo(data, pos + 4); | 2448 | Helpers.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); |
2024 | Helpers.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); | 2449 | Helpers.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); |
2025 | 2450 | ||
2026 | m_TextureAnimation = data; | 2451 | m_TextureAnimation = data; |
@@ -2071,6 +2496,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2071 | #endregion | 2496 | #endregion |
2072 | 2497 | ||
2073 | #region Sound | 2498 | #region Sound |
2499 | |||
2074 | public void PreloadSound(string sound) | 2500 | public void PreloadSound(string sound) |
2075 | { | 2501 | { |
2076 | LLUUID ownerID = OwnerID; | 2502 | LLUUID ownerID = OwnerID; |
@@ -2096,7 +2522,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2096 | foreach (ScenePresence p in avatarts) | 2522 | foreach (ScenePresence p in avatarts) |
2097 | { | 2523 | { |
2098 | // TODO: some filtering by distance of avatar | 2524 | // TODO: some filtering by distance of avatar |
2099 | 2525 | ||
2100 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | 2526 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); |
2101 | } | 2527 | } |
2102 | } | 2528 | } |
@@ -2111,7 +2537,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2111 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2537 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
2112 | foreach (ScenePresence p in avatarts) | 2538 | foreach (ScenePresence p in avatarts) |
2113 | { | 2539 | { |
2114 | p.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); | 2540 | p.ControllingClient.SendAttachedSoundGainChange(UUID, (float) volume); |
2115 | } | 2541 | } |
2116 | } | 2542 | } |
2117 | 2543 | ||
@@ -2137,7 +2563,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2137 | SceneObjectPart op = this; | 2563 | SceneObjectPart op = this; |
2138 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | 2564 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) |
2139 | { | 2565 | { |
2140 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 2566 | if (item.Value.Name == sound && item.Value.Type == (int) AssetType.Sound) |
2141 | { | 2567 | { |
2142 | soundID = item.Value.ItemID; | 2568 | soundID = item.Value.ItemID; |
2143 | break; | 2569 | break; |
@@ -2145,26 +2571,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
2145 | } | 2571 | } |
2146 | } | 2572 | } |
2147 | 2573 | ||
2148 | if(soundID == LLUUID.Zero) | 2574 | if (soundID == LLUUID.Zero) |
2149 | return; | 2575 | return; |
2150 | 2576 | ||
2151 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2577 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
2152 | foreach (ScenePresence p in avatarts) | 2578 | foreach (ScenePresence p in avatarts) |
2153 | { | 2579 | { |
2154 | double dis=Util.GetDistanceTo(p.AbsolutePosition, position); | 2580 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); |
2155 | if(dis > 100.0) // Max audio distance | 2581 | if (dis > 100.0) // Max audio distance |
2156 | continue; | 2582 | continue; |
2157 | 2583 | ||
2158 | // Scale by distance | 2584 | // Scale by distance |
2159 | volume*=((100.0-dis)/100.0); | 2585 | volume *= ((100.0 - dis) / 100.0); |
2160 | 2586 | ||
2161 | if (triggered) | 2587 | if (triggered) |
2162 | { | 2588 | { |
2163 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); | 2589 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float) volume); |
2164 | } | 2590 | } |
2165 | else | 2591 | else |
2166 | { | 2592 | { |
2167 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags); | 2593 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float) volume, flags); |
2168 | } | 2594 | } |
2169 | } | 2595 | } |
2170 | } | 2596 | } |
@@ -2181,513 +2607,57 @@ namespace OpenSim.Region.Environment.Scenes | |||
2181 | { | 2607 | { |
2182 | StoreUndoState(); | 2608 | StoreUndoState(); |
2183 | m_shape.Scale = scale; | 2609 | m_shape.Scale = scale; |
2184 | 2610 | ||
2185 | ScheduleFullUpdate(); | 2611 | ScheduleFullUpdate(); |
2186 | } | 2612 | } |
2187 | 2613 | ||
2188 | #endregion | 2614 | #endregion |
2189 | 2615 | ||
2190 | public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) | 2616 | #region Copying |
2191 | { | ||
2192 | bool set = addRemTF == 1; | ||
2193 | |||
2194 | // Are we the owner? | ||
2195 | if (AgentID == OwnerID) | ||
2196 | { | ||
2197 | switch (field) | ||
2198 | { | ||
2199 | case 2: | ||
2200 | OwnerMask = ApplyMask(OwnerMask, set, mask); | ||
2201 | break; | ||
2202 | case 4: | ||
2203 | GroupMask = ApplyMask(GroupMask, set, mask); | ||
2204 | break; | ||
2205 | case 8: | ||
2206 | EveryoneMask = ApplyMask(EveryoneMask, set, mask); | ||
2207 | break; | ||
2208 | case 16: | ||
2209 | NextOwnerMask = ApplyMask(NextOwnerMask, set, mask); | ||
2210 | break; | ||
2211 | } | ||
2212 | SendFullUpdateToAllClients(); | ||
2213 | |||
2214 | SendObjectPropertiesToClient(AgentID); | ||
2215 | |||
2216 | } | ||
2217 | } | ||
2218 | |||
2219 | private void SendObjectPropertiesToClient(LLUUID AgentID) | ||
2220 | { | ||
2221 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2222 | for (int i = 0; i < avatars.Count; i++) | ||
2223 | { | ||
2224 | // Ugly reference :( | ||
2225 | if (avatars[i].UUID == AgentID) | ||
2226 | { | ||
2227 | m_parentGroup.GetProperties(avatars[i].ControllingClient); | ||
2228 | } | ||
2229 | } | ||
2230 | } | ||
2231 | |||
2232 | private uint ApplyMask(uint val, bool set, uint mask) | ||
2233 | { | ||
2234 | if (set) | ||
2235 | { | ||
2236 | return val |= mask; | ||
2237 | } | ||
2238 | else | ||
2239 | { | ||
2240 | return val &= ~mask; | ||
2241 | } | ||
2242 | } | ||
2243 | |||
2244 | #region Client Update Methods | ||
2245 | |||
2246 | /// <summary> | ||
2247 | /// Tell all scene presences that they should send updates for this part to their clients | ||
2248 | /// </summary> | ||
2249 | public void AddFullUpdateToAllAvatars() | ||
2250 | { | ||
2251 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2252 | for (int i = 0; i < avatars.Count; i++) | ||
2253 | { | ||
2254 | avatars[i].QueuePartForUpdate(this); | ||
2255 | } | ||
2256 | } | ||
2257 | |||
2258 | public void SendFullUpdateToAllClientsExcept(LLUUID agentID) | ||
2259 | { | ||
2260 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2261 | for (int i = 0; i < avatars.Count; i++) | ||
2262 | { | ||
2263 | // Ugly reference :( | ||
2264 | if (avatars[i].UUID != agentID) | ||
2265 | { | ||
2266 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
2267 | avatars[i].GenerateClientFlags(UUID)); | ||
2268 | } | ||
2269 | } | ||
2270 | } | ||
2271 | |||
2272 | |||
2273 | public void AddFullUpdateToAvatar(ScenePresence presence) | ||
2274 | { | ||
2275 | presence.QueuePartForUpdate(this); | ||
2276 | } | ||
2277 | |||
2278 | /// <summary> | ||
2279 | /// | ||
2280 | /// </summary> | ||
2281 | public void SendFullUpdateToAllClients() | ||
2282 | { | ||
2283 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2284 | for (int i = 0; i < avatars.Count; i++) | ||
2285 | { | ||
2286 | // Ugly reference :( | ||
2287 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | ||
2288 | avatars[i].GenerateClientFlags(UUID)); | ||
2289 | } | ||
2290 | } | ||
2291 | |||
2292 | /// <summary> | ||
2293 | /// | ||
2294 | /// </summary> | ||
2295 | /// <param name="remoteClient"></param> | ||
2296 | public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) | ||
2297 | { | ||
2298 | m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); | ||
2299 | } | ||
2300 | |||
2301 | /// <summary> | ||
2302 | /// Sends a full update to the client | ||
2303 | /// </summary> | ||
2304 | /// <param name="remoteClient"></param> | ||
2305 | /// <param name="clientFlags"></param> | ||
2306 | public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags) | ||
2307 | { | ||
2308 | LLVector3 lPos; | ||
2309 | lPos = OffsetPosition; | ||
2310 | SendFullUpdateToClient(remoteClient, lPos, clientflags); | ||
2311 | } | ||
2312 | |||
2313 | /// <summary> | ||
2314 | /// Sends a full update to the client | ||
2315 | /// </summary> | ||
2316 | /// <param name="remoteClient"></param> | ||
2317 | /// <param name="lPos"></param> | ||
2318 | /// <param name="clientFlags"></param> | ||
2319 | public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags) | ||
2320 | { | ||
2321 | LLQuaternion lRot; | ||
2322 | lRot = RotationOffset; | ||
2323 | clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected; | ||
2324 | |||
2325 | if (remoteClient.AgentId == OwnerID) | ||
2326 | { | ||
2327 | if ((uint) (Flags & LLObject.ObjectFlags.CreateSelected) != 0) | ||
2328 | { | ||
2329 | clientFlags |= (uint) LLObject.ObjectFlags.CreateSelected; | ||
2330 | Flags &= ~LLObject.ObjectFlags.CreateSelected; | ||
2331 | } | ||
2332 | } | ||
2333 | |||
2334 | |||
2335 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; | ||
2336 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, lPos, clientFlags, m_uuid, | ||
2337 | OwnerID, | ||
2338 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation, m_IsAttachment, m_attachmentPoint,fromAssetID); | ||
2339 | } | ||
2340 | |||
2341 | /// Terse updates | ||
2342 | public void AddTerseUpdateToAllAvatars() | ||
2343 | { | ||
2344 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2345 | for (int i = 0; i < avatars.Count; i++) | ||
2346 | { | ||
2347 | avatars[i].QueuePartForUpdate(this); | ||
2348 | } | ||
2349 | } | ||
2350 | |||
2351 | public void AddTerseUpdateToAvatar(ScenePresence presence) | ||
2352 | { | ||
2353 | presence.QueuePartForUpdate(this); | ||
2354 | } | ||
2355 | |||
2356 | /// <summary> | ||
2357 | /// | ||
2358 | /// </summary> | ||
2359 | public void SendTerseUpdateToAllClients() | ||
2360 | { | ||
2361 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | ||
2362 | for (int i = 0; i < avatars.Count; i++) | ||
2363 | { | ||
2364 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); | ||
2365 | } | ||
2366 | } | ||
2367 | 2617 | ||
2368 | /// <summary> | 2618 | /// <summary> |
2369 | /// Send a terse update to the client. | 2619 | /// Duplicates this part. |
2370 | /// </summary> | 2620 | /// </summary> |
2371 | /// <param name="remoteClient"></param> | 2621 | /// <returns></returns> |
2372 | public void SendTerseUpdate(IClientAPI remoteClient) | 2622 | public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID, int linkNum) |
2373 | { | ||
2374 | m_parentGroup.SendPartTerseUpdate(remoteClient, this); | ||
2375 | } | ||
2376 | |||
2377 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | ||
2378 | { | 2623 | { |
2379 | LLVector3 lPos; | 2624 | SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone(); |
2380 | lPos = OffsetPosition; | 2625 | dupe.m_shape = m_shape.Copy(); |
2381 | LLQuaternion mRot = RotationOffset; | 2626 | dupe.m_regionHandle = m_regionHandle; |
2382 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | 2627 | dupe.UUID = LLUUID.Random(); |
2383 | { | 2628 | dupe.LocalId = localID; |
2384 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Shape.State, fromAssetID); | 2629 | dupe.OwnerID = AgentID; |
2385 | } | 2630 | dupe.GroupID = GroupID; |
2386 | else | 2631 | dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); |
2387 | { | 2632 | dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); |
2388 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, | 2633 | dupe.RotationOffset = |
2389 | RotationalVelocity); | 2634 | new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); |
2390 | //System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | 2635 | dupe.Velocity = new LLVector3(0, 0, 0); |
2391 | } | 2636 | dupe.Acceleration = new LLVector3(0, 0, 0); |
2392 | } | 2637 | dupe.AngularVelocity = new LLVector3(0, 0, 0); |
2638 | dupe.ObjectFlags = ObjectFlags; | ||
2393 | 2639 | ||
2394 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | 2640 | dupe.OwnershipCost = OwnershipCost; |
2395 | { | 2641 | dupe.ObjectSaleType = ObjectSaleType; |
2396 | LLQuaternion mRot = RotationOffset; | 2642 | dupe.SalePrice = SalePrice; |
2397 | if (m_IsAttachment) | 2643 | dupe.Category = Category; |
2398 | { | ||
2399 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, (byte)((m_attachmentPoint % 16) * 16 + (m_attachmentPoint / 16)),fromAssetID); | ||
2400 | } | ||
2401 | else | ||
2402 | { | ||
2403 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) | ||
2404 | { | ||
2405 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Shape.State, fromAssetID); | ||
2406 | } | ||
2407 | else | ||
2408 | { | ||
2409 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
2410 | RotationalVelocity); | ||
2411 | //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
2412 | } | ||
2413 | } | ||
2414 | } | ||
2415 | 2644 | ||
2416 | #endregion | 2645 | dupe.TaskInventory = (TaskInventoryDictionary) dupe.TaskInventory.Clone(); |
2417 | 2646 | ||
2418 | public virtual void UpdateMovement() | 2647 | dupe.ResetIDs(linkNum); |
2419 | { | ||
2420 | } | ||
2421 | 2648 | ||
2422 | #region Events | 2649 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
2650 | dupe.LastOwnerID = ObjectOwner; | ||
2423 | 2651 | ||
2424 | public void PhysicsRequestingTerseUpdate() | 2652 | byte[] extraP = new byte[Shape.ExtraParams.Length]; |
2425 | { | 2653 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
2426 | if (PhysActor != null) | 2654 | dupe.Shape.ExtraParams = extraP; |
2427 | { | 2655 | bool UsePhysics = ((dupe.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); |
2428 | LLVector3 newpos = new LLVector3(PhysActor.Position.GetBytes(), 0); | 2656 | dupe.DoPhysicsPropertyUpdate(UsePhysics, true); |
2429 | if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f) | ||
2430 | { | ||
2431 | m_parentGroup.AbsolutePosition = newpos; | ||
2432 | return; | ||
2433 | } | ||
2434 | |||
2435 | } | ||
2436 | ScheduleTerseUpdate(); | ||
2437 | 2657 | ||
2438 | //SendTerseUpdateToAllClients(); | 2658 | return dupe; |
2439 | } | 2659 | } |
2440 | 2660 | ||
2441 | #endregion | 2661 | #endregion |
2442 | |||
2443 | public void PhysicsOutOfBounds(PhysicsVector pos) | ||
2444 | { | ||
2445 | m_log.Info("[PHYSICS]: Physical Object went out of bounds."); | ||
2446 | RemFlag(LLObject.ObjectFlags.Physics); | ||
2447 | DoPhysicsPropertyUpdate(false, true); | ||
2448 | //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
2449 | } | ||
2450 | |||
2451 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | ||
2452 | { | ||
2453 | } | ||
2454 | |||
2455 | |||
2456 | public void SetText(string text) | ||
2457 | { | ||
2458 | Text = text; | ||
2459 | ScheduleFullUpdate(); | ||
2460 | } | ||
2461 | |||
2462 | public void SetText(string text, Vector3 color, double alpha) | ||
2463 | { | ||
2464 | Color = Color.FromArgb(0xff - (int) (alpha*0xff), | ||
2465 | (int) (color.x*0xff), | ||
2466 | (int) (color.y*0xff), | ||
2467 | (int) (color.z*0xff)); | ||
2468 | SetText( text ); | ||
2469 | } | ||
2470 | |||
2471 | public int registerTargetWaypoint(LLVector3 target, float tolerance) | ||
2472 | { | ||
2473 | if (m_parentGroup != null) | ||
2474 | { | ||
2475 | return m_parentGroup.registerTargetWaypoint(target, tolerance); | ||
2476 | } | ||
2477 | return 0; | ||
2478 | } | ||
2479 | public void unregisterTargetWaypoint(int handle) | ||
2480 | { | ||
2481 | if (m_parentGroup != null) | ||
2482 | { | ||
2483 | m_parentGroup.unregisterTargetWaypoint(handle); | ||
2484 | } | ||
2485 | } | ||
2486 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | ||
2487 | { | ||
2488 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); | ||
2489 | |||
2490 | if (info == null) | ||
2491 | { | ||
2492 | throw new ArgumentNullException("info"); | ||
2493 | } | ||
2494 | |||
2495 | /* | ||
2496 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); | ||
2497 | m_ids = (List<LLUUID>)info.GetValue("m_ids", typeof(List<LLUUID>)); | ||
2498 | */ | ||
2499 | |||
2500 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); | ||
2501 | } | ||
2502 | |||
2503 | [SecurityPermission(SecurityAction.LinkDemand, | ||
2504 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
2505 | public virtual void GetObjectData( | ||
2506 | SerializationInfo info, StreamingContext context) | ||
2507 | { | ||
2508 | if (info == null) | ||
2509 | { | ||
2510 | throw new ArgumentNullException("info"); | ||
2511 | } | ||
2512 | |||
2513 | info.AddValue("m_inventoryFileName", m_inventoryFileName); | ||
2514 | info.AddValue("m_folderID", m_folderID.UUID); | ||
2515 | info.AddValue("PhysActor", PhysActor); | ||
2516 | |||
2517 | Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); | ||
2518 | |||
2519 | foreach (LLUUID id in TaskInventory.Keys) | ||
2520 | { | ||
2521 | TaskInventory_work.Add(id.UUID, TaskInventory[id]); | ||
2522 | } | ||
2523 | |||
2524 | info.AddValue("TaskInventory", TaskInventory_work); | ||
2525 | |||
2526 | info.AddValue("LastOwnerID", LastOwnerID.UUID); | ||
2527 | info.AddValue("OwnerID", OwnerID.UUID); | ||
2528 | info.AddValue("GroupID", GroupID.UUID); | ||
2529 | |||
2530 | info.AddValue("OwnershipCost", OwnershipCost); | ||
2531 | info.AddValue("ObjectSaleType", ObjectSaleType); | ||
2532 | info.AddValue("SalePrice", SalePrice); | ||
2533 | info.AddValue("Category", Category); | ||
2534 | |||
2535 | info.AddValue("CreationDate", CreationDate); | ||
2536 | info.AddValue("ParentID", ParentID); | ||
2537 | |||
2538 | info.AddValue("OwnerMask", OwnerMask); | ||
2539 | info.AddValue("NextOwnerMask", NextOwnerMask); | ||
2540 | info.AddValue("GroupMask", GroupMask); | ||
2541 | info.AddValue("EveryoneMask", EveryoneMask); | ||
2542 | info.AddValue("BaseMask", BaseMask); | ||
2543 | |||
2544 | info.AddValue("m_particleSystem", m_particleSystem); | ||
2545 | |||
2546 | info.AddValue("TimeStampFull", TimeStampFull); | ||
2547 | info.AddValue("TimeStampTerse", TimeStampTerse); | ||
2548 | info.AddValue("TimeStampLastActivity", TimeStampLastActivity); | ||
2549 | |||
2550 | info.AddValue("m_updateFlag", m_updateFlag); | ||
2551 | info.AddValue("CreatorID", CreatorID.UUID); | ||
2552 | |||
2553 | info.AddValue("m_inventorySerial", m_inventorySerial); | ||
2554 | info.AddValue("m_uuid", m_uuid.UUID); | ||
2555 | info.AddValue("m_localID", m_localId); | ||
2556 | info.AddValue("m_name", m_name); | ||
2557 | info.AddValue("m_flags", Flags); | ||
2558 | info.AddValue("m_material", m_material); | ||
2559 | info.AddValue("m_regionHandle", m_regionHandle); | ||
2560 | |||
2561 | info.AddValue("m_groupPosition.X", m_groupPosition.X); | ||
2562 | info.AddValue("m_groupPosition.Y", m_groupPosition.Y); | ||
2563 | info.AddValue("m_groupPosition.Z", m_groupPosition.Z); | ||
2564 | |||
2565 | info.AddValue("m_offsetPosition.X", m_offsetPosition.X); | ||
2566 | info.AddValue("m_offsetPosition.Y", m_offsetPosition.Y); | ||
2567 | info.AddValue("m_offsetPosition.Z", m_offsetPosition.Z); | ||
2568 | |||
2569 | info.AddValue("m_rotationOffset.W", m_rotationOffset.W); | ||
2570 | info.AddValue("m_rotationOffset.X", m_rotationOffset.X); | ||
2571 | info.AddValue("m_rotationOffset.Y", m_rotationOffset.Y); | ||
2572 | info.AddValue("m_rotationOffset.Z", m_rotationOffset.Z); | ||
2573 | |||
2574 | info.AddValue("m_velocity.X", m_velocity.X); | ||
2575 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
2576 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
2577 | |||
2578 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
2579 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
2580 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
2581 | |||
2582 | info.AddValue("m_angularVelocity.X", m_angularVelocity.X); | ||
2583 | info.AddValue("m_angularVelocity.Y", m_angularVelocity.Y); | ||
2584 | info.AddValue("m_angularVelocity.Z", m_angularVelocity.Z); | ||
2585 | |||
2586 | info.AddValue("m_acceleration.X", m_acceleration.X); | ||
2587 | info.AddValue("m_acceleration.Y", m_acceleration.Y); | ||
2588 | info.AddValue("m_acceleration.Z", m_acceleration.Z); | ||
2589 | |||
2590 | info.AddValue("m_description", m_description); | ||
2591 | info.AddValue("m_color", m_color); | ||
2592 | info.AddValue("m_text", m_text); | ||
2593 | info.AddValue("m_sitName", m_sitName); | ||
2594 | info.AddValue("m_touchName", m_touchName); | ||
2595 | info.AddValue("m_clickAction", m_clickAction); | ||
2596 | info.AddValue("m_shape", m_shape); | ||
2597 | info.AddValue("m_parentGroup", m_parentGroup); | ||
2598 | info.AddValue("PayPrice", PayPrice); | ||
2599 | } | ||
2600 | |||
2601 | |||
2602 | public void Undo() | ||
2603 | { | ||
2604 | if (m_undo.Count > 0) | ||
2605 | { | ||
2606 | UndoState goback = m_undo.Pop(); | ||
2607 | if (goback != null) | ||
2608 | goback.PlaybackState(this); | ||
2609 | } | ||
2610 | } | ||
2611 | |||
2612 | public void SetScriptEvents(LLUUID scriptid, int events) | ||
2613 | { | ||
2614 | scriptEvents oldparts; | ||
2615 | lock (m_scriptEvents) | ||
2616 | { | ||
2617 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2618 | { | ||
2619 | oldparts = m_scriptEvents[scriptid]; | ||
2620 | |||
2621 | // remove values from aggregated script events | ||
2622 | m_scriptEvents[scriptid] = (scriptEvents) events; | ||
2623 | } | ||
2624 | else | ||
2625 | { | ||
2626 | m_scriptEvents.Add(scriptid, (scriptEvents) events); | ||
2627 | } | ||
2628 | } | ||
2629 | aggregateScriptEvents(); | ||
2630 | } | ||
2631 | |||
2632 | public void RemoveScriptEvents(LLUUID scriptid) | ||
2633 | { | ||
2634 | lock (m_scriptEvents) | ||
2635 | { | ||
2636 | if (m_scriptEvents.ContainsKey(scriptid)) | ||
2637 | { | ||
2638 | scriptEvents oldparts = scriptEvents.None; | ||
2639 | oldparts = (scriptEvents) m_scriptEvents[scriptid]; | ||
2640 | |||
2641 | // remove values from aggregated script events | ||
2642 | m_aggregateScriptEvents &= ~oldparts; | ||
2643 | m_scriptEvents.Remove(scriptid); | ||
2644 | } | ||
2645 | } | ||
2646 | aggregateScriptEvents(); | ||
2647 | } | ||
2648 | |||
2649 | public void aggregateScriptEvents() | ||
2650 | { | ||
2651 | // Aggregate script events | ||
2652 | lock (m_scriptEvents) | ||
2653 | { | ||
2654 | foreach (scriptEvents s in m_scriptEvents.Values) | ||
2655 | { | ||
2656 | m_aggregateScriptEvents |= s; | ||
2657 | } | ||
2658 | } | ||
2659 | |||
2660 | uint objectflagupdate = 0; | ||
2661 | |||
2662 | if ( | ||
2663 | ((m_aggregateScriptEvents & scriptEvents.touch) != 0) || | ||
2664 | ((m_aggregateScriptEvents & scriptEvents.touch_end) != 0) || | ||
2665 | ((m_aggregateScriptEvents & scriptEvents.touch_start) != 0) | ||
2666 | ) | ||
2667 | { | ||
2668 | objectflagupdate |= (uint) LLObject.ObjectFlags.Touch; | ||
2669 | } | ||
2670 | |||
2671 | if ((m_aggregateScriptEvents & scriptEvents.money) != 0) | ||
2672 | { | ||
2673 | objectflagupdate |= (uint) LLObject.ObjectFlags.Money; | ||
2674 | } | ||
2675 | |||
2676 | if ( | ||
2677 | ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || | ||
2678 | ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
2679 | ((m_aggregateScriptEvents & scriptEvents.collision_start) != 0) | ||
2680 | ) | ||
2681 | { | ||
2682 | // subscribe to physics updates. | ||
2683 | } | ||
2684 | |||
2685 | LocalFlags=(LLObject.ObjectFlags)objectflagupdate; | ||
2686 | |||
2687 | if(m_parentGroup != null && m_parentGroup.RootPart == this) | ||
2688 | m_parentGroup.aggregateScriptEvents(); | ||
2689 | else | ||
2690 | ScheduleFullUpdate(); | ||
2691 | } | ||
2692 | } | 2662 | } |
2693 | } | 2663 | } \ No newline at end of file |