mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
Partial port of Avination's support for the new physics parameters.
Implements the parameters as properties, the serialization and database storage (MySQL only). Implements llSetPrimitiveParams for prim physics shape and the other 4 extra params. Only the prim shape type "None" is currently functional. No support for the Viewer UI (yet), that will be ported in due course. Lots more to port, this is a large-ish changeset.
This commit is contained in:
@@ -367,6 +367,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
|
||||
m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
|
||||
m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
|
||||
|
||||
m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
|
||||
m_SOPXmlProcessors.Add("Density", ProcessDensity);
|
||||
m_SOPXmlProcessors.Add("Friction", ProcessFriction);
|
||||
m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
|
||||
m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
|
||||
|
||||
#endregion
|
||||
|
||||
#region TaskInventoryXmlProcessors initialization
|
||||
@@ -594,6 +601,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
List<string> errorNodeNames;
|
||||
@@ -1257,6 +1289,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
|
||||
writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
|
||||
|
||||
if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
|
||||
writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
|
||||
if (sop.Density != 1000.0f)
|
||||
writer.WriteElementString("Density", sop.Density.ToString().ToLower());
|
||||
if (sop.Friction != 0.6f)
|
||||
writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
|
||||
if (sop.Bounciness != 0.5f)
|
||||
writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower());
|
||||
if (sop.GravityModifier != 1.0f)
|
||||
writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user