aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2012-03-22 20:36:01 -0700
committerDiva Canto2012-03-22 20:36:01 -0700
commit179c0f5f562ae9d6994dda3c6702a55a79872bda (patch)
treeaf09cf69626cc375ad73b1072399a41c7a578e87 /OpenSim/Region
parentAdded new simple_build_permissions config to the .ini and .example files. (diff)
parentComment out login parameters debug output accidentally included with c4b2d24 (diff)
downloadopensim-SC_OLD-179c0f5f562ae9d6994dda3c6702a55a79872bda.zip
opensim-SC_OLD-179c0f5f562ae9d6994dda3c6702a55a79872bda.tar.gz
opensim-SC_OLD-179c0f5f562ae9d6994dda3c6702a55a79872bda.tar.bz2
opensim-SC_OLD-179c0f5f562ae9d6994dda3c6702a55a79872bda.tar.xz
Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs6
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs168
8 files changed, 219 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index ef9c95c..9cd8f2b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -598,6 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
598 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", 598 "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
599 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); 599 m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
600 } 600 }
601// else
602// {
603// m_log.ErrorFormat(
604// "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}",
605// m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
606// }
601 } 607 }
602 608
603 /// <summary> 609 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 15060fd..1334905 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -155,6 +155,15 @@ namespace OpenSim.Region.Framework.Interfaces
155 TaskInventoryItem GetInventoryItem(UUID itemId); 155 TaskInventoryItem GetInventoryItem(UUID itemId);
156 156
157 /// <summary> 157 /// <summary>
158 /// Get all inventory items.
159 /// </summary>
160 /// <param name="name"></param>
161 /// <returns>
162 /// If there are no inventory items then an empty list is returned.
163 /// </returns>
164 List<TaskInventoryItem> GetInventoryItems();
165
166 /// <summary>
158 /// Get inventory items by name. 167 /// Get inventory items by name.
159 /// </summary> 168 /// </summary>
160 /// <param name="name"></param> 169 /// <param name="name"></param>
@@ -162,7 +171,7 @@ namespace OpenSim.Region.Framework.Interfaces
162 /// A list of inventory items with that name. 171 /// A list of inventory items with that name.
163 /// If no inventory item has that name then an empty list is returned. 172 /// If no inventory item has that name then an empty list is returned.
164 /// </returns> 173 /// </returns>
165 IList<TaskInventoryItem> GetInventoryItems(string name); 174 List<TaskInventoryItem> GetInventoryItems(string name);
166 175
167 /// <summary> 176 /// <summary>
168 /// Get the scene object referenced by an inventory item. 177 /// Get the scene object referenced by an inventory item.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 23f39a8..2ca9353 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
1210 /// <summary> 1210 /// <summary>
1211 /// Copy a task (prim) inventory item to another task (prim) 1211 /// Copy a task (prim) inventory item to another task (prim)
1212 /// </summary> 1212 /// </summary>
1213 /// <param name="destId"></param> 1213 /// <param name="destId">ID of destination part</param>
1214 /// <param name="part"></param> 1214 /// <param name="part">Source part</param>
1215 /// <param name="itemId"></param> 1215 /// <param name="itemId">Source item id to transfer</param>
1216 public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) 1216 public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
1217 { 1217 {
1218 TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); 1218 TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);
@@ -1238,24 +1238,21 @@ namespace OpenSim.Region.Framework.Scenes
1238 return; 1238 return;
1239 } 1239 }
1240 1240
1241 // Can't transfer this 1241 if (part.OwnerID != destPart.OwnerID)
1242 //
1243 if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
1244 return;
1245
1246 if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1247 { 1242 {
1248 // object cannot copy items to an object owned by a different owner 1243 // Source must have transfer permissions
1249 // unless llAllowInventoryDrop has been called 1244 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
1245 return;
1250 1246
1251 return; 1247 // Object cannot copy items to an object owned by a different owner
1248 // unless llAllowInventoryDrop has been called on the destination
1249 if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
1250 return;
1252 } 1251 }
1253 1252
1254 // must have both move and modify permission to put an item in an object 1253 // must have both move and modify permission to put an item in an object
1255 if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) 1254 if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0)
1256 {
1257 return; 1255 return;
1258 }
1259 1256
1260 TaskInventoryItem destTaskItem = new TaskInventoryItem(); 1257 TaskInventoryItem destTaskItem = new TaskInventoryItem();
1261 1258
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f2d1915..71a9084 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -590,9 +590,9 @@ namespace OpenSim.Region.Framework.Scenes
590 /// A list of inventory items with that name. 590 /// A list of inventory items with that name.
591 /// If no inventory item has that name then an empty list is returned. 591 /// If no inventory item has that name then an empty list is returned.
592 /// </returns> 592 /// </returns>
593 public IList<TaskInventoryItem> GetInventoryItems(string name) 593 public List<TaskInventoryItem> GetInventoryItems(string name)
594 { 594 {
595 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); 595 List<TaskInventoryItem> items = new List<TaskInventoryItem>();
596 596
597 lock (m_items) 597 lock (m_items)
598 { 598 {
@@ -1100,7 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes
1100 1100
1101 public List<TaskInventoryItem> GetInventoryItems() 1101 public List<TaskInventoryItem> GetInventoryItems()
1102 { 1102 {
1103 List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); 1103 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
1104 1104
1105 lock (m_items) 1105 lock (m_items)
1106 ret = new List<TaskInventoryItem>(m_items.Values); 1106 ret = new List<TaskInventoryItem>(m_items.Values);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index e4b607d..f946b00 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Tests
114 } 114 }
115 115
116 /// <summary> 116 /// <summary>
117 /// Test MoveTaskInventoryItem where the item has no parent folder assigned. 117 /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
118 /// </summary> 118 /// </summary>
119 /// <remarks> 119 /// <remarks>
120 /// This should place it in the most suitable user folder. 120 /// This should place it in the most suitable user folder.
@@ -143,9 +143,11 @@ namespace OpenSim.Region.Framework.Tests
143 } 143 }
144 144
145 /// <summary> 145 /// <summary>
146 /// Test MoveTaskInventoryItem where the item has no parent folder assigned. 146 /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
147 /// </summary> 147 /// </summary>
148 /// <remarks>
148 /// This should place it in the most suitable user folder. 149 /// This should place it in the most suitable user folder.
150 /// </remarks>
149 [Test] 151 [Test]
150 public void TestMoveTaskInventoryItemNoParent() 152 public void TestMoveTaskInventoryItemNoParent()
151 { 153 {
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 6f6ed7f..3bd15ce 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -358,7 +358,7 @@ namespace OpenSim.Region.Physics.Meshing
358 358
359 if (physicsParms == null) 359 if (physicsParms == null)
360 { 360 {
361 m_log.Warn("[MESH]: no recognized physics mesh found in mesh asset"); 361 m_log.WarnFormat("[MESH]: No recognized physics mesh found in mesh asset for {0}", primName);
362 return false; 362 return false;
363 } 363 }
364 364
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 97890ee..1f79cd8 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -842,17 +842,23 @@ namespace OpenSim.Region.Physics.OdePlugin
842 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage 842 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
843 843
844 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory 844 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
845 if (m_MeshToTriMeshMap.ContainsKey(mesh))
846 {
847 _triMeshData = m_MeshToTriMeshMap[mesh];
848 }
849 else
850 {
851 _triMeshData = d.GeomTriMeshDataCreate();
852 845
853 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); 846 // We must lock here since m_MeshToTriMeshMap is static and multiple scene threads may call this method at
854 d.GeomTriMeshDataPreprocess(_triMeshData); 847 // the same time.
855 m_MeshToTriMeshMap[mesh] = _triMeshData; 848 lock (m_MeshToTriMeshMap)
849 {
850 if (m_MeshToTriMeshMap.ContainsKey(mesh))
851 {
852 _triMeshData = m_MeshToTriMeshMap[mesh];
853 }
854 else
855 {
856 _triMeshData = d.GeomTriMeshDataCreate();
857
858 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
859 d.GeomTriMeshDataPreprocess(_triMeshData);
860 m_MeshToTriMeshMap[mesh] = _triMeshData;
861 }
856 } 862 }
857 863
858// _parent_scene.waitForSpaceUnlock(m_targetSpace); 864// _parent_scene.waitForSpaceUnlock(m_targetSpace);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
new file mode 100644
index 0000000..e2d0db2
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -0,0 +1,168 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData;
38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47
48namespace OpenSim.Region.ScriptEngine.Shared.Tests
49{
50 /// <summary>
51 /// Tests for inventory functions in LSL
52 /// </summary>
53 [TestFixture]
54 public class LSL_ApiInventoryTests
55 {
56 protected Scene m_scene;
57 protected XEngine.XEngine m_engine;
58
59 [SetUp]
60 public void SetUp()
61 {
62 IConfigSource initConfigSource = new IniConfigSource();
63 IConfig config = initConfigSource.AddConfig("XEngine");
64 config.Set("Enabled", "true");
65
66 m_scene = SceneHelpers.SetupScene();
67 SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
68
69 m_engine = new XEngine.XEngine();
70 m_engine.Initialise(initConfigSource);
71 m_engine.AddRegion(m_scene);
72 }
73
74 /// <summary>
75 /// Test giving inventory from an object to an object where both are owned by the same user.
76 /// </summary>
77 [Test]
78 public void TestLlGiveInventoryO2OSameOwner()
79 {
80 TestHelpers.InMethod();
81// log4net.Config.XmlConfigurator.Configure();
82
83 UUID userId = TestHelpers.ParseTail(0x1);
84 string inventoryItemName = "item1";
85
86 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "so1", 0x10);
87 m_scene.AddSceneObject(so1);
88
89 // Create an object embedded inside the first
90 UUID itemId = TestHelpers.ParseTail(0x20);
91 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
92
93 LSL_Api api = new LSL_Api();
94 api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
95
96 // Create a second object
97 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
98 m_scene.AddSceneObject(so2);
99
100 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
101
102 // Item has copy permissions so original should stay intact.
103 List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
104 Assert.That(originalItems.Count, Is.EqualTo(1));
105
106 List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
107 Assert.That(copiedItems.Count, Is.EqualTo(1));
108 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
109 }
110
111 /// <summary>
112 /// Test giving inventory from an object to an object where they have different owners
113 /// </summary>
114 [Test]
115 public void TestLlGiveInventoryO2ODifferentOwners()
116 {
117 TestHelpers.InMethod();
118// log4net.Config.XmlConfigurator.Configure();
119
120 UUID user1Id = TestHelpers.ParseTail(0x1);
121 UUID user2Id = TestHelpers.ParseTail(0x2);
122 string inventoryItemName = "item1";
123
124 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
125 m_scene.AddSceneObject(so1);
126 LSL_Api api = new LSL_Api();
127 api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
128
129 // Create an object embedded inside the first
130 UUID itemId = TestHelpers.ParseTail(0x20);
131 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
132
133 // Create a second object
134 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
135 m_scene.AddSceneObject(so2);
136 LSL_Api api2 = new LSL_Api();
137 api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID);
138
139 // *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
140 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
141
142 {
143 // Item has copy permissions so original should stay intact.
144 List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
145 Assert.That(originalItems.Count, Is.EqualTo(1));
146
147 // Should have not copied
148 List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
149 Assert.That(copiedItems.Count, Is.EqualTo(0));
150 }
151
152 // *** Secondly, we turn on allow inventory drop in the target and retest. ***
153 api2.llAllowInventoryDrop(1);
154 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
155
156 {
157 // Item has copy permissions so original should stay intact.
158 List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
159 Assert.That(originalItems.Count, Is.EqualTo(1));
160
161 // Should now have copied.
162 List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
163 Assert.That(copiedItems.Count, Is.EqualTo(1));
164 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
165 }
166 }
167 }
168} \ No newline at end of file