Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2011-07-10 18:16:09 +02:00
commit b59b1ff3d9
23 changed files with 4291 additions and 4015 deletions

View File

@ -111,6 +111,7 @@ what it is today.
* Mircea Kitsune
* mpallari
* MrMonkE
* Nebadon Izumi (Michael Cerquoni - http://OSgrid.org)
* nornalbion
* Omar Vera Ustariz (IBM)
* openlifegrid.com

View File

@ -213,6 +213,8 @@ namespace OpenSim.Framework
/// <param name="prim"></param>
public PrimitiveBaseShape(Primitive prim)
{
// m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID);
PCode = (byte)prim.PrimData.PCode;
ExtraParams = new byte[1];
@ -376,7 +378,7 @@ namespace OpenSim.Framework
_pathEnd = Primitive.PackEndCut(end);
}
public void SetSculptData(byte sculptType, UUID SculptTextureUUID)
public void SetSculptProperties(byte sculptType, UUID SculptTextureUUID)
{
_sculptType = sculptType;
_sculptTexture = SculptTextureUUID;
@ -613,29 +615,39 @@ namespace OpenSim.Framework
}
}
public byte SculptType {
get {
public byte SculptType
{
get
{
return _sculptType;
}
set {
set
{
_sculptType = value;
}
}
public byte[] SculptData {
get {
public byte[] SculptData
{
get
{
return _sculptData;
}
set {
set
{
// m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Setting SculptData to data with length {0}", value.Length);
_sculptData = value;
}
}
public int FlexiSoftness {
get {
public int FlexiSoftness
{
get
{
return _flexiSoftness;
}
set {
set
{
_flexiSoftness = value;
}
}
@ -869,6 +881,8 @@ namespace OpenSim.Framework
public byte[] ExtraParamsToBytes()
{
// m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()");
ushort FlexiEP = 0x10;
ushort LightEP = 0x20;
ushort SculptEP = 0x30;
@ -884,18 +898,21 @@ namespace OpenSim.Framework
TotalBytesLength += 16;// data
TotalBytesLength += 2 + 4; // type
}
if (_lightEntry)
{
ExtraParamsNum++;
TotalBytesLength += 16;// data
TotalBytesLength += 2 + 4; // type
}
if (_sculptEntry)
{
ExtraParamsNum++;
TotalBytesLength += 17;// data
TotalBytesLength += 2 + 4; // type
}
if (_projectionEntry)
{
ExtraParamsNum++;
@ -905,7 +922,6 @@ namespace OpenSim.Framework
byte[] returnbytes = new byte[TotalBytesLength];
// uint paramlength = ExtraParamsNum;
// Stick in the number of parameters
@ -925,6 +941,7 @@ namespace OpenSim.Framework
Array.Copy(FlexiData, 0, returnbytes, i, FlexiData.Length);
i += FlexiData.Length;
}
if (_lightEntry)
{
byte[] LightData = GetLightBytes();
@ -939,6 +956,7 @@ namespace OpenSim.Framework
Array.Copy(LightData, 0, returnbytes, i, LightData.Length);
i += LightData.Length;
}
if (_sculptEntry)
{
byte[] SculptData = GetSculptBytes();
@ -953,6 +971,7 @@ namespace OpenSim.Framework
Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length);
i += SculptData.Length;
}
if (_projectionEntry)
{
byte[] ProjectionData = GetProjectionBytes();
@ -966,6 +985,7 @@ namespace OpenSim.Framework
Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length);
i += ProjectionData.Length;
}
if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry)
{
byte[] returnbyte = new byte[1];
@ -973,10 +993,7 @@ namespace OpenSim.Framework
return returnbyte;
}
return returnbytes;
//m_log.Info("[EXTRAPARAMS]: Length = " + m_shape.ExtraParams.Length.ToString());
}
public void ReadInUpdateExtraParam(ushort type, bool inUse, byte[] data)
@ -1047,7 +1064,6 @@ namespace OpenSim.Framework
extraParamCount = data[i++];
}
for (int k = 0; k < extraParamCount; k++)
{
ushort epType = Utils.BytesToUInt16(data, i);
@ -1091,7 +1107,6 @@ namespace OpenSim.Framework
_sculptEntry = false;
if (!lGotFilter)
_projectionEntry = false;
}
public void ReadSculptData(byte[] data, int pos)
@ -1120,6 +1135,7 @@ namespace OpenSim.Framework
if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4)
_sculptType = 4;
}
_sculptTexture = SculptUUID;
_sculptType = SculptTypel;
//m_log.Info("[SCULPT]:" + SculptUUID.ToString());

View File

@ -324,10 +324,25 @@ namespace OpenSim.Framework
}
/// <summary>
/// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes.
///
/// Please don't delete me even if I appear currently unused!
/// Debug utility function to convert OSD into formatted XML for debugging purposes.
/// </summary>
/// <param name="osd">
/// A <see cref="OSD"/>
/// </param>
/// <returns>
/// A <see cref="System.String"/>
/// </returns>
public static string GetFormattedXml(OSD osd)
{
return GetFormattedXml(OSDParser.SerializeLLSDXmlString(osd));
}
/// <summary>
/// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes.
/// </summary>
/// <remarks>
/// Please don't delete me even if I appear currently unused!
/// </remarks>
/// <param name="rawXml"></param>
/// <returns></returns>
public static string GetFormattedXml(string rawXml)
@ -431,26 +446,36 @@ namespace OpenSim.Framework
}
/// <summary>
/// Return an SHA1 hash of the given string
/// Return an SHA1 hash
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static string SHA1Hash(string data)
public static string SHA1Hash(string data, Encoding enc)
{
return SHA1Hash(data, Encoding.Default);
return SHA1Hash(enc.GetBytes(data));
}
public static string SHA1Hash(string data, Encoding encoding)
public static string SHA1Hash(string data)
{
byte[] hash = ComputeSHA1Hash(data, encoding);
return SHA1Hash(Encoding.Default.GetBytes(data));
}
/// <summary>
/// Return an SHA1 hash
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static string SHA1Hash(byte[] data)
{
byte[] hash = ComputeSHA1Hash(data);
return BitConverter.ToString(hash).Replace("-", String.Empty);
}
private static byte[] ComputeSHA1Hash(string src, Encoding encoding)
private static byte[] ComputeSHA1Hash(byte[] src)
{
SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
return SHA1.ComputeHash(encoding.GetBytes(src));
return SHA1.ComputeHash(src);
}
public static int fast_distance2d(int x, int y)

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -595,21 +595,25 @@ namespace OpenSim.Region.ClientStack.Linden
Vector3 scale = inner_instance_list["scale"].AsVector3();
Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
// no longer used - begin ------------------------
// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
// int material = inner_instance_list["material"].AsInteger();
// int mesh = inner_instance_list["mesh"].AsInteger();
OSDMap permissions = (OSDMap)inner_instance_list["permissions"];
int base_mask = permissions["base_mask"].AsInteger();
int everyone_mask = permissions["everyone_mask"].AsInteger();
UUID creator_id = permissions["creator_id"].AsUUID();
UUID group_id = permissions["group_id"].AsUUID();
int group_mask = permissions["group_mask"].AsInteger();
// OSDMap permissions = (OSDMap)inner_instance_list["permissions"];
// int base_mask = permissions["base_mask"].AsInteger();
// int everyone_mask = permissions["everyone_mask"].AsInteger();
// UUID creator_id = permissions["creator_id"].AsUUID();
// UUID group_id = permissions["group_id"].AsUUID();
// int group_mask = permissions["group_mask"].AsInteger();
// bool is_owner_group = permissions["is_owner_group"].AsBoolean();
// UUID last_owner_id = permissions["last_owner_id"].AsUUID();
int next_owner_mask = permissions["next_owner_mask"].AsInteger();
UUID owner_id = permissions["owner_id"].AsUUID();
int owner_mask = permissions["owner_mask"].AsInteger();
// int next_owner_mask = permissions["next_owner_mask"].AsInteger();
// UUID owner_id = permissions["owner_id"].AsUUID();
// int owner_mask = permissions["owner_mask"].AsInteger();
// no longer used - end ------------------------
UUID owner_id = m_HostCapsObj.AgentID;
SceneObjectPart prim
= new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
@ -619,19 +623,19 @@ namespace OpenSim.Region.ClientStack.Linden
rotations.Add(rotation);
positions.Add(position);
prim.UUID = UUID.Random();
prim.CreatorID = creator_id;
prim.CreatorID = owner_id;
prim.OwnerID = owner_id;
prim.GroupID = group_id;
prim.GroupID = UUID.Zero;
prim.LastOwnerID = prim.OwnerID;
prim.CreationDate = Util.UnixTimeSinceEpoch();
prim.Name = assetName;
prim.Description = "";
prim.BaseMask = (uint)base_mask;
prim.EveryoneMask = (uint)everyone_mask;
prim.GroupMask = (uint)group_mask;
prim.NextOwnerMask = (uint)next_owner_mask;
prim.OwnerMask = (uint)owner_mask;
// prim.BaseMask = (uint)base_mask;
// prim.EveryoneMask = (uint)everyone_mask;
// prim.GroupMask = (uint)group_mask;
// prim.NextOwnerMask = (uint)next_owner_mask;
// prim.OwnerMask = (uint)owner_mask;
if (grp == null)
grp = new SceneObjectGroup(prim);
@ -1123,4 +1127,4 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
}
}

View File

@ -0,0 +1,149 @@
/*
* 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.Reflection;
using log4net;
using Nini.Config;
using Mono.Addins;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
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.ClientStack.Linden
{
/// <summary>
/// MeshUploadFlag capability. This is required for uploading Mesh.
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class MeshUploadFlagModule : INonSharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Is this module enabled?
/// </summary>
public bool Enabled { get; private set; }
private Scene m_scene;
private UUID m_agentID;
#region ISharedRegionModule Members
public MeshUploadFlagModule()
{
Enabled = true;
}
public void Initialise(IConfigSource source)
{
IConfig config = source.Configs["Mesh"];
if (config == null)
{
return;
}
else
{
Enabled = config.GetBoolean("AllowMeshUpload", Enabled);
}
}
public void AddRegion(Scene s)
{
if (!Enabled)
return;
m_scene = s;
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
}
public void RemoveRegion(Scene s)
{
if (!Enabled)
return;
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
}
public void RegionLoaded(Scene s)
{
}
public void PostInitialise()
{
}
public void Close() { }
public string Name { get { return "MeshUploadFlagModule"; } }
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
public void RegisterCaps(UUID agentID, Caps caps)
{
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag);
caps.RegisterHandler("MeshUploadFlag", reqHandler);
m_agentID = agentID;
}
private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
{
m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request");
OSDMap data = new OSDMap();
ScenePresence sp = m_scene.GetScenePresence(m_agentID);
data["username"] = sp.Firstname + "." + sp.Lastname;
data["display_name_next_update"] = new OSDDate(DateTime.Now);
data["legacy_first_name"] = sp.Firstname;
data["mesh_upload_status"] = "valid";
data["display_name"] = sp.Firstname + " " + sp.Lastname;
data["legacy_last_name"] = sp.Lastname;
data["id"] = m_agentID;
data["is_display_name_default"] = true;
//Send back data
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
return responsedata;
}
}
}

View File

@ -250,11 +250,9 @@ namespace OpenSim.Region.ClientStack.Linden
case 0x40:
pbs.ReadProjectionData(extraParam.ExtraParamData, 0);
break;
}
}
pbs.PathBegin = (ushort) obj.PathBegin;
pbs.PathCurve = (byte) obj.PathCurve;
pbs.PathEnd = (ushort) obj.PathEnd;

View File

@ -7614,13 +7614,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
{
if (!invAccess.GetAgentInventoryItem(this, itemID, requestID))
if (!invAccess.CanGetAgentInventoryItem(this, itemID, requestID))
return false;
}
else
{
return false;
}
}
}
}
@ -7634,7 +7634,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
// m_log.Debug("upload request " + request.ToString());
// m_log.Debug("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString());
UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);

View File

@ -53,7 +53,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <summary>
/// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
/// </summary>
public int MaxTransferDistance { get; set; }
private int m_MaxTransferDistance = 4095;
public int MaxTransferDistance
{
get { return m_MaxTransferDistance; }
set { m_MaxTransferDistance = value; }
}
protected bool m_Enabled = false;
protected Scene m_aScene;

View File

@ -1030,7 +1030,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
}
public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
public virtual bool CanGetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
{
InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
if (assetRequestItem == null)
@ -1109,7 +1109,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
InventoryItemBase item = new InventoryItemBase(itemID, agentID);
item = invService.GetItem(item);
if (item.CreatorData != null && item.CreatorData != string.Empty)
if (item != null && item.CreatorData != null && item.CreatorData != string.Empty)
UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData);
return item;
@ -1117,4 +1117,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
#endregion
}
}
}

View File

@ -284,9 +284,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
item = m_InventoryService.GetItem(item);
if (null == item)
m_log.ErrorFormat(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", requestedItemId);
// if (null == item)
// m_log.ErrorFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", requestedItemId);
return item;
}

View File

@ -59,7 +59,15 @@ namespace OpenSim.Region.Framework.Interfaces
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver);
bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID);
/// <summary>
/// Does the client have sufficient permissions to retrieve the inventory item?
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="requestID"></param>
/// <returns></returns>
bool CanGetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID);
// Must be here because of textures in user's inventory
bool IsForeignUser(UUID userID, out string assetServerURL);

View File

@ -1603,6 +1603,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="m_physicalPrim"></param>
public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool m_physicalPrim)
{
// m_log.DebugFormat("[SCENE OBJECT PART]: Applying physics to {0} {1} {2}", Name, LocalId, UUID);
bool isPhysical = (((rootObjectFlags & (uint) PrimFlags.Physics) != 0) && m_physicalPrim);
bool isPhantom = ((rootObjectFlags & (uint) PrimFlags.Phantom) != 0);
@ -2974,7 +2976,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void SculptTextureCallback(UUID textureID, AssetBase texture)
{
if (m_shape.SculptEntry)

View File

@ -1008,6 +1008,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessShpSculptData(PrimitiveBaseShape shp, XmlTextReader reader)
{
// m_log.DebugFormat("[SCENE OBJECT SERIALIZER]: Setting sculpt data length {0}", shp.SculptData.Length);
shp.SculptData = Convert.FromBase64String(reader.ReadElementString("SculptData"));
}

View File

@ -801,7 +801,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SetSculptData((byte)type, sculptId);
part.Shape.SetSculptProperties((byte)type, sculptId);
part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock);
}

View File

@ -86,7 +86,10 @@ namespace OpenSim.Region.Physics.Manager
Vector3 size, Quaternion rotation, bool isPhysical)
{
PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical);
if (ret != null) ret.LocalID = localID;
if (ret != null)
ret.LocalID = localID;
return ret;
}

View File

@ -100,7 +100,6 @@ namespace OpenSim.Region.Physics.Meshing
{
m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message);
}
}
/// <summary>
@ -156,7 +155,6 @@ namespace OpenSim.Region.Physics.Meshing
return box;
}
/// <summary>
/// Creates a simple bounding box mesh for a complex input mesh
/// </summary>
@ -193,7 +191,6 @@ namespace OpenSim.Region.Physics.Meshing
m_log.Error(message);
m_log.Error("\nPrim Name: " + primName);
m_log.Error("****** PrimMesh Parameters ******\n" + primMesh.ParamsToDisplayString());
}
private ulong GetMeshKey(PrimitiveBaseShape pbs, Vector3 size, float lod)
@ -257,6 +254,52 @@ namespace OpenSim.Region.Physics.Meshing
return ((hash << 5) + hash) + (ulong)(c >> 8);
}
/// <summary>
/// Add a submesh to an existing list of coords and faces.
/// </summary>
/// <param name="subMeshData"></param>
/// <param name="size">Size of entire object</param>
/// <param name="coords"></param>
/// <param name="faces"></param>
private void AddSubMesh(OSDMap subMeshData, Vector3 size, List<Coord> coords, List<Face> faces)
{
// Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap));
// As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level
// of Detail Blocks (maps) contain just a NoGeometry key to signal there is no
// geometry for this submesh.
if (subMeshData.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshData["NoGeometry"]))
return;
OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshData["PositionDomain"])["Max"].AsVector3();
OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshData["PositionDomain"])["Min"].AsVector3();
ushort faceIndexOffset = (ushort)coords.Count;
byte[] posBytes = subMeshData["Position"].AsBinary();
for (int i = 0; i < posBytes.Length; i += 6)
{
ushort uX = Utils.BytesToUInt16(posBytes, i);
ushort uY = Utils.BytesToUInt16(posBytes, i + 2);
ushort uZ = Utils.BytesToUInt16(posBytes, i + 4);
Coord c = new Coord(
Utils.UInt16ToFloat(uX, posMin.X, posMax.X) * size.X,
Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y) * size.Y,
Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z) * size.Z);
coords.Add(c);
}
byte[] triangleBytes = subMeshData["TriangleList"].AsBinary();
for (int i = 0; i < triangleBytes.Length; i += 6)
{
ushort v1 = (ushort)(Utils.BytesToUInt16(triangleBytes, i) + faceIndexOffset);
ushort v2 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 2) + faceIndexOffset);
ushort v3 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 4) + faceIndexOffset);
Face f = new Face(v1, v2, v3);
faces.Add(f);
}
}
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{
@ -304,6 +347,7 @@ namespace OpenSim.Region.Physics.Meshing
{
m_log.Error("[MESH]: Exception deserializing mesh asset header:" + e.ToString());
}
start = data.Position;
}
@ -315,9 +359,10 @@ namespace OpenSim.Region.Physics.Meshing
physicsParms = (OSDMap)map["physics_shape"]; // old asset format
else if (map.ContainsKey("physics_mesh"))
physicsParms = (OSDMap)map["physics_mesh"]; // new asset format
if (physicsParms == null)
{
m_log.Warn("[Mesh]: no recognized physics mesh found in mesh asset");
m_log.Warn("[MESH]: no recognized physics mesh found in mesh asset");
return null;
}
@ -366,42 +411,13 @@ namespace OpenSim.Region.Physics.Meshing
// physics_shape is an array of OSDMaps, one for each submesh
if (decodedMeshOsd is OSDArray)
{
// Console.WriteLine("decodedMeshOsd for {0} - {1}", primName, Util.GetFormattedXml(decodedMeshOsd));
decodedMeshOsdArray = (OSDArray)decodedMeshOsd;
foreach (OSD subMeshOsd in decodedMeshOsdArray)
{
if (subMeshOsd is OSDMap)
{
OSDMap subMeshMap = (OSDMap)subMeshOsd;
OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3();
OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3();
ushort faceIndexOffset = (ushort)coords.Count;
byte[] posBytes = subMeshMap["Position"].AsBinary();
for (int i = 0; i < posBytes.Length; i += 6)
{
ushort uX = Utils.BytesToUInt16(posBytes, i);
ushort uY = Utils.BytesToUInt16(posBytes, i + 2);
ushort uZ = Utils.BytesToUInt16(posBytes, i + 4);
Coord c = new Coord(
Utils.UInt16ToFloat(uX, posMin.X, posMax.X) * size.X,
Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y) * size.Y,
Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z) * size.Z);
coords.Add(c);
}
byte[] triangleBytes = subMeshMap["TriangleList"].AsBinary();
for (int i = 0; i < triangleBytes.Length; i += 6)
{
ushort v1 = (ushort)(Utils.BytesToUInt16(triangleBytes, i) + faceIndexOffset);
ushort v2 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 2) + faceIndexOffset);
ushort v3 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 4) + faceIndexOffset);
Face f = new Face(v1, v2, v3);
faces.Add(f);
}
}
AddSubMesh(subMeshOsd as OSDMap, size, coords, faces);
}
}
}
@ -524,7 +540,6 @@ namespace OpenSim.Region.Physics.Meshing
profileBegin = 0.5f * profileBegin + 0.5f;
profileEnd = 0.5f * profileEnd + 0.5f;
}
int hollowSides = sides;
@ -633,6 +648,7 @@ namespace OpenSim.Region.Physics.Meshing
Face f = faces[i];
mesh.Add(new Triangle(vertices[f.v1], vertices[f.v2], vertices[f.v3]));
}
return mesh;
}
@ -643,6 +659,10 @@ namespace OpenSim.Region.Physics.Meshing
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
{
#if SPAM
m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);
#endif
Mesh mesh = null;
ulong key = 0;

View File

@ -38,6 +38,9 @@
* switch between 'VEHICLE' parameter use and general dynamics
* settings use.
*/
//#define SPAM
using System;
using System.Collections.Generic;
using System.Reflection;
@ -54,7 +57,6 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <summary>
/// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
/// </summary>
public class OdePrim : PhysicsActor
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -279,14 +281,14 @@ namespace OpenSim.Region.Physics.OdePlugin
public override bool Selected
{
set {
set
{
// This only makes the object not collidable if the object
// is physical or the object is modified somehow *IN THE FUTURE*
// without this, if an avatar selects prim, they can walk right
// through it while it's selected
m_collisionscore = 0;
if ((m_isphysical && !_zeroFlag) || !value)
{
m_taintselected = value;
@ -297,7 +299,9 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintselected = value;
m_isSelected = value;
}
if (m_isSelected) disableBodySoft();
if (m_isSelected)
disableBodySoft();
}
}
@ -324,8 +328,6 @@ namespace OpenSim.Region.Physics.OdePlugin
//m_log.Warn("Setting Geom to: " + prim_geom);
}
public void enableBodySoft()
{
if (!childPrim)
@ -626,8 +628,6 @@ namespace OpenSim.Region.Physics.OdePlugin
break;
}
float taperX1;
float taperY1;
float taperX;
@ -682,9 +682,6 @@ namespace OpenSim.Region.Physics.OdePlugin
// else if (returnMass > _parent_scene.maximumMassObject)
// returnMass = _parent_scene.maximumMassObject;
// Recursively calculate mass
bool HasChildPrim = false;
lock (childrenPrim)
@ -693,8 +690,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
HasChildPrim = true;
}
}
if (HasChildPrim)
{
OdePrim[] childPrimArr = new OdePrim[0];
@ -711,10 +708,12 @@ namespace OpenSim.Region.Physics.OdePlugin
break;
}
}
if (returnMass > _parent_scene.maximumMassObject)
returnMass = _parent_scene.maximumMassObject;
return returnMass;
}// end CalculateMass
}
#endregion
@ -750,7 +749,6 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
d.BodyDestroy(Body);
lock (childrenPrim)
{
@ -779,7 +777,6 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
Body = IntPtr.Zero;
}
}
@ -791,6 +788,8 @@ namespace OpenSim.Region.Physics.OdePlugin
public void setMesh(OdeScene parent_scene, IMesh mesh)
{
// m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh);
// This sleeper is there to moderate how long it takes between
// setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object
@ -860,7 +859,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public void ProcessTaints(float timestep)
{
//Console.WriteLine("ProcessTaints for " + Name);
Console.WriteLine("ProcessTaints for " + Name);
if (m_taintadd)
{
changeadd(timestep);
@ -869,7 +868,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (prim_geom != IntPtr.Zero)
{
if (!_position.ApproxEquals(m_taintposition, 0f))
changemove(timestep);
changemove(timestep);
if (m_taintrot != _orientation)
{
@ -887,19 +886,15 @@ namespace OpenSim.Region.Physics.OdePlugin
rotate(timestep);
}
}
//
if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent))
changePhysicsStatus(timestep);
//
if (!_size.ApproxEquals(m_taintsize,0f))
if (!_size.ApproxEquals(m_taintsize, 0f))
changesize(timestep);
//
if (m_taintshape)
changeshape(timestep);
//
if (m_taintforce)
changeAddForce(timestep);
@ -927,7 +922,6 @@ namespace OpenSim.Region.Physics.OdePlugin
if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
changeAngularLock(timestep);
}
else
{
@ -935,7 +929,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
private void changeAngularLock(float timestep)
{
// do we have a Physical object?
@ -963,7 +956,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
// Store this for later in case we get turned into a separate body
m_angularlock = m_taintAngularLock;
}
private void changelink(float timestep)
@ -1102,7 +1094,6 @@ namespace OpenSim.Region.Physics.OdePlugin
m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name);
}
prm.m_interpenetrationcount = 0;
prm.m_collisionscore = 0;
prm.m_disabled = false;
@ -1162,7 +1153,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
}
}
private void ChildSetGeom(OdePrim odePrim)
@ -1223,17 +1213,12 @@ namespace OpenSim.Region.Physics.OdePlugin
//Console.WriteLine("childrenPrim.Remove " + odePrim);
childrenPrim.Remove(odePrim);
}
if (Body != IntPtr.Zero)
{
_parent_scene.remActivePrim(this);
}
lock (childrenPrim)
{
foreach (OdePrim prm in childrenPrim)
@ -1242,8 +1227,6 @@ namespace OpenSim.Region.Physics.OdePlugin
ParentPrim(prm);
}
}
}
private void changeSelectedStatus(float timestep)
@ -1398,7 +1381,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
@ -1438,10 +1420,11 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
lock (_parent_scene.OdeLock)
{
//Console.WriteLine("changeadd 1");
#if SPAM
Console.WriteLine("changeadd 1");
#endif
CreateGeom(m_targetSpace, _mesh);
if (prim_geom != IntPtr.Zero)
@ -1684,13 +1667,11 @@ Console.WriteLine(" JointCreateFixed");
{
PID_G = m_PIDTau + 1;
}
// Where are we, and where are we headed?
d.Vector3 pos = d.BodyGetPosition(Body);
d.Vector3 vel = d.BodyGetLinearVel(Body);
// Non-Vehicles have a limited set of Hover options.
// determine what our target height really is based on HoverType
switch (m_PIDHoverType)
@ -1796,8 +1777,6 @@ Console.WriteLine(" JointCreateFixed");
}
}
public void rotate(float timestep)
{
d.Quaternion myrot = new d.Quaternion();
@ -1908,7 +1887,10 @@ Console.WriteLine(" JointCreateFixed");
public void changesize(float timestamp)
{
#if SPAM
m_log.DebugFormat("[ODE PRIM]: Called changesize");
#endif
string oldname = _parent_scene.geom_name_map[prim_geom];
if (_size.X <= 0) _size.X = 0.01f;
@ -1918,8 +1900,9 @@ Console.WriteLine(" JointCreateFixed");
// Cleanup of old prim geometry
if (_mesh != null)
{
// Cleanup meshing here
// TODO: Cleanup meshing here
}
//kill body to rebuild
if (IsPhysical && Body != IntPtr.Zero)
{
@ -1936,11 +1919,13 @@ Console.WriteLine(" JointCreateFixed");
disableBody();
}
}
if (d.SpaceQuery(m_targetSpace, prim_geom))
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
d.SpaceRemove(m_targetSpace, prim_geom);
}
d.GeomDestroy(prim_geom);
prim_geom = IntPtr.Zero;
// we don't need to do space calculation because the client sends a position update also.
@ -1960,15 +1945,19 @@ Console.WriteLine(" JointCreateFixed");
mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
//IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
//Console.WriteLine("changesize 1");
#if SPAM
Console.WriteLine("changesize 1");
#endif
CreateGeom(m_targetSpace, mesh);
}
else
{
_mesh = null;
//Console.WriteLine("changesize 2");
#if SPAM
Console.WriteLine("changesize 2");
#endif
CreateGeom(m_targetSpace, _mesh);
}
@ -2004,8 +1993,6 @@ Console.WriteLine(" JointCreateFixed");
m_taintsize = _size;
}
public void changefloatonwater(float timestep)
{
m_collidesWater = m_taintCollidesWater;
@ -2053,6 +2040,7 @@ Console.WriteLine(" JointCreateFixed");
prim_geom = IntPtr.Zero;
m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name);
}
prim_geom = IntPtr.Zero;
// we don't need to do space calculation because the client sends a position update also.
if (_size.X <= 0) _size.X = 0.01f;
@ -2062,7 +2050,7 @@ Console.WriteLine(" JointCreateFixed");
if (_parent_scene.needsMeshing(_pbs))
{
// Don't need to re-enable body.. it's done in SetMesh
// Don't need to re-enable body.. it's done in CreateMesh
float meshlod = _parent_scene.meshSculptLOD;
if (IsPhysical)
@ -2070,12 +2058,18 @@ Console.WriteLine(" JointCreateFixed");
IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
// createmesh returns null when it doesn't mesh.
#if SPAM
Console.WriteLine("changeshape needed meshing");
#endif
CreateGeom(m_targetSpace, mesh);
}
else
{
_mesh = null;
//Console.WriteLine("changeshape");
#if SPAM
Console.WriteLine("changeshape not need meshing");
#endif
CreateGeom(m_targetSpace, null);
}
@ -2160,11 +2154,8 @@ Console.WriteLine(" JointCreateFixed");
}
m_taintforce = false;
}
public void changeSetTorque(float timestamp)
{
if (!m_isSelected)
@ -2833,7 +2824,6 @@ Console.WriteLine(" JointCreateFixed");
public override float APIDDamping{ set { return; } }
private void createAMotor(Vector3 axis)
{
if (Body == IntPtr.Zero)
@ -2953,7 +2943,6 @@ Console.WriteLine(" JointCreateFixed");
//d.JointSetAMotorParam(Amotor, (int) dParam.Vel, 9000f);
d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
d.JointSetAMotorParam(Amotor, (int)dParam.FMax, Mass * 50f);//
}
public Matrix4 FromDMass(d.Mass pMass)
@ -3038,8 +3027,6 @@ Console.WriteLine(" JointCreateFixed");
return Matrix4.Identity; // should probably throw an error. singluar matrix inverse not possible
}
return (Adjoint(pMat) / determinant3x3(pMat));
}
@ -3076,6 +3063,7 @@ Console.WriteLine(" JointCreateFixed");
}
m++;
}
return minor;
}
@ -3178,7 +3166,6 @@ Console.WriteLine(" JointCreateFixed");
det = diag1 + diag2 + diag3 - (diag4 + diag5 + diag6);
return det;
}
private static void DMassCopy(ref d.Mass src, ref d.Mass dst)
@ -3203,6 +3190,5 @@ Console.WriteLine(" JointCreateFixed");
{
m_material = pMaterial;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7382,7 +7382,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SetSculptData((byte)type, sculptId);
part.Shape.SetSculptProperties((byte)type, sculptId);
part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock);
}
@ -7945,7 +7945,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID[] anims;
anims = av.Animator.GetAnimationArray();
foreach (UUID foo in anims)
l.Add(foo.ToString());
l.Add(new LSL_Key(foo.ToString()));
return l;
}
@ -8551,17 +8551,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_TEXT:
Color4 textColor = part.GetTextColor();
res.Add(part.Text);
res.Add(new LSL_String(part.Text));
res.Add(new LSL_Vector(textColor.R,
textColor.G,
textColor.B));
res.Add(new LSL_Float(textColor.A));
break;
case (int)ScriptBaseClass.PRIM_NAME:
res.Add(part.Name);
res.Add(new LSL_String(part.Name));
break;
case (int)ScriptBaseClass.PRIM_DESC:
res.Add(part.Description);
res.Add(new LSL_String(part.Description));
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W));
@ -10579,7 +10579,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
foreach (KeyValuePair<UUID, int> detectedParams in land.GetLandObjectOwners())
{
ret.Add(new LSL_String(detectedParams.Key.ToString()));
ret.Add(detectedParams.Value);
ret.Add(new LSL_Integer(detectedParams.Value));
}
}
ScriptSleep(2000);
@ -10629,25 +10629,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (o.ToString())
{
case "0":
ret = ret + new LSL_List(land.Name);
ret.Add(new LSL_String(land.Name));
break;
case "1":
ret = ret + new LSL_List(land.Description);
ret.Add(new LSL_String(land.Description));
break;
case "2":
ret = ret + new LSL_List(land.OwnerID.ToString());
ret.Add(new LSL_Key(land.OwnerID.ToString()));
break;
case "3":
ret = ret + new LSL_List(land.GroupID.ToString());
ret.Add(new LSL_Key(land.GroupID.ToString()));
break;
case "4":
ret = ret + new LSL_List(land.Area);
ret.Add(new LSL_Integer(land.Area));
break;
case "5":
ret = ret + new LSL_List(land.GlobalID);
ret.Add(new LSL_Key(land.GlobalID.ToString()));
break;
default:
ret = ret + new LSL_List(0);
ret.Add(new LSL_Integer(0));
break;
}
}
@ -10679,10 +10679,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (o.ToString())
{
case "1":
ret.Add(av.Firstname + " " + av.Lastname);
ret.Add(new LSL_String(av.Firstname + " " + av.Lastname));
break;
case "2":
ret.Add("");
ret.Add(new LSL_String(""));
break;
case "3":
ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
@ -10694,13 +10694,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
break;
case "6":
ret.Add(id);
ret.Add(new LSL_String(id));
break;
case "7":
ret.Add(UUID.Zero.ToString());
ret.Add(new LSL_String(UUID.Zero.ToString()));
break;
case "8":
ret.Add(UUID.Zero.ToString());
ret.Add(new LSL_String(UUID.Zero.ToString()));
break;
}
}
@ -10714,10 +10714,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (o.ToString())
{
case "1":
ret.Add(obj.Name);
ret.Add(new LSL_String(obj.Name));
break;
case "2":
ret.Add(obj.Description);
ret.Add(new LSL_String(obj.Description));
break;
case "3":
ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z));
@ -10729,13 +10729,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z));
break;
case "6":
ret.Add(obj.OwnerID.ToString());
ret.Add(new LSL_String(obj.OwnerID.ToString()));
break;
case "7":
ret.Add(obj.GroupID.ToString());
ret.Add(new LSL_String(obj.GroupID.ToString()));
break;
case "8":
ret.Add(obj.CreatorID.ToString());
ret.Add(new LSL_String(obj.CreatorID.ToString()));
break;
}
}

View File

@ -820,7 +820,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.ForEachScenePresence(delegate(ScenePresence sp)
{
if (!sp.IsChildAgent)
result.Add(sp.Name);
result.Add(new LSL_String(sp.Name));
});
return result;
}
@ -2043,8 +2043,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (g.Success)
{
result.Add(g.Value);
result.Add(g.Index);
result.Add(new LSL_String(g.Value));
result.Add(new LSL_Integer(g.Index));
}
}
}
@ -2378,8 +2378,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (avatar.IsChildAgent == false)
{
result.Add(new LSL_Key(avatar.UUID.ToString()));
result.Add(new LSL_Vector(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z));
result.Add(new LSL_String(avatar.UUID.ToString()));
OpenMetaverse.Vector3 ap = avatar.AbsolutePosition;
result.Add(new LSL_Vector(ap.X, ap.Y, ap.Z));
result.Add(new LSL_String(avatar.Name));
}
}

View File

@ -84,11 +84,20 @@ namespace OpenSim.Services.AssetService
if (assetLoaderEnabled)
{
m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs,
delegate(AssetBase a)
m_AssetLoader.ForEachDefaultXmlAsset(
loaderArgs,
delegate(AssetBase a)
{
AssetBase existingAsset = Get(a.ID);
// AssetMetadata existingMetadata = GetMetadata(a.ID);
if (existingAsset == null || Util.SHA1Hash(existingAsset.Data) != Util.SHA1Hash(a.Data))
{
// m_log.DebugFormat("[ASSET]: Storing {0} {1}", a.Name, a.ID);
Store(a);
});
}
});
}
m_log.Info("[ASSET SERVICE]: Local asset service enabled");

View File

@ -1 +0,0 @@
Place .ini files here to have them picked up automatically