Exemple #1
0
//----------------------------------------------------------------------------------------------------------------------    
    /// <inheritdoc/>
    public override void OnCreate(TimelineClip clip, TrackAsset track, TimelineClip clonedFrom) {
        
        SceneCachePlayableAsset asset = clip.asset as SceneCachePlayableAsset;
        if (null == asset) {
            Debug.LogError("[MeshSync] Asset is not a SceneCachePlayableAsset: " + clip.asset);
            return;
        }
        
        SceneCachePlayerConfig config = MeshSyncProjectSettings.GetOrCreateSettings().GetDefaultSceneCachePlayerConfig();        
        asset.SetSnapToFrame((SnapToFrame) config.TimelineSnapToFrame);

        //OnCreate() is called before the clip is assigned to the track, but we need the track for creating curves.
        clip.TryMoveToTrack(track);
                       
    }
Exemple #2
0
//----------------------------------------------------------------------------------------------------------------------    
    /// <inheritdoc/>
    public override void OnCreate(TimelineClip clip, TrackAsset track, TimelineClip clonedFrom) {
        
        SceneCachePlayableAsset asset = clip.asset as SceneCachePlayableAsset;
        if (null == asset) {
            Debug.LogError("[MeshSync] Asset is not a SceneCachePlayableAsset: " + clip.asset);
            return;
        }

        //OnCreate() is called before the clip is assigned to the track, but we need the track for creating curves.
        clip.TryMoveToTrack(track);
                       
        //If the clip already has curves (because of cloning, etc), then we don't set anything
        if (null == clip.curves) {
            CreateClipCurve(clip);
        }        
    }
Exemple #3
0
//----------------------------------------------------------------------------------------------------------------------    
    /// <inheritdoc/>
    public override void OnCreate(TimelineClip clip, TrackAsset track, TimelineClip clonedFrom) {
                
        SceneCachePlayableAsset asset = clip.asset as SceneCachePlayableAsset;
        if (null == asset) {
            Debug.LogError("[MeshSync] Asset is not a SceneCachePlayableAsset: " + clip.asset);
            return;
        }
        
        //Track can be null during copy and paste
        if (null != track) {
            //This callback occurs before the clip is assigned to the track, but we need the track for creating curves.
            clip.TryMoveToTrack(track);
        }

        asset.Init(updateClipDurationOnCreatePlayable: null == clonedFrom);
    }
Exemple #4
0
//----------------------------------------------------------------------------------------------------------------------

        /// <inheritdoc/>
        public override void OnCreate(TimelineClip clip, TrackAsset track, TimelineClip clonedFrom)
        {
            StreamingImageSequencePlayableAsset asset = clip.asset as StreamingImageSequencePlayableAsset;

            if (null == asset)
            {
                Debug.LogError("Asset is not a StreamingImageSequencePlayableAsset: " + clip.asset);
                return;
            }

            //[Note-sin: 2021-2-25] Track can be null during copy and paste
            if (null != track)
            {
                //This callback occurs before the clip is assigned to the track, but we need the track for creating curves.
                clip.TryMoveToTrack(track);
            }

            //If we have a default asset, and clonedFrom is NULL, which means this is created by user interaction,
            //such as Folder D&D
            UnityEditor.DefaultAsset timelineDefaultAsset = asset.GetTimelineDefaultAsset();
            if (null != timelineDefaultAsset && null == clonedFrom)
            {
                InitializeAssetFromDefaultAsset(asset, timelineDefaultAsset);
            }

            //If the clip already has curves (because of cloning, etc), then we don't set anything
            if (null == clip.curves)
            {
                int numImages = asset.GetNumImages();
                if (numImages > 0)
                {
                    SISUserSettings userSettings = SISUserSettings.GetInstance();

                    clip.duration    = (double)(numImages) / (userSettings.GetDefaultSISPlayableAssetFPS());
                    clip.displayName = Path.GetFileName(asset.GetFolder());
                }

                ExtendedClipEditorUtility.CreateTimelineClipCurve(clip, StreamingImageSequencePlayableAsset.GetTimeCurveBinding());
            }

            if (null == clonedFrom)
            {
                asset.BindClipData(new SISClipData(clip));
                return;
            }

            //Duplicate/Split process
            StreamingImageSequencePlayableAsset clonedFromAsset = clonedFrom.asset as StreamingImageSequencePlayableAsset;

            Assert.IsNotNull(clonedFromAsset);

            SISClipData otherSISData = clonedFromAsset.GetBoundClipData();

            if (null == otherSISData)
            {
                asset.BindClipData(new SISClipData(clip)); //[Note-sin: 2021-2-25] can be null during copy and paste
                return;
            }

            SISClipData sisData = new SISClipData(clip, otherSISData);

            asset.BindClipData(sisData);
            clip.displayName = clonedFrom.displayName + " (Cloned)";
        }