diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps')
-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 8ec2f20..ef6dedb 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 | ||
@@ -819,6 +829,151 @@ namespace OpenSim.Region.ClientStack.Linden | |||
819 | response["int_response_code"] = 200; | 829 | response["int_response_code"] = 200; |
820 | return LLSDHelpers.SerialiseLLSDReply(response); | 830 | return LLSDHelpers.SerialiseLLSDReply(response); |
821 | } | 831 | } |
832 | |||
833 | public string GetObjectPhysicsData(string request, string path, | ||
834 | string param, IOSHttpRequest httpRequest, | ||
835 | IOSHttpResponse httpResponse) | ||
836 | { | ||
837 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
838 | OSDMap resp = new OSDMap(); | ||
839 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
840 | |||
841 | for (int i = 0 ; i < object_ids.Count ; i++) | ||
842 | { | ||
843 | UUID uuid = object_ids[i].AsUUID(); | ||
844 | |||
845 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
846 | if (obj != null) | ||
847 | { | ||
848 | OSDMap object_data = new OSDMap(); | ||
849 | |||
850 | object_data["PhysicsShapeType"] = obj.PhysicsShapeType; | ||
851 | object_data["Density"] = obj.Density; | ||
852 | object_data["Friction"] = obj.Friction; | ||
853 | object_data["Restitution"] = obj.Bounciness; | ||
854 | object_data["GravityMultiplier"] = obj.GravityModifier; | ||
855 | |||
856 | resp[uuid.ToString()] = object_data; | ||
857 | } | ||
858 | } | ||
859 | |||
860 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
861 | return response; | ||
862 | } | ||
863 | |||
864 | public string GetObjectCost(string request, string path, | ||
865 | string param, IOSHttpRequest httpRequest, | ||
866 | IOSHttpResponse httpResponse) | ||
867 | { | ||
868 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
869 | OSDMap resp = new OSDMap(); | ||
870 | |||
871 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
872 | |||
873 | for (int i = 0; i < object_ids.Count; i++) | ||
874 | { | ||
875 | UUID uuid = object_ids[i].AsUUID(); | ||
876 | |||
877 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
878 | |||
879 | if (part != null) | ||
880 | { | ||
881 | SceneObjectGroup grp = part.ParentGroup; | ||
882 | if (grp != null) | ||
883 | { | ||
884 | float linksetCost; | ||
885 | float linksetPhysCost; | ||
886 | float partCost; | ||
887 | float partPhysCost; | ||
888 | |||
889 | grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost); | ||
890 | |||
891 | OSDMap object_data = new OSDMap(); | ||
892 | object_data["linked_set_resource_cost"] = linksetCost; | ||
893 | object_data["resource_cost"] = partCost; | ||
894 | object_data["physics_cost"] = partPhysCost; | ||
895 | object_data["linked_set_physics_cost"] = linksetPhysCost; | ||
896 | |||
897 | resp[uuid.ToString()] = object_data; | ||
898 | } | ||
899 | } | ||
900 | } | ||
901 | |||
902 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
903 | return response; | ||
904 | } | ||
905 | |||
906 | public string ResourceCostSelected(string request, string path, | ||
907 | string param, IOSHttpRequest httpRequest, | ||
908 | IOSHttpResponse httpResponse) | ||
909 | { | ||
910 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
911 | OSDMap resp = new OSDMap(); | ||
912 | |||
913 | |||
914 | float phys=0; | ||
915 | float stream=0; | ||
916 | float simul=0; | ||
917 | |||
918 | if (req.ContainsKey("selected_roots")) | ||
919 | { | ||
920 | OSDArray object_ids = (OSDArray)req["selected_roots"]; | ||
921 | |||
922 | // should go by SOG suming costs for all parts | ||
923 | // ll v3 works ok with several objects select we get the list and adds ok | ||
924 | // FS calls per object so results are wrong guess fs bug | ||
925 | for (int i = 0; i < object_ids.Count; i++) | ||
926 | { | ||
927 | UUID uuid = object_ids[i].AsUUID(); | ||
928 | float Physc; | ||
929 | float simulc; | ||
930 | float streamc; | ||
931 | |||
932 | SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid); | ||
933 | if (grp != null) | ||
934 | { | ||
935 | grp.GetSelectedCosts(out Physc, out streamc, out simulc); | ||
936 | phys += Physc; | ||
937 | stream += streamc; | ||
938 | simul += simulc; | ||
939 | } | ||
940 | } | ||
941 | } | ||
942 | else if (req.ContainsKey("selected_prims")) | ||
943 | { | ||
944 | OSDArray object_ids = (OSDArray)req["selected_prims"]; | ||
945 | |||
946 | // don't see in use in any of the 2 viewers | ||
947 | // guess it should be for edit linked but... nothing | ||
948 | // should go to SOP per part | ||
949 | for (int i = 0; i < object_ids.Count; i++) | ||
950 | { | ||
951 | UUID uuid = object_ids[i].AsUUID(); | ||
952 | |||
953 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
954 | if (part != null) | ||
955 | { | ||
956 | phys += part.PhysicsCost; | ||
957 | stream += part.StreamingCost; | ||
958 | simul += part.SimulationCost; | ||
959 | } | ||
960 | } | ||
961 | } | ||
962 | |||
963 | if (simul != 0) | ||
964 | { | ||
965 | OSDMap object_data = new OSDMap(); | ||
966 | |||
967 | object_data["physics"] = phys; | ||
968 | object_data["streaming"] = stream; | ||
969 | object_data["simulation"] = simul; | ||
970 | |||
971 | resp["selected"] = object_data; | ||
972 | } | ||
973 | |||
974 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
975 | return response; | ||
976 | } | ||
822 | } | 977 | } |
823 | 978 | ||
824 | public class AssetUploader | 979 | public class AssetUploader |