RoboticArms/Library/PackageCache/com.unity.animation.rigging@68167b505d2b/Editor/Attributes/InverseRigConstraintAttribute.cs
2025-11-17 15:16:36 +07:00

33 lines
1.2 KiB
C#

using System;
using UnityEngine;
using UnityEngine.Animations.Rigging;
namespace UnityEditor.Animations.Rigging
{
/// <summary>
/// The [InverseRigConstraint] attribute allows to match an inverse constraint (inverse solve) to its
/// base constraint (forward solve) counterpart. This is used in bi-directional baking to override
/// constraints when baking animations to constraints.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class InverseRigConstraintAttribute : Attribute
{
/// <summary>
/// Constructor.
/// </summary>
/// <param name="targetBinderType">The base constraint type.</param>
public InverseRigConstraintAttribute(Type targetBinderType)
{
if (targetBinderType == null || !typeof(IRigConstraint).IsAssignableFrom(targetBinderType))
Debug.LogError("Invalid constraint for InverseRigConstraint attribute.");
this.baseConstraint = targetBinderType;
}
/// <summary>
/// Retrieves the base constraint type.
/// </summary>
public Type baseConstraint { get; }
}
}