diff options
author | Melanie Thielker | 2008-07-19 04:05:34 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-07-19 04:05:34 +0000 |
commit | bcf74416a1677584c069e4e0b9acf9015d8c5b6c (patch) | |
tree | 8c0b967fafbc21e93974760c0b32a0dd2119b930 /OpenSim/Region/Environment | |
parent | Introduce a separate connection string for estates, which defaults to the one gi (diff) | |
download | opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.zip opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.gz opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.bz2 opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.xz |
Fix prim link numbers (Mantis #1781)
Implements additional unlink modes (unlink root prim from link set, some
multi-set operations). Linking (single and mutiple) fully implemented.
Consistent numbering of links while in world. Link/delink with predictable
link numbering. Correct link numbers in LSL.
Not all multi-set ops implemented. Link numbers still change when taken and
re-rezzed.
Diffstat (limited to '')
4 files changed, 127 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index ab0adf2..3996fb3 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | |||
@@ -558,10 +558,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
558 | args.regionFlags = GetRegionFlags(); | 558 | args.regionFlags = GetRegionFlags(); |
559 | args.regionName = m_scene.RegionInfo.RegionName; | 559 | args.regionName = m_scene.RegionInfo.RegionName; |
560 | args.SimOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 560 | args.SimOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
561 | args.terrainBase0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; | 561 | args.terrainBase0 = LLUUID.Zero; |
562 | args.terrainBase1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; | 562 | args.terrainBase1 = LLUUID.Zero; |
563 | args.terrainBase2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; | 563 | args.terrainBase2 = LLUUID.Zero; |
564 | args.terrainBase3 = m_scene.RegionInfo.RegionSettings.TerrainTexture4; | 564 | args.terrainBase3 = LLUUID.Zero; |
565 | args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; | 565 | args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; |
566 | args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; | 566 | args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; |
567 | args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; | 567 | args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; |
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 7e8259f..57d3e5c 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -1372,7 +1372,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
1372 | 1372 | ||
1373 | // We need to explicitly resend the newly link prim's object properties since no other actions | 1373 | // We need to explicitly resend the newly link prim's object properties since no other actions |
1374 | // occur on link to invoke this elsewhere (such as object selection) | 1374 | // occur on link to invoke this elsewhere (such as object selection) |
1375 | parenPrim.GetProperties(client); | 1375 | parenPrim.TriggerScriptChangedEvent(Changed.LINK); |
1376 | if(client != null) | ||
1377 | parenPrim.GetProperties(client); | ||
1378 | else | ||
1379 | { | ||
1380 | foreach (ScenePresence p in ScenePresences.Values) | ||
1381 | { | ||
1382 | parenPrim.GetProperties(p.ControllingClient); | ||
1383 | } | ||
1384 | } | ||
1376 | } | 1385 | } |
1377 | 1386 | ||
1378 | /// <summary> | 1387 | /// <summary> |
@@ -1381,6 +1390,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1381 | /// <param name="prims"></param> | 1390 | /// <param name="prims"></param> |
1382 | protected internal void DelinkObjects(List<uint> primIds) | 1391 | protected internal void DelinkObjects(List<uint> primIds) |
1383 | { | 1392 | { |
1393 | DelinkObjects(primIds, true); | ||
1394 | } | ||
1395 | |||
1396 | protected internal void DelinkObjects(List<uint> primIds, bool sendEvents) | ||
1397 | { | ||
1384 | SceneObjectGroup parenPrim = null; | 1398 | SceneObjectGroup parenPrim = null; |
1385 | 1399 | ||
1386 | // Need a list of the SceneObjectGroup local ids | 1400 | // Need a list of the SceneObjectGroup local ids |
@@ -1407,7 +1421,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1407 | 1421 | ||
1408 | if (sceneObjects.ContainsKey(primIds[i])) | 1422 | if (sceneObjects.ContainsKey(primIds[i])) |
1409 | { | 1423 | { |
1410 | |||
1411 | parenPrim = sceneObjects[primIds[i]]; | 1424 | parenPrim = sceneObjects[primIds[i]]; |
1412 | primIds.RemoveAt(i); | 1425 | primIds.RemoveAt(i); |
1413 | break; | 1426 | break; |
@@ -1418,11 +1431,64 @@ namespace OpenSim.Region.Environment.Scenes | |||
1418 | { | 1431 | { |
1419 | foreach (uint childPrimId in primIds) | 1432 | foreach (uint childPrimId in primIds) |
1420 | { | 1433 | { |
1421 | parenPrim.DelinkFromGroup(childPrimId); | 1434 | parenPrim.DelinkFromGroup(childPrimId, sendEvents); |
1435 | } | ||
1436 | |||
1437 | if(parenPrim.Children.Count == 1) | ||
1438 | { | ||
1439 | // The link set has been completely torn down | ||
1440 | // This is the case if you select a link set and delink | ||
1441 | // | ||
1442 | parenPrim.RootPart.LinkNum = 1; | ||
1443 | if(sendEvents) | ||
1444 | parenPrim.TriggerScriptChangedEvent(Changed.LINK); | ||
1445 | } | ||
1446 | else | ||
1447 | { | ||
1448 | // The link set has prims remaining. This path is taken | ||
1449 | // when a subset of a link set's prims are selected | ||
1450 | // and the root prim is part of that selection | ||
1451 | // | ||
1452 | List<SceneObjectPart> parts = new List<SceneObjectPart>(parenPrim.Children.Values); | ||
1453 | |||
1454 | List<uint> unlink_ids = new List<uint>(); | ||
1455 | foreach (SceneObjectPart unlink_part in parts) | ||
1456 | unlink_ids.Add(unlink_part.LocalId); | ||
1457 | |||
1458 | // Tear down the remaining link set | ||
1459 | // | ||
1460 | if(unlink_ids.Count == 2) | ||
1461 | { | ||
1462 | DelinkObjects(unlink_ids, true); | ||
1463 | return; | ||
1464 | } | ||
1465 | |||
1466 | DelinkObjects(unlink_ids, false); | ||
1467 | |||
1468 | // Send event to root prim, then we're done with it | ||
1469 | parenPrim.TriggerScriptChangedEvent(Changed.LINK); | ||
1470 | |||
1471 | unlink_ids.Remove(parenPrim.RootPart.LocalId); | ||
1472 | |||
1473 | foreach (uint localId in unlink_ids) | ||
1474 | { | ||
1475 | SceneObjectPart nr = GetSceneObjectPart(localId); | ||
1476 | nr.UpdateFlag = 0; | ||
1477 | } | ||
1478 | |||
1479 | uint newRoot = unlink_ids[0]; | ||
1480 | unlink_ids.Remove(newRoot); | ||
1481 | |||
1482 | LinkObjects(null, newRoot, unlink_ids); | ||
1422 | } | 1483 | } |
1423 | } | 1484 | } |
1424 | else | 1485 | else |
1425 | { | 1486 | { |
1487 | // The selected prims were all child prims. Edit linked parts | ||
1488 | // without the root prim selected will get us here | ||
1489 | // | ||
1490 | List<SceneObjectGroup> parents = new List<SceneObjectGroup>(); | ||
1491 | |||
1426 | // If the first scan failed, we need to do a /deep/ scan of the linkages. This is /really/ slow | 1492 | // If the first scan failed, we need to do a /deep/ scan of the linkages. This is /really/ slow |
1427 | // We know that this is not the root prim now essentially, so we don't have to worry about remapping | 1493 | // We know that this is not the root prim now essentially, so we don't have to worry about remapping |
1428 | // which one is the root prim | 1494 | // which one is the root prim |
@@ -1436,6 +1502,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1436 | { | 1502 | { |
1437 | grp.DelinkFromGroup(primIds[i]); | 1503 | grp.DelinkFromGroup(primIds[i]); |
1438 | delinkedSomething = true; | 1504 | delinkedSomething = true; |
1505 | if(!parents.Contains(grp)) | ||
1506 | parents.Add(grp); | ||
1439 | } | 1507 | } |
1440 | 1508 | ||
1441 | } | 1509 | } |
@@ -1446,6 +1514,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1446 | "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", | 1514 | "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", |
1447 | primIds); | 1515 | primIds); |
1448 | } | 1516 | } |
1517 | else | ||
1518 | { | ||
1519 | foreach (SceneObjectGroup g in parents) | ||
1520 | { | ||
1521 | g.TriggerScriptChangedEvent(Changed.LINK); | ||
1522 | } | ||
1523 | } | ||
1449 | } | 1524 | } |
1450 | } | 1525 | } |
1451 | 1526 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 86e0caa..82e395d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -427,7 +427,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
427 | if (reader.Name == "SceneObjectPart") | 427 | if (reader.Name == "SceneObjectPart") |
428 | { | 428 | { |
429 | SceneObjectPart Part = SceneObjectPart.FromXml(reader); | 429 | SceneObjectPart Part = SceneObjectPart.FromXml(reader); |
430 | if(m_rootPart.LinkNum == 0) | ||
431 | m_rootPart.LinkNum++; | ||
430 | AddPart(Part); | 432 | AddPart(Part); |
433 | Part.LinkNum = m_parts.Count; | ||
431 | Part.StoreUndoState(); | 434 | Part.StoreUndoState(); |
432 | } | 435 | } |
433 | else | 436 | else |
@@ -462,7 +465,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
462 | LLVector3 rootOffset = new LLVector3(0, 0, 0); | 465 | LLVector3 rootOffset = new LLVector3(0, 0, 0); |
463 | SceneObjectPart newPart = | 466 | SceneObjectPart newPart = |
464 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); | 467 | new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); |
465 | newPart.LinkNum = m_parts.Count; | 468 | newPart.LinkNum = 0; |
466 | m_parts.Add(newPart.UUID, newPart); | 469 | m_parts.Add(newPart.UUID, newPart); |
467 | SetPartAsRoot(newPart); | 470 | SetPartAsRoot(newPart); |
468 | 471 | ||
@@ -817,7 +820,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
817 | lock (m_parts) | 820 | lock (m_parts) |
818 | { | 821 | { |
819 | part.SetParent(this); | 822 | part.SetParent(this); |
820 | part.LinkNum = m_parts.Count; | ||
821 | 823 | ||
822 | try | 824 | try |
823 | { | 825 | { |
@@ -828,6 +830,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
828 | { | 830 | { |
829 | m_log.Error("Failed to add scened object part", e); | 831 | m_log.Error("Failed to add scened object part", e); |
830 | } | 832 | } |
833 | |||
834 | part.LinkNum = m_parts.Count; | ||
835 | |||
836 | if(part.LinkNum == 2 && RootPart != null) | ||
837 | RootPart.LinkNum = 1; | ||
831 | } | 838 | } |
832 | } | 839 | } |
833 | 840 | ||
@@ -1738,14 +1745,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
1738 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | 1745 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); |
1739 | 1746 | ||
1740 | linkPart.ParentID = m_rootPart.LocalId; | 1747 | linkPart.ParentID = m_rootPart.LocalId; |
1741 | 1748 | if(m_rootPart.LinkNum == 0) | |
1742 | linkPart.LinkNum = m_parts.Count; | 1749 | m_rootPart.LinkNum = 1; |
1743 | 1750 | ||
1744 | lock (m_parts) | 1751 | lock (m_parts) |
1745 | { | 1752 | { |
1746 | m_parts.Add(linkPart.UUID, linkPart); | 1753 | m_parts.Add(linkPart.UUID, linkPart); |
1747 | } | 1754 | } |
1748 | 1755 | ||
1756 | linkPart.LinkNum = m_parts.Count; | ||
1757 | |||
1749 | linkPart.SetParent(this); | 1758 | linkPart.SetParent(this); |
1750 | 1759 | ||
1751 | //if (linkPart.PhysActor != null) | 1760 | //if (linkPart.PhysActor != null) |
@@ -1784,6 +1793,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1784 | /// <param name="partID"></param> | 1793 | /// <param name="partID"></param> |
1785 | public void DelinkFromGroup(uint partID) | 1794 | public void DelinkFromGroup(uint partID) |
1786 | { | 1795 | { |
1796 | DelinkFromGroup(partID, true); | ||
1797 | } | ||
1798 | |||
1799 | public void DelinkFromGroup(uint partID, bool sendEvents) | ||
1800 | { | ||
1787 | SceneObjectPart linkPart = GetChildPart(partID); | 1801 | SceneObjectPart linkPart = GetChildPart(partID); |
1788 | 1802 | ||
1789 | if (null != linkPart) | 1803 | if (null != linkPart) |
@@ -1801,7 +1815,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1801 | m_parts.Remove(linkPart.UUID); | 1815 | m_parts.Remove(linkPart.UUID); |
1802 | } | 1816 | } |
1803 | 1817 | ||
1818 | if(m_parts.Count == 1 && RootPart != null) //Single prim is left | ||
1819 | RootPart.LinkNum = 0; | ||
1820 | else | ||
1821 | { | ||
1822 | foreach (SceneObjectPart p in m_parts.Values) | ||
1823 | if(p.LinkNum > linkPart.LinkNum) | ||
1824 | p.LinkNum--; | ||
1825 | } | ||
1826 | |||
1804 | linkPart.ParentID = 0; | 1827 | linkPart.ParentID = 0; |
1828 | linkPart.LinkNum = 0; | ||
1805 | 1829 | ||
1806 | if (linkPart.PhysActor != null) | 1830 | if (linkPart.PhysActor != null) |
1807 | { | 1831 | { |
@@ -1834,6 +1858,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1834 | 1858 | ||
1835 | m_scene.AddNewSceneObject(objectGroup, true); | 1859 | m_scene.AddNewSceneObject(objectGroup, true); |
1836 | 1860 | ||
1861 | if(sendEvents) | ||
1862 | linkPart.TriggerScriptChangedEvent(Changed.LINK); | ||
1863 | |||
1837 | HasGroupChanged = true; | 1864 | HasGroupChanged = true; |
1838 | ScheduleGroupForFullUpdate(); | 1865 | ScheduleGroupForFullUpdate(); |
1839 | } | 1866 | } |
@@ -1858,13 +1885,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1858 | { | 1885 | { |
1859 | part.SetParent(this); | 1886 | part.SetParent(this); |
1860 | part.ParentID = m_rootPart.LocalId; | 1887 | part.ParentID = m_rootPart.LocalId; |
1861 | part.LinkNum = m_parts.Count; | ||
1862 | 1888 | ||
1863 | lock (m_parts) | 1889 | lock (m_parts) |
1864 | { | 1890 | { |
1865 | m_parts.Add(part.UUID, part); | 1891 | m_parts.Add(part.UUID, part); |
1866 | } | 1892 | } |
1867 | 1893 | ||
1894 | part.LinkNum = m_parts.Count; | ||
1895 | |||
1868 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); | 1896 | Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); |
1869 | axiomOldPos = oldGroupRotation * axiomOldPos; | 1897 | axiomOldPos = oldGroupRotation * axiomOldPos; |
1870 | axiomOldPos += oldGroupPosition; | 1898 | axiomOldPos += oldGroupPosition; |
@@ -2670,5 +2698,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
2670 | 2698 | ||
2671 | ScheduleGroupForFullUpdate(); | 2699 | ScheduleGroupForFullUpdate(); |
2672 | } | 2700 | } |
2701 | |||
2702 | public void TriggerScriptChangedEvent(Changed val) | ||
2703 | { | ||
2704 | foreach (SceneObjectPart part in Children.Values) | ||
2705 | { | ||
2706 | part.TriggerScriptChangedEvent(val); | ||
2707 | } | ||
2708 | } | ||
2673 | } | 2709 | } |
2674 | } | 2710 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 63ec23c..edccbe5 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -674,12 +674,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
674 | public int LinkNum | 674 | public int LinkNum |
675 | { | 675 | { |
676 | get { return m_linkNum; } | 676 | get { return m_linkNum; } |
677 | set | 677 | set { m_linkNum = value; } |
678 | { | ||
679 | m_linkNum = value; | ||
680 | TriggerScriptChangedEvent(Changed.LINK); | ||
681 | |||
682 | } | ||
683 | } | 678 | } |
684 | 679 | ||
685 | public byte ClickAction | 680 | public byte ClickAction |
@@ -2250,7 +2245,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2250 | public void SetAvatarOnSitTarget(LLUUID avatarID) | 2245 | public void SetAvatarOnSitTarget(LLUUID avatarID) |
2251 | { | 2246 | { |
2252 | m_sitTargetAvatar = avatarID; | 2247 | m_sitTargetAvatar = avatarID; |
2253 | TriggerScriptChangedEvent(Changed.LINK); | 2248 | if(ParentGroup != null) |
2249 | ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | ||
2254 | } | 2250 | } |
2255 | 2251 | ||
2256 | public void SetAxisRotation(int axis, int rotate) | 2252 | public void SetAxisRotation(int axis, int rotate) |
@@ -3294,4 +3290,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
3294 | 3290 | ||
3295 | #endregion Public Methods | 3291 | #endregion Public Methods |
3296 | } | 3292 | } |
3297 | } \ No newline at end of file | 3293 | } |