k/Extensions/SkinnedModelRendererExtensions.cs
namespace Sandbox.k.Extensions;
public static class SkinnedModelRendererExtensions
{
/// <summary>
/// Clear the outfit from this model, make it named
/// </summary>
public static void Reset( this SkinnedModelRenderer body )
{
// Start with defaults
body.Set( "scale_height", 1.0f );
body.MaterialGroup = "default";
body.MaterialOverride = null;
body.BodyGroups = body.Model?.DefaultBodyGroupMask ?? 0;
// Remove old models
foreach ( var children in body.GameObject.Children )
{
if ( children.Tags.Has( "clothing" ) )
{
children.Destroy();
}
}
}
}