Update svn properties.
parent
e80dcfa9f6
commit
5c310efb79
|
@ -1,56 +1,56 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||||
<class name="OpenSim.Framework.RegionSettings, OpenSim.Framework" table="RegionSettings" lazy="false">
|
<class name="OpenSim.Framework.RegionSettings, OpenSim.Framework" table="RegionSettings" lazy="false">
|
||||||
<id name="RegionUUID" column="RegionId" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
<id name="RegionUUID" column="RegionId" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
|
|
||||||
<property name="BlockTerraform" type="System.Boolean" />
|
<property name="BlockTerraform" type="System.Boolean" />
|
||||||
<property name="BlockFly" type="System.Boolean" />
|
<property name="BlockFly" type="System.Boolean" />
|
||||||
<property name="AllowDamage" type="System.Boolean" />
|
<property name="AllowDamage" type="System.Boolean" />
|
||||||
<property name="RestrictPushing" type="System.Boolean" />
|
<property name="RestrictPushing" type="System.Boolean" />
|
||||||
<property name="AllowLandResell" type="System.Boolean" />
|
<property name="AllowLandResell" type="System.Boolean" />
|
||||||
<property name="AllowLandJoinDivide" type="System.Boolean" />
|
<property name="AllowLandJoinDivide" type="System.Boolean" />
|
||||||
<property name="BlockShowInSearch" type="System.Boolean" />
|
<property name="BlockShowInSearch" type="System.Boolean" />
|
||||||
|
|
||||||
<property name="AgentLimit" type="System.Int32" />
|
<property name="AgentLimit" type="System.Int32" />
|
||||||
<property name="ObjectBonus" type="System.Double" />
|
<property name="ObjectBonus" type="System.Double" />
|
||||||
<property name="Maturity" type="System.Int32" />
|
<property name="Maturity" type="System.Int32" />
|
||||||
|
|
||||||
<property name="DisableScripts" type="System.Boolean" />
|
<property name="DisableScripts" type="System.Boolean" />
|
||||||
<property name="DisableCollisions" type="System.Boolean" />
|
<property name="DisableCollisions" type="System.Boolean" />
|
||||||
<property name="DisablePhysics" type="System.Boolean" />
|
<property name="DisablePhysics" type="System.Boolean" />
|
||||||
|
|
||||||
<property name="TerrainTexture1" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="TerrainTexture1" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="TerrainTexture2" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="TerrainTexture2" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="TerrainTexture3" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="TerrainTexture3" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="TerrainTexture4" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="TerrainTexture4" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
|
|
||||||
<property name="Elevation1NW" type="System.Double" />
|
<property name="Elevation1NW" type="System.Double" />
|
||||||
<property name="Elevation2NW" type="System.Double" />
|
<property name="Elevation2NW" type="System.Double" />
|
||||||
<property name="Elevation1NE" type="System.Double" />
|
<property name="Elevation1NE" type="System.Double" />
|
||||||
<property name="Elevation2NE" type="System.Double" />
|
<property name="Elevation2NE" type="System.Double" />
|
||||||
<property name="Elevation1SE" type="System.Double" />
|
<property name="Elevation1SE" type="System.Double" />
|
||||||
<property name="Elevation2SE" type="System.Double" />
|
<property name="Elevation2SE" type="System.Double" />
|
||||||
<property name="Elevation1SW" type="System.Double" />
|
<property name="Elevation1SW" type="System.Double" />
|
||||||
<property name="Elevation2SW" type="System.Double" />
|
<property name="Elevation2SW" type="System.Double" />
|
||||||
|
|
||||||
<property name="WaterHeight" type="System.Double" />
|
<property name="WaterHeight" type="System.Double" />
|
||||||
<property name="TerrainRaiseLimit" type="System.Double" />
|
<property name="TerrainRaiseLimit" type="System.Double" />
|
||||||
<property name="TerrainLowerLimit" type="System.Double" />
|
<property name="TerrainLowerLimit" type="System.Double" />
|
||||||
|
|
||||||
<property name="UseEstateSun" type="System.Boolean" />
|
<property name="UseEstateSun" type="System.Boolean" />
|
||||||
<property name="Sandbox" type="System.Boolean" />
|
<property name="Sandbox" type="System.Boolean" />
|
||||||
|
|
||||||
<property name="SunVector" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
|
<property name="SunVector" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
|
||||||
<column name="SunVectorX" />
|
<column name="SunVectorX" />
|
||||||
<column name="SunVectorY" />
|
<column name="SunVectorY" />
|
||||||
<column name="SunVectorZ" />
|
<column name="SunVectorZ" />
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<property name="FixedSun" type="System.Boolean" />
|
<property name="FixedSun" type="System.Boolean" />
|
||||||
<property name="SunPosition" type="System.Double" />
|
<property name="SunPosition" type="System.Double" />
|
||||||
<property name="Covenant" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="Covenant" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
|
|
||||||
</class>
|
</class>
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||||
<class name="OpenSim.Data.NHibernate.UserFriend, OpenSim.Data.NHibernate" table="UserFriends" lazy="false">
|
<class name="OpenSim.Data.NHibernate.UserFriend, OpenSim.Data.NHibernate" table="UserFriends" lazy="false">
|
||||||
<id name="UserFriendID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
<id name="UserFriendID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
|
||||||
<generator class="assigned" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="FriendID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="FriendID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="FriendPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
<property name="FriendPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
|
||||||
</class>
|
</class>
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
||||||
|
|
|
@ -1,328 +1,328 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public class WearableItem
|
public class WearableItem
|
||||||
{
|
{
|
||||||
public string WearableName = "";
|
public string WearableName = "";
|
||||||
public WearableType WearType = WearableType.Invalid;
|
public WearableType WearType = WearableType.Invalid;
|
||||||
|
|
||||||
public string ItemInfo = "Created Wearable";
|
public string ItemInfo = "Created Wearable";
|
||||||
|
|
||||||
public SortedList<int, VisualSetting> VisualSettings = new SortedList<int, VisualSetting>();
|
public SortedList<int, VisualSetting> VisualSettings = new SortedList<int, VisualSetting>();
|
||||||
// public LLObject.TextureEntry TextureEntry = null;
|
// public LLObject.TextureEntry TextureEntry = null;
|
||||||
//public byte[] TextureEntry = null;
|
//public byte[] TextureEntry = null;
|
||||||
|
|
||||||
public List<string> TextureStrings = new List<string>();
|
public List<string> TextureStrings = new List<string>();
|
||||||
|
|
||||||
//permissions
|
//permissions
|
||||||
public uint BaseMask = 0;
|
public uint BaseMask = 0;
|
||||||
public uint OwnerMask = 0;
|
public uint OwnerMask = 0;
|
||||||
public uint GroupMask = 0;
|
public uint GroupMask = 0;
|
||||||
public uint EveryoneMask = 0;
|
public uint EveryoneMask = 0;
|
||||||
public uint NextOwnerMask = 0;
|
public uint NextOwnerMask = 0;
|
||||||
|
|
||||||
public UUID CreatorID = UUID.Zero;
|
public UUID CreatorID = UUID.Zero;
|
||||||
public UUID OwnerID = UUID.Zero;
|
public UUID OwnerID = UUID.Zero;
|
||||||
public UUID LastOwnerID = UUID.Zero;
|
public UUID LastOwnerID = UUID.Zero;
|
||||||
public UUID GroupID = UUID.Zero;
|
public UUID GroupID = UUID.Zero;
|
||||||
|
|
||||||
//sale
|
//sale
|
||||||
public string SaleType = "not";
|
public string SaleType = "not";
|
||||||
public int SalePrice = 10;
|
public int SalePrice = 10;
|
||||||
|
|
||||||
private string BuildString = "";
|
private string BuildString = "";
|
||||||
|
|
||||||
|
|
||||||
public WearableItem(string wearableName, WearableType type)
|
public WearableItem(string wearableName, WearableType type)
|
||||||
{
|
{
|
||||||
WearableName = wearableName;
|
WearableName = wearableName;
|
||||||
WearType = type;
|
WearType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WearableItem(string wearableName)
|
public WearableItem(string wearableName)
|
||||||
{
|
{
|
||||||
WearableName = wearableName;
|
WearableName = wearableName;
|
||||||
WearType = ConvertNameToType(WearableName);
|
WearType = ConvertNameToType(WearableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WearableItem(WearableType type)
|
public WearableItem(WearableType type)
|
||||||
{
|
{
|
||||||
WearType = type;
|
WearType = type;
|
||||||
WearableName = Enum.GetName(typeof(WearableType), type).ToLower();
|
WearableName = Enum.GetName(typeof(WearableType), type).ToLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WearableItem()
|
public WearableItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddVisualSetting(VisualSetting setting)
|
public void AddVisualSetting(VisualSetting setting)
|
||||||
{
|
{
|
||||||
if (!VisualSettings.ContainsKey(setting.VisualParam.ParamID))
|
if (!VisualSettings.ContainsKey(setting.VisualParam.ParamID))
|
||||||
{
|
{
|
||||||
VisualSettings.Add(setting.VisualParam.ParamID, setting);
|
VisualSettings.Add(setting.VisualParam.ParamID, setting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetSetting(string paramName, out VisualSetting paramSetting)
|
public bool TryGetSetting(string paramName, out VisualSetting paramSetting)
|
||||||
{
|
{
|
||||||
foreach (VisualSetting setting in VisualSettings.Values)
|
foreach (VisualSetting setting in VisualSettings.Values)
|
||||||
{
|
{
|
||||||
if (setting.VisualParam.Name == paramName)
|
if (setting.VisualParam.Name == paramName)
|
||||||
{
|
{
|
||||||
paramSetting = setting;
|
paramSetting = setting;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paramSetting = null;
|
paramSetting = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetParamValue(string paramName, float value)
|
public bool SetParamValue(string paramName, float value)
|
||||||
{
|
{
|
||||||
VisualSetting paramSetting;
|
VisualSetting paramSetting;
|
||||||
if (TryGetSetting(paramName, out paramSetting))
|
if (TryGetSetting(paramName, out paramSetting))
|
||||||
{
|
{
|
||||||
if ((value >= paramSetting.VisualParam.MinValue) && (value <= paramSetting.VisualParam.MaxValue))
|
if ((value >= paramSetting.VisualParam.MinValue) && (value <= paramSetting.VisualParam.MaxValue))
|
||||||
{
|
{
|
||||||
paramSetting.Value = value;
|
paramSetting.Value = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RandomiseValues()
|
public void RandomiseValues()
|
||||||
{
|
{
|
||||||
foreach (VisualSetting setting in VisualSettings.Values)
|
foreach (VisualSetting setting in VisualSettings.Values)
|
||||||
{
|
{
|
||||||
//int randNum = Util.RandomClass.Next(0, 1000);
|
//int randNum = Util.RandomClass.Next(0, 1000);
|
||||||
float range = setting.VisualParam.MaxValue - setting.VisualParam.MinValue;
|
float range = setting.VisualParam.MaxValue - setting.VisualParam.MinValue;
|
||||||
// float val =((float) randNum )/ ((float)(1000.0f / range));
|
// float val =((float) randNum )/ ((float)(1000.0f / range));
|
||||||
float val = (float)OpenSim.Framework.Util.RandomClass.NextDouble() * range * 0.2f;
|
float val = (float)OpenSim.Framework.Util.RandomClass.NextDouble() * range * 0.2f;
|
||||||
setting.Value = setting.VisualParam.MinValue + (range / 2) + val;
|
setting.Value = setting.VisualParam.MinValue + (range / 2) + val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WearableType ConvertNameToType(string name)
|
public WearableType ConvertNameToType(string name)
|
||||||
{
|
{
|
||||||
return (WearableType)Enum.Parse(typeof(WearableType), name, true);
|
return (WearableType)Enum.Parse(typeof(WearableType), name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToAssetFormat()
|
public string ToAssetFormat()
|
||||||
{
|
{
|
||||||
BuildString = "LLWearable version 22\n";
|
BuildString = "LLWearable version 22\n";
|
||||||
BuildString += "New Item \n";
|
BuildString += "New Item \n";
|
||||||
BuildString += ItemInfo + "\n";
|
BuildString += ItemInfo + "\n";
|
||||||
|
|
||||||
|
|
||||||
AddSectionStart("permissions");
|
AddSectionStart("permissions");
|
||||||
AddTabbedNameValueLine("base_mask", BaseMask.ToString("00000000"));
|
AddTabbedNameValueLine("base_mask", BaseMask.ToString("00000000"));
|
||||||
AddTabbedNameValueLine("owner_mask", OwnerMask.ToString("00000000"));
|
AddTabbedNameValueLine("owner_mask", OwnerMask.ToString("00000000"));
|
||||||
AddTabbedNameValueLine("group_mask", GroupMask.ToString("00000000"));
|
AddTabbedNameValueLine("group_mask", GroupMask.ToString("00000000"));
|
||||||
AddTabbedNameValueLine("everyone_mask", EveryoneMask.ToString("00000000"));
|
AddTabbedNameValueLine("everyone_mask", EveryoneMask.ToString("00000000"));
|
||||||
AddTabbedNameValueLine("next_owner_mask", NextOwnerMask.ToString("00000000"));
|
AddTabbedNameValueLine("next_owner_mask", NextOwnerMask.ToString("00000000"));
|
||||||
AddTabbedNameValueLine("creator_id", CreatorID.ToString());
|
AddTabbedNameValueLine("creator_id", CreatorID.ToString());
|
||||||
AddTabbedNameValueLine("owner_id", OwnerID.ToString());
|
AddTabbedNameValueLine("owner_id", OwnerID.ToString());
|
||||||
AddTabbedNameValueLine("last_owner_id", LastOwnerID.ToString());
|
AddTabbedNameValueLine("last_owner_id", LastOwnerID.ToString());
|
||||||
AddTabbedNameValueLine("group_id", GroupID.ToString());
|
AddTabbedNameValueLine("group_id", GroupID.ToString());
|
||||||
AddSectionEnd();
|
AddSectionEnd();
|
||||||
|
|
||||||
AddSectionStart("sale_info");
|
AddSectionStart("sale_info");
|
||||||
AddTabbedNameValueLine("sale_type", SaleType.ToString());
|
AddTabbedNameValueLine("sale_type", SaleType.ToString());
|
||||||
AddTabbedNameValueLine("sale_price", SalePrice.ToString());
|
AddTabbedNameValueLine("sale_price", SalePrice.ToString());
|
||||||
AddSectionEnd();
|
AddSectionEnd();
|
||||||
|
|
||||||
AddNameValueLine("type", ((byte)WearType).ToString());
|
AddNameValueLine("type", ((byte)WearType).ToString());
|
||||||
AddNameValueLine("parameters", VisualSettings.Count.ToString());
|
AddNameValueLine("parameters", VisualSettings.Count.ToString());
|
||||||
|
|
||||||
foreach (KeyValuePair<int, VisualSetting> kp in VisualSettings)
|
foreach (KeyValuePair<int, VisualSetting> kp in VisualSettings)
|
||||||
{
|
{
|
||||||
AddNameValueLine(kp.Key.ToString(), kp.Value.Value.ToString(CultureInfo.InvariantCulture));
|
AddNameValueLine(kp.Key.ToString(), kp.Value.Value.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
if (TextureStrings.Count == 0)
|
if (TextureStrings.Count == 0)
|
||||||
{
|
{
|
||||||
AddNameValueLine("textures", "0"); //todo output texture entry
|
AddNameValueLine("textures", "0"); //todo output texture entry
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddNameValueLine("textures", TextureStrings.Count.ToString());
|
AddNameValueLine("textures", TextureStrings.Count.ToString());
|
||||||
for (int i = 0; i < TextureStrings.Count; i++)
|
for (int i = 0; i < TextureStrings.Count; i++)
|
||||||
{
|
{
|
||||||
BuildString += TextureStrings[i] + "\n";
|
BuildString += TextureStrings[i] + "\n";
|
||||||
}
|
}
|
||||||
BuildString += "\n";
|
BuildString += "\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return BuildString;
|
return BuildString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveToFile(string fileName)
|
public void SaveToFile(string fileName)
|
||||||
{
|
{
|
||||||
File.WriteAllText(fileName, this.ToAssetFormat());
|
File.WriteAllText(fileName, this.ToAssetFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSectionStart(string sectionName)
|
public void AddSectionStart(string sectionName)
|
||||||
{
|
{
|
||||||
BuildString += "\t" + sectionName + " 0\n";
|
BuildString += "\t" + sectionName + " 0\n";
|
||||||
BuildString += "\t{\n";
|
BuildString += "\t{\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSectionEnd()
|
public void AddSectionEnd()
|
||||||
{
|
{
|
||||||
BuildString += "\t}\n";
|
BuildString += "\t}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddTabbedNameValueLine(string name, string value)
|
private void AddTabbedNameValueLine(string name, string value)
|
||||||
{
|
{
|
||||||
BuildString += "\t\t";
|
BuildString += "\t\t";
|
||||||
BuildString += name + "\t";
|
BuildString += name + "\t";
|
||||||
BuildString += value + "\n";
|
BuildString += value + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddNameValueLine(string name, string value)
|
private void AddNameValueLine(string name, string value)
|
||||||
{
|
{
|
||||||
// BuildString += "\t\t";
|
// BuildString += "\t\t";
|
||||||
BuildString += name + " ";
|
BuildString += name + " ";
|
||||||
BuildString += value + "\n";
|
BuildString += value + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Static Methods
|
#region Static Methods
|
||||||
public static List<VisualParam> FindParamsForWearable(string wearableName)
|
public static List<VisualParam> FindParamsForWearable(string wearableName)
|
||||||
{
|
{
|
||||||
List<VisualParam> wearableParams = new List<VisualParam>();
|
List<VisualParam> wearableParams = new List<VisualParam>();
|
||||||
foreach (VisualParam param in VisualParams.Params.Values)
|
foreach (VisualParam param in VisualParams.Params.Values)
|
||||||
{
|
{
|
||||||
if (param.Wearable == wearableName)
|
if (param.Wearable == wearableName)
|
||||||
{
|
{
|
||||||
wearableParams.Add(param);
|
wearableParams.Add(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wearableParams;
|
return wearableParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WearableItem Create(string wearableTypeName)
|
public static WearableItem Create(string wearableTypeName)
|
||||||
{
|
{
|
||||||
WearableItem wearableItem = new WearableItem(wearableTypeName);
|
WearableItem wearableItem = new WearableItem(wearableTypeName);
|
||||||
List<VisualParam> typeParams = FindParamsForWearable(wearableTypeName);
|
List<VisualParam> typeParams = FindParamsForWearable(wearableTypeName);
|
||||||
foreach (VisualParam param in typeParams)
|
foreach (VisualParam param in typeParams)
|
||||||
{
|
{
|
||||||
wearableItem.AddVisualSetting(new VisualSetting(param));
|
wearableItem.AddVisualSetting(new VisualSetting(param));
|
||||||
}
|
}
|
||||||
return wearableItem;
|
return wearableItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WearableItem CreateFromAsset(string assetData)
|
public static WearableItem CreateFromAsset(string assetData)
|
||||||
{
|
{
|
||||||
UUID creatorID = UUID.Zero;
|
UUID creatorID = UUID.Zero;
|
||||||
UUID ownerID = UUID.Zero;
|
UUID ownerID = UUID.Zero;
|
||||||
UUID lastOwnerID = UUID.Zero;
|
UUID lastOwnerID = UUID.Zero;
|
||||||
UUID groupID = UUID.Zero;
|
UUID groupID = UUID.Zero;
|
||||||
|
|
||||||
char[] newlineDelimiter = { '\n' };
|
char[] newlineDelimiter = { '\n' };
|
||||||
string[] lines = assetData.Split(newlineDelimiter);
|
string[] lines = assetData.Split(newlineDelimiter);
|
||||||
|
|
||||||
WearableItem wearableObject = null;
|
WearableItem wearableObject = null;
|
||||||
Regex r = new Regex("[\t ]+");
|
Regex r = new Regex("[\t ]+");
|
||||||
bool reachedParams = false;
|
bool reachedParams = false;
|
||||||
bool reachedTextures = false;
|
bool reachedTextures = false;
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
string trimLine = line.Trim();
|
string trimLine = line.Trim();
|
||||||
// Console.WriteLine("line : " + trimLine);
|
// Console.WriteLine("line : " + trimLine);
|
||||||
|
|
||||||
string[] splitLine = r.Split(trimLine);
|
string[] splitLine = r.Split(trimLine);
|
||||||
if (splitLine.Length > 1)
|
if (splitLine.Length > 1)
|
||||||
{
|
{
|
||||||
switch (splitLine[0])
|
switch (splitLine[0])
|
||||||
{
|
{
|
||||||
case "textures":
|
case "textures":
|
||||||
reachedParams = false;
|
reachedParams = false;
|
||||||
reachedTextures = true;
|
reachedTextures = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "type":
|
case "type":
|
||||||
string wearableTypeName = Enum.GetName(typeof(WearableType), (WearableType)Convert.ToInt32(splitLine[1]));
|
string wearableTypeName = Enum.GetName(typeof(WearableType), (WearableType)Convert.ToInt32(splitLine[1]));
|
||||||
wearableObject = Create(wearableTypeName.ToLower());
|
wearableObject = Create(wearableTypeName.ToLower());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "parameters":
|
case "parameters":
|
||||||
reachedParams = true;
|
reachedParams = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "creator_id":
|
case "creator_id":
|
||||||
creatorID = new UUID(splitLine[1]);
|
creatorID = new UUID(splitLine[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "owner_id":
|
case "owner_id":
|
||||||
ownerID = new UUID(splitLine[1]);
|
ownerID = new UUID(splitLine[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "last_owner_id":
|
case "last_owner_id":
|
||||||
lastOwnerID = new UUID(splitLine[1]);
|
lastOwnerID = new UUID(splitLine[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "group_id":
|
case "group_id":
|
||||||
groupID = new UUID(splitLine[1]);
|
groupID = new UUID(splitLine[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if ((wearableObject != null) && (reachedParams))
|
if ((wearableObject != null) && (reachedParams))
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(splitLine[0]);
|
int id = Convert.ToInt32(splitLine[0]);
|
||||||
if (wearableObject.VisualSettings.ContainsKey(id))
|
if (wearableObject.VisualSettings.ContainsKey(id))
|
||||||
{
|
{
|
||||||
|
|
||||||
wearableObject.VisualSettings[id].Value = Convert.ToSingle(splitLine[1], CultureInfo.InvariantCulture);
|
wearableObject.VisualSettings[id].Value = Convert.ToSingle(splitLine[1], CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((wearableObject != null) && (reachedTextures))
|
else if ((wearableObject != null) && (reachedTextures))
|
||||||
{
|
{
|
||||||
wearableObject.TextureStrings.Add(line);
|
wearableObject.TextureStrings.Add(line);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wearableObject != null)
|
if (wearableObject != null)
|
||||||
{
|
{
|
||||||
wearableObject.CreatorID = creatorID;
|
wearableObject.CreatorID = creatorID;
|
||||||
wearableObject.OwnerID = ownerID;
|
wearableObject.OwnerID = ownerID;
|
||||||
wearableObject.LastOwnerID = lastOwnerID;
|
wearableObject.LastOwnerID = lastOwnerID;
|
||||||
wearableObject.GroupID = groupID;
|
wearableObject.GroupID = groupID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wearableObject;
|
return wearableObject;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Nested Class
|
#region Nested Class
|
||||||
public class VisualSetting
|
public class VisualSetting
|
||||||
{
|
{
|
||||||
public VisualParam VisualParam;
|
public VisualParam VisualParam;
|
||||||
public float Value = 0;
|
public float Value = 0;
|
||||||
|
|
||||||
public VisualSetting(VisualParam param, float value)
|
public VisualSetting(VisualParam param, float value)
|
||||||
{
|
{
|
||||||
VisualParam = param;
|
VisualParam = param;
|
||||||
Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VisualSetting(VisualParam param)
|
public VisualSetting(VisualParam param)
|
||||||
{
|
{
|
||||||
VisualParam = param;
|
VisualParam = param;
|
||||||
Value = param.DefaultValue;
|
Value = param.DefaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue