aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorUbitUmarov2012-02-10 23:03:30 +0000
committerUbitUmarov2012-02-10 23:03:30 +0000
commite3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7 (patch)
tree0fff77027caf8e6ba723489c45e0cf1cb77bb0ec /OpenSim/Region/Framework
parent Changes to vehicles code etc. Includes some debug aids to remove later. (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.zip
opensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.tar.gz
opensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.tar.bz2
opensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Conflicts: prebuild.xml
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs23
6 files changed, 66 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 2731291..dc3ff89 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
58 /// </param> 58 /// </param>
59 /// <param name="scene"></param> 59 /// <param name="scene"></param>
60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param> 60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param>
61 /// <returns>The UUID of the ScenePresence created.</returns> 61 /// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
62 UUID CreateNPC( 62 UUID CreateNPC(
63 string firstname, 63 string firstname,
64 string lastname, 64 string lastname,
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 58de44e..fff39fb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -330,6 +330,12 @@ namespace OpenSim.Region.Framework.Scenes
330 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); 330 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255);
331 item.Name = itemUpd.Name; 331 item.Name = itemUpd.Name;
332 item.Description = itemUpd.Description; 332 item.Description = itemUpd.Description;
333
334// m_log.DebugFormat(
335// "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}",
336// itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags,
337// item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions);
338
333 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) 339 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
334 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; 340 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
335 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 341 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
@@ -338,6 +344,9 @@ namespace OpenSim.Region.Framework.Scenes
338 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 344 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
339 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) 345 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
340 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; 346 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
347
348// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
349
341 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 350 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
342 item.GroupID = itemUpd.GroupID; 351 item.GroupID = itemUpd.GroupID;
343 item.GroupOwned = itemUpd.GroupOwned; 352 item.GroupOwned = itemUpd.GroupOwned;
@@ -2310,8 +2319,25 @@ namespace OpenSim.Region.Framework.Scenes
2310 m_sceneGraph.DelinkObjects(parts); 2319 m_sceneGraph.DelinkObjects(parts);
2311 } 2320 }
2312 2321
2322 /// <summary>
2323 /// Link the scene objects containing the indicated parts to a root object.
2324 /// </summary>
2325 /// <param name="client"></param>
2326 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2327 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2313 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) 2328 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
2314 { 2329 {
2330 LinkObjects(client.AgentId, parentPrimId, childPrimIds);
2331 }
2332
2333 /// <summary>
2334 /// Link the scene objects containing the indicated parts to a root object.
2335 /// </summary>
2336 /// <param name="agentId">The ID of the user linking.</param>
2337 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2338 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2339 public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds)
2340 {
2315 List<UUID> owners = new List<UUID>(); 2341 List<UUID> owners = new List<UUID>();
2316 2342
2317 List<SceneObjectPart> children = new List<SceneObjectPart>(); 2343 List<SceneObjectPart> children = new List<SceneObjectPart>();
@@ -2323,7 +2349,7 @@ namespace OpenSim.Region.Framework.Scenes
2323 return; 2349 return;
2324 } 2350 }
2325 2351
2326 if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) 2352 if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID))
2327 { 2353 {
2328 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim"); 2354 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim");
2329 return; 2355 return;
@@ -2339,7 +2365,7 @@ namespace OpenSim.Region.Framework.Scenes
2339 if (!owners.Contains(part.OwnerID)) 2365 if (!owners.Contains(part.OwnerID))
2340 owners.Add(part.OwnerID); 2366 owners.Add(part.OwnerID);
2341 2367
2342 if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) 2368 if (Permissions.CanLinkObject(agentId, part.ParentGroup.RootPart.UUID))
2343 children.Add(part); 2369 children.Add(part);
2344 } 2370 }
2345 2371
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 17563bd..6dd42dd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1751,6 +1751,10 @@ namespace OpenSim.Region.Framework.Scenes
1751 { 1751 {
1752 SceneObjectGroup child = children[i].ParentGroup; 1752 SceneObjectGroup child = children[i].ParentGroup;
1753 1753
1754 // Don't try and add a group to itself - this will only cause severe problems later on.
1755 if (child == parentGroup)
1756 continue;
1757
1754 // Make sure no child prim is set for sale 1758 // Make sure no child prim is set for sale
1755 // So that, on delink, no prims are unwittingly 1759 // So that, on delink, no prims are unwittingly
1756 // left for sale and sold off 1760 // left for sale and sold off
@@ -1777,8 +1781,13 @@ namespace OpenSim.Region.Framework.Scenes
1777 1781
1778 // We need to explicitly resend the newly link prim's object properties since no other actions 1782 // We need to explicitly resend the newly link prim's object properties since no other actions
1779 // occur on link to invoke this elsewhere (such as object selection) 1783 // occur on link to invoke this elsewhere (such as object selection)
1780 parentGroup.RootPart.CreateSelected = true; 1784 if (childGroups.Count > 0)
1781 parentGroup.TriggerScriptChangedEvent(Changed.LINK); 1785 {
1786 parentGroup.RootPart.CreateSelected = true;
1787 parentGroup.TriggerScriptChangedEvent(Changed.LINK);
1788 parentGroup.HasGroupChanged = true;
1789 parentGroup.ScheduleGroupForFullUpdate();
1790 }
1782 } 1791 }
1783 finally 1792 finally
1784 { 1793 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index b56d3fc..f3660a5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -269,6 +269,8 @@ namespace OpenSim.Region.Framework.Scenes
269 269
270 public void ApplyNextOwnerPermissions() 270 public void ApplyNextOwnerPermissions()
271 { 271 {
272// m_log.DebugFormat("[PRIM INVENTORY]: Applying next owner permissions to {0} {1}", Name, UUID);
273
272 SceneObjectPart[] parts = m_parts.GetArray(); 274 SceneObjectPart[] parts = m_parts.GetArray();
273 for (int i = 0; i < parts.Length; i++) 275 for (int i = 0; i < parts.Length; i++)
274 parts[i].ApplyNextOwnerPermissions(); 276 parts[i].ApplyNextOwnerPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 2a3d735..9961438 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2377,6 +2377,10 @@ namespace OpenSim.Region.Framework.Scenes
2377// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", 2377// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
2378// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); 2378// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
2379 2379
2380 // Linking to ourselves is not a valid operation.
2381 if (objectGroup == this)
2382 return;
2383
2380 SceneObjectPart linkPart = objectGroup.m_rootPart; 2384 SceneObjectPart linkPart = objectGroup.m_rootPart;
2381 2385
2382 Vector3 oldGroupPosition = linkPart.GroupPosition; 2386 Vector3 oldGroupPosition = linkPart.GroupPosition;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index a2332bb..be5b4a8 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -39,14 +39,31 @@ using log4net;
39 39
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 /// <summary>
43 /// Linking tests
44 /// </summary>
45 [TestFixture] 42 [TestFixture]
46 public class SceneObjectLinkingTests 43 public class SceneObjectLinkingTests
47 { 44 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 46
47 /// <summary>
48 /// Links to self should be ignored.
49 /// </summary>
50 [Test]
51 public void TestLinkToSelf()
52 {
53 TestHelpers.InMethod();
54
55 UUID ownerId = TestHelpers.ParseTail(0x1);
56 int nParts = 3;
57
58 TestScene scene = SceneHelpers.SetupScene();
59 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10);
60 scene.AddSceneObject(sog1);
61 scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId });
62// sog1.LinkToGroup(sog1);
63
64 Assert.That(sog1.Parts.Length, Is.EqualTo(nParts));
65 }
66
50 [Test] 67 [Test]
51 public void TestLinkDelink2SceneObjects() 68 public void TestLinkDelink2SceneObjects()
52 { 69 {