aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs159
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs8
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs20
3 files changed, 185 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
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 7c07c56..a91b02c 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -805,5 +805,13 @@ namespace OpenSim.Region.ClientStack.Linden
805 { 805 {
806 return EventQueueHelper.BuildEvent(eventName, eventBody); 806 return EventQueueHelper.BuildEvent(eventName, eventBody);
807 } 807 }
808
809 public void partPhysicsProperties(uint localID, byte physhapetype,
810 float density, float friction, float bounce, float gravmod,UUID avatarID)
811 {
812 OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype,
813 density, friction, bounce, gravmod);
814 Enqueue(item, avatarID);
815 }
808 } 816 }
809} 817}
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}