aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-28 00:40:33 +0100
committerJustin Clark-Casey (justincc)2010-08-28 00:40:33 +0100
commit1c0b4457cdcd543f04bc818a987f6e3f2311098d (patch)
tree56b6a949423b5ca0f54b2c200e037052a9ac3ff0 /OpenSim
parentminor: reduce log chattiness of "load iar" for IARs with lots of folders (diff)
downloadopensim-SC-1c0b4457cdcd543f04bc818a987f6e3f2311098d.zip
opensim-SC-1c0b4457cdcd543f04bc818a987f6e3f2311098d.tar.gz
opensim-SC-1c0b4457cdcd543f04bc818a987f6e3f2311098d.tar.bz2
opensim-SC-1c0b4457cdcd543f04bc818a987f6e3f2311098d.tar.xz
Improve liveness by operating on list copies of SOG.Children where appropriate
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs57
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs515
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs51
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs50
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs22
9 files changed, 384 insertions, 371 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index e8a26b5..b5f9a8e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -349,7 +349,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
349 public void TestLoadIarPathStartsWithSlash() 349 public void TestLoadIarPathStartsWithSlash()
350 { 350 {
351 TestHelper.InMethod(); 351 TestHelper.InMethod();
352 log4net.Config.XmlConfigurator.Configure(); 352// log4net.Config.XmlConfigurator.Configure();
353 353
354 SerialiserModule serialiserModule = new SerialiserModule(); 354 SerialiserModule serialiserModule = new SerialiserModule();
355 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 355 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 1623e6e..1fba6c2 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -243,39 +243,40 @@ namespace OpenSim.Region.CoreModules.World.Archiver
243 // to the same scene (when this is possible). 243 // to the same scene (when this is possible).
244 sceneObject.ResetIDs(); 244 sceneObject.ResetIDs();
245 245
246 List<SceneObjectPart> partList = null;
246 lock (sceneObject.Children) 247 lock (sceneObject.Children)
248 partList = new List<SceneObjectPart>(sceneObject.Children.Values);
249
250 foreach (SceneObjectPart part in partList)
247 { 251 {
248 foreach (SceneObjectPart part in sceneObject.Children.Values) 252 if (!ResolveUserUuid(part.CreatorID))
253 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
254
255 if (!ResolveUserUuid(part.OwnerID))
256 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
257
258 if (!ResolveUserUuid(part.LastOwnerID))
259 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
260
261 // And zap any troublesome sit target information
262 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
263 part.SitTargetPosition = new Vector3(0, 0, 0);
264
265 // Fix ownership/creator of inventory items
266 // Not doing so results in inventory items
267 // being no copy/no mod for everyone
268 lock (part.TaskInventory)
249 { 269 {
250 if (!ResolveUserUuid(part.CreatorID)) 270 TaskInventoryDictionary inv = part.TaskInventory;
251 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 271 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
252
253 if (!ResolveUserUuid(part.OwnerID))
254 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
255
256 if (!ResolveUserUuid(part.LastOwnerID))
257 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
258
259 // And zap any troublesome sit target information
260 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
261 part.SitTargetPosition = new Vector3(0, 0, 0);
262
263 // Fix ownership/creator of inventory items
264 // Not doing so results in inventory items
265 // being no copy/no mod for everyone
266 lock (part.TaskInventory)
267 { 272 {
268 TaskInventoryDictionary inv = part.TaskInventory; 273 if (!ResolveUserUuid(kvp.Value.OwnerID))
269 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 274 {
275 kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
276 }
277 if (!ResolveUserUuid(kvp.Value.CreatorID))
270 { 278 {
271 if (!ResolveUserUuid(kvp.Value.OwnerID)) 279 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
272 {
273 kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
274 }
275 if (!ResolveUserUuid(kvp.Value.CreatorID))
276 {
277 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
278 }
279 } 280 }
280 } 281 }
281 } 282 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 2f70c0a..57eff8a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -228,280 +228,281 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
228 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 228 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
229 Color mapdotspot = Color.Gray; // Default color when prim color is white 229 Color mapdotspot = Color.Gray; // Default color when prim color is white
230 230
231 // Loop over prim in group 231 // Loop over prim in group
232 List<SceneObjectPart> partList = null;
232 lock (mapdot.Children) 233 lock (mapdot.Children)
234 partList = new List<SceneObjectPart>(mapdot.Children.Values);
235
236 foreach (SceneObjectPart part in partList)
233 { 237 {
234 foreach (SceneObjectPart part in mapdot.Children.Values) 238 if (part == null)
239 continue;
240
241 // Draw if the object is at least 1 meter wide in any direction
242 if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
235 { 243 {
236 if (part == null) 244 // Try to get the RGBA of the default texture entry..
237 continue; 245 //
238 246 try
239 // Draw if the object is at least 1 meter wide in any direction
240 if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
241 { 247 {
242 // Try to get the RGBA of the default texture entry.. 248 // get the null checks out of the way
243 // 249 // skip the ones that break
244 try 250 if (part == null)
251 continue;
252
253 if (part.Shape == null)
254 continue;
255
256 if (part.Shape.PCode == (byte)PCode.Tree || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Grass)
257 continue; // eliminates trees from this since we don't really have a good tree representation
258 // if you want tree blocks on the map comment the above line and uncomment the below line
259 //mapdotspot = Color.PaleGreen;
260
261 Primitive.TextureEntry textureEntry = part.Shape.Textures;
262
263 if (textureEntry == null || textureEntry.DefaultTexture == null)
264 continue;
265
266 Color4 texcolor = textureEntry.DefaultTexture.RGBA;
267
268 // Not sure why some of these are null, oh well.
269
270 int colorr = 255 - (int)(texcolor.R * 255f);
271 int colorg = 255 - (int)(texcolor.G * 255f);
272 int colorb = 255 - (int)(texcolor.B * 255f);
273
274 if (!(colorr == 255 && colorg == 255 && colorb == 255))
245 { 275 {
246 // get the null checks out of the way 276 //Try to set the map spot color
247 // skip the ones that break 277 try
248 if (part == null) 278 {
249 continue; 279 // If the color gets goofy somehow, skip it *shakes fist at Color4
250 280 mapdotspot = Color.FromArgb(colorr, colorg, colorb);
251 if (part.Shape == null) 281 }
252 continue; 282 catch (ArgumentException)
253
254 if (part.Shape.PCode == (byte)PCode.Tree || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Grass)
255 continue; // eliminates trees from this since we don't really have a good tree representation
256 // if you want tree blocks on the map comment the above line and uncomment the below line
257 //mapdotspot = Color.PaleGreen;
258
259 Primitive.TextureEntry textureEntry = part.Shape.Textures;
260
261 if (textureEntry == null || textureEntry.DefaultTexture == null)
262 continue;
263
264 Color4 texcolor = textureEntry.DefaultTexture.RGBA;
265
266 // Not sure why some of these are null, oh well.
267
268 int colorr = 255 - (int)(texcolor.R * 255f);
269 int colorg = 255 - (int)(texcolor.G * 255f);
270 int colorb = 255 - (int)(texcolor.B * 255f);
271
272 if (!(colorr == 255 && colorg == 255 && colorb == 255))
273 { 283 {
274 //Try to set the map spot color
275 try
276 {
277 // If the color gets goofy somehow, skip it *shakes fist at Color4
278 mapdotspot = Color.FromArgb(colorr, colorg, colorb);
279 }
280 catch (ArgumentException)
281 {
282 }
283 } 284 }
284 } 285 }
285 catch (IndexOutOfRangeException) 286 }
286 { 287 catch (IndexOutOfRangeException)
287 // Windows Array 288 {
288 } 289 // Windows Array
289 catch (ArgumentOutOfRangeException) 290 }
290 { 291 catch (ArgumentOutOfRangeException)
291 // Mono Array 292 {
292 } 293 // Mono Array
293 294 }
294 Vector3 pos = part.GetWorldPosition(); 295
295 296 Vector3 pos = part.GetWorldPosition();
296 // skip prim outside of retion 297
297 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) 298 // skip prim outside of retion
298 continue; 299 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f)
299 300 continue;
300 // skip prim in non-finite position 301
301 if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) || 302 // skip prim in non-finite position
302 Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y)) 303 if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) ||
304 Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y))
305 continue;
306
307 // Figure out if object is under 256m above the height of the terrain
308 bool isBelow256AboveTerrain = false;
309
310 try
311 {
312 isBelow256AboveTerrain = (pos.Z < ((float)hm[(int)pos.X, (int)pos.Y] + 256f));
313 }
314 catch (Exception)
315 {
316 }
317
318 if (isBelow256AboveTerrain)
319 {
320 // Translate scale by rotation so scale is represented properly when object is rotated
321 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z);
322 Vector3 scale = new Vector3();
323 Vector3 tScale = new Vector3();
324 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z);
325
326 Quaternion llrot = part.GetWorldRotation();
327 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
328 scale = lscale * rot;
329
330 // negative scales don't work in this situation
331 scale.X = Math.Abs(scale.X);
332 scale.Y = Math.Abs(scale.Y);
333 scale.Z = Math.Abs(scale.Z);
334
335 // This scaling isn't very accurate and doesn't take into account the face rotation :P
336 int mapdrawstartX = (int)(pos.X - scale.X);
337 int mapdrawstartY = (int)(pos.Y - scale.Y);
338 int mapdrawendX = (int)(pos.X + scale.X);
339 int mapdrawendY = (int)(pos.Y + scale.Y);
340
341 // If object is beyond the edge of the map, don't draw it to avoid errors
342 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1)
343 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
344 || mapdrawendY > ((int)Constants.RegionSize - 1))
303 continue; 345 continue;
304 346
305 // Figure out if object is under 256m above the height of the terrain 347#region obb face reconstruction part duex
306 bool isBelow256AboveTerrain = false; 348 Vector3[] vertexes = new Vector3[8];
307 349
308 try 350 // float[] distance = new float[6];
309 { 351 Vector3[] FaceA = new Vector3[6]; // vertex A for Facei
310 isBelow256AboveTerrain = (pos.Z < ((float)hm[(int)pos.X, (int)pos.Y] + 256f)); 352 Vector3[] FaceB = new Vector3[6]; // vertex B for Facei
311 } 353 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
312 catch (Exception) 354 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
355
356 tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
357 scale = ((tScale * rot));
358 vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
359 // vertexes[0].x = pos.X + vertexes[0].x;
360 //vertexes[0].y = pos.Y + vertexes[0].y;
361 //vertexes[0].z = pos.Z + vertexes[0].z;
362
363 FaceA[0] = vertexes[0];
364 FaceB[3] = vertexes[0];
365 FaceA[4] = vertexes[0];
366
367 tScale = lscale;
368 scale = ((tScale * rot));
369 vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
370
371 // vertexes[1].x = pos.X + vertexes[1].x;
372 // vertexes[1].y = pos.Y + vertexes[1].y;
373 //vertexes[1].z = pos.Z + vertexes[1].z;
374
375 FaceB[0] = vertexes[1];
376 FaceA[1] = vertexes[1];
377 FaceC[4] = vertexes[1];
378
379 tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
380 scale = ((tScale * rot));
381
382 vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
383
384 //vertexes[2].x = pos.X + vertexes[2].x;
385 //vertexes[2].y = pos.Y + vertexes[2].y;
386 //vertexes[2].z = pos.Z + vertexes[2].z;
387
388 FaceC[0] = vertexes[2];
389 FaceD[3] = vertexes[2];
390 FaceC[5] = vertexes[2];
391
392 tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
393 scale = ((tScale * rot));
394 vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
395
396 //vertexes[3].x = pos.X + vertexes[3].x;
397 // vertexes[3].y = pos.Y + vertexes[3].y;
398 // vertexes[3].z = pos.Z + vertexes[3].z;
399
400 FaceD[0] = vertexes[3];
401 FaceC[1] = vertexes[3];
402 FaceA[5] = vertexes[3];
403
404 tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
405 scale = ((tScale * rot));
406 vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
407
408 // vertexes[4].x = pos.X + vertexes[4].x;
409 // vertexes[4].y = pos.Y + vertexes[4].y;
410 // vertexes[4].z = pos.Z + vertexes[4].z;
411
412 FaceB[1] = vertexes[4];
413 FaceA[2] = vertexes[4];
414 FaceD[4] = vertexes[4];
415
416 tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
417 scale = ((tScale * rot));
418 vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
419
420 // vertexes[5].x = pos.X + vertexes[5].x;
421 // vertexes[5].y = pos.Y + vertexes[5].y;
422 // vertexes[5].z = pos.Z + vertexes[5].z;
423
424 FaceD[1] = vertexes[5];
425 FaceC[2] = vertexes[5];
426 FaceB[5] = vertexes[5];
427
428 tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
429 scale = ((tScale * rot));
430 vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
431
432 // vertexes[6].x = pos.X + vertexes[6].x;
433 // vertexes[6].y = pos.Y + vertexes[6].y;
434 // vertexes[6].z = pos.Z + vertexes[6].z;
435
436 FaceB[2] = vertexes[6];
437 FaceA[3] = vertexes[6];
438 FaceB[4] = vertexes[6];
439
440 tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
441 scale = ((tScale * rot));
442 vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
443
444 // vertexes[7].x = pos.X + vertexes[7].x;
445 // vertexes[7].y = pos.Y + vertexes[7].y;
446 // vertexes[7].z = pos.Z + vertexes[7].z;
447
448 FaceD[2] = vertexes[7];
449 FaceC[3] = vertexes[7];
450 FaceD[5] = vertexes[7];
451#endregion
452
453 //int wy = 0;
454
455 //bool breakYN = false; // If we run into an error drawing, break out of the
456 // loop so we don't lag to death on error handling
457 DrawStruct ds = new DrawStruct();
458 ds.brush = new SolidBrush(mapdotspot);
459 //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY);
460
461 ds.trns = new face[FaceA.Length];
462
463 for (int i = 0; i < FaceA.Length; i++)
313 { 464 {
465 Point[] working = new Point[5];
466 working[0] = project(FaceA[i], axPos);
467 working[1] = project(FaceB[i], axPos);
468 working[2] = project(FaceD[i], axPos);
469 working[3] = project(FaceC[i], axPos);
470 working[4] = project(FaceA[i], axPos);
471
472 face workingface = new face();
473 workingface.pts = working;
474
475 ds.trns[i] = workingface;
314 } 476 }
315 477
316 if (isBelow256AboveTerrain) 478 z_sort.Add(part.LocalId, ds);
317 { 479 z_localIDs.Add(part.LocalId);
318 // Translate scale by rotation so scale is represented properly when object is rotated 480 z_sortheights.Add(pos.Z);
319 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); 481
320 Vector3 scale = new Vector3(); 482 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
321 Vector3 tScale = new Vector3(); 483 //{
322 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); 484 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++)
323
324 Quaternion llrot = part.GetWorldRotation();
325 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
326 scale = lscale * rot;
327
328 // negative scales don't work in this situation
329 scale.X = Math.Abs(scale.X);
330 scale.Y = Math.Abs(scale.Y);
331 scale.Z = Math.Abs(scale.Z);
332
333 // This scaling isn't very accurate and doesn't take into account the face rotation :P
334 int mapdrawstartX = (int)(pos.X - scale.X);
335 int mapdrawstartY = (int)(pos.Y - scale.Y);
336 int mapdrawendX = (int)(pos.X + scale.X);
337 int mapdrawendY = (int)(pos.Y + scale.Y);
338
339 // If object is beyond the edge of the map, don't draw it to avoid errors
340 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1)
341 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
342 || mapdrawendY > ((int)Constants.RegionSize - 1))
343 continue;
344
345 #region obb face reconstruction part duex
346 Vector3[] vertexes = new Vector3[8];
347
348 // float[] distance = new float[6];
349 Vector3[] FaceA = new Vector3[6]; // vertex A for Facei
350 Vector3[] FaceB = new Vector3[6]; // vertex B for Facei
351 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
352 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
353
354 tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
355 scale = ((tScale * rot));
356 vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
357 // vertexes[0].x = pos.X + vertexes[0].x;
358 //vertexes[0].y = pos.Y + vertexes[0].y;
359 //vertexes[0].z = pos.Z + vertexes[0].z;
360
361 FaceA[0] = vertexes[0];
362 FaceB[3] = vertexes[0];
363 FaceA[4] = vertexes[0];
364
365 tScale = lscale;
366 scale = ((tScale * rot));
367 vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
368
369 // vertexes[1].x = pos.X + vertexes[1].x;
370 // vertexes[1].y = pos.Y + vertexes[1].y;
371 //vertexes[1].z = pos.Z + vertexes[1].z;
372
373 FaceB[0] = vertexes[1];
374 FaceA[1] = vertexes[1];
375 FaceC[4] = vertexes[1];
376
377 tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
378 scale = ((tScale * rot));
379
380 vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
381
382 //vertexes[2].x = pos.X + vertexes[2].x;
383 //vertexes[2].y = pos.Y + vertexes[2].y;
384 //vertexes[2].z = pos.Z + vertexes[2].z;
385
386 FaceC[0] = vertexes[2];
387 FaceD[3] = vertexes[2];
388 FaceC[5] = vertexes[2];
389
390 tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
391 scale = ((tScale * rot));
392 vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
393
394 //vertexes[3].x = pos.X + vertexes[3].x;
395 // vertexes[3].y = pos.Y + vertexes[3].y;
396 // vertexes[3].z = pos.Z + vertexes[3].z;
397
398 FaceD[0] = vertexes[3];
399 FaceC[1] = vertexes[3];
400 FaceA[5] = vertexes[3];
401
402 tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
403 scale = ((tScale * rot));
404 vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
405
406 // vertexes[4].x = pos.X + vertexes[4].x;
407 // vertexes[4].y = pos.Y + vertexes[4].y;
408 // vertexes[4].z = pos.Z + vertexes[4].z;
409
410 FaceB[1] = vertexes[4];
411 FaceA[2] = vertexes[4];
412 FaceD[4] = vertexes[4];
413
414 tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
415 scale = ((tScale * rot));
416 vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
417
418 // vertexes[5].x = pos.X + vertexes[5].x;
419 // vertexes[5].y = pos.Y + vertexes[5].y;
420 // vertexes[5].z = pos.Z + vertexes[5].z;
421
422 FaceD[1] = vertexes[5];
423 FaceC[2] = vertexes[5];
424 FaceB[5] = vertexes[5];
425
426 tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
427 scale = ((tScale * rot));
428 vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
429
430 // vertexes[6].x = pos.X + vertexes[6].x;
431 // vertexes[6].y = pos.Y + vertexes[6].y;
432 // vertexes[6].z = pos.Z + vertexes[6].z;
433
434 FaceB[2] = vertexes[6];
435 FaceA[3] = vertexes[6];
436 FaceB[4] = vertexes[6];
437
438 tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
439 scale = ((tScale * rot));
440 vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
441
442 // vertexes[7].x = pos.X + vertexes[7].x;
443 // vertexes[7].y = pos.Y + vertexes[7].y;
444 // vertexes[7].z = pos.Z + vertexes[7].z;
445
446 FaceD[2] = vertexes[7];
447 FaceC[3] = vertexes[7];
448 FaceD[5] = vertexes[7];
449 #endregion
450
451 //int wy = 0;
452
453 //bool breakYN = false; // If we run into an error drawing, break out of the
454 // loop so we don't lag to death on error handling
455 DrawStruct ds = new DrawStruct();
456 ds.brush = new SolidBrush(mapdotspot);
457 //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY);
458
459 ds.trns = new face[FaceA.Length];
460
461 for (int i = 0; i < FaceA.Length; i++)
462 {
463 Point[] working = new Point[5];
464 working[0] = project(FaceA[i], axPos);
465 working[1] = project(FaceB[i], axPos);
466 working[2] = project(FaceD[i], axPos);
467 working[3] = project(FaceC[i], axPos);
468 working[4] = project(FaceA[i], axPos);
469
470 face workingface = new face();
471 workingface.pts = working;
472
473 ds.trns[i] = workingface;
474 }
475
476 z_sort.Add(part.LocalId, ds);
477 z_localIDs.Add(part.LocalId);
478 z_sortheights.Add(pos.Z);
479
480 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
481 //{ 485 //{
482 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) 486 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy);
487 //try
483 //{ 488 //{
484 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy); 489 // Remember, flip the y!
485 //try 490 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
486 //{
487 // Remember, flip the y!
488 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
489 //}
490 //catch (ArgumentException)
491 //{
492 // breakYN = true;
493 //}
494
495 //if (breakYN)
496 // break;
497 //} 491 //}
498 492 //catch (ArgumentException)
493 //{
494 // breakYN = true;
495 //}
496
499 //if (breakYN) 497 //if (breakYN)
500 // break; 498 // break;
501 //} 499 //}
502 } // Object is within 256m Z of terrain 500
503 } // object is at least a meter wide 501 //if (breakYN)
504 } // mapdot.Children lock 502 // break;
503 //}
504 } // Object is within 256m Z of terrain
505 } // object is at least a meter wide
505 } // loop over group children 506 } // loop over group children
506 } // entitybase is sceneobject group 507 } // entitybase is sceneobject group
507 } // foreach loop over entities 508 } // foreach loop over entities
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 8ed8b96..2ac46e2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2004,11 +2004,12 @@ namespace OpenSim.Region.Framework.Scenes
2004 sog.SetGroup(groupID, remoteClient); 2004 sog.SetGroup(groupID, remoteClient);
2005 sog.ScheduleGroupForFullUpdate(); 2005 sog.ScheduleGroupForFullUpdate();
2006 2006
2007 List<SceneObjectPart> partList = null;
2007 lock (sog.Children) 2008 lock (sog.Children)
2008 { 2009 partList = new List<SceneObjectPart>(sog.Children.Values);
2009 foreach (SceneObjectPart child in sog.Children.Values) 2010
2010 child.Inventory.ChangeInventoryOwner(ownerID); 2011 foreach (SceneObjectPart child in partList)
2011 } 2012 child.Inventory.ChangeInventoryOwner(ownerID);
2012 } 2013 }
2013 else 2014 else
2014 { 2015 {
@@ -2017,14 +2018,15 @@ namespace OpenSim.Region.Framework.Scenes
2017 2018
2018 if (sog.GroupID != groupID) 2019 if (sog.GroupID != groupID)
2019 continue; 2020 continue;
2020 2021
2022 List<SceneObjectPart> partList = null;
2021 lock (sog.Children) 2023 lock (sog.Children)
2024 partList = new List<SceneObjectPart>(sog.Children.Values);
2025
2026 foreach (SceneObjectPart child in partList)
2022 { 2027 {
2023 foreach (SceneObjectPart child in sog.Children.Values) 2028 child.LastOwnerID = child.OwnerID;
2024 { 2029 child.Inventory.ChangeInventoryOwner(groupID);
2025 child.LastOwnerID = child.OwnerID;
2026 child.Inventory.ChangeInventoryOwner(groupID);
2027 }
2028 } 2030 }
2029 2031
2030 sog.SetOwnerId(groupID); 2032 sog.SetOwnerId(groupID);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 9f1575d..c511774 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -164,16 +164,17 @@ namespace OpenSim.Region.Framework.Scenes
164 164
165 SceneObjectGroup sog = ent as SceneObjectGroup; 165 SceneObjectGroup sog = ent as SceneObjectGroup;
166 166
167 List<SceneObjectPart> partList = null;
167 lock (sog.Children) 168 lock (sog.Children)
169 partList = new List<SceneObjectPart>(sog.Children.Values);
170
171 foreach (SceneObjectPart part in partList)
168 { 172 {
169 foreach (KeyValuePair<UUID, SceneObjectPart> child in (sog.Children)) 173 if (part.LocalId == primLocalID)
170 { 174 {
171 if (child.Value.LocalId == primLocalID) 175 part.GetProperties(remoteClient);
172 { 176 foundPrim = true;
173 child.Value.GetProperties(remoteClient); 177 break;
174 foundPrim = true;
175 break;
176 }
177 } 178 }
178 } 179 }
179 180
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5fe944d..db081cc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2065,19 +2065,20 @@ namespace OpenSim.Region.Framework.Scenes
2065 group.RemoveScriptInstances(true); 2065 group.RemoveScriptInstances(true);
2066 } 2066 }
2067 2067
2068 List<SceneObjectPart> partList = null;
2068 lock (group.Children) 2069 lock (group.Children)
2070 partList = new List<SceneObjectPart>(group.Children.Values);
2071
2072 foreach (SceneObjectPart part in partList)
2069 { 2073 {
2070 foreach (SceneObjectPart part in group.Children.Values) 2074 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
2071 { 2075 {
2072 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) 2076 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
2073 { 2077 }
2074 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? 2078 else if (part.PhysActor != null)
2075 } 2079 {
2076 else if (part.PhysActor != null) 2080 PhysicsScene.RemovePrim(part.PhysActor);
2077 { 2081 part.PhysActor = null;
2078 PhysicsScene.RemovePrim(part.PhysActor);
2079 part.PhysActor = null;
2080 }
2081 } 2082 }
2082 } 2083 }
2083 2084
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 9db2691..2c242c9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -380,34 +380,35 @@ namespace OpenSim.Region.Framework.Scenes
380 part.Shape.Scale = scale; 380 part.Shape.Scale = scale;
381 } 381 }
382 } 382 }
383
384 m_numPrim += sceneObject.Children.Count;
385 }
383 386
384 sceneObject.AttachToScene(m_parentScene); 387 sceneObject.AttachToScene(m_parentScene);
385 388
386 if (sendClientUpdates) 389 if (sendClientUpdates)
387 sceneObject.ScheduleGroupForFullUpdate(); 390 sceneObject.ScheduleGroupForFullUpdate();
388 391
389 Entities.Add(sceneObject); 392 Entities.Add(sceneObject);
390 m_numPrim += sceneObject.Children.Count; 393
391 394 if (attachToBackup)
392 if (attachToBackup) 395 sceneObject.AttachToBackup();
393 sceneObject.AttachToBackup(); 396
394 397 if (OnObjectCreate != null)
395 if (OnObjectCreate != null) 398 OnObjectCreate(sceneObject);
396 OnObjectCreate(sceneObject); 399
400 lock (SceneObjectGroupsByFullID)
401 {
402 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
403 foreach (SceneObjectPart part in sceneObject.Children.Values)
404 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
405 }
397 406
398 lock (SceneObjectGroupsByFullID) 407 lock (SceneObjectGroupsByLocalID)
399 { 408 {
400 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 409 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
401 foreach (SceneObjectPart part in sceneObject.Children.Values) 410 foreach (SceneObjectPart part in sceneObject.Children.Values)
402 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 411 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
403 }
404
405 lock (SceneObjectGroupsByLocalID)
406 {
407 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
408 foreach (SceneObjectPart part in sceneObject.Children.Values)
409 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
410 }
411 } 412 }
412 } 413 }
413 414
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index fc5eeed..40a8f83 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -237,6 +237,8 @@ namespace OpenSim.Region.Framework.Scenes
237 237
238 /// <value> 238 /// <value>
239 /// The parts of this scene object group. You must lock this property before using it. 239 /// The parts of this scene object group. You must lock this property before using it.
240 /// If you're doing anything other than reading values, please take a copy of the values rather than locking
241 /// the dictionary for the entirety of the operation. This increases liveness and reduces the danger of deadlock
240 /// If you want to know the number of children, consider using the PrimCount property instead 242 /// If you want to know the number of children, consider using the PrimCount property instead
241 /// </value> 243 /// </value>
242 public Dictionary<UUID, SceneObjectPart> Children 244 public Dictionary<UUID, SceneObjectPart> Children
@@ -1968,28 +1970,29 @@ namespace OpenSim.Region.Framework.Scenes
1968 //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 1970 //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
1969 // return; 1971 // return;
1970 1972
1971 lock (m_parts) 1973 bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
1972 {
1973 bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
1974 1974
1975 if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) 1975 if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f))
1976 { 1976 {
1977 m_rootPart.UpdateFlag = 1; 1977 m_rootPart.UpdateFlag = 1;
1978 lastPhysGroupPos = AbsolutePosition; 1978 lastPhysGroupPos = AbsolutePosition;
1979 } 1979 }
1980 1980
1981 if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) 1981 if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f))
1982 { 1982 {
1983 m_rootPart.UpdateFlag = 1; 1983 m_rootPart.UpdateFlag = 1;
1984 lastPhysGroupRot = GroupRotation; 1984 lastPhysGroupRot = GroupRotation;
1985 } 1985 }
1986 1986
1987 foreach (SceneObjectPart part in m_parts.Values) 1987 List<SceneObjectPart> partList = null;
1988 { 1988 lock (m_parts)
1989 if (!IsSelected) 1989 partList = new List<SceneObjectPart>(m_parts.Values);
1990 part.UpdateLookAt(); 1990
1991 part.SendScheduledUpdates(); 1991 foreach (SceneObjectPart part in partList)
1992 } 1992 {
1993 if (!IsSelected)
1994 part.UpdateLookAt();
1995 part.SendScheduledUpdates();
1993 } 1996 }
1994 } 1997 }
1995 1998
@@ -2787,11 +2790,12 @@ namespace OpenSim.Region.Framework.Scenes
2787 public void UpdatePermissions(UUID AgentID, byte field, uint localID, 2790 public void UpdatePermissions(UUID AgentID, byte field, uint localID,
2788 uint mask, byte addRemTF) 2791 uint mask, byte addRemTF)
2789 { 2792 {
2793 List<SceneObjectPart> partList = null;
2790 lock (m_parts) 2794 lock (m_parts)
2791 { 2795 partList = new List<SceneObjectPart>(m_parts.Values);
2792 foreach (SceneObjectPart part in m_parts.Values) 2796
2793 part.UpdatePermissions(AgentID, field, localID, mask, addRemTF); 2797 foreach (SceneObjectPart part in partList)
2794 } 2798 part.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
2795 2799
2796 HasGroupChanged = true; 2800 HasGroupChanged = true;
2797 } 2801 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 34171b0..c439e3e 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -186,18 +186,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
186 { 186 {
187 SceneObjectPart my = GetSOP(); 187 SceneObjectPart my = GetSOP();
188 IObject[] rets = null; 188 IObject[] rets = null;
189 189
190 int total = my.ParentGroup.PrimCount;
191
192 rets = new IObject[total];
193
194 int i = 0;
195
196 List<SceneObjectPart> partList = null;
190 lock (my.ParentGroup.Children) 197 lock (my.ParentGroup.Children)
198 partList = new List<SceneObjectPart>(my.ParentGroup.Children.Values);
199
200 foreach (SceneObjectPart part in partList)
191 { 201 {
192 int total = my.ParentGroup.Children.Count; 202 rets[i++] = new SOPObject(m_rootScene, part.LocalId, m_security);
193
194 rets = new IObject[total];
195
196 int i = 0;
197 foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children)
198 {
199 rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security);
200 }
201 } 203 }
202 204
203 return rets; 205 return rets;