mirror of https://github.com/opensim/opensim.git
a few changes to materials upload to inventory
This commit is contained in:
parent
cd4c009e64
commit
1d27845e2a
|
@ -68,6 +68,9 @@ namespace OpenSim.Framework
|
|||
public static readonly UUID EmptyNotecardID = new UUID(EmptyNotecard);
|
||||
public static readonly byte[] EmptyNotecardData = osUTF8.GetASCIIBytes("Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length 0\n}\n\0");
|
||||
|
||||
public static readonly string DefaultMaterial = "968cbad0-4dad-d64e-71b5-72bf13ad051a";
|
||||
public static readonly UUID DefaultMaterialID = new UUID(DefaultMaterial);
|
||||
|
||||
public static readonly string m_MrOpenSimIDString = "11111111-1111-0000-0000-000100bba000";
|
||||
public static readonly UUID m_MrOpenSimID = new UUID(m_MrOpenSimIDString);
|
||||
public static readonly DateTime m_MrOpenSimBorn = new DateTime(2007, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
UpdateInventoryItemAsset(httpRequest, httpResponse, map, (byte)AssetType.Material);
|
||||
}
|
||||
|
||||
|
||||
public void UpdateGestureItemAsset(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap map)
|
||||
{
|
||||
UpdateInventoryItemAsset(httpRequest, httpResponse, map, (byte)AssetType.Gesture);
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
name, description, flags, callbackID, asset.FullID, asset.Type, invType,
|
||||
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
|
||||
everyonemask, nextOwnerMask, groupmask,
|
||||
creationDate, false); // Data from viewer
|
||||
creationDate);
|
||||
return;
|
||||
}
|
||||
switch (assetType)
|
||||
|
@ -245,7 +245,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
name, description, flags, callbackID, assetID, (sbyte)AssetType.Settings, invType,
|
||||
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
|
||||
everyonemask, nextOwnerMask, groupmask,
|
||||
creationDate, false); // Data from viewer
|
||||
creationDate);
|
||||
return;
|
||||
}
|
||||
case (sbyte)AssetType.LSLText:
|
||||
|
@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
name, description, flags, callbackID, Constants.DefaultScriptID, (sbyte)AssetType.LSLText, invType,
|
||||
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
|
||||
everyonemask, nextOwnerMask, groupmask,
|
||||
creationDate, false); // Data from viewer
|
||||
creationDate); // Data from viewer
|
||||
return;
|
||||
}
|
||||
case (sbyte)AssetType.Notecard:
|
||||
|
@ -265,7 +265,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
name, description, flags, callbackID, Constants.EmptyNotecardID, (sbyte)AssetType.Notecard, invType,
|
||||
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
|
||||
everyonemask, nextOwnerMask, groupmask,
|
||||
creationDate, false); // Data from viewer
|
||||
creationDate);
|
||||
return;
|
||||
}
|
||||
case (sbyte)AssetType.Material:
|
||||
{
|
||||
m_Scene.CreateNewInventoryItem(
|
||||
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
|
||||
name, description, flags, callbackID, Constants.DefaultMaterialID, (sbyte)AssetType.Material, invType,
|
||||
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
|
||||
everyonemask, nextOwnerMask, groupmask,
|
||||
creationDate);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -282,7 +292,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
name, description, flags, callbackID, UUID.Zero, assetType, invType,
|
||||
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
|
||||
everyonemask, nextOwnerMask, groupmask,
|
||||
creationDate, false); // Data from viewer
|
||||
creationDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1041,53 +1041,33 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
if (newName.Length == 0)
|
||||
if (string.IsNullOrEmpty(newName))
|
||||
newName = item.Name;
|
||||
|
||||
AssetBase asset = AssetService.Get(item.AssetID.ToString());
|
||||
|
||||
if (asset is not null)
|
||||
if (remoteClient.AgentId.Equals(oldAgentID)
|
||||
|| (LibraryService is not null
|
||||
&& LibraryService.LibraryRootFolder is not null
|
||||
&& oldAgentID.Equals(LibraryService.LibraryRootFolder.Owner)))
|
||||
{
|
||||
if (newName.Length != 0)
|
||||
{
|
||||
asset.Name = newName;
|
||||
}
|
||||
else
|
||||
{
|
||||
newName = item.Name;
|
||||
}
|
||||
|
||||
if (remoteClient.AgentId.Equals(oldAgentID)
|
||||
|| (LibraryService is not null
|
||||
&& LibraryService.LibraryRootFolder is not null
|
||||
&& oldAgentID.Equals(LibraryService.LibraryRootFolder.Owner)))
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID,
|
||||
newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
|
||||
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
|
||||
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
|
||||
&& (m_permissions.BypassPermissions()
|
||||
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
|
||||
item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
|
||||
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
|
||||
}
|
||||
}
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID,
|
||||
newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
|
||||
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
|
||||
item.Name, item.AssetID);
|
||||
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
|
||||
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
|
||||
&& (m_permissions.BypassPermissions()
|
||||
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
|
||||
item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
|
||||
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1170,6 +1150,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
|
||||
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
|
||||
bool assetUpload)
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, creatorID, creatorData, folderID,
|
||||
name, description, flags, callbackID, assetID, assetType, invType,
|
||||
baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate);
|
||||
}
|
||||
|
||||
public void CreateNewInventoryItem(
|
||||
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
|
||||
string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
|
||||
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
|
||||
{
|
||||
InventoryItemBase item = new()
|
||||
{
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
TELEPORT = 512,
|
||||
REGION_RESTART = 1024,
|
||||
MEDIA = 2048,
|
||||
MATERIAL = 4096,
|
||||
ANIMATION = 16384,
|
||||
POSITION = 32768
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue