Ejemplo n.º 1
0
        /// <summary>
        /// Override this method to determine which object to bind to <paramref name="track"/>.
        /// A binding object should be determined from <paramref name="candidate"/>.
        ///
        /// By default, the `TrackBindingType` attribute from <paramref name="track"/> will be used to determine the binding.
        /// </summary>
        /// <param name="candidate">The source object from which a track binding should be determined.</param>
        /// <param name="track">The track to bind an object to.</param>
        /// <returns>The object to bind to <paramref name="track"/>.</returns>
        /// <seealso cref="UnityEngine.Timeline.TrackBindingTypeAttribute"/>
        /// <seealso cref="UnityEngine.Timeline.TrackAsset"/>
        public virtual UnityEngine.Object GetBindingFrom(UnityEngine.Object candidate, TrackAsset track)
        {
            Type bindingType = GetBindingType(track);

            BindingUtility.BindingAction action = BindingUtility.GetBindingAction(bindingType, candidate);
            return(BindingUtility.GetBinding(action, candidate, bindingType));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Override this method to validate if a binding for <paramref name="track"/>
        /// can be determined from <paramref name="candidate"/>.
        ///
        /// The default implementation of this method will return true if
        /// - <paramref name="candidate"/> is not null or,
        /// - <paramref name="candidate"/> is not part of a Prefab Asset or,
        /// - <paramref name="candidate"/> is a Component that can be bound to <paramref name="track"/>
        /// </summary>
        /// <param name="candidate"></param>
        /// <param name="track">TBD</param>
        /// <returns>True if a binding can be determined from <paramref name="candidate"/>.</returns>
        /// <seealso cref="UnityEngine.Timeline.TrackBindingTypeAttribute"/>
        /// <seealso cref="UnityEngine.Timeline.TrackAsset"/>
        public virtual bool IsBindingAssignableFrom(UnityEngine.Object candidate, TrackAsset track)
        {
            var action = BindingUtility.GetBindingAction(GetBindingType(track), candidate);

            return(action != BindingUtility.BindingAction.DoNotBind);
        }