diff options
author | Justin Clarke Casey | 2008-11-06 22:21:25 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-06 22:21:25 +0000 |
commit | 0d17ba2a76d4eb01f0bd6097c3974cd9d9fb2061 (patch) | |
tree | 82fc3cdd059f30d72407875a69ff662bb5747e41 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |
parent | add create_time and access_time to asset db for mysql, as well (diff) | |
download | opensim-SC_OLD-0d17ba2a76d4eb01f0bd6097c3974cd9d9fb2061.zip opensim-SC_OLD-0d17ba2a76d4eb01f0bd6097c3974cd9d9fb2061.tar.gz opensim-SC_OLD-0d17ba2a76d4eb01f0bd6097c3974cd9d9fb2061.tar.bz2 opensim-SC_OLD-0d17ba2a76d4eb01f0bd6097c3974cd9d9fb2061.tar.xz |
* refactor: Attach a scene object to a scene separately from its construction
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index bb0bf9a..9fd4728 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -508,35 +508,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
508 | } | 508 | } |
509 | 509 | ||
510 | /// <summary> | 510 | /// <summary> |
511 | /// | 511 | /// Constructor. This object is added to the scene later via AttachToScene() |
512 | /// </summary> | 512 | /// </summary> |
513 | public SceneObjectGroup(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos, | 513 | public SceneObjectGroup(UUID ownerID, uint localID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) |
514 | Quaternion rot, PrimitiveBaseShape shape) | ||
515 | { | 514 | { |
516 | m_regionHandle = regionHandle; | ||
517 | m_scene = scene; | ||
518 | |||
519 | // this.Pos = pos; | ||
520 | Vector3 rootOffset = new Vector3(0, 0, 0); | 515 | Vector3 rootOffset = new Vector3(0, 0, 0); |
521 | SceneObjectPart newPart = | 516 | SceneObjectPart newPart = |
522 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); | 517 | new SceneObjectPart(this, ownerID, localID, shape, pos, rot, rootOffset); |
523 | newPart.LinkNum = 0; | 518 | newPart.LinkNum = 0; |
524 | m_parts.Add(newPart.UUID, newPart); | 519 | m_parts.Add(newPart.UUID, newPart); |
525 | SetPartAsRoot(newPart); | 520 | SetPartAsRoot(newPart); |
526 | |||
527 | // one of these is a proxy. | ||
528 | if (shape.PCode != (byte)PCode.None && shape.PCode != (byte)PCode.ParticleSystem) | ||
529 | AttachToBackup(); | ||
530 | |||
531 | //ApplyPhysics(scene.m_physicalPrim); | ||
532 | } | 521 | } |
533 | 522 | ||
534 | /// <summary> | 523 | /// <summary> |
535 | /// | 524 | /// Constructor. |
536 | /// </summary> | 525 | /// </summary> |
537 | public SceneObjectGroup(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos, | 526 | public SceneObjectGroup(UUID ownerID, uint localID, Vector3 pos, PrimitiveBaseShape shape) |
538 | PrimitiveBaseShape shape) | 527 | : this(ownerID, localID, pos, Quaternion.Identity, shape) |
539 | : this(scene, regionHandle, ownerID, localID, pos, Quaternion.Identity, shape) | ||
540 | { | 528 | { |
541 | } | 529 | } |
542 | 530 | ||
@@ -575,6 +563,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
575 | m_isBackedUp = true; | 563 | m_isBackedUp = true; |
576 | } | 564 | } |
577 | } | 565 | } |
566 | |||
567 | /// <summary> | ||
568 | /// Attach the given group to a scene. It will appear to agents. | ||
569 | /// </summary> | ||
570 | /// <param name="scene"></param> | ||
571 | public void AttachToScene(Scene scene) | ||
572 | { | ||
573 | m_scene = scene; | ||
574 | |||
575 | ApplyPhysics(m_scene.m_physicalPrim); | ||
576 | |||
577 | lock (m_parts) | ||
578 | { | ||
579 | foreach (SceneObjectPart part in m_parts.Values) | ||
580 | { | ||
581 | part.AttachToScene(scene.RegionInfo.RegionHandle); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | // one of these is a proxy. | ||
586 | if (m_rootPart.Shape.PCode != (byte)PCode.None && m_rootPart.Shape.PCode != (byte)PCode.ParticleSystem) | ||
587 | AttachToBackup(); | ||
588 | |||
589 | ScheduleGroupForFullUpdate(); | ||
590 | } | ||
578 | 591 | ||
579 | public Vector3 GroupScale() | 592 | public Vector3 GroupScale() |
580 | { | 593 | { |