diff options
Diffstat (limited to 'OpenSim')
3 files changed, 211 insertions, 41 deletions
diff --git a/OpenSim/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs index 596a556..ae8eb09 100644 --- a/OpenSim/Capabilities/LLSDAssetUploadComplete.cs +++ b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs | |||
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Capabilities | |||
36 | { | 36 | { |
37 | public string new_asset = String.Empty; | 37 | public string new_asset = String.Empty; |
38 | public UUID new_inventory_item = UUID.Zero; | 38 | public UUID new_inventory_item = UUID.Zero; |
39 | // public UUID new_texture_folder_id = UUID.Zero; | ||
39 | public string state = String.Empty; | 40 | public string state = String.Empty; |
40 | public LLSDAssetUploadError error = null; | 41 | public LLSDAssetUploadError error = null; |
41 | //public bool success = false; | 42 | //public bool success = false; |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index a934113..21a1005 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -55,7 +55,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
55 | { | 55 | { |
56 | public delegate void UpLoadedAsset( | 56 | public delegate void UpLoadedAsset( |
57 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, | 57 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, |
58 | byte[] data, string inventoryType, string assetType, int cost, ref string error); | 58 | byte[] data, string inventoryType, string assetType, |
59 | int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, | ||
60 | bool IsAtestUpload, ref string error); | ||
59 | 61 | ||
60 | public delegate UUID UpdateItem(UUID itemID, byte[] data); | 62 | public delegate UUID UpdateItem(UUID itemID, byte[] data); |
61 | 63 | ||
@@ -118,8 +120,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
118 | private string m_regionName; | 120 | private string m_regionName; |
119 | private int m_levelUpload = 0; | 121 | private int m_levelUpload = 0; |
120 | private float m_PrimScaleMin = 0.001f; | 122 | private float m_PrimScaleMin = 0.001f; |
121 | private bool m_enableFreeTestModelUpload = false; | 123 | private bool m_enableFreeTestUpload = false; |
122 | private bool m_enableModelUploadTextureToInventory = false; | 124 | private bool m_enableModelUploadTextureToInventory = false; |
125 | private UUID m_testAssetsCreatorID = UUID.Zero; | ||
123 | 126 | ||
124 | private enum FileAgentInventoryState : int | 127 | private enum FileAgentInventoryState : int |
125 | { | 128 | { |
@@ -148,6 +151,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
148 | float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; | 151 | float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; |
149 | float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; | 152 | float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; |
150 | 153 | ||
154 | // can be UUID.zero. This is me at OSG, should be a valid grid ID, is case a bad config | ||
155 | UUID.TryParse("58e06f33-ea8c-4ff6-9af5-420606926118", out m_testAssetsCreatorID); | ||
156 | |||
151 | IConfigSource config = m_Scene.Config; | 157 | IConfigSource config = m_Scene.Config; |
152 | if (config != null) | 158 | if (config != null) |
153 | { | 159 | { |
@@ -169,9 +175,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
169 | modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); | 175 | modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); |
170 | modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); | 176 | modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); |
171 | modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); | 177 | modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); |
172 | m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); | ||
173 | m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); | 178 | m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); |
174 | 179 | ||
180 | m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", false); | ||
181 | string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", m_testAssetsCreatorID.ToString()); | ||
182 | if (testcreator != "") | ||
183 | { | ||
184 | UUID id; | ||
185 | UUID.TryParse(testcreator, out id); | ||
186 | if (id != null) | ||
187 | m_testAssetsCreatorID = id; | ||
188 | } | ||
189 | |||
175 | m_ModelCost.ModelMeshCostFactor = modelUploadFactor; | 190 | m_ModelCost.ModelMeshCostFactor = modelUploadFactor; |
176 | m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; | 191 | m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; |
177 | m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; | 192 | m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; |
@@ -426,13 +441,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
426 | 441 | ||
427 | return UUID.Zero; | 442 | return UUID.Zero; |
428 | } | 443 | } |
429 | /* | ||
430 | private class AssetUploaderExtraParameters | ||
431 | { | ||
432 | public int total_cost; | ||
433 | public UUID textureFolder = UUID.Zero; | ||
434 | */ | ||
435 | |||
436 | 444 | ||
437 | /// <summary> | 445 | /// <summary> |
438 | /// | 446 | /// |
@@ -477,6 +485,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
477 | } | 485 | } |
478 | 486 | ||
479 | int cost = 0; | 487 | int cost = 0; |
488 | int nreqtextures = 0; | ||
489 | int nreqmeshs= 0; | ||
490 | int nreqinstances = 0; | ||
491 | bool IsAtestUpload = false; | ||
492 | |||
480 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); | 493 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); |
481 | 494 | ||
482 | if (llsdRequest.asset_type == "texture" || | 495 | if (llsdRequest.asset_type == "texture" || |
@@ -496,7 +509,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
496 | resperror.message = "Insufficient permissions to upload"; | 509 | resperror.message = "Insufficient permissions to upload"; |
497 | resperror.identifier = UUID.Zero; | 510 | resperror.identifier = UUID.Zero; |
498 | 511 | ||
499 | |||
500 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 512 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
501 | errorResponse.uploader = ""; | 513 | errorResponse.uploader = ""; |
502 | errorResponse.state = "error"; | 514 | errorResponse.state = "error"; |
@@ -516,13 +528,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
516 | if (mm != null) | 528 | if (mm != null) |
517 | baseCost = mm.UploadCharge; | 529 | baseCost = mm.UploadCharge; |
518 | 530 | ||
531 | string warning = String.Empty; | ||
532 | |||
519 | if (llsdRequest.asset_type == "mesh") | 533 | if (llsdRequest.asset_type == "mesh") |
520 | { | 534 | { |
521 | string error; | 535 | string error; |
522 | int modelcost; | 536 | int modelcost; |
523 | 537 | ||
524 | if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, | 538 | if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, |
525 | meshcostdata, out error)) | 539 | meshcostdata, out error, ref warning)) |
526 | { | 540 | { |
527 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); | 541 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); |
528 | resperror.message = error; | 542 | resperror.message = error; |
@@ -544,8 +558,21 @@ namespace OpenSim.Region.ClientStack.Linden | |||
544 | cost = baseCost; | 558 | cost = baseCost; |
545 | } | 559 | } |
546 | 560 | ||
561 | if (m_enableFreeTestUpload && cost > 0 && mm != null) | ||
562 | { | ||
563 | string str = llsdRequest.name; | ||
564 | if (str.Length > 5 && str.StartsWith("TEST-")) | ||
565 | { | ||
566 | warning += "Upload will have no cost, but for personal test purposes only. Other uses are forbiden"; | ||
567 | IsAtestUpload = true; | ||
568 | } | ||
569 | } | ||
570 | |||
571 | if (client != null && warning != String.Empty) | ||
572 | client.SendAgentAlertMessage(warning, true); | ||
573 | |||
547 | // check funds | 574 | // check funds |
548 | if (mm != null) | 575 | if (!IsAtestUpload && mm != null && cost >0) |
549 | { | 576 | { |
550 | if (!mm.UploadCovered(client.AgentId, (int)cost)) | 577 | if (!mm.UploadCovered(client.AgentId, (int)cost)) |
551 | { | 578 | { |
@@ -572,10 +599,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
572 | UUID newInvItem = UUID.Random(); | 599 | UUID newInvItem = UUID.Random(); |
573 | UUID parentFolder = llsdRequest.folder_id; | 600 | UUID parentFolder = llsdRequest.folder_id; |
574 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 601 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
602 | UUID texturesFolder = UUID.Zero; | ||
603 | |||
604 | if(!IsAtestUpload && m_enableModelUploadTextureToInventory) | ||
605 | texturesFolder = llsdRequest.texture_folder_id; | ||
575 | 606 | ||
576 | AssetUploader uploader = | 607 | AssetUploader uploader = |
577 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 608 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
578 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); | 609 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, |
610 | texturesFolder, nreqtextures, nreqmeshs, nreqinstances,IsAtestUpload); | ||
579 | 611 | ||
580 | m_HostCapsObj.HttpListener.AddStreamHandler( | 612 | m_HostCapsObj.HttpListener.AddStreamHandler( |
581 | new BinaryStreamHandler( | 613 | new BinaryStreamHandler( |
@@ -620,7 +652,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
620 | /// <param name="data"></param> | 652 | /// <param name="data"></param> |
621 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | 653 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, |
622 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | 654 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, |
623 | string assetType, int cost, ref string error) | 655 | string assetType, int cost, |
656 | UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, | ||
657 | bool IsAtestUpload, ref string error) | ||
624 | { | 658 | { |
625 | 659 | ||
626 | lock (m_ModelCost) | 660 | lock (m_ModelCost) |
@@ -633,6 +667,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
633 | sbyte assType = 0; | 667 | sbyte assType = 0; |
634 | sbyte inType = 0; | 668 | sbyte inType = 0; |
635 | 669 | ||
670 | UUID owner_id = m_HostCapsObj.AgentID; | ||
671 | UUID creatorID; | ||
672 | |||
673 | bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0); | ||
674 | |||
675 | if (istest) | ||
676 | creatorID = m_testAssetsCreatorID; | ||
677 | else | ||
678 | creatorID = owner_id; | ||
679 | |||
680 | string creatorIDstr = creatorID.ToString(); | ||
681 | |||
636 | IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); | 682 | IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); |
637 | if (mm != null) | 683 | if (mm != null) |
638 | { | 684 | { |
@@ -703,20 +749,56 @@ namespace OpenSim.Region.ClientStack.Linden | |||
703 | SceneObjectGroup grp = null; | 749 | SceneObjectGroup grp = null; |
704 | 750 | ||
705 | // create and store texture assets | 751 | // create and store texture assets |
752 | bool doTextInv = (!istest && m_enableModelUploadTextureToInventory && | ||
753 | texturesFolder != UUID.Zero); | ||
754 | |||
755 | |||
706 | List<UUID> textures = new List<UUID>(); | 756 | List<UUID> textures = new List<UUID>(); |
757 | |||
707 | for (int i = 0; i < texture_list.Count; i++) | 758 | for (int i = 0; i < texture_list.Count; i++) |
708 | { | 759 | { |
709 | AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); | 760 | AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr); |
710 | textureAsset.Data = texture_list[i].AsBinary(); | 761 | textureAsset.Data = texture_list[i].AsBinary(); |
711 | m_assetService.Store(textureAsset); | 762 | m_assetService.Store(textureAsset); |
712 | textures.Add(textureAsset.FullID); | 763 | textures.Add(textureAsset.FullID); |
764 | |||
765 | if (doTextInv) | ||
766 | { | ||
767 | string name = assetName; | ||
768 | if (name.Length > 25) | ||
769 | name = name.Substring(0, 24); | ||
770 | name += "_Texture#" + i.ToString(); | ||
771 | InventoryItemBase texitem = new InventoryItemBase(); | ||
772 | texitem.Owner = m_HostCapsObj.AgentID; | ||
773 | texitem.CreatorId = creatorIDstr; | ||
774 | texitem.CreatorData = String.Empty; | ||
775 | texitem.ID = UUID.Random(); | ||
776 | texitem.AssetID = textureAsset.FullID; | ||
777 | texitem.Description = "mesh model texture"; | ||
778 | texitem.Name = name; | ||
779 | texitem.AssetType = (int)AssetType.Texture; | ||
780 | texitem.InvType = (int)InventoryType.Texture; | ||
781 | texitem.Folder = texturesFolder; | ||
782 | |||
783 | texitem.CurrentPermissions | ||
784 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | ||
785 | |||
786 | texitem.BasePermissions = (uint)PermissionMask.All; | ||
787 | texitem.EveryOnePermissions = 0; | ||
788 | texitem.NextPermissions = (uint)PermissionMask.All; | ||
789 | texitem.CreationDate = Util.UnixTimeSinceEpoch(); | ||
790 | |||
791 | AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); | ||
792 | texitem = null; | ||
793 | // this aren't showing up in viewer until relog :( | ||
794 | } | ||
713 | } | 795 | } |
714 | 796 | ||
715 | // create and store meshs assets | 797 | // create and store meshs assets |
716 | List<UUID> meshAssets = new List<UUID>(); | 798 | List<UUID> meshAssets = new List<UUID>(); |
717 | for (int i = 0; i < mesh_list.Count; i++) | 799 | for (int i = 0; i < mesh_list.Count; i++) |
718 | { | 800 | { |
719 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); | 801 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); |
720 | meshAsset.Data = mesh_list[i].AsBinary(); | 802 | meshAsset.Data = mesh_list[i].AsBinary(); |
721 | m_assetService.Store(meshAsset); | 803 | m_assetService.Store(meshAsset); |
722 | meshAssets.Add(meshAsset.FullID); | 804 | meshAssets.Add(meshAsset.FullID); |
@@ -827,7 +909,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
827 | // int owner_mask = permissions["owner_mask"].AsInteger(); | 909 | // int owner_mask = permissions["owner_mask"].AsInteger(); |
828 | // no longer used - end ------------------------ | 910 | // no longer used - end ------------------------ |
829 | 911 | ||
830 | UUID owner_id = m_HostCapsObj.AgentID; | 912 | |
831 | 913 | ||
832 | SceneObjectPart prim | 914 | SceneObjectPart prim |
833 | = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); | 915 | = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); |
@@ -837,13 +919,29 @@ namespace OpenSim.Region.ClientStack.Linden | |||
837 | rotations.Add(rotation); | 919 | rotations.Add(rotation); |
838 | positions.Add(position); | 920 | positions.Add(position); |
839 | prim.UUID = UUID.Random(); | 921 | prim.UUID = UUID.Random(); |
840 | prim.CreatorID = owner_id; | 922 | prim.CreatorID = creatorID; |
841 | prim.OwnerID = owner_id; | 923 | prim.OwnerID = owner_id; |
842 | prim.GroupID = UUID.Zero; | 924 | prim.GroupID = UUID.Zero; |
843 | prim.LastOwnerID = prim.OwnerID; | 925 | prim.LastOwnerID = creatorID; |
844 | prim.CreationDate = Util.UnixTimeSinceEpoch(); | 926 | prim.CreationDate = Util.UnixTimeSinceEpoch(); |
845 | prim.Name = assetName; | 927 | |
846 | prim.Description = ""; | 928 | if (grp == null) |
929 | prim.Name = assetName; | ||
930 | else | ||
931 | prim.Name = assetName + "#" + i.ToString(); | ||
932 | |||
933 | if (istest) | ||
934 | { | ||
935 | prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); | ||
936 | prim.EveryoneMask = 0; | ||
937 | prim.GroupMask = 0; | ||
938 | prim.NextOwnerMask = 0; | ||
939 | prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); | ||
940 | |||
941 | prim.Description = "For personal testing only. Other uses are forbiden"; | ||
942 | } | ||
943 | else | ||
944 | prim.Description = ""; | ||
847 | prim.Material = material; | 945 | prim.Material = material; |
848 | prim.PhysicsShapeType = physicsShapeType; | 946 | prim.PhysicsShapeType = physicsShapeType; |
849 | 947 | ||
@@ -854,7 +952,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
854 | // prim.OwnerMask = (uint)owner_mask; | 952 | // prim.OwnerMask = (uint)owner_mask; |
855 | 953 | ||
856 | if (grp == null) | 954 | if (grp == null) |
955 | { | ||
857 | grp = new SceneObjectGroup(prim); | 956 | grp = new SceneObjectGroup(prim); |
957 | grp.LastOwnerID = creatorID; | ||
958 | } | ||
858 | else | 959 | else |
859 | grp.AddPart(prim); | 960 | grp.AddPart(prim); |
860 | } | 961 | } |
@@ -904,7 +1005,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
904 | } | 1005 | } |
905 | 1006 | ||
906 | AssetBase asset; | 1007 | AssetBase asset; |
907 | asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); | 1008 | asset = new AssetBase(assetID, assetName, assType, creatorIDstr); |
908 | asset.Data = data; | 1009 | asset.Data = data; |
909 | if (AddNewAsset != null) | 1010 | if (AddNewAsset != null) |
910 | AddNewAsset(asset); | 1011 | AddNewAsset(asset); |
@@ -913,11 +1014,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
913 | 1014 | ||
914 | InventoryItemBase item = new InventoryItemBase(); | 1015 | InventoryItemBase item = new InventoryItemBase(); |
915 | item.Owner = m_HostCapsObj.AgentID; | 1016 | item.Owner = m_HostCapsObj.AgentID; |
916 | item.CreatorId = m_HostCapsObj.AgentID.ToString(); | 1017 | item.CreatorId = creatorIDstr; |
917 | item.CreatorData = String.Empty; | 1018 | item.CreatorData = String.Empty; |
918 | item.ID = inventoryItem; | 1019 | item.ID = inventoryItem; |
919 | item.AssetID = asset.FullID; | 1020 | item.AssetID = asset.FullID; |
920 | item.Description = assetDescription; | 1021 | if (istest) |
1022 | item.Description = "For personal testing only. Other uses are forbiden"; | ||
1023 | else | ||
1024 | item.Description = assetDescription; | ||
921 | item.Name = assetName; | 1025 | item.Name = assetName; |
922 | item.AssetType = assType; | 1026 | item.AssetType = assType; |
923 | item.InvType = inType; | 1027 | item.InvType = inType; |
@@ -926,17 +1030,53 @@ namespace OpenSim.Region.ClientStack.Linden | |||
926 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current | 1030 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current |
927 | // (owner) permissions. This becomes a problem if next permissions are changed. | 1031 | // (owner) permissions. This becomes a problem if next permissions are changed. |
928 | 1032 | ||
929 | item.CurrentPermissions | 1033 | if (istest) |
930 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | 1034 | { |
1035 | item.CurrentPermissions | ||
1036 | = (uint)(PermissionMask.Move | PermissionMask.Modify); | ||
1037 | |||
1038 | item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); | ||
1039 | item.EveryOnePermissions = 0; | ||
1040 | item.NextPermissions = 0; | ||
1041 | } | ||
1042 | else | ||
1043 | { | ||
1044 | item.CurrentPermissions | ||
1045 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | ||
1046 | |||
1047 | item.BasePermissions = (uint)PermissionMask.All; | ||
1048 | item.EveryOnePermissions = 0; | ||
1049 | item.NextPermissions = (uint)PermissionMask.All; | ||
1050 | } | ||
931 | 1051 | ||
932 | item.BasePermissions = (uint)PermissionMask.All; | ||
933 | item.EveryOnePermissions = 0; | ||
934 | item.NextPermissions = (uint)PermissionMask.All; | ||
935 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 1052 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
936 | 1053 | ||
1054 | IClientAPI client = null; | ||
1055 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); | ||
1056 | |||
937 | if (AddNewInventoryItem != null) | 1057 | if (AddNewInventoryItem != null) |
938 | { | 1058 | { |
939 | AddNewInventoryItem(m_HostCapsObj.AgentID, item,(uint) cost); | 1059 | if (istest) |
1060 | { | ||
1061 | AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0); | ||
1062 | if (client != null) | ||
1063 | client.SendAgentAlertMessage("Upload complete with no cost for personal testing purposes only. Other uses are forbiden", true); | ||
1064 | } | ||
1065 | else | ||
1066 | { | ||
1067 | AddNewInventoryItem(m_HostCapsObj.AgentID, item, (uint)cost); | ||
1068 | if (client != null) | ||
1069 | { | ||
1070 | // let users see anything.. i don't so far | ||
1071 | string str; | ||
1072 | if (cost > 0) | ||
1073 | // dont remember where is money unit name to put here | ||
1074 | str = "Upload complete. charged " + cost.ToString() + "$"; | ||
1075 | else | ||
1076 | str = "Upload complete"; | ||
1077 | client.SendAgentAlertMessage(str, true); | ||
1078 | } | ||
1079 | } | ||
940 | } | 1080 | } |
941 | 1081 | ||
942 | lock (m_ModelCost) | 1082 | lock (m_ModelCost) |
@@ -1272,11 +1412,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1272 | private string m_error = String.Empty; | 1412 | private string m_error = String.Empty; |
1273 | 1413 | ||
1274 | private Timer m_timeoutTimer = new Timer(); | 1414 | private Timer m_timeoutTimer = new Timer(); |
1275 | 1415 | private UUID m_texturesFolder; | |
1416 | private int m_nreqtextures; | ||
1417 | private int m_nreqmeshs; | ||
1418 | private int m_nreqinstances; | ||
1419 | private bool m_IsAtestUpload; | ||
1276 | 1420 | ||
1277 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | 1421 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, |
1278 | UUID parentFolderID, string invType, string assetType, string path, | 1422 | UUID parentFolderID, string invType, string assetType, string path, |
1279 | IHttpServer httpServer, bool dumpAssetsToFile, int totalCost) | 1423 | IHttpServer httpServer, bool dumpAssetsToFile, |
1424 | int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, | ||
1425 | bool IsAtestUpload) | ||
1280 | { | 1426 | { |
1281 | m_assetName = assetName; | 1427 | m_assetName = assetName; |
1282 | m_assetDes = description; | 1428 | m_assetDes = description; |
@@ -1290,6 +1436,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1290 | m_dumpAssetsToFile = dumpAssetsToFile; | 1436 | m_dumpAssetsToFile = dumpAssetsToFile; |
1291 | m_cost = totalCost; | 1437 | m_cost = totalCost; |
1292 | 1438 | ||
1439 | m_texturesFolder = texturesFolder; | ||
1440 | m_nreqtextures = nreqtextures; | ||
1441 | m_nreqmeshs = nreqmeshs; | ||
1442 | m_nreqinstances = nreqinstances; | ||
1443 | m_IsAtestUpload = IsAtestUpload; | ||
1444 | |||
1293 | m_timeoutTimer.Elapsed += TimedOut; | 1445 | m_timeoutTimer.Elapsed += TimedOut; |
1294 | m_timeoutTimer.Interval = 120000; | 1446 | m_timeoutTimer.Interval = 120000; |
1295 | m_timeoutTimer.AutoReset = false; | 1447 | m_timeoutTimer.AutoReset = false; |
@@ -1332,12 +1484,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1332 | handlerUpLoad = OnUpLoad; | 1484 | handlerUpLoad = OnUpLoad; |
1333 | if (handlerUpLoad != null) | 1485 | if (handlerUpLoad != null) |
1334 | { | 1486 | { |
1335 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost, ref m_error); | 1487 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, |
1488 | m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); | ||
1336 | } | 1489 | } |
1337 | if(m_error == String.Empty) | 1490 | if(m_error == String.Empty) |
1338 | { | 1491 | { |
1339 | uploadComplete.new_asset = newAssetID.ToString(); | 1492 | uploadComplete.new_asset = newAssetID.ToString(); |
1340 | uploadComplete.new_inventory_item = inv; | 1493 | uploadComplete.new_inventory_item = inv; |
1494 | // if (m_texturesFolder != UUID.Zero) | ||
1495 | // uploadComplete.new_texture_folder_id = m_texturesFolder; | ||
1341 | uploadComplete.state = "complete"; | 1496 | uploadComplete.state = "complete"; |
1342 | } | 1497 | } |
1343 | else | 1498 | else |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 7a80c72..f03d8d8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | |||
@@ -96,7 +96,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
96 | // basicCost input region assets upload cost | 96 | // basicCost input region assets upload cost |
97 | // totalcost returns model total upload fee | 97 | // totalcost returns model total upload fee |
98 | // meshcostdata returns detailed costs for viewer | 98 | // meshcostdata returns detailed costs for viewer |
99 | public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, LLSDAssetUploadResponseData meshcostdata, out string error) | 99 | public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, |
100 | LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) | ||
100 | { | 101 | { |
101 | totalcost = 0; | 102 | totalcost = 0; |
102 | error = string.Empty; | 103 | error = string.Empty; |
@@ -229,10 +230,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
229 | meshsfee += primCreationCost; | 230 | meshsfee += primCreationCost; |
230 | } | 231 | } |
231 | 232 | ||
232 | if (skipedSmall >0 && skipedSmall > numberInstances / 2) | 233 | if (skipedSmall > 0) |
233 | { | 234 | { |
234 | error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() + "m"; | 235 | if (skipedSmall > numberInstances / 2) |
235 | return false; | 236 | { |
237 | error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() + | ||
238 | "m minimum allowed size. Please check scalling"; | ||
239 | return false; | ||
240 | } | ||
241 | else | ||
242 | warning += skipedSmall.ToString() + " of the requested " +numberInstances.ToString() + | ||
243 | " model prims will not upload because they are smaller than " + PrimScaleMin.ToString() + | ||
244 | "m minimum allowed size. Please check scalling "; | ||
236 | } | 245 | } |
237 | 246 | ||
238 | if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost) | 247 | if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost) |
@@ -403,9 +412,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
403 | 412 | ||
404 | submesh_offset = -1; | 413 | submesh_offset = -1; |
405 | 414 | ||
406 | if (map.ContainsKey("physics_mesh")) | 415 | tmpmap = null; |
407 | { | 416 | if(map.ContainsKey("physics_mesh")) |
408 | tmpmap = (OSDMap)map["physics_mesh"]; | 417 | tmpmap = (OSDMap)map["physics_mesh"]; |
418 | else if (map.ContainsKey("physics_shape")) // old naming | ||
419 | tmpmap = (OSDMap)map["physics_shape"]; | ||
420 | |||
421 | if(tmpmap != null) | ||
422 | { | ||
409 | if (tmpmap.ContainsKey("offset")) | 423 | if (tmpmap.ContainsKey("offset")) |
410 | submesh_offset = tmpmap["offset"].AsInteger() + start; | 424 | submesh_offset = tmpmap["offset"].AsInteger() + start; |
411 | if (tmpmap.ContainsKey("size")) | 425 | if (tmpmap.ContainsKey("size")) |