Пример #1
0
        private void ShowAddProcessorMenu(ReorderableList list)
        {
            if (m_ProcessorDataProvider == null)
            {
                m_ProcessorDataProvider = new ProcessorDataProvider(m_processorStack, m_CurrentAsset);
            }

            FilterPopupWindow.Show(Event.current.mousePosition, m_ProcessorDataProvider);
        }
Пример #2
0
        public void LoadAsset(ImageSequence asset)
        {
            m_CurrentAsset = asset;

            m_InputFramesReorderableList = null;
            m_ProcessorsReorderableList  = null;
            m_LockedPreviewProcessor     = null;
            m_CurrentProcessor           = null;

            // Free resources if any
            if (m_processorStack != null)
            {
                m_processorStack.Dispose();
            }

            InitializeGUI();

            if (m_CurrentAsset != null)
            {
                m_processorStack = new FrameProcessorStack(new ProcessingFrameSequence(null), this);

                m_CurrentAssetSerializedObject = new SerializedObject(m_CurrentAsset);

                VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Loading asset....", 0.0f);

                m_LockedPreviewProcessor = null;

                VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Loading Frames", 0.333333f);

                m_processorStack.LoadFramesFromAsset(m_CurrentAsset);
                UpdateInputTexturesHash();

                m_InputFramesReorderableList = new ReorderableList(m_processorStack.inputSequence.frames, typeof(Texture2D), true, false, true, true);
                m_InputFramesReorderableList.onAddCallback       = AddInputFrame;
                m_InputFramesReorderableList.onRemoveCallback    = RemoveInputFrame;
                m_InputFramesReorderableList.onReorderCallback   = ReorderInputFrame;
                m_InputFramesReorderableList.drawElementCallback = DrawInputFrameRListElement;
                m_InputFramesReorderableList.onSelectCallback    = SelectInputFrameRListElement;

                VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Loading Processors", 0.66666f);

                ImageSequence inheritedSettingReference = m_CurrentAsset;

                // Loading other settings if inheriting settings
                if (m_CurrentAsset.inheritSettingsReference != null)
                {
                    var dependencyList = new List <ImageSequence>();
                    var referenceAsset = FindSettingsReference(m_CurrentAsset.inheritSettingsReference, ref dependencyList);
                    if (referenceAsset == null)
                    {
                        Debug.LogWarning("Dependency Loop detected, ignoring using external settings");
                        m_IgnoreInheritSettings = true;
                    }
                    else
                    {
                        inheritedSettingReference = referenceAsset;
                        m_IgnoreInheritSettings   = false;
                    }
                }

                m_processorStack.LoadProcessorsFromAsset(inheritedSettingReference);
                m_ProcessorDataProvider = new ProcessorDataProvider(m_processorStack, m_CurrentAsset);

                // Construct the RList
                if (m_CurrentAsset.inheritSettingsReference == null)
                {
                    m_ProcessorsReorderableList = new ReorderableList(m_CurrentAssetSerializedObject, m_CurrentAssetSerializedObject.FindProperty("processorInfos"), true, false, true, true);
                    m_ProcessorsReorderableList.onAddCallback       = ShowAddProcessorMenu;
                    m_ProcessorsReorderableList.onRemoveCallback    = MenuRemoveProcessor;
                    m_ProcessorsReorderableList.onReorderCallback   = ReorderProcessor;
                    m_ProcessorsReorderableList.onSelectCallback    = MenuSelectProcessor;
                    m_ProcessorsReorderableList.drawElementCallback = DrawRListProcessorElement;
                    m_SettingsReferenceSerializedObject             = null;
                }
                else
                {
                    m_SettingsReferenceSerializedObject             = new SerializedObject(inheritedSettingReference);
                    m_ProcessorsReorderableList                     = new ReorderableList(m_SettingsReferenceSerializedObject, m_SettingsReferenceSerializedObject.FindProperty("processorInfos"), false, false, false, false);
                    m_ProcessorsReorderableList.drawElementCallback = DrawRListPreviewProcessorElement;
                    m_ProcessorsReorderableList.onSelectCallback    = MenuSelectProcessor;
                }

                m_PreviewCanvas.sequence = m_processorStack.inputSequence;
                if (m_PreviewCanvas.sequence.length > 0)
                {
                    m_PreviewCanvas.currentFrameIndex = 0;
                }
                else
                {
                    m_PreviewCanvas.currentFrameIndex = -1;
                }

                VFXToolboxGUIUtility.DisplayProgressBar("Image Sequencer", "Finalizing...", 1.0f);

                m_processorStack.InvalidateAll();
                RestoreProcessorView();

                EditorUtility.ClearProgressBar();
            }
        }