diff options
author | Melanie | 2012-01-26 00:21:21 +0000 |
---|---|---|
committer | Melanie | 2012-01-26 00:21:21 +0000 |
commit | 4ce42762ee2a8ae323b6a1d118bb4b9b0f447caf (patch) | |
tree | 6173c8da92084547e89db40e5762a74249b4a8db /OpenSim | |
parent | Typo fix (diff) | |
parent | refactor: change RezScriptFromAgentInventory(), RezNewScript() and AddInvento... (diff) | |
download | opensim-SC-4ce42762ee2a8ae323b6a1d118bb4b9b0f447caf.zip opensim-SC-4ce42762ee2a8ae323b6a1d118bb4b9b0f447caf.tar.gz opensim-SC-4ce42762ee2a8ae323b6a1d118bb4b9b0f447caf.tar.bz2 opensim-SC-4ce42762ee2a8ae323b6a1d118bb4b9b0f447caf.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim')
15 files changed, 219 insertions, 111 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 1b93176..1d806fc 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -685,7 +685,7 @@ namespace OpenSim.Data.Tests | |||
685 | SceneObjectGroup sog = GetMySOG("object1"); | 685 | SceneObjectGroup sog = GetMySOG("object1"); |
686 | InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); | 686 | InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); |
687 | 687 | ||
688 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True); | 688 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); |
689 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | 689 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); |
690 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); | 690 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); |
691 | 691 | ||
@@ -762,7 +762,7 @@ namespace OpenSim.Data.Tests | |||
762 | i.CreationDate = creationd; | 762 | i.CreationDate = creationd; |
763 | 763 | ||
764 | SceneObjectGroup sog = GetMySOG("object1"); | 764 | SceneObjectGroup sog = GetMySOG("object1"); |
765 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True); | 765 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); |
766 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); | 766 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); |
767 | 767 | ||
768 | Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); | 768 | Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); |
@@ -807,10 +807,10 @@ namespace OpenSim.Data.Tests | |||
807 | 807 | ||
808 | SceneObjectGroup sog = FindSOG("object1", region1); | 808 | SceneObjectGroup sog = FindSOG("object1", region1); |
809 | 809 | ||
810 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib1, zero), Is.True); | 810 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True); |
811 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib2, zero), Is.True); | 811 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True); |
812 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib3, zero), Is.True); | 812 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True); |
813 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib4, zero), Is.True); | 813 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True); |
814 | 814 | ||
815 | TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); | 815 | TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); |
816 | Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); | 816 | Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); |
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 0316944..f75a990 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs | |||
@@ -130,5 +130,11 @@ namespace OpenSim.Framework | |||
130 | /// </summary> | 130 | /// </summary> |
131 | /// <param name="url"></param> | 131 | /// <param name="url"></param> |
132 | void SetMusicUrl(string url); | 132 | void SetMusicUrl(string url); |
133 | |||
134 | /// <summary> | ||
135 | /// Get the music url for this land parcel | ||
136 | /// </summary> | ||
137 | /// <returns>The music url.</returns> | ||
138 | string GetMusicUrl(); | ||
133 | } | 139 | } |
134 | } | 140 | } |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 515567d..c4f7b91 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -291,10 +291,10 @@ namespace OpenSim | |||
291 | 291 | ||
292 | m_console.Commands.AddCommand("region", false, "save oar", | 292 | m_console.Commands.AddCommand("region", false, "save oar", |
293 | //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]", | 293 | //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]", |
294 | "save oar [-p|--profile=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]", | 294 | "save oar [-h|--home=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]", |
295 | "Save a region's data to an OAR archive.", | 295 | "Save a region's data to an OAR archive.", |
296 | // "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine | 296 | // "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine |
297 | "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine | 297 | "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine |
298 | + "--noassets stops assets being saved to the OAR." + Environment.NewLine | 298 | + "--noassets stops assets being saved to the OAR." + Environment.NewLine |
299 | + "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine | 299 | + "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine |
300 | + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine | 300 | + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index e0b02aa..150d913 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -122,12 +122,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
122 | 122 | ||
123 | scene.AddCommand( | 123 | scene.AddCommand( |
124 | this, "save iar", | 124 | this, "save iar", |
125 | "save iar [--p|-profile=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]", | 125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]", |
126 | "Save user inventory archive (IAR).", | 126 | "Save user inventory archive (IAR).", |
127 | "<first> is the user's first name." + Environment.NewLine | 127 | "<first> is the user's first name." + Environment.NewLine |
128 | + "<last> is the user's last name." + Environment.NewLine | 128 | + "<last> is the user's last name." + Environment.NewLine |
129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine | 129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine |
130 | + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine | 130 | + "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine |
131 | + "-c|--creators preserves information about foreign creators." + Environment.NewLine | 131 | + "-c|--creators preserves information about foreign creators." + Environment.NewLine |
132 | + "-v|--verbose extra debug messages." + Environment.NewLine | 132 | + "-v|--verbose extra debug messages." + Environment.NewLine |
133 | + "--noassets stops assets being saved to the IAR." | 133 | + "--noassets stops assets being saved to the IAR." |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 48f58f0..2d54ed1 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -1153,7 +1153,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1153 | LandData.MusicURL = url; | 1153 | LandData.MusicURL = url; |
1154 | SendLandUpdateToAvatarsOverMe(); | 1154 | SendLandUpdateToAvatarsOverMe(); |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | /// <summary> | ||
1158 | /// Get the music url for this land parcel | ||
1159 | /// </summary> | ||
1160 | /// <returns>The music url.</returns> | ||
1161 | public string GetMusicUrl() | ||
1162 | { | ||
1163 | return LandData.MusicURL; | ||
1164 | } | ||
1165 | |||
1157 | #endregion | 1166 | #endregion |
1158 | } | 1167 | } |
1159 | } | 1168 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e005698..31d9ce59 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1463,7 +1463,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1463 | // If we've found the item in the user's inventory or in the library | 1463 | // If we've found the item in the user's inventory or in the library |
1464 | if (item != null) | 1464 | if (item != null) |
1465 | { | 1465 | { |
1466 | part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); | 1466 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID); |
1467 | m_log.InfoFormat( | 1467 | m_log.InfoFormat( |
1468 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 1468 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
1469 | item.Name, primLocalID, remoteClient.Name); | 1469 | item.Name, primLocalID, remoteClient.Name); |
@@ -1572,104 +1572,130 @@ namespace OpenSim.Region.Framework.Scenes | |||
1572 | /// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory | 1572 | /// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory |
1573 | /// </summary> | 1573 | /// </summary> |
1574 | /// <param name="remoteClient"></param> | 1574 | /// <param name="remoteClient"></param> |
1575 | /// <param name="itemID"> </param> | 1575 | /// <param name="itemBase"> </param> |
1576 | /// <param name="transactionID"></param> | ||
1576 | /// <param name="localID"></param> | 1577 | /// <param name="localID"></param> |
1577 | public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID) | 1578 | public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID) |
1578 | { | 1579 | { |
1579 | UUID itemID = itemBase.ID; | 1580 | SceneObjectPart partWhereRezzed; |
1581 | |||
1582 | if (itemBase.ID != UUID.Zero) | ||
1583 | partWhereRezzed = RezScriptFromAgentInventory(remoteClient.AgentId, itemBase.ID, localID); | ||
1584 | else | ||
1585 | partWhereRezzed = RezNewScript(remoteClient.AgentId, itemBase); | ||
1586 | |||
1587 | if (partWhereRezzed != null) | ||
1588 | partWhereRezzed.SendPropertiesToClient(remoteClient); | ||
1589 | } | ||
1590 | |||
1591 | /// <summary> | ||
1592 | /// Rez a script into a prim from an agent inventory. | ||
1593 | /// </summary> | ||
1594 | /// <param name="agentID"></param> | ||
1595 | /// <param name="fromItemID"></param> | ||
1596 | /// <param name="localID"></param> | ||
1597 | /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> | ||
1598 | public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID) | ||
1599 | { | ||
1580 | UUID copyID = UUID.Random(); | 1600 | UUID copyID = UUID.Random(); |
1601 | InventoryItemBase item = new InventoryItemBase(fromItemID, agentID); | ||
1602 | item = InventoryService.GetItem(item); | ||
1581 | 1603 | ||
1582 | if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory | 1604 | // Try library |
1605 | // XXX clumsy, possibly should be one call | ||
1606 | if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) | ||
1583 | { | 1607 | { |
1584 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 1608 | item = LibraryService.LibraryRootFolder.FindItem(fromItemID); |
1585 | item = InventoryService.GetItem(item); | 1609 | } |
1586 | 1610 | ||
1587 | // Try library | 1611 | if (item != null) |
1588 | // XXX clumsy, possibly should be one call | 1612 | { |
1589 | if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) | 1613 | SceneObjectPart part = GetSceneObjectPart(localID); |
1614 | if (part != null) | ||
1590 | { | 1615 | { |
1591 | item = LibraryService.LibraryRootFolder.FindItem(itemID); | 1616 | if (!Permissions.CanEditObjectInventory(part.UUID, agentID)) |
1592 | } | 1617 | return null; |
1593 | 1618 | ||
1594 | if (item != null) | 1619 | part.ParentGroup.AddInventoryItem(agentID, localID, item, copyID); |
1595 | { | 1620 | // TODO: switch to posting on_rez here when scripts |
1596 | SceneObjectPart part = GetSceneObjectPart(localID); | 1621 | // have state in inventory |
1597 | if (part != null) | 1622 | part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); |
1598 | { | ||
1599 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
1600 | return; | ||
1601 | 1623 | ||
1602 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 1624 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
1603 | // TODO: switch to posting on_rez here when scripts | 1625 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
1604 | // have state in inventory | 1626 | // item.inventoryName, localID, remoteClient.Name); |
1605 | part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); | 1627 | part.ParentGroup.ResumeScripts(); |
1606 | 1628 | ||
1607 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 1629 | return part; |
1608 | // "Rezzed script {0} into prim local ID {1} for user {2}", | ||
1609 | // item.inventoryName, localID, remoteClient.Name); | ||
1610 | part.SendPropertiesToClient(remoteClient); | ||
1611 | part.ParentGroup.ResumeScripts(); | ||
1612 | } | ||
1613 | else | ||
1614 | { | ||
1615 | m_log.ErrorFormat( | ||
1616 | "[PRIM INVENTORY]: " + | ||
1617 | "Could not rez script {0} into prim local ID {1} for user {2}" | ||
1618 | + " because the prim could not be found in the region!", | ||
1619 | item.Name, localID, remoteClient.Name); | ||
1620 | } | ||
1621 | } | 1630 | } |
1622 | else | 1631 | else |
1623 | { | 1632 | { |
1624 | m_log.ErrorFormat( | 1633 | m_log.ErrorFormat( |
1625 | "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", | 1634 | "[PRIM INVENTORY]: " + |
1626 | itemID, remoteClient.Name); | 1635 | "Could not rez script {0} into prim local ID {1} for user {2}" |
1636 | + " because the prim could not be found in the region!", | ||
1637 | item.Name, localID, agentID); | ||
1627 | } | 1638 | } |
1628 | } | 1639 | } |
1629 | else // script has been rezzed directly into a prim's inventory | 1640 | else |
1630 | { | 1641 | { |
1631 | SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); | 1642 | m_log.ErrorFormat( |
1632 | if (part == null) | 1643 | "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", |
1633 | return; | 1644 | fromItemID, agentID); |
1645 | } | ||
1634 | 1646 | ||
1635 | if (!Permissions.CanCreateObjectInventory( | 1647 | return null; |
1636 | itemBase.InvType, part.UUID, remoteClient.AgentId)) | 1648 | } |
1637 | return; | ||
1638 | 1649 | ||
1639 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1650 | /// <summary> |
1640 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), | 1651 | /// Rez a new script from nothing. |
1641 | remoteClient.AgentId); | 1652 | /// </summary> |
1642 | AssetService.Store(asset); | 1653 | /// <param name="remoteClient"></param> |
1654 | /// <param name="itemBase"></param> | ||
1655 | /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> | ||
1656 | public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) | ||
1657 | { | ||
1658 | // The part ID is the folder ID! | ||
1659 | SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); | ||
1660 | if (part == null) | ||
1661 | return null; | ||
1643 | 1662 | ||
1644 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1663 | if (!Permissions.CanCreateObjectInventory(itemBase.InvType, part.UUID, agentID)) |
1645 | 1664 | return null; | |
1646 | taskItem.ResetIDs(itemBase.Folder); | ||
1647 | taskItem.ParentID = itemBase.Folder; | ||
1648 | taskItem.CreationDate = (uint)itemBase.CreationDate; | ||
1649 | taskItem.Name = itemBase.Name; | ||
1650 | taskItem.Description = itemBase.Description; | ||
1651 | taskItem.Type = itemBase.AssetType; | ||
1652 | taskItem.InvType = itemBase.InvType; | ||
1653 | taskItem.OwnerID = itemBase.Owner; | ||
1654 | taskItem.CreatorID = itemBase.CreatorIdAsUuid; | ||
1655 | taskItem.BasePermissions = itemBase.BasePermissions; | ||
1656 | taskItem.CurrentPermissions = itemBase.CurrentPermissions; | ||
1657 | taskItem.EveryonePermissions = itemBase.EveryOnePermissions; | ||
1658 | taskItem.GroupPermissions = itemBase.GroupPermissions; | ||
1659 | taskItem.NextPermissions = itemBase.NextPermissions; | ||
1660 | taskItem.GroupID = itemBase.GroupID; | ||
1661 | taskItem.GroupPermissions = 0; | ||
1662 | taskItem.Flags = itemBase.Flags; | ||
1663 | taskItem.PermsGranter = UUID.Zero; | ||
1664 | taskItem.PermsMask = 0; | ||
1665 | taskItem.AssetID = asset.FullID; | ||
1666 | |||
1667 | part.Inventory.AddInventoryItem(taskItem, false); | ||
1668 | part.SendPropertiesToClient(remoteClient); | ||
1669 | 1665 | ||
1670 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); | 1666 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1671 | part.ParentGroup.ResumeScripts(); | 1667 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1672 | } | 1668 | agentID); |
1669 | AssetService.Store(asset); | ||
1670 | |||
1671 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
1672 | |||
1673 | taskItem.ResetIDs(itemBase.Folder); | ||
1674 | taskItem.ParentID = itemBase.Folder; | ||
1675 | taskItem.CreationDate = (uint)itemBase.CreationDate; | ||
1676 | taskItem.Name = itemBase.Name; | ||
1677 | taskItem.Description = itemBase.Description; | ||
1678 | taskItem.Type = itemBase.AssetType; | ||
1679 | taskItem.InvType = itemBase.InvType; | ||
1680 | taskItem.OwnerID = itemBase.Owner; | ||
1681 | taskItem.CreatorID = itemBase.CreatorIdAsUuid; | ||
1682 | taskItem.BasePermissions = itemBase.BasePermissions; | ||
1683 | taskItem.CurrentPermissions = itemBase.CurrentPermissions; | ||
1684 | taskItem.EveryonePermissions = itemBase.EveryOnePermissions; | ||
1685 | taskItem.GroupPermissions = itemBase.GroupPermissions; | ||
1686 | taskItem.NextPermissions = itemBase.NextPermissions; | ||
1687 | taskItem.GroupID = itemBase.GroupID; | ||
1688 | taskItem.GroupPermissions = 0; | ||
1689 | taskItem.Flags = itemBase.Flags; | ||
1690 | taskItem.PermsGranter = UUID.Zero; | ||
1691 | taskItem.PermsMask = 0; | ||
1692 | taskItem.AssetID = asset.FullID; | ||
1693 | |||
1694 | part.Inventory.AddInventoryItem(taskItem, false); | ||
1695 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); | ||
1696 | part.ParentGroup.ResumeScripts(); | ||
1697 | |||
1698 | return part; | ||
1673 | } | 1699 | } |
1674 | 1700 | ||
1675 | /// <summary> | 1701 | /// <summary> |
@@ -1678,7 +1704,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1678 | /// <param name="remoteClient"></param> | 1704 | /// <param name="remoteClient"></param> |
1679 | /// <param name="itemID"> </param> | 1705 | /// <param name="itemID"> </param> |
1680 | /// <param name="localID"></param> | 1706 | /// <param name="localID"></param> |
1681 | public void RezScript(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) | 1707 | public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) |
1682 | { | 1708 | { |
1683 | TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); | 1709 | TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); |
1684 | 1710 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index c7da4f4..b56d3fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -79,13 +79,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
79 | /// <summary> | 79 | /// <summary> |
80 | /// Add an inventory item from a user's inventory to a prim in this scene object. | 80 | /// Add an inventory item from a user's inventory to a prim in this scene object. |
81 | /// </summary> | 81 | /// </summary> |
82 | /// <param name="remoteClient">The client adding the item.</param> | 82 | /// <param name="agentID">The agent adding the item.</param> |
83 | /// <param name="localID">The local ID of the part receiving the add.</param> | 83 | /// <param name="localID">The local ID of the part receiving the add.</param> |
84 | /// <param name="item">The user inventory item being added.</param> | 84 | /// <param name="item">The user inventory item being added.</param> |
85 | /// <param name="copyItemID">The item UUID that should be used by the new item.</param> | 85 | /// <param name="copyItemID">The item UUID that should be used by the new item.</param> |
86 | /// <returns></returns> | 86 | /// <returns></returns> |
87 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, | 87 | public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID) |
88 | InventoryItemBase item, UUID copyItemID) | ||
89 | { | 88 | { |
90 | // m_log.DebugFormat( | 89 | // m_log.DebugFormat( |
91 | // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", | 90 | // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", |
@@ -107,9 +106,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
107 | taskItem.Type = item.AssetType; | 106 | taskItem.Type = item.AssetType; |
108 | taskItem.InvType = item.InvType; | 107 | taskItem.InvType = item.InvType; |
109 | 108 | ||
110 | if (remoteClient != null && | 109 | if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions()) |
111 | remoteClient.AgentId != part.OwnerID && | ||
112 | m_scene.Permissions.PropagatePermissions()) | ||
113 | { | 110 | { |
114 | taskItem.BasePermissions = item.BasePermissions & | 111 | taskItem.BasePermissions = item.BasePermissions & |
115 | item.NextPermissions; | 112 | item.NextPermissions; |
@@ -144,11 +141,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | // taskItem.SaleType = item.SaleType; | 141 | // taskItem.SaleType = item.SaleType; |
145 | taskItem.CreationDate = (uint)item.CreationDate; | 142 | taskItem.CreationDate = (uint)item.CreationDate; |
146 | 143 | ||
147 | bool addFromAllowedDrop = false; | 144 | bool addFromAllowedDrop = agentID != part.OwnerID; |
148 | if (remoteClient != null) | ||
149 | { | ||
150 | addFromAllowedDrop = remoteClient.AgentId != part.OwnerID; | ||
151 | } | ||
152 | 145 | ||
153 | part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); | 146 | part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); |
154 | 147 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 7704002..e9a849c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -72,6 +72,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
72 | 72 | ||
73 | private bool m_initialized = false; | 73 | private bool m_initialized = false; |
74 | 74 | ||
75 | private int m_detailedStatsStep = 0; | ||
76 | |||
75 | public IMesher mesher; | 77 | public IMesher mesher; |
76 | private float m_meshLOD; | 78 | private float m_meshLOD; |
77 | public float MeshLOD | 79 | public float MeshLOD |
@@ -192,6 +194,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
192 | m_meshLOD = 8f; | 194 | m_meshLOD = 8f; |
193 | m_sculptLOD = 32f; | 195 | m_sculptLOD = 32f; |
194 | 196 | ||
197 | m_detailedStatsStep = 0; // disabled | ||
198 | |||
195 | m_maxSubSteps = 10; | 199 | m_maxSubSteps = 10; |
196 | m_fixedTimeStep = 1f / 60f; | 200 | m_fixedTimeStep = 1f / 60f; |
197 | m_maxCollisionsPerFrame = 2048; | 201 | m_maxCollisionsPerFrame = 2048; |
@@ -209,8 +213,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
209 | parms.deactivationTime = 0.2f; | 213 | parms.deactivationTime = 0.2f; |
210 | parms.linearSleepingThreshold = 0.8f; | 214 | parms.linearSleepingThreshold = 0.8f; |
211 | parms.angularSleepingThreshold = 1.0f; | 215 | parms.angularSleepingThreshold = 1.0f; |
212 | parms.ccdMotionThreshold = 0.5f; // set to zero to disable | 216 | parms.ccdMotionThreshold = 0.0f; // set to zero to disable |
213 | parms.ccdSweptSphereRadius = 0.2f; | 217 | parms.ccdSweptSphereRadius = 0.0f; |
218 | parms.contactProcessingThreshold = 0.1f; | ||
214 | 219 | ||
215 | parms.terrainFriction = 0.5f; | 220 | parms.terrainFriction = 0.5f; |
216 | parms.terrainHitFraction = 0.8f; | 221 | parms.terrainHitFraction = 0.8f; |
@@ -231,6 +236,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
231 | _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim); | 236 | _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim); |
232 | _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); | 237 | _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); |
233 | 238 | ||
239 | m_detailedStatsStep = pConfig.GetInt("DetailedStatsStep", m_detailedStatsStep); | ||
234 | m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD); | 240 | m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD); |
235 | m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD); | 241 | m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD); |
236 | 242 | ||
@@ -253,6 +259,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
253 | parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold", parms.angularSleepingThreshold); | 259 | parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold", parms.angularSleepingThreshold); |
254 | parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold); | 260 | parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold); |
255 | parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius); | 261 | parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius); |
262 | parms.contactProcessingThreshold = pConfig.GetFloat("ContactProcessingThreshold", parms.contactProcessingThreshold); | ||
256 | 263 | ||
257 | parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction); | 264 | parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction); |
258 | parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); | 265 | parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); |
@@ -398,6 +405,14 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
398 | } | 405 | } |
399 | } | 406 | } |
400 | 407 | ||
408 | if (m_detailedStatsStep > 0) | ||
409 | { | ||
410 | if ((m_simulationStep % m_detailedStatsStep) == 0) | ||
411 | { | ||
412 | BulletSimAPI.DumpBulletStatistics(); | ||
413 | } | ||
414 | } | ||
415 | |||
401 | // TODO: FIX THIS: fps calculation wrong. This calculation always returns about 1 in normal operation. | 416 | // TODO: FIX THIS: fps calculation wrong. This calculation always returns about 1 in normal operation. |
402 | return timeStep / (numSubSteps * m_fixedTimeStep) * 1000f; | 417 | return timeStep / (numSubSteps * m_fixedTimeStep) * 1000f; |
403 | } | 418 | } |
@@ -671,6 +686,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
671 | new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"), | 686 | new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"), |
672 | new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"), | 687 | new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"), |
673 | new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"), | 688 | new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"), |
689 | new PhysParameterEntry("DetailedStats", "Frames between outputting detailed phys stats. Zero is off"), | ||
674 | 690 | ||
675 | new PhysParameterEntry("DefaultFriction", "Friction factor used on new objects"), | 691 | new PhysParameterEntry("DefaultFriction", "Friction factor used on new objects"), |
676 | new PhysParameterEntry("DefaultDensity", "Density for new objects" ), | 692 | new PhysParameterEntry("DefaultDensity", "Density for new objects" ), |
@@ -685,6 +701,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
685 | new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), | 701 | new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), |
686 | // new PhysParameterEntry("CcdMotionThreshold", "" ), | 702 | // new PhysParameterEntry("CcdMotionThreshold", "" ), |
687 | // new PhysParameterEntry("CcdSweptSphereRadius", "" ), | 703 | // new PhysParameterEntry("CcdSweptSphereRadius", "" ), |
704 | new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), | ||
688 | 705 | ||
689 | new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), | 706 | new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), |
690 | new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), | 707 | new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), |
@@ -715,6 +732,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
715 | string lparm = parm.ToLower(); | 732 | string lparm = parm.ToLower(); |
716 | switch (lparm) | 733 | switch (lparm) |
717 | { | 734 | { |
735 | case "detailedstats": m_detailedStatsStep = (int)val; break; | ||
718 | case "meshlod": m_meshLOD = (int)val; break; | 736 | case "meshlod": m_meshLOD = (int)val; break; |
719 | case "sculptlod": m_sculptLOD = (int)val; break; | 737 | case "sculptlod": m_sculptLOD = (int)val; break; |
720 | case "maxsubstep": m_maxSubSteps = (int)val; break; | 738 | case "maxsubstep": m_maxSubSteps = (int)val; break; |
@@ -725,7 +743,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
725 | case "defaultdensity": m_params[0].defaultDensity = val; break; | 743 | case "defaultdensity": m_params[0].defaultDensity = val; break; |
726 | case "defaultrestitution": m_params[0].defaultRestitution = val; break; | 744 | case "defaultrestitution": m_params[0].defaultRestitution = val; break; |
727 | case "collisionmargin": m_params[0].collisionMargin = val; break; | 745 | case "collisionmargin": m_params[0].collisionMargin = val; break; |
728 | case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; | 746 | case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; |
729 | 747 | ||
730 | case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; | 748 | case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; |
731 | case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; | 749 | case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; |
@@ -734,6 +752,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
734 | case "angularsleepingthreshold": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; | 752 | case "angularsleepingthreshold": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; |
735 | case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; | 753 | case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; |
736 | case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; | 754 | case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; |
755 | case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; | ||
737 | 756 | ||
738 | // set a terrain physical feature and cause terrain to be recalculated | 757 | // set a terrain physical feature and cause terrain to be recalculated |
739 | case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; | 758 | case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; |
@@ -741,10 +760,10 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
741 | case "terrainrestitution": m_params[0].terrainRestitution = val; TaintedUpdateParameter("terrain", 0, val); break; | 760 | case "terrainrestitution": m_params[0].terrainRestitution = val; TaintedUpdateParameter("terrain", 0, val); break; |
742 | // set an avatar physical feature and cause avatar(s) to be recalculated | 761 | // set an avatar physical feature and cause avatar(s) to be recalculated |
743 | case "avatarfriction": UpdateParameterAvatars(ref m_params[0].avatarFriction, "avatar", localID, val); break; | 762 | case "avatarfriction": UpdateParameterAvatars(ref m_params[0].avatarFriction, "avatar", localID, val); break; |
744 | case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break; | 763 | case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break; |
745 | case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; | 764 | case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; |
746 | case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; | 765 | case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; |
747 | case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; | 766 | case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; |
748 | 767 | ||
749 | default: ret = false; break; | 768 | default: ret = false; break; |
750 | } | 769 | } |
@@ -816,6 +835,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
816 | bool ret = true; | 835 | bool ret = true; |
817 | switch (parm.ToLower()) | 836 | switch (parm.ToLower()) |
818 | { | 837 | { |
838 | case "detailedstats": val = (int)m_detailedStatsStep; break; | ||
819 | case "meshlod": val = (float)m_meshLOD; break; | 839 | case "meshlod": val = (float)m_meshLOD; break; |
820 | case "sculptlod": val = (float)m_sculptLOD; break; | 840 | case "sculptlod": val = (float)m_sculptLOD; break; |
821 | case "maxsubstep": val = (float)m_maxSubSteps; break; | 841 | case "maxsubstep": val = (float)m_maxSubSteps; break; |
@@ -835,6 +855,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
835 | case "angularsleepingthreshold": val = m_params[0].angularDamping; break; | 855 | case "angularsleepingthreshold": val = m_params[0].angularDamping; break; |
836 | case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; | 856 | case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; |
837 | case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; | 857 | case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; |
858 | case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; | ||
838 | 859 | ||
839 | case "terrainfriction": val = m_params[0].terrainFriction; break; | 860 | case "terrainfriction": val = m_params[0].terrainFriction; break; |
840 | case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; | 861 | case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index a610c8d..d12bd7d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -122,6 +122,7 @@ public struct ConfigurationParameters | |||
122 | public float angularSleepingThreshold; | 122 | public float angularSleepingThreshold; |
123 | public float ccdMotionThreshold; | 123 | public float ccdMotionThreshold; |
124 | public float ccdSweptSphereRadius; | 124 | public float ccdSweptSphereRadius; |
125 | public float contactProcessingThreshold; | ||
125 | 126 | ||
126 | public float terrainFriction; | 127 | public float terrainFriction; |
127 | public float terrainHitFraction; | 128 | public float terrainHitFraction; |
@@ -248,6 +249,9 @@ public static extern RaycastHit RayTest(uint worldID, uint id, Vector3 from, Vec | |||
248 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 249 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
249 | public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); | 250 | public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); |
250 | 251 | ||
252 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
253 | public static extern void DumpBulletStatistics(); | ||
254 | |||
251 | // Log a debug message | 255 | // Log a debug message |
252 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | 256 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
253 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | 257 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index c6e8286..7c1c046 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1048,6 +1048,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1048 | CAPSULE_RADIUS = 0.01f; | 1048 | CAPSULE_RADIUS = 0.01f; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | // lock (OdeScene.UniversalColliderSyncObject) | ||
1051 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); | 1052 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); |
1052 | 1053 | ||
1053 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); | 1054 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); |
@@ -1179,7 +1180,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1179 | 1180 | ||
1180 | if (Shell != IntPtr.Zero) | 1181 | if (Shell != IntPtr.Zero) |
1181 | { | 1182 | { |
1183 | // lock (OdeScene.UniversalColliderSyncObject) | ||
1182 | d.GeomDestroy(Shell); | 1184 | d.GeomDestroy(Shell); |
1185 | |||
1183 | _parent_scene.geom_name_map.Remove(Shell); | 1186 | _parent_scene.geom_name_map.Remove(Shell); |
1184 | _parent_scene.actor_name_map.Remove(Shell); | 1187 | _parent_scene.actor_name_map.Remove(Shell); |
1185 | 1188 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 37daf46..4530c09 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -105,6 +105,32 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
105 | private readonly ILog m_log; | 105 | private readonly ILog m_log; |
106 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); | 106 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); |
107 | 107 | ||
108 | /// <summary> | ||
109 | /// Provide a sync object so that only one thread calls d.Collide() at a time across all OdeScene instances. | ||
110 | /// </summary> | ||
111 | /// <remarks> | ||
112 | /// With ODE as of r1755 (though also tested on r1860), only one thread can call d.Collide() at a | ||
113 | /// time, even where physics objects are in entirely different ODE worlds. This is because generating contacts | ||
114 | /// uses a static cache at the ODE level. | ||
115 | /// | ||
116 | /// Without locking, simulators running multiple regions will eventually crash with a native stack trace similar | ||
117 | /// to | ||
118 | /// | ||
119 | /// mono() [0x489171] | ||
120 | /// mono() [0x4d154f] | ||
121 | /// /lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7f6ded592c60] | ||
122 | /// .../opensim/bin/libode-x86_64.so(_ZN6Opcode11OBBCollider8_CollideEPKNS_14AABBNoLeafNodeE+0xd7a) [0x7f6dd822628a] | ||
123 | /// | ||
124 | /// ODE provides an experimental option to cache in thread local storage but compiling ODE with this option | ||
125 | /// causes OpenSimulator to immediately crash with a native stack trace similar to | ||
126 | /// | ||
127 | /// mono() [0x489171] | ||
128 | /// mono() [0x4d154f] | ||
129 | /// /lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7f03c9849c60] | ||
130 | /// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82] | ||
131 | /// </remarks> | ||
132 | internal static Object UniversalColliderSyncObject = new Object(); | ||
133 | |||
108 | private Random fluidRandomizer = new Random(Environment.TickCount); | 134 | private Random fluidRandomizer = new Random(Environment.TickCount); |
109 | 135 | ||
110 | private const uint m_regionWidth = Constants.RegionSize; | 136 | private const uint m_regionWidth = Constants.RegionSize; |
@@ -799,7 +825,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
799 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) | 825 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) |
800 | return; | 826 | return; |
801 | 827 | ||
802 | count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); | 828 | lock (OdeScene.UniversalColliderSyncObject) |
829 | count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); | ||
830 | |||
803 | if (count > contacts.Length) | 831 | if (count > contacts.Length) |
804 | m_log.Error("[ODE SCENE]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length); | 832 | m_log.Error("[ODE SCENE]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length); |
805 | } | 833 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fda4772..23e3e15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7003,7 +7003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7003 | if ((scriptItem.BasePermissions & (uint)PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID) | 7003 | if ((scriptItem.BasePermissions & (uint)PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID) |
7004 | { | 7004 | { |
7005 | // the rest of the permission checks are done in RezScript, so check the pin there as well | 7005 | // the rest of the permission checks are done in RezScript, so check the pin there as well |
7006 | World.RezScript(srcId, m_host, destId, pin, running, start_param); | 7006 | World.RezScriptFromPrim(srcId, m_host, destId, pin, running, start_param); |
7007 | 7007 | ||
7008 | if ((scriptItem.BasePermissions & (uint)PermissionMask.Copy) == 0) | 7008 | if ((scriptItem.BasePermissions & (uint)PermissionMask.Copy) == 0) |
7009 | m_host.Inventory.RemoveInventoryItem(srcId); | 7009 | m_host.Inventory.RemoveInventoryItem(srcId); |
@@ -8065,6 +8065,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8065 | ScriptSleep(2000); | 8065 | ScriptSleep(2000); |
8066 | } | 8066 | } |
8067 | 8067 | ||
8068 | public LSL_String llGetParcelMusicURL() | ||
8069 | { | ||
8070 | m_host.AddScriptLPS(1); | ||
8071 | |||
8072 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
8073 | |||
8074 | if (land.LandData.OwnerID != m_host.OwnerID) | ||
8075 | return String.Empty; | ||
8076 | |||
8077 | return land.GetMusicUrl(); | ||
8078 | } | ||
8079 | |||
8068 | public LSL_Vector llGetRootPosition() | 8080 | public LSL_Vector llGetRootPosition() |
8069 | { | 8081 | { |
8070 | m_host.AddScriptLPS(1); | 8082 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index e0027b2..f4de93e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -162,6 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
162 | LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param); | 162 | LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param); |
163 | LSL_Integer llGetParcelFlags(LSL_Vector pos); | 163 | LSL_Integer llGetParcelFlags(LSL_Vector pos); |
164 | LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide); | 164 | LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide); |
165 | LSL_String llGetParcelMusicURL(); | ||
165 | LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide); | 166 | LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide); |
166 | LSL_List llGetParcelPrimOwners(LSL_Vector pos); | 167 | LSL_List llGetParcelPrimOwners(LSL_Vector pos); |
167 | LSL_Integer llGetPermissions(); | 168 | LSL_Integer llGetPermissions(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 231cd7e..e0c81c7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -661,6 +661,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
661 | return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); | 661 | return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); |
662 | } | 662 | } |
663 | 663 | ||
664 | public LSL_String llGetParcelMusicURL() | ||
665 | { | ||
666 | return m_LSL_Functions.llGetParcelMusicURL(); | ||
667 | } | ||
668 | |||
664 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) | 669 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) |
665 | { | 670 | { |
666 | return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); | 671 | return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); |
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index fca9fd0..24a9418 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs | |||
@@ -442,7 +442,7 @@ namespace OpenSim.Region.UserStatistics | |||
442 | public string ViewerStatsReport(string request, string path, string param, | 442 | public string ViewerStatsReport(string request, string path, string param, |
443 | UUID agentID, Caps caps) | 443 | UUID agentID, Caps caps) |
444 | { | 444 | { |
445 | //m_log.Debug(request); | 445 | // m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID); |
446 | 446 | ||
447 | UpdateUserStats(ParseViewerStats(request,agentID), dbConn); | 447 | UpdateUserStats(ParseViewerStats(request,agentID), dbConn); |
448 | 448 | ||
@@ -655,13 +655,13 @@ namespace OpenSim.Region.UserStatistics | |||
655 | updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); | 655 | updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); |
656 | updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); | 656 | updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); |
657 | updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); | 657 | updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); |
658 | m_log.Debug("UPDATE"); | 658 | // m_log.Debug("UPDATE"); |
659 | 659 | ||
660 | int result = updatecmd.ExecuteNonQuery(); | 660 | int result = updatecmd.ExecuteNonQuery(); |
661 | 661 | ||
662 | if (result == 0) | 662 | if (result == 0) |
663 | { | 663 | { |
664 | m_log.Debug("INSERT"); | 664 | // m_log.Debug("INSERT"); |
665 | updatecmd.CommandText = SQL_STATS_TABLE_INSERT; | 665 | updatecmd.CommandText = SQL_STATS_TABLE_INSERT; |
666 | try | 666 | try |
667 | { | 667 | { |