Example #1
0
 static int DeleteClip(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.Timeline.TimelineAsset obj  = (UnityEngine.Timeline.TimelineAsset)ToLua.CheckObject <UnityEngine.Timeline.TimelineAsset>(L, 1);
         UnityEngine.Timeline.TimelineClip  arg0 = (UnityEngine.Timeline.TimelineClip)ToLua.CheckObject <UnityEngine.Timeline.TimelineClip>(L, 2);
         bool o = obj.DeleteClip(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
        /// <summary>
        /// Constructs a Playable from a TimelineClip.
        /// </summary>
        /// <param name="graph">PlayableGraph that will own the playable.</param>
        /// <param name="gameObject">The GameObject that builds the PlayableGraph.</param>
        /// <param name="clip">The TimelineClip to construct a playable for.</param>
        /// <returns>A playable that will be set as an input to the Track Mixer playable, or Playable.Null if the clip does not have a valid PlayableAsset</returns>
        /// <exception cref="ArgumentException">Thrown if the specified PlayableGraph is not valid.</exception>
        /// <exception cref="ArgumentNullException">Thrown if the specified TimelineClip is not valid.</exception>
        /// <remarks>
        /// By default, this method invokes Playable.CreatePlayable, sets animated properties, and sets the speed of the created playable. Override this method to change this default implementation.
        /// </remarks>
        protected virtual Playable CreatePlayable(PlayableGraph graph, GameObject gameObject, TimelineClip clip)
        {
            if (!graph.IsValid())
            {
                throw new ArgumentException("graph must be a valid PlayableGraph");
            }
            if (clip == null)
            {
                throw new ArgumentNullException("clip");
            }

            var asset = clip.asset as IPlayableAsset;

            if (asset != null)
            {
                var handle = asset.CreatePlayable(graph, gameObject);
                if (handle.IsValid())
                {
                    handle.SetAnimatedProperties(clip.curves);
                    handle.SetSpeed(clip.timeScale);
                    if (OnClipPlayableCreate != null)
                    {
                        OnClipPlayableCreate(clip, gameObject, handle);
                    }
                }
                return(handle);
            }
            return(Playable.Null);
        }
 /// <summary>
 /// Called when a clip is created on a track.
 /// </summary>
 /// <param name="clip">The timeline clip added to this track</param>
 /// <remarks>Use this method to set default values on a timeline clip, or it's PlayableAsset.</remarks>
 protected virtual void OnCreateClip(TimelineClip clip)
 {
 }
 internal void RemoveClip(TimelineClip clip)
 {
     m_Clips.Remove(clip);
     m_ClipsCache = null;
 }
Example #5
0
        protected override Playable CreatePlayable(PlayableGraph graph, GameObject go, TimelineClip clip)
        {
            PlayableDirector timeline = go.GetComponent <PlayableDirector>();
            ScriptPlayable <MidiEventPlayableBehaviour> playable = ScriptPlayable <MidiEventPlayableBehaviour> .Create(graph);

            MidiEventPlayableBehaviour behaviour = playable.GetBehaviour();

            // Assign the VideoPlayer (that is binded the track) to VideoPlayableBehaviour.
            MidiEventPlayer player = timeline.GetGenericBinding(this) as MidiEventPlayer;

            behaviour.player = player;

            // Assign VideoClip to VideoPlayableBehaviour.
            MidiEventPlayable midiPlayable = clip.asset as MidiEventPlayable;

            behaviour.clip  = midiPlayable.clip;           //midiPlayable.clip.Resolve( graph.GetResolver() );
            behaviour.tempo = midiPlayable.tempo;

            return(playable);
        }
 public RuntimeClip(TimelineClip clip, Playable clipPlayable, Playable parentMixer)
 {
     this.Create(clip, clipPlayable, parentMixer);
 }