Merge commit '7e8bad05ec6150e082fb634e3210b83c33dbcfe7' into 0.8.1-post-fixes

0.8.1-post-fixes
Justin Clark-Casey (justincc) 2015-03-04 16:35:27 +00:00
commit 1a185a048b
45 changed files with 1077 additions and 360 deletions

View File

@ -92,6 +92,7 @@ what it is today.
* dslake * dslake
* eeyore * eeyore
* FredoChaplin * FredoChaplin
* FreakyTech
* Garmin Kawaguichi * Garmin Kawaguichi
* Gerhard * Gerhard
* Godfrey * Godfrey
@ -128,6 +129,7 @@ what it is today.
* LuciusSirnah * LuciusSirnah
* lulurun * lulurun
* M.Igarashi * M.Igarashi
* Magnuz Binder
* maimedleech * maimedleech
* Mana Janus * Mana Janus
* MarcelEdward * MarcelEdward

View File

@ -145,14 +145,20 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
//group = m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName); try
group = d(); {
//group = m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName);
lock (m_Cache) group = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, group, GROUPS_CACHE_TIMEOUT);
return (ExtendedGroupRecord)group;
}
}
finally
{ {
m_Cache.AddOrUpdate(cacheKey, group, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return (ExtendedGroupRecord)group;
} }
} }
else else
@ -244,13 +250,19 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
membership = d(); try
{
lock (m_Cache) membership = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT);
return (ExtendedGroupMembershipData)membership;
}
}
finally
{ {
m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return (ExtendedGroupMembershipData)membership;
} }
} }
else else
@ -287,12 +299,18 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
membership = d(); try
lock (m_Cache) {
membership = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT);
return (ExtendedGroupMembershipData)membership;
}
}
finally
{ {
m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return (ExtendedGroupMembershipData)membership;
} }
} }
else else
@ -328,12 +346,18 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
memberships = d(); try
lock (m_Cache) {
memberships = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, memberships, GROUPS_CACHE_TIMEOUT);
return (List<GroupMembershipData>)memberships;
}
}
finally
{ {
m_Cache.AddOrUpdate(cacheKey, memberships, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return (List<GroupMembershipData>)memberships;
} }
} }
else else
@ -370,20 +394,26 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
List<ExtendedGroupMembersData> _members = d(); try
if (_members != null && _members.Count > 0)
members = _members.ConvertAll<GroupMembersData>(new Converter<ExtendedGroupMembersData, GroupMembersData>(m_ForeignImporter.ConvertGroupMembersData));
else
members = new List<GroupMembersData>();
lock (m_Cache)
{ {
//m_Cache.AddOrUpdate(cacheKey, members, GROUPS_CACHE_TIMEOUT); List<ExtendedGroupMembersData> _members = d();
m_Cache.AddOrUpdate(cacheKey, _members, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (List<GroupMembersData>)members; if (_members != null && _members.Count > 0)
members = _members.ConvertAll<GroupMembersData>(new Converter<ExtendedGroupMembersData, GroupMembersData>(m_ForeignImporter.ConvertGroupMembersData));
else
members = new List<GroupMembersData>();
lock (m_Cache)
{
//m_Cache.AddOrUpdate(cacheKey, members, GROUPS_CACHE_TIMEOUT);
m_Cache.AddOrUpdate(cacheKey, _members, GROUPS_CACHE_TIMEOUT);
return (List<GroupMembersData>)members;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
} }
} }
else else
@ -498,16 +528,22 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
roles = d(); try
if (roles != null)
{ {
lock (m_Cache) roles = d();
if (roles != null)
{ {
m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT); lock (m_Cache)
m_ActiveRequests.Remove(cacheKey); {
return (List<GroupRolesData>)roles; m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT);
return (List<GroupRolesData>)roles;
}
} }
} }
finally
{
m_ActiveRequests.Remove(cacheKey);
}
} }
else else
Thread.Sleep(50); Thread.Sleep(50);
@ -542,23 +578,29 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
List<ExtendedGroupRoleMembersData> _rmembers = d(); try
{
if (_rmembers != null && _rmembers.Count > 0) List<ExtendedGroupRoleMembersData> _rmembers = d();
rmembers = _rmembers.ConvertAll<GroupRoleMembersData>(new Converter<ExtendedGroupRoleMembersData, GroupRoleMembersData>(m_ForeignImporter.ConvertGroupRoleMembersData));
else if (_rmembers != null && _rmembers.Count > 0)
rmembers = new List<GroupRoleMembersData>(); rmembers = _rmembers.ConvertAll<GroupRoleMembersData>(new Converter<ExtendedGroupRoleMembersData, GroupRoleMembersData>(m_ForeignImporter.ConvertGroupRoleMembersData));
else
lock (m_Cache) rmembers = new List<GroupRoleMembersData>();
lock (m_Cache)
{
// For some strange reason, when I cache the list of GroupRoleMembersData,
// it gets emptied out. The TryGet gets an empty list...
//m_Cache.AddOrUpdate(cacheKey, rmembers, GROUPS_CACHE_TIMEOUT);
// Caching the list of ExtendedGroupRoleMembersData doesn't show that issue
// I don't get it.
m_Cache.AddOrUpdate(cacheKey, _rmembers, GROUPS_CACHE_TIMEOUT);
return (List<GroupRoleMembersData>)rmembers;
}
}
finally
{ {
// For some strange reason, when I cache the list of GroupRoleMembersData,
// it gets emptied out. The TryGet gets an empty list...
//m_Cache.AddOrUpdate(cacheKey, rmembers, GROUPS_CACHE_TIMEOUT);
// Caching the list of ExtendedGroupRoleMembersData doesn't show that issue
// I don't get it.
m_Cache.AddOrUpdate(cacheKey, _rmembers, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return (List<GroupRoleMembersData>)rmembers;
} }
} }
else else
@ -667,12 +709,19 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
roles = d(); try
lock (m_Cache) {
roles = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (List<GroupRolesData>)roles;
}
}
finally
{ {
m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return (List<GroupRolesData>)roles;
} }
} }
else else
@ -768,13 +817,19 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
GroupNoticeInfo _notice = d(); try
{
lock (m_Cache) GroupNoticeInfo _notice = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, _notice, GROUPS_CACHE_TIMEOUT);
return _notice;
}
}
finally
{ {
m_Cache.AddOrUpdate(cacheKey, _notice, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return _notice;
} }
} }
else else
@ -810,20 +865,24 @@ namespace OpenSim.Groups
if (firstCall) if (firstCall)
{ {
notices = d(); try
{
lock (m_Cache) notices = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, notices, GROUPS_CACHE_TIMEOUT);
return (List<ExtendedGroupNoticeData>)notices;
}
}
finally
{ {
m_Cache.AddOrUpdate(cacheKey, notices, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey); m_ActiveRequests.Remove(cacheKey);
return (List<ExtendedGroupNoticeData>)notices;
} }
} }
else else
Thread.Sleep(50); Thread.Sleep(50);
} }
} }
} }
} }

View File

@ -97,9 +97,9 @@ namespace OpenSim.Capabilities.Handlers
osdname["display_name"] = OSD.FromString(name); osdname["display_name"] = OSD.FromString(name);
osdname["legacy_first_name"] = parts[0]; osdname["legacy_first_name"] = parts[0];
osdname["legacy_last_name"] = parts[1]; osdname["legacy_last_name"] = parts[1];
osdname["username"] = ""; osdname["username"] = OSD.FromString(name);
osdname["id"] = OSD.FromUUID(uuid); osdname["id"] = OSD.FromUUID(uuid);
osdname["is_display_name_default"] = OSD.FromBoolean(false); osdname["is_display_name_default"] = OSD.FromBoolean(true);
agents.Add(osdname); agents.Add(osdname);
} }

View File

@ -78,7 +78,7 @@ namespace OpenSim.Framework.Monitoring
private BlockingCollection<Job> m_jobQueue; private BlockingCollection<Job> m_jobQueue;
private CancellationTokenSource m_cancelSource = new CancellationTokenSource(); private CancellationTokenSource m_cancelSource;
/// <summary> /// <summary>
/// Used to signal that we are ready to complete stop. /// Used to signal that we are ready to complete stop.
@ -105,6 +105,7 @@ namespace OpenSim.Framework.Monitoring
m_finishedProcessingAfterStop.Reset(); m_finishedProcessingAfterStop.Reset();
m_jobQueue = new BlockingCollection<Job>(new ConcurrentQueue<Job>(), 5000); m_jobQueue = new BlockingCollection<Job>(new ConcurrentQueue<Job>(), 5000);
m_cancelSource = new CancellationTokenSource();
WorkManager.StartThread( WorkManager.StartThread(
ProcessRequests, ProcessRequests,
@ -160,7 +161,6 @@ namespace OpenSim.Framework.Monitoring
finally finally
{ {
m_cancelSource.Dispose(); m_cancelSource.Dispose();
m_jobQueue = null;
} }
} }
} }
@ -249,7 +249,19 @@ namespace OpenSim.Framework.Monitoring
{ {
while (IsRunning || m_jobQueue.Count > 0) while (IsRunning || m_jobQueue.Count > 0)
{ {
CurrentJob = m_jobQueue.Take(m_cancelSource.Token); try
{
CurrentJob = m_jobQueue.Take(m_cancelSource.Token);
}
catch (ObjectDisposedException e)
{
// If we see this whilst not running then it may be due to a race where this thread checks
// IsRunning after the stopping thread sets it to false and disposes of the cancellation source.
if (IsRunning)
throw e;
else
break;
}
if (LogLevel >= 1) if (LogLevel >= 1)
m_log.DebugFormat("[{0}]: Processing job {1}", LoggingName, CurrentJob.Name); m_log.DebugFormat("[{0}]: Processing job {1}", LoggingName, CurrentJob.Name);

View File

@ -1,4 +1,31 @@
using System; /*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Reflection; using System.Reflection;

View File

@ -1,4 +1,31 @@
using System; /*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -1,4 +1,31 @@
using System; /*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Nini.Config; using Nini.Config;

View File

@ -420,6 +420,22 @@ namespace OpenSim.Framework
return x; return x;
} }
/// <summary>
/// Check if any of the values in a Vector3 are NaN or Infinity
/// </summary>
/// <param name="v">Vector3 to check</param>
/// <returns></returns>
public static bool IsNanOrInfinity(Vector3 v)
{
if (float.IsNaN(v.X) || float.IsNaN(v.Y) || float.IsNaN(v.Z))
return true;
if (float.IsInfinity(v.X) || float.IsInfinity(v.Y) || float.IsNaN(v.Z))
return true;
return false;
}
// Inclusive, within range test (true if equal to the endpoints) // Inclusive, within range test (true if equal to the endpoints)
public static bool InRange<T>(T x, T min, T max) public static bool InRange<T>(T x, T min, T max)
where T : IComparable<T> where T : IComparable<T>

View File

@ -772,9 +772,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
catch (Exception e) catch (Exception e)
{ {
// Make sure that we see any exception caused by the asynchronous operation. // Make sure that we see any exception caused by the asynchronous operation.
m_log.ErrorFormat( m_log.Error(
"[LLCLIENTVIEW]: Caught exception while processing {0} for {1}, {2} {3}", string.Format(
packetObject.Pack, Name, e.Message, e.StackTrace); "[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packetObject.Pack, Name),
e);
} }
} }
@ -9903,6 +9904,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
case "kickestate":
if(((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
{
UUID invoice = messagePacket.MethodData.Invoice;
UUID SenderID = messagePacket.AgentData.AgentID;
UUID Prey;
UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[0].Parameter), out Prey);
OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey);
}
return true;
default: default:
m_log.WarnFormat( m_log.WarnFormat(
"[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}", "[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}",

View File

@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
TaskInventoryItem scriptItem TaskInventoryItem scriptItem
= TaskInventoryHelpers.AddScript( = TaskInventoryHelpers.AddScript(
scene, scene.AssetService,
so.RootPart, so.RootPart,
"scriptItem", "scriptItem",
"default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
@ -659,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
TaskInventoryItem scriptTaskItem TaskInventoryItem scriptTaskItem
= TaskInventoryHelpers.AddScript( = TaskInventoryHelpers.AddScript(
scene, scene.AssetService,
so.RootPart, so.RootPart,
"scriptItem", "scriptItem",
"default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");

View File

@ -455,6 +455,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
// Check if it's a type of message that we should handle // Check if it's a type of message that we should handle
if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered)
|| (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered)
|| (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
|| (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
|| (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined))) || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined)))

View File

@ -318,8 +318,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
writer.WriteString(reader.Value); writer.WriteString(reader.Value);
break; break;
case XmlNodeType.XmlDeclaration:
// For various reasons, not all serializations have xml declarations (or consistent ones)
// and as it's embedded inside a byte stream we don't need it anyway, so ignore.
break;
default: default:
m_log.WarnFormat("[HG ASSET MAPPER]: Unrecognized node in asset XML transform in {0}", m_scene.Name); m_log.WarnFormat(
"[HG ASSET MAPPER]: Unrecognized node {0} in asset XML transform in {1}",
reader.NodeType, m_scene.Name);
break; break;
} }
} }
@ -336,8 +343,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
TransformXml(reader, writer); TransformXml(reader, writer);
writer.WriteEndDocument();
// Console.WriteLine("Output: [{0}]", sw.ToString()); // Console.WriteLine("Output: [{0}]", sw.ToString());
return sw.ToString(); return sw.ToString();
@ -478,12 +483,37 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
asset = m_scene.AssetService.Get(uuid.ToString()); asset = m_scene.AssetService.Get(uuid.ToString());
if (asset == null) if (asset == null)
{
m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid);
}
else else
success &= PostAsset(userAssetURL, asset); {
try
{
success &= PostAsset(userAssetURL, asset);
}
catch (Exception e)
{
m_log.Error(
string.Format(
"[HG ASSET MAPPER]: Failed to post asset {0} (type {1}, length {2}) referenced from {3} to {4} with exception ",
asset.ID, asset.Type, asset.Data.Length, assetID, userAssetURL),
e);
// For debugging purposes for now we will continue to throw the exception up the stack as was already happening. However, after
// debugging we may want to simply report the failure if we can tell this is due to a failure
// with a particular asset and not a destination network failure where all asset posts will fail (and
// generate large amounts of log spam).
throw e;
}
}
} }
else else
m_log.DebugFormat("[HG ASSET MAPPER]: Didn't post asset {0} because it already exists in asset server {1}", uuid, userAssetURL); {
m_log.DebugFormat(
"[HG ASSET MAPPER]: Didn't post asset {0} referenced from {1} because it already exists in asset server {2}",
uuid, assetID, userAssetURL);
}
} }
if (!success) if (!success)

View File

@ -614,6 +614,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected InventoryItemBase CreateItemForObject( protected InventoryItemBase CreateItemForObject(
DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID)
{ {
// m_log.DebugFormat(
// "[BASIC INVENTORY ACCESS MODULE]: Creating item for object {0} {1} for folder {2}, action {3}",
// so.Name, so.UUID, folderID, action);
//
// Get the user info of the item destination // Get the user info of the item destination
// //
UUID userID = UUID.Zero; UUID userID = UUID.Zero;

View File

@ -801,8 +801,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// Friends with benefits should be able to edit the objects too // Friends with benefits should be able to edit the objects too
if (IsFriendWithPerms(currentUser, objectOwner)) if (IsFriendWithPerms(currentUser, objectOwner))
{
// Return immediately, so that the administrator can share objects with friends // Return immediately, so that the administrator can share objects with friends
return true; return true;
}
// Users should be able to edit what is over their land. // Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
@ -1522,6 +1524,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;
bool permission = GenericObjectPermission(userID, objectID, false); bool permission = GenericObjectPermission(userID, objectID, false);
SceneObjectGroup so = (SceneObjectGroup)m_scene.Entities[objectID];
if (!permission) if (!permission)
{ {
if (!m_scene.Entities.ContainsKey(objectID)) if (!m_scene.Entities.ContainsKey(objectID))
@ -1535,31 +1540,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false; return false;
} }
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
// UUID taskOwner = null; // UUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for // Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect. // the administrator object permissions to take effect.
// UUID objectOwner = task.OwnerID; // UUID objectOwner = task.OwnerID;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) if ((so.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true; permission = true;
}
if (task.OwnerID != userID) if (so.OwnerID != userID)
{ {
if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS)) if ((so.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
permission = false; permission = false;
}
else
{
if ((task.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
permission = false;
}
} }
else else
{ {
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID]; if ((so.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
permission = false; permission = false;
} }

View File

@ -27,6 +27,7 @@
using System; using System;
using System.IO; using System.IO;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -73,12 +74,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
public ITerrainChannel LoadFile(string filename) public ITerrainChannel LoadFile(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.Open, FileAccess.Read);
ITerrainChannel retval = LoadStream(s);
s.Close(); ITerrainChannel channel;
return retval; using (FileStream s = file.Open(FileMode.Open, FileAccess.Read))
channel = LoadStream(s);
return channel;
} }
public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight) public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight)
@ -86,153 +88,159 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight); TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight);
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.Open, FileAccess.Read);
BinaryReader bs = new BinaryReader(s);
int currFileYOffset = fileHeight - 1; using (FileStream s = file.Open(FileMode.Open, FileAccess.Read))
using (BinaryReader bs = new BinaryReader(s))
// if our region isn't on the first Y section of the areas to be landscaped, then
// advance to our section of the file
while (currFileYOffset > offsetY)
{ {
// read a whole strip of regions int currFileYOffset = fileHeight - 1;
int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
bs.ReadBytes(heightsToRead * 13); // because there are 13 fun channels
currFileYOffset--;
}
// got to the Y start offset within the file of our region // if our region isn't on the first Y section of the areas to be landscaped, then
// so read the file bits associated with our region // advance to our section of the file
int y; while (currFileYOffset > offsetY)
// for each Y within our Y offset
for (y = sectionHeight - 1; y >= 0; y--)
{
int currFileXOffset = 0;
// if our region isn't the first X section of the areas to be landscaped, then
// advance the stream to the X start pos of our section in the file
// i.e. eat X upto where we start
while (currFileXOffset < offsetX)
{ {
bs.ReadBytes(sectionWidth * 13); // read a whole strip of regions
currFileXOffset++; int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
bs.ReadBytes(heightsToRead * 13); // because there are 13 fun channels
currFileYOffset--;
} }
// got to our X offset, so write our regions X line // got to the Y start offset within the file of our region
int x; // so read the file bits associated with our region
for (x = 0; x < sectionWidth; x++) int y;
{
// Read a strip and continue
retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
bs.ReadBytes(11);
}
// record that we wrote it
currFileXOffset++;
// if our region isn't the last X section of the areas to be landscaped, then // for each Y within our Y offset
// advance the stream to the end of this Y column for (y = sectionHeight - 1; y >= 0; y--)
while (currFileXOffset < fileWidth)
{ {
// eat the next regions x line int currFileXOffset = 0;
bs.ReadBytes(sectionWidth * 13); //The 13 channels again
// if our region isn't the first X section of the areas to be landscaped, then
// advance the stream to the X start pos of our section in the file
// i.e. eat X upto where we start
while (currFileXOffset < offsetX)
{
bs.ReadBytes(sectionWidth * 13);
currFileXOffset++;
}
// got to our X offset, so write our regions X line
int x;
for (x = 0; x < sectionWidth; x++)
{
// Read a strip and continue
retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
bs.ReadBytes(11);
}
// record that we wrote it
currFileXOffset++; currFileXOffset++;
// if our region isn't the last X section of the areas to be landscaped, then
// advance the stream to the end of this Y column
while (currFileXOffset < fileWidth)
{
// eat the next regions x line
bs.ReadBytes(sectionWidth * 13); //The 13 channels again
currFileXOffset++;
}
} }
} }
bs.Close();
s.Close();
return retval; return retval;
} }
public ITerrainChannel LoadStream(Stream s) public ITerrainChannel LoadStream(Stream s)
{ {
TerrainChannel retval = new TerrainChannel(); // The raw format doesn't contain any dimension information.
// Guess the square dimensions by using the length of the raw file.
double dimension = Math.Sqrt((double)(s.Length / 13));
// Regions are always multiples of 256.
int trimmedDimension = (int)dimension - ((int)dimension % (int)Constants.RegionSize);
if (trimmedDimension < Constants.RegionSize)
trimmedDimension = (int)Constants.RegionSize;
BinaryReader bs = new BinaryReader(s); TerrainChannel retval = new TerrainChannel(trimmedDimension, trimmedDimension);
int y;
for (y = 0; y < retval.Height; y++) using (BinaryReader bs = new BinaryReader(s))
{ {
int x; int y;
for (x = 0; x < retval.Width; x++) for (y = 0; y < retval.Height; y++)
{ {
retval[x, (retval.Height - 1) - y] = bs.ReadByte() * (bs.ReadByte() / 128.0); int x;
bs.ReadBytes(11); // Advance the stream to next bytes. for (x = 0; x < retval.Width; x++)
{
retval[x, (retval.Height - 1) - y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
bs.ReadBytes(11); // Advance the stream to next bytes.
}
} }
} }
bs.Close();
return retval; return retval;
} }
public void SaveFile(string filename, ITerrainChannel map) public void SaveFile(string filename, ITerrainChannel map)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
SaveStream(s, map);
s.Close(); using (FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write))
SaveStream(s, map);
} }
public void SaveStream(Stream s, ITerrainChannel map) public void SaveStream(Stream s, ITerrainChannel map)
{ {
BinaryWriter binStream = new BinaryWriter(s); using (BinaryWriter binStream = new BinaryWriter(s))
// Output the calculated raw
for (int y = 0; y < map.Height; y++)
{ {
for (int x = 0; x < map.Width; x++) // Output the calculated raw
for (int y = 0; y < map.Height; y++)
{ {
double t = map[x, (map.Height - 1) - y]; for (int x = 0; x < map.Width; x++)
//if height is less than 0, set it to 0 as
//can't save -ve values in a LLRAW file
if (t < 0d)
{ {
t = 0d; double t = map[x, (map.Height - 1) - y];
//if height is less than 0, set it to 0 as
//can't save -ve values in a LLRAW file
if (t < 0d)
{
t = 0d;
}
int index = 0;
// The lookup table is pre-sorted, so we either find an exact match or
// the next closest (smaller) match with a binary search
index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t));
if (index < 0)
index = ~index - 1;
index = LookupHeightTable[index].Index;
byte red = (byte) (index & 0xFF);
byte green = (byte) ((index >> 8) & 0xFF);
const byte blue = 20;
const byte alpha1 = 0;
const byte alpha2 = 0;
const byte alpha3 = 0;
const byte alpha4 = 0;
const byte alpha5 = 255;
const byte alpha6 = 255;
const byte alpha7 = 255;
const byte alpha8 = 255;
byte alpha9 = red;
byte alpha10 = green;
binStream.Write(red);
binStream.Write(green);
binStream.Write(blue);
binStream.Write(alpha1);
binStream.Write(alpha2);
binStream.Write(alpha3);
binStream.Write(alpha4);
binStream.Write(alpha5);
binStream.Write(alpha6);
binStream.Write(alpha7);
binStream.Write(alpha8);
binStream.Write(alpha9);
binStream.Write(alpha10);
} }
int index = 0;
// The lookup table is pre-sorted, so we either find an exact match or
// the next closest (smaller) match with a binary search
index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t));
if (index < 0)
index = ~index - 1;
index = LookupHeightTable[index].Index;
byte red = (byte) (index & 0xFF);
byte green = (byte) ((index >> 8) & 0xFF);
const byte blue = 20;
const byte alpha1 = 0;
const byte alpha2 = 0;
const byte alpha3 = 0;
const byte alpha4 = 0;
const byte alpha5 = 255;
const byte alpha6 = 255;
const byte alpha7 = 255;
const byte alpha8 = 255;
byte alpha9 = red;
byte alpha10 = green;
binStream.Write(red);
binStream.Write(green);
binStream.Write(blue);
binStream.Write(alpha1);
binStream.Write(alpha2);
binStream.Write(alpha3);
binStream.Write(alpha4);
binStream.Write(alpha5);
binStream.Write(alpha6);
binStream.Write(alpha7);
binStream.Write(alpha8);
binStream.Write(alpha9);
binStream.Write(alpha10);
} }
} }
binStream.Close();
} }
public string FileExtension public string FileExtension
@ -259,7 +267,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
public bool SupportsTileSave() public bool SupportsTileSave()
{ {
return false; return false;
} }
} }
} }

View File

@ -217,8 +217,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
if (regionInfos.Count == 0) if (regionInfos.Count == 0)
remoteClient.SendAlertMessage("No regions found with that name."); remoteClient.SendAlertMessage("No regions found with that name.");
else if (regionInfos.Count == 1) // this seems unnecessary because found regions will show up in the search results
remoteClient.SendAlertMessage("Region found!"); //else if (regionInfos.Count == 1)
// remoteClient.SendAlertMessage("Region found!");
} }
} }

View File

@ -807,7 +807,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
{ {
//// Retrieve the folder from the sender //// Retrieve the folder from the sender
InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId)); InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId));
if (null == folder) if (null == folder)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(

View File

@ -265,6 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];
// m_log.DebugFormat("[SCENE OBJECT GROUP INVENTORY]: Effective perms of {0} are {1}", part.Name, (OpenMetaverse.PermissionMask)part.OwnerMask);
ownerMask &= part.OwnerMask; ownerMask &= part.OwnerMask;
perms &= part.Inventory.MaskEffectivePermissions(); perms &= part.Inventory.MaskEffectivePermissions();
} }

View File

@ -924,13 +924,17 @@ namespace OpenSim.Region.Framework.Scenes
string uuid = reader.GetAttribute("UUID"); string uuid = reader.GetAttribute("UUID");
// Even if there is no UUID attribute for some strange reason, we must always read the inner XML
// so we don't continually keep checking the same SavedScriptedState element.
string innerXml = reader.ReadInnerXml();
if (uuid != null) if (uuid != null)
{ {
// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); // m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name);
UUID itemid = new UUID(uuid); UUID itemid = new UUID(uuid);
if (itemid != UUID.Zero) if (itemid != UUID.Zero)
m_savedScriptState[itemid] = reader.ReadInnerXml(); m_savedScriptState[itemid] = innerXml;
} }
else else
{ {
@ -2943,6 +2947,11 @@ namespace OpenSim.Region.Framework.Scenes
uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
RootPart.ScheduleFullUpdate(); RootPart.ScheduleFullUpdate();
} }

View File

@ -266,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes
public Quaternion SpinOldOrientation = Quaternion.Identity; public Quaternion SpinOldOrientation = Quaternion.Identity;
protected int m_APIDIterations = 0; protected bool m_APIDActive = false;
protected Quaternion m_APIDTarget = Quaternion.Identity; protected Quaternion m_APIDTarget = Quaternion.Identity;
protected float m_APIDDamp = 0; protected float m_APIDDamp = 0;
protected float m_APIDStrength = 0; protected float m_APIDStrength = 0;
@ -642,6 +642,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected bool APIDActive
{
get { return m_APIDActive; }
set { m_APIDActive = value; }
}
protected Quaternion APIDTarget protected Quaternion APIDTarget
{ {
get { return m_APIDTarget; } get { return m_APIDTarget; }
@ -923,14 +929,17 @@ namespace OpenSim.Region.Framework.Scenes
set set
{ {
m_velocity = value; if (Util.IsNanOrInfinity(value))
m_velocity = Vector3.Zero;
else
m_velocity = value;
PhysicsActor actor = PhysActor; PhysicsActor actor = PhysActor;
if (actor != null) if (actor != null)
{ {
if (actor.IsPhysical) if (actor.IsPhysical)
{ {
actor.Velocity = value; actor.Velocity = m_velocity;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
} }
} }
@ -957,14 +966,30 @@ namespace OpenSim.Region.Framework.Scenes
} }
return m_angularVelocity; return m_angularVelocity;
} }
set { m_angularVelocity = value; } set
{
if (Util.IsNanOrInfinity(value))
m_angularVelocity = Vector3.Zero;
else
m_angularVelocity = value;
PhysicsActor actor = PhysActor;
if ((actor != null) && actor.IsPhysical)
actor.RotationalVelocity = m_angularVelocity;
}
} }
/// <summary></summary> /// <summary></summary>
public Vector3 Acceleration public Vector3 Acceleration
{ {
get { return m_acceleration; } get { return m_acceleration; }
set { m_acceleration = value; } set
{
if (Util.IsNanOrInfinity(value))
m_acceleration = Vector3.Zero;
else
m_acceleration = value;
}
} }
public string Description { get; set; } public string Description { get; set; }
@ -2610,7 +2635,7 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); APIDActive = true;
} }
// Necessary to get the lookat deltas applied // Necessary to get the lookat deltas applied
@ -2624,7 +2649,7 @@ namespace OpenSim.Region.Framework.Scenes
public void StopLookAt() public void StopLookAt()
{ {
APIDTarget = Quaternion.Identity; APIDActive = false;
} }
@ -4873,20 +4898,44 @@ namespace OpenSim.Region.Framework.Scenes
{ {
try try
{ {
if (APIDTarget != Quaternion.Identity) if (APIDActive)
{ {
if (m_APIDIterations <= 1) PhysicsActor pa = ParentGroup.RootPart.PhysActor;
if (pa == null || !pa.IsPhysical || APIDStrength < 0.04)
{ {
UpdateRotation(APIDTarget); StopLookAt();
APIDTarget = Quaternion.Identity;
return; return;
} }
Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); Quaternion currRot = GetWorldRotation();
rot.Normalize(); currRot.Normalize();
UpdateRotation(rot);
// difference between current orientation and desired orientation
Quaternion dR = new Quaternion(currRot.X, currRot.Y, currRot.Z, -currRot.W) * APIDTarget;
m_APIDIterations--; // find axis of rotation to rotate to desired orientation
Vector3 axis = Vector3.UnitX;
float s = (float)Math.Sqrt(1.0f - dR.W * dR.W);
if (s >= 0.001)
{
float invS = 1.0f / s;
if (dR.W < 0) invS = -invS;
axis = new Vector3(dR.X * invS, dR.Y * invS, dR.Z * invS) * currRot;
axis.Normalize();
}
// angle between current and desired orientation
float angle = 2.0f * (float)Math.Acos(dR.W);
if (angle > Math.PI)
angle = 2.0f * (float)Math.PI - angle;
// clamp strength to avoid overshoot
float strength = 1.0f / APIDStrength;
if (strength > 1.0) strength = 1.0f;
// set angular velocity to rotate to desired orientation
// with velocity proportional to strength and angle
AngularVelocity = axis * angle * strength * (float)Math.PI;
// This ensures that we'll check this object on the next iteration // This ensures that we'll check this object on the next iteration
ParentGroup.QueueForUpdateCheck(); ParentGroup.QueueForUpdateCheck();

View File

@ -378,6 +378,11 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public uint MovementFlag { get; private set; } public uint MovementFlag { get; private set; }
/// <summary>
/// Set this if we need to force a movement update on the next received AgentUpdate from the viewer.
/// </summary>
private const uint ForceUpdateMovementFlagValue = uint.MaxValue;
/// <summary> /// <summary>
/// Is the agent stop control flag currently active? /// Is the agent stop control flag currently active?
/// </summary> /// </summary>
@ -822,7 +827,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
private bool m_mouseLook; private bool m_mouseLook;
private bool m_leftButtonDown; // private bool m_leftButtonDown;
private bool m_inTransit; private bool m_inTransit;
@ -1005,23 +1010,6 @@ namespace OpenSim.Region.Framework.Scenes
Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
} }
private Vector3[] GetWalkDirectionVectors()
{
Vector3[] vector = new Vector3[11];
vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD
vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK
vector[2] = Vector3.UnitY; //LEFT
vector[3] = -Vector3.UnitY; //RIGHT
vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP
vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN
vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE
vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE
vector[8] = Vector3.UnitY; //LEFT_NUDGE
vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE
return vector;
}
#endregion #endregion
#region Status Methods #region Status Methods
@ -1267,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes
// If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
// stall on the border crossing since the existing child agent will still have the last movement // stall on the border crossing since the existing child agent will still have the last movement
// recorded, which stops the input from being processed. // recorded, which stops the input from being processed.
MovementFlag = 0; MovementFlag = ForceUpdateMovementFlagValue;
m_scene.EventManager.TriggerOnMakeRootAgent(this); m_scene.EventManager.TriggerOnMakeRootAgent(this);
@ -1925,13 +1913,13 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{ {
//m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); // Scene.Name, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
if (IsChildAgent) if (IsChildAgent)
{ {
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); // m_log.DebugFormat("DEBUG: HandleAgentUpdate: child agent in {0}", Scene.Name);
return; return;
} }
@ -1973,7 +1961,12 @@ namespace OpenSim.Region.Framework.Scenes
// DrawDistance = Scene.DefaultDrawDistance; // DrawDistance = Scene.DefaultDrawDistance;
m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
// FIXME: This does not work as intended because the viewer only sends the lbutton down when the button
// is first pressed, not whilst it is held down. If this is required in the future then need to look
// for an AGENT_CONTROL_LBUTTON_UP event and make sure to handle cases where an initial DOWN is not
// received (e.g. on holding LMB down on the avatar in a viewer).
// m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
#endregion Inputs #endregion Inputs
@ -2066,6 +2059,14 @@ namespace OpenSim.Region.Framework.Scenes
bool update_movementflag = false; bool update_movementflag = false;
// If we were just made root agent then we must perform movement updates for the first AgentUpdate that
// we get
if (MovementFlag == ForceUpdateMovementFlagValue)
{
MovementFlag = 0;
update_movementflag = true;
}
if (agentData.UseClientAgentPosition) if (agentData.UseClientAgentPosition)
{ {
MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
@ -2097,15 +2098,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
bool bAllowUpdateMoveToPosition = false; bool bAllowUpdateMoveToPosition = false;
Vector3[] dirVectors;
// use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
// this prevents 'jumping' in inappropriate situations.
if (!Flying && (m_mouseLook || m_leftButtonDown))
dirVectors = GetWalkDirectionVectors();
else
dirVectors = Dir_Vectors;
// A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
{ {
@ -2115,7 +2107,9 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
agent_control_v3 += dirVectors[i]; // Don't slide against ground when crouching if camera is panned around avatar
if (Flying || DCF != Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)
agent_control_v3 += Dir_Vectors[i];
//m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]);
} }
catch (IndexOutOfRangeException) catch (IndexOutOfRangeException)
@ -3149,7 +3143,17 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
// vec, Rotation, thisAddSpeedModifier, Name); // vec, Rotation, thisAddSpeedModifier, Name);
Vector3 direc = vec * Rotation; Quaternion rot = Rotation;
if (!(Flying && m_mouseLook) && (PresenceType != PresenceType.Npc))
{
// The only situation in which we care about X and Y is in mouselook flying. The rest of the time
// these parameters are not relevant for determining avatar movement direction and cause issues such
// as wrong walk speed if the camera is rotated.
rot.X = 0;
rot.Y = 0;
}
Vector3 direc = vec * rot;
direc.Normalize(); direc.Normalize();
if (Flying != FlyingOld) // add for fly velocity control if (Flying != FlyingOld) // add for fly velocity control

View File

@ -0,0 +1,347 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.CoreModules.Framework.EntityTransfer;
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Region.CoreModules.World.Permissions;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
namespace OpenSim.Region.Framework.Scenes.Tests
{
/// <summary>
/// Test copying of scene objects.
/// </summary>
/// <remarks>
/// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
/// </remarks>
[TestFixture]
public class SceneObjectCopyTests : OpenSimTestCase
{
[TestFixtureSetUp]
public void FixtureInit()
{
// Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
// This facility was added after the original async delete tests were written, so it may be possible now
// to not bother explicitly disabling their async (since everything will be running sync).
Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
}
[TestFixtureTearDown]
public void TearDown()
{
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
// threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
// tests really shouldn't).
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
}
[Test]
public void TestTakeCopyWhenCopierIsOwnerWithPerms()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
uint soLocalId = so.LocalId;
// so.UpdatePermissions(
// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Copy, 1);
// so.UpdatePermissions(
// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
// so.UpdatePermissions(
// ua.PrincipalID, (byte)PermissionWho.Base, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
// scene.HandleObjectPermissionsUpdate(client, client.AgentId, client.SessionId, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
// Ideally we might change these via client-focussed method calls as commented out above. However, this
// becomes very convoluted so we will set only the copy perm directly.
so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
// so.RootPart.OwnerMask = (uint)OpenMetaverse.PermissionMask.Copy;
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will currently plop it in Lost and Found
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
Assert.That(item, Is.Not.Null);
}
[Test]
public void TestTakeCopyWhenCopierIsOwnerWithoutPerms()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
uint soLocalId = so.LocalId;
so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
//so.RootPart.OwnerMask = (uint)(OpenMetaverse.PermissionMask.Copy & ~OpenMetaverse.PermissionMask.Copy);
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will currently plop it in Lost and Found
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we do not have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
Assert.That(item, Is.Null);
}
[Test]
public void TestTakeCopyWhenCopierIsNotOwnerWithPerms()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
uint soLocalId = so.LocalId;
// Base must allow transfer and copy
so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
// Must be set so anyone can copy
so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will plop it in the Objects folder
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
Assert.That(item, Is.Not.Null);
}
[Test]
public void TestTakeCopyWhenCopierIsNotOwnerWithoutPerms()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
uint soLocalId = so.LocalId;
{
// Check that object is not copied if copy base perms is missing.
// Should not allow copy if base does not have this.
so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Transfer;
// Must be set so anyone can copy
so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
// Check that object is not copied
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
Assert.That(item, Is.Null);
}
{
// Check that object is not copied if copy trans perms is missing.
// Should not allow copy if base does not have this.
so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
// Must be set so anyone can copy
so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
// Check that object is not copied
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
Assert.That(item, Is.Null);
}
{
// Check that object is not copied if everyone copy perms is missing.
// Should not allow copy if base does not have this.
so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
// Make sure everyone perm does not allow copy
so.RootPart.EveryoneMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
// Check that object is not copied
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
Assert.That(item, Is.Null);
}
}
}
}

View File

@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
TaskInventoryItem taskSceneObjectItem TaskInventoryItem taskSceneObjectItem
= TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
scene.AddSceneObject(sog1); scene.AddSceneObject(sog1);
@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectPart sop1 = sog1.RootPart; SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 TaskInventoryItem sopItem1
= TaskInventoryHelpers.AddNotecard( = TaskInventoryHelpers.AddNotecard(
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
InventoryFolderBase folder InventoryFolderBase folder
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectPart sop1 = sog1.RootPart; SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 TaskInventoryItem sopItem1
= TaskInventoryHelpers.AddNotecard( = TaskInventoryHelpers.AddNotecard(
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
// Perform test // Perform test
string message; string message;

View File

@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
UUID ownerId = TestHelpers.ParseTail(0x10); UUID ownerId = TestHelpers.ParseTail(0x10);
UUID embeddedId = TestHelpers.ParseTail(0x20); UUID embeddedId = TestHelpers.ParseTail(0x20);
UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21);
@ -120,5 +120,39 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId));
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId));
} }
[Test]
public void TestTaskItems()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID ownerId = TestHelpers.ParseTail(0x10);
SceneObjectGroup soL0 = SceneHelpers.CreateSceneObject(1, ownerId, "l0", 0x20);
SceneObjectGroup soL1 = SceneHelpers.CreateSceneObject(1, ownerId, "l1", 0x21);
SceneObjectGroup soL2 = SceneHelpers.CreateSceneObject(1, ownerId, "l2", 0x22);
TaskInventoryHelpers.AddScript(
m_assetService, soL2.RootPart, TestHelpers.ParseTail(0x33), TestHelpers.ParseTail(0x43), "l3-script", "gibberish");
TaskInventoryHelpers.AddSceneObject(
m_assetService, soL1.RootPart, "l2-item", TestHelpers.ParseTail(0x32), soL2, TestHelpers.ParseTail(0x42));
TaskInventoryHelpers.AddSceneObject(
m_assetService, soL0.RootPart, "l1-item", TestHelpers.ParseTail(0x31), soL1, TestHelpers.ParseTail(0x41));
m_uuidGatherer.AddForInspection(soL0);
m_uuidGatherer.GatherAll();
// foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys)
// System.Console.WriteLine("key : {0}", key);
// We expect to see the default prim texture and the assets of the contained task items
Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(4));
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(new UUID(Constants.DefaultTexture)));
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x41)));
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x42)));
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x43)));
}
} }
} }

View File

@ -123,6 +123,8 @@ namespace OpenSim.Region.Framework.Scenes
if (m_assetUuidsToInspect.Contains(uuid)) if (m_assetUuidsToInspect.Contains(uuid))
return false; return false;
// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
m_assetUuidsToInspect.Enqueue(uuid); m_assetUuidsToInspect.Enqueue(uuid);
return true; return true;
@ -238,7 +240,11 @@ namespace OpenSim.Region.Framework.Scenes
if (Complete) if (Complete)
return false; return false;
GetAssetUuids(m_assetUuidsToInspect.Dequeue()); UUID nextToInspect = m_assetUuidsToInspect.Dequeue();
// m_log.DebugFormat("[UUID GATHERER]: Inspecting asset {0}", nextToInspect);
GetAssetUuids(nextToInspect);
return true; return true;
} }
@ -322,8 +328,6 @@ namespace OpenSim.Region.Framework.Scenes
// Here, we want to collect uuids which require further asset fetches but mark the others as gathered // Here, we want to collect uuids which require further asset fetches but mark the others as gathered
try try
{ {
GatheredUuids[assetUuid] = assetType;
if ((sbyte)AssetType.Bodypart == assetType if ((sbyte)AssetType.Bodypart == assetType
|| (sbyte)AssetType.Clothing == assetType || (sbyte)AssetType.Clothing == assetType
|| (sbyte)AssetType.Gesture == assetType || (sbyte)AssetType.Gesture == assetType
@ -334,11 +338,15 @@ namespace OpenSim.Region.Framework.Scenes
{ {
AddForInspection(assetUuid); AddForInspection(assetUuid);
} }
else
{
GatheredUuids[assetUuid] = assetType;
}
} }
catch (Exception) catch (Exception)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[ITERATABLE UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
assetUuid, assetType); assetUuid, assetType);
throw; throw;
} }

View File

@ -67,18 +67,17 @@ namespace OpenSim.Region.OptionalModules.Materials
private bool m_enabled = false; private bool m_enabled = false;
public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>(); public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>();
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
m_enabled = true; // default is enabled
IConfig config = source.Configs["Materials"]; IConfig config = source.Configs["Materials"];
if (config == null) if (config != null)
return; m_enabled = config.GetBoolean("enable_materials", m_enabled);
m_enabled = config.GetBoolean("enable_materials", true); if (m_enabled)
if (!m_enabled) m_log.DebugFormat("[Materials]: Initialized");
return;
m_log.DebugFormat("[Materials]: Initialized");
} }
public void Close() public void Close()

View File

@ -785,6 +785,14 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
private void setAngularVelocity(float x, float y, float z)
{
if (Body != (IntPtr)0)
{
d.BodySetAngularVel(Body, x, y, z);
}
}
/// <summary> /// <summary>
/// Stop a prim from being subject to physics. /// Stop a prim from being subject to physics.
/// </summary> /// </summary>
@ -2645,6 +2653,7 @@ Console.WriteLine(" JointCreateFixed");
if (value.IsFinite()) if (value.IsFinite())
{ {
m_rotationalVelocity = value; m_rotationalVelocity = value;
setAngularVelocity(value.X, value.Y, value.Z);
} }
else else
{ {

View File

@ -3092,26 +3092,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Determine where we are looking from // Determine where we are looking from
LSL_Vector from = llGetPos(); LSL_Vector from = llGetPos();
// Work out the normalised vector from the source to the target // normalized direction to target
LSL_Vector delta = llVecNorm(target - from); LSL_Vector dir = llVecNorm(target - from);
LSL_Vector angle = new LSL_Vector(0,0,0); // use vertical to help compute left axis
LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
// find normalized left axis parallel to horizon
LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
// make up orthogonal to left and dir
up = LSL_Vector.Cross(dir, left);
// Calculate the yaw // compute rotation based on orthogonal axes
// subtracting PI_BY_TWO is required to compensate for the odd SL co-ordinate system LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
angle.x = llAtan2(delta.z, delta.y) - ScriptBaseClass.PI_BY_TWO;
// Calculate pitch
angle.y = llAtan2(delta.x, llSqrt((delta.y * delta.y) + (delta.z * delta.z)));
// we need to convert from a vector describing
// the angles of rotation in radians into rotation value
LSL_Rotation rot = llEuler2Rot(angle);
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior // set the rotation of the object, copy that behavior
PhysicsActor pa = m_host.PhysActor; PhysicsActor pa = m_host.PhysActor;
if (strength == 0 || pa == null || !pa.IsPhysical) if (m_host.ParentGroup.IsAttachment || strength == 0 || pa == null || !pa.IsPhysical)
{ {
llSetRot(rot); llSetRot(rot);
} }
@ -9012,7 +9009,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Vector(textColor.R, res.Add(new LSL_Vector(textColor.R,
textColor.G, textColor.G,
textColor.B)); textColor.B));
res.Add(new LSL_Float(textColor.A)); res.Add(new LSL_Float(1.0 - textColor.A));
break; break;
case (int)ScriptBaseClass.PRIM_NAME: case (int)ScriptBaseClass.PRIM_NAME:
res.Add(new LSL_String(part.Name)); res.Add(new LSL_String(part.Name));

View File

@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule);
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, so.RootPart); m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart);
// This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
// Possibly this could be done and we could obtain it directly from the MockScriptEngine. // Possibly this could be done and we could obtain it directly from the MockScriptEngine.

View File

@ -91,7 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20); UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId);
LSL_Api api = new LSL_Api(); LSL_Api api = new LSL_Api();
api.Initialize(m_engine, so1.RootPart, null, null); api.Initialize(m_engine, so1.RootPart, null, null);
@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20); UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
// Create a second object // Create a second object
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
@ -188,7 +188,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20); UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
@ -223,7 +223,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20); UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryItem tii TaskInventoryItem tii
= TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); = TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
tii.NextPermissions &= ~((uint)PermissionMask.Modify); tii.NextPermissions &= ~((uint)PermissionMask.Modify);
UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
@ -251,7 +251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(sourceSo); m_scene.AddSceneObject(sourceSo);
LSL_Api api = new LSL_Api(); LSL_Api api = new LSL_Api();
api.Initialize(m_engine, sourceSo.RootPart, null, null); api.Initialize(m_engine, sourceSo.RootPart, null, null);
TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World"); TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World");
SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id); SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id); SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id);

View File

@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// FIXME: This should really be a script item (with accompanying script) // FIXME: This should really be a script item (with accompanying script)
TaskInventoryItem grp1Item TaskInventoryItem grp1Item
= TaskInventoryHelpers.AddNotecard( = TaskInventoryHelpers.AddNotecard(
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// FIXME: This should really be a script item (with accompanying script) // FIXME: This should really be a script item (with accompanying script)
TaskInventoryItem grp1Item TaskInventoryItem grp1Item
= TaskInventoryHelpers.AddNotecard( = TaskInventoryHelpers.AddNotecard(
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
@ -155,7 +155,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// FIXME: This should really be a script item (with accompanying script) // FIXME: This should really be a script item (with accompanying script)
TaskInventoryItem grp1Item TaskInventoryItem grp1Item
= TaskInventoryHelpers.AddNotecard( = TaskInventoryHelpers.AddNotecard(
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine); SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine);
m_so = SceneHelpers.AddSceneObject(m_scene); m_so = SceneHelpers.AddSceneObject(m_scene);
m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart); m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart);
// This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
// Possibly this could be done and we could obtain it directly from the MockScriptEngine. // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
string[] ncLines = { "One", "Twoè", "Three" }; string[] ncLines = { "One", "Twoè", "Three" };
TaskInventoryItem ncItem TaskInventoryItem ncItem
= TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); = TaskInventoryHelpers.AddNotecard(m_scene.AssetService, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines));
AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]);
AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]);
@ -102,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart, "nc1", "Not important"); TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart, "nc1", "Not important");
AssertInValidNotecardLine(ncItem.Name, 0); AssertInValidNotecardLine(ncItem.Name, 0);
} }

View File

@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, part); TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part);
LSL_Api apiGrp1 = new LSL_Api(); LSL_Api apiGrp1 = new LSL_Api();
apiGrp1.Initialize(m_engine, part, scriptItem, null); apiGrp1.Initialize(m_engine, part, scriptItem, null);

View File

@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
OSSL_Api osslApi = new OSSL_Api(); OSSL_Api osslApi = new OSSL_Api();
@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
// Create an object embedded inside the first // Create an object embedded inside the first
TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint);
@ -142,7 +142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
OSSL_Api osslApi = new OSSL_Api(); OSSL_Api osslApi = new OSSL_Api();
@ -150,7 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
TaskInventoryHelpers.AddNotecard( TaskInventoryHelpers.AddNotecard(
m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!");
bool exceptionCaught = false; bool exceptionCaught = false;
@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1);
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
OSSL_Api osslApi = new OSSL_Api(); OSSL_Api osslApi = new OSSL_Api();
@ -198,7 +198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
TaskInventoryHelpers.AddSceneObject( TaskInventoryHelpers.AddSceneObject(
m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2);

View File

@ -114,7 +114,7 @@ namespace OpenSim.Region.ScriptEngine.Tests
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
TaskInventoryHelpers.AddScript( TaskInventoryHelpers.AddScript(
scene, scene.AssetService,
so.RootPart, so.RootPart,
"scriptItem", "scriptItem",
"default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");

View File

@ -248,7 +248,6 @@ namespace OpenSim.Service.Connectors
public void StoreEstateSettings(EstateSettings es) public void StoreEstateSettings(EstateSettings es)
{ {
string reply = string.Empty;
// /estates/estate/ // /estates/estate/
string uri = m_ServerURI + ("/estates/estate"); string uri = m_ServerURI + ("/estates/estate");
@ -260,7 +259,6 @@ namespace OpenSim.Service.Connectors
public bool LinkRegion(UUID regionID, int estateID) public bool LinkRegion(UUID regionID, int estateID)
{ {
string reply = string.Empty;
// /estates/estate/?eid=int&region=uuid // /estates/estate/?eid=int&region=uuid
string uri = m_ServerURI + String.Format("/estates/estate/?eid={0}&region={1}", estateID, regionID); string uri = m_ServerURI + String.Format("/estates/estate/?eid={0}&region={1}", estateID, regionID);

View File

@ -43,7 +43,7 @@ namespace OpenSim.Tests.Common
/// <summary> /// <summary>
/// Add a notecard item to the given part. /// Add a notecard item to the given part.
/// </summary> /// </summary>
/// <param name="scene"></param> /// <param name="assetService"></param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="itemName"></param> /// <param name="itemName"></param>
/// <param name="itemIDFrag">UUID or UUID stem</param> /// <param name="itemIDFrag">UUID or UUID stem</param>
@ -51,16 +51,16 @@ namespace OpenSim.Tests.Common
/// <param name="text">The tex to put in the notecard.</param> /// <param name="text">The tex to put in the notecard.</param>
/// <returns>The item that was added</returns> /// <returns>The item that was added</returns>
public static TaskInventoryItem AddNotecard( public static TaskInventoryItem AddNotecard(
Scene scene, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text) IAssetService assetService, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text)
{ {
return AddNotecard( return AddNotecard(
scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text); assetService, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text);
} }
/// <summary> /// <summary>
/// Add a notecard item to the given part. /// Add a notecard item to the given part.
/// </summary> /// </summary>
/// <param name="scene"></param> /// <param name="assetService"></param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="itemName"></param> /// <param name="itemName"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
@ -68,7 +68,7 @@ namespace OpenSim.Tests.Common
/// <param name="text">The tex to put in the notecard.</param> /// <param name="text">The tex to put in the notecard.</param>
/// <returns>The item that was added</returns> /// <returns>The item that was added</returns>
public static TaskInventoryItem AddNotecard( public static TaskInventoryItem AddNotecard(
Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text) IAssetService assetService, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text)
{ {
AssetNotecard nc = new AssetNotecard(); AssetNotecard nc = new AssetNotecard();
nc.BodyText = text; nc.BodyText = text;
@ -76,7 +76,7 @@ namespace OpenSim.Tests.Common
AssetBase ncAsset AssetBase ncAsset
= AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero); = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero);
scene.AssetService.Store(ncAsset); assetService.Store(ncAsset);
TaskInventoryItem ncItem TaskInventoryItem ncItem
= new TaskInventoryItem = new TaskInventoryItem
@ -94,12 +94,12 @@ namespace OpenSim.Tests.Common
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
/// functions more than once in a test. /// functions more than once in a test.
/// </remarks> /// </remarks>
/// <param name="scene"></param> /// <param name="assetService"></param>
/// <param name="part"></param> /// <param name="part"></param>
/// <returns>The item that was added</returns> /// <returns>The item that was added</returns>
public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) public static TaskInventoryItem AddScript(IAssetService assetService, SceneObjectPart part)
{ {
return AddScript(scene, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }"); return AddScript(assetService, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }");
} }
/// <summary> /// <summary>
@ -109,15 +109,15 @@ namespace OpenSim.Tests.Common
/// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
/// than a random component. /// than a random component.
/// </remarks> /// </remarks>
/// <param name="scene"></param> /// <param name="assetService"></param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="scriptName">Name of the script to add</param> /// <param name="scriptName">Name of the script to add</param>
/// <param name="scriptSource">LSL script source</param> /// <param name="scriptSource">LSL script source</param>
/// <returns>The item that was added</returns> /// <returns>The item that was added</returns>
public static TaskInventoryItem AddScript( public static TaskInventoryItem AddScript(
Scene scene, SceneObjectPart part, string scriptName, string scriptSource) IAssetService assetService, SceneObjectPart part, string scriptName, string scriptSource)
{ {
return AddScript(scene, part, UUID.Random(), UUID.Random(), scriptName, scriptSource); return AddScript(assetService, part, UUID.Random(), UUID.Random(), scriptName, scriptSource);
} }
/// <summary> /// <summary>
@ -127,7 +127,7 @@ namespace OpenSim.Tests.Common
/// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
/// than a random component. /// than a random component.
/// </remarks> /// </remarks>
/// <param name="scene"></param> /// <param name="assetService"></param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="itemId">Item UUID for the script</param> /// <param name="itemId">Item UUID for the script</param>
/// <param name="assetId">Asset UUID for the script</param> /// <param name="assetId">Asset UUID for the script</param>
@ -135,7 +135,7 @@ namespace OpenSim.Tests.Common
/// <param name="scriptSource">LSL script source</param> /// <param name="scriptSource">LSL script source</param>
/// <returns>The item that was added</returns> /// <returns>The item that was added</returns>
public static TaskInventoryItem AddScript( public static TaskInventoryItem AddScript(
Scene scene, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource) IAssetService assetService, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource)
{ {
AssetScriptText ast = new AssetScriptText(); AssetScriptText ast = new AssetScriptText();
ast.Source = scriptSource; ast.Source = scriptSource;
@ -143,7 +143,7 @@ namespace OpenSim.Tests.Common
AssetBase asset AssetBase asset
= AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero); = AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero);
scene.AssetService.Store(asset); assetService.Store(asset);
TaskInventoryItem item TaskInventoryItem item
= new TaskInventoryItem = new TaskInventoryItem
{ Name = scriptName, AssetID = assetId, ItemID = itemId, { Name = scriptName, AssetID = assetId, ItemID = itemId,
@ -153,6 +153,37 @@ namespace OpenSim.Tests.Common
return item; return item;
} }
/// <summary>
/// Add a scene object item to the given part.
/// </summary>
/// <remarks>
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
/// functions more than once in a test.
/// </remarks>
///
/// <param name="assetService"></param>
/// <param name="sop"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="soToAdd"></param>
/// <param name="soAssetId"></param>
public static TaskInventoryItem AddSceneObject(
IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, SceneObjectGroup soToAdd, UUID soAssetId)
{
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(soAssetId, soToAdd);
assetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
{ Name = itemName,
AssetID = taskSceneObjectAsset.FullID,
ItemID = itemId,
OwnerID = soToAdd.OwnerID,
Type = (int)AssetType.Object,
InvType = (int)InventoryType.Object };
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
return taskSceneObjectItem;
}
/// <summary> /// <summary>
/// Add a scene object item to the given part. /// Add a scene object item to the given part.
@ -162,28 +193,18 @@ namespace OpenSim.Tests.Common
/// functions more than once in a test. /// functions more than once in a test.
/// </remarks> /// </remarks>
/// ///
/// <param name="scene"></param> /// <param name="assetService"></param>
/// <param name="sop"></param> /// <param name="sop"></param>
/// <param name="itemName"></param> /// <param name="itemName"></param>
/// <param name="id"></param> /// <param name="id"></param>
/// <param name="userId"></param> /// <param name="userId"></param>
public static TaskInventoryItem AddSceneObject( public static TaskInventoryItem AddSceneObject(
Scene scene, SceneObjectPart sop, string itemName, UUID id, UUID userId) IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, UUID userId)
{ {
SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, userId);
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
scene.AssetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
{ Name = itemName,
AssetID = taskSceneObjectAsset.FullID,
ItemID = id,
OwnerID = userId,
Type = (int)AssetType.Object,
InvType = (int)InventoryType.Object };
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
return taskSceneObjectItem; return TaskInventoryHelpers.AddSceneObject(
assetService, sop, itemName, itemId, taskSceneObject, TestHelpers.ParseTail(0x10));
} }
} }
} }

View File

@ -185,7 +185,7 @@ namespace OpenSim.Tests.Common
public void addInventoryItem(InventoryItemBase item) public void addInventoryItem(InventoryItemBase item)
{ {
// InventoryFolderBase folder = m_folders[item.Folder]; InventoryFolderBase folder = m_folders[item.Folder];
// m_log.DebugFormat( // m_log.DebugFormat(
// "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID); // "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID);

View File

@ -46,20 +46,33 @@ namespace OpenSim.Tests.Common
public XInventoryItem[] GetItems(string[] fields, string[] vals) public XInventoryItem[] GetItems(string[] fields, string[] vals)
{ {
// Console.WriteLine(
// "Requesting items, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList()); List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList());
return origItems.Select(i => i.Clone()).ToArray(); XInventoryItem[] items = origItems.Select(i => i.Clone()).ToArray();
// Console.WriteLine("Found {0} items", items.Length);
// Array.ForEach(items, i => Console.WriteLine("Found item {0} {1}", i.inventoryName, i.inventoryID));
return items;
} }
public XInventoryFolder[] GetFolders(string[] fields, string[] vals) public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
{ {
// Console.WriteLine( // Console.WriteLine(
// "Requesting folders, fields {0}, vals {1}", string.Join(",", fields), string.Join(",", vals)); // "Requesting folders, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
List<XInventoryFolder> origFolders List<XInventoryFolder> origFolders
= Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList()); = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList());
return origFolders.Select(f => f.Clone()).ToArray(); XInventoryFolder[] folders = origFolders.Select(f => f.Clone()).ToArray();
// Console.WriteLine("Found {0} folders", folders.Length);
// Array.ForEach(folders, f => Console.WriteLine("Found folder {0} {1}", f.folderName, f.folderID));
return folders;
} }
public bool StoreFolder(XInventoryFolder folder) public bool StoreFolder(XInventoryFolder folder)
@ -75,7 +88,9 @@ namespace OpenSim.Tests.Common
{ {
m_allItems[item.inventoryID] = item.Clone(); m_allItems[item.inventoryID] = item.Clone();
// Console.WriteLine("Added item {0} {1}, creator {2}, owner {3}", item.inventoryName, item.inventoryID, item.creatorID, item.avatarID); // Console.WriteLine(
// "Added item {0} {1}, folder {2}, creator {3}, owner {4}",
// item.inventoryName, item.inventoryID, item.parentFolderID, item.creatorID, item.avatarID);
return true; return true;
} }

View File

@ -187,12 +187,13 @@
;; YOU HAVE BEEN WARNED!!! ;; YOU HAVE BEEN WARNED!!!
; TrustBinaries = false ; TrustBinaries = false
;# {CombineContiguousRegions} {} {Create megaregions where possible? (Do not use with existing content!)} {true false} false ;# {CombineContiguousRegions} {} {Create megaregions where possible? (Do not use with existing content or varregions!)} {true false} false
;; Combine all contiguous regions into one large megaregion ;; Combine all contiguous regions into one large megaregion
;; Order your regions from South to North, West to East in your regions.ini ;; Order your regions from South to North, West to East in your regions.ini
;; and then set this to true ;; and then set this to true
;; Warning! Don't use this with regions that have existing content!, ;; Warning! Don't use this with regions that have existing content!,
;; This will likely break them ;; This will likely break them
;; Also, this setting should be set to false for varregions as they are proper larger single regions rather than combined smaller regions.
; CombineContiguousRegions = false ; CombineContiguousRegions = false
;# {InworldRestartShutsDown} {} {Shutdown instance on region restart?} {true false} false ;# {InworldRestartShutsDown} {} {Shutdown instance on region restart?} {true false} false

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.