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 ed3430a..0103761 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 |
@@ -182,7 +185,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
182 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 185 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
183 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 186 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
184 | m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); | 187 | m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); |
185 | 188 | IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); | |
189 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | ||
190 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | ||
191 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); | ||
192 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); | ||
193 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | ||
194 | |||
195 | |||
186 | // As of RC 1.22.9 of the Linden client this is | 196 | // As of RC 1.22.9 of the Linden client this is |
187 | // supported | 197 | // supported |
188 | 198 | ||
@@ -799,6 +809,151 @@ namespace OpenSim.Region.ClientStack.Linden | |||
799 | response["int_response_code"] = 200; | 809 | response["int_response_code"] = 200; |
800 | return LLSDHelpers.SerialiseLLSDReply(response); | 810 | return LLSDHelpers.SerialiseLLSDReply(response); |
801 | } | 811 | } |
812 | |||
813 | public string GetObjectPhysicsData(string request, string path, | ||
814 | string param, IOSHttpRequest httpRequest, | ||
815 | IOSHttpResponse httpResponse) | ||
816 | { | ||
817 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
818 | OSDMap resp = new OSDMap(); | ||
819 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
820 | |||
821 | for (int i = 0 ; i < object_ids.Count ; i++) | ||
822 | { | ||
823 | UUID uuid = object_ids[i].AsUUID(); | ||
824 | |||
825 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
826 | if (obj != null) | ||
827 | { | ||
828 | OSDMap object_data = new OSDMap(); | ||
829 | |||
830 | object_data["PhysicsShapeType"] = obj.PhysicsShapeType; | ||
831 | object_data["Density"] = obj.Density; | ||
832 | object_data["Friction"] = obj.Friction; | ||
833 | object_data["Restitution"] = obj.Bounciness; | ||
834 | object_data["GravityMultiplier"] = obj.GravityModifier; | ||
835 | |||
836 | resp[uuid.ToString()] = object_data; | ||
837 | } | ||
838 | } | ||
839 | |||
840 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
841 | return response; | ||
842 | } | ||
843 | |||
844 | public string GetObjectCost(string request, string path, | ||
845 | string param, IOSHttpRequest httpRequest, | ||
846 | IOSHttpResponse httpResponse) | ||
847 | { | ||
848 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
849 | OSDMap resp = new OSDMap(); | ||
850 | |||
851 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
852 | |||
853 | for (int i = 0; i < object_ids.Count; i++) | ||
854 | { | ||
855 | UUID uuid = object_ids[i].AsUUID(); | ||
856 | |||
857 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
858 | |||
859 | if (part != null) | ||
860 | { | ||
861 | SceneObjectGroup grp = part.ParentGroup; | ||
862 | if (grp != null) | ||
863 | { | ||
864 | float linksetCost; | ||
865 | float linksetPhysCost; | ||
866 | float partCost; | ||
867 | float partPhysCost; | ||
868 | |||
869 | grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost); | ||
870 | |||
871 | OSDMap object_data = new OSDMap(); | ||
872 | object_data["linked_set_resource_cost"] = linksetCost; | ||
873 | object_data["resource_cost"] = partCost; | ||
874 | object_data["physics_cost"] = partPhysCost; | ||
875 | object_data["linked_set_physics_cost"] = linksetPhysCost; | ||
876 | |||
877 | resp[uuid.ToString()] = object_data; | ||
878 | } | ||
879 | } | ||
880 | } | ||
881 | |||
882 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
883 | return response; | ||
884 | } | ||
885 | |||
886 | public string ResourceCostSelected(string request, string path, | ||
887 | string param, IOSHttpRequest httpRequest, | ||
888 | IOSHttpResponse httpResponse) | ||
889 | { | ||
890 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
891 | OSDMap resp = new OSDMap(); | ||
892 | |||
893 | |||
894 | float phys=0; | ||
895 | float stream=0; | ||
896 | float simul=0; | ||
897 | |||
898 | if (req.ContainsKey("selected_roots")) | ||
899 | { | ||
900 | OSDArray object_ids = (OSDArray)req["selected_roots"]; | ||
901 | |||
902 | // should go by SOG suming costs for all parts | ||
903 | // ll v3 works ok with several objects select we get the list and adds ok | ||
904 | // FS calls per object so results are wrong guess fs bug | ||
905 | for (int i = 0; i < object_ids.Count; i++) | ||
906 | { | ||
907 | UUID uuid = object_ids[i].AsUUID(); | ||
908 | float Physc; | ||
909 | float simulc; | ||
910 | float streamc; | ||
911 | |||
912 | SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid); | ||
913 | if (grp != null) | ||
914 | { | ||
915 | grp.GetSelectedCosts(out Physc, out streamc, out simulc); | ||
916 | phys += Physc; | ||
917 | stream += streamc; | ||
918 | simul += simulc; | ||
919 | } | ||
920 | } | ||
921 | } | ||
922 | else if (req.ContainsKey("selected_prims")) | ||
923 | { | ||
924 | OSDArray object_ids = (OSDArray)req["selected_prims"]; | ||
925 | |||
926 | // don't see in use in any of the 2 viewers | ||
927 | // guess it should be for edit linked but... nothing | ||
928 | // should go to SOP per part | ||
929 | for (int i = 0; i < object_ids.Count; i++) | ||
930 | { | ||
931 | UUID uuid = object_ids[i].AsUUID(); | ||
932 | |||
933 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
934 | if (part != null) | ||
935 | { | ||
936 | phys += part.PhysicsCost; | ||
937 | stream += part.StreamingCost; | ||
938 | simul += part.SimulationCost; | ||
939 | } | ||
940 | } | ||
941 | } | ||
942 | |||
943 | if (simul != 0) | ||
944 | { | ||
945 | OSDMap object_data = new OSDMap(); | ||
946 | |||
947 | object_data["physics"] = phys; | ||
948 | object_data["streaming"] = stream; | ||
949 | object_data["simulation"] = simul; | ||
950 | |||
951 | resp["selected"] = object_data; | ||
952 | } | ||
953 | |||
954 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
955 | return response; | ||
956 | } | ||
802 | } | 957 | } |
803 | 958 | ||
804 | public class AssetUploader | 959 | public class AssetUploader |