diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
3 files changed, 185 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 9791885..f14beb0 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 |
@@ -199,6 +202,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
199 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); | 202 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); |
200 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 203 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
201 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 204 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
205 | IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); | ||
206 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | ||
207 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | ||
208 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); | ||
209 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); | ||
210 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | ||
211 | |||
212 | |||
202 | 213 | ||
203 | m_HostCapsObj.RegisterHandler( | 214 | m_HostCapsObj.RegisterHandler( |
204 | "CopyInventoryFromNotecard", | 215 | "CopyInventoryFromNotecard", |
@@ -849,6 +860,151 @@ namespace OpenSim.Region.ClientStack.Linden | |||
849 | response["int_response_code"] = 200; | 860 | response["int_response_code"] = 200; |
850 | return LLSDHelpers.SerialiseLLSDReply(response); | 861 | return LLSDHelpers.SerialiseLLSDReply(response); |
851 | } | 862 | } |
863 | |||
864 | public string GetObjectPhysicsData(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 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
871 | |||
872 | for (int i = 0 ; i < object_ids.Count ; i++) | ||
873 | { | ||
874 | UUID uuid = object_ids[i].AsUUID(); | ||
875 | |||
876 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
877 | if (obj != null) | ||
878 | { | ||
879 | OSDMap object_data = new OSDMap(); | ||
880 | |||
881 | object_data["PhysicsShapeType"] = obj.PhysicsShapeType; | ||
882 | object_data["Density"] = obj.Density; | ||
883 | object_data["Friction"] = obj.Friction; | ||
884 | object_data["Restitution"] = obj.Bounciness; | ||
885 | object_data["GravityMultiplier"] = obj.GravityModifier; | ||
886 | |||
887 | resp[uuid.ToString()] = object_data; | ||
888 | } | ||
889 | } | ||
890 | |||
891 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
892 | return response; | ||
893 | } | ||
894 | |||
895 | public string GetObjectCost(string request, string path, | ||
896 | string param, IOSHttpRequest httpRequest, | ||
897 | IOSHttpResponse httpResponse) | ||
898 | { | ||
899 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
900 | OSDMap resp = new OSDMap(); | ||
901 | |||
902 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
903 | |||
904 | for (int i = 0; i < object_ids.Count; i++) | ||
905 | { | ||
906 | UUID uuid = object_ids[i].AsUUID(); | ||
907 | |||
908 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
909 | |||
910 | if (part != null) | ||
911 | { | ||
912 | SceneObjectGroup grp = part.ParentGroup; | ||
913 | if (grp != null) | ||
914 | { | ||
915 | float linksetCost; | ||
916 | float linksetPhysCost; | ||
917 | float partCost; | ||
918 | float partPhysCost; | ||
919 | |||
920 | grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost); | ||
921 | |||
922 | OSDMap object_data = new OSDMap(); | ||
923 | object_data["linked_set_resource_cost"] = linksetCost; | ||
924 | object_data["resource_cost"] = partCost; | ||
925 | object_data["physics_cost"] = partPhysCost; | ||
926 | object_data["linked_set_physics_cost"] = linksetPhysCost; | ||
927 | |||
928 | resp[uuid.ToString()] = object_data; | ||
929 | } | ||
930 | } | ||
931 | } | ||
932 | |||
933 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
934 | return response; | ||
935 | } | ||
936 | |||
937 | public string ResourceCostSelected(string request, string path, | ||
938 | string param, IOSHttpRequest httpRequest, | ||
939 | IOSHttpResponse httpResponse) | ||
940 | { | ||
941 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
942 | OSDMap resp = new OSDMap(); | ||
943 | |||
944 | |||
945 | float phys=0; | ||
946 | float stream=0; | ||
947 | float simul=0; | ||
948 | |||
949 | if (req.ContainsKey("selected_roots")) | ||
950 | { | ||
951 | OSDArray object_ids = (OSDArray)req["selected_roots"]; | ||
952 | |||
953 | // should go by SOG suming costs for all parts | ||
954 | // ll v3 works ok with several objects select we get the list and adds ok | ||
955 | // FS calls per object so results are wrong guess fs bug | ||
956 | for (int i = 0; i < object_ids.Count; i++) | ||
957 | { | ||
958 | UUID uuid = object_ids[i].AsUUID(); | ||
959 | float Physc; | ||
960 | float simulc; | ||
961 | float streamc; | ||
962 | |||
963 | SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid); | ||
964 | if (grp != null) | ||
965 | { | ||
966 | grp.GetSelectedCosts(out Physc, out streamc, out simulc); | ||
967 | phys += Physc; | ||
968 | stream += streamc; | ||
969 | simul += simulc; | ||
970 | } | ||
971 | } | ||
972 | } | ||
973 | else if (req.ContainsKey("selected_prims")) | ||
974 | { | ||
975 | OSDArray object_ids = (OSDArray)req["selected_prims"]; | ||
976 | |||
977 | // don't see in use in any of the 2 viewers | ||
978 | // guess it should be for edit linked but... nothing | ||
979 | // should go to SOP per part | ||
980 | for (int i = 0; i < object_ids.Count; i++) | ||
981 | { | ||
982 | UUID uuid = object_ids[i].AsUUID(); | ||
983 | |||
984 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
985 | if (part != null) | ||
986 | { | ||
987 | phys += part.PhysicsCost; | ||
988 | stream += part.StreamingCost; | ||
989 | simul += part.SimulationCost; | ||
990 | } | ||
991 | } | ||
992 | } | ||
993 | |||
994 | if (simul != 0) | ||
995 | { | ||
996 | OSDMap object_data = new OSDMap(); | ||
997 | |||
998 | object_data["physics"] = phys; | ||
999 | object_data["streaming"] = stream; | ||
1000 | object_data["simulation"] = simul; | ||
1001 | |||
1002 | resp["selected"] = object_data; | ||
1003 | } | ||
1004 | |||
1005 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
1006 | return response; | ||
1007 | } | ||
852 | } | 1008 | } |
853 | 1009 | ||
854 | public class AssetUploader | 1010 | public class AssetUploader |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 1a35d22..a38d231 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -809,5 +809,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
809 | { | 809 | { |
810 | return EventQueueHelper.BuildEvent(eventName, eventBody); | 810 | return EventQueueHelper.BuildEvent(eventName, eventBody); |
811 | } | 811 | } |
812 | |||
813 | public void partPhysicsProperties(uint localID, byte physhapetype, | ||
814 | float density, float friction, float bounce, float gravmod,UUID avatarID) | ||
815 | { | ||
816 | OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype, | ||
817 | density, friction, bounce, gravmod); | ||
818 | Enqueue(item, avatarID); | ||
819 | } | ||
812 | } | 820 | } |
813 | } | 821 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 3f49aba..b9222e3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -395,5 +395,25 @@ namespace OpenSim.Region.ClientStack.Linden | |||
395 | return message; | 395 | return message; |
396 | } | 396 | } |
397 | 397 | ||
398 | public static OSD partPhysicsProperties(uint localID, byte physhapetype, | ||
399 | float density, float friction, float bounce, float gravmod) | ||
400 | { | ||
401 | |||
402 | OSDMap physinfo = new OSDMap(6); | ||
403 | physinfo["LocalID"] = localID; | ||
404 | physinfo["Density"] = density; | ||
405 | physinfo["Friction"] = friction; | ||
406 | physinfo["GravityMultiplier"] = gravmod; | ||
407 | physinfo["Restitution"] = bounce; | ||
408 | physinfo["PhysicsShapeType"] = (int)physhapetype; | ||
409 | |||
410 | OSDArray array = new OSDArray(1); | ||
411 | array.Add(physinfo); | ||
412 | |||
413 | OSDMap llsdBody = new OSDMap(1); | ||
414 | llsdBody.Add("ObjectData", array); | ||
415 | |||
416 | return BuildEvent("ObjectPhysicsProperties", llsdBody); | ||
417 | } | ||
398 | } | 418 | } |
399 | } | 419 | } |