mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
Add a sample use for the validation
This commit is contained in:
@@ -454,6 +454,22 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
|
||||
private void ValidateAssets()
|
||||
{
|
||||
if (m_asset.Type == (sbyte)CustomAssetType.AnimationSet)
|
||||
{
|
||||
AnimationSet animSet = new AnimationSet(m_asset.Data);
|
||||
|
||||
bool allOk = animSet.Validate(x => {
|
||||
int perms = m_Scene.InventoryService.GetAssetPermissions(ourClient.AgentId, x);
|
||||
int required = (int)(PermissionMask.Transfer | PermissionMask.Copy);
|
||||
if ((perms & required) != required)
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!allOk)
|
||||
m_asset.Data = animSet.ToBytes();
|
||||
}
|
||||
|
||||
if (m_asset.Type == (sbyte)AssetType.Clothing ||
|
||||
m_asset.Type == (sbyte)AssetType.Bodypart)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Animation;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using AnimationSet = OpenSim.Region.Framework.Scenes.Animation.AnimationSet;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Avatar.Animations
|
||||
{
|
||||
@@ -197,4 +198,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations
|
||||
sb.Append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user