From 457551d0699558520c9ce47e05fcace828a706e5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 12 Jul 2017 10:28:11 +0100 Subject: rename SOG.UpdatePrimFlags as just UpdateFlags since this is relative to the group never individual prims/parts and so confusing --- OpenSim/Region/Framework/Scenes/EventManager.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 131 +++++++++------------ 3 files changed, 59 insertions(+), 76 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 827f91e..f76f882 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -855,7 +855,7 @@ namespace OpenSim.Region.Framework.Scenes /// , /// , /// , - /// , + /// , /// /// public event ParcelPrimCountTainted OnParcelPrimCountTainted; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index ae827f4..61a243d 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1649,7 +1649,7 @@ namespace OpenSim.Region.Framework.Scenes else // else turn it off vdtc = false; - group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc); + group.UpdateFlags(UsePhysics, SetTemporary, SetPhantom, vdtc); } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c4b768b..6f46a92 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2718,35 +2718,22 @@ namespace OpenSim.Region.Framework.Scenes RootPart.KeyframeMotion.Stop(); RootPart.KeyframeMotion = null; } - UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); + UpdateFlags(usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); } public void ScriptSetTemporaryStatus(bool makeTemporary) { - UpdatePrimFlags(RootPart.LocalId, UsesPhysics, makeTemporary, IsPhantom, IsVolumeDetect); + UpdateFlags(UsesPhysics, makeTemporary, IsPhantom, IsVolumeDetect); } public void ScriptSetPhantomStatus(bool makePhantom) { - UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, makePhantom, IsVolumeDetect); + UpdateFlags(UsesPhysics, IsTemporary, makePhantom, IsVolumeDetect); } public void ScriptSetVolumeDetect(bool makeVolumeDetect) { - UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, IsPhantom, makeVolumeDetect); - - /* - ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore - - if (PhysActor != null) // Should always be the case now - { - PhysActor.SetVolumeDetect(param); - } - if (param != 0) - AddFlag(PrimFlags.Phantom); - - ScheduleFullUpdate(); - */ + UpdateFlags(UsesPhysics, IsTemporary, IsPhantom, makeVolumeDetect); } public void applyImpulse(Vector3 impulse) @@ -4031,84 +4018,80 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void UpdatePrimFlags(uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect) + public void UpdateFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect) { - HasGroupChanged = true; + if (m_scene == null || IsDeleted) + return; - SceneObjectPart selectionPart = GetPart(localID); + HasGroupChanged = true; - if (Scene != null) + if (SetTemporary) { - if (SetTemporary) - { - DetachFromBackup(); - // Remove from database and parcel prim count - // - m_scene.DeleteFromStorage(UUID); - } - else if (!Backup) - { - // Previously been temporary now switching back so make it - // available for persisting again - AttachToBackup(); - } - - m_scene.EventManager.TriggerParcelPrimCountTainted(); + DetachFromBackup(); + // Remove from database and parcel prim count + // + m_scene.DeleteFromStorage(UUID); } - - if (selectionPart != null) + else if (!Backup) { - SceneObjectPart[] parts = m_parts.GetArray(); + // Previously been temporary now switching back so make it + // available for persisting again + AttachToBackup(); + } - if (Scene != null && UsePhysics) - { - int maxprims = m_scene.m_linksetPhysCapacity; - bool checkShape = (maxprims > 0 && - parts.Length > maxprims); - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart part = parts[i]; + SceneObjectPart[] parts = m_parts.GetArray(); - if(part.PhysicsShapeType == (byte)PhysicsShapeType.None) - continue; // assuming root type was checked elsewhere + if (UsePhysics) + { + int maxprims = m_scene.m_linksetPhysCapacity; + bool checkShape = (maxprims > 0 && + parts.Length > maxprims); - if (checkShape) - { - if (--maxprims < 0) - { - UsePhysics = false; - break; - } - } + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; - if (part.Scale.X > m_scene.m_maxPhys || - part.Scale.Y > m_scene.m_maxPhys || - part.Scale.Z > m_scene.m_maxPhys ) + if(part.PhysicsShapeType == (byte)PhysicsShapeType.None) + continue; // assuming root type was checked elsewhere + + if (checkShape) + { + if (--maxprims < 0) { - UsePhysics = false; // Reset physics + UsePhysics = false; break; } } - } - if (parts.Length > 1) - { - m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); - - for (int i = 0; i < parts.Length; i++) + if (part.Scale.X > m_scene.m_maxPhys || + part.Scale.Y > m_scene.m_maxPhys || + part.Scale.Z > m_scene.m_maxPhys ) { - - if (parts[i].UUID != m_rootPart.UUID) - parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); + UsePhysics = false; // Reset physics + break; } + } + } - if (m_rootPart.PhysActor != null) - m_rootPart.PhysActor.Building = false; + if (parts.Length > 1) + { + m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); + + for (int i = 0; i < parts.Length; i++) + { + + if (parts[i].UUID != m_rootPart.UUID) + parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); } - else - m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); + + if (m_rootPart.PhysActor != null) + m_rootPart.PhysActor.Building = false; } + else + m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); + + m_scene.EventManager.TriggerParcelPrimCountTainted(); } public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) -- cgit v1.1