aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs158
1 files changed, 157 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 185f9ce..88c4d7f 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
@@ -204,6 +207,14 @@ namespace OpenSim.Region.ClientStack.Linden
204 m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); 207 m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
205 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); 208 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
206 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); 209 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
210 IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData);
211 m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
212 IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
213 m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
214 IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
215 m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
216
217
207 218
208 m_HostCapsObj.RegisterHandler( 219 m_HostCapsObj.RegisterHandler(
209 "CopyInventoryFromNotecard", 220 "CopyInventoryFromNotecard",
@@ -854,6 +865,151 @@ namespace OpenSim.Region.ClientStack.Linden
854 response["int_response_code"] = 200; 865 response["int_response_code"] = 200;
855 return LLSDHelpers.SerialiseLLSDReply(response); 866 return LLSDHelpers.SerialiseLLSDReply(response);
856 } 867 }
868
869 public string GetObjectPhysicsData(string request, string path,
870 string param, IOSHttpRequest httpRequest,
871 IOSHttpResponse httpResponse)
872 {
873 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
874 OSDMap resp = new OSDMap();
875 OSDArray object_ids = (OSDArray)req["object_ids"];
876
877 for (int i = 0 ; i < object_ids.Count ; i++)
878 {
879 UUID uuid = object_ids[i].AsUUID();
880
881 SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid);
882 if (obj != null)
883 {
884 OSDMap object_data = new OSDMap();
885
886 object_data["PhysicsShapeType"] = obj.PhysicsShapeType;
887 object_data["Density"] = obj.Density;
888 object_data["Friction"] = obj.Friction;
889 object_data["Restitution"] = obj.Bounciness;
890 object_data["GravityMultiplier"] = obj.GravityModifier;
891
892 resp[uuid.ToString()] = object_data;
893 }
894 }
895
896 string response = OSDParser.SerializeLLSDXmlString(resp);
897 return response;
898 }
899
900 public string GetObjectCost(string request, string path,
901 string param, IOSHttpRequest httpRequest,
902 IOSHttpResponse httpResponse)
903 {
904 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
905 OSDMap resp = new OSDMap();
906
907 OSDArray object_ids = (OSDArray)req["object_ids"];
908
909 for (int i = 0; i < object_ids.Count; i++)
910 {
911 UUID uuid = object_ids[i].AsUUID();
912
913 SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
914
915 if (part != null)
916 {
917 SceneObjectGroup grp = part.ParentGroup;
918 if (grp != null)
919 {
920 float linksetCost;
921 float linksetPhysCost;
922 float partCost;
923 float partPhysCost;
924
925 grp.GetResourcesCosts(part, out linksetCost, out linksetPhysCost, out partCost, out partPhysCost);
926
927 OSDMap object_data = new OSDMap();
928 object_data["linked_set_resource_cost"] = linksetCost;
929 object_data["resource_cost"] = partCost;
930 object_data["physics_cost"] = partPhysCost;
931 object_data["linked_set_physics_cost"] = linksetPhysCost;
932
933 resp[uuid.ToString()] = object_data;
934 }
935 }
936 }
937
938 string response = OSDParser.SerializeLLSDXmlString(resp);
939 return response;
940 }
941
942 public string ResourceCostSelected(string request, string path,
943 string param, IOSHttpRequest httpRequest,
944 IOSHttpResponse httpResponse)
945 {
946 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
947 OSDMap resp = new OSDMap();
948
949
950 float phys=0;
951 float stream=0;
952 float simul=0;
953
954 if (req.ContainsKey("selected_roots"))
955 {
956 OSDArray object_ids = (OSDArray)req["selected_roots"];
957
958 // should go by SOG suming costs for all parts
959 // ll v3 works ok with several objects select we get the list and adds ok
960 // FS calls per object so results are wrong guess fs bug
961 for (int i = 0; i < object_ids.Count; i++)
962 {
963 UUID uuid = object_ids[i].AsUUID();
964 float Physc;
965 float simulc;
966 float streamc;
967
968 SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid);
969 if (grp != null)
970 {
971 grp.GetSelectedCosts(out Physc, out streamc, out simulc);
972 phys += Physc;
973 stream += streamc;
974 simul += simulc;
975 }
976 }
977 }
978 else if (req.ContainsKey("selected_prims"))
979 {
980 OSDArray object_ids = (OSDArray)req["selected_prims"];
981
982 // don't see in use in any of the 2 viewers
983 // guess it should be for edit linked but... nothing
984 // should go to SOP per part
985 for (int i = 0; i < object_ids.Count; i++)
986 {
987 UUID uuid = object_ids[i].AsUUID();
988
989 SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
990 if (part != null)
991 {
992 phys += part.PhysicsCost;
993 stream += part.StreamingCost;
994 simul += part.SimulationCost;
995 }
996 }
997 }
998
999 if (simul != 0)
1000 {
1001 OSDMap object_data = new OSDMap();
1002
1003 object_data["physics"] = phys;
1004 object_data["streaming"] = stream;
1005 object_data["simulation"] = simul;
1006
1007 resp["selected"] = object_data;
1008 }
1009
1010 string response = OSDParser.SerializeLLSDXmlString(resp);
1011 return response;
1012 }
857 } 1013 }
858 1014
859 public class AssetUploader 1015 public class AssetUploader