Merge branch 'master' into bulletsim

bulletsim
Dan Lake 2011-07-20 15:01:32 -07:00
commit 2c11f7fc38
49 changed files with 1464 additions and 845 deletions

View File

@ -57,6 +57,11 @@ namespace OpenSim.Data.SQLite
private SqliteConnection m_conn; private SqliteConnection m_conn;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
override public void Dispose() override public void Dispose()
{ {
if (m_conn != null) if (m_conn != null)
@ -83,8 +88,7 @@ namespace OpenSim.Data.SQLite
m_conn = new SqliteConnection(dbconnect); m_conn = new SqliteConnection(dbconnect);
m_conn.Open(); m_conn.Open();
Assembly assem = GetType().Assembly; Migration m = new Migration(m_conn, Assembly, "AssetStore");
Migration m = new Migration(m_conn, assem, "AssetStore");
m.Update(); m.Update();
return; return;

View File

@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite
protected static SqliteConnection m_Connection; protected static SqliteConnection m_Connection;
private static bool m_initialized = false; private static bool m_initialized = false;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteAuthenticationData(string connectionString, string realm) public SQLiteAuthenticationData(string connectionString, string realm)
: base(connectionString) : base(connectionString)
{ {
@ -63,7 +68,7 @@ namespace OpenSim.Data.SQLite
m_Connection = new SqliteConnection(connectionString); m_Connection = new SqliteConnection(connectionString);
m_Connection.Open(); m_Connection.Open();
Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore"); Migration m = new Migration(m_Connection, Assembly, "AuthStore");
m.Update(); m.Update();
m_initialized = true; m_initialized = true;

View File

@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite
private Dictionary<string, FieldInfo> m_FieldMap = private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>(); new Dictionary<string, FieldInfo>();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteEstateStore() public SQLiteEstateStore()
{ {
} }
@ -71,8 +76,7 @@ namespace OpenSim.Data.SQLite
m_connection = new SqliteConnection(m_connectionString); m_connection = new SqliteConnection(m_connectionString);
m_connection.Open(); m_connection.Open();
Assembly assem = GetType().Assembly; Migration m = new Migration(m_connection, Assembly, "EstateStore");
Migration m = new Migration(m_connection, assem, "EstateStore");
m.Update(); m.Update();
//m_connection.Close(); //m_connection.Close();

View File

@ -55,6 +55,11 @@ namespace OpenSim.Data.SQLite
protected static SqliteConnection m_Connection; protected static SqliteConnection m_Connection;
private static bool m_initialized; private static bool m_initialized;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteGenericTableHandler(string connectionString, public SQLiteGenericTableHandler(string connectionString,
string realm, string storeName) : base(connectionString) string realm, string storeName) : base(connectionString)
{ {
@ -68,13 +73,12 @@ namespace OpenSim.Data.SQLite
if (storeName != String.Empty) if (storeName != String.Empty)
{ {
Assembly assem = GetType().Assembly;
//SqliteConnection newConnection = //SqliteConnection newConnection =
// (SqliteConnection)((ICloneable)m_Connection).Clone(); // (SqliteConnection)((ICloneable)m_Connection).Clone();
//newConnection.Open(); //newConnection.Open();
//Migration m = new Migration(newConnection, assem, storeName); //Migration m = new Migration(newConnection, Assembly, storeName);
Migration m = new Migration(m_Connection, assem, storeName); Migration m = new Migration(m_Connection, Assembly, storeName);
m.Update(); m.Update();
//newConnection.Close(); //newConnection.Close();
//newConnection.Dispose(); //newConnection.Dispose();

View File

@ -74,6 +74,11 @@ namespace OpenSim.Data.SQLite
private String m_connectionString; private String m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public SQLiteSimulationData() public SQLiteSimulationData()
{ {
} }
@ -132,8 +137,7 @@ namespace OpenSim.Data.SQLite
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Migration m = new Migration(m_conn, Assembly, "RegionStore");
Migration m = new Migration(m_conn, assem, "RegionStore");
m.Update(); m.Update();
lock (ds) lock (ds)

View File

@ -41,7 +41,7 @@ using OpenSim.Framework;
namespace OpenSim.Data.SQLite namespace OpenSim.Data.SQLite
{ {
/// <summary> /// <summary>
/// A MySQL Interface for the Asset Server /// A SQLite Interface for the Asset Server
/// </summary> /// </summary>
public class SQLiteXInventoryData : IXInventoryData public class SQLiteXInventoryData : IXInventoryData
{ {

View File

@ -1,114 +0,0 @@
/*
* 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;
namespace OpenSim.Framework
{
/// <summary>
/// Undo stack. Deletes entries beyond a certain capacity
/// </summary>
/// <typeparam name="T"></typeparam>
[Serializable]
public class UndoStack<T>
{
private int m_new = 1;
private int m_old = 0;
private T[] m_Undos;
public UndoStack(int capacity)
{
m_Undos = new T[capacity + 1];
}
public bool IsFull
{
get { return m_new == m_old; }
}
public int Capacity
{
get { return m_Undos.Length - 1; }
}
public int Count
{
get
{
int count = m_new - m_old - 1;
if (count < 0)
count += m_Undos.Length;
return count;
}
}
public void Push(T item)
{
if (IsFull)
{
m_old++;
if (m_old >= m_Undos.Length)
m_old -= m_Undos.Length;
}
if (++m_new >= m_Undos.Length)
m_new -= m_Undos.Length;
m_Undos[m_new] = item;
}
public T Pop()
{
if (Count > 0)
{
T deleted = m_Undos[m_new];
m_Undos[m_new--] = default(T);
if (m_new < 0)
m_new += m_Undos.Length;
return deleted;
}
else
throw new InvalidOperationException("Cannot pop from empty stack");
}
public T Peek()
{
return m_Undos[m_new];
}
public void Clear()
{
if (Count > 0)
{
for (int i = 0; i < m_Undos.Length; i++)
{
m_Undos[i] = default(T);
}
m_new = 1;
m_old = 0;
}
}
}
}

View File

@ -907,15 +907,6 @@ namespace OpenSim.Framework
} }
} }
public class SynchronousRestObjectPoster
{
[Obsolete]
public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
{
return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj);
}
}
public class SynchronousRestObjectRequester public class SynchronousRestObjectRequester
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
@ -981,9 +972,6 @@ namespace OpenSim.Framework
{ {
using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse())
{ {
if (resp.StatusCode == HttpStatusCode.NotFound)
return deserial;
if (resp.ContentLength != 0) if (resp.ContentLength != 0)
{ {
Stream respStream = resp.GetResponseStream(); Stream respStream = resp.GetResponseStream();
@ -993,9 +981,19 @@ namespace OpenSim.Framework
} }
else else
m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
} }
} }
catch (WebException e)
{
HttpWebResponse hwr = (HttpWebResponse)e.Response;
if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound)
return deserial;
else
m_log.ErrorFormat(
"[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}",
requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
}
catch (System.InvalidOperationException) catch (System.InvalidOperationException)
{ {
// This is what happens when there is invalid XML // This is what happens when there is invalid XML

View File

@ -331,14 +331,22 @@ namespace OpenSim.Region.ClientStack.Linden
} }
} }
/// <summary>
/// Handle a request from the client for a Uri to upload a baked texture.
/// </summary>
/// <param name="request"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <param name="httpRequest"></param>
/// <param name="httpResponse"></param>
/// <returns>The upload response if the request is successful, null otherwise.</returns>
public string UploadBakedTexture(string request, string path, public string UploadBakedTexture(string request, string path,
string param, OSHttpRequest httpRequest, string param, OSHttpRequest httpRequest,
OSHttpResponse httpResponse) OSHttpResponse httpResponse)
{ {
try try
{ {
// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName);
// m_regionName);
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
@ -374,6 +382,11 @@ namespace OpenSim.Region.ClientStack.Linden
return null; return null;
} }
/// <summary>
/// Called when a baked texture has been successfully uploaded by a client.
/// </summary>
/// <param name="assetID"></param>
/// <param name="data"></param>
public void BakedTextureUploaded(UUID assetID, byte[] data) public void BakedTextureUploaded(UUID assetID, byte[] data)
{ {
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
@ -687,7 +700,7 @@ namespace OpenSim.Region.ClientStack.Linden
item.CurrentPermissions = (uint)PermissionMask.All; item.CurrentPermissions = (uint)PermissionMask.All;
item.BasePermissions = (uint)PermissionMask.All; item.BasePermissions = (uint)PermissionMask.All;
item.EveryOnePermissions = 0; item.EveryOnePermissions = 0;
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); item.NextPermissions = (uint)PermissionMask.All;
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
if (AddNewInventoryItem != null) if (AddNewInventoryItem != null)

View File

@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden
private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
{ {
m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request"); // m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request");
OSDMap data = new OSDMap(); OSDMap data = new OSDMap();
ScenePresence sp = m_scene.GetScenePresence(m_agentID); ScenePresence sp = m_scene.GetScenePresence(m_agentID);

View File

@ -161,8 +161,6 @@ namespace OpenSim.Region.ClientStack.Linden
} }
// } // }
string assetName = llsdRequest.name; string assetName = llsdRequest.name;
string assetDes = llsdRequest.description; string assetDes = llsdRequest.description;
string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/"; string capsBase = "/CAPS/NewFileAgentInventoryVariablePrice/";
@ -208,12 +206,10 @@ namespace OpenSim.Region.ClientStack.Linden
return uploadResponse; return uploadResponse;
} }
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
string assetType,UUID AgentID) string assetType,UUID AgentID)
{ {
sbyte assType = 0; sbyte assType = 0;
sbyte inType = 0; sbyte inType = 0;
@ -266,7 +262,7 @@ namespace OpenSim.Region.ClientStack.Linden
item.CurrentPermissions = (uint)PermissionMask.All; item.CurrentPermissions = (uint)PermissionMask.All;
item.BasePermissions = (uint)PermissionMask.All; item.BasePermissions = (uint)PermissionMask.All;
item.EveryOnePermissions = 0; item.EveryOnePermissions = 0;
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); item.NextPermissions = (uint)PermissionMask.All;
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
m_scene.AddInventoryItem(item); m_scene.AddInventoryItem(item);

View File

@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden
/// <summary> /// <summary>
/// Parses ad request /// Parses add request
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="AgentId"></param> /// <param name="AgentId"></param>
@ -312,11 +312,11 @@ namespace OpenSim.Region.ClientStack.Linden
primFace.RepeatV = face.ScaleT; primFace.RepeatV = face.ScaleT;
primFace.TexMapType = (MappingType) (face.MediaFlags & 6); primFace.TexMapType = (MappingType) (face.MediaFlags & 6);
} }
pbs.TextureEntry = tmp.GetBytes(); pbs.TextureEntry = tmp.GetBytes();
prim.Shape = pbs; prim.Shape = pbs;
prim.Scale = obj.Scale; prim.Scale = obj.Scale;
SceneObjectGroup grp = new SceneObjectGroup(); SceneObjectGroup grp = new SceneObjectGroup();
grp.SetRootPart(prim); grp.SetRootPart(prim);
@ -339,8 +339,8 @@ namespace OpenSim.Region.ClientStack.Linden
m_scene.AddSceneObject(grp); m_scene.AddSceneObject(grp);
grp.AbsolutePosition = obj.Position; grp.AbsolutePosition = obj.Position;
} }
allparts[i] = grp;
allparts[i] = grp;
} }
for (int j = 1; j < allparts.Length; j++) for (int j = 1; j < allparts.Length; j++)
@ -351,7 +351,9 @@ namespace OpenSim.Region.ClientStack.Linden
} }
rootGroup.ScheduleGroupForFullUpdate(); rootGroup.ScheduleGroupForFullUpdate();
pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false); pos
= m_scene.GetNewRezLocation(
Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false);
responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["int_response_code"] = 200; //501; //410; //404;
responsedata["content_type"] = "text/plain"; responsedata["content_type"] = "text/plain";

View File

@ -574,22 +574,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return result; return result;
} }
/// <summary>
/// Add a handler for the given packet type.
/// </summary>
/// <remarks>The packet is handled on its own thread. If packets must be handled in the order in which thye
/// are received then please us ethe synchronous version of this method.</remarks>
/// <param name="packetType"></param>
/// <param name="handler"></param>
/// <returns>true if the handler was added. This is currently always the case.</returns>
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler) public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler)
{ {
return AddLocalPacketHandler(packetType, handler, true); return AddLocalPacketHandler(packetType, handler, true);
} }
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool async) /// <summary>
/// Add a handler for the given packet type.
/// </summary>
/// <param name="packetType"></param>
/// <param name="handler"></param>
/// <param name="doAsync">
/// If true, when the packet is received it is handled on its own thread rather than on the main inward bound
/// packet handler thread. This vastly increases respnosiveness but some packets need to be handled
/// synchronously.
/// </param>
/// <returns>true if the handler was added. This is currently always the case.</returns>
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync)
{ {
bool result = false; bool result = false;
lock (m_packetHandlers) lock (m_packetHandlers)
{ {
if (!m_packetHandlers.ContainsKey(packetType)) if (!m_packetHandlers.ContainsKey(packetType))
{ {
m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = async }); m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = doAsync });
result = true; result = true;
} }
} }
return result; return result;
} }
@ -11200,8 +11220,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet) protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet)
{ {
MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
if (multipleupdate.AgentData.SessionID != SessionId) return false;
// m_log.Debug("new multi update packet " + multipleupdate.ToString()); if (multipleupdate.AgentData.SessionID != SessionId)
return false;
// m_log.DebugFormat(
// "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length);
Scene tScene = (Scene)m_scene; Scene tScene = (Scene)m_scene;
for (int i = 0; i < multipleupdate.ObjectData.Length; i++) for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
@ -11222,7 +11247,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
else else
{ {
// UUID partId = part.UUID; // m_log.DebugFormat(
// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
// i, block.Type, part.Name, part.LocalId);
// // Do this once since fetch parts creates a new array.
// SceneObjectPart[] parts = part.ParentGroup.Parts;
// for (int j = 0; j < parts.Length; j++)
// {
// part.StoreUndoState();
// parts[j].IgnoreUndoUpdate = true;
// }
UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
switch (block.Type) switch (block.Type)
@ -11237,6 +11273,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimSinglePosition(localId, pos1, this); handlerUpdatePrimSinglePosition(localId, pos1, this);
} }
break; break;
case 2: case 2:
Quaternion rot1 = new Quaternion(block.Data, 0, true); Quaternion rot1 = new Quaternion(block.Data, 0, true);
@ -11247,6 +11284,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimSingleRotation(localId, rot1, this); handlerUpdatePrimSingleRotation(localId, rot1, this);
} }
break; break;
case 3: case 3:
Vector3 rotPos = new Vector3(block.Data, 0); Vector3 rotPos = new Vector3(block.Data, 0);
Quaternion rot2 = new Quaternion(block.Data, 12, true); Quaternion rot2 = new Quaternion(block.Data, 12, true);
@ -11259,6 +11297,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
} }
break; break;
case 4: case 4:
case 20: case 20:
Vector3 scale4 = new Vector3(block.Data, 0); Vector3 scale4 = new Vector3(block.Data, 0);
@ -11270,8 +11309,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimScale(localId, scale4, this); handlerUpdatePrimScale(localId, scale4, this);
} }
break; break;
case 5:
case 5:
Vector3 scale1 = new Vector3(block.Data, 12); Vector3 scale1 = new Vector3(block.Data, 12);
Vector3 pos11 = new Vector3(block.Data, 0); Vector3 pos11 = new Vector3(block.Data, 0);
@ -11288,6 +11327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case 9: case 9:
Vector3 pos2 = new Vector3(block.Data, 0); Vector3 pos2 = new Vector3(block.Data, 0);
@ -11295,10 +11335,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerUpdateVector != null) if (handlerUpdateVector != null)
{ {
handlerUpdateVector(localId, pos2, this); handlerUpdateVector(localId, pos2, this);
} }
break; break;
case 10: case 10:
Quaternion rot3 = new Quaternion(block.Data, 0, true); Quaternion rot3 = new Quaternion(block.Data, 0, true);
@ -11309,6 +11349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimRotation(localId, rot3, this); handlerUpdatePrimRotation(localId, rot3, this);
} }
break; break;
case 11: case 11:
Vector3 pos3 = new Vector3(block.Data, 0); Vector3 pos3 = new Vector3(block.Data, 0);
Quaternion rot4 = new Quaternion(block.Data, 12, true); Quaternion rot4 = new Quaternion(block.Data, 12, true);
@ -11332,6 +11373,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimGroupScale(localId, scale7, this); handlerUpdatePrimGroupScale(localId, scale7, this);
} }
break; break;
case 13: case 13:
Vector3 scale2 = new Vector3(block.Data, 12); Vector3 scale2 = new Vector3(block.Data, 12);
Vector3 pos4 = new Vector3(block.Data, 0); Vector3 pos4 = new Vector3(block.Data, 0);
@ -11351,6 +11393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case 29: case 29:
Vector3 scale5 = new Vector3(block.Data, 12); Vector3 scale5 = new Vector3(block.Data, 12);
Vector3 pos5 = new Vector3(block.Data, 0); Vector3 pos5 = new Vector3(block.Data, 0);
@ -11359,6 +11402,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerUpdatePrimGroupScale != null) if (handlerUpdatePrimGroupScale != null)
{ {
// m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
part.StoreUndoState(true);
part.IgnoreUndoUpdate = true;
handlerUpdatePrimGroupScale(localId, scale5, this); handlerUpdatePrimGroupScale(localId, scale5, this);
handlerUpdateVector = OnUpdatePrimGroupPosition; handlerUpdateVector = OnUpdatePrimGroupPosition;
@ -11366,8 +11411,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
handlerUpdateVector(localId, pos5, this); handlerUpdateVector(localId, pos5, this);
} }
part.IgnoreUndoUpdate = false;
} }
break; break;
case 21: case 21:
Vector3 scale6 = new Vector3(block.Data, 12); Vector3 scale6 = new Vector3(block.Data, 12);
Vector3 pos6 = new Vector3(block.Data, 0); Vector3 pos6 = new Vector3(block.Data, 0);
@ -11375,6 +11424,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUpdatePrimScale = OnUpdatePrimScale; handlerUpdatePrimScale = OnUpdatePrimScale;
if (handlerUpdatePrimScale != null) if (handlerUpdatePrimScale != null)
{ {
part.StoreUndoState(false);
part.IgnoreUndoUpdate = true;
// m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
handlerUpdatePrimScale(localId, scale6, this); handlerUpdatePrimScale(localId, scale6, this);
handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
@ -11382,15 +11434,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
handlerUpdatePrimSinglePosition(localId, pos6, this); handlerUpdatePrimSinglePosition(localId, pos6, this);
} }
part.IgnoreUndoUpdate = false;
} }
break; break;
default: default:
m_log.Debug("[CLIENT] MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
break; break;
} }
// for (int j = 0; j < parts.Length; j++)
// parts[j].IgnoreUndoUpdate = false;
} }
} }
} }
return true; return true;
} }

View File

@ -566,7 +566,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// <param name="silent"></param> /// <param name="silent"></param>
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
{ {
m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name, m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
attachmentpoint, attachOffset, so.RootPart.AttachedPos); attachmentpoint, attachOffset, so.RootPart.AttachedPos);

View File

@ -180,8 +180,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
} }
/// <summary> /// <summary>
/// Set appearance data (textureentry and slider settings) received from the client /// Set appearance data (texture asset IDs and slider settings) received from the client
/// </summary> /// </summary>
/// <param name="client"></param>
/// <param name="texture"></param> /// <param name="texture"></param>
/// <param name="visualParam"></param> /// <param name="visualParam"></param>
public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)

View File

@ -173,9 +173,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{ {
if (m_RestURL != "") if (m_RestURL != "")
{ {
m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId);
List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( List<GridInstantMessage> msglist
= SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>(
"POST", m_RestURL + "/RetrieveMessages/", client.AgentId); "POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
if (msglist == null) if (msglist == null)
@ -203,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if ((im.offline != 0) if ((im.offline != 0)
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
{ {
bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
"POST", m_RestURL+"/SaveMessage/", im); "POST", m_RestURL+"/SaveMessage/", im);
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)

View File

@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
if (!(client.Scene is Scene)) if (!(client.Scene is Scene))
return; return;
Scene scene = (Scene)(client.Scene); // Scene scene = (Scene)(client.Scene);
GridInstantMessage im = null; GridInstantMessage im = null;
if (m_PendingLures.TryGetValue(lureID, out im)) if (m_PendingLures.TryGetValue(lureID, out im))

View File

@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
if (!(s is Scene)) if (!(s is Scene))
return; return;
Scene scene = (Scene)s; // Scene scene = (Scene)s;
string profileUrl = String.Empty; string profileUrl = String.Empty;
string aboutText = String.Empty; string aboutText = String.Empty;

View File

@ -810,18 +810,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// //
if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment))
remoteClient.SendBulkUpdateInventory(item); remoteClient.SendBulkUpdateInventory(item);
return null; return null;
} }
for (int i = 0 ; i < objlist.Count ; i++ ) for (int i = 0 ; i < objlist.Count; i++)
{ {
group = objlist[i]; group = objlist[i];
Vector3 storedPosition = group.AbsolutePosition; // Vector3 storedPosition = group.AbsolutePosition;
if (group.UUID == UUID.Zero) if (group.UUID == UUID.Zero)
{ {
m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3"); m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3");
} }
group.RootPart.FromFolderID = item.Folder; group.RootPart.FromFolderID = item.Folder;
// If it's rezzed in world, select it. Much easier to // If it's rezzed in world, select it. Much easier to
@ -833,6 +835,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
foreach (SceneObjectPart child in group.Parts) foreach (SceneObjectPart child in group.Parts)
child.CreateSelected = true; child.CreateSelected = true;
} }
group.ResetIDs(); group.ResetIDs();
if (attachment) if (attachment)

View File

@ -68,7 +68,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
{ {
m_scene = scene; m_scene = scene;
m_scene.AddCommand(this, "monitor report", m_scene.AddCommand(this, "monitor report",
"monitor report", "monitor report",
"Returns a variety of statistics about the current region and/or simulator", "Returns a variety of statistics about the current region and/or simulator",

View File

@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
private ITerrainChannel m_revert; private ITerrainChannel m_revert;
private Scene m_scene; private Scene m_scene;
private volatile bool m_tainted; private volatile bool m_tainted;
private readonly UndoStack<LandUndoState> m_undo = new UndoStack<LandUndoState>(5); private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
#region ICommandableModule Members #region ICommandableModule Members

View File

@ -1751,8 +1751,9 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart rootPart = group.GetChildPart(group.UUID); SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.Flags &= ~PrimFlags.Scripted; rootPart.Flags &= ~PrimFlags.Scripted;
rootPart.TrimPermissions(); rootPart.TrimPermissions();
group.CheckSculptAndLoad();
//rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); // Don't do this here - it will get done later on when sculpt data is loaded.
// group.CheckSculptAndLoad();
} }
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
@ -2715,12 +2716,14 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientPrimEvents(IClientAPI client) public virtual void SubscribeToClientPrimEvents(IClientAPI client)
{ {
client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition;
client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation;
client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation;
client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation;
client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition;
client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale;
client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale;
client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam;
@ -2842,12 +2845,14 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) public virtual void UnSubscribeToClientPrimEvents(IClientAPI client)
{ {
client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition;
client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition;
client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation;
client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation; client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation;
client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation;
client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation;
client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition;
client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale;
client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale;
client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam;

View File

@ -564,11 +564,13 @@ namespace OpenSim.Region.Framework.Scenes
part.Undo(); part.Undo();
} }
} }
protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
{ {
if (primId != UUID.Zero) if (primId != UUID.Zero)
{ {
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
if (part != null) if (part != null)
part.Redo(); part.Redo();
} }
@ -1210,19 +1212,20 @@ namespace OpenSim.Region.Framework.Scenes
#region Client Event handlers #region Client Event handlers
/// <summary> /// <summary>
/// /// Update the scale of an individual prim.
/// </summary> /// </summary>
/// <param name="localID"></param> /// <param name="localID"></param>
/// <param name="scale"></param> /// <param name="scale"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (group != null)
if (part != null)
{ {
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId))
{ {
group.Resize(scale, localID); part.Resize(scale);
} }
} }
} }
@ -1234,7 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{ {
group.GroupResize(scale, localID); group.GroupResize(scale);
} }
} }
} }
@ -1288,19 +1291,18 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
{ {
group.UpdateSingleRotation(rot,pos, localID); group.UpdateSingleRotation(rot, pos, localID);
} }
} }
} }
/// <summary> /// <summary>
/// /// Update the rotation of a whole group.
/// </summary> /// </summary>
/// <param name="localID"></param> /// <param name="localID"></param>
/// <param name="rot"></param> /// <param name="rot"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
protected internal void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient) protected internal void UpdatePrimGroupRotation(uint localID, Quaternion rot, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null) if (group != null)
@ -1319,7 +1321,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos"></param> /// <param name="pos"></param>
/// <param name="rot"></param> /// <param name="rot"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
protected internal void UpdatePrimRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient) protected internal void UpdatePrimGroupRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null) if (group != null)
@ -1350,12 +1352,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// Update the position of the given part /// Update the position of the given group.
/// </summary> /// </summary>
/// <param name="localID"></param> /// <param name="localID"></param>
/// <param name="pos"></param> /// <param name="pos"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);

View File

@ -236,6 +236,38 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_rootPart.RotationOffset; } get { return m_rootPart.RotationOffset; }
} }
public Vector3 GroupScale
{
get
{
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
Vector3 maxScale = Vector3.Zero;
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
Vector3 partscale = part.Scale;
Vector3 partoffset = part.OffsetPosition;
minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
}
finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X;
finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
return finalScale;
}
}
public UUID GroupID public UUID GroupID
{ {
get { return m_rootPart.GroupID; } get { return m_rootPart.GroupID; }
@ -592,34 +624,6 @@ namespace OpenSim.Region.Framework.Scenes
//ScheduleGroupForFullUpdate(); //ScheduleGroupForFullUpdate();
} }
public Vector3 GroupScale()
{
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
Vector3 maxScale = Vector3.Zero;
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
Vector3 partscale = part.Scale;
Vector3 partoffset = part.OffsetPosition;
minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
}
finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X;
finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
return finalScale;
}
public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters)
{ {
// We got a request from the inner_scene to raytrace along the Ray hRay // We got a request from the inner_scene to raytrace along the Ray hRay
@ -1141,6 +1145,10 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
{ {
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Processing OnGrabPart for {0} on {1} {2}, offsetPos {3}",
// remoteClient.Name, part.Name, part.LocalId, offsetPos);
part.StoreUndoState(); part.StoreUndoState();
part.OnGrab(offsetPos, remoteClient); part.OnGrab(offsetPos, remoteClient);
} }
@ -1463,17 +1471,17 @@ namespace OpenSim.Region.Framework.Scenes
// Need to duplicate the physics actor as well // Need to duplicate the physics actor as well
if (part.PhysActor != null && userExposed) if (part.PhysActor != null && userExposed)
{ {
PrimitiveBaseShape pbs = part.Shape; PrimitiveBaseShape pbs = newPart.Shape;
newPart.PhysActor newPart.PhysActor
= m_scene.PhysicsScene.AddPrimShape( = m_scene.PhysicsScene.AddPrimShape(
part.LocalId, string.Format("{0}/{1}", newPart.Name, newPart.UUID),
string.Format("{0}/{1}", part.Name, part.UUID),
pbs, pbs,
part.AbsolutePosition, newPart.AbsolutePosition,
part.Scale, newPart.Scale,
part.RotationOffset, newPart.RotationOffset,
part.PhysActor.IsPhysical); part.PhysActor.IsPhysical,
newPart.LocalId);
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
} }
@ -2608,195 +2616,150 @@ namespace OpenSim.Region.Framework.Scenes
#region Resize #region Resize
/// <summary> /// <summary>
/// Resize the given part /// Resize the entire group of prims.
/// </summary> /// </summary>
/// <param name="scale"></param> /// <param name="scale"></param>
/// <param name="localID"></param> public void GroupResize(Vector3 scale)
public void Resize(Vector3 scale, uint localID)
{ {
if (scale.X > m_scene.m_maxNonphys) // m_log.DebugFormat(
scale.X = m_scene.m_maxNonphys; // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale);
if (scale.Y > m_scene.m_maxNonphys)
scale.Y = m_scene.m_maxNonphys;
if (scale.Z > m_scene.m_maxNonphys)
scale.Z = m_scene.m_maxNonphys;
SceneObjectPart part = GetChildPart(localID); RootPart.StoreUndoState(true);
if (part != null)
scale.X = Math.Min(scale.X, Scene.m_maxNonphys);
scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
{ {
part.Resize(scale); scale.X = Math.Min(scale.X, Scene.m_maxPhys);
if (part.PhysActor != null) scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
{ scale.Z = Math.Min(scale.Z, Scene.m_maxPhys);
if (part.PhysActor.IsPhysical)
{
if (scale.X > m_scene.m_maxPhys)
scale.X = m_scene.m_maxPhys;
if (scale.Y > m_scene.m_maxPhys)
scale.Y = m_scene.m_maxPhys;
if (scale.Z > m_scene.m_maxPhys)
scale.Z = m_scene.m_maxPhys;
}
part.PhysActor.Size = scale;
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
}
//if (part.UUID != m_rootPart.UUID)
HasGroupChanged = true;
part.TriggerScriptChangedEvent(Changed.SCALE);
ScheduleGroupForFullUpdate();
//if (part.UUID == m_rootPart.UUID)
//{
//if (m_rootPart.PhysActor != null)
//{
//m_rootPart.PhysActor.Size =
//new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
//m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
//}
//}
} }
}
public void GroupResize(Vector3 scale, uint localID) float x = (scale.X / RootPart.Scale.X);
{ float y = (scale.Y / RootPart.Scale.Y);
SceneObjectPart part = GetChildPart(localID); float z = (scale.Z / RootPart.Scale.Z);
if (part != null)
SceneObjectPart[] parts;
if (x > 1.0f || y > 1.0f || z > 1.0f)
{ {
part.IgnoreUndoUpdate = true;
if (scale.X > m_scene.m_maxNonphys)
scale.X = m_scene.m_maxNonphys;
if (scale.Y > m_scene.m_maxNonphys)
scale.Y = m_scene.m_maxNonphys;
if (scale.Z > m_scene.m_maxNonphys)
scale.Z = m_scene.m_maxNonphys;
if (part.PhysActor != null && part.PhysActor.IsPhysical)
{
if (scale.X > m_scene.m_maxPhys)
scale.X = m_scene.m_maxPhys;
if (scale.Y > m_scene.m_maxPhys)
scale.Y = m_scene.m_maxPhys;
if (scale.Z > m_scene.m_maxPhys)
scale.Z = m_scene.m_maxPhys;
}
float x = (scale.X / part.Scale.X);
float y = (scale.Y / part.Scale.Y);
float z = (scale.Z / part.Scale.Z);
SceneObjectPart[] parts;
if (x > 1.0f || y > 1.0f || z > 1.0f)
{
parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart obPart = parts[i];
if (obPart.UUID != m_rootPart.UUID)
{
obPart.IgnoreUndoUpdate = true;
Vector3 oldSize = new Vector3(obPart.Scale);
float f = 1.0f;
float a = 1.0f;
if (part.PhysActor != null && part.PhysActor.IsPhysical)
{
if (oldSize.X * x > m_scene.m_maxPhys)
{
f = m_scene.m_maxPhys / oldSize.X;
a = f / x;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Y * y > m_scene.m_maxPhys)
{
f = m_scene.m_maxPhys / oldSize.Y;
a = f / y;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Z * z > m_scene.m_maxPhys)
{
f = m_scene.m_maxPhys / oldSize.Z;
a = f / z;
x *= a;
y *= a;
z *= a;
}
}
else
{
if (oldSize.X * x > m_scene.m_maxNonphys)
{
f = m_scene.m_maxNonphys / oldSize.X;
a = f / x;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Y * y > m_scene.m_maxNonphys)
{
f = m_scene.m_maxNonphys / oldSize.Y;
a = f / y;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Z * z > m_scene.m_maxNonphys)
{
f = m_scene.m_maxNonphys / oldSize.Z;
a = f / z;
x *= a;
y *= a;
z *= a;
}
}
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
}
}
}
Vector3 prevScale = part.Scale;
prevScale.X *= x;
prevScale.Y *= y;
prevScale.Z *= z;
part.Resize(prevScale);
parts = m_parts.GetArray(); parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart obPart = parts[i]; SceneObjectPart obPart = parts[i];
obPart.IgnoreUndoUpdate = true;
if (obPart.UUID != m_rootPart.UUID) if (obPart.UUID != m_rootPart.UUID)
{ {
Vector3 currentpos = new Vector3(obPart.OffsetPosition); // obPart.IgnoreUndoUpdate = true;
currentpos.X *= x; Vector3 oldSize = new Vector3(obPart.Scale);
currentpos.Y *= y;
currentpos.Z *= z; float f = 1.0f;
Vector3 newSize = new Vector3(obPart.Scale); float a = 1.0f;
newSize.X *= x;
newSize.Y *= y; if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
newSize.Z *= z; {
obPart.Resize(newSize); if (oldSize.X * x > m_scene.m_maxPhys)
obPart.UpdateOffSet(currentpos); {
f = m_scene.m_maxPhys / oldSize.X;
a = f / x;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Y * y > m_scene.m_maxPhys)
{
f = m_scene.m_maxPhys / oldSize.Y;
a = f / y;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Z * z > m_scene.m_maxPhys)
{
f = m_scene.m_maxPhys / oldSize.Z;
a = f / z;
x *= a;
y *= a;
z *= a;
}
}
else
{
if (oldSize.X * x > m_scene.m_maxNonphys)
{
f = m_scene.m_maxNonphys / oldSize.X;
a = f / x;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Y * y > m_scene.m_maxNonphys)
{
f = m_scene.m_maxNonphys / oldSize.Y;
a = f / y;
x *= a;
y *= a;
z *= a;
}
if (oldSize.Z * z > m_scene.m_maxNonphys)
{
f = m_scene.m_maxNonphys / oldSize.Z;
a = f / z;
x *= a;
y *= a;
z *= a;
}
}
// obPart.IgnoreUndoUpdate = false;
} }
obPart.IgnoreUndoUpdate = false;
obPart.StoreUndoState();
} }
if (part.PhysActor != null)
{
part.PhysActor.Size = prevScale;
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
}
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
HasGroupChanged = true;
m_rootPart.TriggerScriptChangedEvent(Changed.SCALE);
ScheduleGroupForTerseUpdate();
} }
Vector3 prevScale = RootPart.Scale;
prevScale.X *= x;
prevScale.Y *= y;
prevScale.Z *= z;
// RootPart.IgnoreUndoUpdate = true;
RootPart.Resize(prevScale);
// RootPart.IgnoreUndoUpdate = false;
parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart obPart = parts[i];
if (obPart.UUID != m_rootPart.UUID)
{
obPart.IgnoreUndoUpdate = true;
Vector3 currentpos = new Vector3(obPart.OffsetPosition);
currentpos.X *= x;
currentpos.Y *= y;
currentpos.Z *= z;
Vector3 newSize = new Vector3(obPart.Scale);
newSize.X *= x;
newSize.Y *= y;
newSize.Z *= z;
obPart.Resize(newSize);
obPart.UpdateOffSet(currentpos);
obPart.IgnoreUndoUpdate = false;
}
// obPart.IgnoreUndoUpdate = false;
// obPart.StoreUndoState();
}
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale);
} }
#endregion #endregion
@ -2809,9 +2772,13 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos"></param> /// <param name="pos"></param>
public void UpdateGroupPosition(Vector3 pos) public void UpdateGroupPosition(Vector3 pos)
{ {
SceneObjectPart[] parts = m_parts.GetArray(); // m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos);
for (int i = 0; i < parts.Length; i++)
parts[i].StoreUndoState(); RootPart.StoreUndoState(true);
// SceneObjectPart[] parts = m_parts.GetArray();
// for (int i = 0; i < parts.Length; i++)
// parts[i].StoreUndoState();
if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{ {
@ -2848,12 +2815,18 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectPart part = GetChildPart(localID); SceneObjectPart part = GetChildPart(localID);
SceneObjectPart[] parts = m_parts.GetArray(); // SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) // for (int i = 0; i < parts.Length; i++)
parts[i].StoreUndoState(); // parts[i].StoreUndoState();
if (part != null) if (part != null)
{ {
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos);
part.StoreUndoState(false);
part.IgnoreUndoUpdate = true;
if (part.UUID == m_rootPart.UUID) if (part.UUID == m_rootPart.UUID)
{ {
UpdateRootPosition(pos); UpdateRootPosition(pos);
@ -2864,18 +2837,22 @@ namespace OpenSim.Region.Framework.Scenes
} }
HasGroupChanged = true; HasGroupChanged = true;
part.IgnoreUndoUpdate = false;
} }
} }
/// <summary> /// <summary>
/// /// Update just the root prim position in a linkset
/// </summary> /// </summary>
/// <param name="pos"></param> /// <param name="pos"></param>
private void UpdateRootPosition(Vector3 pos) public void UpdateRootPosition(Vector3 pos)
{ {
SceneObjectPart[] parts = m_parts.GetArray(); // m_log.DebugFormat(
for (int i = 0; i < parts.Length; i++) // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos);
parts[i].StoreUndoState();
// SceneObjectPart[] parts = m_parts.GetArray();
// for (int i = 0; i < parts.Length; i++)
// parts[i].StoreUndoState();
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
Vector3 oldPos = Vector3 oldPos =
@ -2888,7 +2865,7 @@ namespace OpenSim.Region.Framework.Scenes
axDiff *= Quaternion.Inverse(partRotation); axDiff *= Quaternion.Inverse(partRotation);
diff = axDiff; diff = axDiff;
parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart obPart = parts[i]; SceneObjectPart obPart = parts[i];
@ -2917,9 +2894,14 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="rot"></param> /// <param name="rot"></param>
public void UpdateGroupRotationR(Quaternion rot) public void UpdateGroupRotationR(Quaternion rot)
{ {
SceneObjectPart[] parts = m_parts.GetArray(); // m_log.DebugFormat(
for (int i = 0; i < parts.Length; i++) // "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot);
parts[i].StoreUndoState();
// SceneObjectPart[] parts = m_parts.GetArray();
// for (int i = 0; i < parts.Length; i++)
// parts[i].StoreUndoState();
m_rootPart.StoreUndoState(true);
m_rootPart.UpdateRotation(rot); m_rootPart.UpdateRotation(rot);
@ -2941,9 +2923,15 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="rot"></param> /// <param name="rot"></param>
public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
{ {
SceneObjectPart[] parts = m_parts.GetArray(); // m_log.DebugFormat(
for (int i = 0; i < parts.Length; i++) // "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot);
parts[i].StoreUndoState();
// SceneObjectPart[] parts = m_parts.GetArray();
// for (int i = 0; i < parts.Length; i++)
// parts[i].StoreUndoState();
RootPart.StoreUndoState(true);
RootPart.IgnoreUndoUpdate = true;
m_rootPart.UpdateRotation(rot); m_rootPart.UpdateRotation(rot);
@ -2958,6 +2946,8 @@ namespace OpenSim.Region.Framework.Scenes
HasGroupChanged = true; HasGroupChanged = true;
ScheduleGroupForTerseUpdate(); ScheduleGroupForTerseUpdate();
RootPart.IgnoreUndoUpdate = false;
} }
/// <summary> /// <summary>
@ -2975,6 +2965,9 @@ namespace OpenSim.Region.Framework.Scenes
if (part != null) if (part != null)
{ {
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot);
if (part.UUID == m_rootPart.UUID) if (part.UUID == m_rootPart.UUID)
{ {
UpdateRootRotation(rot); UpdateRootRotation(rot);
@ -2996,6 +2989,13 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetChildPart(localID); SceneObjectPart part = GetChildPart(localID);
if (part != null) if (part != null)
{ {
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}",
// part.Name, part.LocalId, rot);
part.StoreUndoState();
part.IgnoreUndoUpdate = true;
if (part.UUID == m_rootPart.UUID) if (part.UUID == m_rootPart.UUID)
{ {
UpdateRootRotation(rot); UpdateRootRotation(rot);
@ -3003,12 +3003,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
part.IgnoreUndoUpdate = true;
part.UpdateRotation(rot); part.UpdateRotation(rot);
part.OffsetPosition = pos; part.OffsetPosition = pos;
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
} }
part.IgnoreUndoUpdate = false;
} }
} }
@ -3016,8 +3015,12 @@ namespace OpenSim.Region.Framework.Scenes
/// ///
/// </summary> /// </summary>
/// <param name="rot"></param> /// <param name="rot"></param>
private void UpdateRootRotation(Quaternion rot) public void UpdateRootRotation(Quaternion rot)
{ {
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}",
// Name, LocalId, rot);
Quaternion axRot = rot; Quaternion axRot = rot;
Quaternion oldParentRot = m_rootPart.RotationOffset; Quaternion oldParentRot = m_rootPart.RotationOffset;
@ -3045,20 +3048,25 @@ namespace OpenSim.Region.Framework.Scenes
newRot *= Quaternion.Inverse(axRot); newRot *= Quaternion.Inverse(axRot);
prim.RotationOffset = newRot; prim.RotationOffset = newRot;
prim.ScheduleTerseUpdate(); prim.ScheduleTerseUpdate();
prim.IgnoreUndoUpdate = false;
} }
} }
for (int i = 0; i < parts.Length; i++) // for (int i = 0; i < parts.Length; i++)
{ // {
SceneObjectPart childpart = parts[i]; // SceneObjectPart childpart = parts[i];
if (childpart != m_rootPart) // if (childpart != m_rootPart)
{ // {
childpart.IgnoreUndoUpdate = false; //// childpart.IgnoreUndoUpdate = false;
childpart.StoreUndoState(); //// childpart.StoreUndoState();
} // }
} // }
m_rootPart.ScheduleTerseUpdate(); m_rootPart.ScheduleTerseUpdate();
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}",
// Name, LocalId, rot);
} }
#endregion #endregion
@ -3312,23 +3320,6 @@ namespace OpenSim.Region.Framework.Scenes
parts[i].CheckSculptAndLoad(); parts[i].CheckSculptAndLoad();
} }
/// <summary>
/// Handle an asset received asynchronously from the asset service.
/// </summary>
/// <param name="id"></param>
/// <param name="sender"></param>
/// <param name="asset"></param>
protected void AssetReceived(string id, Object sender, AssetBase asset)
{
SceneObjectPart sop = (SceneObjectPart)sender;
if (sop != null)
{
if (asset != null)
sop.SculptTextureCallback(asset.FullID, asset);
}
}
/// <summary> /// <summary>
/// Set the user group to which this scene object belongs. /// Set the user group to which this scene object belongs.
/// </summary> /// </summary>

View File

@ -287,8 +287,8 @@ namespace OpenSim.Region.Framework.Scenes
private string m_sitAnimation = "SIT"; private string m_sitAnimation = "SIT";
private string m_text = String.Empty; private string m_text = String.Empty;
private string m_touchName = String.Empty; private string m_touchName = String.Empty;
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5);
private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5); private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5);
private UUID _creatorID; private UUID _creatorID;
private bool m_passTouches; private bool m_passTouches;
@ -414,7 +414,6 @@ namespace OpenSim.Region.Framework.Scenes
CreateSelected = true; CreateSelected = true;
TrimPermissions(); TrimPermissions();
//m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
m_inventory = new SceneObjectPartInventory(this); m_inventory = new SceneObjectPartInventory(this);
} }
@ -789,7 +788,7 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_offsetPosition; } get { return m_offsetPosition; }
set set
{ {
StoreUndoState(); // StoreUndoState();
m_offsetPosition = value; m_offsetPosition = value;
if (ParentGroup != null && !ParentGroup.IsDeleted) if (ParentGroup != null && !ParentGroup.IsDeleted)
@ -1016,14 +1015,18 @@ namespace OpenSim.Region.Framework.Scenes
set { m_shape = value; } set { m_shape = value; }
} }
/// <summary>
/// Change the scale of this part.
/// </summary>
public Vector3 Scale public Vector3 Scale
{ {
get { return m_shape.Scale; } get { return m_shape.Scale; }
set set
{ {
StoreUndoState();
if (m_shape != null) if (m_shape != null)
{ {
StoreUndoState();
m_shape.Scale = value; m_shape.Scale = value;
PhysicsActor actor = PhysActor; PhysicsActor actor = PhysActor;
@ -1034,11 +1037,16 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup.Scene.PhysicsScene != null) if (m_parentGroup.Scene.PhysicsScene != null)
{ {
actor.Size = m_shape.Scale; actor.Size = m_shape.Scale;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
CheckSculptAndLoad();
else
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
} }
} }
} }
} }
TriggerScriptChangedEvent(Changed.SCALE); TriggerScriptChangedEvent(Changed.SCALE);
} }
} }
@ -1588,17 +1596,23 @@ namespace OpenSim.Region.Framework.Scenes
// or flexible // or flexible
if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
{ {
// m_log.DebugFormat("[SCENE OBJECT PART]: Creating PhysActor for {0} {1} {2}", Name, LocalId, UUID); try
{
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
LocalId, string.Format("{0}/{1}", Name, UUID),
string.Format("{0}/{1}", Name, UUID), Shape,
Shape, AbsolutePosition,
AbsolutePosition, Scale,
Scale, RotationOffset,
RotationOffset, RigidBody,
RigidBody); m_localId);
PhysActor.SetMaterial(Material);
}
catch
{
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
PhysActor = null;
}
// Basic Physics returns null.. joy joy joy. // Basic Physics returns null.. joy joy joy.
if (PhysActor != null) if (PhysActor != null)
{ {
@ -1615,19 +1629,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void ClearUndoState()
{
lock (m_undo)
{
m_undo.Clear();
}
lock (m_redo)
{
m_redo.Clear();
}
StoreUndoState();
}
public byte ConvertScriptUintToByte(uint indata) public byte ConvertScriptUintToByte(uint indata)
{ {
byte outdata = (byte)TextureAnimFlags.NONE; byte outdata = (byte)TextureAnimFlags.NONE;
@ -1705,7 +1706,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero)
{ {
m_parentGroup.Scene.AssetService.Get(dupe.m_shape.SculptTexture.ToString(), dupe, AssetReceived); ParentGroup.Scene.AssetService.Get(
dupe.m_shape.SculptTexture.ToString(), dupe, dupe.AssetReceived);
} }
bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0);
@ -1719,14 +1721,20 @@ namespace OpenSim.Region.Framework.Scenes
return dupe; return dupe;
} }
/// <summary>
/// Called back by asynchronous asset fetch.
/// </summary>
/// <param name="id">ID of asset received</param>
/// <param name="sender">Register</param>
/// <param name="asset"></param>
protected void AssetReceived(string id, Object sender, AssetBase asset) protected void AssetReceived(string id, Object sender, AssetBase asset)
{ {
if (asset != null) if (asset != null)
{ SculptTextureCallback(asset);
SceneObjectPart sop = (SceneObjectPart)sender; else
if (sop != null) m_log.WarnFormat(
sop.SculptTextureCallback(asset.FullID, asset); "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data",
} Name, LocalId, id);
} }
public static SceneObjectPart Create() public static SceneObjectPart Create()
@ -1896,7 +1904,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
// mesh data.
if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
CheckSculptAndLoad();
else
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
} }
} }
} }
@ -2823,19 +2836,29 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// Resize this part. /// Set the scale of this part.
/// </summary> /// </summary>
/// <remarks>
/// Unlike the scale property, this checks the new size against scene limits and schedules a full property
/// update to viewers.
/// </remarks>
/// <param name="scale"></param> /// <param name="scale"></param>
public void Resize(Vector3 scale) public void Resize(Vector3 scale)
{ {
StoreUndoState(); scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys);
m_shape.Scale = scale; scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
// If we're a mesh/sculpt, then we need to tell the physics engine about our new size. To do this, we if (PhysActor != null && PhysActor.IsPhysical)
// need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to {
// save memory scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
if (PhysActor != null) scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
CheckSculptAndLoad(); scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
}
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
Scale = scale;
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate(); ScheduleFullUpdate();
@ -2965,7 +2988,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void SculptTextureCallback(UUID textureID, AssetBase texture) /// <summary>
/// Set sculpt and mesh data, and tell the physics engine to process the change.
/// </summary>
/// <param name="texture">The mesh itself.</param>
public void SculptTextureCallback(AssetBase texture)
{ {
if (m_shape.SculptEntry) if (m_shape.SculptEntry)
{ {
@ -2991,16 +3018,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
// /// <summary>
// ///
// /// </summary>
// /// <param name="remoteClient"></param>
// public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
// {
// m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags);
// }
/// <summary> /// <summary>
/// Send a full update to the client for the given part /// Send a full update to the client for the given part
/// </summary> /// </summary>
@ -3647,6 +3664,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
public void StoreUndoState() public void StoreUndoState()
{
StoreUndoState(false);
}
public void StoreUndoState(bool forGroup)
{ {
if (!Undoing) if (!Undoing)
{ {
@ -3661,21 +3683,135 @@ namespace OpenSim.Region.Framework.Scenes
UndoState last = m_undo.Peek(); UndoState last = m_undo.Peek();
if (last != null) if (last != null)
{ {
// TODO: May need to fix for group comparison
if (last.Compare(this)) if (last.Compare(this))
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
// Name, LocalId, m_undo.Count);
return; return;
}
} }
} }
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
// Name, LocalId, forGroup, m_undo.Count);
if (m_parentGroup.GetSceneMaxUndo() > 0) if (m_parentGroup.GetSceneMaxUndo() > 0)
{ {
UndoState nUndo = new UndoState(this); UndoState nUndo = new UndoState(this, forGroup);
m_undo.Push(nUndo); m_undo.Push(nUndo);
}
if (m_redo.Count > 0)
m_redo.Clear();
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
// Name, LocalId, forGroup, m_undo.Count);
}
} }
} }
} }
// else
// {
// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId);
// }
}
// else
// {
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
// }
}
/// <summary>
/// Return number of undos on the stack. Here temporarily pending a refactor.
/// </summary>
public int UndoCount
{
get
{
lock (m_undo)
return m_undo.Count;
}
}
public void Undo()
{
lock (m_undo)
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}",
// Name, LocalId, m_undo.Count);
if (m_undo.Count > 0)
{
UndoState goback = m_undo.Pop();
if (goback != null)
{
UndoState nUndo = null;
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
nUndo = new UndoState(this, goback.ForGroup);
}
goback.PlaybackState(this);
if (nUndo != null)
m_redo.Push(nUndo);
}
}
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}",
// Name, LocalId, m_undo.Count);
}
}
public void Redo()
{
lock (m_undo)
{
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}",
// Name, LocalId, m_redo.Count);
if (m_redo.Count > 0)
{
UndoState gofwd = m_redo.Pop();
if (gofwd != null)
{
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState(this, gofwd.ForGroup);
m_undo.Push(nUndo);
}
gofwd.PlayfwdState(this);
}
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
// Name, LocalId, m_redo.Count);
}
}
}
public void ClearUndoState()
{
// m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId);
lock (m_undo)
{
m_undo.Clear();
m_redo.Clear();
} }
} }
@ -4139,44 +4275,6 @@ namespace OpenSim.Region.Framework.Scenes
_nextOwnerMask &= (uint)PermissionMask.All; _nextOwnerMask &= (uint)PermissionMask.All;
} }
public void Undo()
{
lock (m_undo)
{
if (m_undo.Count > 0)
{
UndoState nUndo = null;
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
nUndo = new UndoState(this);
}
UndoState goback = m_undo.Pop();
if (goback != null)
{
goback.PlaybackState(this);
if (nUndo != null)
m_redo.Push(nUndo);
}
}
}
}
public void Redo()
{
lock (m_redo)
{
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState(this);
m_undo.Push(nUndo);
}
UndoState gofwd = m_redo.Pop();
if (gofwd != null)
gofwd.PlayfwdState(this);
}
}
public void UpdateExtraParam(ushort type, bool inUse, byte[] data) public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
{ {
m_shape.ReadInUpdateExtraParam(type, inUse, data); m_shape.ReadInUpdateExtraParam(type, inUse, data);
@ -4435,13 +4533,14 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// It's not phantom anymore. So make sure the physics engine get's knowledge of it // It's not phantom anymore. So make sure the physics engine get's knowledge of it
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
LocalId,
string.Format("{0}/{1}", Name, UUID), string.Format("{0}/{1}", Name, UUID),
Shape, Shape,
AbsolutePosition, AbsolutePosition,
Scale, Scale,
RotationOffset, RotationOffset,
UsePhysics); UsePhysics,
m_localId);
PhysActor.SetMaterial(Material);
pa = PhysActor; pa = PhysActor;
if (pa != null) if (pa != null)
@ -4600,7 +4699,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks> /// </remarks>
public void CheckSculptAndLoad() public void CheckSculptAndLoad()
{ {
// m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); // m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
if (ParentGroup.IsDeleted) if (ParentGroup.IsDeleted)
return; return;
@ -4611,9 +4710,11 @@ namespace OpenSim.Region.Framework.Scenes
if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero) if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero)
{ {
// check if a previously decoded sculpt map has been cached // check if a previously decoded sculpt map has been cached
// We don't read the file here - the meshmerizer will do that later.
// TODO: Could we simplify the meshmerizer code by reading and setting the data here?
if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString()))) if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString())))
{ {
SculptTextureCallback(Shape.SculptTexture, null); SculptTextureCallback(null);
} }
else else
{ {

View File

@ -102,7 +102,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
sceneObject.AddPart(part); sceneObject.AddPart(part);
part.LinkNum = linkNum; part.LinkNum = linkNum;
part.TrimPermissions(); part.TrimPermissions();
part.StoreUndoState();
reader.Close(); reader.Close();
sr.Close(); sr.Close();
} }
@ -236,15 +235,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (originalLinkNum != 0) if (originalLinkNum != 0)
part.LinkNum = originalLinkNum; part.LinkNum = originalLinkNum;
part.StoreUndoState();
reader.Close(); reader.Close();
sr.Close(); sr.Close();
} }
// Script state may, or may not, exist. Not having any, is NOT // Script state may, or may not, exist. Not having any, is NOT
// ever a problem. // ever a problem.
sceneObject.LoadScriptState(doc); sceneObject.LoadScriptState(doc);
return sceneObject; return sceneObject;
} }
catch (Exception e) catch (Exception e)

View File

@ -0,0 +1,104 @@
/*
* 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.Reflection;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.Framework.Scenes.Tests
{
/// <summary>
/// Basic scene object resize tests
/// </summary>
[TestFixture]
public class SceneObjectResizeTests
{
/// <summary>
/// Test resizing an object
/// </summary>
[Test]
public void TestResizeSceneObject()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup;
g1.GroupResize(new Vector3(2, 3, 4));
SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);
Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1));
}
/// <summary>
/// Test resizing an individual part in a scene object.
/// </summary>
[Test]
public void TestResizeSceneObjectPart()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
SceneObjectGroup g1 = SceneSetupHelpers.CreateSceneObject(2, UUID.Zero);
g1.RootPart.Scale = new Vector3(2, 3, 4);
g1.Parts[1].Scale = new Vector3(5, 6, 7);
scene.AddSceneObject(g1);
SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);
g1Post.Parts[1].Resize(new Vector3(8, 9, 10));
SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID);
SceneObjectPart g1RootPart = g1PostPost.RootPart;
SceneObjectPart g1ChildPart = g1PostPost.Parts[1];
Assert.That(g1RootPart.Scale.X, Is.EqualTo(2));
Assert.That(g1RootPart.Scale.Y, Is.EqualTo(3));
Assert.That(g1RootPart.Scale.Z, Is.EqualTo(4));
Assert.That(g1ChildPart.Scale.X, Is.EqualTo(8));
Assert.That(g1ChildPart.Scale.Y, Is.EqualTo(9));
Assert.That(g1ChildPart.Scale.Z, Is.EqualTo(10));
}
}
}

View File

@ -25,6 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Reflection;
using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -32,110 +35,199 @@ namespace OpenSim.Region.Framework.Scenes
{ {
public class UndoState public class UndoState
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Vector3 Position = Vector3.Zero; public Vector3 Position = Vector3.Zero;
public Vector3 Scale = Vector3.Zero; public Vector3 Scale = Vector3.Zero;
public Quaternion Rotation = Quaternion.Identity; public Quaternion Rotation = Quaternion.Identity;
public UndoState(SceneObjectPart part) /// <summary>
/// Is this undo state for an entire group?
/// </summary>
public bool ForGroup;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="part"></param>
/// <param name="forGroup">True if the undo is for an entire group</param>
public UndoState(SceneObjectPart part, bool forGroup)
{ {
if (part != null) if (part.ParentID == 0)
{ {
if (part.ParentID == 0) ForGroup = forGroup;
{
// if (ForGroup)
Position = part.ParentGroup.AbsolutePosition; Position = part.ParentGroup.AbsolutePosition;
Rotation = part.RotationOffset; // else
Scale = part.Shape.Scale; // Position = part.OffsetPosition;
}
else // m_log.DebugFormat(
{ // "[UNDO STATE]: Storing undo position {0} for root part", Position);
Position = part.OffsetPosition;
Rotation = part.RotationOffset; Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
} // m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation);
Scale = part.Shape.Scale;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for root part", Scale);
}
else
{
Position = part.OffsetPosition;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo position {0} for child part", Position);
Rotation = part.RotationOffset;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation);
Scale = part.Shape.Scale;
// m_log.DebugFormat(
// "[UNDO STATE]: Storing undo scale {0} for child part", Scale);
} }
} }
/// <summary>
/// Compare the relevant state in the given part to this state.
/// </summary>
/// <param name="part"></param>
/// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns>
public bool Compare(SceneObjectPart part) public bool Compare(SceneObjectPart part)
{ {
if (part != null) if (part != null)
{ {
if (part.ParentID == 0) if (part.ParentID == 0)
{ return
if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation) Position == part.ParentGroup.AbsolutePosition
return true; && Rotation == part.RotationOffset
else && Scale == part.Shape.Scale;
return false;
}
else else
{ return
if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale) Position == part.OffsetPosition
return true; && Rotation == part.RotationOffset
else && Scale == part.Shape.Scale;
return false;
}
} }
return false; return false;
} }
public void PlaybackState(SceneObjectPart part) public void PlaybackState(SceneObjectPart part)
{ {
if (part != null) part.Undoing = true;
if (part.ParentID == 0)
{ {
part.Undoing = true; // m_log.DebugFormat(
// "[UNDO STATE]: Undoing position to {0} for root part {1} {2}",
// Position, part.Name, part.LocalId);
if (part.ParentID == 0) if (Position != Vector3.Zero)
{ {
if (Position != Vector3.Zero) if (ForGroup)
part.ParentGroup.AbsolutePosition = Position; part.ParentGroup.AbsolutePosition = Position;
part.RotationOffset = Rotation; else
if (Scale != Vector3.Zero) part.ParentGroup.UpdateRootPosition(Position);
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate();
} }
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale); part.ScheduleTerseUpdate();
}
part.Undoing = false;
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId);
if (ForGroup)
part.UpdateRotation(Rotation);
else
part.ParentGroup.UpdateRootRotation(Rotation);
if (Scale != Vector3.Zero)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId);
if (ForGroup)
part.ParentGroup.GroupResize(Scale);
else
part.Resize(Scale);
}
part.ParentGroup.ScheduleGroupForTerseUpdate();
} }
else
{
if (Position != Vector3.Zero)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}",
// part.OffsetPosition, Position, part.Name, part.LocalId);
part.OffsetPosition = Position;
}
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}",
// part.RotationOffset, Rotation, part.Name, part.LocalId);
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
{
// m_log.DebugFormat(
// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}",
// part.Shape.Scale, Scale, part.Name, part.LocalId);
part.Resize(Scale);
}
part.ScheduleTerseUpdate();
}
part.Undoing = false;
} }
public void PlayfwdState(SceneObjectPart part) public void PlayfwdState(SceneObjectPart part)
{ {
if (part != null) part.Undoing = true;
if (part.ParentID == 0)
{ {
part.Undoing = true; if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
if (part.ParentID == 0) if (Rotation != Quaternion.Identity)
{ part.UpdateRotation(Rotation);
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate();
}
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ScheduleTerseUpdate();
}
part.Undoing = false;
if (Scale != Vector3.Zero)
{
if (ForGroup)
part.ParentGroup.GroupResize(Scale);
else
part.Resize(Scale);
}
part.ParentGroup.ScheduleGroupForTerseUpdate();
} }
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ScheduleTerseUpdate();
}
part.Undoing = false;
} }
} }
public class LandUndoState public class LandUndoState
{ {
public ITerrainModule m_terrainModule; public ITerrainModule m_terrainModule;
@ -149,10 +241,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool Compare(ITerrainChannel terrainChannel) public bool Compare(ITerrainChannel terrainChannel)
{ {
if (m_terrainChannel != terrainChannel) return m_terrainChannel == terrainChannel;
return false;
else
return false;
} }
public void PlaybackState() public void PlaybackState()

View File

@ -0,0 +1,119 @@
/*
* 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.Reflection;
using System.Text;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Framework.Monitoring
{
/// <summary>
/// An experimental module to return data on services used by the simulator.
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MonitorServicesModule")]
public class MonitorServicesModule : ISharedRegionModule
{
protected Scene m_scene;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string Name { get { return "Services Health Monitoring Module"; } }
public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source)
{
}
public void PostInitialise()
{
}
public void Close()
{
}
public void AddRegion(Scene scene)
{
if (m_scene == null)
{
m_scene = scene;
// m_scene.AddCommand(this, "monitor services",
// "monitor services",
// "Returns the status of services used by the simulator. Experimental.",
// HandleMonitorServices);
}
}
public void RemoveRegion(Scene scene)
{
}
public void RegionLoaded(Scene scene)
{
}
protected void HandleMonitorServices(string module, string[] args)
{
MainConsole.Instance.Output(GenerateServicesReport());
}
protected string GenerateServicesReport()
{
StringBuilder sb = new StringBuilder();
sb.Append("This is an experimental module. Please don't rely on these results\n");
sb.Append("Asset service: ");
try
{
CheckAssetService();
sb.Append("OK");
}
catch (Exception e)
{
sb.AppendFormat("FAIL ({0})", e.Message);
}
return sb.ToString();
}
protected void CheckAssetService()
{
// Try to fetch an asset that will not exist (and hence avoid hitting cache)
m_scene.AssetService.Get(UUID.Random().ToString());
}
}
}

View File

@ -106,7 +106,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
info.channel = channel; info.channel = channel;
info.uri = uri; info.uri = uri;
bool success = SynchronousRestObjectPoster.BeginPostObject<XmlRpcInfo, bool>( bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>(
"POST", m_ServerURI+"/RegisterChannel/", info); "POST", m_ServerURI+"/RegisterChannel/", info);
if (!success) if (!success)
@ -125,7 +125,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
if (m_Channels.ContainsKey(itemID)) if (m_Channels.ContainsKey(itemID))
{ {
bool success = SynchronousRestObjectPoster.BeginPostObject<UUID, bool>( bool success = SynchronousRestObjectRequester.MakeRequest<UUID, bool>(
"POST", m_ServerURI+"/RemoveChannel/", m_Channels[itemID]); "POST", m_ServerURI+"/RemoveChannel/", m_Channels[itemID]);
if (!success) if (!success)

View File

@ -84,13 +84,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
*/ */
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
return null; return null;
} }

View File

@ -213,12 +213,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
return newPrim; return newPrim;
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation) public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical)
{ {
PhysicsActor result; PhysicsActor result;
IMesh mesh = null; IMesh mesh = null;

View File

@ -626,13 +626,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation) OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical)
{ {
PhysicsActor result; PhysicsActor result;

View File

@ -37,6 +37,18 @@ namespace OpenSim.Region.Physics.Manager
public delegate void physicsCrash(); public delegate void physicsCrash();
public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal);
public delegate void RayCallback(List<ContactResult> list);
/// <summary>
/// Contact result from a raycast.
/// </summary>
public struct ContactResult
{
public Vector3 Pos;
public float Depth;
public uint ConsumerID;
public Vector3 Normal;
}
public abstract class PhysicsScene public abstract class PhysicsScene
{ {
@ -61,7 +73,6 @@ namespace OpenSim.Region.Physics.Manager
} }
} }
public abstract void Initialise(IMesher meshmerizer, IConfigSource config); public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying);
@ -78,20 +89,7 @@ namespace OpenSim.Region.Physics.Manager
public abstract void RemovePrim(PhysicsActor prim); public abstract void RemovePrim(PhysicsActor prim);
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation); //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical);
public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{
PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical);
if (ret != null)
ret.LocalID = localID;
return ret;
}
public virtual float TimeDilation public virtual float TimeDilation
{ {
@ -225,6 +223,17 @@ namespace OpenSim.Region.Physics.Manager
retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero);
} }
public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod)
{
if (retMethod != null)
retMethod(new List<ContactResult>());
}
public virtual List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count)
{
return new List<ContactResult>();
}
private class NullPhysicsScene : PhysicsScene private class NullPhysicsScene : PhysicsScene
{ {
private static int m_workIndicator; private static int m_workIndicator;
@ -262,13 +271,7 @@ namespace OpenSim.Region.Physics.Manager
*/ */
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
return PhysicsActor.Null; return PhysicsActor.Null;

View File

@ -303,6 +303,10 @@ namespace OpenSim.Region.Physics.Meshing
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod) private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{ {
// m_log.DebugFormat(
// "[MESH]: Creating physics proxy for {0}, shape {1}",
// primName, (OpenMetaverse.SculptType)primShape.SculptType);
PrimMesh primMesh; PrimMesh primMesh;
PrimMesher.SculptMesh sculptMesh; PrimMesher.SculptMesh sculptMesh;
@ -668,7 +672,6 @@ namespace OpenSim.Region.Physics.Meshing
// If this mesh has been created already, return it instead of creating another copy // If this mesh has been created already, return it instead of creating another copy
// For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
key = GetMeshKey(primShape, size, lod); key = GetMeshKey(primShape, size, lod);
if (m_uniqueMeshes.TryGetValue(key, out mesh)) if (m_uniqueMeshes.TryGetValue(key, out mesh))
return mesh; return mesh;

View File

@ -638,7 +638,7 @@ namespace OpenSim.Region.Physics.OdePlugin
float profileEnd; float profileEnd;
if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible) if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible)
{ {
taperX1 = _pbs.PathScaleX * 0.01f; taperX1 = _pbs.PathScaleX * 0.01f;
if (taperX1 > 1.0f) if (taperX1 > 1.0f)
taperX1 = 2.0f - taperX1; taperX1 = 2.0f - taperX1;
@ -648,9 +648,9 @@ namespace OpenSim.Region.Physics.OdePlugin
if (taperY1 > 1.0f) if (taperY1 > 1.0f)
taperY1 = 2.0f - taperY1; taperY1 = 2.0f - taperY1;
taperY = 1.0f - taperY1; taperY = 1.0f - taperY1;
} }
else else
{ {
taperX = _pbs.PathTaperX * 0.01f; taperX = _pbs.PathTaperX * 0.01f;
if (taperX < 0.0f) if (taperX < 0.0f)
taperX = -taperX; taperX = -taperX;
@ -660,9 +660,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (taperY < 0.0f) if (taperY < 0.0f)
taperY = -taperY; taperY = -taperY;
taperY1 = 1.0f - taperY; taperY1 = 1.0f - taperY;
}
}
volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY); volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY);
@ -846,7 +844,6 @@ namespace OpenSim.Region.Physics.OdePlugin
return; return;
} }
// if (IsPhysical && Body == (IntPtr) 0) // if (IsPhysical && Body == (IntPtr) 0)
// { // {
// Recreate the body // Recreate the body
@ -859,7 +856,9 @@ namespace OpenSim.Region.Physics.OdePlugin
public void ProcessTaints(float timestep) public void ProcessTaints(float timestep)
{ {
//Console.WriteLine("ProcessTaints for " + Name); #if SPAM
Console.WriteLine("ZProcessTaints for " + Name);
#endif
if (m_taintadd) if (m_taintadd)
{ {
changeadd(timestep); changeadd(timestep);
@ -1323,7 +1322,9 @@ namespace OpenSim.Region.Physics.OdePlugin
public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
{ {
//Console.WriteLine("CreateGeom:"); #if SPAM
Console.WriteLine("CreateGeom:");
#endif
if (_mesh != null) if (_mesh != null)
{ {
setMesh(_parent_scene, _mesh); setMesh(_parent_scene, _mesh);
@ -1944,7 +1945,6 @@ Console.WriteLine(" JointCreateFixed");
if (_parent_scene.needsMeshing(_pbs)) if (_parent_scene.needsMeshing(_pbs))
mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
//IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
#if SPAM #if SPAM
Console.WriteLine("changesize 1"); Console.WriteLine("changesize 1");
#endif #endif
@ -2056,8 +2056,8 @@ Console.WriteLine("changesize 2");
if (IsPhysical) if (IsPhysical)
meshlod = _parent_scene.MeshSculptphysicalLOD; meshlod = _parent_scene.MeshSculptphysicalLOD;
IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
// createmesh returns null when it doesn't mesh. // createmesh returns null when it doesn't mesh.
IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
#if SPAM #if SPAM
Console.WriteLine("changeshape needed meshing"); Console.WriteLine("changeshape needed meshing");
#endif #endif
@ -2284,6 +2284,7 @@ Console.WriteLine("changeshape not need meshing");
if (value.IsFinite()) if (value.IsFinite())
{ {
_size = value; _size = value;
// m_log.DebugFormat("[PHYSICS]: Set size on {0} to {1}", Name, value);
} }
else else
{ {

View File

@ -45,10 +45,15 @@ namespace OpenSim.Region.Physics.OdePlugin
public class ODERayCastRequestManager public class ODERayCastRequestManager
{ {
/// <summary> /// <summary>
/// Pending Raycast Requests /// Pending raycast requests
/// </summary> /// </summary>
protected List<ODERayCastRequest> m_PendingRequests = new List<ODERayCastRequest>(); protected List<ODERayCastRequest> m_PendingRequests = new List<ODERayCastRequest>();
/// <summary>
/// Pending ray requests
/// </summary>
protected List<ODERayRequest> m_PendingRayRequests = new List<ODERayRequest>();
/// <summary> /// <summary>
/// Scene that created this object. /// Scene that created this object.
/// </summary> /// </summary>
@ -95,6 +100,29 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
/// <summary>
/// Queues a raycast
/// </summary>
/// <param name="position">Origin of Ray</param>
/// <param name="direction">Ray normal</param>
/// <param name="length">Ray length</param>
/// <param name="count"></param>
/// <param name="retMethod">Return method to send the results</param>
public void QueueRequest(Vector3 position, Vector3 direction, float length, int count, RayCallback retMethod)
{
lock (m_PendingRequests)
{
ODERayRequest req = new ODERayRequest();
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
req.Origin = position;
req.Count = count;
m_PendingRayRequests.Add(req);
}
}
/// <summary> /// <summary>
/// Process all queued raycast requests /// Process all queued raycast requests
/// </summary> /// </summary>
@ -112,18 +140,26 @@ namespace OpenSim.Region.Physics.OdePlugin
if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast
RayCast(reqs[i]); // if there isn't anyone to send results RayCast(reqs[i]); // if there isn't anyone to send results
} }
/*
foreach (ODERayCastRequest req in m_PendingRequests)
{
if (req.callbackMethod != null) // quick optimization here, don't raycast
RayCast(req); // if there isn't anyone to send results to
}
*/
m_PendingRequests.Clear(); m_PendingRequests.Clear();
} }
} }
lock (m_PendingRayRequests)
{
if (m_PendingRayRequests.Count > 0)
{
ODERayRequest[] reqs = m_PendingRayRequests.ToArray();
for (int i = 0; i < reqs.Length; i++)
{
if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast
RayCast(reqs[i]); // if there isn't anyone to send results
}
m_PendingRayRequests.Clear();
}
}
lock (m_contactResults) lock (m_contactResults)
m_contactResults.Clear(); m_contactResults.Clear();
@ -146,7 +182,6 @@ namespace OpenSim.Region.Physics.OdePlugin
// Remove Ray // Remove Ray
d.GeomDestroy(ray); d.GeomDestroy(ray);
// Define default results // Define default results
bool hitYN = false; bool hitYN = false;
uint hitConsumerID = 0; uint hitConsumerID = 0;
@ -177,6 +212,31 @@ namespace OpenSim.Region.Physics.OdePlugin
req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal); req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal);
} }
/// <summary>
/// Method that actually initiates the raycast
/// </summary>
/// <param name="req"></param>
private void RayCast(ODERayRequest req)
{
// Create the ray
IntPtr ray = d.CreateRay(m_scene.space, req.length);
d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
// Collide test
d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
// Remove Ray
d.GeomDestroy(ray);
// Find closest contact and object.
lock (m_contactResults)
{
// Return results
if (req.callbackMethod != null)
req.callbackMethod(m_contactResults);
}
}
// This is the standard Near. Uses space AABBs to speed up detection. // This is the standard Near. Uses space AABBs to speed up detection.
private void near(IntPtr space, IntPtr g1, IntPtr g2) private void near(IntPtr space, IntPtr g1, IntPtr g2)
{ {
@ -342,10 +402,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_contactResults.Add(collisionresult); m_contactResults.Add(collisionresult);
} }
} }
} }
} }
/// <summary> /// <summary>
@ -365,11 +422,12 @@ namespace OpenSim.Region.Physics.OdePlugin
public RaycastCallback callbackMethod; public RaycastCallback callbackMethod;
} }
public struct ContactResult public struct ODERayRequest
{ {
public Vector3 Pos; public Vector3 Origin;
public float Depth;
public uint ConsumerID;
public Vector3 Normal; public Vector3 Normal;
public int Count;
public float length;
public RayCallback callbackMethod;
} }
} }

View File

@ -1677,7 +1677,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, uint localID)
{ {
Vector3 pos = position; Vector3 pos = position;
Vector3 siz = size; Vector3 siz = size;
@ -1691,7 +1691,7 @@ namespace OpenSim.Region.Physics.OdePlugin
lock (_prims) lock (_prims)
_prims.Add(newPrim); _prims.Add(newPrim);
} }
newPrim.LocalID = localID;
return newPrim; return newPrim;
} }
@ -1708,13 +1708,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
#if SPAM #if SPAM
m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName); m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName);
@ -1723,22 +1717,23 @@ namespace OpenSim.Region.Physics.OdePlugin
PhysicsActor result; PhysicsActor result;
IMesh mesh = null; IMesh mesh = null;
if (needsMeshing(pbs)) // Don't create the mesh here - wait until the mesh data is loaded from the asset store.
{ // if (needsMeshing(pbs))
try // {
{ // try
mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); // {
} // mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical);
catch(Exception e) // }
{ // catch(Exception e)
m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); // {
m_log.Debug(e.ToString()); // m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName);
mesh = null; // m_log.Debug(e.ToString());
return null; // mesh = null;
} // return null;
} // }
// }
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, localid);
return result; return result;
} }
@ -2590,7 +2585,9 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (!(_taintedPrimH.Contains(taintedprim))) if (!(_taintedPrimH.Contains(taintedprim)))
{ {
//Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); #if SPAM
Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
#endif
_taintedPrimH.Add(taintedprim); // HashSet for searching _taintedPrimH.Add(taintedprim); // HashSet for searching
_taintedPrimL.Add(taintedprim); // List for ordered readout _taintedPrimL.Add(taintedprim); // List for ordered readout
} }
@ -3733,6 +3730,34 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
public override void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod)
{
if (retMethod != null)
{
m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod);
}
}
public override List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count)
{
ContactResult[] ourResults = null;
RayCallback retMethod = delegate(List<ContactResult> results)
{
ourResults = new ContactResult[results.Count];
results.CopyTo(ourResults, 0);
};
int waitTime = 0;
m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod);
while (ourResults == null && waitTime < 1000)
{
Thread.Sleep(1);
waitTime++;
}
if (ourResults == null)
return new List<ContactResult> ();
return new List<ContactResult>(ourResults);
}
#if USE_DRAWSTUFF #if USE_DRAWSTUFF
// Keyboard callback // Keyboard callback
public void command(int cmd) public void command(int cmd)

View File

@ -31,17 +31,18 @@ using NUnit.Framework;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Physics.OdePlugin;
using log4net; using log4net;
using System.Reflection; using System.Reflection;
namespace OpenSim.Region.Physics.OdePlugin namespace OpenSim.Region.Physics.OdePlugin.Tests
{ {
[TestFixture] [TestFixture]
public class ODETestClass public class ODETestClass
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private OdePlugin cbt; private OpenSim.Region.Physics.OdePlugin.OdePlugin cbt;
private PhysicsScene ps; private PhysicsScene ps;
private IMeshingPlugin imp; private IMeshingPlugin imp;
@ -83,7 +84,7 @@ namespace OpenSim.Region.Physics.OdePlugin
Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
Quaternion rot = Quaternion.Identity; Quaternion rot = Quaternion.Identity;
PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0);
OdePrim oprim = (OdePrim)prim; OdePrim oprim = (OdePrim)prim;
OdeScene pscene = (OdeScene) ps; OdeScene pscene = (OdeScene) ps;

View File

@ -91,13 +91,7 @@ namespace OpenSim.Region.Physics.POSPlugin
*/ */
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
POSPrim prim = new POSPrim(); POSPrim prim = new POSPrim();
prim.Position = position; prim.Position = position;

View File

@ -108,13 +108,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
} }
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation) //To be removed Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, false);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{ {
return AddPrim(position, size, rotation); return AddPrim(position, size, rotation);
} }

View File

@ -2214,7 +2214,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetVel() public LSL_Vector llGetVel()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return new LSL_Vector(m_host.Velocity.X, m_host.Velocity.Y, m_host.Velocity.Z);
Vector3 vel;
if (m_host.IsAttachment)
{
ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.AttachedAvatar);
vel = avatar.Velocity;
}
else
{
vel = m_host.Velocity;
}
return new LSL_Vector(vel.X, vel.Y, vel.Z);
} }
public LSL_Vector llGetAccel() public LSL_Vector llGetAccel()
@ -2510,10 +2523,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// negative (indicating end-relative) and may be inverted, /// negative (indicating end-relative) and may be inverted,
/// i.e. end < start. /// i.e. end < start.
/// </summary> /// </summary>
public LSL_String llDeleteSubString(string src, int start, int end) public LSL_String llDeleteSubString(string src, int start, int end)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Normalize indices (if negative). // Normalize indices (if negative).
@ -2593,10 +2604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// which case it is end-relative. The index may exceed either /// which case it is end-relative. The index may exceed either
/// string bound, with the result being a concatenation. /// string bound, with the result being a concatenation.
/// </summary> /// </summary>
public LSL_String llInsertString(string dest, int index, string src) public LSL_String llInsertString(string dest, int index, string src)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Normalize indices (if negative). // Normalize indices (if negative).
@ -9983,6 +9992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetObjectDetails(string id, LSL_List args) public LSL_List llGetObjectDetails(string id, LSL_List args)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LSL_List ret = new LSL_List(); LSL_List ret = new LSL_List();
UUID key = new UUID(); UUID key = new UUID();
if (UUID.TryParse(id, out key)) if (UUID.TryParse(id, out key))
@ -9993,72 +10003,76 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
foreach (object o in args.Data) foreach (object o in args.Data)
{ {
switch (o.ToString()) switch (int.Parse(o.ToString()))
{ {
case "1": case ScriptBaseClass.OBJECT_NAME:
ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); ret.Add(new LSL_String(av.Firstname + " " + av.Lastname));
break; break;
case "2": case ScriptBaseClass.OBJECT_DESC:
ret.Add(new LSL_String("")); ret.Add(new LSL_String(""));
break; break;
case "3": case ScriptBaseClass.OBJECT_POS:
ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
break; break;
case "4": case ScriptBaseClass.OBJECT_ROT:
ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W));
break; break;
case "5": case ScriptBaseClass.OBJECT_VELOCITY:
ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
break; break;
case "6": case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(id)); ret.Add(new LSL_String(id));
break; break;
case "7": case ScriptBaseClass.OBJECT_GROUP:
ret.Add(new LSL_String(UUID.Zero.ToString())); ret.Add(new LSL_String(UUID.Zero.ToString()));
break; break;
case "8": case ScriptBaseClass.OBJECT_CREATOR:
ret.Add(new LSL_String(UUID.Zero.ToString())); ret.Add(new LSL_String(UUID.Zero.ToString()));
break; break;
} }
} }
return ret; return ret;
} }
SceneObjectPart obj = World.GetSceneObjectPart(key); SceneObjectPart obj = World.GetSceneObjectPart(key);
if (obj != null) if (obj != null)
{ {
foreach (object o in args.Data) foreach (object o in args.Data)
{ {
switch (o.ToString()) switch (int.Parse(o.ToString()))
{ {
case "1": case ScriptBaseClass.OBJECT_NAME:
ret.Add(new LSL_String(obj.Name)); ret.Add(new LSL_String(obj.Name));
break; break;
case "2": case ScriptBaseClass.OBJECT_DESC:
ret.Add(new LSL_String(obj.Description)); ret.Add(new LSL_String(obj.Description));
break; break;
case "3": case ScriptBaseClass.OBJECT_POS:
ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z));
break; break;
case "4": case ScriptBaseClass.OBJECT_ROT:
ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W));
break; break;
case "5": case ScriptBaseClass.OBJECT_VELOCITY:
ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z));
break; break;
case "6": case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(obj.OwnerID.ToString())); ret.Add(new LSL_String(obj.OwnerID.ToString()));
break; break;
case "7": case ScriptBaseClass.OBJECT_GROUP:
ret.Add(new LSL_String(obj.GroupID.ToString())); ret.Add(new LSL_String(obj.GroupID.ToString()));
break; break;
case "8": case ScriptBaseClass.OBJECT_CREATOR:
ret.Add(new LSL_String(obj.CreatorID.ToString())); ret.Add(new LSL_String(obj.CreatorID.ToString()));
break; break;
} }
} }
return ret; return ret;
} }
} }
return new LSL_List(); return new LSL_List();
} }
@ -10309,51 +10323,191 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return rq.ToString(); return rq.ToString();
} }
public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
{
m_host.AddScriptLPS(1);
Vector3 dir = new Vector3((float)(end-start).x, (float)(end-start).y, (float)(end-start).z);
Vector3 startvector = new Vector3((float)start.x, (float)start.y, (float)start.z);
Vector3 endvector = new Vector3((float)end.x, (float)end.y, (float)end.z);
int count = 0;
// int detectPhantom = 0;
int dataFlags = 0;
int rejectTypes = 0;
for (int i = 0; i < options.Length; i += 2)
{
if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
{
count = options.GetLSLIntegerItem(i + 1);
}
// else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
// {
// detectPhantom = options.GetLSLIntegerItem(i + 1);
// }
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS)
{
dataFlags = options.GetLSLIntegerItem(i + 1);
}
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
{
rejectTypes = options.GetLSLIntegerItem(i + 1);
}
}
LSL_List list = new LSL_List();
List<ContactResult> results = World.PhysicsScene.RaycastWorld(startvector, dir, dir.Length(), count);
double distance = Util.GetDistanceTo(startvector, endvector);
if (distance == 0)
distance = 0.001;
Vector3 posToCheck = startvector;
ITerrainChannel channel = World.RequestModuleInterface<ITerrainChannel>();
bool checkTerrain = !((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) == ScriptBaseClass.RC_REJECT_LAND);
bool checkAgents = !((rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) == ScriptBaseClass.RC_REJECT_AGENTS);
bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL);
bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
for (float i = 0; i <= distance; i += 0.1f)
{
posToCheck = startvector + (dir * (i / (float)distance));
if (checkTerrain && channel[(int)(posToCheck.X + startvector.X), (int)(posToCheck.Y + startvector.Y)] < posToCheck.Z)
{
ContactResult result = new ContactResult();
result.ConsumerID = 0;
result.Depth = 0;
result.Normal = Vector3.Zero;
result.Pos = posToCheck;
results.Add(result);
checkTerrain = false;
}
if (checkAgents)
{
World.ForEachScenePresence(delegate(ScenePresence sp)
{
if (sp.AbsolutePosition.ApproxEquals(posToCheck, sp.PhysicsActor.Size.X))
{
ContactResult result = new ContactResult ();
result.ConsumerID = sp.LocalId;
result.Depth = 0;
result.Normal = Vector3.Zero;
result.Pos = posToCheck;
results.Add(result);
}
});
}
}
int refcount = 0;
foreach (ContactResult result in results)
{
if ((rejectTypes & ScriptBaseClass.RC_REJECT_LAND)
== ScriptBaseClass.RC_REJECT_LAND && result.ConsumerID == 0)
continue;
ISceneEntity entity = World.GetSceneObjectPart(result.ConsumerID);
if (entity == null && (rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) != ScriptBaseClass.RC_REJECT_AGENTS)
entity = World.GetScenePresence(result.ConsumerID); //Only check if we should be looking for agents
if (entity == null)
{
list.Add(UUID.Zero);
if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM)
list.Add(0);
list.Add(result.Pos);
if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL)
list.Add(result.Normal);
continue; //Can't find it, so add UUID.Zero
}
/*if (detectPhantom == 0 && intersection.obj is ISceneChildEntity &&
((ISceneChildEntity)intersection.obj).PhysActor == null)
continue;*/ //Can't do this ATM, physics engine knows only of non phantom objects
if (entity is SceneObjectPart)
{
if (((SceneObjectPart)entity).PhysActor != null && ((SceneObjectPart)entity).PhysActor.IsPhysical)
{
if (!checkPhysical)
continue;
}
else
{
if (!checkNonPhysical)
continue;
}
}
refcount++;
if ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) == ScriptBaseClass.RC_GET_ROOT_KEY && entity is SceneObjectPart)
list.Add(((SceneObjectPart)entity).ParentGroup.UUID);
else
list.Add(entity.UUID);
if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM)
{
if (entity is SceneObjectPart)
list.Add(((SceneObjectPart)entity).LinkNum);
else
list.Add(0);
}
list.Add(result.Pos);
if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL)
list.Add(result.Normal);
}
list.Add(refcount); //The status code, either the # of contacts, RCERR_SIM_PERF_LOW, or RCERR_CAST_TIME_EXCEEDED
return list;
}
#region Not Implemented #region Not Implemented
// //
// Listing the unimplemented lsl functions here, please move // Listing the unimplemented lsl functions here, please move
// them from this region as they are completed // them from this region as they are completed
// //
public void llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
{
m_host.AddScriptLPS(1);
NotImplemented("llCastRay");
}
public void llGetEnv(LSL_String name) public void llGetEnv(LSL_String name)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
NotImplemented("llGetEnv"); NotImplemented("llGetEnv");
} }
public void llGetSPMaxMemory() public void llGetSPMaxMemory()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
NotImplemented("llGetSPMaxMemory"); NotImplemented("llGetSPMaxMemory");
} }
public void llGetUsedMemory() public void llGetUsedMemory()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
NotImplemented("llGetUsedMemory"); NotImplemented("llGetUsedMemory");
} }
public void llRegionSayTo( LSL_Key target, LSL_Integer channel, LSL_String msg ) public void llRegionSayTo(LSL_Key target, LSL_Integer channel, LSL_String msg)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
NotImplemented("llRegionSayTo"); NotImplemented("llRegionSayTo");
} }
public void llScriptProfiler( LSL_Integer flags ) public void llScriptProfiler(LSL_Integer flags)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
NotImplemented("llScriptProfiler"); NotImplemented("llScriptProfiler");
} }
public void llSetSoundQueueing(int queue) public void llSetSoundQueueing(int queue)

View File

@ -60,6 +60,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llBase64ToString(string str); LSL_String llBase64ToString(string str);
void llBreakAllLinks(); void llBreakAllLinks();
void llBreakLink(int linknum); void llBreakLink(int linknum);
LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options);
LSL_Integer llCeil(double f); LSL_Integer llCeil(double f);
void llClearCameraParams(); void llClearCameraParams();
LSL_Integer llClearPrimMedia(LSL_Integer face); LSL_Integer llClearPrimMedia(LSL_Integer face);
@ -404,7 +405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llXorBase64StringsCorrect(string str1, string str2); LSL_String llXorBase64StringsCorrect(string str1, string str2);
void print(string str); void print(string str);
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
} }
} }

View File

@ -593,5 +593,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED";
public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED";
public static readonly LSLInteger RC_REJECT_TYPES = 2;
public static readonly LSLInteger RC_DATA_FLAGS = 4;
public static readonly LSLInteger RC_MAX_HITS = 8;
public static readonly LSLInteger RC_DETECT_PHANTOM = 16;
public static readonly LSLInteger RC_REJECT_AGENTS = 2;
public static readonly LSLInteger RC_REJECT_PHYSICAL = 4;
public static readonly LSLInteger RC_REJECT_NONPHYSICAL = 8;
public static readonly LSLInteger RC_REJECT_LAND = 16;
public static readonly LSLInteger RC_GET_NORMAL = 2;
public static readonly LSLInteger RC_GET_ROOT_KEY = 4;
public static readonly LSLInteger RC_GET_LINK_NUM = 8;
public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 1;
} }
} }

View File

@ -244,6 +244,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
} }
// Add the input arguments // Add the input arguments
args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI);
args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
@ -429,7 +430,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("status_notification", paramList); XmlRpcRequest request = new XmlRpcRequest("status_notification", paramList);
string reason = string.Empty; // string reason = string.Empty;
// Send and get reply // Send and get reply
List<UUID> friendsOnline = new List<UUID>(); List<UUID> friendsOnline = new List<UUID>();
@ -438,17 +439,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
response = request.Send(m_ServerURL, 6000); response = request.Send(m_ServerURL, 6000);
} }
catch (Exception e) catch
{ {
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
return friendsOnline; return friendsOnline;
} }
if (response.IsFault) if (response.IsFault)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
reason = "XMLRPC Fault"; // reason = "XMLRPC Fault";
return friendsOnline; return friendsOnline;
} }
@ -460,7 +461,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
if (hash == null) if (hash == null)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
reason = "Internal error 1"; // reason = "Internal error 1";
return friendsOnline; return friendsOnline;
} }
@ -476,10 +477,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
} }
catch (Exception e) catch
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
} }
return friendsOnline; return friendsOnline;
@ -500,7 +501,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_online_friends", paramList); XmlRpcRequest request = new XmlRpcRequest("get_online_friends", paramList);
string reason = string.Empty; // string reason = string.Empty;
// Send and get reply // Send and get reply
List<UUID> online = new List<UUID>(); List<UUID> online = new List<UUID>();
@ -509,17 +510,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
response = request.Send(m_ServerURL, 10000); response = request.Send(m_ServerURL, 10000);
} }
catch (Exception e) catch
{ {
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
return online; return online;
} }
if (response.IsFault) if (response.IsFault)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
reason = "XMLRPC Fault"; // reason = "XMLRPC Fault";
return online; return online;
} }
@ -531,7 +532,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
if (hash == null) if (hash == null)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
reason = "Internal error 1"; // reason = "Internal error 1";
return online; return online;
} }
@ -547,10 +548,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
} }
catch (Exception e) catch
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
} }
return online; return online;
@ -565,7 +566,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList); XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList);
string reason = string.Empty; // string reason = string.Empty;
// Send and get reply // Send and get reply
Dictionary<string, object> serverURLs = new Dictionary<string,object>(); Dictionary<string, object> serverURLs = new Dictionary<string,object>();
@ -574,17 +575,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
response = request.Send(m_ServerURL, 10000); response = request.Send(m_ServerURL, 10000);
} }
catch (Exception e) catch
{ {
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
return serverURLs; return serverURLs;
} }
if (response.IsFault) if (response.IsFault)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
reason = "XMLRPC Fault"; // reason = "XMLRPC Fault";
return serverURLs; return serverURLs;
} }
@ -596,7 +597,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
if (hash == null) if (hash == null)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL); m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
reason = "Internal error 1"; // reason = "Internal error 1";
return serverURLs; return serverURLs;
} }
@ -611,10 +612,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
} }
catch (Exception e) catch
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
} }
return serverURLs; return serverURLs;
@ -629,7 +630,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("locate_user", paramList); XmlRpcRequest request = new XmlRpcRequest("locate_user", paramList);
string reason = string.Empty; // string reason = string.Empty;
// Send and get reply // Send and get reply
string url = string.Empty; string url = string.Empty;
@ -638,17 +639,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
response = request.Send(m_ServerURL, 10000); response = request.Send(m_ServerURL, 10000);
} }
catch (Exception e) catch
{ {
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
return url; return url;
} }
if (response.IsFault) if (response.IsFault)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
reason = "XMLRPC Fault"; // reason = "XMLRPC Fault";
return url; return url;
} }
@ -660,7 +661,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
if (hash == null) if (hash == null)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: LocateUser Got null response from {0}! THIS IS BAAAAD", m_ServerURL); m_log.ErrorFormat("[USER AGENT CONNECTOR]: LocateUser Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
reason = "Internal error 1"; // reason = "Internal error 1";
return url; return url;
} }
@ -669,10 +670,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
url = hash["URL"].ToString(); url = hash["URL"].ToString();
} }
catch (Exception e) catch
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response.");
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
} }
return url; return url;
@ -688,7 +689,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList); XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList);
string reason = string.Empty; // string reason = string.Empty;
// Send and get reply // Send and get reply
string uui = string.Empty; string uui = string.Empty;
@ -697,17 +698,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
response = request.Send(m_ServerURL, 10000); response = request.Send(m_ServerURL, 10000);
} }
catch (Exception e) catch
{ {
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
return uui; return uui;
} }
if (response.IsFault) if (response.IsFault)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
reason = "XMLRPC Fault"; // reason = "XMLRPC Fault";
return uui; return uui;
} }
@ -719,7 +720,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
if (hash == null) if (hash == null)
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
reason = "Internal error 1"; // reason = "Internal error 1";
return uui; return uui;
} }
@ -728,10 +729,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
uui = hash["UUI"].ToString(); uui = hash["UUI"].ToString();
} }
catch (Exception e) catch
{ {
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response.");
reason = "Exception: " + e.Message; // reason = "Exception: " + e.Message;
} }
return uui; return uui;

View File

@ -50,7 +50,6 @@ namespace OpenSim.Services.Connectors
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private string m_ServerURI = String.Empty; private string m_ServerURI = String.Empty;
private IImprovedAssetCache m_Cache = null;
public MapImageServicesConnector() public MapImageServicesConnector()
{ {

View File

@ -326,7 +326,6 @@ namespace OpenSim.Services.HypergridService
// This is recursive!!!!! // This is recursive!!!!!
return TrySendInstantMessage(im, url, false, foreigner); return TrySendInstantMessage(im, url, false, foreigner);
} }
} }
private bool UndeliveredMessage(GridInstantMessage im) private bool UndeliveredMessage(GridInstantMessage im)
@ -335,11 +334,10 @@ namespace OpenSim.Services.HypergridService
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
{ {
m_log.DebugFormat("[HG IM SERVICE]: Message saved"); m_log.DebugFormat("[HG IM SERVICE]: Message saved");
return SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
return SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
"POST", m_RestURL + "/SaveMessage/", im); "POST", m_RestURL + "/SaveMessage/", im);
} }
else else
{ {
return false; return false;

View File

@ -28,19 +28,19 @@
AssetLoaderArgs = "assets/AssetSets.xml" AssetLoaderArgs = "assets/AssetSets.xml"
; ;
; change this to your grid-wide asset server ; Change this to your grid-wide asset server. Do not add a slash to the end of any of these addresses.
; ;
AssetServerURI = "http://myassetserver.com:8003" AssetServerURI = "http://myassetserver.com:8003"
[InventoryService] [InventoryService]
; ;
; change this to your grid-wide inventory server ; Change this to your grid-wide inventory server
; ;
InventoryServerURI = "http://myinventoryserver.com:8003" InventoryServerURI = "http://myinventoryserver.com:8003"
[GridService] [GridService]
; ;
; change this to your grid-wide grid server ; Change this to your grid-wide grid server
; ;
GridServerURI = "http://mygridserver.com:8003" GridServerURI = "http://mygridserver.com:8003"
;AllowHypergridMapSearch = true ;AllowHypergridMapSearch = true
@ -49,51 +49,51 @@
; MapTileDirectory = "./maptiles" ; MapTileDirectory = "./maptiles"
; === HG ONLY === ; === HG ONLY ===
;; change this to the address of your Gatekeeper service ;; Change this to the address of your Gatekeeper service
;; (usually bundled with the rest of the services in one ;; (usually bundled with the rest of the services in one
;; Robust server in port 8002, but not always) ;; Robust server in port 8002, but not always)
Gatekeeper="http://mygridserver.com:8002" Gatekeeper="http://mygridserver.com:8002"
[Messaging] [Messaging]
; === HG ONLY === ; === HG ONLY ===
;; change this to the address of your Gatekeeper service ;; Change this to the address of your Gatekeeper service
;; (usually bundled with the rest of the services in one ;; (usually bundled with the rest of the services in one
;; Robust server in port 8002, but not always) ;; Robust server in port 8002, but not always)
Gatekeeper = "http://mygridserver.com:8002" Gatekeeper = "http://mygridserver.com:8002"
[AvatarService] [AvatarService]
; ;
; change this to your grid-wide grid server ; Change this to your grid-wide grid server
; ;
AvatarServerURI = "http://mygridserver.com:8003" AvatarServerURI = "http://mygridserver.com:8003"
[PresenceService] [PresenceService]
; ;
; change this to your grid-wide presence server ; Change this to your grid-wide presence server
; ;
PresenceServerURI = "http://mygridserver.com:8003" PresenceServerURI = "http://mygridserver.com:8003"
[UserAccountService] [UserAccountService]
; ;
; change this to your grid-wide user accounts server ; Change this to your grid-wide user accounts server
; ;
UserAccountServerURI = "http://mygridserver.com:8003" UserAccountServerURI = "http://mygridserver.com:8003"
[GridUserService] [GridUserService]
; ;
; change this to your grid-wide user accounts server ; Change this to your grid-wide user accounts server
; ;
GridUserServerURI = "http://mygridserver.com:8003" GridUserServerURI = "http://mygridserver.com:8003"
[AuthenticationService] [AuthenticationService]
; ;
; change this to your grid-wide authentication server ; Change this to your grid-wide authentication server
; ;
AuthenticationServerURI = "http://mygridserver.com:8003" AuthenticationServerURI = "http://mygridserver.com:8003"
[FriendsService] [FriendsService]
; ;
; change this to your grid-wide friends server ; Change this to your grid-wide friends server
; ;
FriendsServerURI = "http://mygridserver.com:8003" FriendsServerURI = "http://mygridserver.com:8003"
@ -104,10 +104,10 @@
; accessible from other grids ; accessible from other grids
; ;
ProfileServerURI = "http://mygridserver.com:8002/user" ProfileServerURI = "http://mygridserver.com:8002/user"
Gatekeeper = "http://mygridserver.com:8002" Gatekeeper = "http://mygridserver.com:8002"
;; If you want to protect your assets from being copied by foreign visitors ;; If you want to protect your assets from being copied by foreign visitors
;; uncomment the next line. You may want to do this on sims that have licensed content. ;; uncomment the next line. You may want to do this on sims that have licensed content.
; OutboundPermission = False ; OutboundPermission = False
[UserAgentService] [UserAgentService]
; ;

View File

@ -3224,29 +3224,30 @@
TODO: this is kind of lame, we basically build a duplicate TODO: this is kind of lame, we basically build a duplicate
assembly but with tests added in, just because we can't resolve cross-bin-dir-refs. assembly but with tests added in, just because we can't resolve cross-bin-dir-refs.
--> -->
<Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.OdePlugin.Tests" path="OpenSim/Region/Physics/OdePlugin" type="Library"> <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.OdePlugin.Tests" path="OpenSim/Region/Physics/OdePlugin/Tests" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
<OutputPath>../../../../bin/</OutputPath> <OutputPath>../../../../../bin/</OutputPath>
</Options> </Options>
</Configuration> </Configuration>
<Configuration name="Release"> <Configuration name="Release">
<Options> <Options>
<OutputPath>../../../../bin/</OutputPath> <OutputPath>../../../../../bin/</OutputPath>
</Options> </Options>
</Configuration> </Configuration>
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/> <Reference name="System.Core"/>
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
<Reference name="Nini" path="../../../../bin/"/> <Reference name="Nini" path="../../../../../bin/"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="Ode.NET" path="../../../../bin/"/> <Reference name="OpenSim.Region.Physics.OdePlugin" path="../../../../../bin/Physics/"/>
<Reference name="nunit.framework" path="../../../../bin/"/> <Reference name="Ode.NET" path="../../../../../bin/"/>
<Reference name="log4net" path="../../../../bin/"/> <Reference name="nunit.framework" path="../../../../../bin/"/>
<Reference name="log4net" path="../../../../../bin/"/>
<Files> <Files>
<Match pattern="*.cs" recurse="true"/> <Match pattern="*.cs" recurse="true"/>