diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 74 |
1 files changed, 10 insertions, 64 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index ac4203f..6251266 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -789,83 +789,29 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
789 | 789 | ||
790 | SceneObjectGroup group = null; | 790 | SceneObjectGroup group = null; |
791 | 791 | ||
792 | string xmlData = Utils.BytesToString(rezAsset.Data); | 792 | List<SceneObjectGroup> objlist; |
793 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(); | 793 | List<Vector3> veclist; |
794 | List<Vector3> veclist = new List<Vector3>(); | 794 | Vector3 bbox; |
795 | float offsetHeight; | ||
795 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); | 796 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); |
796 | Vector3 pos; | 797 | Vector3 pos; |
797 | 798 | ||
798 | XmlDocument doc = new XmlDocument(); | 799 | bool single = m_Scene.GetObjectsToRez(rezAsset.Data, attachment, out objlist, out veclist, out bbox, out offsetHeight); |
799 | doc.LoadXml(xmlData); | ||
800 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | ||
801 | Vector3 rez_pos; | ||
802 | if (e == null || attachment) // Single | ||
803 | { | ||
804 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
805 | if (!attachment) | ||
806 | { | ||
807 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
808 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
809 | g.RootPart.AttachRotation = g.GroupRotation; | ||
810 | if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && | ||
811 | g.RootPart.Shape.PCode != (byte)PCode.Tree) | ||
812 | g.RootPart.Shape.State = 0; | ||
813 | } | ||
814 | |||
815 | objlist.Add(g); | ||
816 | veclist.Add(Vector3.Zero); | ||
817 | 800 | ||
818 | float offsetHeight = 0; | 801 | if (single) |
802 | { | ||
819 | pos = m_Scene.GetNewRezLocation( | 803 | pos = m_Scene.GetNewRezLocation( |
820 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 804 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
821 | BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); | 805 | BypassRayCast, bRayEndIsIntersection, true, bbox, false); |
822 | pos.Z += offsetHeight; | 806 | pos.Z += offsetHeight; |
823 | rez_pos = pos; | ||
824 | } | 807 | } |
825 | else | 808 | else |
826 | { | 809 | { |
827 | XmlElement coll = (XmlElement)e; | ||
828 | float bx = Convert.ToSingle(coll.GetAttribute("x")); | ||
829 | float by = Convert.ToSingle(coll.GetAttribute("y")); | ||
830 | float bz = Convert.ToSingle(coll.GetAttribute("z")); | ||
831 | Vector3 bbox = new Vector3(bx, by, bz); | ||
832 | |||
833 | pos = m_Scene.GetNewRezLocation(RayStart, RayEnd, | 810 | pos = m_Scene.GetNewRezLocation(RayStart, RayEnd, |
834 | RayTargetID, Quaternion.Identity, | 811 | RayTargetID, Quaternion.Identity, |
835 | BypassRayCast, bRayEndIsIntersection, true, | 812 | BypassRayCast, bRayEndIsIntersection, true, |
836 | bbox, false); | 813 | bbox, false); |
837 | |||
838 | rez_pos = pos; | ||
839 | |||
840 | pos -= bbox / 2; | 814 | pos -= bbox / 2; |
841 | |||
842 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | ||
843 | foreach (XmlNode n in groups) | ||
844 | { | ||
845 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | ||
846 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
847 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
848 | g.RootPart.AttachRotation = g.GroupRotation; | ||
849 | if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && | ||
850 | g.RootPart.Shape.PCode != (byte)PCode.Tree) | ||
851 | g.RootPart.Shape.State = 0; | ||
852 | |||
853 | objlist.Add(g); | ||
854 | XmlElement el = (XmlElement)n; | ||
855 | |||
856 | string rawX = el.GetAttribute("offsetx"); | ||
857 | string rawY = el.GetAttribute("offsety"); | ||
858 | string rawZ = el.GetAttribute("offsetz"); | ||
859 | // | ||
860 | // m_log.DebugFormat( | ||
861 | // "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>", | ||
862 | // g.Name, rawX, rawY, rawZ); | ||
863 | |||
864 | float x = Convert.ToSingle(rawX); | ||
865 | float y = Convert.ToSingle(rawY); | ||
866 | float z = Convert.ToSingle(rawZ); | ||
867 | veclist.Add(new Vector3(x, y, z)); | ||
868 | } | ||
869 | } | 815 | } |
870 | 816 | ||
871 | int primcount = 0; | 817 | int primcount = 0; |
@@ -873,7 +819,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
873 | primcount += g.PrimCount; | 819 | primcount += g.PrimCount; |
874 | 820 | ||
875 | if (!m_Scene.Permissions.CanRezObject( | 821 | if (!m_Scene.Permissions.CanRezObject( |
876 | primcount, remoteClient.AgentId, rez_pos) | 822 | primcount, remoteClient.AgentId, pos) |
877 | && !attachment) | 823 | && !attachment) |
878 | { | 824 | { |
879 | // The client operates in no fail mode. It will | 825 | // The client operates in no fail mode. It will |
@@ -890,7 +836,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
890 | return null; | 836 | return null; |
891 | } | 837 | } |
892 | 838 | ||
893 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, rez_pos, veclist, attachment)) | 839 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, veclist, attachment)) |
894 | return null; | 840 | return null; |
895 | 841 | ||
896 | for (int i = 0; i < objlist.Count; i++) | 842 | for (int i = 0; i < objlist.Count; i++) |