using UnityEngine;

public class PoseLoadOptions
{
    //general
    public bool
        Root,
        Morphs;

    //body parts
    public bool
        Body,
        Ears,
        //EarsAlt,
        Tail,
        //TailAlt,
        Other;

    //all
    public bool
        Position,
        Rotation,
        Scale;

    public PoseLoadOptions(bool value)
    {
        Root        = value;
        Morphs      = value;
        Body        = value;
        Ears        = value;
        //EarsAlt     = value;
        Tail        = value;
        //TailAlt     = value;
        Other       = value;
        Position    = value;
        Rotation    = value;
        Scale       = value;
    }

    public static PoseLoadOptions None()
    {
        return new PoseLoadOptions(false);
    }

    public static PoseLoadOptions All()
    {
        return new PoseLoadOptions(true);
    }
}

public static class PoseLoadOptionsExtra
{
    public static void ApplyTo(this SerializableTransform tsf, Transform t, PoseLoadOptions options)
    {
        if (tsf.Space == Space.World)
        {
            if (options.Position) t.position = tsf.Position;
            if (options.Rotation) t.eulerAngles = tsf.Rotation;
            if (options.Scale) t.localScale = tsf.Scale;
        }
        else
        {
            if (options.Position) t.localPosition = tsf.Position;
            if (options.Rotation) t.localEulerAngles = tsf.Rotation;
            if (options.Scale) t.localScale = tsf.Scale;
        }
    }
}