diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 159 |
1 files changed, 157 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index e20c24f..2c2d80a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -96,7 +96,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
96 | // private static readonly string m_fetchInventoryPath = "0006/"; | 96 | // private static readonly string m_fetchInventoryPath = "0006/"; |
97 | private static readonly string m_copyFromNotecardPath = "0007/"; | 97 | private static readonly string m_copyFromNotecardPath = "0007/"; |
98 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | 98 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. |
99 | 99 | private static readonly string m_getObjectPhysicsDataPath = "0101/"; | |
100 | private static readonly string m_getObjectCostPath = "0102/"; | ||
101 | private static readonly string m_ResourceCostSelectedPath = "0103/"; | ||
102 | |||
100 | 103 | ||
101 | // These are callbacks which will be setup by the scene so that we can update scene data when we | 104 | // These are callbacks which will be setup by the scene so that we can update scene data when we |
102 | // receive capability calls | 105 | // receive capability calls |
@@ -186,7 +189,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
186 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 189 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
187 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 190 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
188 | m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); | 191 | m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); |
189 | 192 | IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); | |
193 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | ||
194 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | ||
195 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); | ||
196 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); | ||
197 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | ||
198 | |||
199 | |||
190 | // As of RC 1.22.9 of the Linden client this is | 200 | // As of RC 1.22.9 of the Linden client this is |
191 | // supported | 201 | // supported |
192 | 202 | ||
@@ -822,6 +832,151 @@ namespace OpenSim.Region.ClientStack.Linden | |||
822 | response["int_response_code"] = 200; | 832 | response["int_response_code"] = 200; |
823 | return LLSDHelpers.SerialiseLLSDReply(response); | 833 | return LLSDHelpers.SerialiseLLSDReply(response); |
824 | } | 834 | } |
835 | |||
836 | public string GetObjectPhysicsData(string request, string path, | ||
837 | string param, IOSHttpRequest httpRequest, | ||
838 | IOSHttpResponse httpResponse) | ||
839 | { | ||
840 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
841 | OSDMap resp = new OSDMap(); | ||
842 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
843 | |||
844 | for (int i = 0 ; i < object_ids.Count ; i++) | ||
845 | { | ||
846 | UUID uuid = object_ids[i].AsUUID(); | ||
847 | |||
848 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
849 | if (obj != null) | ||
850 | { | ||
851 | OSDMap object_data = new OSDMap(); | ||
852 | |||
853 | object_data["PhysicsShapeType"] = obj.PhysicsShapeType; | ||
854 | object_data["Density"] = obj.Density; | ||
855 | object_data["Friction"] = obj.Friction; | ||
856 | object_data["Restitution"] = obj.Bounciness; | ||
857 | object_data["GravityMultiplier"] = obj.GravityModifier; | ||
858 | |||
859 | resp[uuid.ToString()] = object_data; | ||
860 | } | ||
861 | } | ||
862 | |||
863 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
864 | return response; | ||
865 | } | ||
866 | |||
867 | public string GetObjectCost(string request, string path, | ||
868 | string param, IOSHttpRequest httpRequest, | ||
869 | IOSHttpResponse httpResponse) | ||
870 | { | ||
871 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
872 | OSDMap resp = new OSDMap(); | ||
873 | |||
874 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
875 | |||
876 | for (int i = 0; i < object_ids.Count; i++) | ||
877 | { | ||
878 | UUID uuid = object_ids[i].AsUUID(); | ||
879 | |||
880 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
881 | |||
882 | if (part != null) | ||
883 | { | ||
884 | SceneObjectGroup grp = part.ParentGroup; | ||
885 | if (grp != null) | ||
886 | { | ||
887 | float linksetCost; | ||
888 | float linksetPhysCost; | ||
889 | float partCost; | ||
890 | float partPhysCost; | ||
891 | |||
892 | grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost); | ||
893 | |||
894 | OSDMap object_data = new OSDMap(); | ||
895 | object_data["linked_set_resource_cost"] = linksetCost; | ||
896 | object_data["resource_cost"] = partCost; | ||
897 | object_data["physics_cost"] = partPhysCost; | ||
898 | object_data["linked_set_physics_cost"] = linksetPhysCost; | ||
899 | |||
900 | resp[uuid.ToString()] = object_data; | ||
901 | } | ||
902 | } | ||
903 | } | ||
904 | |||
905 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
906 | return response; | ||
907 | } | ||
908 | |||
909 | public string ResourceCostSelected(string request, string path, | ||
910 | string param, IOSHttpRequest httpRequest, | ||
911 | IOSHttpResponse httpResponse) | ||
912 | { | ||
913 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
914 | OSDMap resp = new OSDMap(); | ||
915 | |||
916 | |||
917 | float phys=0; | ||
918 | float stream=0; | ||
919 | float simul=0; | ||
920 | |||
921 | if (req.ContainsKey("selected_roots")) | ||
922 | { | ||
923 | OSDArray object_ids = (OSDArray)req["selected_roots"]; | ||
924 | |||
925 | // should go by SOG suming costs for all parts | ||
926 | // ll v3 works ok with several objects select we get the list and adds ok | ||
927 | // FS calls per object so results are wrong guess fs bug | ||
928 | for (int i = 0; i < object_ids.Count; i++) | ||
929 | { | ||
930 | UUID uuid = object_ids[i].AsUUID(); | ||
931 | float Physc; | ||
932 | float simulc; | ||
933 | float streamc; | ||
934 | |||
935 | SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid); | ||
936 | if (grp != null) | ||
937 | { | ||
938 | grp.GetSelectedCosts(out Physc, out streamc, out simulc); | ||
939 | phys += Physc; | ||
940 | stream += streamc; | ||
941 | simul += simulc; | ||
942 | } | ||
943 | } | ||
944 | } | ||
945 | else if (req.ContainsKey("selected_prims")) | ||
946 | { | ||
947 | OSDArray object_ids = (OSDArray)req["selected_prims"]; | ||
948 | |||
949 | // don't see in use in any of the 2 viewers | ||
950 | // guess it should be for edit linked but... nothing | ||
951 | // should go to SOP per part | ||
952 | for (int i = 0; i < object_ids.Count; i++) | ||
953 | { | ||
954 | UUID uuid = object_ids[i].AsUUID(); | ||
955 | |||
956 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
957 | if (part != null) | ||
958 | { | ||
959 | phys += part.PhysicsCost; | ||
960 | stream += part.StreamingCost; | ||
961 | simul += part.SimulationCost; | ||
962 | } | ||
963 | } | ||
964 | } | ||
965 | |||
966 | if (simul != 0) | ||
967 | { | ||
968 | OSDMap object_data = new OSDMap(); | ||
969 | |||
970 | object_data["physics"] = phys; | ||
971 | object_data["streaming"] = stream; | ||
972 | object_data["simulation"] = simul; | ||
973 | |||
974 | resp["selected"] = object_data; | ||
975 | } | ||
976 | |||
977 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
978 | return response; | ||
979 | } | ||
825 | } | 980 | } |
826 | 981 | ||
827 | public class AssetUploader | 982 | public class AssetUploader |