aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorMW2007-07-13 19:01:09 +0000
committerMW2007-07-13 19:01:09 +0000
commit401af6ad4a16a39e1460abaf30df1a1170069087 (patch)
tree1c40aa36b6f33ce1ff01183dd5c74f584cb358cd /OpenSim/Region/Environment/Scenes
parent* Fixed bug reported by xyzo - region assets are now stored in "regionassets.... (diff)
downloadopensim-SC-401af6ad4a16a39e1460abaf30df1a1170069087.zip
opensim-SC-401af6ad4a16a39e1460abaf30df1a1170069087.tar.gz
opensim-SC-401af6ad4a16a39e1460abaf30df1a1170069087.tar.bz2
opensim-SC-401af6ad4a16a39e1460abaf30df1a1170069087.tar.xz
Prim Copying (both CTRL+D and shift-drag) should now work.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs84
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs8
3 files changed, 66 insertions, 44 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index ab50373..e20870f 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -163,21 +163,33 @@ namespace OpenSim.Region.Environment.Scenes
163 dupe.inventoryItems = this.inventoryItems; 163 dupe.inventoryItems = this.inventoryItems;
164 dupe.m_Parent = parent; 164 dupe.m_Parent = parent;
165 dupe.m_RootParent = rootParent; 165 dupe.m_RootParent = rootParent;
166 // TODO: Copy this properly. 166
167 dupe.m_Shape = this.m_Shape.Copy(); 167 dupe.m_Shape = this.m_Shape.Copy();
168 dupe.children = new List<EntityBase>(); 168 dupe.children = new List<EntityBase>();
169 uint newLocalID = this.m_world.PrimIDAllocate(); 169 uint newLocalID = this.m_world.PrimIDAllocate();
170 dupe.uuid = LLUUID.Random(); 170 dupe.uuid = LLUUID.Random();
171 dupe.LocalId = newLocalID; 171 dupe.LocalId = newLocalID;
172 dupe.m_regionHandle = this.m_regionHandle;
173
174 if (parent is SceneObject)
175 {
176 dupe.m_isRootPrim = true;
177 dupe.ParentID = 0;
178 }
179 else
180 {
181 dupe.m_isRootPrim = false;
182 dupe.ParentID = ((Primitive)parent).LocalId;
183 }
172 184
173 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); 185 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z);
174 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 186 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
175 dupe.Pos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 187 dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z);
176 rootParent.AddChildToList(dupe); 188 rootParent.AddChildToList(dupe);
177 189
178 foreach (Primitive prim in this.children) 190 foreach (Primitive prim in this.children)
179 { 191 {
180 Primitive primClone = prim.Copy(this, rootParent); 192 Primitive primClone = prim.Copy(dupe, rootParent);
181 dupe.children.Add(primClone); 193 dupe.children.Add(primClone);
182 } 194 }
183 195
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 14bf87c..b86e5c8 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
139 /// <param name="fromAgentID"></param> 139 /// <param name="fromAgentID"></param>
140 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 140 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
141 { 141 {
142 // Console.WriteLine("Chat message"); 142 // Console.WriteLine("Chat message");
143 ScenePresence avatar = null; 143 ScenePresence avatar = null;
144 144
145 m_clientManager.ForEachClient(delegate(IClientAPI client) 145 m_clientManager.ForEachClient(delegate(IClientAPI client)
@@ -149,7 +149,7 @@ namespace OpenSim.Region.Environment.Scenes
149 { 149 {
150 avatar = this.Avatars[client.AgentId]; 150 avatar = this.Avatars[client.AgentId];
151 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); 151 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
152 dis = (int) avatar.Pos.GetDistanceTo(fromPos); 152 dis = (int)avatar.Pos.GetDistanceTo(fromPos);
153 //Console.WriteLine("found avatar at " +dis); 153 //Console.WriteLine("found avatar at " +dis);
154 } 154 }
155 155
@@ -194,7 +194,7 @@ namespace OpenSim.Region.Environment.Scenes
194 /// <param name="pos"></param> 194 /// <param name="pos"></param>
195 public void RezObject(AssetBase primAsset, LLVector3 pos) 195 public void RezObject(AssetBase primAsset, LLVector3 pos)
196 { 196 {
197 197
198 } 198 }
199 199
200 /// <summary> 200 /// <summary>
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Environment.Scenes
204 /// <param name="simClient"></param> 204 /// <param name="simClient"></param>
205 public void DeRezObject(Packet packet, IClientAPI simClient) 205 public void DeRezObject(Packet packet, IClientAPI simClient)
206 { 206 {
207 207
208 } 208 }
209 209
210 /// <summary> 210 /// <summary>
@@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
213 /// <param name="remoteClient"></param> 213 /// <param name="remoteClient"></param>
214 public void SendAvatarsToClient(IClientAPI remoteClient) 214 public void SendAvatarsToClient(IClientAPI remoteClient)
215 { 215 {
216 216
217 } 217 }
218 218
219 /// <summary> 219 /// <summary>
@@ -239,7 +239,15 @@ namespace OpenSim.Region.Environment.Scenes
239 239
240 if (originPrim != null) 240 if (originPrim != null)
241 { 241 {
242 //SceneObject copy = originPrim.Copy(); 242 SceneObject copy = originPrim.Copy();
243 copy.Pos = copy.Pos + offset;
244 this.Entities.Add(copy.rootUUID, copy);
245
246 List<ScenePresence> avatars = this.RequestAvatarList();
247 for (int i = 0; i < avatars.Count; i++)
248 {
249 copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
250 }
243 251
244 } 252 }
245 else 253 else
@@ -256,7 +264,7 @@ namespace OpenSim.Region.Environment.Scenes
256 /// <param name="childPrims"></param> 264 /// <param name="childPrims"></param>
257 public void LinkObjects(uint parentPrim, List<uint> childPrims) 265 public void LinkObjects(uint parentPrim, List<uint> childPrims)
258 { 266 {
259 SceneObject parenPrim = null; 267 SceneObject parenPrim = null;
260 foreach (EntityBase ent in Entities.Values) 268 foreach (EntityBase ent in Entities.Values)
261 { 269 {
262 if (ent is SceneObject) 270 if (ent is SceneObject)
@@ -328,7 +336,7 @@ namespace OpenSim.Region.Environment.Scenes
328 { 336 {
329 if (((SceneObject)ent).rootLocalID == primLocalID) 337 if (((SceneObject)ent).rootLocalID == primLocalID)
330 { 338 {
331 ((SceneObject)ent).GetProperites(remoteClient); 339 ((SceneObject)ent).GetProperites(remoteClient);
332 break; 340 break;
333 } 341 }
334 } 342 }
@@ -342,7 +350,7 @@ namespace OpenSim.Region.Environment.Scenes
342 /// <param name="description"></param> 350 /// <param name="description"></param>
343 public void PrimDescription(uint primLocalID, string description) 351 public void PrimDescription(uint primLocalID, string description)
344 { 352 {
345 Primitive prim = null; 353 Primitive prim = null;
346 foreach (EntityBase ent in Entities.Values) 354 foreach (EntityBase ent in Entities.Values)
347 { 355 {
348 if (ent is SceneObject) 356 if (ent is SceneObject)
@@ -350,7 +358,7 @@ namespace OpenSim.Region.Environment.Scenes
350 prim = ((SceneObject)ent).HasChildPrim(primLocalID); 358 prim = ((SceneObject)ent).HasChildPrim(primLocalID);
351 if (prim != null) 359 if (prim != null)
352 { 360 {
353 prim.Description = description; 361 prim.Description = description;
354 break; 362 break;
355 } 363 }
356 } 364 }
@@ -381,19 +389,19 @@ namespace OpenSim.Region.Environment.Scenes
381 389
382 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 390 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
383 { 391 {
384 Primitive prim = null; 392 Primitive prim = null;
385 foreach (EntityBase ent in Entities.Values) 393 foreach (EntityBase ent in Entities.Values)
386 { 394 {
387 if (ent is SceneObject) 395 if (ent is SceneObject)
388 { 396 {
389 prim = ((SceneObject)ent).HasChildPrim(objectID); 397 prim = ((SceneObject)ent).HasChildPrim(objectID);
390 if (prim != null) 398 if (prim != null)
391 { 399 {
392 ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); 400 ((SceneObject)ent).GrapMovement(offset, pos, remoteClient);
393 break; 401 break;
394 } 402 }
395 } 403 }
396 } 404 }
397 /* 405 /*
398 if (this.Entities.ContainsKey(objectID)) 406 if (this.Entities.ContainsKey(objectID))
399 { 407 {
@@ -412,7 +420,7 @@ namespace OpenSim.Region.Environment.Scenes
412 /// <param name="remoteClient"></param> 420 /// <param name="remoteClient"></param>
413 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) 421 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
414 { 422 {
415 423
416 } 424 }
417 425
418 /// <summary> 426 /// <summary>
@@ -423,18 +431,18 @@ namespace OpenSim.Region.Environment.Scenes
423 /// <param name="remoteClient"></param> 431 /// <param name="remoteClient"></param>
424 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) 432 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
425 { 433 {
426 Primitive prim = null; 434 Primitive prim = null;
427 foreach (EntityBase ent in Entities.Values) 435 foreach (EntityBase ent in Entities.Values)
428 { 436 {
429 if (ent is SceneObject) 437 if (ent is SceneObject)
430 { 438 {
431 prim = ((SceneObject)ent).HasChildPrim(localID); 439 prim = ((SceneObject)ent).HasChildPrim(localID);
432 if (prim != null) 440 if (prim != null)
433 { 441 {
434 prim.UpdateTextureEntry(texture); 442 prim.UpdateTextureEntry(texture);
435 } 443 }
436 } 444 }
437 } 445 }
438 } 446 }
439 447
440 /// <summary> 448 /// <summary>
@@ -494,7 +502,7 @@ namespace OpenSim.Region.Environment.Scenes
494 prim = ((SceneObject)ent).HasChildPrim(localID); 502 prim = ((SceneObject)ent).HasChildPrim(localID);
495 if (prim != null) 503 if (prim != null)
496 { 504 {
497 prim.UpdateGroupMouseRotation( pos, rot); 505 prim.UpdateGroupMouseRotation(pos, rot);
498 break; 506 break;
499 } 507 }
500 } 508 }
@@ -532,7 +540,7 @@ namespace OpenSim.Region.Environment.Scenes
532 /// <param name="remoteClient"></param> 540 /// <param name="remoteClient"></param>
533 public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) 541 public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
534 { 542 {
535 //Console.WriteLine("trying to update single prim rotation"); 543 //Console.WriteLine("trying to update single prim rotation");
536 Primitive prim = null; 544 Primitive prim = null;
537 foreach (EntityBase ent in Entities.Values) 545 foreach (EntityBase ent in Entities.Values)
538 { 546 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index e979186..d507a98 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -117,11 +117,13 @@ namespace OpenSim.Region.Environment.Scenes
117 117
118 dupe.m_world = this.m_world; 118 dupe.m_world = this.m_world;
119 dupe.m_regionHandle = this.m_regionHandle; 119 dupe.m_regionHandle = this.m_regionHandle;
120 Primitive newRoot = this.rootPrimitive.Copy((EntityBase)dupe, dupe); 120 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
121 dupe.rootPrimitive = newRoot; 121 dupe.rootPrimitive = newRoot;
122 dupe.rootPrimitive.Pos =( this.Pos + new LLVector3(0,0,1)); 122 dupe.children.Add(dupe.rootPrimitive);
123 dupe.rootPrimitive.Pos = this.Pos;
123 dupe.Rotation = this.Rotation; 124 dupe.Rotation = this.Rotation;
124 125 LLUUID rootu= dupe.rootUUID;
126 uint rooti = dupe.rootLocalID;
125 return dupe; 127 return dupe;
126 } 128 }
127 129