aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-23 18:01:58 +0000
committerJustin Clarke Casey2008-06-23 18:01:58 +0000
commitde243802334c44967273be2d1455a5f191f75955 (patch)
tree7228d224717ff5b5c021161225ac9f4e46b39174 /OpenSim/Region/Environment/Scenes
parentadd migration to go from varchar -> char for uuid. Tested (diff)
downloadopensim-SC_OLD-de243802334c44967273be2d1455a5f191f75955.zip
opensim-SC_OLD-de243802334c44967273be2d1455a5f191f75955.tar.gz
opensim-SC_OLD-de243802334c44967273be2d1455a5f191f75955.tar.bz2
opensim-SC_OLD-de243802334c44967273be2d1455a5f191f75955.tar.xz
* Remove all use of asset.InvType, as outlined in mailing list discussion
* This is stage 1, the field will be removed from AssetType and the assets table if this change doesn't prove problematic
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs87
2 files changed, 53 insertions, 36 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 7529d77..c0edaba 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -433,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
433 SceneObjectGroup group = (SceneObjectGroup)obj; 433 SceneObjectGroup group = (SceneObjectGroup)obj;
434 group.DetachToInventoryPrep(); 434 group.DetachToInventoryPrep();
435 m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 435 m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
436 m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID); 436 m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID);
437 m_parentScene.DeleteSceneObject(group); 437 m_parentScene.DeleteSceneObject(group);
438 } 438 }
439 } 439 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index ff62a3b..e6bae4c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -164,8 +164,7 @@ namespace OpenSim.Region.Environment.Scenes
164 if (item != null) 164 if (item != null)
165 { 165 {
166 AssetBase asset = 166 AssetBase asset =
167 CreateAsset(item.Name, item.Description, (sbyte) item.InvType, 167 CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data);
168 (sbyte) item.AssetType, data);
169 AssetCache.AddAsset(asset); 168 AssetCache.AddAsset(asset);
170 169
171 item.AssetID = asset.FullID; 170 item.AssetID = asset.FullID;
@@ -241,10 +240,7 @@ namespace OpenSim.Region.Environment.Scenes
241 return; 240 return;
242 } 241 }
243 242
244 // Create new asset 243 AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data);
245 // XXX Hardcoding the numbers is a temporary measure - need an enumeration for this
246 // There may well be one in libsecondlife
247 AssetBase asset = CreateAsset(item.Name, item.Description, 10, 10, data);
248 AssetCache.AddAsset(asset); 244 AssetCache.AddAsset(asset);
249 245
250 // Update item with new asset 246 // Update item with new asset
@@ -521,12 +517,14 @@ namespace OpenSim.Region.Environment.Scenes
521 if (remoteClient.AgentId == oldAgentID) 517 if (remoteClient.AgentId == oldAgentID)
522 { 518 {
523 CreateNewInventoryItem( 519 CreateNewInventoryItem(
524 remoteClient, newFolderID, callbackID, asset, item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions); 520 remoteClient, newFolderID, callbackID, asset, (sbyte)item.InvType,
521 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions);
525 } 522 }
526 else 523 else
527 { 524 {
528 CreateNewInventoryItem( 525 CreateNewInventoryItem(
529 remoteClient, newFolderID, callbackID, asset, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions); 526 remoteClient, newFolderID, callbackID, asset, (sbyte)item.InvType,
527 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions);
530 } 528 }
531 } 529 }
532 else 530 else
@@ -537,15 +535,24 @@ namespace OpenSim.Region.Environment.Scenes
537 } 535 }
538 } 536 }
539 537
540 private AssetBase CreateAsset(string name, string description, sbyte invType, sbyte assetType, byte[] data) 538 /// <summary>
539 /// Create a new asset data structure.
540 /// </summary>
541 /// <param name="name"></param>
542 /// <param name="description"></param>
543 /// <param name="invType"></param>
544 /// <param name="assetType"></param>
545 /// <param name="data"></param>
546 /// <returns></returns>
547 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
541 { 548 {
542 AssetBase asset = new AssetBase(); 549 AssetBase asset = new AssetBase();
543 asset.Name = name; 550 asset.Name = name;
544 asset.Description = description; 551 asset.Description = description;
545 asset.InvType = invType;
546 asset.Type = assetType; 552 asset.Type = assetType;
547 asset.FullID = LLUUID.Random(); 553 asset.FullID = LLUUID.Random();
548 asset.Data = (data == null) ? new byte[1] : data; 554 asset.Data = (data == null) ? new byte[1] : data;
555
549 return asset; 556 return asset;
550 } 557 }
551 558
@@ -603,10 +610,21 @@ namespace OpenSim.Region.Environment.Scenes
603 } 610 }
604 } 611 }
605 612
613 /// <summary>
614 /// Create a new inventory item.
615 /// </summary>
616 /// <param name="remoteClient"></param>
617 /// <param name="folderID"></param>
618 /// <param name="callbackID"></param>
619 /// <param name="asset"></param>
620 /// <param name="invType"></param>
621 /// <param name="nextOwnerMask"></param>
606 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, 622 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
607 AssetBase asset, uint nextOwnerMask) 623 AssetBase asset, sbyte invType, uint nextOwnerMask)
608 { 624 {
609 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask); 625 CreateNewInventoryItem(
626 remoteClient, folderID, callbackID, asset, invType,
627 (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask);
610 } 628 }
611 629
612 /// <summary> 630 /// <summary>
@@ -616,9 +634,11 @@ namespace OpenSim.Region.Environment.Scenes
616 /// <param name="folderID"></param> 634 /// <param name="folderID"></param>
617 /// <param name="callbackID"></param> 635 /// <param name="callbackID"></param>
618 /// <param name="asset"></param> 636 /// <param name="asset"></param>
637 /// <param name="invType"></param>
619 /// <param name="nextOwnerMask"></param> 638 /// <param name="nextOwnerMask"></param>
620 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, 639 private void CreateNewInventoryItem(
621 AssetBase asset, uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask) 640 IClientAPI remoteClient, LLUUID folderID, uint callbackID, AssetBase asset, sbyte invType,
641 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask)
622 { 642 {
623 CachedUserInfo userInfo 643 CachedUserInfo userInfo
624 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 644 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
@@ -633,7 +653,7 @@ namespace OpenSim.Region.Environment.Scenes
633 item.Description = asset.Description; 653 item.Description = asset.Description;
634 item.Name = asset.Name; 654 item.Name = asset.Name;
635 item.AssetType = asset.Type; 655 item.AssetType = asset.Type;
636 item.InvType = asset.InvType; 656 item.InvType = invType;
637 item.Folder = folderID; 657 item.Folder = folderID;
638 item.CurrentPermissions = currentMask; 658 item.CurrentPermissions = currentMask;
639 item.NextPermissions = nextOwnerMask; 659 item.NextPermissions = nextOwnerMask;
@@ -692,10 +712,10 @@ namespace OpenSim.Region.Environment.Scenes
692 data=Encoding.ASCII.GetBytes(strdata); 712 data=Encoding.ASCII.GetBytes(strdata);
693 } 713 }
694 714
695 AssetBase asset = CreateAsset(name, description, invType, assetType, data); 715 AssetBase asset = CreateAsset(name, description, assetType, data);
696 AssetCache.AddAsset(asset); 716 AssetCache.AddAsset(asset);
697 717
698 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask); 718 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, invType, nextOwnerMask);
699 } 719 }
700 else 720 else
701 { 721 {
@@ -926,8 +946,7 @@ namespace OpenSim.Region.Environment.Scenes
926 public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID transactionID, TaskInventoryItem itemInfo, 946 public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID transactionID, TaskInventoryItem itemInfo,
927 uint primLocalID) 947 uint primLocalID)
928 { 948 {
929 LLUUID itemID=itemInfo.ItemID; 949 LLUUID itemID = itemInfo.ItemID;
930 LLUUID folderID=itemInfo.ParentID;
931 950
932 // Find the prim we're dealing with 951 // Find the prim we're dealing with
933 SceneObjectPart part = GetSceneObjectPart(primLocalID); 952 SceneObjectPart part = GetSceneObjectPart(primLocalID);
@@ -1057,7 +1076,7 @@ namespace OpenSim.Region.Environment.Scenes
1057 if (part == null) 1076 if (part == null)
1058 return; 1077 return;
1059 1078
1060 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.InvType, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); 1079 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"));
1061 AssetCache.AddAsset(asset); 1080 AssetCache.AddAsset(asset);
1062 1081
1063 TaskInventoryItem taskItem=new TaskInventoryItem(); 1082 TaskInventoryItem taskItem=new TaskInventoryItem();
@@ -1084,6 +1103,7 @@ namespace OpenSim.Region.Environment.Scenes
1084 1103
1085 part.AddInventoryItem(taskItem); 1104 part.AddInventoryItem(taskItem);
1086 part.GetProperties(remoteClient); 1105 part.GetProperties(remoteClient);
1106
1087 if (ExternalChecks.ExternalChecksCanRunScript(taskItem.AssetID, part.UUID, remoteClient.AgentId)) 1107 if (ExternalChecks.ExternalChecksCanRunScript(taskItem.AssetID, part.UUID, remoteClient.AgentId))
1088 { 1108 {
1089 part.StartScript(taskItem); 1109 part.StartScript(taskItem);
@@ -1160,12 +1180,12 @@ namespace OpenSim.Region.Environment.Scenes
1160 CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 1180 CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
1161 if (userInfo != null) 1181 if (userInfo != null)
1162 { 1182 {
1163 string searchFolder = ""; 1183// string searchFolder = "";
1164 1184
1165 if (DeRezPacket.AgentBlock.Destination == 6) 1185// if (DeRezPacket.AgentBlock.Destination == 6)
1166 searchFolder = "Trash"; 1186// searchFolder = "Trash";
1167 else if (DeRezPacket.AgentBlock.Destination == 9) 1187// else if (DeRezPacket.AgentBlock.Destination == 9)
1168 searchFolder = "Lost And Found"; 1188// searchFolder = "Lost And Found";
1169 1189
1170 // If we're deleting someone else's item, it goes back to their deleted items folder 1190 // If we're deleting someone else's item, it goes back to their deleted items folder
1171 // If we're returning someone's item, it goes back to the owner's Lost And Found folder. 1191 // If we're returning someone's item, it goes back to the owner's Lost And Found folder.
@@ -1196,8 +1216,7 @@ namespace OpenSim.Region.Environment.Scenes
1196 AssetBase asset = CreateAsset( 1216 AssetBase asset = CreateAsset(
1197 ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId), 1217 ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId),
1198 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId), 1218 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId),
1199 (sbyte) InventoryType.Object, 1219 (sbyte)AssetType.Object,
1200 (sbyte) AssetType.Object,
1201 Helpers.StringToField(sceneObjectXml)); 1220 Helpers.StringToField(sceneObjectXml));
1202 AssetCache.AddAsset(asset); 1221 AssetCache.AddAsset(asset);
1203 1222
@@ -1214,7 +1233,7 @@ namespace OpenSim.Region.Environment.Scenes
1214 item.Description = asset.Description; 1233 item.Description = asset.Description;
1215 item.Name = asset.Name; 1234 item.Name = asset.Name;
1216 item.AssetType = asset.Type; 1235 item.AssetType = asset.Type;
1217 item.InvType = asset.InvType; 1236 item.InvType = (int)InventoryType.Object;
1218 item.Folder = folderID; 1237 item.Folder = folderID;
1219 if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) 1238 if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
1220 { 1239 {
@@ -1286,7 +1305,6 @@ namespace OpenSim.Region.Environment.Scenes
1286 // search through folders to find the asset. 1305 // search through folders to find the asset.
1287 while (searchfolders.Count > 0) 1306 while (searchfolders.Count > 0)
1288 { 1307 {
1289
1290 InventoryFolderImpl fld = searchfolders.Dequeue(); 1308 InventoryFolderImpl fld = searchfolders.Dequeue();
1291 lock (fld) 1309 lock (fld)
1292 { 1310 {
@@ -1308,10 +1326,10 @@ namespace OpenSim.Region.Environment.Scenes
1308 } 1326 }
1309 } 1327 }
1310 } 1328 }
1329
1311 AssetBase asset = CreateAsset( 1330 AssetBase asset = CreateAsset(
1312 objectGroup.GetPartName(objectGroup.LocalId), 1331 objectGroup.GetPartName(objectGroup.LocalId),
1313 objectGroup.GetPartDescription(objectGroup.LocalId), 1332 objectGroup.GetPartDescription(objectGroup.LocalId),
1314 (sbyte)InventoryType.Object,
1315 (sbyte)AssetType.Object, 1333 (sbyte)AssetType.Object,
1316 Helpers.StringToField(sceneObjectXml)); 1334 Helpers.StringToField(sceneObjectXml));
1317 AssetCache.AddAsset(asset); 1335 AssetCache.AddAsset(asset);
@@ -1324,7 +1342,7 @@ namespace OpenSim.Region.Environment.Scenes
1324 item.Description = asset.Description; 1342 item.Description = asset.Description;
1325 item.Name = asset.Name; 1343 item.Name = asset.Name;
1326 item.AssetType = asset.Type; 1344 item.AssetType = asset.Type;
1327 item.InvType = asset.InvType; 1345 item.InvType = (int)InventoryType.Object;
1328 1346
1329 // Sticking it in root folder for now.. objects folder later? 1347 // Sticking it in root folder for now.. objects folder later?
1330 1348
@@ -1369,7 +1387,6 @@ namespace OpenSim.Region.Environment.Scenes
1369 AssetBase asset = CreateAsset( 1387 AssetBase asset = CreateAsset(
1370 objectGroup.GetPartName(objectGroup.LocalId), 1388 objectGroup.GetPartName(objectGroup.LocalId),
1371 objectGroup.GetPartDescription(objectGroup.LocalId), 1389 objectGroup.GetPartDescription(objectGroup.LocalId),
1372 (sbyte)InventoryType.Object,
1373 (sbyte)AssetType.Object, 1390 (sbyte)AssetType.Object,
1374 Helpers.StringToField(sceneObjectXml)); 1391 Helpers.StringToField(sceneObjectXml));
1375 AssetCache.AddAsset(asset); 1392 AssetCache.AddAsset(asset);
@@ -1382,7 +1399,7 @@ namespace OpenSim.Region.Environment.Scenes
1382 item.Description = asset.Description; 1399 item.Description = asset.Description;
1383 item.Name = asset.Name; 1400 item.Name = asset.Name;
1384 item.AssetType = asset.Type; 1401 item.AssetType = asset.Type;
1385 item.InvType = asset.InvType; 1402 item.InvType = (int)InventoryType.Object;
1386 1403
1387 // Sticking it in root folder for now.. objects folder later? 1404 // Sticking it in root folder for now.. objects folder later?
1388 1405
@@ -1748,7 +1765,6 @@ namespace OpenSim.Region.Environment.Scenes
1748 AssetBase asset = CreateAsset( 1765 AssetBase asset = CreateAsset(
1749 returnobjects[i].GetPartName(returnobjects[i].LocalId), 1766 returnobjects[i].GetPartName(returnobjects[i].LocalId),
1750 returnobjects[i].GetPartDescription(returnobjects[i].LocalId), 1767 returnobjects[i].GetPartDescription(returnobjects[i].LocalId),
1751 (sbyte)InventoryType.Object,
1752 (sbyte)AssetType.Object, 1768 (sbyte)AssetType.Object,
1753 Helpers.StringToField(sceneObjectXml)); 1769 Helpers.StringToField(sceneObjectXml));
1754 AssetCache.AddAsset(asset); 1770 AssetCache.AddAsset(asset);
@@ -1761,8 +1777,9 @@ namespace OpenSim.Region.Environment.Scenes
1761 item.Description = asset.Description; 1777 item.Description = asset.Description;
1762 item.Name = asset.Name; 1778 item.Name = asset.Name;
1763 item.AssetType = asset.Type; 1779 item.AssetType = asset.Type;
1764 item.InvType = asset.InvType; 1780 item.InvType = (int)InventoryType.Object;
1765 item.Folder = folderID; 1781 item.Folder = folderID;
1782
1766 if ((AgentId != returnobjects[i].RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) 1783 if ((AgentId != returnobjects[i].RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
1767 { 1784 {
1768 uint perms = returnobjects[i].GetEffectivePermissions(); 1785 uint perms = returnobjects[i].GetEffectivePermissions();