diff options
author | Teravus Ovares | 2008-05-16 23:11:00 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-16 23:11:00 +0000 |
commit | aa5197304e2bb8c6b2f7bf3c8e86256042cf23b8 (patch) | |
tree | c55e7c94e4978bbc073947da44b383c692d8f5c6 /OpenSim/Region/Environment | |
parent | minor change to justin's previous fix that should still (diff) | |
download | opensim-SC_OLD-aa5197304e2bb8c6b2f7bf3c8e86256042cf23b8.zip opensim-SC_OLD-aa5197304e2bb8c6b2f7bf3c8e86256042cf23b8.tar.gz opensim-SC_OLD-aa5197304e2bb8c6b2f7bf3c8e86256042cf23b8.tar.bz2 opensim-SC_OLD-aa5197304e2bb8c6b2f7bf3c8e86256042cf23b8.tar.xz |
* Committing patch from mantis 0001297: [PATCH] Fix behavior of child prim inventories. Also enables 'New Script' button. from Melanie. Thanks Melanie!
Diffstat (limited to 'OpenSim/Region/Environment')
4 files changed, 68 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 5e2ccec..0447631 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -221,7 +221,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
221 | // Update item with new asset | 221 | // Update item with new asset |
222 | item.AssetID = asset.FullID; | 222 | item.AssetID = asset.FullID; |
223 | group.UpdateInventoryItem(item); | 223 | group.UpdateInventoryItem(item); |
224 | group.GetProperties(remoteClient); | 224 | part.GetProperties(remoteClient); |
225 | 225 | ||
226 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) | 226 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) |
227 | if (isScriptRunning) | 227 | if (isScriptRunning) |
@@ -572,7 +572,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
572 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, | 572 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, |
573 | AssetBase asset, uint nextOwnerMask) | 573 | AssetBase asset, uint nextOwnerMask) |
574 | { | 574 | { |
575 | CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask, nextOwnerMask, 0, nextOwnerMask); | 575 | CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask); |
576 | } | 576 | } |
577 | 577 | ||
578 | /// <summary> | 578 | /// <summary> |
@@ -789,11 +789,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
789 | /// <param name="localID"></param> | 789 | /// <param name="localID"></param> |
790 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) | 790 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) |
791 | { | 791 | { |
792 | SceneObjectGroup group = GetGroupByPrim(localID); | 792 | SceneObjectPart part = GetSceneObjectPart(localID); |
793 | SceneObjectGroup group = part.ParentGroup; | ||
793 | if (group != null) | 794 | if (group != null) |
794 | { | 795 | { |
795 | int type = group.RemoveInventoryItem(localID, itemID); | 796 | int type = group.RemoveInventoryItem(localID, itemID); |
796 | group.GetProperties(remoteClient); | 797 | part.GetProperties(remoteClient); |
797 | if (type == 10) | 798 | if (type == 10) |
798 | { | 799 | { |
799 | EventManager.TriggerRemoveScript(localID, itemID); | 800 | EventManager.TriggerRemoveScript(localID, itemID); |
@@ -917,7 +918,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
917 | m_log.InfoFormat( | 918 | m_log.InfoFormat( |
918 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 919 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
919 | item.Name, primLocalID, remoteClient.Name); | 920 | item.Name, primLocalID, remoteClient.Name); |
920 | part.ParentGroup.GetProperties(remoteClient); | 921 | part.GetProperties(remoteClient); |
921 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 922 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
922 | { | 923 | { |
923 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 924 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
@@ -948,8 +949,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
948 | /// <param name="remoteClient"></param> | 949 | /// <param name="remoteClient"></param> |
949 | /// <param name="itemID"> </param> | 950 | /// <param name="itemID"> </param> |
950 | /// <param name="localID"></param> | 951 | /// <param name="localID"></param> |
951 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 952 | public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, LLUUID transactionID, uint localID) |
952 | { | 953 | { |
954 | LLUUID itemID=itemBase.ID; | ||
953 | LLUUID copyID = LLUUID.Random(); | 955 | LLUUID copyID = LLUUID.Random(); |
954 | 956 | ||
955 | if (itemID != LLUUID.Zero) | 957 | if (itemID != LLUUID.Zero) |
@@ -974,7 +976,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
974 | { | 976 | { |
975 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 977 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
976 | part.ParentGroup.StartScript(localID, copyID); | 978 | part.ParentGroup.StartScript(localID, copyID); |
977 | part.ParentGroup.GetProperties(remoteClient); | 979 | part.GetProperties(remoteClient); |
978 | 980 | ||
979 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 981 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
980 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 982 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
@@ -999,11 +1001,38 @@ namespace OpenSim.Region.Environment.Scenes | |||
999 | } | 1001 | } |
1000 | else // If the itemID is zero then the script has been rezzed directly in an object's inventory | 1002 | else // If the itemID is zero then the script has been rezzed directly in an object's inventory |
1001 | { | 1003 | { |
1002 | // not yet implemented | 1004 | SceneObjectPart part=GetSceneObjectPart(itemBase.Folder); |
1003 | // TODO Need to get more details from original RezScript packet | 1005 | if(part == null) |
1004 | // XXX jc tmp | 1006 | return; |
1005 | // AssetBase asset = CreateAsset("chimney sweep", "sailor.lsl", 10, 10, null); | 1007 | |
1006 | // AssetCache.AddAsset(asset); | 1008 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.InvType, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); |
1009 | AssetCache.AddAsset(asset); | ||
1010 | |||
1011 | TaskInventoryItem taskItem=new TaskInventoryItem(); | ||
1012 | |||
1013 | taskItem.ResetIDs(itemBase.Folder); | ||
1014 | taskItem.ParentID = itemBase.Folder; | ||
1015 | taskItem.CreationDate = (uint)itemBase.CreationDate; | ||
1016 | taskItem.Name = itemBase.Name; | ||
1017 | taskItem.Description = itemBase.Description; | ||
1018 | taskItem.Type = itemBase.AssetType; | ||
1019 | taskItem.InvType = itemBase.InvType; | ||
1020 | taskItem.OwnerID = itemBase.Owner; | ||
1021 | taskItem.CreatorID = itemBase.Creator; | ||
1022 | taskItem.BaseMask = itemBase.BasePermissions; | ||
1023 | taskItem.OwnerMask = itemBase.CurrentPermissions; | ||
1024 | taskItem.EveryoneMask = itemBase.EveryOnePermissions; | ||
1025 | taskItem.NextOwnerMask = itemBase.NextPermissions; | ||
1026 | taskItem.GroupID = itemBase.GroupID; | ||
1027 | taskItem.GroupMask = 0; | ||
1028 | taskItem.Flags = itemBase.Flags; | ||
1029 | taskItem.PermsGranter = LLUUID.Zero; | ||
1030 | taskItem.PermsMask = 0; | ||
1031 | taskItem.AssetID = asset.ID; | ||
1032 | |||
1033 | part.AddInventoryItem(taskItem); | ||
1034 | part.GetProperties(remoteClient); | ||
1035 | part.StartScript(taskItem); | ||
1007 | } | 1036 | } |
1008 | } | 1037 | } |
1009 | 1038 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 332d160..7f26f35 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1927,13 +1927,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1927 | /// <param name="client"></param> | 1927 | /// <param name="client"></param> |
1928 | public void GetProperties(IClientAPI client) | 1928 | public void GetProperties(IClientAPI client) |
1929 | { | 1929 | { |
1930 | 1930 | m_rootPart.GetProperties(client); | |
1931 | client.SendObjectPropertiesReply(LLUUID.Zero, (ulong)m_rootPart.CreationDate, m_rootPart.CreatorID, LLUUID.Zero, LLUUID.Zero, | ||
1932 | LLUUID.Zero, (short)m_rootPart.InventorySerial, m_rootPart.LastOwnerID, UUID, m_rootPart.OwnerID, | ||
1933 | m_rootPart.TouchName, new byte[0], m_rootPart.SitName, m_rootPart.Name, m_rootPart.Description, | ||
1934 | m_rootPart.OwnerMask, m_rootPart.NextOwnerMask, m_rootPart.GroupMask, m_rootPart.EveryoneMask, | ||
1935 | m_rootPart.BaseMask); | ||
1936 | |||
1937 | } | 1931 | } |
1938 | 1932 | ||
1939 | /// <summary> | 1933 | /// <summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index b151d75..0444685 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | private string m_inventoryFileName = String.Empty; | 44 | private string m_inventoryFileName = String.Empty; |
45 | private int m_inventoryFileNameSerial = 0; | ||
45 | 46 | ||
46 | /// <summary> | 47 | /// <summary> |
47 | /// Exposing this is not particularly good, but it's one of the least evils at the moment to see | 48 | /// Exposing this is not particularly good, but it's one of the least evils at the moment to see |
@@ -444,6 +445,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
444 | return -1; | 445 | return -1; |
445 | } | 446 | } |
446 | 447 | ||
448 | public string GetInventoryFileName() | ||
449 | { | ||
450 | if(m_inventoryFileName == String.Empty) | ||
451 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; | ||
452 | if(m_inventoryFileNameSerial < m_inventorySerial) | ||
453 | { | ||
454 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; | ||
455 | } | ||
456 | return m_inventoryFileName; | ||
457 | } | ||
458 | |||
447 | /// <summary> | 459 | /// <summary> |
448 | /// Return the name with which a client can request a xfer of this prim's inventory metadata | 460 | /// Return the name with which a client can request a xfer of this prim's inventory metadata |
449 | /// </summary> | 461 | /// </summary> |
@@ -458,7 +470,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
458 | if (m_inventorySerial > 0) | 470 | if (m_inventorySerial > 0) |
459 | { | 471 | { |
460 | client.SendTaskInventory(m_uuid, (short)m_inventorySerial, | 472 | client.SendTaskInventory(m_uuid, (short)m_inventorySerial, |
461 | Helpers.StringToField(m_inventoryFileName)); | 473 | Helpers.StringToField(GetInventoryFileName())); |
462 | return true; | 474 | return true; |
463 | } | 475 | } |
464 | else | 476 | else |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 80b93b1..a7b7692 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -759,7 +759,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
759 | public SceneObjectPart() | 759 | public SceneObjectPart() |
760 | { | 760 | { |
761 | // It's not necessary to persist this | 761 | // It's not necessary to persist this |
762 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; | ||
763 | m_TextureAnimation = new byte[0]; | 762 | m_TextureAnimation = new byte[0]; |
764 | } | 763 | } |
765 | 764 | ||
@@ -808,7 +807,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
808 | AngularVelocity = new LLVector3(0, 0, 0); | 807 | AngularVelocity = new LLVector3(0, 0, 0); |
809 | Acceleration = new LLVector3(0, 0, 0); | 808 | Acceleration = new LLVector3(0, 0, 0); |
810 | m_TextureAnimation = new byte[0]; | 809 | m_TextureAnimation = new byte[0]; |
811 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; | ||
812 | 810 | ||
813 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, | 811 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, |
814 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 812 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
@@ -2530,7 +2528,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2530 | throw new ArgumentNullException("info"); | 2528 | throw new ArgumentNullException("info"); |
2531 | } | 2529 | } |
2532 | 2530 | ||
2533 | info.AddValue("m_inventoryFileName", m_inventoryFileName); | 2531 | info.AddValue("m_inventoryFileName", GetInventoryFileName()); |
2534 | info.AddValue("m_folderID", UUID); | 2532 | info.AddValue("m_folderID", UUID); |
2535 | info.AddValue("PhysActor", PhysActor); | 2533 | info.AddValue("PhysActor", PhysActor); |
2536 | 2534 | ||
@@ -2758,5 +2756,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
2758 | 2756 | ||
2759 | return m_parentGroup.RootPart.DIE_AT_EDGE; | 2757 | return m_parentGroup.RootPart.DIE_AT_EDGE; |
2760 | } | 2758 | } |
2759 | |||
2760 | public void GetProperties(IClientAPI client) | ||
2761 | { | ||
2762 | |||
2763 | client.SendObjectPropertiesReply(LLUUID.Zero, (ulong)CreationDate, CreatorID, LLUUID.Zero, LLUUID.Zero, | ||
2764 | LLUUID.Zero, (short)InventorySerial, LastOwnerID, UUID, OwnerID, | ||
2765 | ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, | ||
2766 | ParentGroup.RootPart.OwnerMask, ParentGroup.RootPart.NextOwnerMask, ParentGroup.RootPart.GroupMask, ParentGroup.RootPart.EveryoneMask, | ||
2767 | ParentGroup.RootPart.BaseMask); | ||
2768 | |||
2769 | } | ||
2770 | |||
2761 | } | 2771 | } |
2762 | } | 2772 | } |