aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs92
1 files changed, 50 insertions, 42 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 39d4a29..29edf13 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -403,7 +403,7 @@ namespace OpenSim.Region.Framework.Scenes
403 /// </returns> 403 /// </returns>
404 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 404 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
405 { 405 {
406 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 406 if (sceneObject == null || sceneObject.RootPart.UUID == UUID.Zero)
407 return false; 407 return false;
408 408
409 if (Entities.ContainsKey(sceneObject.UUID)) 409 if (Entities.ContainsKey(sceneObject.UUID))
@@ -613,13 +613,6 @@ namespace OpenSim.Region.Framework.Scenes
613 m_activeScripts += number; 613 m_activeScripts += number;
614 } 614 }
615 615
616 public void DropObject(uint objectLocalID, IClientAPI remoteClient)
617 {
618 SceneObjectGroup group = GetGroupByPrim(objectLocalID);
619 if (group != null)
620 m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient);
621 }
622
623 protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) 616 protected internal void HandleUndo(IClientAPI remoteClient, UUID primId)
624 { 617 {
625 if (primId != UUID.Zero) 618 if (primId != UUID.Zero)
@@ -629,11 +622,13 @@ namespace OpenSim.Region.Framework.Scenes
629 part.Undo(); 622 part.Undo();
630 } 623 }
631 } 624 }
625
632 protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) 626 protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
633 { 627 {
634 if (primId != UUID.Zero) 628 if (primId != UUID.Zero)
635 { 629 {
636 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); 630 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
631
637 if (part != null) 632 if (part != null)
638 part.Redo(); 633 part.Redo();
639 } 634 }
@@ -653,12 +648,13 @@ namespace OpenSim.Region.Framework.Scenes
653 } 648 }
654 } 649 }
655 650
656 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 651 protected internal ScenePresence CreateAndAddChildScenePresence(
652 IClientAPI client, AvatarAppearance appearance, PresenceType type)
657 { 653 {
658 ScenePresence newAvatar = null; 654 ScenePresence newAvatar = null;
659 655
660 // ScenePresence always defaults to child agent 656 // ScenePresence always defaults to child agent
661 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 657 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type);
662 658
663 AddScenePresence(newAvatar); 659 AddScenePresence(newAvatar);
664 660
@@ -1285,19 +1281,20 @@ namespace OpenSim.Region.Framework.Scenes
1285 #region Client Event handlers 1281 #region Client Event handlers
1286 1282
1287 /// <summary> 1283 /// <summary>
1288 /// 1284 /// Update the scale of an individual prim.
1289 /// </summary> 1285 /// </summary>
1290 /// <param name="localID"></param> 1286 /// <param name="localID"></param>
1291 /// <param name="scale"></param> 1287 /// <param name="scale"></param>
1292 /// <param name="remoteClient"></param> 1288 /// <param name="remoteClient"></param>
1293 protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) 1289 protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient)
1294 { 1290 {
1295 SceneObjectGroup group = GetGroupByPrim(localID); 1291 SceneObjectPart part = GetSceneObjectPart(localID);
1296 if (group != null) 1292
1293 if (part != null)
1297 { 1294 {
1298 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1295 if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId))
1299 { 1296 {
1300 group.Resize(scale, localID); 1297 part.Resize(scale);
1301 } 1298 }
1302 } 1299 }
1303 } 1300 }
@@ -1309,7 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
1309 { 1306 {
1310 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1307 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
1311 { 1308 {
1312 group.GroupResize(scale, localID); 1309 group.GroupResize(scale);
1313 } 1310 }
1314 } 1311 }
1315 } 1312 }
@@ -1363,19 +1360,18 @@ namespace OpenSim.Region.Framework.Scenes
1363 { 1360 {
1364 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1361 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
1365 { 1362 {
1366 group.UpdateSingleRotation(rot,pos, localID); 1363 group.UpdateSingleRotation(rot, pos, localID);
1367 } 1364 }
1368 } 1365 }
1369 } 1366 }
1370 1367
1371
1372 /// <summary> 1368 /// <summary>
1373 /// 1369 /// Update the rotation of a whole group.
1374 /// </summary> 1370 /// </summary>
1375 /// <param name="localID"></param> 1371 /// <param name="localID"></param>
1376 /// <param name="rot"></param> 1372 /// <param name="rot"></param>
1377 /// <param name="remoteClient"></param> 1373 /// <param name="remoteClient"></param>
1378 protected internal void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient) 1374 protected internal void UpdatePrimGroupRotation(uint localID, Quaternion rot, IClientAPI remoteClient)
1379 { 1375 {
1380 SceneObjectGroup group = GetGroupByPrim(localID); 1376 SceneObjectGroup group = GetGroupByPrim(localID);
1381 if (group != null) 1377 if (group != null)
@@ -1394,7 +1390,7 @@ namespace OpenSim.Region.Framework.Scenes
1394 /// <param name="pos"></param> 1390 /// <param name="pos"></param>
1395 /// <param name="rot"></param> 1391 /// <param name="rot"></param>
1396 /// <param name="remoteClient"></param> 1392 /// <param name="remoteClient"></param>
1397 protected internal void UpdatePrimRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient) 1393 protected internal void UpdatePrimGroupRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient)
1398 { 1394 {
1399 SceneObjectGroup group = GetGroupByPrim(localID); 1395 SceneObjectGroup group = GetGroupByPrim(localID);
1400 if (group != null) 1396 if (group != null)
@@ -1425,12 +1421,12 @@ namespace OpenSim.Region.Framework.Scenes
1425 } 1421 }
1426 1422
1427 /// <summary> 1423 /// <summary>
1428 /// Update the position of the given part 1424 /// Update the position of the given group.
1429 /// </summary> 1425 /// </summary>
1430 /// <param name="localID"></param> 1426 /// <param name="localID"></param>
1431 /// <param name="pos"></param> 1427 /// <param name="pos"></param>
1432 /// <param name="remoteClient"></param> 1428 /// <param name="remoteClient"></param>
1433 public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) 1429 public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
1434 { 1430 {
1435 SceneObjectGroup group = GetGroupByPrim(localID); 1431 SceneObjectGroup group = GetGroupByPrim(localID);
1436 1432
@@ -1481,21 +1477,26 @@ namespace OpenSim.Region.Framework.Scenes
1481 } 1477 }
1482 1478
1483 /// <summary> 1479 /// <summary>
1484 /// 1480 /// Update the flags on a scene object. This covers properties such as phantom, physics and temporary.
1485 /// </summary> 1481 /// </summary>
1482 /// <remarks>
1483 /// This is currently handling the incoming call from the client stack (e.g. LLClientView).
1484 /// </remarks>
1486 /// <param name="localID"></param> 1485 /// <param name="localID"></param>
1487 /// <param name="packet"></param> 1486 /// <param name="UsePhysics"></param>
1487 /// <param name="SetTemporary"></param>
1488 /// <param name="SetPhantom"></param>
1488 /// <param name="remoteClient"></param> 1489 /// <param name="remoteClient"></param>
1489 /// This routine seems to get called when a user changes object settings in the viewer. 1490 protected internal void UpdatePrimFlags(
1490 /// If some one can confirm that, please change the comment according. 1491 uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient)
1491 protected internal void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient)
1492 { 1492 {
1493 SceneObjectGroup group = GetGroupByPrim(localID); 1493 SceneObjectGroup group = GetGroupByPrim(localID);
1494 if (group != null) 1494 if (group != null)
1495 { 1495 {
1496 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1496 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
1497 { 1497 {
1498 group.UpdatePrimFlags(localID, UsePhysics, IsTemporary, IsPhantom, false); // VolumeDetect can't be set via UI and will always be off when a change is made there 1498 // VolumeDetect can't be set via UI and will always be off when a change is made there
1499 group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false);
1499 } 1500 }
1500 } 1501 }
1501 } 1502 }
@@ -1618,8 +1619,11 @@ namespace OpenSim.Region.Framework.Scenes
1618 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1619 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
1619 { 1620 {
1620 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); 1621 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
1621 part.ClickAction = Convert.ToByte(clickAction); 1622 if (part != null)
1622 group.HasGroupChanged = true; 1623 {
1624 part.ClickAction = Convert.ToByte(clickAction);
1625 group.HasGroupChanged = true;
1626 }
1623 } 1627 }
1624 } 1628 }
1625 } 1629 }
@@ -1632,8 +1636,11 @@ namespace OpenSim.Region.Framework.Scenes
1632 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1636 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
1633 { 1637 {
1634 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); 1638 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
1635 part.Material = Convert.ToByte(material); 1639 if (part != null)
1636 group.HasGroupChanged = true; 1640 {
1641 part.Material = Convert.ToByte(material);
1642 group.HasGroupChanged = true;
1643 }
1637 } 1644 }
1638 } 1645 }
1639 } 1646 }
@@ -1706,23 +1713,24 @@ namespace OpenSim.Region.Framework.Scenes
1706 parentGroup.areUpdatesSuspended = true; 1713 parentGroup.areUpdatesSuspended = true;
1707 1714
1708 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1715 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1709 if (parentGroup != null) 1716
1717 // We do this in reverse to get the link order of the prims correct
1718 for (int i = children.Count - 1; i >= 0; i--)
1710 { 1719 {
1711 // We do this in reverse to get the link order of the prims correct 1720 SceneObjectGroup child = children[i].ParentGroup;
1712 for (int i = children.Count - 1; i >= 0; i--)
1713 {
1714 SceneObjectGroup child = children[i].ParentGroup;
1715 1721
1722 // Make sure no child prim is set for sale
1723 // So that, on delink, no prims are unwittingly
1724 // left for sale and sold off
1725
1716 if (child != null) 1726 if (child != null)
1717 { 1727 {
1728 child.RootPart.ObjectSaleType = 0;
1729 child.RootPart.SalePrice = 10;
1718 childGroups.Add(child); 1730 childGroups.Add(child);
1719 } 1731 }
1720 } 1732 }
1721 } 1733 }
1722 else
1723 {
1724 return; // parent is null so not in this region
1725 }
1726 1734
1727 foreach (SceneObjectGroup child in childGroups) 1735 foreach (SceneObjectGroup child in childGroups)
1728 { 1736 {