Add a sample use for the validation

avinationmerge
Melanie Thielker 2014-09-25 22:03:02 +02:00
parent 546537c056
commit e37637587a
2 changed files with 18 additions and 1 deletions

View File

@ -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)
{

View File

@ -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
{