// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System; namespace FlaxEngine { /// /// Specifies a options for an asset reference picker in the editor. Allows to customize view or provide custom value assign policy. /// /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class AssetReferenceAttribute : Attribute { /// /// The full name of the asset type to link. Use null or empty to skip it. Can be used as file extension filter if starts with a dot and used over string property. /// public string TypeName; /// /// True if use asset picker with a smaller height (single line), otherwise will use with full icon. /// public bool UseSmallPicker; /// /// Initializes a new instance of the class. /// /// True if use asset picker with a smaller height (single line), otherwise will use with full icon. public AssetReferenceAttribute(bool useSmallPicker) { TypeName = null; UseSmallPicker = useSmallPicker; } /// /// Initializes a new instance of the class. /// /// The full name of the asset type to link. Use null or empty to skip it. /// True if use asset picker with a smaller height (single line), otherwise will use with full icon. public AssetReferenceAttribute(Type typeName = null, bool useSmallPicker = false) { TypeName = typeName?.FullName; UseSmallPicker = useSmallPicker; } /// /// Initializes a new instance of the class. /// /// The full name of the asset type to link. Use null or empty to skip it. Can be used as file extension filter if starts with a dot and used over string property. /// True if use asset picker with a smaller height (single line), otherwise will use with full icon. public AssetReferenceAttribute(string typeName = null, bool useSmallPicker = false) { TypeName = typeName; UseSmallPicker = useSmallPicker; } } #if USE_NETCORE /// /// Specifies a options for an asset reference picker in the editor. Allows to customize view or provide custom value assign policy. /// /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class AssetReferenceAttribute : AssetReferenceAttribute { /// /// Initializes a new instance of the class for generic type T. /// /// True if use asset picker with a smaller height (single line), otherwise will use with full icon. public AssetReferenceAttribute(bool useSmallPicker = false) : base(typeof(T), useSmallPicker) { } } #endif }