diff options
author | UbitUmarov | 2017-04-25 17:59:53 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-25 17:59:53 +0100 |
commit | a680d8b8d700f78beb1a9eea98b52d59118efe2e (patch) | |
tree | dd084e74fb61400c704a14dcfa8689670acb9ec2 /OpenSim/Region/Framework/Scenes/SceneGraph.cs | |
parent | Merge branch 'master' into httptests (diff) | |
parent | move mesh pbs creation code out of mesh upload code into to PrimitiveBaseShap... (diff) | |
download | opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.zip opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.gz opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.bz2 opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.xz |
fix merge
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 138 |
1 files changed, 52 insertions, 86 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2f65ce2..a005068 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -343,7 +343,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
343 | sceneObject.ForceInventoryPersistence(); | 343 | sceneObject.ForceInventoryPersistence(); |
344 | sceneObject.HasGroupChanged = true; | 344 | sceneObject.HasGroupChanged = true; |
345 | } | 345 | } |
346 | 346 | sceneObject.AggregateDeepPerms(); | |
347 | return ret; | 347 | return ret; |
348 | } | 348 | } |
349 | 349 | ||
@@ -549,6 +549,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
549 | // that are part of the Scene Object being removed | 549 | // that are part of the Scene Object being removed |
550 | m_numTotalPrim -= grp.PrimCount; | 550 | m_numTotalPrim -= grp.PrimCount; |
551 | 551 | ||
552 | bool isPh = (grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics; | ||
553 | int nphysparts = 0; | ||
552 | // Go through all parts (primitives and meshes) of this Scene Object | 554 | // Go through all parts (primitives and meshes) of this Scene Object |
553 | foreach (SceneObjectPart part in grp.Parts) | 555 | foreach (SceneObjectPart part in grp.Parts) |
554 | { | 556 | { |
@@ -559,10 +561,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
559 | m_numMesh--; | 561 | m_numMesh--; |
560 | else | 562 | else |
561 | m_numPrim--; | 563 | m_numPrim--; |
564 | |||
565 | if(isPh && part.PhysicsShapeType != (byte)PhysShapeType.none) | ||
566 | nphysparts++; | ||
562 | } | 567 | } |
563 | 568 | ||
564 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 569 | if (nphysparts > 0 ) |
565 | RemovePhysicalPrim(grp.PrimCount); | 570 | RemovePhysicalPrim(nphysparts); |
566 | } | 571 | } |
567 | 572 | ||
568 | bool ret = Entities.Remove(uuid); | 573 | bool ret = Entities.Remove(uuid); |
@@ -1358,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1358 | SceneObjectGroup grp = part.ParentGroup; | 1363 | SceneObjectGroup grp = part.ParentGroup; |
1359 | if (grp != null) | 1364 | if (grp != null) |
1360 | { | 1365 | { |
1361 | if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId)) | 1366 | if (m_parentScene.Permissions.CanEditObject(grp, remoteClient)) |
1362 | { | 1367 | { |
1363 | // These two are exceptions SL makes in the interpretation | 1368 | // These two are exceptions SL makes in the interpretation |
1364 | // of the change flags. Must check them here because otherwise | 1369 | // of the change flags. Must check them here because otherwise |
@@ -1379,7 +1384,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1379 | if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0) | 1384 | if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0) |
1380 | { | 1385 | { |
1381 | // Are we allowed to move it? | 1386 | // Are we allowed to move it? |
1382 | if (m_parentScene.Permissions.CanMoveObject(grp.UUID, remoteClient.AgentId)) | 1387 | if (m_parentScene.Permissions.CanMoveObject(grp, remoteClient)) |
1383 | { | 1388 | { |
1384 | // Strip all but move and rotation from request | 1389 | // Strip all but move and rotation from request |
1385 | data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation); | 1390 | data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation); |
@@ -1406,7 +1411,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1406 | 1411 | ||
1407 | if (part != null) | 1412 | if (part != null) |
1408 | { | 1413 | { |
1409 | if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) | 1414 | if (m_parentScene.Permissions.CanEditObject(part.ParentGroup, remoteClient)) |
1410 | { | 1415 | { |
1411 | bool physbuild = false; | 1416 | bool physbuild = false; |
1412 | if (part.ParentGroup.RootPart.PhysActor != null) | 1417 | if (part.ParentGroup.RootPart.PhysActor != null) |
@@ -1428,7 +1433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1428 | SceneObjectGroup group = GetGroupByPrim(localID); | 1433 | SceneObjectGroup group = GetGroupByPrim(localID); |
1429 | if (group != null) | 1434 | if (group != null) |
1430 | { | 1435 | { |
1431 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1436 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1432 | { | 1437 | { |
1433 | bool physbuild = false; | 1438 | bool physbuild = false; |
1434 | if (group.RootPart.PhysActor != null) | 1439 | if (group.RootPart.PhysActor != null) |
@@ -1474,7 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1474 | SceneObjectGroup group = GetGroupByPrim(localID); | 1479 | SceneObjectGroup group = GetGroupByPrim(localID); |
1475 | if (group != null) | 1480 | if (group != null) |
1476 | { | 1481 | { |
1477 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1482 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1478 | { | 1483 | { |
1479 | group.UpdateSingleRotation(rot, localID); | 1484 | group.UpdateSingleRotation(rot, localID); |
1480 | } | 1485 | } |
@@ -1492,7 +1497,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1492 | SceneObjectGroup group = GetGroupByPrim(localID); | 1497 | SceneObjectGroup group = GetGroupByPrim(localID); |
1493 | if (group != null) | 1498 | if (group != null) |
1494 | { | 1499 | { |
1495 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1500 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1496 | { | 1501 | { |
1497 | group.UpdateSingleRotation(rot, pos, localID); | 1502 | group.UpdateSingleRotation(rot, pos, localID); |
1498 | } | 1503 | } |
@@ -1510,7 +1515,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1510 | SceneObjectGroup group = GetGroupByPrim(localID); | 1515 | SceneObjectGroup group = GetGroupByPrim(localID); |
1511 | if (group != null) | 1516 | if (group != null) |
1512 | { | 1517 | { |
1513 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1518 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1514 | { | 1519 | { |
1515 | group.UpdateGroupRotationR(rot); | 1520 | group.UpdateGroupRotationR(rot); |
1516 | } | 1521 | } |
@@ -1529,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1529 | SceneObjectGroup group = GetGroupByPrim(localID); | 1534 | SceneObjectGroup group = GetGroupByPrim(localID); |
1530 | if (group != null) | 1535 | if (group != null) |
1531 | { | 1536 | { |
1532 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1537 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)) |
1533 | { | 1538 | { |
1534 | group.UpdateGroupRotationPR(pos, rot); | 1539 | group.UpdateGroupRotationPR(pos, rot); |
1535 | } | 1540 | } |
@@ -1547,7 +1552,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1547 | SceneObjectGroup group = GetGroupByPrim(localID); | 1552 | SceneObjectGroup group = GetGroupByPrim(localID); |
1548 | if (group != null) | 1553 | if (group != null) |
1549 | { | 1554 | { |
1550 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) | 1555 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) || group.IsAttachment) |
1551 | { | 1556 | { |
1552 | group.UpdateSinglePosition(pos, localID); | 1557 | group.UpdateSinglePosition(pos, localID); |
1553 | } | 1558 | } |
@@ -1562,17 +1567,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1562 | /// <param name="remoteClient"></param> | 1567 | /// <param name="remoteClient"></param> |
1563 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) | 1568 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) |
1564 | { | 1569 | { |
1565 | UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId); | ||
1566 | } | ||
1567 | |||
1568 | /// <summary> | ||
1569 | /// Update the position of the given group. | ||
1570 | /// </summary> | ||
1571 | /// <param name="localId"></param> | ||
1572 | /// <param name="pos"></param> | ||
1573 | /// <param name="updatingAgentId"></param> | ||
1574 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId) | ||
1575 | { | ||
1576 | SceneObjectGroup group = GetGroupByPrim(localId); | 1570 | SceneObjectGroup group = GetGroupByPrim(localId); |
1577 | 1571 | ||
1578 | if (group != null) | 1572 | if (group != null) |
@@ -1580,7 +1574,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1580 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) | 1574 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) |
1581 | { | 1575 | { |
1582 | // Set the new attachment point data in the object | 1576 | // Set the new attachment point data in the object |
1583 | byte attachmentPoint = group.GetAttachmentPoint(); | 1577 | byte attachmentPoint = (byte)group.AttachmentPoint; |
1584 | group.UpdateGroupPosition(pos); | 1578 | group.UpdateGroupPosition(pos); |
1585 | group.IsAttachment = false; | 1579 | group.IsAttachment = false; |
1586 | group.AbsolutePosition = group.RootPart.AttachedPos; | 1580 | group.AbsolutePosition = group.RootPart.AttachedPos; |
@@ -1589,8 +1583,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1589 | } | 1583 | } |
1590 | else | 1584 | else |
1591 | { | 1585 | { |
1592 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId) | 1586 | if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) |
1593 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) | 1587 | && m_parentScene.Permissions.CanObjectEntry(group, false, pos)) |
1594 | { | 1588 | { |
1595 | group.UpdateGroupPosition(pos); | 1589 | group.UpdateGroupPosition(pos); |
1596 | } | 1590 | } |
@@ -1614,7 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1614 | 1608 | ||
1615 | if (group != null) | 1609 | if (group != null) |
1616 | { | 1610 | { |
1617 | if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) | 1611 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1618 | { | 1612 | { |
1619 | group.UpdateTextureEntry(localID, texture); | 1613 | group.UpdateTextureEntry(localID, texture); |
1620 | } | 1614 | } |
@@ -1638,7 +1632,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1638 | SceneObjectGroup group = GetGroupByPrim(localID); | 1632 | SceneObjectGroup group = GetGroupByPrim(localID); |
1639 | if (group != null) | 1633 | if (group != null) |
1640 | { | 1634 | { |
1641 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1635 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1642 | { | 1636 | { |
1643 | // VolumeDetect can't be set via UI and will always be off when a change is made there | 1637 | // VolumeDetect can't be set via UI and will always be off when a change is made there |
1644 | // now only change volume dtc if phantom off | 1638 | // now only change volume dtc if phantom off |
@@ -1685,7 +1679,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1685 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1679 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1686 | if (group != null) | 1680 | if (group != null) |
1687 | { | 1681 | { |
1688 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1682 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1689 | { | 1683 | { |
1690 | group.SetPartName(Util.CleanString(name), primLocalID); | 1684 | group.SetPartName(Util.CleanString(name), primLocalID); |
1691 | group.HasGroupChanged = true; | 1685 | group.HasGroupChanged = true; |
@@ -1703,7 +1697,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1703 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1697 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1704 | if (group != null) | 1698 | if (group != null) |
1705 | { | 1699 | { |
1706 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1700 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1707 | { | 1701 | { |
1708 | group.SetPartDescription(Util.CleanString(description), primLocalID); | 1702 | group.SetPartDescription(Util.CleanString(description), primLocalID); |
1709 | group.HasGroupChanged = true; | 1703 | group.HasGroupChanged = true; |
@@ -1725,7 +1719,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1725 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1719 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1726 | if (group != null) | 1720 | if (group != null) |
1727 | { | 1721 | { |
1728 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1722 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1729 | { | 1723 | { |
1730 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); | 1724 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); |
1731 | if (part != null) | 1725 | if (part != null) |
@@ -1742,7 +1736,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1742 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 1736 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
1743 | if (group != null) | 1737 | if (group != null) |
1744 | { | 1738 | { |
1745 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1739 | if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) |
1746 | { | 1740 | { |
1747 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); | 1741 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); |
1748 | if (part != null) | 1742 | if (part != null) |
@@ -1996,6 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1996 | { | 1990 | { |
1997 | newRoot.TriggerScriptChangedEvent(Changed.LINK); | 1991 | newRoot.TriggerScriptChangedEvent(Changed.LINK); |
1998 | newRoot.ParentGroup.HasGroupChanged = true; | 1992 | newRoot.ParentGroup.HasGroupChanged = true; |
1993 | newRoot.ParentGroup.InvalidatePartsLinkMaps(); | ||
1999 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); | 1994 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); |
2000 | } | 1995 | } |
2001 | } | 1996 | } |
@@ -2012,6 +2007,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2012 | // from the database. They will be rewritten immediately, | 2007 | // from the database. They will be rewritten immediately, |
2013 | // minus the rows for the unlinked child prims. | 2008 | // minus the rows for the unlinked child prims. |
2014 | m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); | 2009 | m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); |
2010 | g.InvalidatePartsLinkMaps(); | ||
2015 | g.TriggerScriptChangedEvent(Changed.LINK); | 2011 | g.TriggerScriptChangedEvent(Changed.LINK); |
2016 | g.HasGroupChanged = true; // Persist | 2012 | g.HasGroupChanged = true; // Persist |
2017 | g.ScheduleGroupForFullUpdate(); | 2013 | g.ScheduleGroupForFullUpdate(); |
@@ -2025,27 +2021,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2025 | 2021 | ||
2026 | protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) | 2022 | protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) |
2027 | { | 2023 | { |
2028 | UUID user = remoteClient.AgentId; | 2024 | SceneObjectGroup sog = GetGroupByPrim(localID); |
2029 | UUID objid = UUID.Zero; | 2025 | if(sog == null) |
2030 | SceneObjectPart obj = null; | 2026 | return; |
2031 | |||
2032 | EntityBase[] entityList = GetEntities(); | ||
2033 | foreach (EntityBase ent in entityList) | ||
2034 | { | ||
2035 | if (ent is SceneObjectGroup) | ||
2036 | { | ||
2037 | SceneObjectGroup sog = ent as SceneObjectGroup; | ||
2038 | |||
2039 | foreach (SceneObjectPart part in sog.Parts) | ||
2040 | { | ||
2041 | if (part.LocalId == localID) | ||
2042 | { | ||
2043 | objid = part.UUID; | ||
2044 | obj = part; | ||
2045 | } | ||
2046 | } | ||
2047 | } | ||
2048 | } | ||
2049 | 2027 | ||
2050 | //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints | 2028 | //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints |
2051 | //aka ObjectFlags.JointWheel = IncludeInSearch | 2029 | //aka ObjectFlags.JointWheel = IncludeInSearch |
@@ -2062,15 +2040,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2062 | // libomv will complain about PrimFlags.JointWheel being | 2040 | // libomv will complain about PrimFlags.JointWheel being |
2063 | // deprecated, so we | 2041 | // deprecated, so we |
2064 | #pragma warning disable 0612 | 2042 | #pragma warning disable 0612 |
2065 | if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(objid, user)) | 2043 | if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog, remoteClient)) |
2066 | { | 2044 | { |
2067 | obj.ParentGroup.RootPart.AddFlag(PrimFlags.JointWheel); | 2045 | sog.RootPart.AddFlag(PrimFlags.JointWheel); |
2068 | obj.ParentGroup.HasGroupChanged = true; | 2046 | sog.HasGroupChanged = true; |
2069 | } | 2047 | } |
2070 | else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(objid,user)) | 2048 | else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(sog, remoteClient)) |
2071 | { | 2049 | { |
2072 | obj.ParentGroup.RootPart.RemFlag(PrimFlags.JointWheel); | 2050 | sog.RootPart.RemFlag(PrimFlags.JointWheel); |
2073 | obj.ParentGroup.HasGroupChanged = true; | 2051 | sog.HasGroupChanged = true; |
2074 | } | 2052 | } |
2075 | #pragma warning restore 0612 | 2053 | #pragma warning restore 0612 |
2076 | } | 2054 | } |
@@ -2086,7 +2064,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2086 | /// <param name="rot"></param> | 2064 | /// <param name="rot"></param> |
2087 | /// <returns>null if duplication fails, otherwise the duplicated object</returns> | 2065 | /// <returns>null if duplication fails, otherwise the duplicated object</returns> |
2088 | /// <summary> | 2066 | /// <summary> |
2089 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) | 2067 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, UUID AgentID, UUID GroupID, Quaternion rot, bool createSelected) |
2090 | { | 2068 | { |
2091 | // m_log.DebugFormat( | 2069 | // m_log.DebugFormat( |
2092 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", | 2070 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", |
@@ -2095,27 +2073,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 2073 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
2096 | if (original != null) | 2074 | if (original != null) |
2097 | { | 2075 | { |
2098 | if (m_parentScene.Permissions.CanDuplicateObject( | 2076 | if (m_parentScene.Permissions.CanDuplicateObject(original, AgentID)) |
2099 | original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) | ||
2100 | { | 2077 | { |
2101 | SceneObjectGroup copy = original.Copy(true); | 2078 | SceneObjectGroup copy = original.Copy(true); |
2102 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 2079 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
2103 | 2080 | ||
2081 | SceneObjectPart[] parts = copy.Parts; | ||
2082 | |||
2083 | m_numTotalPrim += parts.Length; | ||
2084 | |||
2104 | if (original.OwnerID != AgentID) | 2085 | if (original.OwnerID != AgentID) |
2105 | { | 2086 | { |
2106 | copy.SetOwnerId(AgentID); | 2087 | copy.SetOwner(AgentID, GroupID); |
2107 | copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID); | ||
2108 | |||
2109 | SceneObjectPart[] partList = copy.Parts; | ||
2110 | 2088 | ||
2111 | if (m_parentScene.Permissions.PropagatePermissions()) | 2089 | if (m_parentScene.Permissions.PropagatePermissions()) |
2112 | { | 2090 | { |
2113 | foreach (SceneObjectPart child in partList) | 2091 | foreach (SceneObjectPart child in parts) |
2114 | { | 2092 | { |
2115 | child.Inventory.ChangeInventoryOwner(AgentID); | 2093 | child.Inventory.ChangeInventoryOwner(AgentID); |
2116 | child.TriggerScriptChangedEvent(Changed.OWNER); | 2094 | child.TriggerScriptChangedEvent(Changed.OWNER); |
2117 | child.ApplyNextOwnerPermissions(); | 2095 | child.ApplyNextOwnerPermissions(); |
2118 | } | 2096 | } |
2097 | copy.AggregatePerms(); | ||
2119 | } | 2098 | } |
2120 | } | 2099 | } |
2121 | 2100 | ||
@@ -2125,10 +2104,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2125 | lock (SceneObjectGroupsByFullID) | 2104 | lock (SceneObjectGroupsByFullID) |
2126 | SceneObjectGroupsByFullID[copy.UUID] = copy; | 2105 | SceneObjectGroupsByFullID[copy.UUID] = copy; |
2127 | 2106 | ||
2128 | SceneObjectPart[] parts = copy.Parts; | ||
2129 | |||
2130 | m_numTotalPrim += parts.Length; | ||
2131 | |||
2132 | foreach (SceneObjectPart part in parts) | 2107 | foreach (SceneObjectPart part in parts) |
2133 | { | 2108 | { |
2134 | if (part.GetPrimType() == PrimType.SCULPT) | 2109 | if (part.GetPrimType() == PrimType.SCULPT) |
@@ -2144,28 +2119,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2144 | 2119 | ||
2145 | // PROBABLE END OF FIXME | 2120 | // PROBABLE END OF FIXME |
2146 | 2121 | ||
2147 | // Since we copy from a source group that is in selected | 2122 | copy.IsSelected = createSelected; |
2148 | // state, but the copy is shown deselected in the viewer, | ||
2149 | // We need to clear the selection flag here, else that | ||
2150 | // prim never gets persisted at all. The client doesn't | ||
2151 | // think it's selected, so it will never send a deselect... | ||
2152 | copy.IsSelected = false; | ||
2153 | |||
2154 | m_numPrim += copy.Parts.Length; | ||
2155 | 2123 | ||
2156 | if (rot != Quaternion.Identity) | 2124 | if (rot != Quaternion.Identity) |
2157 | { | ||
2158 | copy.UpdateGroupRotationR(rot); | 2125 | copy.UpdateGroupRotationR(rot); |
2159 | } | 2126 | |
2127 | // required for physics to update it's position | ||
2128 | copy.ResetChildPrimPhysicsPositions(); | ||
2160 | 2129 | ||
2161 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); | 2130 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); |
2162 | copy.HasGroupChanged = true; | ||
2163 | copy.ScheduleGroupForFullUpdate(); | ||
2164 | copy.ResumeScripts(); | 2131 | copy.ResumeScripts(); |
2165 | 2132 | ||
2166 | // required for physics to update it's position | 2133 | copy.HasGroupChanged = true; |
2167 | copy.AbsolutePosition = copy.AbsolutePosition; | 2134 | copy.ScheduleGroupForFullUpdate(); |
2168 | |||
2169 | return copy; | 2135 | return copy; |
2170 | } | 2136 | } |
2171 | } | 2137 | } |