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
* eeyore
* FredoChaplin
* FreakyTech
* Garmin Kawaguichi
* Gerhard
* Godfrey
@ -128,6 +129,7 @@ what it is today.
* LuciusSirnah
* lulurun
* M.Igarashi
* Magnuz Binder
* maimedleech
* Mana Janus
* MarcelEdward

View File

@ -144,6 +144,8 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
//group = m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName);
group = d();
@ -151,10 +153,14 @@ namespace OpenSim.Groups
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, group, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (ExtendedGroupRecord)group;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -243,16 +249,22 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
membership = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (ExtendedGroupMembershipData)membership;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -286,15 +298,21 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
membership = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (ExtendedGroupMembershipData)membership;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -327,15 +345,21 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
memberships = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, memberships, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (List<GroupMembershipData>)memberships;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -369,6 +393,8 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
List<ExtendedGroupMembersData> _members = d();
@ -381,11 +407,15 @@ namespace OpenSim.Groups
{
//m_Cache.AddOrUpdate(cacheKey, members, GROUPS_CACHE_TIMEOUT);
m_Cache.AddOrUpdate(cacheKey, _members, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (List<GroupMembersData>)members;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -497,6 +527,8 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
roles = d();
if (roles != null)
@ -504,11 +536,15 @@ namespace OpenSim.Groups
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (List<GroupRolesData>)roles;
}
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -541,6 +577,8 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
List<ExtendedGroupRoleMembersData> _rmembers = d();
@ -557,10 +595,14 @@ namespace OpenSim.Groups
// 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);
return (List<GroupRoleMembersData>)rmembers;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -666,6 +708,8 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
roles = d();
lock (m_Cache)
@ -675,6 +719,11 @@ namespace OpenSim.Groups
return (List<GroupRolesData>)roles;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -767,16 +816,22 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
GroupNoticeInfo _notice = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, _notice, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return _notice;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
@ -809,21 +864,25 @@ namespace OpenSim.Groups
}
if (firstCall)
{
try
{
notices = d();
lock (m_Cache)
{
m_Cache.AddOrUpdate(cacheKey, notices, GROUPS_CACHE_TIMEOUT);
m_ActiveRequests.Remove(cacheKey);
return (List<ExtendedGroupNoticeData>)notices;
}
}
finally
{
m_ActiveRequests.Remove(cacheKey);
}
}
else
Thread.Sleep(50);
}
}
}
}

View File

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

View File

@ -78,7 +78,7 @@ namespace OpenSim.Framework.Monitoring
private BlockingCollection<Job> m_jobQueue;
private CancellationTokenSource m_cancelSource = new CancellationTokenSource();
private CancellationTokenSource m_cancelSource;
/// <summary>
/// Used to signal that we are ready to complete stop.
@ -105,6 +105,7 @@ namespace OpenSim.Framework.Monitoring
m_finishedProcessingAfterStop.Reset();
m_jobQueue = new BlockingCollection<Job>(new ConcurrentQueue<Job>(), 5000);
m_cancelSource = new CancellationTokenSource();
WorkManager.StartThread(
ProcessRequests,
@ -160,7 +161,6 @@ namespace OpenSim.Framework.Monitoring
finally
{
m_cancelSource.Dispose();
m_jobQueue = null;
}
}
}
@ -248,8 +248,20 @@ namespace OpenSim.Framework.Monitoring
try
{
while (IsRunning || m_jobQueue.Count > 0)
{
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)
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.Specialized;
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.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 Nini.Config;

View File

@ -420,6 +420,22 @@ namespace OpenSim.Framework
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)
public static bool InRange<T>(T x, T min, T max)
where T : IComparable<T>

View File

@ -772,9 +772,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
catch (Exception e)
{
// Make sure that we see any exception caused by the asynchronous operation.
m_log.ErrorFormat(
"[LLCLIENTVIEW]: Caught exception while processing {0} for {1}, {2} {3}",
packetObject.Pack, Name, e.Message, e.StackTrace);
m_log.Error(
string.Format(
"[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packetObject.Pack, Name),
e);
}
}
@ -9903,6 +9904,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
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:
m_log.WarnFormat(
"[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);
TaskInventoryItem scriptItem
= TaskInventoryHelpers.AddScript(
scene,
scene.AssetService,
so.RootPart,
"scriptItem",
"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);
TaskInventoryItem scriptTaskItem
= TaskInventoryHelpers.AddScript(
scene,
scene.AssetService,
so.RootPart,
"scriptItem",
"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
if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered)
|| (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered)
|| (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
|| (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
|| (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined)))

View File

@ -318,8 +318,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
writer.WriteString(reader.Value);
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:
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;
}
}
@ -336,8 +343,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
TransformXml(reader, writer);
writer.WriteEndDocument();
// Console.WriteLine("Output: [{0}]", sw.ToString());
return sw.ToString();
@ -478,12 +483,37 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
asset = m_scene.AssetService.Get(uuid.ToString());
if (asset == null)
{
m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid);
else
success &= PostAsset(userAssetURL, asset);
}
else
m_log.DebugFormat("[HG ASSET MAPPER]: Didn't post asset {0} because it already exists in asset server {1}", uuid, userAssetURL);
{
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
{
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)

View File

@ -614,6 +614,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected InventoryItemBase CreateItemForObject(
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
//
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
if (IsFriendWithPerms(currentUser, objectOwner))
{
// Return immediately, so that the administrator can share objects with friends
return true;
}
// Users should be able to edit what is over their land.
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;
bool permission = GenericObjectPermission(userID, objectID, false);
SceneObjectGroup so = (SceneObjectGroup)m_scene.Entities[objectID];
if (!permission)
{
if (!m_scene.Entities.ContainsKey(objectID))
@ -1535,31 +1540,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
// UUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
// UUID objectOwner = task.OwnerID;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
if ((so.RootPart.EveryoneMask & PERM_COPY) != 0)
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;
}
else
{
if ((task.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
permission = false;
}
}
else
{
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
if ((so.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
permission = false;
}

View File

@ -27,6 +27,7 @@
using System;
using System.IO;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@ -73,12 +74,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
public ITerrainChannel LoadFile(string 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)
@ -86,9 +88,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight);
FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.Open, FileAccess.Read);
BinaryReader bs = new BinaryReader(s);
using (FileStream s = file.Open(FileMode.Open, FileAccess.Read))
using (BinaryReader bs = new BinaryReader(s))
{
int currFileYOffset = fileHeight - 1;
// if our region isn't on the first Y section of the areas to be landscaped, then
@ -104,6 +107,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
// got to the Y start offset within the file of our region
// so read the file bits associated with our region
int y;
// for each Y within our Y offset
for (y = sectionHeight - 1; y >= 0; y--)
{
@ -138,18 +142,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
currFileXOffset++;
}
}
bs.Close();
s.Close();
}
return retval;
}
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);
using (BinaryReader bs = new BinaryReader(s))
{
int y;
for (y = 0; y < retval.Height; y++)
{
@ -160,8 +171,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
bs.ReadBytes(11); // Advance the stream to next bytes.
}
}
bs.Close();
}
return retval;
}
@ -169,16 +179,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
public void SaveFile(string filename, ITerrainChannel map)
{
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)
{
BinaryWriter binStream = new BinaryWriter(s);
using (BinaryWriter binStream = new BinaryWriter(s))
{
// Output the calculated raw
for (int y = 0; y < map.Height; y++)
{
@ -231,8 +240,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
binStream.Write(alpha10);
}
}
binStream.Close();
}
}
public string FileExtension
@ -260,6 +268,5 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{
return false;
}
}
}

View File

@ -217,8 +217,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
if (regionInfos.Count == 0)
remoteClient.SendAlertMessage("No regions found with that name.");
else if (regionInfos.Count == 1)
remoteClient.SendAlertMessage("Region found!");
// this seems unnecessary because found regions will show up in the search results
//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)
{
//// Retrieve the folder from the sender
InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId));
InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId));
if (null == folder)
{
m_log.ErrorFormat(

View File

@ -265,6 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; 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;
perms &= part.Inventory.MaskEffectivePermissions();
}

View File

@ -924,13 +924,17 @@ namespace OpenSim.Region.Framework.Scenes
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)
{
// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name);
UUID itemid = new UUID(uuid);
if (itemid != UUID.Zero)
m_savedScriptState[itemid] = reader.ReadInnerXml();
m_savedScriptState[itemid] = innerXml;
}
else
{
@ -2943,6 +2947,11 @@ namespace OpenSim.Region.Framework.Scenes
uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
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();
}

View File

@ -266,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes
public Quaternion SpinOldOrientation = Quaternion.Identity;
protected int m_APIDIterations = 0;
protected bool m_APIDActive = false;
protected Quaternion m_APIDTarget = Quaternion.Identity;
protected float m_APIDDamp = 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
{
get { return m_APIDTarget; }
@ -923,6 +929,9 @@ namespace OpenSim.Region.Framework.Scenes
set
{
if (Util.IsNanOrInfinity(value))
m_velocity = Vector3.Zero;
else
m_velocity = value;
PhysicsActor actor = PhysActor;
@ -930,7 +939,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (actor.IsPhysical)
{
actor.Velocity = value;
actor.Velocity = m_velocity;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
}
}
@ -957,14 +966,30 @@ namespace OpenSim.Region.Framework.Scenes
}
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>
public Vector3 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; }
@ -2610,7 +2635,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
m_APIDIterations = 1 + (int)(Math.PI * APIDStrength);
APIDActive = true;
}
// Necessary to get the lookat deltas applied
@ -2624,7 +2649,7 @@ namespace OpenSim.Region.Framework.Scenes
public void StopLookAt()
{
APIDTarget = Quaternion.Identity;
APIDActive = false;
}
@ -4873,20 +4898,44 @@ namespace OpenSim.Region.Framework.Scenes
{
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);
APIDTarget = Quaternion.Identity;
StopLookAt();
return;
}
Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations);
rot.Normalize();
UpdateRotation(rot);
Quaternion currRot = GetWorldRotation();
currRot.Normalize();
m_APIDIterations--;
// difference between current orientation and desired orientation
Quaternion dR = new Quaternion(currRot.X, currRot.Y, currRot.Z, -currRot.W) * APIDTarget;
// 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
ParentGroup.QueueForUpdateCheck();

View File

@ -378,6 +378,11 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
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>
/// Is the agent stop control flag currently active?
/// </summary>
@ -822,7 +827,7 @@ namespace OpenSim.Region.Framework.Scenes
}
private bool m_mouseLook;
private bool m_leftButtonDown;
// private bool m_leftButtonDown;
private bool m_inTransit;
@ -1005,23 +1010,6 @@ namespace OpenSim.Region.Framework.Scenes
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
#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
// stall on the border crossing since the existing child agent will still have the last movement
// recorded, which stops the input from being processed.
MovementFlag = 0;
MovementFlag = ForceUpdateMovementFlagValue;
m_scene.EventManager.TriggerOnMakeRootAgent(this);
@ -1925,13 +1913,13 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
//m_log.DebugFormat(
// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
// m_log.DebugFormat(
// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
// Scene.Name, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
if (IsChildAgent)
{
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
// m_log.DebugFormat("DEBUG: HandleAgentUpdate: child agent in {0}", Scene.Name);
return;
}
@ -1973,7 +1961,12 @@ namespace OpenSim.Region.Framework.Scenes
// DrawDistance = Scene.DefaultDrawDistance;
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
@ -2066,6 +2059,14 @@ namespace OpenSim.Region.Framework.Scenes
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)
{
MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
@ -2097,15 +2098,6 @@ namespace OpenSim.Region.Framework.Scenes
{
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.
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
{
@ -2115,7 +2107,9 @@ namespace OpenSim.Region.Framework.Scenes
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]);
}
catch (IndexOutOfRangeException)
@ -3149,7 +3143,17 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
// 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();
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
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);
Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Tests
// Create an object embedded inside the first
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
TaskInventoryItem taskSceneObjectItem
= TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
= TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
scene.AddSceneObject(sog1);
@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1
= 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
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1
= 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
string message;

View File

@ -120,5 +120,39 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId));
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))
return false;
// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
m_assetUuidsToInspect.Enqueue(uuid);
return true;
@ -238,7 +240,11 @@ namespace OpenSim.Region.Framework.Scenes
if (Complete)
return false;
GetAssetUuids(m_assetUuidsToInspect.Dequeue());
UUID nextToInspect = m_assetUuidsToInspect.Dequeue();
// m_log.DebugFormat("[UUID GATHERER]: Inspecting asset {0}", nextToInspect);
GetAssetUuids(nextToInspect);
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
try
{
GatheredUuids[assetUuid] = assetType;
if ((sbyte)AssetType.Bodypart == assetType
|| (sbyte)AssetType.Clothing == assetType
|| (sbyte)AssetType.Gesture == assetType
@ -334,11 +338,15 @@ namespace OpenSim.Region.Framework.Scenes
{
AddForInspection(assetUuid);
}
else
{
GatheredUuids[assetUuid] = assetType;
}
}
catch (Exception)
{
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);
throw;
}

View File

@ -70,14 +70,13 @@ namespace OpenSim.Region.OptionalModules.Materials
public void Initialise(IConfigSource source)
{
m_enabled = true; // default is enabled
IConfig config = source.Configs["Materials"];
if (config == null)
return;
m_enabled = config.GetBoolean("enable_materials", true);
if (!m_enabled)
return;
if (config != null)
m_enabled = config.GetBoolean("enable_materials", m_enabled);
if (m_enabled)
m_log.DebugFormat("[Materials]: Initialized");
}

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>
/// Stop a prim from being subject to physics.
/// </summary>
@ -2645,6 +2653,7 @@ Console.WriteLine(" JointCreateFixed");
if (value.IsFinite())
{
m_rotationalVelocity = value;
setAngularVelocity(value.X, value.Y, value.Z);
}
else
{

View File

@ -3092,26 +3092,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Determine where we are looking from
LSL_Vector from = llGetPos();
// Work out the normalised vector from the source to the target
LSL_Vector delta = llVecNorm(target - from);
LSL_Vector angle = new LSL_Vector(0,0,0);
// normalized direction to target
LSL_Vector dir = llVecNorm(target - from);
// 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
// subtracting PI_BY_TWO is required to compensate for the odd SL co-ordinate system
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);
// compute rotation based on orthogonal axes
LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior
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);
}
@ -9012,7 +9009,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Vector(textColor.R,
textColor.G,
textColor.B));
res.Add(new LSL_Float(textColor.A));
res.Add(new LSL_Float(1.0 - textColor.A));
break;
case (int)ScriptBaseClass.PRIM_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);
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.
// 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
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();
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
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
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
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);
@ -223,7 +223,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
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);
UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
@ -251,7 +251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(sourceSo);
LSL_Api api = new LSL_Api();
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 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)
TaskInventoryItem grp1Item
= 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;
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)
TaskInventoryItem grp1Item
= 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;
@ -155,7 +155,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// FIXME: This should really be a script item (with accompanying script)
TaskInventoryItem grp1Item
= 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;

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine);
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.
// 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" };
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, 2, ncLines[2]);
@ -102,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
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);
}

View File

@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
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();
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);
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, 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);
OSSL_Api osslApi = new OSSL_Api();
@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
// 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);
@ -142,7 +142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, 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);
OSSL_Api osslApi = new OSSL_Api();
@ -150,7 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first
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;
@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1);
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);
OSSL_Api osslApi = new OSSL_Api();
@ -198,7 +198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first
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);

View File

@ -114,7 +114,7 @@ namespace OpenSim.Region.ScriptEngine.Tests
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
TaskInventoryHelpers.AddScript(
scene,
scene.AssetService,
so.RootPart,
"scriptItem",
"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)
{
string reply = string.Empty;
// /estates/estate/
string uri = m_ServerURI + ("/estates/estate");
@ -260,7 +259,6 @@ namespace OpenSim.Service.Connectors
public bool LinkRegion(UUID regionID, int estateID)
{
string reply = string.Empty;
// /estates/estate/?eid=int&region=uuid
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>
/// Add a notecard item to the given part.
/// </summary>
/// <param name="scene"></param>
/// <param name="assetService"></param>
/// <param name="part"></param>
/// <param name="itemName"></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>
/// <returns>The item that was added</returns>
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(
scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text);
assetService, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text);
}
/// <summary>
/// Add a notecard item to the given part.
/// </summary>
/// <param name="scene"></param>
/// <param name="assetService"></param>
/// <param name="part"></param>
/// <param name="itemName"></param>
/// <param name="itemID"></param>
@ -68,7 +68,7 @@ namespace OpenSim.Tests.Common
/// <param name="text">The tex to put in the notecard.</param>
/// <returns>The item that was added</returns>
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();
nc.BodyText = text;
@ -76,7 +76,7 @@ namespace OpenSim.Tests.Common
AssetBase ncAsset
= AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero);
scene.AssetService.Store(ncAsset);
assetService.Store(ncAsset);
TaskInventoryItem ncItem
= 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
/// functions more than once in a test.
/// </remarks>
/// <param name="scene"></param>
/// <param name="assetService"></param>
/// <param name="part"></param>
/// <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>
@ -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
/// than a random component.
/// </remarks>
/// <param name="scene"></param>
/// <param name="assetService"></param>
/// <param name="part"></param>
/// <param name="scriptName">Name of the script to add</param>
/// <param name="scriptSource">LSL script source</param>
/// <returns>The item that was added</returns>
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>
@ -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
/// than a random component.
/// </remarks>
/// <param name="scene"></param>
/// <param name="assetService"></param>
/// <param name="part"></param>
/// <param name="itemId">Item 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>
/// <returns>The item that was added</returns>
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();
ast.Source = scriptSource;
@ -143,7 +143,7 @@ namespace OpenSim.Tests.Common
AssetBase asset
= AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero);
scene.AssetService.Store(asset);
assetService.Store(asset);
TaskInventoryItem item
= new TaskInventoryItem
{ Name = scriptName, AssetID = assetId, ItemID = itemId,
@ -153,6 +153,37 @@ namespace OpenSim.Tests.Common
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>
/// Add a scene object item to the given part.
@ -162,28 +193,18 @@ namespace OpenSim.Tests.Common
/// functions more than once in a test.
/// </remarks>
///
/// <param name="scene"></param>
/// <param name="assetService"></param>
/// <param name="sop"></param>
/// <param name="itemName"></param>
/// <param name="id"></param>
/// <param name="userId"></param>
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);
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);
SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, userId);
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)
{
// InventoryFolderBase folder = m_folders[item.Folder];
InventoryFolderBase folder = m_folders[item.Folder];
// m_log.DebugFormat(
// "[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)
{
// 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());
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)
{
// 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
= 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)
@ -75,7 +88,9 @@ namespace OpenSim.Tests.Common
{
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;
}

View File

@ -187,12 +187,13 @@
;; YOU HAVE BEEN WARNED!!!
; 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
;; Order your regions from South to North, West to East in your regions.ini
;; and then set this to true
;; Warning! Don't use this with regions that have existing content!,
;; 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
;# {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.