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/Scenes/InnerScene.cs | |
parent | Introduce a separate connection string for estates, which defaults to the one gi (diff) | |
download | opensim-SC-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.zip opensim-SC-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.gz opensim-SC-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.bz2 opensim-SC-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 '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 81 |
1 files changed, 78 insertions, 3 deletions
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 | ||