diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 99 |
1 files changed, 59 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index c61afda..7ef3285 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -894,11 +894,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
894 | } | 894 | } |
895 | } | 895 | } |
896 | 896 | ||
897 | /// <summary> | ||
898 | /// Rez an object into a scene | ||
899 | /// </summary> | ||
900 | /// <param name="remoteClient"></param> | ||
901 | /// <param name="itemID"></param> | ||
902 | /// <param name="RayEnd"></param> | ||
903 | /// <param name="RayStart"></param> | ||
904 | /// <param name="RayTargetID"></param> | ||
905 | /// <param name="BypassRayCast"></param> | ||
906 | /// <param name="RayEndIsIntersection"></param> | ||
907 | /// <param name="EveryoneMask"></param> | ||
908 | /// <param name="GroupMask"></param> | ||
909 | /// <param name="NextOwnerMask"></param> | ||
910 | /// <param name="ItemFlags"></param> | ||
911 | /// <param name="RezSelected"></param> | ||
912 | /// <param name="RemoveItem"></param> | ||
913 | /// <param name="fromTaskID"></param> | ||
897 | public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart, | 914 | public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart, |
898 | LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 915 | LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
899 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, | 916 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, |
900 | bool RezSelected, bool RemoveItem, LLUUID fromTaskID) | 917 | bool RezSelected, bool RemoveItem, LLUUID fromTaskID) |
901 | { | 918 | { |
919 | // Work out position details | ||
902 | byte bRayEndIsIntersection = (byte)0; | 920 | byte bRayEndIsIntersection = (byte)0; |
903 | 921 | ||
904 | if (RayEndIsIntersection) | 922 | if (RayEndIsIntersection) |
@@ -910,12 +928,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
910 | bRayEndIsIntersection = (byte)0; | 928 | bRayEndIsIntersection = (byte)0; |
911 | } | 929 | } |
912 | 930 | ||
913 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), BypassRayCast, bRayEndIsIntersection); | 931 | LLVector3 pos |
914 | RezObject(remoteClient, itemID, pos); | 932 | = GetNewRezLocation( |
915 | } | 933 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), |
916 | 934 | BypassRayCast, bRayEndIsIntersection); | |
917 | public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | 935 | |
918 | { | 936 | // Rez object |
919 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 937 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
920 | if (userInfo != null) | 938 | if (userInfo != null) |
921 | { | 939 | { |
@@ -928,9 +946,41 @@ namespace OpenSim.Region.Environment.Scenes | |||
928 | 946 | ||
929 | if (rezAsset != null) | 947 | if (rezAsset != null) |
930 | { | 948 | { |
931 | AddRezObject(Helpers.FieldToUTF8String(rezAsset.Data), pos); | 949 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); |
932 | //userInfo.DeleteItem(remoteClient.AgentId, item); | 950 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
933 | //remoteClient.SendRemoveInventoryItem(itemID); | 951 | group.ResetIDs(); |
952 | AddEntity(group); | ||
953 | group.AbsolutePosition = pos; | ||
954 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
955 | |||
956 | // Since renaming the item in the inventory does not affect the name stored | ||
957 | // in the serialization, transfer the correct name from the inventory to the | ||
958 | // object itself before we rez. | ||
959 | rootPart.Name = item.inventoryName; | ||
960 | rootPart.Description = item.inventoryDescription; | ||
961 | |||
962 | rootPart.TrimPermissions(); | ||
963 | group.ApplyPhysics(m_physicalPrim); | ||
964 | group.StartScripts(); | ||
965 | |||
966 | //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); | ||
967 | //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | ||
968 | //{ | ||
969 | //PrimitiveBaseShape pbs = rootPart.Shape; | ||
970 | //rootPart.PhysActor = PhysicsScene.AddPrimShape( | ||
971 | //rootPart.Name, | ||
972 | //pbs, | ||
973 | //new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | ||
974 | // rootPart.AbsolutePosition.Z), | ||
975 | //new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | ||
976 | //new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | ||
977 | // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); | ||
978 | |||
979 | // rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | ||
980 | |||
981 | // } | ||
982 | // | ||
983 | rootPart.ScheduleFullUpdate(); | ||
934 | } | 984 | } |
935 | } | 985 | } |
936 | } | 986 | } |
@@ -942,36 +992,5 @@ namespace OpenSim.Region.Environment.Scenes | |||
942 | { | 992 | { |
943 | System.Console.WriteLine("RezSingleAttachment: unimplemented yet"); | 993 | System.Console.WriteLine("RezSingleAttachment: unimplemented yet"); |
944 | } | 994 | } |
945 | |||
946 | private void AddRezObject(string xmlData, LLVector3 pos) | ||
947 | { | ||
948 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | ||
949 | group.ResetIDs(); | ||
950 | AddEntity(group); | ||
951 | group.AbsolutePosition = pos; | ||
952 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
953 | rootPart.TrimPermissions(); | ||
954 | group.ApplyPhysics(m_physicalPrim); | ||
955 | group.StartScripts(); | ||
956 | |||
957 | //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); | ||
958 | //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | ||
959 | //{ | ||
960 | //PrimitiveBaseShape pbs = rootPart.Shape; | ||
961 | //rootPart.PhysActor = PhysicsScene.AddPrimShape( | ||
962 | //rootPart.Name, | ||
963 | //pbs, | ||
964 | //new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | ||
965 | // rootPart.AbsolutePosition.Z), | ||
966 | //new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | ||
967 | //new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | ||
968 | // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); | ||
969 | |||
970 | // rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | ||
971 | |||
972 | // } | ||
973 | // | ||
974 | rootPart.ScheduleFullUpdate(); | ||
975 | } | ||
976 | } | 995 | } |
977 | } | 996 | } |