diff options
Start of replacing the old SceneObject/Primitive classes with the new versions.
PLEASE NOTE: that with this revision some prim related features may be broke for a while. (things like linking prims and the parcel prim count.)
Also this revision may not work on mono, but that will be fixed soon.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 184 |
1 files changed, 91 insertions, 93 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 2f3ce6e..4300ce4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -272,14 +272,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
272 | /// <param name="flags"></param> | 272 | /// <param name="flags"></param> |
273 | public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags) | 273 | public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags) |
274 | { | 274 | { |
275 | SceneObject originPrim = null; | 275 | SceneObjectGroup originPrim = null; |
276 | foreach (EntityBase ent in Entities.Values) | 276 | foreach (EntityBase ent in Entities.Values) |
277 | { | 277 | { |
278 | if (ent is SceneObject) | 278 | if (ent is SceneObjectGroup) |
279 | { | 279 | { |
280 | if (((SceneObject)ent).rootLocalID == originalPrim) | 280 | if (((SceneObjectGroup)ent).LocalId == originalPrim) |
281 | { | 281 | { |
282 | originPrim = (SceneObject)ent; | 282 | originPrim = (SceneObjectGroup)ent; |
283 | break; | 283 | break; |
284 | } | 284 | } |
285 | } | 285 | } |
@@ -287,15 +287,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
287 | 287 | ||
288 | if (originPrim != null) | 288 | if (originPrim != null) |
289 | { | 289 | { |
290 | SceneObject copy = originPrim.Copy(); | 290 | SceneObjectGroup copy = originPrim.Copy(); |
291 | copy.Pos = copy.Pos + offset; | 291 | copy.Pos = copy.Pos + offset; |
292 | this.Entities.Add(copy.rootUUID, copy); | 292 | this.Entities.Add(copy.UUID, copy); |
293 | 293 | ||
294 | List<ScenePresence> avatars = this.RequestAvatarList(); | 294 | copy.ScheduleGroupForFullUpdate(); |
295 | /* List<ScenePresence> avatars = this.RequestAvatarList(); | ||
295 | for (int i = 0; i < avatars.Count; i++) | 296 | for (int i = 0; i < avatars.Count; i++) |
296 | { | 297 | { |
297 | copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); | 298 | // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); |
298 | } | 299 | }*/ |
299 | 300 | ||
300 | } | 301 | } |
301 | else | 302 | else |
@@ -312,40 +313,40 @@ namespace OpenSim.Region.Environment.Scenes | |||
312 | /// <param name="childPrims"></param> | 313 | /// <param name="childPrims"></param> |
313 | public void LinkObjects(uint parentPrim, List<uint> childPrims) | 314 | public void LinkObjects(uint parentPrim, List<uint> childPrims) |
314 | { | 315 | { |
315 | SceneObject parenPrim = null; | 316 | SceneObjectGroup parenPrim = null; |
316 | foreach (EntityBase ent in Entities.Values) | 317 | foreach (EntityBase ent in Entities.Values) |
317 | { | 318 | { |
318 | if (ent is SceneObject) | 319 | if (ent is SceneObjectGroup) |
319 | { | 320 | { |
320 | if (((SceneObject)ent).rootLocalID == parentPrim) | 321 | if (((SceneObjectGroup)ent).LocalId == parentPrim) |
321 | { | 322 | { |
322 | parenPrim = (SceneObject)ent; | 323 | parenPrim = (SceneObjectGroup)ent; |
323 | break; | 324 | break; |
324 | } | 325 | } |
325 | } | 326 | } |
326 | } | 327 | } |
327 | 328 | ||
328 | List<SceneObject> children = new List<SceneObject>(); | 329 | List<SceneObjectGroup> children = new List<SceneObjectGroup>(); |
329 | if (parenPrim != null) | 330 | if (parenPrim != null) |
330 | { | 331 | { |
331 | for (int i = 0; i < childPrims.Count; i++) | 332 | for (int i = 0; i < childPrims.Count; i++) |
332 | { | 333 | { |
333 | foreach (EntityBase ent in Entities.Values) | 334 | foreach (EntityBase ent in Entities.Values) |
334 | { | 335 | { |
335 | if (ent is SceneObject) | 336 | if (ent is SceneObjectGroup) |
336 | { | 337 | { |
337 | if (((SceneObject)ent).rootLocalID == childPrims[i]) | 338 | if (((SceneObjectGroup)ent).LocalId == childPrims[i]) |
338 | { | 339 | { |
339 | children.Add((SceneObject)ent); | 340 | children.Add((SceneObjectGroup)ent); |
340 | } | 341 | } |
341 | } | 342 | } |
342 | } | 343 | } |
343 | } | 344 | } |
344 | } | 345 | } |
345 | 346 | ||
346 | foreach (SceneObject sceneObj in children) | 347 | foreach (SceneObjectGroup sceneObj in children) |
347 | { | 348 | { |
348 | parenPrim.AddNewChildPrims(sceneObj); | 349 | parenPrim.LinkToGroup(sceneObj); |
349 | } | 350 | } |
350 | } | 351 | } |
351 | 352 | ||
@@ -356,15 +357,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
356 | /// <param name="shapeBlock"></param> | 357 | /// <param name="shapeBlock"></param> |
357 | public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) | 358 | public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) |
358 | { | 359 | { |
359 | Primitive prim = null; | 360 | bool hasPrim = false; |
360 | foreach (EntityBase ent in Entities.Values) | 361 | foreach (EntityBase ent in Entities.Values) |
361 | { | 362 | { |
362 | if (ent is SceneObject) | 363 | if (ent is SceneObjectGroup) |
363 | { | 364 | { |
364 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 365 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
365 | if (prim != null) | 366 | if (hasPrim != false) |
366 | { | 367 | { |
367 | prim.UpdateShape(shapeBlock); | 368 | ((SceneObjectGroup)ent).UpdateShape(shapeBlock, primLocalID); |
368 | break; | 369 | break; |
369 | } | 370 | } |
370 | } | 371 | } |
@@ -373,15 +374,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
373 | 374 | ||
374 | public void UpdateExtraParam(uint primLocalID, ushort type, bool inUse, byte[] data) | 375 | public void UpdateExtraParam(uint primLocalID, ushort type, bool inUse, byte[] data) |
375 | { | 376 | { |
376 | Primitive prim = null; | 377 | bool hasPrim = false; |
377 | foreach (EntityBase ent in Entities.Values) | 378 | foreach (EntityBase ent in Entities.Values) |
378 | { | 379 | { |
379 | if (ent is SceneObject) | 380 | if (ent is SceneObjectGroup) |
380 | { | 381 | { |
381 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 382 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
382 | if (prim != null) | 383 | if (hasPrim != false) |
383 | { | 384 | { |
384 | prim.UpdateExtraParam(type, inUse, data); | 385 | ((SceneObjectGroup)ent).UpdateExtraParam(primLocalID, type, inUse, data); |
385 | break; | 386 | break; |
386 | } | 387 | } |
387 | } | 388 | } |
@@ -395,15 +396,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
395 | /// <param name="primLocalID"></param> | 396 | /// <param name="primLocalID"></param> |
396 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 397 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
397 | { | 398 | { |
398 | Primitive prim = null; | 399 | |
400 | bool hasPrim = false; | ||
399 | foreach (EntityBase ent in Entities.Values) | 401 | foreach (EntityBase ent in Entities.Values) |
400 | { | 402 | { |
401 | if (ent is SceneObject) | 403 | if (ent is SceneObjectGroup) |
402 | { | 404 | { |
403 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 405 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
404 | if (prim != null) | 406 | if (hasPrim != false) |
405 | { | 407 | { |
406 | prim.GetInventory(remoteClient, primLocalID); | 408 | ((SceneObjectGroup)ent).GetPartInventory(remoteClient, primLocalID); |
407 | break; | 409 | break; |
408 | } | 410 | } |
409 | } | 411 | } |
@@ -419,12 +421,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
419 | { | 421 | { |
420 | foreach (EntityBase ent in Entities.Values) | 422 | foreach (EntityBase ent in Entities.Values) |
421 | { | 423 | { |
422 | if (ent is SceneObject) | 424 | if (ent is SceneObjectGroup) |
423 | { | 425 | { |
424 | if (((SceneObject)ent).rootLocalID == primLocalID) | 426 | if (((SceneObjectGroup)ent).LocalId == primLocalID) |
425 | { | 427 | { |
426 | ((SceneObject)ent).GetProperites(remoteClient); | 428 | ((SceneObjectGroup)ent).GetProperites(remoteClient); |
427 | ((SceneObject)ent).isSelected = true; | 429 | ((SceneObjectGroup)ent).IsSelected = true; |
428 | this.LandManager.setPrimsTainted(); | 430 | this.LandManager.setPrimsTainted(); |
429 | break; | 431 | break; |
430 | } | 432 | } |
@@ -441,11 +443,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
441 | { | 443 | { |
442 | foreach (EntityBase ent in Entities.Values) | 444 | foreach (EntityBase ent in Entities.Values) |
443 | { | 445 | { |
444 | if (ent is SceneObject) | 446 | if (ent is SceneObjectGroup) |
445 | { | 447 | { |
446 | if (((SceneObject)ent).rootLocalID == primLocalID) | 448 | if (((SceneObjectGroup)ent).LocalId == primLocalID) |
447 | { | 449 | { |
448 | ((SceneObject)ent).isSelected = false; | 450 | ((SceneObjectGroup)ent).IsSelected = false; |
449 | this.LandManager.setPrimsTainted(); | 451 | this.LandManager.setPrimsTainted(); |
450 | break; | 452 | break; |
451 | } | 453 | } |
@@ -460,15 +462,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
460 | /// <param name="description"></param> | 462 | /// <param name="description"></param> |
461 | public void PrimDescription(uint primLocalID, string description) | 463 | public void PrimDescription(uint primLocalID, string description) |
462 | { | 464 | { |
463 | Primitive prim = null; | 465 | bool hasPrim = false; |
464 | foreach (EntityBase ent in Entities.Values) | 466 | foreach (EntityBase ent in Entities.Values) |
465 | { | 467 | { |
466 | if (ent is SceneObject) | 468 | if (ent is SceneObjectGroup) |
467 | { | 469 | { |
468 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 470 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
469 | if (prim != null) | 471 | if (hasPrim != false) |
470 | { | 472 | { |
471 | prim.Description = description; | 473 | ((SceneObjectGroup)ent).SetPartDescription(description, primLocalID); |
472 | break; | 474 | break; |
473 | } | 475 | } |
474 | } | 476 | } |
@@ -482,15 +484,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
482 | /// <param name="description"></param> | 484 | /// <param name="description"></param> |
483 | public void PrimName(uint primLocalID, string name) | 485 | public void PrimName(uint primLocalID, string name) |
484 | { | 486 | { |
485 | Primitive prim = null; | 487 | bool hasPrim = false; |
486 | foreach (EntityBase ent in Entities.Values) | 488 | foreach (EntityBase ent in Entities.Values) |
487 | { | 489 | { |
488 | if (ent is SceneObject) | 490 | if (ent is SceneObjectGroup) |
489 | { | 491 | { |
490 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | 492 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
491 | if (prim != null) | 493 | if (hasPrim != false) |
492 | { | 494 | { |
493 | prim.Name = name; | 495 | ((SceneObjectGroup)ent).SetPartName(name, primLocalID); |
494 | break; | 496 | break; |
495 | } | 497 | } |
496 | } | 498 | } |
@@ -499,27 +501,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
499 | 501 | ||
500 | public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | 502 | public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) |
501 | { | 503 | { |
502 | Primitive prim = null; | 504 | bool hasPrim = false; |
503 | foreach (EntityBase ent in Entities.Values) | 505 | foreach (EntityBase ent in Entities.Values) |
504 | { | 506 | { |
505 | if (ent is SceneObject) | 507 | if (ent is SceneObjectGroup) |
506 | { | 508 | { |
507 | prim = ((SceneObject)ent).HasChildPrim(objectID); | 509 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(objectID); |
508 | if (prim != null) | 510 | if (hasPrim != false) |
509 | { | 511 | { |
510 | ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); | 512 | ((SceneObjectGroup)ent).GrapMovement(offset, pos, remoteClient); |
511 | break; | 513 | break; |
512 | } | 514 | } |
513 | } | 515 | } |
514 | } | 516 | } |
515 | /* | ||
516 | if (this.Entities.ContainsKey(objectID)) | ||
517 | { | ||
518 | if (this.Entities[objectID] is SceneObject) | ||
519 | { | ||
520 | ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); | ||
521 | } | ||
522 | }*/ | ||
523 | } | 517 | } |
524 | 518 | ||
525 | /// <summary> | 519 | /// <summary> |
@@ -541,15 +535,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
541 | /// <param name="remoteClient"></param> | 535 | /// <param name="remoteClient"></param> |
542 | public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) | 536 | public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) |
543 | { | 537 | { |
544 | Primitive prim = null; | 538 | bool hasPrim = false; |
545 | foreach (EntityBase ent in Entities.Values) | 539 | foreach (EntityBase ent in Entities.Values) |
546 | { | 540 | { |
547 | if (ent is SceneObject) | 541 | if (ent is SceneObjectGroup) |
548 | { | 542 | { |
549 | prim = ((SceneObject)ent).HasChildPrim(localID); | 543 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); |
550 | if (prim != null) | 544 | if (hasPrim != false) |
551 | { | 545 | { |
552 | prim.UpdateTextureEntry(texture); | 546 | ((SceneObjectGroup)ent).UpdateTextureEntry(localID, texture); |
547 | break; | ||
553 | } | 548 | } |
554 | } | 549 | } |
555 | } | 550 | } |
@@ -563,15 +558,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
563 | /// <param name="remoteClient"></param> | 558 | /// <param name="remoteClient"></param> |
564 | public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) | 559 | public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) |
565 | { | 560 | { |
566 | Primitive prim = null; | 561 | bool hasPrim = false; |
567 | foreach (EntityBase ent in Entities.Values) | 562 | foreach (EntityBase ent in Entities.Values) |
568 | { | 563 | { |
569 | if (ent is SceneObject) | 564 | if (ent is SceneObjectGroup) |
570 | { | 565 | { |
571 | prim = ((SceneObject)ent).HasChildPrim(localID); | 566 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); |
572 | if (prim != null) | 567 | if (hasPrim != false) |
573 | { | 568 | { |
574 | prim.UpdateGroupPosition(pos); | 569 | ((SceneObjectGroup)ent).UpdateGroupPosition(pos); |
575 | break; | 570 | break; |
576 | } | 571 | } |
577 | } | 572 | } |
@@ -583,9 +578,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
583 | Primitive prim = null; | 578 | Primitive prim = null; |
584 | foreach (EntityBase ent in Entities.Values) | 579 | foreach (EntityBase ent in Entities.Values) |
585 | { | 580 | { |
586 | if (ent is SceneObject) | 581 | if (ent is SceneObjectGroup) |
587 | { | 582 | { |
588 | prim = ((SceneObject)ent).HasChildPrim(localID); | 583 | //prim = ((SceneObject)ent).HasChildPrim(localID); |
589 | if (prim != null) | 584 | if (prim != null) |
590 | { | 585 | { |
591 | prim.UpdateSinglePosition(pos); | 586 | prim.UpdateSinglePosition(pos); |
@@ -604,15 +599,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
604 | /// <param name="remoteClient"></param> | 599 | /// <param name="remoteClient"></param> |
605 | public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient) | 600 | public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient) |
606 | { | 601 | { |
607 | Primitive prim = null; | 602 | bool hasPrim = false; |
608 | foreach (EntityBase ent in Entities.Values) | 603 | foreach (EntityBase ent in Entities.Values) |
609 | { | 604 | { |
610 | if (ent is SceneObject) | 605 | if (ent is SceneObjectGroup) |
611 | { | 606 | { |
612 | prim = ((SceneObject)ent).HasChildPrim(localID); | 607 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); |
613 | if (prim != null) | 608 | if (hasPrim != false) |
614 | { | 609 | { |
615 | prim.UpdateGroupMouseRotation(pos, rot); | 610 | ((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot); |
611 | // prim.UpdateGroupMouseRotation(pos, rot); | ||
616 | break; | 612 | break; |
617 | } | 613 | } |
618 | } | 614 | } |
@@ -627,15 +623,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
627 | /// <param name="remoteClient"></param> | 623 | /// <param name="remoteClient"></param> |
628 | public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) | 624 | public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) |
629 | { | 625 | { |
630 | Primitive prim = null; | 626 | bool hasPrim = false; |
631 | foreach (EntityBase ent in Entities.Values) | 627 | foreach (EntityBase ent in Entities.Values) |
632 | { | 628 | { |
633 | if (ent is SceneObject) | 629 | if (ent is SceneObjectGroup) |
634 | { | 630 | { |
635 | prim = ((SceneObject)ent).HasChildPrim(localID); | 631 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); |
636 | if (prim != null) | 632 | if (hasPrim != false) |
637 | { | 633 | { |
638 | prim.UpdateGroupRotation(rot); | 634 | ((SceneObjectGroup)ent).UpdateGroupRotation(rot); |
635 | //prim.UpdateGroupRotation(rot); | ||
639 | break; | 636 | break; |
640 | } | 637 | } |
641 | } | 638 | } |
@@ -654,9 +651,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
654 | Primitive prim = null; | 651 | Primitive prim = null; |
655 | foreach (EntityBase ent in Entities.Values) | 652 | foreach (EntityBase ent in Entities.Values) |
656 | { | 653 | { |
657 | if (ent is SceneObject) | 654 | if (ent is SceneObjectGroup) |
658 | { | 655 | { |
659 | prim = ((SceneObject)ent).HasChildPrim(localID); | 656 | // prim = ((SceneObject)ent).HasChildPrim(localID); |
660 | if (prim != null) | 657 | if (prim != null) |
661 | { | 658 | { |
662 | prim.UpdateSingleRotation(rot); | 659 | prim.UpdateSingleRotation(rot); |
@@ -674,15 +671,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
674 | /// <param name="remoteClient"></param> | 671 | /// <param name="remoteClient"></param> |
675 | public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) | 672 | public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) |
676 | { | 673 | { |
677 | Primitive prim = null; | 674 | bool hasPrim = false; |
678 | foreach (EntityBase ent in Entities.Values) | 675 | foreach (EntityBase ent in Entities.Values) |
679 | { | 676 | { |
680 | if (ent is SceneObject) | 677 | if (ent is SceneObjectGroup) |
681 | { | 678 | { |
682 | prim = ((SceneObject)ent).HasChildPrim(localID); | 679 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); |
683 | if (prim != null) | 680 | if (hasPrim != false) |
684 | { | 681 | { |
685 | prim.ResizeGoup(scale); | 682 | ((SceneObjectGroup)ent).Resize(scale, localID); |
683 | // prim.ResizeGoup(scale); | ||
686 | break; | 684 | break; |
687 | } | 685 | } |
688 | } | 686 | } |