using System; using UnityEngine; namespace Unity.Cinemachine { /// /// Property applied to legacy input axis name specification. Used for custom drawing in the inspector. /// public sealed class InputAxisNamePropertyAttribute : PropertyAttribute {} /// /// Suppresses the top-level foldout on a complex property /// public sealed class HideFoldoutAttribute : PropertyAttribute {} /// Hide this property if a component of a given type is not present public sealed class HideIfNoComponentAttribute : PropertyAttribute { /// The name of the field controlling the enabled state public Type ComponentType; /// Constructor /// Type of the component to check for public HideIfNoComponentAttribute(Type type) => ComponentType = type; } /// /// Draw a foldout with an Enabled toggle that shadows a field inside the foldout /// public class FoldoutWithEnabledButtonAttribute : PropertyAttribute { /// The name of the field controlling the enabled state public string EnabledPropertyName; /// Constructor /// The name of the field controlling the enabled state public FoldoutWithEnabledButtonAttribute(string enabledProperty = "Enabled") => EnabledPropertyName = enabledProperty; } /// /// Draw a FoldoutWithEnabledButtonAttribute on a single line /// public sealed class EnabledPropertyAttribute : FoldoutWithEnabledButtonAttribute { /// Text to display to the right of the toggle button when disabled public string ToggleDisabledText; /// Constructor /// The name of the field controlling the enabled state /// Text to display to the right of the toggle button public EnabledPropertyAttribute(string enabledProperty = "Enabled", string toggleText = "") : base(enabledProperty) => ToggleDisabledText = toggleText; } /// /// Property applied to int or float fields to generate a slider in the inspector. /// [Obsolete("Use RangeAttribute instead")] public sealed class RangeSliderAttribute : PropertyAttribute { /// Minimum value for the range slider public float Min; /// Maximum value for the range slider public float Max; /// Constructor for the range slider attribute /// Minimum value for the range slider /// Maximum value for the range slider public RangeSliderAttribute(float min, float max) { Min = min; Max = max; } } /// /// Property applied to int or float fields to generate a minmax range slider in the inspector. /// public sealed class MinMaxRangeSliderAttribute : PropertyAttribute { /// Minimum value for the range slider public float Min; /// Maximum value for the range slider public float Max; /// Constructor for the range slider attribute /// Minimum value for the range slider /// Maximum value for the range slider public MinMaxRangeSliderAttribute(float min, float max) { Min = min; Max = max; } } /// /// Property applied to LensSetting properties. /// Will cause the property drawer to hide the ModeOverride setting. /// public sealed class LensSettingsHideModeOverridePropertyAttribute : PropertyAttribute {} /// Property to display a SensorSize field public sealed class SensorSizePropertyAttribute : PropertyAttribute {} /// Property field is a Tag. public sealed class TagFieldAttribute : PropertyAttribute {} /// /// Used for custom drawing in the inspector. Inspector will show a foldout with the asset contents /// /// GML TODO: delete this attribute public sealed class CinemachineEmbeddedAssetPropertyAttribute : PropertyAttribute { /// If true, inspector will display a warning if the embedded asset is null public bool WarnIfNull; /// Standard constructor /// If true, inspector will display a warning if the embedded asset is null public CinemachineEmbeddedAssetPropertyAttribute(bool warnIfNull = false) { WarnIfNull = warnIfNull; } } /// /// Property applied to Vector2 to treat (x, y) as (min, max). /// Used for custom drawing in the inspector. /// public sealed class Vector2AsRangeAttribute : PropertyAttribute {} /// /// Sets isDelayed to true for each float field of the vector. /// public sealed class DelayedVectorAttribute : PropertyAttribute {} /// /// Attribute used by camera pipeline authoring components to indicate /// which stage of the pipeline they belong in. /// public sealed class CameraPipelineAttribute : System.Attribute { /// Get the stage in the Camera Pipeline in which to position this component public CinemachineCore.Stage Stage { get; private set; } /// Constructor: Pipeline Stage is defined here. /// The stage in the Camera Pipeline in which to position this component public CameraPipelineAttribute(CinemachineCore.Stage stage) { Stage = stage; } } /// /// Attribute used by inspector to display warnings about missing targets. /// This can be used on CinemachineComponents and CinemachineExtensions. /// public sealed class RequiredTargetAttribute : System.Attribute { /// Choices for which targets are required public enum RequiredTargets { /// No specific target is required. None, /// Tracking Target is required for the pipeline element to work Tracking, /// LookAt Target is required for the pipeline element to work LookAt, /// LookAt Target is required and must be a ICinemachineTargetGroup for the pipeline element to work GroupLookAt }; /// Get the stage in the Camera Pipeline in which to position this component public RequiredTargets RequiredTarget { get; private set; } /// Constructor: Pipeline Stage is defined here. /// Which targets are required public RequiredTargetAttribute(RequiredTargets requiredTarget) { RequiredTarget = requiredTarget; } } /// /// Attribute applied to a CinemachineVirtualCameraBase property to produce /// a child camera selector in the inspectoe. /// public sealed class ChildCameraPropertyAttribute : PropertyAttribute {} /// /// Draws BlenderSettings asset embedded within the inspector. /// public sealed class EmbeddedBlenderSettingsPropertyAttribute : PropertyAttribute {} }