Merge branch 'master' into ghosts

ghosts
Justin Clark-Casey (justincc) 2014-09-02 18:34:54 +01:00
commit 1559a3a099
16 changed files with 783 additions and 433 deletions

View File

@ -51,7 +51,7 @@ namespace OpenSim.Framework.Serialization.External
/// <param name="xtr"></param> /// <param name="xtr"></param>
/// <returns>true on successful, false if there were any processing failures</returns> /// <returns>true on successful, false if there were any processing failures</returns>
public static bool ExecuteReadProcessors<NodeType>( public static bool ExecuteReadProcessors<NodeType>(
NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr) NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlReader>> processors, XmlReader xtr)
{ {
return ExecuteReadProcessors( return ExecuteReadProcessors(
nodeToFill, nodeToFill,
@ -75,8 +75,8 @@ namespace OpenSim.Framework.Serialization.External
/// <returns>true on successful, false if there were any processing failures</returns> /// <returns>true on successful, false if there were any processing failures</returns>
public static bool ExecuteReadProcessors<NodeType>( public static bool ExecuteReadProcessors<NodeType>(
NodeType nodeToFill, NodeType nodeToFill,
Dictionary<string, Action<NodeType, XmlTextReader>> processors, Dictionary<string, Action<NodeType, XmlReader>> processors,
XmlTextReader xtr, XmlReader xtr,
Action<NodeType, string, Exception> parseExceptionAction) Action<NodeType, string, Exception> parseExceptionAction)
{ {
bool errors = false; bool errors = false;
@ -88,7 +88,7 @@ namespace OpenSim.Framework.Serialization.External
// m_log.DebugFormat("[ExternalRepresentationUtils]: Processing: {0}", nodeName); // m_log.DebugFormat("[ExternalRepresentationUtils]: Processing: {0}", nodeName);
Action<NodeType, XmlTextReader> p = null; Action<NodeType, XmlReader> p = null;
if (processors.TryGetValue(xtr.Name, out p)) if (processors.TryGetValue(xtr.Name, out p))
{ {
// m_log.DebugFormat("[ExternalRepresentationUtils]: Found {0} processor, nodeName); // m_log.DebugFormat("[ExternalRepresentationUtils]: Found {0} processor, nodeName);

View File

@ -44,11 +44,11 @@ namespace OpenSim.Framework.Serialization.External
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static Dictionary<string, Action<LandData, XmlTextReader>> m_ldProcessors private static Dictionary<string, Action<LandData, XmlReader>> m_ldProcessors
= new Dictionary<string, Action<LandData, XmlTextReader>>(); = new Dictionary<string, Action<LandData, XmlReader>>();
private static Dictionary<string, Action<LandAccessEntry, XmlTextReader>> m_laeProcessors private static Dictionary<string, Action<LandAccessEntry, XmlReader>> m_laeProcessors
= new Dictionary<string, Action<LandAccessEntry, XmlTextReader>>(); = new Dictionary<string, Action<LandAccessEntry, XmlReader>>();
static LandDataSerializer() static LandDataSerializer()
{ {
@ -134,7 +134,7 @@ namespace OpenSim.Framework.Serialization.External
"AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList"))); "AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
} }
public static void ProcessParcelAccessList(LandData ld, XmlTextReader xtr) public static void ProcessParcelAccessList(LandData ld, XmlReader xtr)
{ {
if (!xtr.IsEmptyElement) if (!xtr.IsEmptyElement)
{ {

View File

@ -46,8 +46,8 @@ namespace OpenSim.Framework.Serialization.External
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static Dictionary<string, Action<InventoryItemBase, XmlTextReader>> m_InventoryItemXmlProcessors private static Dictionary<string, Action<InventoryItemBase, XmlReader>> m_InventoryItemXmlProcessors
= new Dictionary<string, Action<InventoryItemBase, XmlTextReader>>(); = new Dictionary<string, Action<InventoryItemBase, XmlReader>>();
#region InventoryItemBase Processor initialization #region InventoryItemBase Processor initialization
static UserInventoryItemSerializer() static UserInventoryItemSerializer()
@ -76,103 +76,103 @@ namespace OpenSim.Framework.Serialization.External
#endregion #endregion
#region InventoryItemBase Processors #region InventoryItemBase Processors
private static void ProcessName(InventoryItemBase item, XmlTextReader reader) private static void ProcessName(InventoryItemBase item, XmlReader reader)
{ {
item.Name = reader.ReadElementContentAsString("Name", String.Empty); item.Name = reader.ReadElementContentAsString("Name", String.Empty);
} }
private static void ProcessID(InventoryItemBase item, XmlTextReader reader) private static void ProcessID(InventoryItemBase item, XmlReader reader)
{ {
item.ID = Util.ReadUUID(reader, "ID"); item.ID = Util.ReadUUID(reader, "ID");
} }
private static void ProcessInvType(InventoryItemBase item, XmlTextReader reader) private static void ProcessInvType(InventoryItemBase item, XmlReader reader)
{ {
item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty); item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty);
} }
private static void ProcessCreatorUUID(InventoryItemBase item, XmlTextReader reader) private static void ProcessCreatorUUID(InventoryItemBase item, XmlReader reader)
{ {
item.CreatorId = reader.ReadElementContentAsString("CreatorUUID", String.Empty); item.CreatorId = reader.ReadElementContentAsString("CreatorUUID", String.Empty);
} }
private static void ProcessCreatorID(InventoryItemBase item, XmlTextReader reader) private static void ProcessCreatorID(InventoryItemBase item, XmlReader reader)
{ {
// when it exists, this overrides the previous // when it exists, this overrides the previous
item.CreatorId = reader.ReadElementContentAsString("CreatorID", String.Empty); item.CreatorId = reader.ReadElementContentAsString("CreatorID", String.Empty);
} }
private static void ProcessCreationDate(InventoryItemBase item, XmlTextReader reader) private static void ProcessCreationDate(InventoryItemBase item, XmlReader reader)
{ {
item.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty); item.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty);
} }
private static void ProcessOwner(InventoryItemBase item, XmlTextReader reader) private static void ProcessOwner(InventoryItemBase item, XmlReader reader)
{ {
item.Owner = Util.ReadUUID(reader, "Owner"); item.Owner = Util.ReadUUID(reader, "Owner");
} }
private static void ProcessDescription(InventoryItemBase item, XmlTextReader reader) private static void ProcessDescription(InventoryItemBase item, XmlReader reader)
{ {
item.Description = reader.ReadElementContentAsString("Description", String.Empty); item.Description = reader.ReadElementContentAsString("Description", String.Empty);
} }
private static void ProcessAssetType(InventoryItemBase item, XmlTextReader reader) private static void ProcessAssetType(InventoryItemBase item, XmlReader reader)
{ {
item.AssetType = reader.ReadElementContentAsInt("AssetType", String.Empty); item.AssetType = reader.ReadElementContentAsInt("AssetType", String.Empty);
} }
private static void ProcessAssetID(InventoryItemBase item, XmlTextReader reader) private static void ProcessAssetID(InventoryItemBase item, XmlReader reader)
{ {
item.AssetID = Util.ReadUUID(reader, "AssetID"); item.AssetID = Util.ReadUUID(reader, "AssetID");
} }
private static void ProcessSaleType(InventoryItemBase item, XmlTextReader reader) private static void ProcessSaleType(InventoryItemBase item, XmlReader reader)
{ {
item.SaleType = (byte)reader.ReadElementContentAsInt("SaleType", String.Empty); item.SaleType = (byte)reader.ReadElementContentAsInt("SaleType", String.Empty);
} }
private static void ProcessSalePrice(InventoryItemBase item, XmlTextReader reader) private static void ProcessSalePrice(InventoryItemBase item, XmlReader reader)
{ {
item.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty); item.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty);
} }
private static void ProcessBasePermissions(InventoryItemBase item, XmlTextReader reader) private static void ProcessBasePermissions(InventoryItemBase item, XmlReader reader)
{ {
item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty); item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
} }
private static void ProcessCurrentPermissions(InventoryItemBase item, XmlTextReader reader) private static void ProcessCurrentPermissions(InventoryItemBase item, XmlReader reader)
{ {
item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty); item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
} }
private static void ProcessEveryOnePermissions(InventoryItemBase item, XmlTextReader reader) private static void ProcessEveryOnePermissions(InventoryItemBase item, XmlReader reader)
{ {
item.EveryOnePermissions = (uint)reader.ReadElementContentAsInt("EveryOnePermissions", String.Empty); item.EveryOnePermissions = (uint)reader.ReadElementContentAsInt("EveryOnePermissions", String.Empty);
} }
private static void ProcessNextPermissions(InventoryItemBase item, XmlTextReader reader) private static void ProcessNextPermissions(InventoryItemBase item, XmlReader reader)
{ {
item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty); item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
} }
private static void ProcessFlags(InventoryItemBase item, XmlTextReader reader) private static void ProcessFlags(InventoryItemBase item, XmlReader reader)
{ {
item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty); item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty);
} }
private static void ProcessGroupID(InventoryItemBase item, XmlTextReader reader) private static void ProcessGroupID(InventoryItemBase item, XmlReader reader)
{ {
item.GroupID = Util.ReadUUID(reader, "GroupID"); item.GroupID = Util.ReadUUID(reader, "GroupID");
} }
private static void ProcessGroupOwned(InventoryItemBase item, XmlTextReader reader) private static void ProcessGroupOwned(InventoryItemBase item, XmlReader reader)
{ {
item.GroupOwned = Util.ReadBoolean(reader); item.GroupOwned = Util.ReadBoolean(reader);
} }
private static void ProcessCreatorData(InventoryItemBase item, XmlTextReader reader) private static void ProcessCreatorData(InventoryItemBase item, XmlReader reader)
{ {
item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
} }

View File

@ -2605,7 +2605,7 @@ namespace OpenSim.Framework
} }
#region Xml Serialization Utilities #region Xml Serialization Utilities
public static bool ReadBoolean(XmlTextReader reader) public static bool ReadBoolean(XmlReader reader)
{ {
// AuroraSim uses "int" for some fields that are boolean in OpenSim, e.g. "PassCollisions". Don't fail because of this. // AuroraSim uses "int" for some fields that are boolean in OpenSim, e.g. "PassCollisions". Don't fail because of this.
reader.ReadStartElement(); reader.ReadStartElement();
@ -2616,7 +2616,7 @@ namespace OpenSim.Framework
return result; return result;
} }
public static UUID ReadUUID(XmlTextReader reader, string name) public static UUID ReadUUID(XmlReader reader, string name)
{ {
UUID id; UUID id;
string idStr; string idStr;
@ -2635,7 +2635,7 @@ namespace OpenSim.Framework
return id; return id;
} }
public static Vector3 ReadVector(XmlTextReader reader, string name) public static Vector3 ReadVector(XmlReader reader, string name)
{ {
Vector3 vec; Vector3 vec;
@ -2648,7 +2648,7 @@ namespace OpenSim.Framework
return vec; return vec;
} }
public static Quaternion ReadQuaternion(XmlTextReader reader, string name) public static Quaternion ReadQuaternion(XmlReader reader, string name)
{ {
Quaternion quat = new Quaternion(); Quaternion quat = new Quaternion();
@ -2677,7 +2677,7 @@ namespace OpenSim.Framework
return quat; return quat;
} }
public static T ReadEnum<T>(XmlTextReader reader, string name) public static T ReadEnum<T>(XmlReader reader, string name)
{ {
string value = reader.ReadElementContentAsString(name, String.Empty); string value = reader.ReadElementContentAsString(name, String.Empty);
// !!!!! to deal with flags without commas // !!!!! to deal with flags without commas

View File

@ -829,7 +829,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
Vector3 pos; Vector3 pos;
bool single = m_Scene.GetObjectsToRez(rezAsset.Data, attachment, out objlist, out veclist, out bbox, out offsetHeight); bool single
= m_Scene.GetObjectsToRez(
rezAsset.Data, attachment, out objlist, out veclist, out bbox, out offsetHeight);
if (single) if (single)
{ {

View File

@ -111,6 +111,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
InventoryFolderBase objsFolder InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, m_userId, "Objects")[0]; = InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, m_userId, "Objects")[0];
item1.Folder = objsFolder.ID; item1.Folder = objsFolder.ID;
item1.Flags |= (uint)InventoryItemFlags.ObjectHasMultipleItems;
m_scene.AddInventoryItem(item1); m_scene.AddInventoryItem(item1);
SceneObjectGroup so SceneObjectGroup so

View File

@ -27,6 +27,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using System.Xml; using System.Xml;
using log4net.Config; using log4net.Config;
using NUnit.Framework; using NUnit.Framework;
@ -42,8 +43,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
[TestFixture] [TestFixture]
public class SerialiserTests : OpenSimTestCase public class SerialiserTests : OpenSimTestCase
{ {
private string xml = @" private const string ObjectRootPartStubXml =
<SceneObjectGroup> @"<SceneObjectGroup>
<RootPart> <RootPart>
<SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<AllowedDrop>false</AllowedDrop> <AllowedDrop>false</AllowedDrop>
@ -159,11 +160,234 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
</llsd> </llsd>
</DynAttrs> </DynAttrs>
</SceneObjectPart> </SceneObjectPart>
</RootPart> </RootPart>";
private const string ObjectWithNoOtherPartsXml = ObjectRootPartStubXml +
@"
<OtherParts /> <OtherParts />
</SceneObjectGroup>"; </SceneObjectGroup>";
private string badFloatsXml = @" private const string ObjectWithOtherPartsXml = ObjectRootPartStubXml +
@"
<OtherParts>
<Part>
<SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<AllowedDrop>false</AllowedDrop>
<CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
<FolderID><Guid>9958feb1-02a6-49e4-a4ce-eba6f578ee13</Guid></FolderID>
<InventorySerial>3</InventorySerial>
<UUID><Guid>9958feb1-02a6-49e4-a4ce-eba6f578ee13</Guid></UUID>
<LocalId>1154704500</LocalId>
<Name>Alien Head 1</Name>
<Material>3</Material>
<PassTouches>false</PassTouches>
<PassCollisions>false</PassCollisions>
<RegionHandle>21990232560640000</RegionHandle>
<ScriptAccessPin>0</ScriptAccessPin>
<GroupPosition><X>125.5655</X><Y>127.346</Y><Z>22.48036</Z></GroupPosition>
<OffsetPosition><X>-0.2171936</X><Y>0.1083984</Y><Z>0.0009994507</Z></OffsetPosition>
<RotationOffset><X>-0.5122106</X><Y>0.4851225</Y><Z>-0.4957454</Z><W>0.5064908</W></RotationOffset>
<Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
<AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
<Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
<Description>(No Description)</Description>
<Color><R>0</R><G>0</G><B>0</B><A>255</A></Color>
<Text/>
<SitName/>
<TouchName/>
<LinkNum>253</LinkNum>
<ClickAction>0</ClickAction>
<Shape>
<ProfileCurve>5</ProfileCurve>
<TextureEntry>Vw3dpvgTRUOiIUOGsnpWlAB/f38AAAAAgL8AAACAPwAAAAAAAAAF4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</TextureEntry>
<ExtraParams>AA==</ExtraParams>
<PathBegin>0</PathBegin>
<PathCurve>32</PathCurve>
<PathEnd>0</PathEnd>
<PathRadiusOffset>0</PathRadiusOffset>
<PathRevolutions>0</PathRevolutions>
<PathScaleX>100</PathScaleX>
<PathScaleY>100</PathScaleY>
<PathShearX>0</PathShearX>
<PathShearY>0</PathShearY>
<PathSkew>0</PathSkew>
<PathTaperX>0</PathTaperX>
<PathTaperY>0</PathTaperY>
<PathTwist>0</PathTwist>
<PathTwistBegin>0</PathTwistBegin>
<PCode>9</PCode>
<ProfileBegin>0</ProfileBegin>
<ProfileEnd>0</ProfileEnd>
<ProfileHollow>0</ProfileHollow>
<State>9</State>
<LastAttachPoint>0</LastAttachPoint>
<ProfileShape>HalfCircle</ProfileShape>
<HollowShape>Same</HollowShape>
<SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
<SculptType>0</SculptType>
<FlexiSoftness>0</FlexiSoftness>
<FlexiTension>0</FlexiTension>
<FlexiDrag>0</FlexiDrag>
<FlexiGravity>0</FlexiGravity>
<FlexiWind>0</FlexiWind>
<FlexiForceX>0</FlexiForceX>
<FlexiForceY>0</FlexiForceY>
<FlexiForceZ>0</FlexiForceZ>
<LightColorR>0</LightColorR>
<LightColorG>0</LightColorG>
<LightColorB>0</LightColorB>
<LightColorA>1</LightColorA>
<LightRadius>0</LightRadius>
<LightCutoff>0</LightCutoff>
<LightFalloff>0</LightFalloff>
<LightIntensity>1</LightIntensity>
<FlexiEntry>false</FlexiEntry>
<LightEntry>false</LightEntry>
<SculptEntry>false</SculptEntry>
</Shape>
<Scale><X>0.1148195</X><Y>0.0143891</Y><Z>0.02768878</Z></Scale>
<SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
<SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
<SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
<SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
<ParentID>1154704499</ParentID>
<CreationDate>1256611042</CreationDate>
<Category>0</Category>
<SalePrice>10</SalePrice>
<ObjectSaleType>0</ObjectSaleType>
<OwnershipCost>0</OwnershipCost>
<GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
<OwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></OwnerID>
<LastOwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></LastOwnerID>
<BaseMask>647168</BaseMask>
<OwnerMask>647168</OwnerMask>
<GroupMask>0</GroupMask>
<EveryoneMask>0</EveryoneMask>
<NextOwnerMask>581632</NextOwnerMask>
<Flags>None</Flags>
<CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
<CollisionSoundVolume>0</CollisionSoundVolume>
<AttachedPos><X>0</X><Y>0</Y><Z>0</Z></AttachedPos>
<TextureAnimation/>
<ParticleSystem/>
<PayPrice0>-2</PayPrice0>
<PayPrice1>-2</PayPrice1>
<PayPrice2>-2</PayPrice2>
<PayPrice3>-2</PayPrice3>
<PayPrice4>-2</PayPrice4>
</SceneObjectPart>
</Part>
<Part>
<SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<AllowedDrop>false</AllowedDrop>
<CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
<FolderID><Guid>674b6b86-f5aa-439a-8e00-0d75bc08c80a</Guid></FolderID>
<InventorySerial>3</InventorySerial>
<UUID><Guid>674b6b86-f5aa-439a-8e00-0d75bc08c80a</Guid></UUID>
<LocalId>1154704501</LocalId>
<Name>Alien Head 2</Name>
<Material>3</Material>
<PassTouches>false</PassTouches>
<PassCollisions>false</PassCollisions>
<RegionHandle>21990232560640000</RegionHandle>
<ScriptAccessPin>0</ScriptAccessPin>
<GroupPosition><X>125.5655</X><Y>127.346</Y><Z>22.48036</Z></GroupPosition>
<OffsetPosition><X>-0.2490997</X><Y>0.08520126</Y><Z>0.0009002686</Z></OffsetPosition>
<RotationOffset><X>-0.4765368</X><Y>0.5194498</Y><Z>-0.5301372</Z><W>0.4712104</W></RotationOffset>
<Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
<AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
<Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
<Description>(No Description)</Description>
<Color><R>0</R><G>0</G><B>0</B><A>255</A></Color>
<Text/>
<SitName/>
<TouchName/>
<LinkNum>252</LinkNum>
<ClickAction>0</ClickAction>
<Shape>
<ProfileCurve>0</ProfileCurve>
<TextureEntry>Vw3dpvgTRUOiIUOGsnpWlAB/f38AAAAAgL8AAACAPwAAAAAAAAAF4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</TextureEntry>
<ExtraParams>AA==</ExtraParams>
<PathBegin>0</PathBegin>
<PathCurve>32</PathCurve>
<PathEnd>0</PathEnd>
<PathRadiusOffset>0</PathRadiusOffset>
<PathRevolutions>0</PathRevolutions>
<PathScaleX>100</PathScaleX>
<PathScaleY>150</PathScaleY>
<PathShearX>0</PathShearX>
<PathShearY>0</PathShearY>
<PathSkew>0</PathSkew>
<PathTaperX>0</PathTaperX>
<PathTaperY>0</PathTaperY>
<PathTwist>0</PathTwist>
<PathTwistBegin>0</PathTwistBegin>
<PCode>9</PCode>
<ProfileBegin>0</ProfileBegin>
<ProfileEnd>0</ProfileEnd>
<ProfileHollow>0</ProfileHollow>
<State>9</State>
<LastAttachPoint>0</LastAttachPoint>
<ProfileShape>Circle</ProfileShape>
<HollowShape>Same</HollowShape>
<SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
<SculptType>0</SculptType>
<FlexiSoftness>0</FlexiSoftness>
<FlexiTension>0</FlexiTension>
<FlexiDrag>0</FlexiDrag>
<FlexiGravity>0</FlexiGravity>
<FlexiWind>0</FlexiWind>
<FlexiForceX>0</FlexiForceX>
<FlexiForceY>0</FlexiForceY>
<FlexiForceZ>0</FlexiForceZ>
<LightColorR>0</LightColorR>
<LightColorG>0</LightColorG>
<LightColorB>0</LightColorB>
<LightColorA>1</LightColorA>
<LightRadius>0</LightRadius>
<LightCutoff>0</LightCutoff>
<LightFalloff>0</LightFalloff>
<LightIntensity>1</LightIntensity>
<FlexiEntry>false</FlexiEntry>
<LightEntry>false</LightEntry>
<SculptEntry>false</SculptEntry>
</Shape>
<Scale><X>0.03574385</X><Y>0.05958032</Y><Z>0.04764182</Z></Scale>
<SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
<SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
<SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
<SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
<ParentID>1154704499</ParentID>
<CreationDate>1256611042</CreationDate>
<Category>0</Category>
<SalePrice>10</SalePrice>
<ObjectSaleType>0</ObjectSaleType>
<OwnershipCost>0</OwnershipCost>
<GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
<OwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></OwnerID>
<LastOwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></LastOwnerID>
<BaseMask>647168</BaseMask>
<OwnerMask>647168</OwnerMask>
<GroupMask>0</GroupMask>
<EveryoneMask>0</EveryoneMask>
<NextOwnerMask>581632</NextOwnerMask>
<Flags>None</Flags>
<CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
<CollisionSoundVolume>0</CollisionSoundVolume>
<AttachedPos><X>0</X><Y>0</Y><Z>0</Z></AttachedPos>
<TextureAnimation/>
<ParticleSystem/>
<PayPrice0>-2</PayPrice0>
<PayPrice1>-2</PayPrice1>
<PayPrice2>-2</PayPrice2>
<PayPrice3>-2</PayPrice3>
<PayPrice4>-2</PayPrice4>
</SceneObjectPart>
</Part>
</OtherParts>
</SceneObjectGroup>";
private const string ObjectWithBadFloatsXml = @"
<SceneObjectGroup> <SceneObjectGroup>
<RootPart> <RootPart>
<SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
@ -270,7 +494,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
<OtherParts /> <OtherParts />
</SceneObjectGroup>"; </SceneObjectGroup>";
private string xml2 = @" private const string ObjectWithNoPartsXml2 = @"
<SceneObjectGroup> <SceneObjectGroup>
<SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID> <CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID>
@ -377,12 +601,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
} }
[Test] [Test]
public void TestDeserializeXml() public void TestDeserializeXmlObjectWithNoOtherParts()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
//log4net.Config.XmlConfigurator.Configure(); TestHelpers.EnableLogging();
SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml); SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithNoOtherPartsXml);
SceneObjectPart rootPart = so.RootPart; SceneObjectPart rootPart = so.RootPart;
Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
@ -394,13 +618,52 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
// TODO: Check other properties // TODO: Check other properties
} }
[Test]
public void TestDeserializeXmlObjectWithOtherParts()
{
TestHelpers.InMethod();
TestHelpers.EnableLogging();
SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithOtherPartsXml);
SceneObjectPart[] parts = so.Parts;
Assert.AreEqual(3, so.Parts.Length);
{
SceneObjectPart part = parts[0];
Assert.That(part.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
Assert.That(part.Name, Is.EqualTo("PrimMyRide"));
OSDMap store = part.DynAttrs.GetStore("MyNamespace", "MyStore");
Assert.AreEqual(42, store["the answer"].AsInteger());
}
{
SceneObjectPart part = parts[1];
Assert.That(part.UUID, Is.EqualTo(new UUID("9958feb1-02a6-49e4-a4ce-eba6f578ee13")));
Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
Assert.That(part.Name, Is.EqualTo("Alien Head 1"));
}
{
SceneObjectPart part = parts[2];
Assert.That(part.UUID, Is.EqualTo(new UUID("674b6b86-f5aa-439a-8e00-0d75bc08c80a")));
Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
Assert.That(part.Name, Is.EqualTo("Alien Head 2"));
}
// TODO: Check other properties
}
[Test] [Test]
public void TestDeserializeBadFloatsXml() public void TestDeserializeBadFloatsXml()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(badFloatsXml); SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithBadFloatsXml);
SceneObjectPart rootPart = so.RootPart; SceneObjectPart rootPart = so.RootPart;
Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
@ -517,7 +780,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
//log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2); SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(ObjectWithNoPartsXml2);
SceneObjectPart rootPart = so.RootPart; SceneObjectPart rootPart = so.RootPart;
Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946")));

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Collections; using System.Collections;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading;
using System.Timers; using System.Timers;
using System.Xml; using System.Xml;
using OpenMetaverse; using OpenMetaverse;
@ -2192,34 +2193,47 @@ namespace OpenSim.Region.Framework.Scenes
/// Returns one object if the asset is a regular object, and multiple objects for a coalesced object. /// Returns one object if the asset is a regular object, and multiple objects for a coalesced object.
/// </remarks> /// </remarks>
/// <param name="assetData">Asset data</param> /// <param name="assetData">Asset data</param>
/// <param name="attachment">Whether the item is an attachment</param> /// <param name="isAttachment">True if the object is an attachment.</param>
/// <param name="objlist">The objects included in the asset</param> /// <param name="objlist">The objects included in the asset</param>
/// <param name="veclist">Relative positions of the objects</param> /// <param name="veclist">Relative positions of the objects</param>
/// <param name="bbox">Bounding box of all the objects</param> /// <param name="bbox">Bounding box of all the objects</param>
/// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box /// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box
/// to the centre of the root prim (relevant only when returning a single object)</param> /// to the centre of the root prim (relevant only when returning a single object)</param>
/// <returns>true = returning a single object; false = multiple objects</returns> /// <returns>
public bool GetObjectsToRez(byte[] assetData, bool attachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, /// true if returning a single object or deserialization fails, false if returning the coalesced
/// list of objects
/// </returns>
public bool GetObjectsToRez(
byte[] assetData, bool isAttachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist,
out Vector3 bbox, out float offsetHeight) out Vector3 bbox, out float offsetHeight)
{ {
objlist = new List<SceneObjectGroup>(); objlist = new List<SceneObjectGroup>();
veclist = new List<Vector3>(); veclist = new List<Vector3>();
XmlDocument doc = new XmlDocument();
string xmlData = Utils.BytesToString(assetData); string xmlData = Utils.BytesToString(assetData);
doc.LoadXml(xmlData);
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
if (e == null || attachment) // Single try
{ {
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
{
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
{
reader.Read();
bool isSingleObject = reader.Name != "CoalescedObject";
if (isSingleObject || isAttachment)
{
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(reader);
objlist.Add(g); objlist.Add(g);
veclist.Add(new Vector3(0, 0, 0)); veclist.Add(Vector3.Zero);
bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); bbox = g.GetAxisAlignedBoundingBox(out offsetHeight);
return true; return true;
} }
else else
{ {
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlData);
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
XmlElement coll = (XmlElement)e; XmlElement coll = (XmlElement)e;
float bx = Convert.ToSingle(coll.GetAttribute("x")); float bx = Convert.ToSingle(coll.GetAttribute("x"));
float by = Convert.ToSingle(coll.GetAttribute("y")); float by = Convert.ToSingle(coll.GetAttribute("y"));
@ -2243,10 +2257,24 @@ namespace OpenSim.Region.Framework.Scenes
float z = Convert.ToSingle(rawZ); float z = Convert.ToSingle(rawZ);
veclist.Add(new Vector3(x, y, z)); veclist.Add(new Vector3(x, y, z));
} }
}
return false; return false;
} }
}
}
}
catch (Exception e)
{
m_log.Error(
"[AGENT INVENTORY]: Deserialization of xml failed when looking for CoalescedObject tag. Exception ",
e);
bbox = Vector3.Zero;
offsetHeight = 0;
}
return true;
}
/// <summary> /// <summary>
/// Event Handler Rez an object into a scene /// Event Handler Rez an object into a scene

View File

@ -2110,8 +2110,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart target = GetSceneObjectPart(RayTargetID); SceneObjectPart target = GetSceneObjectPart(RayTargetID);
Vector3 direction = Vector3.Normalize(RayEnd - RayStart); Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); Vector3 AXOrigin = RayStart;
Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); Vector3 AXdirection = direction;
if (target != null) if (target != null)
{ {
@ -2133,13 +2133,13 @@ namespace OpenSim.Region.Framework.Scenes
// If we hit something // If we hit something
if (ei.HitTF) if (ei.HitTF)
{ {
Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); Vector3 scaleComponent = ei.AAfaceNormal;
if (scaleComponent.X != 0) ScaleOffset = scale.X; if (scaleComponent.X != 0) ScaleOffset = scale.X;
if (scaleComponent.Y != 0) ScaleOffset = scale.Y; if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
if (scaleComponent.Z != 0) ScaleOffset = scale.Z; if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
ScaleOffset = Math.Abs(ScaleOffset); ScaleOffset = Math.Abs(ScaleOffset);
Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); Vector3 intersectionpoint = ei.ipoint;
Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); Vector3 normal = ei.normal;
// Set the position to the intersection point // Set the position to the intersection point
Vector3 offset = (normal * (ScaleOffset / 2f)); Vector3 offset = (normal * (ScaleOffset / 2f));
pos = (intersectionpoint + offset); pos = (intersectionpoint + offset);
@ -2164,8 +2164,9 @@ namespace OpenSim.Region.Framework.Scenes
if (ei.HitTF) if (ei.HitTF)
{ {
pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); pos = ei.ipoint;
} else }
else
{ {
// fall back to our stupid functionality // fall back to our stupid functionality
pos = RayEnd; pos = RayEnd;
@ -3218,8 +3219,8 @@ namespace OpenSim.Region.Framework.Scenes
if (target != null && target2 != null) if (target != null && target2 != null)
{ {
Vector3 direction = Vector3.Normalize(RayEnd - RayStart); Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); Vector3 AXOrigin = RayStart;
Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); Vector3 AXdirection = direction;
pos = target2.AbsolutePosition; pos = target2.AbsolutePosition;
//m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
@ -3240,13 +3241,13 @@ namespace OpenSim.Region.Framework.Scenes
if (ei.HitTF) if (ei.HitTF)
{ {
Vector3 scale = target.Scale; Vector3 scale = target.Scale;
Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); Vector3 scaleComponent = ei.AAfaceNormal;
if (scaleComponent.X != 0) ScaleOffset = scale.X; if (scaleComponent.X != 0) ScaleOffset = scale.X;
if (scaleComponent.Y != 0) ScaleOffset = scale.Y; if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
if (scaleComponent.Z != 0) ScaleOffset = scale.Z; if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
ScaleOffset = Math.Abs(ScaleOffset); ScaleOffset = Math.Abs(ScaleOffset);
Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); Vector3 intersectionpoint = ei.ipoint;
Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); Vector3 normal = ei.normal;
Vector3 offset = normal * (ScaleOffset / 2f); Vector3 offset = normal * (ScaleOffset / 2f);
pos = intersectionpoint + offset; pos = intersectionpoint + offset;
@ -3266,6 +3267,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
} }
if (copy != null) if (copy != null)
EventManager.TriggerObjectAddedToScene(copy); EventManager.TriggerObjectAddedToScene(copy);
} }
@ -5098,7 +5100,7 @@ namespace OpenSim.Region.Framework.Scenes
case PhysicsJointType.Ball: case PhysicsJointType.Ball:
{ {
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); Vector3 proxyPos = jointAnchor;
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
} }
break; break;
@ -5123,7 +5125,7 @@ namespace OpenSim.Region.Framework.Scenes
jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene);
} }
Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); Vector3 proxyPos = jointAnchor;
Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; Quaternion q = trackedBody.RotationOffset * joint.LocalRotation;
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
@ -5224,8 +5226,8 @@ namespace OpenSim.Region.Framework.Scenes
y = Heightmap.Height - 1; y = Heightmap.Height - 1;
Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]);
Vector3 p1 = new Vector3(p0); Vector3 p1 = p0;
Vector3 p2 = new Vector3(p0); Vector3 p2 = p0;
p1.X += 1.0f; p1.X += 1.0f;
if (p1.X < Heightmap.Width) if (p1.X < Heightmap.Width)

View File

@ -1446,8 +1446,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
{ {
group.GrabMovement(offset, pos, remoteClient); group.GrabMovement(objectID, offset, pos, remoteClient);
} }
// This is outside the above permissions condition // This is outside the above permissions condition
// so that if the object is locked the client moving the object // so that if the object is locked the client moving the object
// get's it's position on the simulator even if it was the same as before // get's it's position on the simulator even if it was the same as before

View File

@ -827,6 +827,12 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks> /// </remarks>
public UUID FromFolderID { get; set; } public UUID FromFolderID { get; set; }
/// <summary>
/// If true then grabs are blocked no matter what the individual part BlockGrab setting.
/// </summary>
/// <value><c>true</c> if block grab override; otherwise, <c>false</c>.</value>
public bool BlockGrabOverride { get; set; }
/// <summary> /// <summary>
/// IDs of all avatars sat on this scene object. /// IDs of all avatars sat on this scene object.
/// </summary> /// </summary>
@ -902,6 +908,34 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void LoadScriptState(XmlReader reader)
{
// m_log.DebugFormat("[SCENE OBJECT GROUP]: Looking for script state for {0} in {1}", Name);
while (reader.ReadToFollowing("SavedScriptState"))
{
// m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name);
if (m_savedScriptState == null)
m_savedScriptState = new Dictionary<UUID, string>();
string uuid = reader.GetAttribute("UUID");
if (uuid != null)
{
// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name);
UUID itemid = new UUID(uuid);
if (itemid != UUID.Zero)
m_savedScriptState[itemid] = reader.ReadInnerXml();
}
else
{
m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0}", Name);
}
}
}
/// <summary> /// <summary>
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
/// </summary> /// </summary>
@ -2582,20 +2616,26 @@ namespace OpenSim.Region.Framework.Scenes
/// If object is physical, apply force to move it around /// If object is physical, apply force to move it around
/// If object is not physical, just put it at the resulting location /// If object is not physical, just put it at the resulting location
/// </summary> /// </summary>
/// <param name="partID">Part ID to check for grab</param>
/// <param name="offset">Always seems to be 0,0,0, so ignoring</param> /// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
/// <param name="pos">New position. We do the math here to turn it into a force</param> /// <param name="pos">New position. We do the math here to turn it into a force</param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void GrabMovement(Vector3 offset, Vector3 pos, IClientAPI remoteClient) public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient)
{ {
if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{ {
SceneObjectPart part = GetPart(partID);
if (part == null)
return;
PhysicsActor pa = m_rootPart.PhysActor; PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null) if (pa != null)
{ {
if (pa.IsPhysical) if (pa.IsPhysical)
{ {
if (!m_rootPart.BlockGrab) if (!BlockGrabOverride && !part.BlockGrab)
{ {
Vector3 llmoveforce = pos - AbsolutePosition; Vector3 llmoveforce = pos - AbsolutePosition;
Vector3 grabforce = llmoveforce; Vector3 grabforce = llmoveforce;

View File

@ -186,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool RETURN_AT_EDGE; public bool RETURN_AT_EDGE;
public bool BlockGrab; public bool BlockGrab { get; set; }
public bool StatusSandbox; public bool StatusSandbox;
@ -2044,7 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
/// <param name="xmlReader"></param> /// <param name="xmlReader"></param>
/// <returns></returns> /// <returns></returns>
public static SceneObjectPart FromXml(XmlTextReader xmlReader) public static SceneObjectPart FromXml(XmlReader xmlReader)
{ {
SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader);
@ -2079,22 +2079,6 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.RootPart.RETURN_AT_EDGE = p; ParentGroup.RootPart.RETURN_AT_EDGE = p;
} }
public bool GetBlockGrab()
{
if (ParentGroup.IsDeleted)
return false;
return ParentGroup.RootPart.BlockGrab;
}
public void SetBlockGrab(bool p)
{
if (ParentGroup.IsDeleted)
return;
ParentGroup.RootPart.BlockGrab = p;
}
public void SetStatusSandbox(bool p) public void SetStatusSandbox(bool p)
{ {
if (ParentGroup.IsDeleted) if (ParentGroup.IsDeleted)

View File

@ -622,9 +622,14 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!",
// m_velocity, Name, Scene.RegionInfo.RegionName); // m_velocity, Name, Scene.RegionInfo.RegionName);
} }
else if (ParentPart != null)
{
return ParentPart.ParentGroup.Velocity;
}
return m_velocity; return m_velocity;
} }
set set
{ {
if (PhysicsActor != null) if (PhysicsActor != null)
@ -2631,7 +2636,7 @@ namespace OpenSim.Region.Framework.Scenes
// Vector3 standPositionAdjustment // Vector3 standPositionAdjustment
// = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f); // = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f);
Vector3 adjustmentForSitPosition = part.SitTargetPosition * part.GetWorldRotation(); Vector3 adjustmentForSitPosition = (part.SitTargetPosition + OffsetPosition) * part.GetWorldRotation();
// XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than
// hardcoding here. // hardcoding here.

View File

@ -58,58 +58,60 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
/// <param name="xmlData"></param> /// <param name="xmlData"></param>
/// <returns>The scene object deserialized. Null on failure.</returns> /// <returns>The scene object deserialized. Null on failure.</returns>
public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) public static SceneObjectGroup FromOriginalXmlFormat(string xmlData)
{
using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
return FromOriginalXmlFormat(reader);
}
/// <summary>
/// Deserialize a scene object from the original xml format
/// </summary>
/// <param name="xmlData"></param>
/// <returns>The scene object deserialized. Null on failure.</returns>
public static SceneObjectGroup FromOriginalXmlFormat(XmlReader reader)
{ {
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = System.Environment.TickCount; //int time = System.Environment.TickCount;
SceneObjectGroup sceneObject = null;
try try
{ {
StringReader sr;
XmlTextReader reader;
XmlNodeList parts;
XmlDocument doc;
int linkNum; int linkNum;
doc = new XmlDocument(); reader.ReadToFollowing("RootPart");
doc.LoadXml(xmlData); reader.ReadToFollowing("SceneObjectPart");
parts = doc.GetElementsByTagName("RootPart"); sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
reader.ReadToFollowing("OtherParts");
if (parts.Count == 0) if (reader.ReadToDescendant("Part"))
throw new Exception("Invalid Xml format - no root part"); {
do
sr = new StringReader(parts[0].InnerXml); {
reader = new XmlTextReader(sr); if (reader.ReadToDescendant("SceneObjectPart"))
SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
reader.Close();
sr.Close();
parts = doc.GetElementsByTagName("Part");
for (int i = 0; i < parts.Count; i++)
{ {
sr = new StringReader(parts[i].InnerXml);
reader = new XmlTextReader(sr);
SceneObjectPart part = SceneObjectPart.FromXml(reader); SceneObjectPart part = SceneObjectPart.FromXml(reader);
linkNum = part.LinkNum; linkNum = part.LinkNum;
sceneObject.AddPart(part); sceneObject.AddPart(part);
part.LinkNum = linkNum; part.LinkNum = linkNum;
part.TrimPermissions(); part.TrimPermissions();
reader.Close(); }
sr.Close(); }
while (reader.ReadToNextSibling("Part"));
} }
// Script state may, or may not, exist. Not having any, is NOT // Script state may, or may not, exist. Not having any, is NOT
// ever a problem. // ever a problem.
sceneObject.LoadScriptState(doc); sceneObject.LoadScriptState(reader);
return sceneObject;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed. Exception {0}", e);
"[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
return null; return null;
} }
return sceneObject;
} }
/// <summary> /// <summary>
@ -369,14 +371,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region manual serialization #region manual serialization
private static Dictionary<string, Action<SceneObjectPart, XmlTextReader>> m_SOPXmlProcessors private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors
= new Dictionary<string, Action<SceneObjectPart, XmlTextReader>>(); = new Dictionary<string, Action<SceneObjectPart, XmlReader>>();
private static Dictionary<string, Action<TaskInventoryItem, XmlTextReader>> m_TaskInventoryXmlProcessors private static Dictionary<string, Action<TaskInventoryItem, XmlReader>> m_TaskInventoryXmlProcessors
= new Dictionary<string, Action<TaskInventoryItem, XmlTextReader>>(); = new Dictionary<string, Action<TaskInventoryItem, XmlReader>>();
private static Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>> m_ShapeXmlProcessors private static Dictionary<string, Action<PrimitiveBaseShape, XmlReader>> m_ShapeXmlProcessors
= new Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>>(); = new Dictionary<string, Action<PrimitiveBaseShape, XmlReader>>();
static SceneObjectSerializer() static SceneObjectSerializer()
{ {
@ -532,112 +534,112 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
#region SOPXmlProcessors #region SOPXmlProcessors
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) private static void ProcessAllowedDrop(SceneObjectPart obj, XmlReader reader)
{ {
obj.AllowedDrop = Util.ReadBoolean(reader); obj.AllowedDrop = Util.ReadBoolean(reader);
} }
private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessCreatorID(SceneObjectPart obj, XmlReader reader)
{ {
obj.CreatorID = Util.ReadUUID(reader, "CreatorID"); obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
} }
private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) private static void ProcessCreatorData(SceneObjectPart obj, XmlReader reader)
{ {
obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
} }
private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessFolderID(SceneObjectPart obj, XmlReader reader)
{ {
obj.FolderID = Util.ReadUUID(reader, "FolderID"); obj.FolderID = Util.ReadUUID(reader, "FolderID");
} }
private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader) private static void ProcessInventorySerial(SceneObjectPart obj, XmlReader reader)
{ {
obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty); obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty);
} }
private static void ProcessTaskInventory(SceneObjectPart obj, XmlTextReader reader) private static void ProcessTaskInventory(SceneObjectPart obj, XmlReader reader)
{ {
obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory"); obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory");
} }
private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessUUID(SceneObjectPart obj, XmlReader reader)
{ {
obj.UUID = Util.ReadUUID(reader, "UUID"); obj.UUID = Util.ReadUUID(reader, "UUID");
} }
private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader) private static void ProcessLocalId(SceneObjectPart obj, XmlReader reader)
{ {
obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty); obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty);
} }
private static void ProcessName(SceneObjectPart obj, XmlTextReader reader) private static void ProcessName(SceneObjectPart obj, XmlReader reader)
{ {
obj.Name = reader.ReadElementString("Name"); obj.Name = reader.ReadElementString("Name");
} }
private static void ProcessMaterial(SceneObjectPart obj, XmlTextReader reader) private static void ProcessMaterial(SceneObjectPart obj, XmlReader reader)
{ {
obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty); obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty);
} }
private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPassTouches(SceneObjectPart obj, XmlReader reader)
{ {
obj.PassTouches = Util.ReadBoolean(reader); obj.PassTouches = Util.ReadBoolean(reader);
} }
private static void ProcessPassCollisions(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPassCollisions(SceneObjectPart obj, XmlReader reader)
{ {
obj.PassCollisions = Util.ReadBoolean(reader); obj.PassCollisions = Util.ReadBoolean(reader);
} }
private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) private static void ProcessRegionHandle(SceneObjectPart obj, XmlReader reader)
{ {
obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty); obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty);
} }
private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlTextReader reader) private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlReader reader)
{ {
obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty); obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty);
} }
private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader) private static void ProcessGroupPosition(SceneObjectPart obj, XmlReader reader)
{ {
obj.GroupPosition = Util.ReadVector(reader, "GroupPosition"); obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
} }
private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) private static void ProcessOffsetPosition(SceneObjectPart obj, XmlReader reader)
{ {
obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ; obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
} }
private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader) private static void ProcessRotationOffset(SceneObjectPart obj, XmlReader reader)
{ {
obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset"); obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
} }
private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader) private static void ProcessVelocity(SceneObjectPart obj, XmlReader reader)
{ {
obj.Velocity = Util.ReadVector(reader, "Velocity"); obj.Velocity = Util.ReadVector(reader, "Velocity");
} }
private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader) private static void ProcessAngularVelocity(SceneObjectPart obj, XmlReader reader)
{ {
obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity"); obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
} }
private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader) private static void ProcessAcceleration(SceneObjectPart obj, XmlReader reader)
{ {
obj.Acceleration = Util.ReadVector(reader, "Acceleration"); obj.Acceleration = Util.ReadVector(reader, "Acceleration");
} }
private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader) private static void ProcessDescription(SceneObjectPart obj, XmlReader reader)
{ {
obj.Description = reader.ReadElementString("Description"); obj.Description = reader.ReadElementString("Description");
} }
private static void ProcessColor(SceneObjectPart obj, XmlTextReader reader) private static void ProcessColor(SceneObjectPart obj, XmlReader reader)
{ {
reader.ReadStartElement("Color"); reader.ReadStartElement("Color");
if (reader.Name == "R") if (reader.Name == "R")
@ -651,57 +653,57 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
} }
private static void ProcessText(SceneObjectPart obj, XmlTextReader reader) private static void ProcessText(SceneObjectPart obj, XmlReader reader)
{ {
obj.Text = reader.ReadElementString("Text", String.Empty); obj.Text = reader.ReadElementString("Text", String.Empty);
} }
private static void ProcessSitName(SceneObjectPart obj, XmlTextReader reader) private static void ProcessSitName(SceneObjectPart obj, XmlReader reader)
{ {
obj.SitName = reader.ReadElementString("SitName", String.Empty); obj.SitName = reader.ReadElementString("SitName", String.Empty);
} }
private static void ProcessTouchName(SceneObjectPart obj, XmlTextReader reader) private static void ProcessTouchName(SceneObjectPart obj, XmlReader reader)
{ {
obj.TouchName = reader.ReadElementString("TouchName", String.Empty); obj.TouchName = reader.ReadElementString("TouchName", String.Empty);
} }
private static void ProcessLinkNum(SceneObjectPart obj, XmlTextReader reader) private static void ProcessLinkNum(SceneObjectPart obj, XmlReader reader)
{ {
obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty); obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty);
} }
private static void ProcessClickAction(SceneObjectPart obj, XmlTextReader reader) private static void ProcessClickAction(SceneObjectPart obj, XmlReader reader)
{ {
obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
} }
private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader)
{ {
obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
} }
private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader) private static void ProcessDensity(SceneObjectPart obj, XmlReader reader)
{ {
obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty); obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
} }
private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader) private static void ProcessFriction(SceneObjectPart obj, XmlReader reader)
{ {
obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty); obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
} }
private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) private static void ProcessBounce(SceneObjectPart obj, XmlReader reader)
{ {
obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty); obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty);
} }
private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) private static void ProcessGravityModifier(SceneObjectPart obj, XmlReader reader)
{ {
obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
} }
private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
{ {
List<string> errorNodeNames; List<string> errorNodeNames;
obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); obj.Shape = ReadShape(reader, "Shape", out errorNodeNames);
@ -714,163 +716,163 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
} }
private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) private static void ProcessScale(SceneObjectPart obj, XmlReader reader)
{ {
obj.Scale = Util.ReadVector(reader, "Scale"); obj.Scale = Util.ReadVector(reader, "Scale");
} }
private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader) private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlReader reader)
{ {
obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation"); obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
} }
private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader) private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlReader reader)
{ {
obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition"); obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
} }
private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader) private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlReader reader)
{ {
obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL"); obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL");
} }
private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader) private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlReader reader)
{ {
obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL"); obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
} }
private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessParentID(SceneObjectPart obj, XmlReader reader)
{ {
string str = reader.ReadElementContentAsString("ParentID", String.Empty); string str = reader.ReadElementContentAsString("ParentID", String.Empty);
obj.ParentID = Convert.ToUInt32(str); obj.ParentID = Convert.ToUInt32(str);
} }
private static void ProcessCreationDate(SceneObjectPart obj, XmlTextReader reader) private static void ProcessCreationDate(SceneObjectPart obj, XmlReader reader)
{ {
obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty); obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty);
} }
private static void ProcessCategory(SceneObjectPart obj, XmlTextReader reader) private static void ProcessCategory(SceneObjectPart obj, XmlReader reader)
{ {
obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty); obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty);
} }
private static void ProcessSalePrice(SceneObjectPart obj, XmlTextReader reader) private static void ProcessSalePrice(SceneObjectPart obj, XmlReader reader)
{ {
obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty); obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty);
} }
private static void ProcessObjectSaleType(SceneObjectPart obj, XmlTextReader reader) private static void ProcessObjectSaleType(SceneObjectPart obj, XmlReader reader)
{ {
obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty); obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty);
} }
private static void ProcessOwnershipCost(SceneObjectPart obj, XmlTextReader reader) private static void ProcessOwnershipCost(SceneObjectPart obj, XmlReader reader)
{ {
obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty); obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty);
} }
private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessGroupID(SceneObjectPart obj, XmlReader reader)
{ {
obj.GroupID = Util.ReadUUID(reader, "GroupID"); obj.GroupID = Util.ReadUUID(reader, "GroupID");
} }
private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessOwnerID(SceneObjectPart obj, XmlReader reader)
{ {
obj.OwnerID = Util.ReadUUID(reader, "OwnerID"); obj.OwnerID = Util.ReadUUID(reader, "OwnerID");
} }
private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader) private static void ProcessLastOwnerID(SceneObjectPart obj, XmlReader reader)
{ {
obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
} }
private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader) private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader)
{ {
obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty);
} }
private static void ProcessOwnerMask(SceneObjectPart obj, XmlTextReader reader) private static void ProcessOwnerMask(SceneObjectPart obj, XmlReader reader)
{ {
obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty); obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty);
} }
private static void ProcessGroupMask(SceneObjectPart obj, XmlTextReader reader) private static void ProcessGroupMask(SceneObjectPart obj, XmlReader reader)
{ {
obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty); obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty);
} }
private static void ProcessEveryoneMask(SceneObjectPart obj, XmlTextReader reader) private static void ProcessEveryoneMask(SceneObjectPart obj, XmlReader reader)
{ {
obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty); obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty);
} }
private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlTextReader reader) private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlReader reader)
{ {
obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty); obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty);
} }
private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) private static void ProcessFlags(SceneObjectPart obj, XmlReader reader)
{ {
obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags"); obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
} }
private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) private static void ProcessCollisionSound(SceneObjectPart obj, XmlReader reader)
{ {
obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound"); obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound");
} }
private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlReader reader)
{ {
obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty);
} }
private static void ProcessMediaUrl(SceneObjectPart obj, XmlTextReader reader) private static void ProcessMediaUrl(SceneObjectPart obj, XmlReader reader)
{ {
obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
} }
private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader) private static void ProcessAttachedPos(SceneObjectPart obj, XmlReader reader)
{ {
obj.AttachedPos = Util.ReadVector(reader, "AttachedPos"); obj.AttachedPos = Util.ReadVector(reader, "AttachedPos");
} }
private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) private static void ProcessDynAttrs(SceneObjectPart obj, XmlReader reader)
{ {
obj.DynAttrs.ReadXml(reader); obj.DynAttrs.ReadXml(reader);
} }
private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) private static void ProcessTextureAnimation(SceneObjectPart obj, XmlReader reader)
{ {
obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
} }
private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader) private static void ProcessParticleSystem(SceneObjectPart obj, XmlReader reader)
{ {
obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
} }
private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPayPrice0(SceneObjectPart obj, XmlReader reader)
{ {
obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty); obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty);
} }
private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPayPrice1(SceneObjectPart obj, XmlReader reader)
{ {
obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty); obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty);
} }
private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPayPrice2(SceneObjectPart obj, XmlReader reader)
{ {
obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty); obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty);
} }
private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPayPrice3(SceneObjectPart obj, XmlReader reader)
{ {
obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty); obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty);
} }
private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader) private static void ProcessPayPrice4(SceneObjectPart obj, XmlReader reader)
{ {
obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
} }
@ -878,122 +880,122 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#endregion #endregion
#region TaskInventoryXmlProcessors #region TaskInventoryXmlProcessors
private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIAssetID(TaskInventoryItem item, XmlReader reader)
{ {
item.AssetID = Util.ReadUUID(reader, "AssetID"); item.AssetID = Util.ReadUUID(reader, "AssetID");
} }
private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlReader reader)
{ {
item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty); item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
} }
private static void ProcessTICreationDate(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTICreationDate(TaskInventoryItem item, XmlReader reader)
{ {
item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty); item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty);
} }
private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTICreatorID(TaskInventoryItem item, XmlReader reader)
{ {
item.CreatorID = Util.ReadUUID(reader, "CreatorID"); item.CreatorID = Util.ReadUUID(reader, "CreatorID");
} }
private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTICreatorData(TaskInventoryItem item, XmlReader reader)
{ {
item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
} }
private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIDescription(TaskInventoryItem item, XmlReader reader)
{ {
item.Description = reader.ReadElementContentAsString("Description", String.Empty); item.Description = reader.ReadElementContentAsString("Description", String.Empty);
} }
private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlReader reader)
{ {
item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty); item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty);
} }
private static void ProcessTIFlags(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIFlags(TaskInventoryItem item, XmlReader reader)
{ {
item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty); item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty);
} }
private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIGroupID(TaskInventoryItem item, XmlReader reader)
{ {
item.GroupID = Util.ReadUUID(reader, "GroupID"); item.GroupID = Util.ReadUUID(reader, "GroupID");
} }
private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlReader reader)
{ {
item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty); item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty);
} }
private static void ProcessTIInvType(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIInvType(TaskInventoryItem item, XmlReader reader)
{ {
item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty); item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty);
} }
private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIItemID(TaskInventoryItem item, XmlReader reader)
{ {
item.ItemID = Util.ReadUUID(reader, "ItemID"); item.ItemID = Util.ReadUUID(reader, "ItemID");
} }
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIOldItemID(TaskInventoryItem item, XmlReader reader)
{ {
item.OldItemID = Util.ReadUUID(reader, "OldItemID"); item.OldItemID = Util.ReadUUID(reader, "OldItemID");
} }
private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlReader reader)
{ {
item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
} }
private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIName(TaskInventoryItem item, XmlReader reader)
{ {
item.Name = reader.ReadElementContentAsString("Name", String.Empty); item.Name = reader.ReadElementContentAsString("Name", String.Empty);
} }
private static void ProcessTINextPermissions(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTINextPermissions(TaskInventoryItem item, XmlReader reader)
{ {
item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty); item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
} }
private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIOwnerID(TaskInventoryItem item, XmlReader reader)
{ {
item.OwnerID = Util.ReadUUID(reader, "OwnerID"); item.OwnerID = Util.ReadUUID(reader, "OwnerID");
} }
private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlReader reader)
{ {
item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty); item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
} }
private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIParentID(TaskInventoryItem item, XmlReader reader)
{ {
item.ParentID = Util.ReadUUID(reader, "ParentID"); item.ParentID = Util.ReadUUID(reader, "ParentID");
} }
private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIParentPartID(TaskInventoryItem item, XmlReader reader)
{ {
item.ParentPartID = Util.ReadUUID(reader, "ParentPartID"); item.ParentPartID = Util.ReadUUID(reader, "ParentPartID");
} }
private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlReader reader)
{ {
item.PermsGranter = Util.ReadUUID(reader, "PermsGranter"); item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
} }
private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIPermsMask(TaskInventoryItem item, XmlReader reader)
{ {
item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty); item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty);
} }
private static void ProcessTIType(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIType(TaskInventoryItem item, XmlReader reader)
{ {
item.Type = reader.ReadElementContentAsInt("Type", String.Empty); item.Type = reader.ReadElementContentAsInt("Type", String.Empty);
} }
private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlReader reader)
{ {
item.OwnerChanged = Util.ReadBoolean(reader); item.OwnerChanged = Util.ReadBoolean(reader);
} }
@ -1001,243 +1003,243 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#endregion #endregion
#region ShapeXmlProcessors #region ShapeXmlProcessors
private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty); shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty);
} }
private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlReader reader)
{ {
byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
} }
private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams")); shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams"));
} }
private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty); shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty);
} }
private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty); shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty);
} }
private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty); shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty);
} }
private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty); shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty);
} }
private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty); shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty);
} }
private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty); shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty);
} }
private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty); shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty);
} }
private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty); shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty);
} }
private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty); shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty);
} }
private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty); shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty);
} }
private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty); shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty);
} }
private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty); shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty);
} }
private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty); shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty);
} }
private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty); shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty);
} }
private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty); shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty);
} }
private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty); shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty);
} }
private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty); shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty);
} }
private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty); shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty);
} }
private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpScale(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.Scale = Util.ReadVector(reader, "Scale"); shp.Scale = Util.ReadVector(reader, "Scale");
} }
private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpState(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty);
} }
private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty); shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty);
} }
private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
} }
private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
} }
private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
} }
private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty); shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty);
} }
private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty);
} }
private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty); shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty);
} }
private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty); shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty);
} }
private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty); shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty);
} }
private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty); shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty);
} }
private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty); shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty);
} }
private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty); shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty);
} }
private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty); shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty);
} }
private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty); shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty);
} }
private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty); shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty);
} }
private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty); shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty);
} }
private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty); shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty);
} }
private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty); shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty);
} }
private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty); shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty);
} }
private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty); shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty);
} }
private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty); shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty);
} }
private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.FlexiEntry = Util.ReadBoolean(reader); shp.FlexiEntry = Util.ReadBoolean(reader);
} }
private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.LightEntry = Util.ReadBoolean(reader); shp.LightEntry = Util.ReadBoolean(reader);
} }
private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlReader reader)
{ {
shp.SculptEntry = Util.ReadBoolean(reader); shp.SculptEntry = Util.ReadBoolean(reader);
} }
private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader)
{ {
string value = reader.ReadElementContentAsString("Media", String.Empty); string value = reader.ReadElementContentAsString("Media", String.Empty);
shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
@ -1589,7 +1591,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
} }
public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) public static SceneObjectPart Xml2ToSOP(XmlReader reader)
{ {
SceneObjectPart obj = new SceneObjectPart(); SceneObjectPart obj = new SceneObjectPart();
@ -1610,7 +1612,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
return obj; return obj;
} }
public static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) public static TaskInventoryDictionary ReadTaskInventory(XmlReader reader, string name)
{ {
TaskInventoryDictionary tinv = new TaskInventoryDictionary(); TaskInventoryDictionary tinv = new TaskInventoryDictionary();
@ -1651,7 +1653,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
/// <param name="name">The name of the xml element containing the shape</param> /// <param name="name">The name of the xml element containing the shape</param>
/// <param name="errors">a list containing the failing node names. If no failures then null.</param> /// <param name="errors">a list containing the failing node names. If no failures then null.</param>
/// <returns>The shape parsed</returns> /// <returns>The shape parsed</returns>
public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames) public static PrimitiveBaseShape ReadShape(XmlReader reader, string name, out List<string> errorNodeNames)
{ {
List<string> internalErrorNodeNames = null; List<string> internalErrorNodeNames = null;

View File

@ -1377,12 +1377,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB)
{ m_host.BlockGrab = value != 0;
if (value != 0)
m_host.SetBlockGrab(true); if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT) == ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT)
else m_host.ParentGroup.BlockGrabOverride = value != 0;
m_host.SetBlockGrab(false);
}
if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE)
{ {
@ -1443,10 +1441,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0; return 0;
case ScriptBaseClass.STATUS_BLOCK_GRAB: case ScriptBaseClass.STATUS_BLOCK_GRAB:
if (m_host.GetBlockGrab()) return m_host.BlockGrab ? 1 : 0;
return 1;
else case ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT:
return 0; return m_host.ParentGroup.BlockGrabOverride ? 1 : 0;
case ScriptBaseClass.STATUS_DIE_AT_EDGE: case ScriptBaseClass.STATUS_DIE_AT_EDGE:
if (m_host.GetDieAtEdge()) if (m_host.GetDieAtEdge())
@ -11315,20 +11313,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z));
break; break;
case ScriptBaseClass.OBJECT_ROT: case ScriptBaseClass.OBJECT_ROT:
{
Quaternion rot = Quaternion.Identity; Quaternion rot = Quaternion.Identity;
if (obj.ParentGroup.IsAttachment)
{
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
if (sp != null)
rot = sp.GetWorldRotation();
}
else
{
if (obj.ParentGroup.RootPart == obj) if (obj.ParentGroup.RootPart == obj)
rot = obj.ParentGroup.GroupRotation; rot = obj.ParentGroup.GroupRotation;
else else
rot = obj.GetWorldRotation(); rot = obj.GetWorldRotation();
}
LSL_Rotation objrot = new LSL_Rotation(rot); LSL_Rotation objrot = new LSL_Rotation(rot);
ret.Add(objrot); ret.Add(objrot);
}
break; break;
case ScriptBaseClass.OBJECT_VELOCITY: case ScriptBaseClass.OBJECT_VELOCITY:
ret.Add(new LSL_Vector(obj.Velocity)); Vector3 vel = Vector3.Zero;
if (obj.ParentGroup.IsAttachment)
{
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
if (sp != null)
vel = sp.Velocity;
}
else
{
vel = obj.Velocity;
}
ret.Add(vel);
break; break;
case ScriptBaseClass.OBJECT_OWNER: case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(obj.OwnerID.ToString())); ret.Add(new LSL_String(obj.OwnerID.ToString()));

View File

@ -48,6 +48,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int STATUS_DIE_AT_EDGE = 128; public const int STATUS_DIE_AT_EDGE = 128;
public const int STATUS_RETURN_AT_EDGE = 256; public const int STATUS_RETURN_AT_EDGE = 256;
public const int STATUS_CAST_SHADOWS = 512; public const int STATUS_CAST_SHADOWS = 512;
public const int STATUS_BLOCK_GRAB_OBJECT = 1024;
public const int AGENT = 1; public const int AGENT = 1;
public const int AGENT_BY_LEGACY_NAME = 1; public const int AGENT_BY_LEGACY_NAME = 1;