Example #1
0
//----------------------------------------------------------------------------------------------------------------------

    private void DoFolderGUI() {
        string prevFolder = m_asset.GetFolder();
        string newLoadPath = InspectorUtility.ShowFolderSelectorGUI("Image Sequence", "Select Folder", 
            prevFolder,
            AssetEditorUtility.NormalizeAssetPath
        );        
        
        if (newLoadPath != prevFolder) {
            ImportImages(newLoadPath);
            GUIUtility.ExitGUI();
        }

    }
//----------------------------------------------------------------------------------------------------------------------
        public override void OnInspectorGUI()
        {
            //View resolution
            Vector2 res = ViewEditorUtility.GetMainGameViewSize();

            EditorGUILayout.LabelField("Resolution (Modify GameView size to change)");
            ++EditorGUI.indentLevel;
            EditorGUILayout.LabelField("Width", res.x.ToString(CultureInfo.InvariantCulture));
            EditorGUILayout.LabelField("Height", res.y.ToString(CultureInfo.InvariantCulture));
            --EditorGUI.indentLevel;
            EditorGUILayout.Space(15f);

            //Check if the asset is actually inspected
            if (null != TimelineEditor.selectedClip && TimelineEditor.selectedClip.asset != m_asset)
            {
                return;
            }

            ValidateAssetFolder();

            string prevFolder = m_asset.GetFolder();

            string newFolder = InspectorUtility.ShowFolderSelectorGUI("Cache Output Folder", "Select Folder",
                                                                      prevFolder,
                                                                      AssetEditorUtility.NormalizeAssetPath
                                                                      );

            if (newFolder != prevFolder)
            {
                m_asset.SetFolder(AssetEditorUtility.NormalizeAssetPath(newFolder));
                GUIUtility.ExitGUI();
            }

            TimelineClipSISData timelineClipSISData = m_asset.GetBoundTimelineClipSISData();

            if (null == timelineClipSISData)
            {
                return;
            }

            GUILayout.Space(15);

            //Capture Selected Frames
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                ShowCaptureSelectedFramesGUI(TimelineEditor.selectedClip, timelineClipSISData);
                ShowLockFramesGUI(TimelineEditor.selectedClip, timelineClipSISData);
            }

            ShortcutBinding updateRenderCacheShortcut
                = ShortcutManager.instance.GetShortcutBinding(SISEditorConstants.SHORTCUT_UPDATE_RENDER_CACHE);

            GUILayout.Space(15);
            if (GUILayout.Button($"Update Render Cache ({updateRenderCacheShortcut})"))
            {
                PlayableDirector director = TimelineEditor.inspectedDirector;
                if (null == director)
                {
                    EditorUtility.DisplayDialog("Streaming Image Sequence",
                                                "PlayableAsset is not loaded in scene. Please load the correct scene before doing this operation.",
                                                "Ok");
                    return;
                }

                //Loop time
                EditorCoroutineUtility.StartCoroutine(UpdateRenderCacheCoroutine(director, m_asset), this);
            }
        }