diff options
author | Teravus Ovares | 2008-04-27 14:37:51 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-27 14:37:51 +0000 |
commit | f71871bca3f2a6a3b49634963c6754b2acba27cd (patch) | |
tree | 63fd08f44d1787c1dd1af63009a49f433a7dad91 /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |
parent | Thank you Melanie for implementing (diff) | |
download | opensim-SC_OLD-f71871bca3f2a6a3b49634963c6754b2acba27cd.zip opensim-SC_OLD-f71871bca3f2a6a3b49634963c6754b2acba27cd.tar.gz opensim-SC_OLD-f71871bca3f2a6a3b49634963c6754b2acba27cd.tar.bz2 opensim-SC_OLD-f71871bca3f2a6a3b49634963c6754b2acba27cd.tar.xz |
* More attachment stuff, reworked some of the inventory routines to be what I need them to be for attachments.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 133 |
1 files changed, 106 insertions, 27 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 67d3dfb..a3e26b4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1002,9 +1002,65 @@ namespace OpenSim.Region.Environment.Scenes | |||
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId) | ||
1006 | { | ||
1007 | SceneObjectGroup objectGroup = grp; | ||
1008 | if (objectGroup != null) | ||
1009 | { | ||
1010 | string sceneObjectXml = objectGroup.ToXmlString(); | ||
1011 | |||
1012 | CachedUserInfo userInfo = | ||
1013 | CommsManager.UserProfileCacheService.GetUserDetails(AgentId); | ||
1014 | if (userInfo != null) | ||
1015 | { | ||
1016 | AssetBase asset = CreateAsset( | ||
1017 | objectGroup.GetPartName(objectGroup.LocalId), | ||
1018 | objectGroup.GetPartDescription(objectGroup.LocalId), | ||
1019 | (sbyte)InventoryType.Object, | ||
1020 | (sbyte)AssetType.Object, | ||
1021 | Helpers.StringToField(sceneObjectXml)); | ||
1022 | AssetCache.AddAsset(asset); | ||
1023 | |||
1024 | InventoryItemBase item = new InventoryItemBase(); | ||
1025 | item.Creator = objectGroup.RootPart.CreatorID; | ||
1026 | item.Owner = remoteClient.AgentId; | ||
1027 | item.ID = LLUUID.Random(); | ||
1028 | item.AssetID = asset.FullID; | ||
1029 | item.Description = asset.Description; | ||
1030 | item.Name = asset.Name; | ||
1031 | item.AssetType = asset.Type; | ||
1032 | item.InvType = asset.InvType; | ||
1033 | |||
1034 | // Sticking it in root folder for now.. objects folder later? | ||
1035 | |||
1036 | item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID; | ||
1037 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
1038 | if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) | ||
1039 | { | ||
1040 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; | ||
1041 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1042 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1043 | } | ||
1044 | else | ||
1045 | { | ||
1046 | item.BasePermissions = objectGroup.RootPart.BaseMask; | ||
1047 | item.CurrentPermissions = objectGroup.RootPart.OwnerMask; | ||
1048 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1049 | } | ||
1050 | |||
1051 | userInfo.AddItem(remoteClient.AgentId, item); | ||
1052 | remoteClient.SendInventoryItemCreateUpdate(item); | ||
1053 | return item.AssetID; | ||
1054 | } | ||
1055 | return LLUUID.Zero; | ||
1056 | } | ||
1057 | return LLUUID.Zero; | ||
1058 | |||
1059 | } | ||
1005 | 1060 | ||
1006 | /// <summary> | 1061 | /// <summary> |
1007 | /// Rez an object into a scene | 1062 | /// Event Handler Rez an object into a scene |
1063 | /// Calls the non-void event handler | ||
1008 | /// </summary> | 1064 | /// </summary> |
1009 | /// <param name="remoteClient"></param> | 1065 | /// <param name="remoteClient"></param> |
1010 | /// <param name="itemID"></param> | 1066 | /// <param name="itemID"></param> |
@@ -1025,6 +1081,38 @@ namespace OpenSim.Region.Environment.Scenes | |||
1025 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, | 1081 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, |
1026 | bool RezSelected, bool RemoveItem, LLUUID fromTaskID) | 1082 | bool RezSelected, bool RemoveItem, LLUUID fromTaskID) |
1027 | { | 1083 | { |
1084 | SceneObjectGroup sog = RezObject(remoteClient, itemID, RayEnd, RayStart, | ||
1085 | RayTargetID, BypassRayCast, RayEndIsIntersection, | ||
1086 | EveryoneMask, GroupMask, NextOwnerMask, ItemFlags, | ||
1087 | RezSelected, RemoveItem, fromTaskID, false); | ||
1088 | } | ||
1089 | |||
1090 | |||
1091 | |||
1092 | /// <summary> | ||
1093 | /// Returns SceneObjectGroup or null from asset request. | ||
1094 | /// </summary> | ||
1095 | /// <param name="remoteClient"></param> | ||
1096 | /// <param name="itemID"></param> | ||
1097 | /// <param name="RayEnd"></param> | ||
1098 | /// <param name="RayStart"></param> | ||
1099 | /// <param name="RayTargetID"></param> | ||
1100 | /// <param name="BypassRayCast"></param> | ||
1101 | /// <param name="RayEndIsIntersection"></param> | ||
1102 | /// <param name="EveryoneMask"></param> | ||
1103 | /// <param name="GroupMask"></param> | ||
1104 | /// <param name="NextOwnerMask"></param> | ||
1105 | /// <param name="ItemFlags"></param> | ||
1106 | /// <param name="RezSelected"></param> | ||
1107 | /// <param name="RemoveItem"></param> | ||
1108 | /// <param name="fromTaskID"></param> | ||
1109 | /// <param name="difference"></param> | ||
1110 | /// <returns></returns> | ||
1111 | public virtual SceneObjectGroup RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart, | ||
1112 | LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
1113 | uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags, | ||
1114 | bool RezSelected, bool RemoveItem, LLUUID fromTaskID, bool attachment) | ||
1115 | { | ||
1028 | // Work out position details | 1116 | // Work out position details |
1029 | byte bRayEndIsIntersection = (byte)0; | 1117 | byte bRayEndIsIntersection = (byte)0; |
1030 | 1118 | ||
@@ -1042,9 +1130,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1042 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), | 1130 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), |
1043 | BypassRayCast, bRayEndIsIntersection); | 1131 | BypassRayCast, bRayEndIsIntersection); |
1044 | 1132 | ||
1045 | if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos)) | 1133 | if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos) && !attachment) |
1046 | { | 1134 | { |
1047 | return; | 1135 | return null; |
1048 | } | 1136 | } |
1049 | 1137 | ||
1050 | // Rez object | 1138 | // Rez object |
@@ -1064,7 +1152,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1064 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 1152 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
1065 | group.ResetIDs(); | 1153 | group.ResetIDs(); |
1066 | AddEntity(group); | 1154 | AddEntity(group); |
1067 | group.AbsolutePosition = pos; | 1155 | |
1156 | // if attachment we set it's asset id so object updates can reflect that | ||
1157 | // if not, we set it's position in world. | ||
1158 | if (!attachment) | ||
1159 | group.AbsolutePosition = pos; | ||
1160 | else | ||
1161 | group.SetFromAssetID(itemID); | ||
1162 | |||
1068 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1163 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1069 | 1164 | ||
1070 | // Since renaming the item in the inventory does not affect the name stored | 1165 | // Since renaming the item in the inventory does not affect the name stored |
@@ -1092,34 +1187,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1092 | group.ApplyPhysics(m_physicalPrim); | 1187 | group.ApplyPhysics(m_physicalPrim); |
1093 | group.StartScripts(); | 1188 | group.StartScripts(); |
1094 | 1189 | ||
1095 | //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); | 1190 | |
1096 | //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 1191 | if (!attachment) |
1097 | //{ | 1192 | rootPart.ScheduleFullUpdate(); |
1098 | //PrimitiveBaseShape pbs = rootPart.Shape; | 1193 | |
1099 | //rootPart.PhysActor = PhysicsScene.AddPrimShape( | 1194 | return rootPart.ParentGroup; |
1100 | //rootPart.Name, | ||
1101 | //pbs, | ||
1102 | //new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | ||
1103 | // rootPart.AbsolutePosition.Z), | ||
1104 | //new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | ||
1105 | //new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | ||
1106 | // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); | ||
1107 | |||
1108 | // rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | ||
1109 | |||
1110 | // } | ||
1111 | // | ||
1112 | rootPart.ScheduleFullUpdate(); | ||
1113 | } | 1195 | } |
1114 | } | 1196 | } |
1115 | } | 1197 | } |
1116 | } | 1198 | } |
1199 | return null; | ||
1117 | } | 1200 | } |
1118 | 1201 | ||
1119 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, | 1202 | |
1120 | uint ItemFlags, uint NextOwnerMask) | ||
1121 | { | ||
1122 | Console.WriteLine("RezSingleAttachment: unimplemented yet"); | ||
1123 | } | ||
1124 | } | 1203 | } |
1125 | } | 1204 | } |