aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive(Old).cs724
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject(Old).cs319
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs2
6 files changed, 4 insertions, 1058 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs
deleted file mode 100644
index 0efa570..0000000
--- a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs
+++ /dev/null
@@ -1,724 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Xml;
4using System.Xml.Serialization;
5using Axiom.Math;
6using libsecondlife;
7using libsecondlife.Packets;
8using OpenSim.Framework.Interfaces;
9using OpenSim.Framework.Inventory;
10using OpenSim.Framework.Types;
11
12using InventoryItem = OpenSim.Framework.Inventory.InventoryItem;
13
14namespace OpenSim.Region.Environment.Scenes
15{
16 public delegate void PrimCountTaintedDelegate();
17
18 public class Primitive : EntityBase
19 {
20 private const uint FULL_MASK_PERMISSIONS = 2147483647;
21
22 private LLVector3 m_positionLastFrame = new LLVector3(0, 0, 0);
23 private ulong m_regionHandle;
24 private byte m_updateFlag;
25 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
26
27 private Dictionary<LLUUID, InventoryItem> m_inventoryItems;
28
29 private string m_description = "";
30
31 public LLUUID CreatorID;
32 public LLUUID OwnerID;
33 public LLUUID LastOwnerID;
34
35 public Int32 CreationDate;
36
37 public uint ParentID = 0;
38
39 public uint OwnerMask = FULL_MASK_PERMISSIONS;
40 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
41 public uint GroupMask = 0;// FULL_MASK_PERMISSIONS;
42 public uint EveryoneMask = 0;//FULL_MASK_PERMISSIONS;
43 public uint BaseMask = 0;//FULL_MASK_PERMISSIONS;
44
45 private PrimitiveBaseShape m_shape;
46 private byte[] m_particleSystem = new byte[0];
47
48 public SceneObjectOLD m_RootParent;
49 public bool m_isRootPrim;
50 public EntityBase m_Parent;
51
52 public event PrimCountTaintedDelegate OnPrimCountTainted;
53
54 #region Properties
55
56 /// <summary>
57 /// If rootprim, will return world position
58 /// otherwise will return local offset from rootprim
59 /// </summary>
60 public override LLVector3 AbsolutePosition
61 {
62 get
63 {
64 if (m_isRootPrim)
65 {
66 //if we are rootprim then our offset should be zero
67 return m_pos + m_Parent.AbsolutePosition;
68 }
69 else
70 {
71 return m_pos;
72 }
73 }
74 set
75 {
76 if (m_isRootPrim)
77 {
78 m_Parent.AbsolutePosition = value;
79 }
80 m_pos = value - m_Parent.AbsolutePosition;
81 }
82 }
83
84 public PrimitiveBaseShape Shape
85 {
86 get { return m_shape; }
87 }
88
89 public LLVector3 WorldPos
90 {
91 get
92 {
93 if (!m_isRootPrim)
94 {
95 Primitive parentPrim = (Primitive)m_Parent;
96 Vector3 offsetPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
97 offsetPos = parentPrim.Rotation * offsetPos;
98 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z);
99 }
100 else
101 {
102 return AbsolutePosition;
103 }
104 }
105 }
106
107 public string Description
108 {
109 get { return m_description; }
110 set { m_description = value; }
111 }
112
113 public LLVector3 Scale
114 {
115 set { m_shape.Scale = value; }
116 get { return m_shape.Scale; }
117 }
118
119 private string m_sitName = "";
120 public string SitName
121 {
122 get { return m_sitName; }
123 }
124
125 private string m_touchName = "";
126 public string TouchName
127 {
128 get { return m_touchName; }
129 }
130
131 private string m_text = "";
132 public string Text
133 {
134 get { return m_text; }
135 set
136 {
137 m_text = value;
138 ScheduleFullUpdate();
139 }
140 }
141
142 #endregion
143
144 #region Constructors
145
146 public Primitive(ulong regionHandle, Scene scene, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
147 SceneObjectOLD rootObject, PrimitiveBaseShape shape, LLVector3 pos)
148 {
149 m_regionHandle = regionHandle;
150 m_scene = scene;
151 m_inventoryItems = new Dictionary<LLUUID, InventoryItem>();
152 m_Parent = parent;
153 m_isRootPrim = isRoot;
154 m_RootParent = rootObject;
155 ClearUpdateSchedule();
156 CreateFromShape(ownerID, localID, pos, shape);
157
158 Rotation = Quaternion.Identity;
159
160 m_scene.AcknowledgeNewPrim(this);
161
162 OnPrimCountTainted();
163 }
164
165 /// <summary>
166 ///
167 /// </summary>
168 /// <remarks>Empty constructor for duplication</remarks>
169 public Primitive()
170 {
171 }
172
173 #endregion
174
175 #region Destructors
176
177 ~Primitive()
178 {
179 if (OnPrimCountTainted != null)
180 OnPrimCountTainted();
181 }
182
183 #endregion
184
185 #region Duplication
186
187 public Primitive Copy(EntityBase parent, SceneObjectOLD rootParent)
188 {
189 Primitive dupe = (Primitive)MemberwiseClone();
190
191 dupe.m_Parent = parent;
192 dupe.m_RootParent = rootParent;
193
194 // TODO: Copy this properly.
195
196 dupe.m_inventoryItems = m_inventoryItems;
197 dupe.m_children = new List<EntityBase>();
198 dupe.m_shape = m_shape.Copy();
199 dupe.m_regionHandle = m_regionHandle;
200 dupe.m_scene = m_scene;
201
202
203 uint newLocalID = m_scene.PrimIDAllocate();
204 dupe.m_uuid = LLUUID.Random();
205 dupe.LocalId = newLocalID;
206
207 if (parent is SceneObjectGroup)
208 {
209 dupe.m_isRootPrim = true;
210 dupe.ParentID = 0;
211 }
212 else
213 {
214 dupe.m_isRootPrim = false;
215 dupe.ParentID = ((Primitive)parent).LocalId;
216 }
217
218 dupe.Scale = new LLVector3(Scale.X, Scale.Y, Scale.Z);
219 dupe.Rotation = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
220 dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z);
221
222 rootParent.AddChildToList(dupe);
223 m_scene.AcknowledgeNewPrim(dupe);
224 dupe.TriggerOnPrimCountTainted();
225
226
227 foreach (Primitive prim in m_children)
228 {
229 Primitive primClone = prim.Copy(dupe, rootParent);
230
231 dupe.m_children.Add(primClone);
232 }
233
234 return dupe;
235 }
236
237 #endregion
238
239 #region Override from EntityBase
240
241 /// <summary>
242 ///
243 /// </summary>
244 public override void Update()
245 {
246 if (m_updateFlag == 1) //some change has been made so update the clients
247 {
248 SendTerseUpdateToALLClients();
249 ClearUpdateSchedule();
250 }
251 else
252 {
253 if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes
254 {
255 SendFullUpdateToAllClients();
256 ClearUpdateSchedule();
257 }
258 }
259
260 foreach (EntityBase child in m_children)
261 {
262 child.Update();
263 }
264 }
265
266 private void ClearUpdateSchedule()
267 {
268 m_updateFlag = 0;
269 }
270
271 #endregion
272
273 #region Setup
274
275 /// <summary>
276 ///
277 /// </summary>
278 /// <param name="addPacket"></param>
279 /// <param name="ownerID"></param>
280 /// <param name="localID"></param>
281 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
282 {
283 CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
284 OwnerID = ownerID;
285 CreatorID = OwnerID;
286 LastOwnerID = LLUUID.Zero;
287 AbsolutePosition = pos;
288 m_uuid = LLUUID.Random();
289 m_localId = (uint)(localID);
290
291 m_shape = shape;
292
293 ScheduleFullUpdate();
294 }
295
296 private void ScheduleFullUpdate()
297 {
298 m_updateFlag = 2;
299 }
300
301 private void ScheduleTerseUpdate()
302 {
303 if (m_updateFlag < 1)
304 {
305 m_updateFlag = 1;
306 }
307 }
308
309 #endregion
310
311 #region Linking / unlinking
312
313 /// <summary>
314 ///
315 /// </summary>
316 /// <param name="linkObject"></param>
317 public void AddNewChildren(SceneObjectOLD linkObject)
318 {
319 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
320 //TODO check permissions
321
322 m_children.Add(linkObject.rootPrimitive);
323 linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
324
325 m_scene.DeleteEntity(linkObject.rootUUID);
326 linkObject.DeleteAllChildren();
327
328 OnPrimCountTainted();
329 }
330
331 /// <summary>
332 ///
333 /// </summary>
334 /// <param name="newParent"></param>
335 /// <param name="rootParent"></param>
336 public void SetNewParent(Primitive newParent, SceneObjectOLD rootParent)
337 {
338 LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
339 m_isRootPrim = false;
340 m_Parent = newParent;
341 ParentID = newParent.LocalId;
342 m_RootParent = rootParent;
343 m_RootParent.AddChildToList(this);
344 AbsolutePosition = oldPos;
345 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
346 axPos = m_Parent.Rotation.Inverse() * axPos;
347 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
348 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
349 Rotation = m_Parent.Rotation.Inverse() * Rotation;
350 ScheduleFullUpdate();
351
352
353 foreach (Primitive child in m_children)
354 {
355 child.SetRootParent(rootParent, newParent, oldPos, oldRot);
356 }
357
358 m_children.Clear();
359
360 }
361
362 /// <summary>
363 ///
364 /// </summary>
365 /// <param name="newRoot"></param>
366 public void SetRootParent(SceneObjectOLD newRoot, Primitive newParent, LLVector3 oldParentPosition,
367 Quaternion oldParentRotation)
368 {
369 LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
370 Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z);
371 axOldPos = oldParentRotation * axOldPos;
372 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z);
373 oldPos += oldParentPosition;
374 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
375 m_isRootPrim = false;
376 m_Parent = newParent;
377 ParentID = newParent.LocalId;
378 newParent.AddToChildrenList(this);
379
380 m_RootParent = newRoot;
381 m_RootParent.AddChildToList(this);
382 AbsolutePosition = oldPos;
383 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
384 axPos = m_Parent.Rotation.Inverse() * axPos;
385 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
386 Rotation = oldParentRotation * Rotation;
387 Rotation = m_Parent.Rotation.Inverse() * Rotation;
388 ScheduleFullUpdate();
389 foreach (Primitive child in m_children)
390 {
391 child.SetRootParent(newRoot, newParent, oldPos, oldRot);
392 }
393
394 m_children.Clear();
395
396 }
397
398 /// <summary>
399 ///
400 /// </summary>
401 /// <param name="offset"></param>
402 public void AddOffsetToChildren(LLVector3 offset)
403 {
404 foreach (Primitive prim in m_children)
405 {
406 prim.m_pos += offset;
407 prim.ScheduleTerseUpdate();
408 }
409 OnPrimCountTainted();
410 }
411
412 /// <summary>
413 ///
414 /// </summary>
415 /// <param name="prim"></param>
416 public void AddToChildrenList(Primitive prim)
417 {
418 m_children.Add(prim);
419 }
420
421 #endregion
422
423 #region Resizing/Scale
424
425 /// <summary>
426 ///
427 /// </summary>
428 /// <param name="scale"></param>
429 public void ResizeGoup(LLVector3 scale)
430 {
431 m_shape.Scale = scale;
432
433 ScheduleFullUpdate();
434 }
435
436 #endregion
437
438 #region Position
439
440 /// <summary>
441 ///
442 /// </summary>
443 /// <param name="pos"></param>
444 public void UpdateGroupPosition(LLVector3 pos)
445 {
446 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
447
448 AbsolutePosition = newPos;
449 ScheduleTerseUpdate();
450
451 OnPrimCountTainted();
452 }
453
454 /// <summary>
455 ///
456 /// </summary>
457 /// <param name="pos"></param>
458 public void UpdateSinglePosition(LLVector3 pos)
459 {
460 // Console.WriteLine("updating single prim position");
461 if (m_isRootPrim)
462 {
463 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
464 LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
465 LLVector3 diff = oldPos - newPos;
466 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
467 axDiff = Rotation.Inverse() * axDiff;
468 diff.X = axDiff.x;
469 diff.Y = axDiff.y;
470 diff.Z = axDiff.z;
471 AbsolutePosition = newPos;
472
473 foreach (Primitive prim in m_children)
474 {
475 prim.m_pos += diff;
476 prim.ScheduleTerseUpdate();
477 }
478 ScheduleTerseUpdate();
479 }
480 else
481 {
482 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
483 m_pos = newPos;
484 ScheduleTerseUpdate();
485 }
486 }
487
488 #endregion
489
490 #region Rotation
491
492 /// <summary>
493 ///
494 /// </summary>
495 /// <param name="rot"></param>
496 public void UpdateGroupRotation(LLQuaternion rot)
497 {
498 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
499 ScheduleTerseUpdate();
500 }
501
502 /// <summary>
503 ///
504 /// </summary>
505 /// <param name="pos"></param>
506 /// <param name="rot"></param>
507 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
508 {
509 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
510 AbsolutePosition = pos;
511 ScheduleTerseUpdate();
512 }
513
514 /// <summary>
515 ///
516 /// </summary>
517 /// <param name="rot"></param>
518 public void UpdateSingleRotation(LLQuaternion rot)
519 {
520 //Console.WriteLine("updating single prim rotation");
521
522 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
523 Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
524 Rotation = axRot;
525 foreach (Primitive prim in m_children)
526 {
527 Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z);
528 axPos = oldParentRot * axPos;
529 axPos = axRot.Inverse() * axPos;
530 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
531 prim.Rotation = oldParentRot * prim.Rotation;
532 prim.Rotation = axRot.Inverse() * prim.Rotation;
533 prim.ScheduleTerseUpdate();
534 }
535 ScheduleTerseUpdate();
536 }
537
538 #endregion
539
540 #region Shape
541
542 /// <summary>
543 ///
544 /// </summary>
545 /// <param name="shapeBlock"></param>
546 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
547 {
548 m_shape.PathBegin = shapeBlock.PathBegin;
549 m_shape.PathEnd = shapeBlock.PathEnd;
550 m_shape.PathScaleX = shapeBlock.PathScaleX;
551 m_shape.PathScaleY = shapeBlock.PathScaleY;
552 m_shape.PathShearX = shapeBlock.PathShearX;
553 m_shape.PathShearY = shapeBlock.PathShearY;
554 m_shape.PathSkew = shapeBlock.PathSkew;
555 m_shape.ProfileBegin = shapeBlock.ProfileBegin;
556 m_shape.ProfileEnd = shapeBlock.ProfileEnd;
557 m_shape.PathCurve = shapeBlock.PathCurve;
558 m_shape.ProfileCurve = shapeBlock.ProfileCurve;
559 m_shape.ProfileHollow = shapeBlock.ProfileHollow;
560 m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
561 m_shape.PathRevolutions = shapeBlock.PathRevolutions;
562 m_shape.PathTaperX = shapeBlock.PathTaperX;
563 m_shape.PathTaperY = shapeBlock.PathTaperY;
564 m_shape.PathTwist = shapeBlock.PathTwist;
565 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
566 ScheduleFullUpdate();
567 }
568
569 #endregion
570
571 #region Inventory
572 public void GetInventory(IClientAPI client, uint localID)
573 {
574 if (localID == this.m_localId)
575 {
576 client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
577 }
578 }
579 #endregion
580
581 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
582 {
583 this.m_shape.ExtraParams = new byte[data.Length + 7];
584 int i =0;
585 uint length = (uint) data.Length;
586 this.m_shape.ExtraParams[i++] = 1;
587 this.m_shape.ExtraParams[i++] = (byte)(type % 256);
588 this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256);
589
590 this.m_shape.ExtraParams[i++] = (byte)(length % 256);
591 this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256);
592 this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256);
593 this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256);
594 Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length);
595
596 this.ScheduleFullUpdate();
597 }
598
599 #region Texture
600
601 /// <summary>
602 ///
603 /// </summary>
604 /// <param name="textureEntry"></param>
605 public void UpdateTextureEntry(byte[] textureEntry)
606 {
607 m_shape.TextureEntry = textureEntry;
608 ScheduleFullUpdate();
609 }
610
611 #endregion
612
613 public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem)
614 {
615 this.m_particleSystem = pSystem.GetBytes();
616 ScheduleFullUpdate();
617 }
618
619 #region Client Update Methods
620
621 /// <summary>
622 ///
623 /// </summary>
624 /// <param name="remoteClient"></param>
625 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
626 {
627
628 SendFullUpdateToClient(remoteClient);
629 for (int i = 0; i < m_children.Count; i++)
630
631 {
632
633 if (m_children[i] is Primitive)
634 {
635 ((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient);
636 }
637 }
638 }
639
640 /// <summary>
641 ///
642 /// </summary>
643 /// <param name="remoteClient"></param>
644 public void SendFullUpdateToClient(IClientAPI remoteClient)
645 {
646 LLVector3 lPos;
647 lPos = AbsolutePosition;
648 LLQuaternion lRot;
649 lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w);
650
651 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalId, m_shape, lPos, m_flags, m_uuid, OwnerID,
652 m_text, ParentID, this.m_particleSystem, lRot);
653 }
654
655 /// <summary>
656 ///
657 /// </summary>
658 public void SendFullUpdateToAllClients()
659 {
660 List<ScenePresence> avatars = m_scene.RequestAvatarList();
661 for (int i = 0; i < avatars.Count; i++)
662 {
663 SendFullUpdateToClient(avatars[i].ControllingClient);
664 }
665 }
666
667 /// <summary>
668 ///
669 /// </summary>
670 /// <param name="remoteClient"></param>
671 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
672 {
673
674 SendTerseUpdateToClient(remoteClient);
675 for (int i = 0; i < m_children.Count; i++)
676 {
677 if (m_children[i] is Primitive)
678 {
679 ((Primitive)m_children[i]).SendTerseUpdateForAllChildren(remoteClient);
680 }
681 }
682 }
683
684 /// <summary>
685 ///
686 /// </summary>
687 /// <param name="RemoteClient"></param>
688 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
689 {
690 LLVector3 lPos;
691 Quaternion lRot;
692
693 lPos = AbsolutePosition;
694 lRot = Rotation;
695
696 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
697 RemoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalId, lPos, mRot);
698 }
699
700 /// <summary>
701 ///
702 /// </summary>
703 public void SendTerseUpdateToALLClients()
704 {
705 List<ScenePresence> avatars = m_scene.RequestAvatarList();
706 for (int i = 0; i < avatars.Count; i++)
707 {
708 SendTerseUpdateToClient(avatars[i].ControllingClient);
709 }
710 }
711
712 #endregion
713
714 public void TriggerOnPrimCountTainted()
715 {
716 OnPrimCountTainted();
717 }
718
719 public override void SetText(string text, Vector3 color, double alpha)
720 {
721 throw new Exception("The method or operation is not implemented.");
722 }
723 }
724} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index e0fd459..16cd484 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -281,11 +281,9 @@ namespace OpenSim.Region.Environment.Scenes
281 281
282 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); 282 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
283 ((SceneObjectGroup)ent).GetProperites(remoteClient); 283 ((SceneObjectGroup)ent).GetProperites(remoteClient);
284
285 } 284 }
286 } 285 }
287 } 286 }
288
289 } 287 }
290 } 288 }
291 } 289 }
@@ -301,7 +299,6 @@ namespace OpenSim.Region.Environment.Scenes
301 { 299 {
302 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 300 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
303 301
304
305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 302 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
306 { 303 {
307 //currently following code not used (or don't know of any case of destination being zero 304 //currently following code not used (or don't know of any case of destination being zero
@@ -421,8 +418,6 @@ namespace OpenSim.Region.Environment.Scenes
421 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 418 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
422 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 419 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
423 } 420 }
424
425
426 } 421 }
427 422
428} 423}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 49ba655..1fca719 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -513,13 +513,7 @@ namespace OpenSim.Region.Environment.Scenes
513 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 513 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
514 } 514 }
515 515
516 /// <summary> 516
517 /// Loads a specific object from storage
518 /// </summary>
519 /// <param name="prim">The object to load</param>
520 public void PrimFromStorage(PrimData prim)
521 {
522 }
523 517
524 /// <summary> 518 /// <summary>
525 /// Returns a new unallocated primitive ID 519 /// Returns a new unallocated primitive ID
@@ -603,7 +597,7 @@ namespace OpenSim.Region.Environment.Scenes
603 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to 597 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to
604 /// </summary> 598 /// </summary>
605 /// <param name="prim"></param> 599 /// <param name="prim"></param>
606 public void AcknowledgeNewPrim(Primitive prim) 600 public void AcknowledgeNewPrim(SceneObjectGroup prim)
607 { 601 {
608 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; 602 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
609 } 603 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
deleted file mode 100644
index 6f06b5a..0000000
--- a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
+++ /dev/null
@@ -1,319 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.Collections.Generic;
29using System.Text;
30using System.IO;
31using System.Xml;
32using System.Xml.Serialization;
33using libsecondlife;
34using libsecondlife.Packets;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types;
37using OpenSim.Physics.Manager;
38
39namespace OpenSim.Region.Environment.Scenes
40{
41 public class SceneObjectOLD : EntityBase
42 {
43 private Encoding enc = Encoding.ASCII;
44 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
45 public Primitive rootPrimitive;
46 protected ulong m_regionHandle;
47
48 private EventManager m_eventManager;
49
50 public bool isSelected = false;
51
52 public LLUUID rootUUID
53 {
54 get
55 {
56 this.m_uuid = this.rootPrimitive.m_uuid;
57 return this.m_uuid;
58 }
59 }
60
61 public uint rootLocalID
62 {
63 get
64 {
65 this.m_localId = this.rootPrimitive.LocalId;
66 return this.LocalId;
67 }
68 }
69
70 public int primCount
71 {
72 get
73 {
74 return this.ChildPrimitives.Count;
75 }
76 }
77
78 public Dictionary<LLUUID, Primitive> Children
79 {
80 get
81 {
82 return this.ChildPrimitives;
83 }
84 }
85
86 /// <summary>
87 ///
88 /// </summary>
89 public SceneObjectOLD(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
90 {
91 m_regionHandle = world.RegionInfo.RegionHandle;
92 m_scene = world;
93 m_eventManager = eventManager;
94
95 this.AbsolutePosition = pos;
96 this.CreateRootFromShape(ownerID, localID, shape, pos);
97
98 registerEvents();
99 }
100
101 /// <summary>
102 ///
103 /// </summary>
104 /// <remarks>Need a null constructor for duplication</remarks>
105 public SceneObjectOLD()
106 {
107
108 }
109
110 public void registerEvents()
111 {
112 m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup);
113 m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
114 }
115
116 public void unregisterEvents()
117 {
118 m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup);
119 m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
120 }
121
122 /// <summary>
123 /// Processes backup
124 /// </summary>
125 /// <param name="datastore"></param>
126 public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore)
127 {
128 // datastore.StoreObject(this);
129 }
130
131 /// <summary>
132 /// Sends my primitive info to the land manager for it to keep tally of all of the prims!
133 /// </summary>
134 private void ProcessParcelPrimCountUpdate()
135 {
136
137 // m_eventManager.TriggerParcelPrimCountAdd(this);
138 }
139
140 /// <summary>
141 ///
142 /// </summary>
143 /// <param name="addPacket"></param>
144 /// <param name="agentID"></param>
145 /// <param name="localID"></param>
146 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
147 {
148
149 // this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_scene, agentID, localID, true, this, this, shape, pos);
150 this.m_children.Add(rootPrimitive);
151
152 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
153 }
154
155 /// <summary>
156 ///
157 /// </summary>
158 /// <param name="data"></param>
159 public void CreateFromBytes(byte[] data)
160 {
161
162 }
163
164 /// <summary>
165 /// Makes a copy of this SceneObject (and child primitives)
166 /// </summary>
167 /// <returns>A complete copy of the object</returns>
168 public new SceneObjectOLD Copy()
169 {
170 SceneObjectOLD dupe = new SceneObjectOLD();
171
172 dupe.m_scene = this.m_scene;
173 dupe.m_eventManager = this.m_eventManager;
174 dupe.m_regionHandle = this.m_regionHandle;
175 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
176 dupe.rootPrimitive = newRoot;
177
178 dupe.m_children.Add(dupe.rootPrimitive);
179 dupe.rootPrimitive.AbsolutePosition = this.AbsolutePosition;
180 dupe.Rotation = this.Rotation;
181 dupe.LocalId = m_scene.PrimIDAllocate();
182
183 dupe.registerEvents();
184 return dupe;
185 }
186
187 /// <summary>
188 ///
189 /// </summary>
190 public void Serialise()
191 {
192
193 }
194
195 /// <summary>
196 ///
197 /// </summary>
198 public void DeleteAllChildren()
199 {
200 this.m_children.Clear();
201 this.ChildPrimitives.Clear();
202 this.rootPrimitive = null;
203 unregisterEvents();
204 }
205
206 /// <summary>
207 ///
208 /// </summary>
209 /// <param name="primObject"></param>
210 public void AddNewChildPrims(SceneObjectOLD primObject)
211 {
212 this.rootPrimitive.AddNewChildren(primObject);
213 }
214
215 public void AddChildToList(Primitive prim)
216 {
217 if (!this.ChildPrimitives.ContainsKey(prim.m_uuid))
218 {
219 this.ChildPrimitives.Add(prim.m_uuid, prim);
220 }
221 }
222 /// <summary>
223 ///
224 /// </summary>
225 /// <param name="primID"></param>
226 /// <returns></returns>
227 public Primitive HasChildPrim(LLUUID primID)
228 {
229 if (this.ChildPrimitives.ContainsKey(primID))
230 {
231 return this.ChildPrimitives[primID];
232 }
233
234 return null;
235 }
236
237 /// <summary>
238 ///
239 /// </summary>
240 /// <param name="localID"></param>
241 /// <returns></returns>
242 public Primitive HasChildPrim(uint localID)
243 {
244 Primitive returnPrim = null;
245 foreach (Primitive prim in this.ChildPrimitives.Values)
246 {
247 if (prim.LocalId == localID)
248 {
249 returnPrim = prim;
250 break;
251 }
252 }
253 return returnPrim;
254 }
255
256 public void SendAllChildPrimsToClient(IClientAPI client)
257 {
258 this.rootPrimitive.SendFullUpdateForAllChildren(client);
259 }
260
261 /// <summary>
262 ///
263 /// </summary>
264 public override void BackUp()
265 {
266
267 }
268
269 /// <summary>
270 ///
271 /// </summary>
272 /// <param name="offset"></param>
273 /// <param name="pos"></param>
274 /// <param name="remoteClient"></param>
275 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
276 {
277 this.rootPrimitive.AbsolutePosition = pos;
278 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
279 }
280
281 /// <summary>
282 ///
283 /// </summary>
284 /// <param name="client"></param>
285 public void GetProperites(IClientAPI client)
286 {
287 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
288 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
289 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
290 proper.ObjectData[0].ItemID = LLUUID.Zero;
291 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
292 proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID;
293 proper.ObjectData[0].FolderID = LLUUID.Zero;
294 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
295 proper.ObjectData[0].GroupID = LLUUID.Zero;
296 proper.ObjectData[0].InventorySerial = 0;
297 proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID;
298 proper.ObjectData[0].ObjectID = this.rootUUID;
299 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
300 proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0");
301 proper.ObjectData[0].TextureID = new byte[0];
302 proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0");
303 proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0");
304 proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0");
305 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
306 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask;
307 proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask;
308 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask;
309 proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask;
310
311 client.OutPacket(proper);
312 }
313
314 public override void SetText(string text, Axiom.Math.Vector3 color, double alpha)
315 {
316 throw new System.Exception("The method or operation is not implemented.");
317 }
318 }
319}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index b3e3fe3..2fd7b57 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -14,7 +14,7 @@ using OpenSim.Framework.Data;
14 14
15namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
16{ 16{
17 // public delegate void PrimCountTaintedDelegate(); 17 public delegate void PrimCountTaintedDelegate();
18 18
19 public class SceneObjectGroup : EntityBase 19 public class SceneObjectGroup : EntityBase
20 { 20 {
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
index 97b1ada..80d77f2 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Scripting.Examples
51 }*/ 51 }*/
52 } 52 }
53 53
54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim) 54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim)
55 { 55 {
56 /*string desc = prim.Description; 56 /*string desc = prim.Description;
57 string name = prim.Name; 57 string name = prim.Name;