From 237cf1ced6d5cd1ae75c082f7b2f72df1c089da2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Jan 2019 12:59:32 +0000 Subject: some cleanup --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 90 ++++++---------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 44 ----------- .../Shared/Api/Implementation/LSL_Api.cs | 4 +- 3 files changed, 27 insertions(+), 111 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c2c0178..730e487 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1231,36 +1231,6 @@ namespace OpenSim.Region.Framework.Scenes // } } } - // PlaySoundMasterPrim no longer in use to remove - private SceneObjectPart m_PlaySoundMasterPrim = null; - public SceneObjectPart PlaySoundMasterPrim - { - get { return m_PlaySoundMasterPrim; } - set { m_PlaySoundMasterPrim = value; } - } - // PlaySoundSlavePrims no longer in use to remove - private List m_PlaySoundSlavePrims = new List(); - public List PlaySoundSlavePrims - { - get { return m_PlaySoundSlavePrims; } - set { m_PlaySoundSlavePrims = value; } - } - - // LoopSoundMasterPrim no longer in use to remove - private SceneObjectPart m_LoopSoundMasterPrim = null; - public SceneObjectPart LoopSoundMasterPrim - { - get { return m_LoopSoundMasterPrim; } - set { m_LoopSoundMasterPrim = value; } - } - - // m_LoopSoundSlavePrims no longer in use to remove - private List m_LoopSoundSlavePrims = new List(); - public List LoopSoundSlavePrims - { - get { return m_LoopSoundSlavePrims; } - set { m_LoopSoundSlavePrims = value; } - } private double m_lastCollisionSoundMS; @@ -1465,9 +1435,10 @@ namespace OpenSim.Region.Framework.Scenes m_rootPart.LocalId = m_scene.AllocateLocalId(); SceneObjectPart[] parts = m_parts.GetArray(); + SceneObjectPart part; for (int i = 0; i < parts.Length; i++) { - SceneObjectPart part = parts[i]; + part = parts[i]; if (part.KeyframeMotion != null) { part.KeyframeMotion.UpdateSceneObject(this); @@ -1963,12 +1934,7 @@ namespace OpenSim.Region.Framework.Scenes public void GetSelectedCosts(out float PhysCost, out float StreamCost, out float SimulCost) { SceneObjectPart p; - SceneObjectPart[] parts; - - lock (m_parts) - { - parts = m_parts.GetArray(); - } + SceneObjectPart[] parts = m_parts.GetArray(); int nparts = parts.Length; @@ -2098,11 +2064,6 @@ namespace OpenSim.Region.Framework.Scenes part.ClearUndoState(); } - public ushort GetTimeDilation() - { - return Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); - } - /// /// Set a part to act as the root part for this scene object /// @@ -2765,24 +2726,29 @@ namespace OpenSim.Region.Framework.Scenes // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object public void MoveToTarget(Vector3 target, float tau) { - if (IsAttachment) + if(tau > 0) { - ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - - if (avatar != null && !avatar.IsSatOnObject) - avatar.MoveToTarget(target, false, false, tau); - } - else - { - PhysicsActor pa = RootPart.PhysActor; + if (IsAttachment) + { + ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - if (pa != null) + if (avatar != null && !avatar.IsSatOnObject) + avatar.MoveToTarget(target, false, false, tau); + } + else { - pa.PIDTarget = target; - pa.PIDTau = tau; - pa.PIDActive = true; + PhysicsActor pa = RootPart.PhysActor; + + if (pa != null) + { + pa.PIDTarget = target; + pa.PIDTau = tau; + pa.PIDActive = true; + } } } + else + StopMoveToTarget(); } public void StopMoveToTarget() @@ -3188,13 +3154,9 @@ namespace OpenSim.Region.Framework.Scenes /// null if a part with the local ID was not found public SceneObjectPart GetPart(uint localID) { - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - { - if (parts[i].LocalId == localID) - return parts[i]; - } - + SceneObjectPart sop = m_scene.GetSceneObjectPart(localID); + if(sop.ParentGroup.Equals(this)) + return sop; return null; } @@ -4013,7 +3975,6 @@ namespace OpenSim.Region.Framework.Scenes AttachToBackup(); } - SceneObjectPart[] parts = m_parts.GetArray(); if (UsePhysics) @@ -4054,8 +4015,7 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < parts.Length; i++) { - - if (parts[i].UUID != m_rootPart.UUID) + if (parts[i].LocalId != m_rootPart.LocalId) parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index abda29a..0ff9388 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -703,33 +703,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_scriptAccessPin; } set { m_scriptAccessPin = (int)value; } } - private SceneObjectPart m_PlaySoundMasterPrim = null; - public SceneObjectPart PlaySoundMasterPrim - { - get { return m_PlaySoundMasterPrim; } - set { m_PlaySoundMasterPrim = value; } - } - - private List m_PlaySoundSlavePrims = new List(); - public List PlaySoundSlavePrims - { - get { return m_PlaySoundSlavePrims; } - set { m_PlaySoundSlavePrims = value; } - } - - private SceneObjectPart m_LoopSoundMasterPrim = null; - public SceneObjectPart LoopSoundMasterPrim - { - get { return m_LoopSoundMasterPrim; } - set { m_LoopSoundMasterPrim = value; } - } - - private List m_LoopSoundSlavePrims = new List(); - public List LoopSoundSlavePrims - { - get { return m_LoopSoundSlavePrims; } - set { m_LoopSoundSlavePrims = value; } - } public Byte[] TextureAnimation { @@ -2714,18 +2687,6 @@ namespace OpenSim.Region.Framework.Scenes return newRot; } - public void MoveToTarget(Vector3 target, float tau) - { - if (tau > 0) - { - ParentGroup.MoveToTarget(target, tau); - } - else - { - StopMoveToTarget(); - } - } - /// /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. /// @@ -4139,11 +4100,6 @@ namespace OpenSim.Region.Framework.Scenes SetText(text); } - public void StopMoveToTarget() - { - ParentGroup.StopMoveToTarget(); - } - public void StoreUndoState(ObjectChangeType change) { lock (m_UndoLock) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 48c3812..6f3c7e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3035,13 +3035,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llMoveToTarget(LSL_Vector target, double tau) { m_host.AddScriptLPS(1); - m_host.MoveToTarget(target, (float)tau); + m_host.ParentGroup.MoveToTarget(target, (float)tau); } public void llStopMoveToTarget() { m_host.AddScriptLPS(1); - m_host.StopMoveToTarget(); + m_host.ParentGroup.StopMoveToTarget(); } public void llApplyImpulse(LSL_Vector force, int local) -- cgit v1.1