XML importing and exporting should be functional again
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1137 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -232,6 +232,8 @@ namespace libsecondlife
|
||||
/// </summary>
|
||||
public enum RequestFlagsType
|
||||
{
|
||||
/// <summary></summary>
|
||||
None = 0,
|
||||
/// <summary></summary>
|
||||
BugReportRequest = 1,
|
||||
/// <summary></summary>
|
||||
@@ -310,22 +312,16 @@ namespace libsecondlife
|
||||
/// <summary></summary>
|
||||
public ObjectProperties Properties;
|
||||
/// <summary></summary>
|
||||
[XmlIgnore]
|
||||
public ObjectPropertiesFamily PropertiesFamily;
|
||||
/// <summary></summary>
|
||||
public NameValue[] NameValues;
|
||||
/// <summary></summary>
|
||||
public ObjectData Data;
|
||||
|
||||
#endregion Public Members
|
||||
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary></summary>
|
||||
public ObjectData Data { get { return data; } }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
|
||||
internal ObjectData data;
|
||||
//internal DateTime lastInterpolation;
|
||||
|
||||
|
||||
|
||||
@@ -619,6 +619,30 @@ namespace libsecondlife
|
||||
Client.Network.SendPacket(select, simulator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select multiple objects. This will trigger the simulator to send us
|
||||
/// back ObjectProperties for each object
|
||||
/// </summary>
|
||||
/// <param name="simulator"></param>
|
||||
/// <param name="localIDs"></param>
|
||||
public void SelectObjects(Simulator simulator, uint[] localIDs)
|
||||
{
|
||||
ObjectSelectPacket select = new ObjectSelectPacket();
|
||||
|
||||
select.AgentData.AgentID = Client.Network.AgentID;
|
||||
select.AgentData.SessionID = Client.Network.SessionID;
|
||||
|
||||
select.ObjectData = new ObjectSelectPacket.ObjectDataBlock[localIDs.Length];
|
||||
|
||||
for (int i = 0; i < localIDs.Length; i++)
|
||||
{
|
||||
select.ObjectData[i] = new ObjectSelectPacket.ObjectDataBlock();
|
||||
select.ObjectData[i].ObjectLocalID = localIDs[i];
|
||||
}
|
||||
|
||||
Client.Network.SendPacket(select, simulator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -1213,6 +1237,7 @@ namespace libsecondlife
|
||||
data.ProfileBegin = LLObject.ProfileBeginFloat(block.ProfileBegin);
|
||||
data.ProfileEnd = LLObject.ProfileEndFloat(block.ProfileEnd);
|
||||
data.ProfileHollow = block.ProfileHollow;
|
||||
data.PCode = pcode;
|
||||
#endregion
|
||||
|
||||
#region Decode Additional packed parameters in ObjectData
|
||||
@@ -1375,7 +1400,7 @@ namespace libsecondlife
|
||||
prim.JointAxisOrAnchor = block.JointAxisOrAnchor;
|
||||
|
||||
// Object parameters
|
||||
prim.data = data;
|
||||
prim.Data = data;
|
||||
|
||||
// Textures, texture animations, particle system, and extra params
|
||||
prim.Textures = new Primitive.TextureEntry(block.TextureEntry, 0,
|
||||
@@ -1455,7 +1480,7 @@ namespace libsecondlife
|
||||
avatar.Rotation = rotation;
|
||||
avatar.AngularVelocity = angularVelocity;
|
||||
avatar.NameValues = nameValues;
|
||||
avatar.data = data;
|
||||
avatar.Data = data;
|
||||
avatar.GenericData = block.Data;
|
||||
|
||||
SetAvatarSittingOn(avatar, block.ParentID);
|
||||
@@ -1685,6 +1710,7 @@ namespace libsecondlife
|
||||
prim.LocalID = LocalID;
|
||||
prim.ID = FullID;
|
||||
prim.Flags = (LLObject.ObjectFlags)block.UpdateFlags;
|
||||
prim.Data.PCode = pcode;
|
||||
|
||||
switch (pcode)
|
||||
{
|
||||
@@ -1694,11 +1720,11 @@ namespace libsecondlife
|
||||
#region Foliage Decoding
|
||||
|
||||
// State
|
||||
prim.data.State = (uint)block.Data[i++];
|
||||
prim.Data.State = (uint)block.Data[i++];
|
||||
// CRC
|
||||
i += 4;
|
||||
// Material
|
||||
prim.data.Material = (uint)block.Data[i++];
|
||||
prim.Data.Material = (uint)block.Data[i++];
|
||||
// Click action
|
||||
prim.ClickAction = (ClickAction)block.Data[i++];
|
||||
// Scale
|
||||
@@ -1723,11 +1749,11 @@ namespace libsecondlife
|
||||
case PCode.Prim:
|
||||
#region Decode block and update Prim
|
||||
// State
|
||||
prim.data.State = (uint)block.Data[i++];
|
||||
prim.Data.State = (uint)block.Data[i++];
|
||||
// CRC
|
||||
i += 4;
|
||||
// Material
|
||||
prim.data.Material = (uint)block.Data[i++];
|
||||
prim.Data.Material = (uint)block.Data[i++];
|
||||
// Click action
|
||||
prim.ClickAction = (ClickAction)block.Data[i++];
|
||||
// Scale
|
||||
@@ -1872,25 +1898,25 @@ namespace libsecondlife
|
||||
}
|
||||
}
|
||||
|
||||
prim.data.PathCurve = (uint)block.Data[i++];
|
||||
prim.data.PathBegin = LLObject.PathBeginFloat(block.Data[i++]);
|
||||
prim.data.PathEnd = LLObject.PathEndFloat(block.Data[i++]);
|
||||
prim.data.PathScaleX = LLObject.PathScaleFloat(block.Data[i++]);
|
||||
prim.data.PathScaleY = LLObject.PathScaleFloat(block.Data[i++]);
|
||||
prim.data.PathShearX = LLObject.PathShearFloat(block.Data[i++]);
|
||||
prim.data.PathShearY = LLObject.PathShearFloat(block.Data[i++]);
|
||||
prim.data.PathTwist = (int)block.Data[i++];
|
||||
prim.data.PathTwistBegin = (int)block.Data[i++];
|
||||
prim.data.PathRadiusOffset = LLObject.PathRadiusOffsetFloat((sbyte)block.Data[i++]);
|
||||
prim.data.PathTaperX = LLObject.PathTaperFloat((sbyte)block.Data[i++]);
|
||||
prim.data.PathTaperY = LLObject.PathTaperFloat((sbyte)block.Data[i++]);
|
||||
prim.data.PathRevolutions = LLObject.PathRevolutionsFloat(block.Data[i++]);
|
||||
prim.data.PathSkew = LLObject.PathSkewFloat((sbyte)block.Data[i++]);
|
||||
prim.Data.PathCurve = (uint)block.Data[i++];
|
||||
prim.Data.PathBegin = LLObject.PathBeginFloat(block.Data[i++]);
|
||||
prim.Data.PathEnd = LLObject.PathEndFloat(block.Data[i++]);
|
||||
prim.Data.PathScaleX = LLObject.PathScaleFloat(block.Data[i++]);
|
||||
prim.Data.PathScaleY = LLObject.PathScaleFloat(block.Data[i++]);
|
||||
prim.Data.PathShearX = LLObject.PathShearFloat(block.Data[i++]);
|
||||
prim.Data.PathShearY = LLObject.PathShearFloat(block.Data[i++]);
|
||||
prim.Data.PathTwist = (int)block.Data[i++];
|
||||
prim.Data.PathTwistBegin = (int)block.Data[i++];
|
||||
prim.Data.PathRadiusOffset = LLObject.PathRadiusOffsetFloat((sbyte)block.Data[i++]);
|
||||
prim.Data.PathTaperX = LLObject.PathTaperFloat((sbyte)block.Data[i++]);
|
||||
prim.Data.PathTaperY = LLObject.PathTaperFloat((sbyte)block.Data[i++]);
|
||||
prim.Data.PathRevolutions = LLObject.PathRevolutionsFloat(block.Data[i++]);
|
||||
prim.Data.PathSkew = LLObject.PathSkewFloat((sbyte)block.Data[i++]);
|
||||
|
||||
prim.data.ProfileCurve = (uint)block.Data[i++];
|
||||
prim.data.ProfileBegin = Primitive.ProfileBeginFloat(block.Data[i++]);
|
||||
prim.data.ProfileEnd = Primitive.ProfileEndFloat(block.Data[i++]);
|
||||
prim.data.ProfileHollow = (uint)block.Data[i++];
|
||||
prim.Data.ProfileCurve = (uint)block.Data[i++];
|
||||
prim.Data.ProfileBegin = Primitive.ProfileBeginFloat(block.Data[i++]);
|
||||
prim.Data.ProfileEnd = Primitive.ProfileEndFloat(block.Data[i++]);
|
||||
prim.Data.ProfileHollow = (uint)block.Data[i++];
|
||||
|
||||
// TextureEntry
|
||||
int textureEntryLength = (int)(block.Data[i++] + (block.Data[i++] << 8) +
|
||||
|
||||
@@ -41,10 +41,8 @@ namespace libsecondlife
|
||||
public enum ExtraParamType : ushort
|
||||
{
|
||||
/// <summary>Whether this object has flexible parameters</summary>
|
||||
[XmlEnum("Flexible")]
|
||||
Flexible = 0x10,
|
||||
/// <summary>Whether this object has light parameters</summary>
|
||||
[XmlEnum("Light")]
|
||||
Light = 0x20
|
||||
}
|
||||
|
||||
@@ -77,19 +75,14 @@ namespace libsecondlife
|
||||
public class FlexibleData
|
||||
{
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("softness"), DefaultValue(0)]
|
||||
public int Softness;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("gravity"), DefaultValue(0)]
|
||||
public float Gravity;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("drag"), DefaultValue(0)]
|
||||
public float Drag;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("wind"), DefaultValue(0)]
|
||||
public float Wind;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("tension"), DefaultValue(0)]
|
||||
public float Tension;
|
||||
/// <summary></summary>
|
||||
public LLVector3 Force = LLVector3.Zero;
|
||||
@@ -154,22 +147,16 @@ namespace libsecondlife
|
||||
public class LightData
|
||||
{
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("red"), DefaultValue(0)]
|
||||
public byte R;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("green"), DefaultValue(0)]
|
||||
public byte G;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("blue"), DefaultValue(0)]
|
||||
public byte B;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("intensity"), DefaultValue(0)]
|
||||
public float Intensity;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("radius"), DefaultValue(0)]
|
||||
public float Radius;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("falloff"), DefaultValue(0)]
|
||||
public float Falloff;
|
||||
|
||||
/// <summary>
|
||||
@@ -285,16 +272,16 @@ namespace libsecondlife
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string output = "";
|
||||
string output = String.Empty;
|
||||
|
||||
output += "ID: " + ID + ", ";
|
||||
output += "GroupID: " + GroupID + ", ";
|
||||
output += "ParentID: " + ParentID + ", ";
|
||||
output += "LocalID: " + LocalID + ", ";
|
||||
output += "Flags: " + Flags + ", ";
|
||||
output += "State: " + data.State + ", ";
|
||||
output += "PCode: " + data.PCode + ", ";
|
||||
output += "Material: " + data.Material + ", ";
|
||||
output += "State: " + Data.State + ", ";
|
||||
output += "PCode: " + Data.PCode + ", ";
|
||||
output += "Material: " + Data.Material + ", ";
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace libsecondlife
|
||||
public struct LLUUID
|
||||
{
|
||||
/// <summary>The System.Guid object this struct wraps around</summary>
|
||||
[XmlAttribute]
|
||||
public Guid UUID;
|
||||
|
||||
/// <summary>Get a byte array of the 16 raw bytes making up the UUID</summary>
|
||||
@@ -310,10 +311,13 @@ namespace libsecondlife
|
||||
public struct LLVector3
|
||||
{
|
||||
/// <summary>X value</summary>
|
||||
[XmlAttribute]
|
||||
public float X;
|
||||
/// <summary>Y value</summary>
|
||||
[XmlAttribute]
|
||||
public float Y;
|
||||
/// <summary>Z value</summary>
|
||||
[XmlAttribute]
|
||||
public float Z;
|
||||
|
||||
/// <summary>
|
||||
@@ -565,11 +569,14 @@ namespace libsecondlife
|
||||
public struct LLVector3d
|
||||
{
|
||||
/// <summary>X value</summary>
|
||||
[XmlAttribute("x"), DefaultValue(0)] public double X;
|
||||
[XmlAttribute]
|
||||
public double X;
|
||||
/// <summary>Y value</summary>
|
||||
[XmlAttribute("y"), DefaultValue(0)] public double Y;
|
||||
[XmlAttribute]
|
||||
public double Y;
|
||||
/// <summary>Z value</summary>
|
||||
[XmlAttribute("z"), DefaultValue(0)] public double Z;
|
||||
[XmlAttribute]
|
||||
public double Z;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -734,13 +741,17 @@ namespace libsecondlife
|
||||
public struct LLVector4
|
||||
{
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("x"), DefaultValue(0)] public float X;
|
||||
[XmlAttribute]
|
||||
public float X;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("y"), DefaultValue(0)] public float Y;
|
||||
[XmlAttribute]
|
||||
public float Y;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("z"), DefaultValue(0)] public float Z;
|
||||
[XmlAttribute]
|
||||
public float Z;
|
||||
/// <summary></summary>
|
||||
[XmlAttribute("s"), DefaultValue(0)] public float S;
|
||||
[XmlAttribute]
|
||||
public float S;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -819,16 +830,16 @@ namespace libsecondlife
|
||||
public struct LLColor
|
||||
{
|
||||
/// <summary>Red</summary>
|
||||
[XmlAttribute("r"), DefaultValue(0)]
|
||||
[XmlAttribute]
|
||||
public float R;
|
||||
/// <summary>Green</summary>
|
||||
[XmlAttribute("g"), DefaultValue(0)]
|
||||
[XmlAttribute]
|
||||
public float G;
|
||||
/// <summary>Blue</summary>
|
||||
[XmlAttribute("b"), DefaultValue(0)]
|
||||
[XmlAttribute]
|
||||
public float B;
|
||||
/// <summary>Alpha</summary>
|
||||
[XmlAttribute("a"), DefaultValue(0)]
|
||||
[XmlAttribute]
|
||||
public float A;
|
||||
|
||||
/// <summary>
|
||||
@@ -910,13 +921,17 @@ namespace libsecondlife
|
||||
public struct LLQuaternion
|
||||
{
|
||||
/// <summary>X value</summary>
|
||||
[XmlAttribute("x"), DefaultValue(0)] public float X;
|
||||
[XmlAttribute]
|
||||
public float X;
|
||||
/// <summary>Y value</summary>
|
||||
[XmlAttribute("y"), DefaultValue(0)] public float Y;
|
||||
[XmlAttribute]
|
||||
public float Y;
|
||||
/// <summary>Z value</summary>
|
||||
[XmlAttribute("z"), DefaultValue(0)] public float Z;
|
||||
[XmlAttribute]
|
||||
public float Z;
|
||||
/// <summary>W value</summary>
|
||||
[XmlAttribute("w"), DefaultValue(0)] public float W;
|
||||
[XmlAttribute]
|
||||
public float W;
|
||||
|
||||
/// <summary>
|
||||
/// Build a quaternion object from a byte array
|
||||
|
||||
@@ -72,12 +72,12 @@ namespace libsecondlife.TestClient
|
||||
{
|
||||
return "Couldn't fetch permissions for the requested object, try again";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
GotPermissions = false;
|
||||
if (Properties.OwnerID != Client.Network.AgentID)
|
||||
if (Properties.OwnerID != Client.Network.AgentID && Client.Network.AgentID != Client.Self.ID)
|
||||
{
|
||||
// We need a MasterID field, those exports should be allowed as well
|
||||
// FIXME: We need a MasterID field, those exports should be allowed as well
|
||||
return "That object is owned by " + Properties.OwnerID + ", we don't have permission " +
|
||||
"to export it";
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace libsecondlife.TestClient
|
||||
}
|
||||
}
|
||||
}
|
||||
bool complete = RequestObjectProperties(prims, (int)TimeSpan.FromMinutes(1).TotalMilliseconds);
|
||||
bool complete = RequestObjectProperties(prims, 250);
|
||||
|
||||
//Serialize it!
|
||||
Helpers.PrimListToXml(prims, writer);
|
||||
@@ -144,22 +144,23 @@ namespace libsecondlife.TestClient
|
||||
|
||||
private bool RequestObjectProperties(List<Primitive> objects, int msPerRequest)
|
||||
{
|
||||
// Create an array of the local IDs of all the prims we are requesting properties for
|
||||
uint[] localids = new uint[objects.Count];
|
||||
|
||||
lock (PrimsWaiting)
|
||||
{
|
||||
PrimsWaiting.Clear();
|
||||
ObjectSelectPacket select = new ObjectSelectPacket();
|
||||
select.ObjectData = new ObjectSelectPacket.ObjectDataBlock[objects.Count];
|
||||
|
||||
for (int i = 0; i < objects.Count; ++i)
|
||||
{
|
||||
select.ObjectData[i] = new ObjectSelectPacket.ObjectDataBlock();
|
||||
select.ObjectData[i].ObjectLocalID = objects[i].LocalID;
|
||||
localids[i] = objects[i].LocalID;
|
||||
PrimsWaiting.Add(objects[i].ID, objects[i]);
|
||||
}
|
||||
select.AgentData.AgentID = Client.Self.ID;
|
||||
select.AgentData.SessionID = Client.Network.SessionID;
|
||||
Client.Network.SendPacket(select); // this should cause the server to send us ObjectProperty packets
|
||||
}
|
||||
return AllPropertiesReceived.WaitOne(msPerRequest * objects.Count, false);
|
||||
|
||||
Client.Objects.SelectObjects(Client.Network.CurrentSim, localids);
|
||||
|
||||
return AllPropertiesReceived.WaitOne(3000 + msPerRequest * objects.Count, false);
|
||||
}
|
||||
|
||||
void Objects_OnObjectPropertiesFamily(Simulator simulator, LLObject.ObjectPropertiesFamily properties)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace libsecondlife.TestClient
|
||||
public ImportCommand(TestClient testClient)
|
||||
{
|
||||
Name = "import";
|
||||
Description = "Import prims from an exported xml file. Usage: import [filename.xml]";
|
||||
Description = "Import prims from an exported xml file. Usage: import inputfile.xml";
|
||||
primDone = new AutoResetEvent(false);
|
||||
registeredCreateEvent = false;
|
||||
}
|
||||
@@ -217,8 +217,13 @@ namespace libsecondlife.TestClient
|
||||
currentClient.Objects.SetTextures(simulator, prim.LocalID, currentPrim.Textures);
|
||||
currentClient.Objects.SetLight(simulator, prim.LocalID, currentPrim.Light);
|
||||
currentClient.Objects.SetFlexible(simulator, prim.LocalID, currentPrim.Flexible);
|
||||
currentClient.Objects.SetName(simulator, prim.LocalID, currentPrim.Properties.Name);
|
||||
currentClient.Objects.SetDescription(simulator, prim.LocalID, currentPrim.Properties.Description);
|
||||
|
||||
if (!String.IsNullOrEmpty(currentPrim.Properties.Name))
|
||||
currentClient.Objects.SetName(simulator, prim.LocalID, currentPrim.Properties.Name);
|
||||
if (!String.IsNullOrEmpty(currentPrim.Properties.Description))
|
||||
currentClient.Objects.SetDescription(simulator, prim.LocalID,
|
||||
currentPrim.Properties.Description);
|
||||
|
||||
primsCreated.Add(prim);
|
||||
primDone.Set();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user