2007-09-06 04:17:45 +00:00
|
|
|
using System;
|
2025-05-27 14:16:03 -05:00
|
|
|
using System.Security.Permissions;
|
2007-09-06 04:17:45 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-09-06 04:17:45 +00:00
|
|
|
{
|
|
|
|
|
public class FindTextureCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public FindTextureCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "findtexture";
|
|
|
|
|
Description = "Checks if a specified texture is currently visible on a specified face. " +
|
|
|
|
|
"Usage: findtexture [face-index] [texture-uuid]";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Objects;
|
2007-09-06 04:17:45 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-09-06 04:17:45 +00:00
|
|
|
{
|
|
|
|
|
if (args.Length != 2)
|
2025-05-27 14:16:03 -05:00
|
|
|
{
|
2007-09-06 04:17:45 +00:00
|
|
|
return "Usage: findtexture [face-index] [texture-uuid]";
|
2025-05-27 14:16:03 -05:00
|
|
|
}
|
2007-09-06 04:17:45 +00:00
|
|
|
|
2025-05-27 14:16:03 -05:00
|
|
|
if (int.TryParse(args[0], out var faceIndex) &&
|
|
|
|
|
UUID.TryParse(args[1], out var textureID))
|
2007-09-06 04:17:45 +00:00
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
foreach (var kvp in Client.Network.CurrentSim.ObjectsPrimitives)
|
|
|
|
|
{
|
|
|
|
|
if (kvp.Value == null) { continue; }
|
|
|
|
|
|
|
|
|
|
var prim = kvp.Value;
|
|
|
|
|
if (prim.Textures?.FaceTextures[faceIndex] == null) { continue; }
|
|
|
|
|
if (prim.Textures.FaceTextures[faceIndex].TextureID == textureID)
|
2007-09-06 04:17:45 +00:00
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
Logger.Log(
|
|
|
|
|
$"Primitive {prim.ID.ToString()} ({prim.LocalID}) has face index {faceIndex} set to {textureID.ToString()}",
|
|
|
|
|
Helpers.LogLevel.Info, Client);
|
2007-09-06 04:17:45 +00:00
|
|
|
}
|
2025-05-27 14:16:03 -05:00
|
|
|
}
|
2007-09-06 04:17:45 +00:00
|
|
|
|
|
|
|
|
return "Done searching";
|
|
|
|
|
}
|
2025-05-27 14:16:03 -05:00
|
|
|
|
|
|
|
|
return "Usage: findtexture [face-index] [texture-uuid]";
|
2007-09-06 04:17:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|