Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
commit
e6d0fb0b0e
|
@ -962,10 +962,10 @@ namespace OpenSim.Framework.Capabilities
|
|||
item.AssetType = assType;
|
||||
item.InvType = inType;
|
||||
item.Folder = parentFolder;
|
||||
item.CurrentPermissions = 2147483647;
|
||||
item.BasePermissions = 2147483647;
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = 2147483647;
|
||||
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (AddNewInventoryItem != null)
|
||||
|
|
|
@ -39,4 +39,18 @@ namespace OpenSim.Framework.Capabilities
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
|
||||
{
|
||||
public int resource_cost;
|
||||
public string state;
|
||||
public int upload_price;
|
||||
public string rsvp;
|
||||
|
||||
public LLSDNewFileAngentInventoryVariablePriceReplyResponse()
|
||||
{
|
||||
state = "confirm_upload";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -136,6 +136,13 @@ namespace OpenSim.Framework
|
|||
[XmlIgnore] private bool _lightEntry;
|
||||
[XmlIgnore] private bool _sculptEntry;
|
||||
|
||||
// Light Projection Filter
|
||||
[XmlIgnore] private bool _projectionEntry;
|
||||
[XmlIgnore] private UUID _projectionTextureID;
|
||||
[XmlIgnore] private float _projectionFOV;
|
||||
[XmlIgnore] private float _projectionFocus;
|
||||
[XmlIgnore] private float _projectionAmb;
|
||||
|
||||
public byte ProfileCurve
|
||||
{
|
||||
get { return (byte)((byte)HollowShape | (byte)ProfileShape); }
|
||||
|
@ -800,6 +807,7 @@ namespace OpenSim.Framework
|
|||
ushort FlexiEP = 0x10;
|
||||
ushort LightEP = 0x20;
|
||||
ushort SculptEP = 0x30;
|
||||
ushort ProjectionEP = 0x40;
|
||||
|
||||
int i = 0;
|
||||
uint TotalBytesLength = 1; // ExtraParamsNum
|
||||
|
@ -823,6 +831,12 @@ namespace OpenSim.Framework
|
|||
TotalBytesLength += 17;// data
|
||||
TotalBytesLength += 2 + 4; // type
|
||||
}
|
||||
if (_projectionEntry)
|
||||
{
|
||||
ExtraParamsNum++;
|
||||
TotalBytesLength += 28;// data
|
||||
TotalBytesLength += 2 + 4;// type
|
||||
}
|
||||
|
||||
byte[] returnbytes = new byte[TotalBytesLength];
|
||||
|
||||
|
@ -874,7 +888,19 @@ namespace OpenSim.Framework
|
|||
Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length);
|
||||
i += SculptData.Length;
|
||||
}
|
||||
if (_projectionEntry)
|
||||
{
|
||||
byte[] ProjectionData = GetProjectionBytes();
|
||||
|
||||
returnbytes[i++] = (byte)(ProjectionEP % 256);
|
||||
returnbytes[i++] = (byte)((ProjectionEP >> 8) % 256);
|
||||
returnbytes[i++] = (byte)((ProjectionData.Length) % 256);
|
||||
returnbytes[i++] = (byte)((ProjectionData.Length >> 16) % 256);
|
||||
returnbytes[i++] = (byte)((ProjectionData.Length >> 20) % 256);
|
||||
returnbytes[i++] = (byte)((ProjectionData.Length >> 24) % 256);
|
||||
Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length);
|
||||
i += ProjectionData.Length;
|
||||
}
|
||||
if (!_flexiEntry && !_lightEntry && !_sculptEntry)
|
||||
{
|
||||
byte[] returnbyte = new byte[1];
|
||||
|
@ -893,6 +919,7 @@ namespace OpenSim.Framework
|
|||
const ushort FlexiEP = 0x10;
|
||||
const ushort LightEP = 0x20;
|
||||
const ushort SculptEP = 0x30;
|
||||
const ushort ProjectionEP = 0x40;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -922,6 +949,14 @@ namespace OpenSim.Framework
|
|||
}
|
||||
ReadSculptData(data, 0);
|
||||
break;
|
||||
case ProjectionEP:
|
||||
if (!inUse)
|
||||
{
|
||||
_projectionEntry = false;
|
||||
return;
|
||||
}
|
||||
ReadProjectionData(data, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -933,10 +968,12 @@ namespace OpenSim.Framework
|
|||
const ushort FlexiEP = 0x10;
|
||||
const ushort LightEP = 0x20;
|
||||
const ushort SculptEP = 0x30;
|
||||
const ushort ProjectionEP = 0x40;
|
||||
|
||||
bool lGotFlexi = false;
|
||||
bool lGotLight = false;
|
||||
bool lGotSculpt = false;
|
||||
bool lGotFilter = false;
|
||||
|
||||
int i = 0;
|
||||
byte extraParamCount = 0;
|
||||
|
@ -973,6 +1010,11 @@ namespace OpenSim.Framework
|
|||
i += 17;
|
||||
lGotSculpt = true;
|
||||
break;
|
||||
case ProjectionEP:
|
||||
ReadProjectionData(data, i);
|
||||
i += 28;
|
||||
lGotFilter = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -982,6 +1024,8 @@ namespace OpenSim.Framework
|
|||
_lightEntry = false;
|
||||
if (!lGotSculpt)
|
||||
_sculptEntry = false;
|
||||
if (!lGotFilter)
|
||||
_projectionEntry = false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1121,6 +1165,42 @@ namespace OpenSim.Framework
|
|||
return data;
|
||||
}
|
||||
|
||||
public void ReadProjectionData(byte[] data, int pos)
|
||||
{
|
||||
byte[] ProjectionTextureUUID = new byte[16];
|
||||
|
||||
if (data.Length - pos >= 28)
|
||||
{
|
||||
_projectionEntry = true;
|
||||
Array.Copy(data, pos, ProjectionTextureUUID,0, 16);
|
||||
_projectionTextureID = new UUID(ProjectionTextureUUID, 0);
|
||||
|
||||
_projectionFocus = Utils.BytesToFloat(data, pos + 16);
|
||||
_projectionFOV = Utils.BytesToFloat(data, pos + 20);
|
||||
_projectionAmb = Utils.BytesToFloat(data, pos + 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
_projectionEntry = false;
|
||||
_projectionTextureID = UUID.Zero;
|
||||
_projectionFocus = 0f;
|
||||
_projectionFOV = 0f;
|
||||
_projectionAmb = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetProjectionBytes()
|
||||
{
|
||||
byte[] data = new byte[28];
|
||||
|
||||
_projectionTextureID.GetBytes().CopyTo(data, 0);
|
||||
Utils.FloatToBytes(_projectionFocus).CopyTo(data, 16);
|
||||
Utils.FloatToBytes(_projectionFOV).CopyTo(data, 20);
|
||||
Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values
|
||||
|
|
|
@ -1474,7 +1474,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
if (!(contentType.Contains("image")
|
||||
|| contentType.Contains("x-shockwave-flash")
|
||||
|| contentType.Contains("application/x-oar")))
|
||||
|| contentType.Contains("application/x-oar")
|
||||
|| contentType.Contains("application/vnd.ll.mesh")))
|
||||
{
|
||||
// Text
|
||||
buffer = Encoding.UTF8.GetBytes(responseString);
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Assets
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetMeshModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
{
|
||||
m_scene = pScene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "GetMeshModule"; } }
|
||||
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
m_log.Info("[GETMESH]: /CAPS/" + capID);
|
||||
caps.RegisterHandler("GetMesh",
|
||||
new RestHTTPHandler("GET", "/CAPS/" + capID,
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
{
|
||||
return ProcessGetMesh(m_dhttpMethod, agentID, caps);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
||||
{
|
||||
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 400; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Request wasn't what was expected";
|
||||
|
||||
string meshStr = string.Empty;
|
||||
|
||||
if (request.ContainsKey("mesh_id"))
|
||||
meshStr = request["mesh_id"].ToString();
|
||||
|
||||
|
||||
UUID meshID = UUID.Zero;
|
||||
if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
|
||||
{
|
||||
if (m_assetService == null)
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
AssetBase mesh;
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
mesh = m_assetService.GetCached(meshID.ToString());
|
||||
if (mesh != null)
|
||||
{
|
||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||
{
|
||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||
responsedata["int_response_code"] = 200;
|
||||
}
|
||||
// Optionally add additional mesh types here
|
||||
else
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mesh = m_assetService.Get(meshID.ToString());
|
||||
if (mesh != null)
|
||||
{
|
||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||
{
|
||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||
responsedata["int_response_code"] = 200;
|
||||
}
|
||||
// Optionally add additional mesh types here
|
||||
else
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Assets
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
private bool m_dumpAssetsToFile = false;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
{
|
||||
m_scene = pScene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "NewFileAgentInventoryVariablePriceModule"; } }
|
||||
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
m_log.Info("[GETMESH]: /CAPS/" + capID);
|
||||
caps.RegisterHandler("NewFileAgentInventoryVariablePrice",
|
||||
|
||||
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST",
|
||||
"/CAPS/" + capID.ToString(),
|
||||
delegate(LLSDAssetUploadRequest req)
|
||||
{
|
||||
return NewAgentInventoryRequest(req,agentID);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID)
|
||||
{
|
||||
|
||||
//TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit
|
||||
// You need to be aware of this and
|
||||
|
||||
|
||||
//if (llsdRequest.asset_type == "texture" ||
|
||||
// llsdRequest.asset_type == "animation" ||
|
||||
// llsdRequest.asset_type == "sound")
|
||||
// {
|
||||
IClientAPI client = null;
|
||||
|
||||
|
||||
IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>();
|
||||
|
||||
if (mm != null)
|
||||
{
|
||||
if (m_scene.TryGetClient(agentID, out client))
|
||||
{
|
||||
if (!mm.UploadCovered(client, mm.UploadCharge))
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
|
||||
LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
|
||||
errorResponse.rsvp = "";
|
||||
errorResponse.state = "error";
|
||||
return errorResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
string assetName = llsdRequest.name;
|
||||
string assetDes = llsdRequest.description;
|
||||
string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/";
|
||||
UUID newAsset = UUID.Random();
|
||||
UUID newInvItem = UUID.Random();
|
||||
UUID parentFolder = llsdRequest.folder_id;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/";
|
||||
|
||||
Caps.AssetUploader uploader =
|
||||
new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||
llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile);
|
||||
MainServer.Instance.AddStreamHandler(
|
||||
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (MainServer.Instance.UseSSL)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
|
||||
|
||||
LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse();
|
||||
|
||||
|
||||
uploadResponse.rsvp = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
uploadResponse.resource_cost = 0;
|
||||
uploadResponse.upload_price = 0;
|
||||
|
||||
uploader.OnUpLoad += //UploadCompleteHandler;
|
||||
|
||||
delegate(
|
||||
string passetName, string passetDescription, UUID passetID,
|
||||
UUID pinventoryItem, UUID pparentFolder, byte[] pdata, string pinventoryType,
|
||||
string passetType)
|
||||
{
|
||||
UploadCompleteHandler(passetName, passetDescription, passetID,
|
||||
pinventoryItem, pparentFolder, pdata, pinventoryType,
|
||||
passetType,agentID);
|
||||
};
|
||||
return uploadResponse;
|
||||
}
|
||||
|
||||
|
||||
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
|
||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||
string assetType,UUID AgentID)
|
||||
{
|
||||
|
||||
sbyte assType = 0;
|
||||
sbyte inType = 0;
|
||||
|
||||
if (inventoryType == "sound")
|
||||
{
|
||||
inType = 1;
|
||||
assType = 1;
|
||||
}
|
||||
else if (inventoryType == "animation")
|
||||
{
|
||||
inType = 19;
|
||||
assType = 20;
|
||||
}
|
||||
else if (inventoryType == "wearable")
|
||||
{
|
||||
inType = 18;
|
||||
switch (assetType)
|
||||
{
|
||||
case "bodypart":
|
||||
assType = 13;
|
||||
break;
|
||||
case "clothing":
|
||||
assType = 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (inventoryType == "mesh")
|
||||
{
|
||||
inType = (sbyte)InventoryType.Mesh;
|
||||
assType = (sbyte)AssetType.Mesh;
|
||||
}
|
||||
|
||||
AssetBase asset;
|
||||
asset = new AssetBase(assetID, assetName, assType, AgentID.ToString());
|
||||
asset.Data = data;
|
||||
|
||||
if (m_scene.AssetService != null)
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = AgentID;
|
||||
item.CreatorId = AgentID.ToString();
|
||||
item.ID = inventoryItem;
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = assetDescription;
|
||||
item.Name = assetName;
|
||||
item.AssetType = assType;
|
||||
item.InvType = inType;
|
||||
item.Folder = parentFolder;
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_scene.AddInventoryItem(item);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -114,6 +114,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
||||
// be removed when that functionality is implemented in opensim
|
||||
AttachmentPt &= 0x7f;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false))
|
||||
{
|
||||
|
@ -143,6 +147,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
|
||||
if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
|
||||
{
|
||||
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
||||
// be removed when that functionality is implemented in opensim
|
||||
AttachmentPt &= 0x7f;
|
||||
|
||||
// If the attachment point isn't the same as the one previously used
|
||||
// set it's offset position = 0 so that it appears on the attachment point
|
||||
// and not in a weird location somewhere unknown.
|
||||
|
@ -231,6 +239,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
public UUID RezSingleAttachmentFromInventory(
|
||||
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
|
||||
{
|
||||
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
||||
// be removed when that functionality is implemented in opensim
|
||||
AttachmentPt &= 0x7f;
|
||||
|
||||
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
|
||||
|
||||
if (updateInventoryStatus)
|
||||
|
|
|
@ -316,7 +316,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
m_SOPXmlProcessors.Add("FolderID", ProcessFolderID);
|
||||
m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial);
|
||||
m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory);
|
||||
m_SOPXmlProcessors.Add("ObjectFlags", ProcessObjectFlags);
|
||||
m_SOPXmlProcessors.Add("UUID", ProcessUUID);
|
||||
m_SOPXmlProcessors.Add("LocalId", ProcessLocalId);
|
||||
m_SOPXmlProcessors.Add("Name", ProcessName);
|
||||
|
@ -361,6 +360,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
m_SOPXmlProcessors.Add("Flags", ProcessFlags);
|
||||
m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
|
||||
m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
|
||||
m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
|
||||
#endregion
|
||||
|
||||
#region TaskInventoryXmlProcessors initialization
|
||||
|
@ -436,6 +436,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
m_ShapeXmlProcessors.Add("FlexiEntry", ProcessShpFlexiEntry);
|
||||
m_ShapeXmlProcessors.Add("LightEntry", ProcessShpLightEntry);
|
||||
m_ShapeXmlProcessors.Add("SculptEntry", ProcessShpSculptEntry);
|
||||
m_ShapeXmlProcessors.Add("Media", ProcessShpMedia);
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -465,11 +466,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory");
|
||||
}
|
||||
|
||||
private static void ProcessObjectFlags(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.Flags = (PrimFlags)reader.ReadElementContentAsInt("ObjectFlags", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.UUID = ReadUUID(reader, "UUID");
|
||||
|
@ -703,6 +699,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
{
|
||||
obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessMediaUrl(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TaskInventoryXmlProcessors
|
||||
|
@ -1063,6 +1064,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||
{
|
||||
string value = reader.ReadElementContentAsString("Media", String.Empty);
|
||||
shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
////////// Write /////////
|
||||
|
@ -1075,6 +1083,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
|
||||
sog.ForEachPart(delegate(SceneObjectPart sop)
|
||||
{
|
||||
if (sop.UUID != sog.RootPart.UUID)
|
||||
SOPToXml2(writer, sop, sog.RootPart);
|
||||
});
|
||||
|
||||
|
@ -1088,19 +1097,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||
writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
|
||||
|
||||
writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower());
|
||||
WriteUUID(writer, "CreatorID", sop.CreatorID);
|
||||
WriteUUID(writer, "FolderID", sop.FolderID);
|
||||
writer.WriteElementString("InventorySerial", (sop.Inventory != null) ? sop.InventorySerial.ToString() : "0");
|
||||
writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString());
|
||||
|
||||
// FIXME: Task inventory
|
||||
writer.WriteStartElement("TaskInventory"); writer.WriteEndElement();
|
||||
|
||||
writer.WriteElementString("ObjectFlags", ((int)sop.Flags).ToString());
|
||||
WriteTaskInventory(writer, sop.TaskInventory);
|
||||
|
||||
WriteUUID(writer, "UUID", sop.UUID);
|
||||
writer.WriteElementString("LocalId", sop.LocalId.ToString());
|
||||
writer.WriteElementString("Name", sop.Name);
|
||||
writer.WriteElementString("Material", ((int)sop.Material).ToString());
|
||||
writer.WriteElementString("Material", sop.Material.ToString());
|
||||
writer.WriteElementString("PassTouches", sop.PassTouches.ToString().ToLower());
|
||||
writer.WriteElementString("RegionHandle", sop.RegionHandle.ToString());
|
||||
writer.WriteElementString("ScriptAccessPin", sop.ScriptAccessPin.ToString());
|
||||
|
||||
|
@ -1109,115 +1117,40 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
|
||||
WriteQuaternion(writer, "RotationOffset", sop.RotationOffset);
|
||||
WriteVector(writer, "Velocity", sop.Velocity);
|
||||
WriteVector(writer, "RotationalVelocity", Vector3.Zero);
|
||||
WriteVector(writer, "AngularVelocity", sop.AngularVelocity);
|
||||
WriteVector(writer, "Acceleration", sop.Acceleration);
|
||||
writer.WriteElementString("Description", sop.Description);
|
||||
if (sop.Color != null)
|
||||
{
|
||||
writer.WriteStartElement("Color");
|
||||
writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("A", sop.Color.G.ToString(Utils.EnUsCulture));
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
writer.WriteElementString("Text", sop.Text);
|
||||
writer.WriteElementString("SitName", sop.SitName);
|
||||
writer.WriteElementString("TouchName", sop.TouchName);
|
||||
|
||||
writer.WriteElementString("LinkNum", sop.LinkNum.ToString());
|
||||
writer.WriteElementString("ClickAction", sop.ClickAction.ToString());
|
||||
writer.WriteStartElement("Shape");
|
||||
|
||||
writer.WriteElementString("ProfileCurve", sop.Shape.ProfileCurve.ToString());
|
||||
|
||||
writer.WriteStartElement("TextureEntry");
|
||||
byte[] te;
|
||||
if (sop.Shape.TextureEntry != null)
|
||||
te = sop.Shape.TextureEntry;
|
||||
else
|
||||
te = Utils.EmptyBytes;
|
||||
writer.WriteBase64(te, 0, te.Length);
|
||||
writer.WriteEndElement(); // TextureEntry
|
||||
|
||||
writer.WriteStartElement("ExtraParams");
|
||||
byte[] ep;
|
||||
if (sop.Shape.ExtraParams != null)
|
||||
ep = sop.Shape.ExtraParams;
|
||||
else
|
||||
ep = Utils.EmptyBytes;
|
||||
writer.WriteBase64(ep, 0, ep.Length);
|
||||
writer.WriteEndElement(); // ExtraParams
|
||||
|
||||
writer.WriteElementString("PathBegin", Primitive.PackBeginCut(sop.Shape.PathBegin).ToString());
|
||||
writer.WriteElementString("PathCurve", sop.Shape.PathCurve.ToString());
|
||||
writer.WriteElementString("PathEnd", Primitive.PackEndCut(sop.Shape.PathEnd).ToString());
|
||||
writer.WriteElementString("PathRadiusOffset", Primitive.PackPathTwist(sop.Shape.PathRadiusOffset).ToString());
|
||||
writer.WriteElementString("PathRevolutions", Primitive.PackPathRevolutions(sop.Shape.PathRevolutions).ToString());
|
||||
writer.WriteElementString("PathScaleX", Primitive.PackPathScale(sop.Shape.PathScaleX).ToString());
|
||||
writer.WriteElementString("PathScaleY", Primitive.PackPathScale(sop.Shape.PathScaleY).ToString());
|
||||
writer.WriteElementString("PathShearX", ((byte)Primitive.PackPathShear(sop.Shape.PathShearX)).ToString());
|
||||
writer.WriteElementString("PathShearY", ((byte)Primitive.PackPathShear(sop.Shape.PathShearY)).ToString());
|
||||
writer.WriteElementString("PathSkew", Primitive.PackPathTwist(sop.Shape.PathSkew).ToString());
|
||||
writer.WriteElementString("PathTaperX", Primitive.PackPathTaper(sop.Shape.PathTaperX).ToString());
|
||||
writer.WriteElementString("PathTaperY", Primitive.PackPathTaper(sop.Shape.PathTaperY).ToString());
|
||||
writer.WriteElementString("PathTwist", Primitive.PackPathTwist(sop.Shape.PathTwist).ToString());
|
||||
writer.WriteElementString("PathTwistBegin", Primitive.PackPathTwist(sop.Shape.PathTwistBegin).ToString());
|
||||
writer.WriteElementString("PCode", sop.Shape.PCode.ToString());
|
||||
writer.WriteElementString("ProfileBegin", Primitive.PackBeginCut(sop.Shape.ProfileBegin).ToString());
|
||||
writer.WriteElementString("ProfileEnd", Primitive.PackEndCut(sop.Shape.ProfileEnd).ToString());
|
||||
writer.WriteElementString("ProfileHollow", Primitive.PackProfileHollow(sop.Shape.ProfileHollow).ToString());
|
||||
WriteVector(writer, "Scale", sop.Scale);
|
||||
writer.WriteElementString("State", sop.Shape.State.ToString());
|
||||
|
||||
writer.WriteElementString("ProfileShape", sop.Shape.ProfileShape.ToString());
|
||||
writer.WriteElementString("HollowShape", sop.Shape.HollowShape.ToString());
|
||||
|
||||
writer.WriteElementString("SculptTexture", sop.Shape.SculptTexture.ToString());
|
||||
writer.WriteElementString("SculptType", sop.Shape.SculptType.ToString());
|
||||
writer.WriteStartElement("SculptData");
|
||||
byte[] sd;
|
||||
if (sop.Shape.SculptData != null)
|
||||
sd = sop.Shape.ExtraParams;
|
||||
else
|
||||
sd = Utils.EmptyBytes;
|
||||
writer.WriteBase64(sd, 0, sd.Length);
|
||||
writer.WriteEndElement(); // SculptData
|
||||
|
||||
writer.WriteElementString("FlexiSoftness", sop.Shape.FlexiSoftness.ToString());
|
||||
writer.WriteElementString("FlexiTension", sop.Shape.FlexiTension.ToString());
|
||||
writer.WriteElementString("FlexiDrag", sop.Shape.FlexiDrag.ToString());
|
||||
writer.WriteElementString("FlexiGravity", sop.Shape.FlexiGravity.ToString());
|
||||
writer.WriteElementString("FlexiWind", sop.Shape.FlexiWind.ToString());
|
||||
writer.WriteElementString("FlexiForceX", sop.Shape.FlexiForceX.ToString());
|
||||
writer.WriteElementString("FlexiForceY", sop.Shape.FlexiForceY.ToString());
|
||||
writer.WriteElementString("FlexiForceZ", sop.Shape.FlexiForceZ.ToString());
|
||||
|
||||
writer.WriteElementString("LightColorR", sop.Shape.LightColorR.ToString());
|
||||
writer.WriteElementString("LightColorG", sop.Shape.LightColorG.ToString());
|
||||
writer.WriteElementString("LightColorB", sop.Shape.LightColorB.ToString());
|
||||
writer.WriteElementString("LightColorA", sop.Shape.LightColorA.ToString());
|
||||
writer.WriteElementString("LightRadius", sop.Shape.LightRadius.ToString());
|
||||
writer.WriteElementString("LightCutoff", sop.Shape.LightCutoff.ToString());
|
||||
writer.WriteElementString("LightFalloff", sop.Shape.LightFalloff.ToString());
|
||||
writer.WriteElementString("LightIntensity", sop.Shape.LightIntensity.ToString());
|
||||
|
||||
writer.WriteElementString("FlexyEntry", sop.Shape.FlexiEntry.ToString());
|
||||
writer.WriteElementString("LightEntry", sop.Shape.LightEntry.ToString());
|
||||
writer.WriteElementString("SculptEntry", sop.Shape.SculptEntry.ToString());
|
||||
|
||||
writer.WriteEndElement(); // Shape
|
||||
WriteShape(writer, sop.Shape);
|
||||
|
||||
WriteVector(writer, "Scale", sop.Scale);
|
||||
writer.WriteElementString("UpdateFlag", "0");
|
||||
writer.WriteElementString("UpdateFlag", sop.UpdateFlag.ToString());
|
||||
WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation);
|
||||
WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
|
||||
WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);
|
||||
WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL);
|
||||
writer.WriteElementString("ParentID", sop.ParentID.ToString());
|
||||
writer.WriteElementString("CreationDate", sop.CreationDate.ToString());
|
||||
writer.WriteElementString("Category", "0");
|
||||
writer.WriteElementString("Category", sop.Category.ToString());
|
||||
writer.WriteElementString("SalePrice", sop.SalePrice.ToString());
|
||||
writer.WriteElementString("ObjectSaleType", ((int)sop.ObjectSaleType).ToString());
|
||||
writer.WriteElementString("OwnershipCost", "0");
|
||||
writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
|
||||
writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
|
||||
WriteUUID(writer, "GroupID", sop.GroupID);
|
||||
WriteUUID(writer, "OwnerID", sop.OwnerID);
|
||||
WriteUUID(writer, "LastOwnerID", sop.LastOwnerID);
|
||||
|
@ -1229,6 +1162,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteElementString("Flags", sop.Flags.ToString());
|
||||
WriteUUID(writer, "CollisionSound", sop.CollisionSound);
|
||||
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
|
||||
if (sop.MediaUrl != null)
|
||||
writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
@ -1259,6 +1194,134 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv)
|
||||
{
|
||||
if (tinv.Count > 0) // otherwise skip this
|
||||
{
|
||||
writer.WriteStartElement("TaskInventory");
|
||||
|
||||
foreach (TaskInventoryItem item in tinv.Values)
|
||||
{
|
||||
writer.WriteStartElement("TaskInventoryItem");
|
||||
|
||||
WriteUUID(writer, "AssetID", item.AssetID);
|
||||
writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
|
||||
writer.WriteElementString("CreationDate", item.CreationDate.ToString());
|
||||
WriteUUID(writer, "CreatorID", item.CreatorID);
|
||||
writer.WriteElementString("Description", item.Description);
|
||||
writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
|
||||
writer.WriteElementString("Flags", item.Flags.ToString());
|
||||
WriteUUID(writer, "GroupID", item.GroupID);
|
||||
writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString());
|
||||
writer.WriteElementString("InvType", item.InvType.ToString());
|
||||
WriteUUID(writer, "ItemID", item.ItemID);
|
||||
WriteUUID(writer, "OldItemID", item.OldItemID);
|
||||
WriteUUID(writer, "LastOwnerID", item.LastOwnerID);
|
||||
writer.WriteElementString("Name", item.Name);
|
||||
writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());
|
||||
WriteUUID(writer, "OwnerID", item.OwnerID);
|
||||
writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
|
||||
WriteUUID(writer, "ParentID", item.ParentID);
|
||||
WriteUUID(writer, "ParentPartID", item.ParentPartID);
|
||||
WriteUUID(writer, "PermsGranter", item.PermsGranter);
|
||||
writer.WriteElementString("PermsMask", item.PermsMask.ToString());
|
||||
writer.WriteElementString("Type", item.Type.ToString());
|
||||
|
||||
writer.WriteEndElement(); // TaskInventoryItem
|
||||
}
|
||||
|
||||
writer.WriteEndElement(); // TaskInventory
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp)
|
||||
{
|
||||
if (shp != null)
|
||||
{
|
||||
writer.WriteStartElement("Shape");
|
||||
|
||||
writer.WriteElementString("ProfileCurve", shp.ProfileCurve.ToString());
|
||||
|
||||
writer.WriteStartElement("TextureEntry");
|
||||
byte[] te;
|
||||
if (shp.TextureEntry != null)
|
||||
te = shp.TextureEntry;
|
||||
else
|
||||
te = Utils.EmptyBytes;
|
||||
writer.WriteBase64(te, 0, te.Length);
|
||||
writer.WriteEndElement(); // TextureEntry
|
||||
|
||||
writer.WriteStartElement("ExtraParams");
|
||||
byte[] ep;
|
||||
if (shp.ExtraParams != null)
|
||||
ep = shp.ExtraParams;
|
||||
else
|
||||
ep = Utils.EmptyBytes;
|
||||
writer.WriteBase64(ep, 0, ep.Length);
|
||||
writer.WriteEndElement(); // ExtraParams
|
||||
|
||||
writer.WriteElementString("PathBegin", shp.PathBegin.ToString());
|
||||
writer.WriteElementString("PathCurve", shp.PathCurve.ToString());
|
||||
writer.WriteElementString("PathEnd", shp.PathEnd.ToString());
|
||||
writer.WriteElementString("PathRadiusOffset", shp.PathRadiusOffset.ToString());
|
||||
writer.WriteElementString("PathRevolutions", shp.PathRevolutions.ToString());
|
||||
writer.WriteElementString("PathScaleX", shp.PathScaleX.ToString());
|
||||
writer.WriteElementString("PathScaleY", shp.PathScaleY.ToString());
|
||||
writer.WriteElementString("PathShearX", shp.PathShearX.ToString());
|
||||
writer.WriteElementString("PathShearY", shp.PathShearY.ToString());
|
||||
writer.WriteElementString("PathSkew", shp.PathSkew.ToString());
|
||||
writer.WriteElementString("PathTaperX", shp.PathTaperX.ToString());
|
||||
writer.WriteElementString("PathTaperY", shp.PathTaperY.ToString());
|
||||
writer.WriteElementString("PathTwist", shp.PathTwist.ToString());
|
||||
writer.WriteElementString("PathTwistBegin", shp.PathTwistBegin.ToString());
|
||||
writer.WriteElementString("PCode", shp.PCode.ToString());
|
||||
writer.WriteElementString("ProfileBegin", shp.ProfileBegin.ToString());
|
||||
writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString());
|
||||
writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
|
||||
writer.WriteElementString("State", shp.State.ToString());
|
||||
|
||||
writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString());
|
||||
writer.WriteElementString("HollowShape", shp.HollowShape.ToString());
|
||||
|
||||
WriteUUID(writer, "SculptTexture", shp.SculptTexture);
|
||||
writer.WriteElementString("SculptType", shp.SculptType.ToString());
|
||||
writer.WriteStartElement("SculptData");
|
||||
byte[] sd;
|
||||
if (shp.SculptData != null)
|
||||
sd = shp.ExtraParams;
|
||||
else
|
||||
sd = Utils.EmptyBytes;
|
||||
writer.WriteBase64(sd, 0, sd.Length);
|
||||
writer.WriteEndElement(); // SculptData
|
||||
|
||||
writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString());
|
||||
writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString());
|
||||
writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString());
|
||||
writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString());
|
||||
writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString());
|
||||
writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString());
|
||||
writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString());
|
||||
writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString());
|
||||
|
||||
writer.WriteElementString("LightColorR", shp.LightColorR.ToString());
|
||||
writer.WriteElementString("LightColorG", shp.LightColorG.ToString());
|
||||
writer.WriteElementString("LightColorB", shp.LightColorB.ToString());
|
||||
writer.WriteElementString("LightColorA", shp.LightColorA.ToString());
|
||||
writer.WriteElementString("LightRadius", shp.LightRadius.ToString());
|
||||
writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString());
|
||||
writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString());
|
||||
writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString());
|
||||
|
||||
writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower());
|
||||
writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower());
|
||||
writer.WriteElementString("SculptEntry", shp.SculptEntry.ToString().ToLower());
|
||||
|
||||
if (shp.Media != null)
|
||||
writer.WriteElementString("Media", shp.Media.ToXml());
|
||||
|
||||
writer.WriteEndElement(); // Shape
|
||||
}
|
||||
}
|
||||
|
||||
//////// Read /////////
|
||||
public static bool Xml2ToSOG(XmlTextReader reader, SceneObjectGroup sog)
|
||||
|
@ -1305,210 +1368,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
return true;
|
||||
}
|
||||
|
||||
public static SceneObjectPart Xml2ToSOPPull(XmlTextReader reader)
|
||||
{
|
||||
SceneObjectPart obj = new SceneObjectPart();
|
||||
|
||||
reader.ReadStartElement("SceneObjectPart");
|
||||
|
||||
if (reader.Name == "AllowedDrop")
|
||||
obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty);
|
||||
else
|
||||
obj.AllowedDrop = true;
|
||||
|
||||
obj.CreatorID = ReadUUID(reader, "CreatorID");
|
||||
obj.FolderID = ReadUUID(reader, "FolderID");
|
||||
obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty);
|
||||
|
||||
#region Task Inventory
|
||||
|
||||
obj.TaskInventory = new TaskInventoryDictionary();
|
||||
//List<PrimObject.InventoryBlock.ItemBlock> invItems = new List<PrimObject.InventoryBlock.ItemBlock>();
|
||||
|
||||
reader.ReadStartElement("TaskInventory", String.Empty);
|
||||
while (reader.Name == "TaskInventoryItem")
|
||||
{
|
||||
TaskInventoryItem item = new TaskInventoryItem();
|
||||
reader.ReadStartElement("TaskInventoryItem", String.Empty);
|
||||
|
||||
item.AssetID = ReadUUID(reader, "AssetID");
|
||||
item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
|
||||
item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty);
|
||||
item.CreatorID = ReadUUID(reader, "CreatorID");
|
||||
item.Description = reader.ReadElementContentAsString("Description", String.Empty);
|
||||
item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty);
|
||||
item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty);
|
||||
item.GroupID = ReadUUID(reader, "GroupID");
|
||||
item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty);
|
||||
item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty);
|
||||
item.ItemID = ReadUUID(reader, "ItemID");
|
||||
UUID oldItemID = ReadUUID(reader, "OldItemID"); // TODO: Is this useful?
|
||||
item.LastOwnerID = ReadUUID(reader, "LastOwnerID");
|
||||
item.Name = reader.ReadElementContentAsString("Name", String.Empty);
|
||||
item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
|
||||
item.OwnerID = ReadUUID(reader, "OwnerID");
|
||||
item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
|
||||
UUID parentID = ReadUUID(reader, "ParentID");
|
||||
UUID parentPartID = ReadUUID(reader, "ParentPartID");
|
||||
item.PermsGranter = ReadUUID(reader, "PermsGranter");
|
||||
item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty);
|
||||
item.Type = reader.ReadElementContentAsInt("Type", String.Empty);
|
||||
|
||||
reader.ReadEndElement();
|
||||
obj.TaskInventory.Add(item.ItemID, item);
|
||||
}
|
||||
if (reader.NodeType == XmlNodeType.EndElement)
|
||||
reader.ReadEndElement();
|
||||
|
||||
#endregion Task Inventory
|
||||
|
||||
obj.Flags = (PrimFlags)reader.ReadElementContentAsInt("ObjectFlags", String.Empty);
|
||||
|
||||
obj.UUID = ReadUUID(reader, "UUID");
|
||||
obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty);
|
||||
obj.Name = reader.ReadElementString("Name");
|
||||
obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty);
|
||||
|
||||
if (reader.Name == "PassTouches")
|
||||
obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty);
|
||||
else
|
||||
obj.PassTouches = false;
|
||||
|
||||
obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty);
|
||||
obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty);
|
||||
|
||||
if (reader.Name == "PlaySoundSlavePrims")
|
||||
reader.ReadInnerXml();
|
||||
if (reader.Name == "LoopSoundSlavePrims")
|
||||
reader.ReadInnerXml();
|
||||
|
||||
Vector3 groupPosition = ReadVector(reader, "GroupPosition");
|
||||
Vector3 offsetPosition = ReadVector(reader, "OffsetPosition");
|
||||
obj.RotationOffset = ReadQuaternion(reader, "RotationOffset");
|
||||
obj.Velocity = ReadVector(reader, "Velocity");
|
||||
if (reader.Name == "RotationalVelocity")
|
||||
ReadVector(reader, "RotationalVelocity");
|
||||
obj.AngularVelocity = ReadVector(reader, "AngularVelocity");
|
||||
obj.Acceleration = ReadVector(reader, "Acceleration");
|
||||
obj.Description = reader.ReadElementString("Description");
|
||||
reader.ReadStartElement("Color");
|
||||
if (reader.Name == "R")
|
||||
{
|
||||
obj.Color = Color.FromArgb((int)reader.ReadElementContentAsFloat("A", String.Empty),
|
||||
(int)reader.ReadElementContentAsFloat("R", String.Empty),
|
||||
(int)reader.ReadElementContentAsFloat("G", String.Empty),
|
||||
(int)reader.ReadElementContentAsFloat("B", String.Empty));
|
||||
reader.ReadEndElement();
|
||||
}
|
||||
obj.Text = reader.ReadElementString("Text", String.Empty);
|
||||
obj.SitName = reader.ReadElementString("SitName", String.Empty);
|
||||
obj.TouchName = reader.ReadElementString("TouchName", String.Empty);
|
||||
|
||||
obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty);
|
||||
obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
|
||||
|
||||
reader.ReadStartElement("Shape");
|
||||
obj.Shape.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty);
|
||||
|
||||
byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
|
||||
obj.Shape.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
|
||||
|
||||
reader.ReadInnerXml(); // ExtraParams
|
||||
|
||||
obj.Shape.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty);
|
||||
obj.Shape.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty);
|
||||
obj.Shape.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty);
|
||||
obj.Shape.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty);
|
||||
obj.Shape.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty);
|
||||
obj.Shape.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty);
|
||||
obj.Shape.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty);
|
||||
obj.Shape.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty);
|
||||
obj.Shape.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty);
|
||||
obj.Shape.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty);
|
||||
obj.Shape.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty);
|
||||
obj.Shape.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty);
|
||||
obj.Shape.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty);
|
||||
obj.Shape.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty);
|
||||
obj.Shape.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty);
|
||||
obj.Shape.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty);
|
||||
obj.Shape.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty);
|
||||
obj.Shape.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty);
|
||||
obj.Scale = ReadVector(reader, "Scale");
|
||||
obj.Shape.State = (byte)reader.ReadElementContentAsInt("State", String.Empty);
|
||||
|
||||
obj.Shape.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty);
|
||||
obj.Shape.ProfileShape = (ProfileShape)reader.ReadElementContentAsInt("ProfileShape", String.Empty);
|
||||
obj.Shape.HollowShape = (HollowShape)reader.ReadElementContentAsInt("HollowShape", String.Empty);
|
||||
|
||||
UUID sculptTexture = ReadUUID(reader, "SculptTexture");
|
||||
SculptType sculptType = (SculptType)reader.ReadElementContentAsInt("SculptType", String.Empty);
|
||||
if (sculptTexture != UUID.Zero)
|
||||
{
|
||||
obj.Shape.SculptTexture = sculptTexture;
|
||||
obj.Shape.SculptType = (byte)sculptType;
|
||||
}
|
||||
|
||||
reader.ReadInnerXml(); // SculptData
|
||||
|
||||
obj.Shape.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty);
|
||||
obj.Shape.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty);
|
||||
obj.Shape.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty);
|
||||
obj.Shape.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty);
|
||||
obj.Shape.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty);
|
||||
obj.Shape.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty);
|
||||
obj.Shape.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty);
|
||||
obj.Shape.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty);
|
||||
|
||||
obj.Shape.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty);
|
||||
obj.Shape.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty);
|
||||
obj.Shape.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty);
|
||||
obj.Shape.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty);
|
||||
obj.Shape.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty);
|
||||
obj.Shape.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty);
|
||||
obj.Shape.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty);
|
||||
obj.Shape.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty);
|
||||
|
||||
bool hasFlexi = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty);
|
||||
bool hasLight = reader.ReadElementContentAsBoolean("LightEntry", String.Empty);
|
||||
reader.ReadInnerXml(); // SculptEntry
|
||||
|
||||
reader.ReadEndElement();
|
||||
|
||||
obj.Scale = ReadVector(reader, "Scale"); // Yes, again
|
||||
obj.UpdateFlag = (byte)reader.ReadElementContentAsInt("UpdateFlag", String.Empty); // UpdateFlag
|
||||
|
||||
obj.SitTargetOrientation = ReadQuaternion(reader, "SitTargetOrientation");
|
||||
obj.SitTargetPosition = ReadVector(reader, "SitTargetPosition");
|
||||
obj.SitTargetPositionLL = ReadVector(reader, "SitTargetPositionLL");
|
||||
obj.SitTargetOrientationLL = ReadQuaternion(reader, "SitTargetOrientationLL");
|
||||
obj.ParentID = (uint)reader.ReadElementContentAsLong("ParentID", String.Empty);
|
||||
obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty);
|
||||
int category = reader.ReadElementContentAsInt("Category", String.Empty);
|
||||
obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty);
|
||||
obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty);
|
||||
int ownershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty);
|
||||
obj.GroupID = ReadUUID(reader, "GroupID");
|
||||
obj.OwnerID = ReadUUID(reader, "OwnerID");
|
||||
obj.LastOwnerID = ReadUUID(reader, "LastOwnerID");
|
||||
obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty);
|
||||
obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty);
|
||||
obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty);
|
||||
obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty);
|
||||
obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty);
|
||||
|
||||
obj.Flags = (PrimFlags)reader.ReadElementContentAsInt("Flags", String.Empty);
|
||||
|
||||
obj.CollisionSound = ReadUUID(reader, "CollisionSound");
|
||||
obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty);
|
||||
|
||||
reader.ReadEndElement();
|
||||
|
||||
obj.GroupPosition = groupPosition;
|
||||
obj.OffsetPosition = offsetPosition;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static SceneObjectPart Xml2ToSOP(XmlTextReader reader)
|
||||
{
|
||||
SceneObjectPart obj = new SceneObjectPart();
|
||||
|
@ -1522,13 +1381,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
SOPXmlProcessor p = null;
|
||||
if (m_SOPXmlProcessors.TryGetValue(reader.Name, out p))
|
||||
{
|
||||
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
|
||||
try
|
||||
{
|
||||
p(obj, reader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing {0} in {1}-{2}: {3}", nodeName, obj.Name, obj.UUID, e);
|
||||
m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing {0}: {1}", nodeName, e);
|
||||
if (reader.NodeType == XmlNodeType.EndElement)
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1631,6 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
|
||||
while (reader.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
|
||||
ShapeXmlProcessor p = null;
|
||||
if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p))
|
||||
p(shape, reader);
|
||||
|
|
|
@ -280,6 +280,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
|
||||
public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
|
||||
{
|
||||
XmlTextWriter writer = new XmlTextWriter(stream);
|
||||
|
||||
int primCount = 0;
|
||||
stream.WriteLine("<scene>\n");
|
||||
|
||||
|
@ -297,10 +299,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
continue;
|
||||
}
|
||||
|
||||
stream.WriteLine(SceneObjectSerializer.ToXml2Format(g));
|
||||
//stream.WriteLine(SceneObjectSerializer.ToXml2Format(g));
|
||||
SceneObjectSerializer.SOGToXml2(writer, (SceneObjectGroup)ent);
|
||||
stream.WriteLine();
|
||||
|
||||
primCount++;
|
||||
}
|
||||
}
|
||||
|
||||
stream.WriteLine("</scene>\n");
|
||||
stream.Flush();
|
||||
}
|
||||
|
|
|
@ -31,8 +31,10 @@ using System.Collections.Generic;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO.Compression;
|
||||
using PrimMesher;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
|
@ -256,13 +258,85 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
PrimMesh primMesh;
|
||||
PrimMesher.SculptMesh sculptMesh;
|
||||
|
||||
List<Coord> coords;
|
||||
List<Face> faces;
|
||||
List<Coord> coords = new List<Coord>();
|
||||
List<Face> faces = new List<Face>();
|
||||
|
||||
Image idata = null;
|
||||
string decodedSculptFileName = "";
|
||||
|
||||
if (primShape.SculptEntry)
|
||||
{
|
||||
if (((OpenMetaverse.SculptType)primShape.SculptType) == SculptType.Mesh)
|
||||
{
|
||||
// add code for mesh physics proxy generation here
|
||||
m_log.Debug("[MESH]: mesh proxy generation not implemented yet ");
|
||||
|
||||
OSD meshOsd;
|
||||
|
||||
if (primShape.SculptData.Length > 0)
|
||||
{
|
||||
|
||||
|
||||
m_log.Debug("[MESH]: asset data length: " + primShape.SculptData.Length.ToString());
|
||||
byte[] header = Util.StringToBytes256("<? LLSD/Binary ?>");
|
||||
|
||||
////dump to debugging file
|
||||
//string filename = System.IO.Path.Combine(decodedSculptMapPath, "mesh_" + primShape.SculptTexture.ToString());
|
||||
//BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create));
|
||||
//writer.Write(primShape.SculptData);
|
||||
//writer.Close();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[MESH]: asset data is zero length");
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (meshOsd is OSDMap)
|
||||
{
|
||||
OSDMap map = (OSDMap)meshOsd;
|
||||
//foreach (string name in map.Keys)
|
||||
// m_log.Debug("[MESH]: key:" + name + " value:" + map[name].AsString());
|
||||
OSDMap physicsParms = (OSDMap)map["physics_shape"];
|
||||
int physOffset = physicsParms["offset"].AsInteger();
|
||||
int physSize = physicsParms["size"].AsInteger();
|
||||
|
||||
if (physOffset < 0 || physSize == 0)
|
||||
return null; // no mesh data in asset
|
||||
|
||||
m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString());
|
||||
//MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize);
|
||||
//GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress);
|
||||
|
||||
//int maxSize = physSize * 5; // arbitrary guess
|
||||
//byte[] readBuffer = new byte[maxSize];
|
||||
|
||||
//int bytesRead = gzStream.Read(readBuffer, 0, maxSize);
|
||||
|
||||
//OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//just bail out for now until mesh code is finished
|
||||
return null;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cacheSculptMaps && primShape.SculptTexture != UUID.Zero)
|
||||
{
|
||||
|
@ -353,6 +427,7 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
coords = sculptMesh.coords;
|
||||
faces = sculptMesh.faces;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Welcome to OpenSim!
|
||||
|
||||
================
|
||||
=== OVERVIEW ===
|
||||
================
|
||||
==================
|
||||
==== OVERVIEW ====
|
||||
==================
|
||||
|
||||
OpenSim is a BSD Licensed Open Source project to develop a functioning
|
||||
virtual worlds server platform capable of supporting multiple clients
|
||||
|
|
Binary file not shown.
|
@ -175,7 +175,7 @@
|
|||
<param name="toFind"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:OpenMetaverse.StructuredData.OSDParser.FindByteArray(System.IO.Stream,System.Byte[])">
|
||||
<member name="M:OpenMetaverse.StructuredData.OSDParser.FindString(System.IO.Stream,System.String)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
|
|
Binary file not shown.
31790
bin/OpenMetaverse.XML
31790
bin/OpenMetaverse.XML
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -617,9 +617,11 @@
|
|||
<ReferencePath>../../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.IO.Compression;"/>
|
||||
<Reference name="CSJ2K" path="../../../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
|
@ -709,6 +711,7 @@
|
|||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<!-- FIXME: The OpenMetaverse.dll reference can be dropped when the TransferRequestPacket reference is removed from the code -->
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
|
|
Loading…
Reference in New Issue