Merge branch 'master' into dev

Conflicts:
	OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
	OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
	OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
	OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
	OpenSim/Region/Framework/Scenes/UndoState.cs
dsg
Dan Lake 2011-07-20 14:35:06 -07:00
commit 30a9cee425
36 changed files with 988 additions and 762 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

@ -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());

View File

@ -130,7 +130,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>
@ -313,11 +313,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);
@ -340,8 +340,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++)
@ -353,7 +353,9 @@ namespace OpenSim.Region.ClientStack.Linden
//rootGroup.ScheduleGroupForFullUpdate(); //rootGroup.ScheduleGroupForFullUpdate();
rootGroup.ScheduleGroupForFullUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.FullUpdate}); //seems like new object rootGroup.ScheduleGroupForFullUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.FullUpdate}); //seems like new object
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

@ -650,22 +650,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;
} }
@ -11323,8 +11343,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++)
@ -11345,7 +11370,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)
@ -11360,6 +11396,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);
@ -11370,6 +11407,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);
@ -11382,6 +11420,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);
@ -11393,8 +11432,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);
@ -11411,6 +11450,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);
@ -11418,10 +11458,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);
@ -11432,6 +11472,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);
@ -11455,6 +11496,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);
@ -11474,6 +11516,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);
@ -11482,6 +11525,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;
@ -11489,8 +11534,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);
@ -11498,6 +11547,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;
@ -11505,15 +11557,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

@ -567,7 +567,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

@ -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,6 +810,7 @@ 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;
} }
@ -817,11 +818,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
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

@ -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

@ -3389,12 +3389,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;
@ -3520,12 +3522,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

@ -599,11 +599,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();
} }
@ -1245,19 +1247,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);
} }
} }
} }
@ -1269,7 +1272,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);
} }
} }
} }
@ -1323,19 +1326,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)
@ -1354,7 +1356,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)
@ -1385,12 +1387,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; }
@ -299,7 +331,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Scene != null) if (Scene != null)
{ {
if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|| Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
&& !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) && !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
{ {
//DSG DEBUG //DSG DEBUG
@ -307,17 +339,17 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.CrossPrimGroupIntoNewRegion(val, this, true); m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
} }
} }
if (RootPart.GetStatusSandbox()) if (RootPart.GetStatusSandbox())
{ {
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
{ {
RootPart.ScriptSetPhysicsStatus(false); RootPart.ScriptSetPhysicsStatus(false);
if (Scene != null) if (Scene != null)
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
return; return;
} }
} }
@ -333,7 +365,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_rootPart.GroupPosition.Z); //m_rootPart.GroupPosition.Z);
//m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
//} //}
if (Scene != null) if (Scene != null)
Scene.EventManager.TriggerParcelPrimCountTainted(); Scene.EventManager.TriggerParcelPrimCountTainted();
} }
@ -608,34 +640,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
@ -1164,6 +1168,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);
} }
@ -1508,17 +1516,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.PhysActor.UUID = part.UUID; newPart.PhysActor.UUID = part.UUID;
newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
@ -2688,197 +2696,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();
ScheduleGroupForFullUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.None}); //above actions only update Scale for the given part, and part.Resize() will taint Scale as updated
//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();
ScheduleGroupForTerseUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.Scale});
} }
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
@ -2891,9 +2852,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))
{ {
@ -2937,12 +2902,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);
@ -2953,18 +2924,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 =
@ -2977,7 +2952,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];
@ -3008,9 +2983,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);
@ -3043,9 +3023,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);
@ -3060,7 +3046,6 @@ namespace OpenSim.Region.Framework.Scenes
HasGroupChanged = true; HasGroupChanged = true;
//DSG SYNC //DSG SYNC
//ScheduleGroupForTerseUpdate();
if (actor != null) if (actor != null)
{ {
//RotationOffset is only updated for m_rootPart, and m_rootPart.UpdateRotation should already taint RotationOffset as updated //RotationOffset is only updated for m_rootPart, and m_rootPart.UpdateRotation should already taint RotationOffset as updated
@ -3072,6 +3057,9 @@ namespace OpenSim.Region.Framework.Scenes
//ScheduleGroupForTerseUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.Position }); //ScheduleGroupForTerseUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.Position });
ScheduleGroupForTerseUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.AbsolutePosition}); ScheduleGroupForTerseUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.AbsolutePosition});
} }
//ScheduleGroupForTerseUpdate();
RootPart.IgnoreUndoUpdate = false;
} }
/// <summary> /// <summary>
@ -3089,6 +3077,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);
@ -3110,6 +3101,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);
@ -3117,12 +3115,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;
} }
} }
@ -3130,8 +3127,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;
@ -3158,23 +3159,28 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion newRot = primsRot * oldParentRot; Quaternion newRot = primsRot * oldParentRot;
newRot *= Quaternion.Inverse(axRot); newRot *= Quaternion.Inverse(axRot);
prim.RotationOffset = newRot; prim.RotationOffset = newRot;
//prim.ScheduleTerseUpdate();
prim.ScheduleTerseUpdate(new List<SceneObjectPartSyncProperties>(){ SceneObjectPartSyncProperties.RotationOffset, SceneObjectPartSyncProperties.OffsetPosition}); prim.ScheduleTerseUpdate(new List<SceneObjectPartSyncProperties>(){ SceneObjectPartSyncProperties.RotationOffset, SceneObjectPartSyncProperties.OffsetPosition});
//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(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.RotationOffset}); m_rootPart.ScheduleTerseUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.RotationOffset});
//m_rootPart.ScheduleTerseUpdate();
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}",
// Name, LocalId, rot);
} }
#endregion #endregion
@ -3428,23 +3434,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

@ -329,8 +329,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;
@ -461,7 +461,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);
//m_inventory = new SceneObjectPartInventoryBase(this); //m_inventory = new SceneObjectPartInventoryBase(this);
@ -840,7 +839,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)
@ -1066,15 +1065,19 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_shape; } get { return m_shape; }
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;
@ -1085,11 +1088,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);
} }
} }
@ -1639,17 +1647,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)
{ {
@ -1667,19 +1681,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;
@ -1757,7 +1758,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);
@ -1771,14 +1773,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()
@ -2900,19 +2908,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();
@ -3048,7 +3066,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)
{ {
@ -3074,16 +3096,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>
@ -3745,6 +3757,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
public void StoreUndoState() public void StoreUndoState()
{
StoreUndoState(false);
}
public void StoreUndoState(bool forGroup)
{ {
if (!Undoing) if (!Undoing)
{ {
@ -3760,20 +3777,136 @@ namespace OpenSim.Region.Framework.Scenes
if (last != null) if (last != null)
{ {
if (last.Compare((SceneObjectPart)this)) if (last.Compare((SceneObjectPart)this))
// TODO: May need to fix for group comparison
//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((SceneObjectPart)this); UndoState nUndo = new UndoState((SceneObjectPart)this, forGroup);
//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((SceneObjectPart)this, goback.ForGroup);
}
goback.PlaybackState((SceneObjectPart)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((SceneObjectPart)this, gofwd.ForGroup);
m_undo.Push(nUndo);
}
gofwd.PlayfwdState((SceneObjectPart)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();
} }
} }
@ -4237,44 +4370,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((SceneObjectPart)this);
}
UndoState goback = m_undo.Pop();
if (goback != null)
{
goback.PlaybackState((SceneObjectPart)this);
if (nUndo != null)
m_redo.Push(nUndo);
}
}
}
}
public void Redo()
{
lock (m_redo)
{
if (m_parentGroup.GetSceneMaxUndo() > 0)
{
UndoState nUndo = new UndoState((SceneObjectPart)this);
m_undo.Push(nUndo);
}
UndoState gofwd = m_redo.Pop();
if (gofwd != null)
gofwd.PlayfwdState((SceneObjectPart)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);
@ -4454,13 +4549,9 @@ namespace OpenSim.Region.Framework.Scenes
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
{ {
//m_log.DebugFormat("UpdatePrimFlags called on {0}, nothing changed", Name);
return; return;
} }
//DSG VD DEBUG
//m_log.DebugFormat("UpdatePrimFlags for SOP {0}, with args UsePhysics ={1}, IsTemporary= {2}, IsPhantom= {3}, IsVD = {4}", Name, UsePhysics, IsTemporary, IsPhantom, IsVD);
// Special cases for VD. VD can only be called from a script // Special cases for VD. VD can only be called from a script
// and can't be combined with changes to other states. So we can rely // and can't be combined with changes to other states. So we can rely
// that... // that...
@ -4539,15 +4630,15 @@ namespace OpenSim.Region.Framework.Scenes
if (pa == null) if (pa == null)
{ {
// 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)
@ -4698,10 +4789,6 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
TriggerScriptChangedEvent(Changed.SHAPE); TriggerScriptChangedEvent(Changed.SHAPE);
//ScheduleFullUpdate(); //ScheduleFullUpdate();
//DSG DEBUG
//m_log.DebugFormat("{0}, {1}: shaped updated to {2}, calling ScheduleFullUpdate.", Name, UUID, Shape.ProfileShape);
ScheduleFullUpdate(new List<SceneObjectPartSyncProperties>() {SceneObjectPartSyncProperties.Shape}); ScheduleFullUpdate(new List<SceneObjectPartSyncProperties>() {SceneObjectPartSyncProperties.Shape});
} }
@ -4714,7 +4801,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;
@ -4725,9 +4812,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
{ {
@ -5572,13 +5661,13 @@ 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,
LocalId);
pa = PhysActor; pa = PhysActor;
if (pa != null) if (pa != null)

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;
@ -34,145 +37,223 @@ 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();
//DSG SYNC
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
if (Position != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.Position);
if (Scale != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate(updatedProperties);
} }
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale); //part.ScheduleTerseUpdate();
//DSG SYNC
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
if (Position != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.OffsetPosition);
if (Scale != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
part.ScheduleTerseUpdate(updatedProperties);
}
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);
}
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
updatedProperties.Add(SceneObjectPartSyncProperties.OffsetPosition);
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
updatedProperties.Add(SceneObjectPartSyncProperties.AbsolutePosition);
part.ParentGroup.ScheduleGroupForTerseUpdate(updatedProperties);
//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);
}
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
updatedProperties.Add(SceneObjectPartSyncProperties.OffsetPosition);
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
updatedProperties.Add(SceneObjectPartSyncProperties.AbsolutePosition);
part.ScheduleTerseUpdate(updatedProperties);
//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 (Scale != Vector3.Zero)
{ {
if (Position != Vector3.Zero) if (ForGroup)
part.ParentGroup.AbsolutePosition = Position; part.ParentGroup.GroupResize(Scale);
if (Rotation != Quaternion.Identity) else
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale); part.Resize(Scale);
//part.ParentGroup.ScheduleGroupForTerseUpdate();
//DSG SYNC
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
if (Rotation != Quaternion.Identity)
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
if (Position != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.Position);
if (Scale != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
part.ParentGroup.ScheduleGroupForTerseUpdate(updatedProperties);
} }
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
//part.ScheduleTerseUpdate();
//DSG SYNC
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
if (Rotation != Quaternion.Identity)
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
if (Position != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.Position);
if (Scale != Vector3.Zero)
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
part.ScheduleTerseUpdate(updatedProperties);
}
part.Undoing = false;
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
updatedProperties.Add(SceneObjectPartSyncProperties.OffsetPosition);
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
updatedProperties.Add(SceneObjectPartSyncProperties.AbsolutePosition);
part.ParentGroup.ScheduleGroupForTerseUpdate(updatedProperties);
//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);
List<SceneObjectPartSyncProperties> updatedProperties = new List<SceneObjectPartSyncProperties>();
updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset);
updatedProperties.Add(SceneObjectPartSyncProperties.OffsetPosition);
updatedProperties.Add(SceneObjectPartSyncProperties.Scale);
updatedProperties.Add(SceneObjectPartSyncProperties.AbsolutePosition);
part.ScheduleTerseUpdate(updatedProperties);
//part.ScheduleTerseUpdate();
}
part.Undoing = false;
} }
} }
public class LandUndoState public class LandUndoState
{ {
public ITerrainModule m_terrainModule; public ITerrainModule m_terrainModule;
@ -186,10 +267,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

@ -88,13 +88,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

@ -88,15 +88,16 @@ 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,
// Vector3 size, Quaternion rotation); //To be removed - Actually removed!
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, public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical) Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{ {
PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical); PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
if (ret != null) if (ret != null)
ret.LocalID = localID; ret.LocalID = localID;
@ -284,13 +285,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

@ -2289,6 +2289,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

@ -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);
@ -1739,7 +1733,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// } // }
// } // }
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, localid);
return result; return result;
} }

View File

@ -84,7 +84,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
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

@ -2230,7 +2230,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()
@ -2532,10 +2545,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).
@ -2615,10 +2626,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).
@ -10092,6 +10101,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))
@ -10102,72 +10112,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();
} }

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()
{ {