예제 #1
0
//----------------------------------------------------------------------------------------------------------------------

        internal static void LockAndEditPlayableFrame(SISPlayableFrame playableFrame,
                                                      RenderCachePlayableAsset renderCachePlayableAsset)
        {
            int    index    = playableFrame.GetIndex();
            string filePath = renderCachePlayableAsset.GetImageFilePath(index);

            if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
            {
                EditorUtility.DisplayDialog(StreamingImageSequenceConstants.DIALOG_HEADER,
                                            "Please update RenderCachePlayableAsset.",
                                            "Ok");
                return;
            }

            string fullPath = Path.GetFullPath(filePath);

            playableFrame.SetLocked(true);
            string imageAppPath = EditorPrefs.GetString("kImagesDefaultApp");

            if (string.IsNullOrEmpty(imageAppPath) || !File.Exists(imageAppPath))
            {
                System.Diagnostics.Process.Start(fullPath);
                return;
            }

            System.Diagnostics.Process.Start(imageAppPath, fullPath);
        }
//----------------------------------------------------------------------------------------------------------------------

        internal static void LockAndEditPlayableFrame(SISPlayableFrame playableFrame,
                                                      RenderCachePlayableAsset renderCachePlayableAsset)
        {
            int    index    = playableFrame.GetIndex();
            string filePath = renderCachePlayableAsset.GetImageFilePath(index);

            if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
            {
                EditorUtility.DisplayDialog(StreamingImageSequenceConstants.DIALOG_HEADER,
                                            "Please update RenderCachePlayableAsset.",
                                            "Ok");
                return;
            }

            playableFrame.SetLocked(true);
            LaunchImageApplicationExternalTool(Path.GetFullPath(filePath));
        }
        internal static void EditPlayableFrame(SISPlayableFrame playableFrame,
                                               StreamingImageSequencePlayableAsset sisPlayableAsset)
        {
            //Find the correct imageIndex. The number of frames in the clip may be more/less than the number of images
            int playableFrameIndex = playableFrame.GetIndex();
            int numPlayableFrames  = sisPlayableAsset.GetBoundClipData().GetNumPlayableFrames();

            int numImages = sisPlayableAsset.GetNumImages();
            int index     = Mathf.FloorToInt(playableFrameIndex * ((float)numImages / numPlayableFrames));

            string filePath = sisPlayableAsset.GetImageFilePath(index);

            if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
            {
                EditorUtility.DisplayDialog(StreamingImageSequenceConstants.DIALOG_HEADER,
                                            "Image does not exist: " + filePath,
                                            "Ok");
                return;
            }

            LaunchImageApplicationExternalTool(Path.GetFullPath(filePath));
        }