From cf9ebd301c32fa7cd991e78647ce011b0aefc796 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Mar 2012 18:24:04 +0000 Subject: bug fixs, added a default physics shape estimator based on being a mesh or not and use it on unlink if new root part as type none. Viewer doesn't get updated even with fullupdates we are missing something still --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 84 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a68b3eb..84ed40c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -986,7 +986,11 @@ namespace OpenSim.Region.Framework.Scenes public PrimitiveBaseShape Shape { get { return m_shape; } - set { m_shape = value;} + set + { + m_shape = value; + m_physicsShapeType = DefaultPhysicsShapeType(); + } } /// @@ -1377,31 +1381,68 @@ namespace OpenSim.Region.Framework.Scenes { if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial) { - m_material = (Material)value; - m_friction = SOPMaterialData.friction(m_material); - m_bounce = SOPMaterialData.bounce(m_material); - if (PhysActor != null) + bool update = false; + + if (m_material != (Material)value) + { + update = true; + m_material = (Material)value; + } + + if (m_friction != SOPMaterialData.friction(m_material)) + { + update = true; + m_friction = SOPMaterialData.friction(m_material); + } + + if (m_bounce != SOPMaterialData.bounce(m_material)) { - PhysActor.SetMaterial((int)value); + update = true; + m_bounce = SOPMaterialData.bounce(m_material); + } + + if (update) + { + if (PhysActor != null) + { + PhysActor.SetMaterial((int)value); + } + if(ParentGroup != null) + ParentGroup.HasGroupChanged = true; + ScheduleFullUpdateIfNone(); } } } } + // not a propriety to move to methods place later + public byte DefaultPhysicsShapeType() + { + byte type; + + if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh)) + type = (byte)PhysShapeType.convex; + else + type = (byte)PhysShapeType.prim; + + return type; + } + public byte PhysicsShapeType { get { return m_physicsShapeType; } set { - if (value < 0 || value >= (byte)PhysShapeType.convex) - value = (byte)PhysShapeType.prim; //convex not supported ? - - else if (value == (byte)PhysShapeType.none) + if (value >= 0 && value <= (byte)PhysShapeType.convex) { - if (ParentGroup == null || ParentGroup.RootPart == this) - value = (byte)PhysShapeType.prim; + if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) + m_physicsShapeType = DefaultPhysicsShapeType(); + else + m_physicsShapeType = value; + ScheduleFullUpdateIfNone(); } - m_physicsShapeType = value; + else + m_physicsShapeType = DefaultPhysicsShapeType(); } } @@ -1413,6 +1454,7 @@ namespace OpenSim.Region.Framework.Scenes if (value >=1 && value <= 22587.0) { m_density = value; + ScheduleFullUpdateIfNone(); } } } @@ -1423,6 +1465,7 @@ namespace OpenSim.Region.Framework.Scenes set { if( value >= -1 && value <=28.0f) m_gravitymod = value; + ScheduleFullUpdateIfNone(); } } @@ -1434,6 +1477,7 @@ namespace OpenSim.Region.Framework.Scenes if (value >= 0 && value <= 255.0f) { m_friction = value; + ScheduleFullUpdateIfNone(); } } } @@ -1446,6 +1490,7 @@ namespace OpenSim.Region.Framework.Scenes if (value >= 0 && value <= 1.0f) { m_bounce = value; + ScheduleFullUpdateIfNone(); } } } @@ -2942,6 +2987,19 @@ namespace OpenSim.Region.Framework.Scenes APIDTarget = Quaternion.Identity; } + + + public void ScheduleFullUpdateIfNone() + { + if (ParentGroup == null) + return; + +// ??? ParentGroup.HasGroupChanged = true; + + if (UpdateFlag != UpdateRequired.FULL) + ScheduleFullUpdate(); + } + /// /// Schedules this prim for a full update /// -- cgit v1.1 From 84ca09f7c5cec051014181853083e52691bb7e07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Mar 2012 02:24:13 +0000 Subject: added ObjectPhysicsProperties http event message to send viewer that data. For now on caps/EventQueue, and still only used on a material change... --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 84ed40c..f188e8d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4730,7 +4730,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); } - + // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); } -- cgit v1.1