Add a sample use for the validation
parent
546537c056
commit
e37637587a
|
@ -454,6 +454,22 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
|
|
||||||
private void ValidateAssets()
|
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 ||
|
if (m_asset.Type == (sbyte)AssetType.Clothing ||
|
||||||
m_asset.Type == (sbyte)AssetType.Bodypart)
|
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;
|
||||||
using OpenSim.Region.Framework.Scenes.Animation;
|
using OpenSim.Region.Framework.Scenes.Animation;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
using AnimationSet = OpenSim.Region.Framework.Scenes.Animation.AnimationSet;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Avatar.Animations
|
namespace OpenSim.Region.OptionalModules.Avatar.Animations
|
||||||
{
|
{
|
||||||
|
@ -197,4 +198,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations
|
||||||
sb.Append("\n");
|
sb.Append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue