Пример #1
0
        /// <summary>
        /// Sets the video clip to edit,
        /// Sets the importer,
        /// Caches the video clip length
        /// Caches the user data in a serialized property
        /// Initializes the editor video clip events
        /// </summary>
        private static void Initialize()
        {
            Current.wantsMouseMove = true;
            Current.editingClip    = (Selection.activeObject as VideoClip);
            if (Current.editingClip == null)
            {
                var videoPlayer = FindObjectOfType <VideoPlayer>();
                Current.editingClip = videoPlayer.clip;
                if (Current.editingClip == null)
                {
                    Debug.LogError("No clip selected");
                    return;
                }
            }
            Current.importer          = (VideoClipImporter)AssetImporter.GetAtPath(Current.editingClip.originalPath);
            Current.videoClipImporter = new SerializedObject(Current.importer);
            Current.TotalVideoTime    = Current.importer.frameCount / Current.importer.frameRate;

            string userData = Current.importer.userData;

            Current.videoClipEvents       = VideoClipEvents.JSONToObject(userData);
            Current.editorVideoClipEvents = new EditorVideoClipEvents(Current.videoClipEvents);
        }