aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-07-09 15:29:39 +0000
committerAdam Frisby2007-07-09 15:29:39 +0000
commite8acf1cca92592fea38208dbfe4137555431434d (patch)
tree4d8b6353f1baab805b17caec835d93ee0ef6817e
parent* reverted rev 1200 waiting for info re animations.xml (diff)
downloadopensim-SC-e8acf1cca92592fea38208dbfe4137555431434d.zip
opensim-SC-e8acf1cca92592fea38208dbfe4137555431434d.tar.gz
opensim-SC-e8acf1cca92592fea38208dbfe4137555431434d.tar.bz2
opensim-SC-e8acf1cca92592fea38208dbfe4137555431434d.tar.xz
* Begun work on Primitive Duplication. Not hooked up yet, but theoretically could be done so. In practice, more work needs to be done.
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs1
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs35
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs33
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs28
8 files changed, 140 insertions, 2 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index acacabe..206122d 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -59,6 +59,7 @@ namespace OpenSim.Framework.Interfaces
59 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); 59 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
60 public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); 60 public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
61 public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient); 61 public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient);
62 public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags);
62 public delegate void StatusChange(bool status); 63 public delegate void StatusChange(bool status);
63 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); 64 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
64 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); 65 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
@@ -92,6 +93,7 @@ namespace OpenSim.Framework.Interfaces
92 event UpdateAgent OnAgentUpdate; 93 event UpdateAgent OnAgentUpdate;
93 event GenericCall OnRequestAvatarsData; 94 event GenericCall OnRequestAvatarsData;
94 event GenericCall4 OnAddPrim; 95 event GenericCall4 OnAddPrim;
96 event ObjectDuplicate OnObjectDuplicate;
95 event UpdateVector OnGrapObject; 97 event UpdateVector OnGrapObject;
96 event ObjectSelect OnDeGrapObject; 98 event ObjectSelect OnDeGrapObject;
97 event MoveObject OnGrapUpdate; 99 event MoveObject OnGrapUpdate;
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index cefe856..3c1df75 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.ClientStack
55 public event LinkObjects OnLinkObjects; 55 public event LinkObjects OnLinkObjects;
56 public event UpdateVector OnGrapObject; 56 public event UpdateVector OnGrapObject;
57 public event ObjectSelect OnDeGrapObject; 57 public event ObjectSelect OnDeGrapObject;
58 public event ObjectDuplicate OnObjectDuplicate;
58 public event MoveObject OnGrapUpdate; 59 public event MoveObject OnGrapUpdate;
59 public event GenericCall4 OnAddPrim; 60 public event GenericCall4 OnAddPrim;
60 public event UpdateShape OnUpdatePrimShape; 61 public event UpdateShape OnUpdatePrimShape;
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index def14c7..982ae50 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -233,6 +233,18 @@ namespace OpenSim.Region.ClientStack
233 } 233 }
234 } 234 }
235 break; 235 break;
236 case PacketType.ObjectDuplicate:
237 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
238 for (int i = 0; i < dupe.ObjectData.Length; i++)
239 {
240 if (OnObjectDuplicate != null)
241 {
242 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags);
243 }
244 }
245
246 break;
247
236 case PacketType.ObjectSelect: 248 case PacketType.ObjectSelect:
237 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 249 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
238 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 250 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 99ca021..7914bab 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -74,6 +74,7 @@ namespace OpenSim.Region.Environment.Scenes
74 public uint LocalId 74 public uint LocalId
75 { 75 {
76 get { return m_localId; } 76 get { return m_localId; }
77 set { m_localId = value; }
77 } 78 }
78 79
79 /// <summary> 80 /// <summary>
@@ -122,6 +123,15 @@ namespace OpenSim.Region.Environment.Scenes
122 } 123 }
123 124
124 /// <summary> 125 /// <summary>
126 /// Copies the entity
127 /// </summary>
128 /// <returns></returns>
129 public virtual EntityBase Copy()
130 {
131 return (EntityBase)this.MemberwiseClone();
132 }
133
134 /// <summary>
125 /// Infoms the entity that the land (heightmap) has changed 135 /// Infoms the entity that the land (heightmap) has changed
126 /// </summary> 136 /// </summary>
127 public virtual void LandRenegerated() 137 public virtual void LandRenegerated()
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 9d01618..8d31d63 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -141,8 +141,43 @@ namespace OpenSim.Region.Environment.Scenes
141 this.CreateFromPacket(addPacket, ownerID, localID); 141 this.CreateFromPacket(addPacket, ownerID, localID);
142 this.rotation = Axiom.Math.Quaternion.Identity; 142 this.rotation = Axiom.Math.Quaternion.Identity;
143 } 143 }
144
145 /// <summary>
146 ///
147 /// </summary>
148 /// <remarks>Empty constructor for duplication</remarks>
149 public Primitive()
150 {
151
152 }
153
144 #endregion 154 #endregion
145 155
156 #region Duplication
157
158 public Primitive Copy(EntityBase parent, SceneObject rootParent)
159 {
160 Primitive dupe = (Primitive)this.MemberwiseClone();
161 // TODO: Copy this properly.
162 dupe.inventoryItems = this.inventoryItems;
163 dupe.m_Parent = parent;
164 dupe.m_RootParent = rootParent;
165 // TODO: Copy this properly.
166 dupe.m_Shape = this.m_Shape;
167
168 uint newLocalID = this.m_world.PrimIDAllocate();
169 dupe.LocalId = newLocalID;
170
171 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z);
172 dupe.rotation = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z);
173 dupe.Pos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
174
175 return dupe;
176 }
177
178 #endregion
179
180
146 #region Override from EntityBase 181 #region Override from EntityBase
147 /// <summary> 182 /// <summary>
148 /// 183 ///
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index e078348..35e0ea6 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -215,6 +215,39 @@ namespace OpenSim.Region.Environment.Scenes
215 /// <summary> 215 /// <summary>
216 /// 216 ///
217 /// </summary> 217 /// </summary>
218 /// <param name="originalPrim"></param>
219 /// <param name="offset"></param>
220 /// <param name="flags"></param>
221 public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags)
222 {
223 SceneObject originPrim = null;
224 foreach (EntityBase ent in Entities.Values)
225 {
226 if (ent is SceneObject)
227 {
228 if (((SceneObject)ent).rootLocalID == originalPrim)
229 {
230 originPrim = (SceneObject)ent;
231 break;
232 }
233 }
234 }
235
236 if (originPrim != null)
237 {
238 //SceneObject copy = originPrim.Copy();
239
240 }
241 else
242 {
243 OpenSim.Framework.Console.MainLog.Instance.Warn("Attempted to duplicate nonexistant prim");
244 }
245
246 }
247
248 /// <summary>
249 ///
250 /// </summary>
218 /// <param name="parentPrim"></param> 251 /// <param name="parentPrim"></param>
219 /// <param name="childPrims"></param> 252 /// <param name="childPrims"></param>
220 public void LinkObjects(uint parentPrim, List<uint> childPrims) 253 public void LinkObjects(uint parentPrim, List<uint> childPrims)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index fdf3cc8..1798cba 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Environment.Scenes
57 private float timeStep = 0.1f; 57 private float timeStep = 0.1f;
58 private Random Rand = new Random(); 58 private Random Rand = new Random();
59 private uint _primCount = 702000; 59 private uint _primCount = 702000;
60 private System.Threading.Mutex _primAllocateMutex = new Mutex(false);
60 private int storageCount; 61 private int storageCount;
61 private Mutex updateLock; 62 private Mutex updateLock;
62 63
@@ -397,6 +398,22 @@ namespace OpenSim.Region.Environment.Scenes
397 } 398 }
398 399
399 /// <summary> 400 /// <summary>
401 /// Returns a new unallocated primitive ID
402 /// </summary>
403 /// <returns>A brand new primitive ID</returns>
404 public uint PrimIDAllocate()
405 {
406 uint myID;
407
408 _primAllocateMutex.WaitOne();
409 ++_primCount;
410 myID = _primCount;
411 _primAllocateMutex.ReleaseMutex();
412
413 return myID;
414 }
415
416 /// <summary>
400 /// 417 ///
401 /// </summary> 418 /// </summary>
402 /// <param name="addPacket"></param> 419 /// <param name="addPacket"></param>
@@ -415,9 +432,8 @@ namespace OpenSim.Region.Environment.Scenes
415 { 432 {
416 try 433 try
417 { 434 {
418 SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount); 435 SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this.PrimIDAllocate());
419 this.Entities.Add(sceneOb.rootUUID, sceneOb); 436 this.Entities.Add(sceneOb.rootUUID, sceneOb);
420 this._primCount++;
421 437
422 // Trigger event for listeners 438 // Trigger event for listeners
423 // eventManager.TriggerOnNewPrimitive(prim); 439 // eventManager.TriggerOnNewPrimitive(prim);
@@ -468,6 +484,7 @@ namespace OpenSim.Region.Environment.Scenes
468 client.OnObjectDescription += this.PrimDescription; 484 client.OnObjectDescription += this.PrimDescription;
469 client.OnObjectName += this.PrimName; 485 client.OnObjectName += this.PrimName;
470 client.OnLinkObjects += this.LinkObjects; 486 client.OnLinkObjects += this.LinkObjects;
487 client.OnObjectDuplicate += this.DuplicateObject;
471 488
472 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 489 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
473 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); 490 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 452502b..2b80d57 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -78,6 +78,15 @@ namespace OpenSim.Region.Environment.Scenes
78 /// <summary> 78 /// <summary>
79 /// 79 ///
80 /// </summary> 80 /// </summary>
81 /// <remarks>Need a null constructor for duplication</remarks>
82 public SceneObject()
83 {
84
85 }
86
87 /// <summary>
88 ///
89 /// </summary>
81 /// <param name="addPacket"></param> 90 /// <param name="addPacket"></param>
82 /// <param name="agentID"></param> 91 /// <param name="agentID"></param>
83 /// <param name="localID"></param> 92 /// <param name="localID"></param>
@@ -100,6 +109,25 @@ namespace OpenSim.Region.Environment.Scenes
100 /// <summary> 109 /// <summary>
101 /// 110 ///
102 /// </summary> 111 /// </summary>
112 /// <returns>A complete copy of the object</returns>
113 public SceneObject Copy()
114 {
115 SceneObject dupe = new SceneObject();
116
117 Primitive newRoot = this.rootPrimitive.Copy((EntityBase)dupe, dupe);
118
119 foreach (EntityBase child in this.children)
120 {
121 EntityBase newChild = child.Copy();
122 dupe.children.Add(newChild);
123 }
124
125 return dupe;
126 }
127
128 /// <summary>
129 ///
130 /// </summary>
103 public void DeleteAllChildren() 131 public void DeleteAllChildren()
104 { 132 {
105 this.children.Clear(); 133 this.children.Clear();