From 41dda4407e5503e596822b45d9f6fdd229a79bd3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 4 Oct 2025 23:19:46 +0100 Subject: [PATCH] avoid some unnecessary sog saves --- .../Framework/Scenes/SceneObjectPart.cs | 57 ++++++++++--------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3eccf5bbe7..497bfd683d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -661,10 +661,11 @@ namespace OpenSim.Region.Framework.Scenes get { return m_passTouches; } set { - m_passTouches = value; - - if (ParentGroup != null) + if(m_passTouches != value) + { + m_passTouches = value; ParentGroup.HasGroupChanged = true; + } } } @@ -674,10 +675,11 @@ namespace OpenSim.Region.Framework.Scenes get { return m_passCollisions; } set { - m_passCollisions = value; - - if (ParentGroup != null) + if(m_passCollisions != value) + { + m_passCollisions = value; ParentGroup.HasGroupChanged = true; + } } } @@ -992,9 +994,12 @@ namespace OpenSim.Region.Framework.Scenes /// Update angular velocity and schedule terse update. public void UpdateAngularVelocity(Vector3 avel) { - AngularVelocity = avel; - ScheduleTerseUpdate(); - ParentGroup.HasGroupChanged = true; + if(m_angularVelocity.NotEqual(avel)) + { + AngularVelocity = avel; + ScheduleTerseUpdate(); + ParentGroup.HasGroupChanged = true; + } } /// Get or set angular velocity. Does not schedule update. @@ -1683,17 +1688,18 @@ namespace OpenSim.Region.Framework.Scenes update = true; m_material = (Material)value; } - - if (m_friction != SOPMaterialData.friction(m_material)) + float newfriction = SOPMaterialData.friction(m_material); + if (m_friction != newfriction) { update = true; - m_friction = SOPMaterialData.friction(m_material); + m_friction = newfriction; } - if (m_bounce != SOPMaterialData.bounce(m_material)) + float newbounce = SOPMaterialData.bounce(m_material); + if (m_bounce != newbounce) { update = true; - m_bounce = SOPMaterialData.bounce(m_material); + m_bounce = newbounce; } if (update) @@ -1841,11 +1847,10 @@ namespace OpenSim.Region.Framework.Scenes get { return m_density; } set { - if (value >=1 && value <= 22587.0) + if (value >=1 && value <= 22587.0 && value != m_density) { m_density = value; - if (ParentGroup != null) { ParentGroup.HasGroupChanged = true; @@ -1865,7 +1870,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_gravitymod; } set { - if( value >= -1 && value <=28.0f) + if(value >= -1f && value <= 28.0f && value != m_gravitymod) { m_gravitymod = value; @@ -1888,7 +1893,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_friction; } set { - if (value >= 0 && value <= 255.0f) + if (value >= 0 && value <= 255.0f && value != m_friction) { m_friction = value; @@ -1911,7 +1916,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_bounce; } set { - if (value >= 0 && value <= 1.0f) + if (value >= 0 && value <= 1.0f && value != m_bounce) { m_bounce = value; @@ -4048,16 +4053,16 @@ namespace OpenSim.Region.Framework.Scenes /// Set the text displayed for this part. /// /// - /// - /// - public void SetText(string text, Vector3 color, double alpha) + /// + /// + public void SetText(string text, Vector3 newcolor, double newalpha) { Color oldcolor = Color; - Color = Color.FromArgb((int) (alpha * 0xff), - (int) (color.X * 0xff), - (int) (color.Y * 0xff), - (int) (color.Z * 0xff)); + Color = Color.FromArgb((int) (newalpha * 0xff), + (int) (newcolor.X * 0xff), + (int) (newcolor.Y * 0xff), + (int) (newcolor.Z * 0xff)); osUTF8 old = osUTF8Text; if(string.IsNullOrEmpty(text)) {