コード例 #1
0
        public static void Open()
        {
            _instance = GetWindow <FInspectorWindow>();

            _instance.Show();
            _instance.titleContent = new GUIContent("参数面板");
        }
コード例 #2
0
        public void OnUndo()
        {
            _editorCache.Refresh();

            FInspectorWindow.SetEvents(_selectedEvents);
            FInspectorWindow.SetTracks(_selectedTracks);
        }
コード例 #3
0
        void OnEnable()
        {
            _instance = this;

            hideFlags = HideFlags.DontSave;

            EditorApplication.playmodeStateChanged += OnPlaymodeChanged;
        }
コード例 #4
0
        void OnEnable()
        {
            _instance = this;

            hideFlags = HideFlags.DontSave;

            wantsMouseMove = true;

            autoRepaintOnSceneChange = true;
        }
コード例 #5
0
        public static void Open()
        {
            _instance = GetWindow <FInspectorWindow>();

            _instance.Show();
#if UNITY_5_0
            _instance.title = "Flux Inspector";
#else
            _instance.titleContent = new GUIContent("Flux Inspector");
#endif
        }
コード例 #6
0
        private void DeselectEvent(FEventEditor eventEditor)
        {
            if (eventEditor == null || !eventEditor.IsSelected())
            {
                return;
            }

            Undo.RegisterCompleteObjectUndo(new Object[] { eventEditor, this }, "deselect Event");

            _selectedEvents.Remove(eventEditor);
            FInspectorWindow.SetEvents(_selectedEvents);

            eventEditor.OnDeselect();
        }
コード例 #7
0
        private void SelectTrack(FTrackEditor trackEditor)
        {
            if (trackEditor == null || trackEditor.IsSelected())
            {
                return;
            }

            Undo.RegisterCompleteObjectUndo(new Object[] { trackEditor, this }, "select Track");

            _selectedTracks.Add(trackEditor);
            trackEditor.OnSelect();

            FInspectorWindow.SetTracks(_selectedTracks);
        }
コード例 #8
0
        private void SelectEvent(FEventEditor eventEditor)
        {
            if (eventEditor == null || eventEditor.IsSelected())
            {
                return;
            }

            SelectTrack(eventEditor._trackEditor);
            Undo.RegisterCompleteObjectUndo(new Object[] { eventEditor, this }, "select Event");

            _selectedEvents.Add(eventEditor);
            FInspectorWindow.SetEvents(_selectedEvents);

            eventEditor.OnSelect();
        }
コード例 #9
0
        private void DeselectAll()
        {
            int numEvents = _selectedEvents.Count;
            int numTracks = _selectedTracks.Count;

            int totalSelected = numEvents + numTracks;

            if (totalSelected == 0)
            {
                return;
            }

            // tracks + events + window
            Object[] objsToSave = new Object[totalSelected + 1];

            int i = 0;

            for (int j = 0; j != numEvents; ++i, ++j)
            {
                objsToSave[i] = _selectedEvents[j];
            }

            for (int j = 0; j != numTracks; ++i, ++j)
            {
                objsToSave[i] = _selectedTracks[j];
            }

            objsToSave[totalSelected] = this;

            Undo.RegisterCompleteObjectUndo(objsToSave, "deselect all");

            for (int j = 0; j != numEvents; ++j)
            {
                _selectedEvents[j].OnDeselect();
            }

            for (int j = 0; j != numTracks; ++j)
            {
                _selectedTracks[j].OnDeselect();
            }

            _selectedEvents.Clear();
            _selectedTracks.Clear();

            FInspectorWindow.SetEvents(null);
            FInspectorWindow.SetTracks(null);
        }
コード例 #10
0
        public void OnGUI()
        {
            FSequence sequence = _sequenceWindow.GetSequenceEditor().Sequence;

            if ((_selectedSequenceIndex < 0 && sequence != null) || (_selectedSequenceIndex >= 0 && _sequences[_selectedSequenceIndex] != sequence))
            {
                for (int i = 0; i != _sequences.Length; ++i)
                {
                    if (_sequences[i] == sequence)
                    {
                        _selectedSequenceIndex = i;
                        break;
                    }
                }
            }


            if (Event.current.type == EventType.MouseDown && Event.current.alt && _sequencePopupRect.Contains(Event.current.mousePosition))
            {
                Selection.activeObject = sequence;
                Event.current.Use();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUI.PrefixLabel(_sequenceLabelRect, _sequenceLabel);
            int newSequenceIndex = EditorGUI.Popup(_sequencePopupRect, _selectedSequenceIndex, _sequenceNames);

            if (EditorGUI.EndChangeCheck())
            {
                if (newSequenceIndex == _sequenceNames.Length - 1)
                {
                    FSequence newSequence = FSequenceEditorWindow.CreateSequence();
                    Selection.activeTransform = newSequence.transform;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(newSequence);
                }
                else
                {
                    _selectedSequenceIndex = newSequenceIndex;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(_sequences[_selectedSequenceIndex]);
                    _sequenceWindow.RemoveNotification();
                }
                EditorGUIUtility.keyboardControl = 0; // deselect it
                EditorGUIUtility.ExitGUI();
            }

            // if we're in play mode, can't change anything
            if (Application.isPlaying)
            {
                GUI.enabled = false;
            }

            if (sequence == null)
            {
                return;
            }

            if (_sequenceSO == null || _sequenceSO.targetObject != sequence)
            {
                _sequenceSO          = new SerializedObject(sequence);
                _sequenceExecuteTime = _sequenceSO.FindProperty("_executeTime");
                _sequenceUpdateMode  = _sequenceSO.FindProperty("_updateMode");
                _sequenceLength      = _sequenceSO.FindProperty("_length");
            }

            _sequenceSO.Update();

            if (_showExecuteTime)
            {
                EditorGUI.PrefixLabel(_executeTimeLabelRect, _executeTimeLabel);
                //EditorGUI.PropertyField(_executeTimeFieldRect, _sequenceExecuteTime, _numberFieldStyle);
                _sequenceExecuteTime.intValue = EditorGUI.IntField(_executeTimeFieldRect, _sequenceExecuteTime.intValue, _numberFieldStyle);
            }

            if (_showUpdadeMode)
            {
                EditorGUI.PrefixLabel(_updateModeLabelRect, _updateModeLabel);
                EditorGUI.PropertyField(_updateModeFieldRect, _sequenceUpdateMode, GUIContent.none);
            }

            if (_showFramerate)
            {
                EditorGUI.PrefixLabel(_framerateLabelRect, _framerateLabel);
                EditorGUI.BeginChangeCheck();
                int newFrameRate = FGUI.FrameRatePopup(_framerateFieldRect, sequence.FrameRate);
                if (EditorGUI.EndChangeCheck())
                {
                    if (newFrameRate == -1)
                    {
                        FChangeFrameRateWindow.Show(new Vector2(_framerateLabelRect.xMin, _framerateLabelRect.yMax), sequence, FSequenceInspector.Rescale);
                    }
                    else
                    {
                        FSequenceInspector.Rescale(sequence, newFrameRate, true);
                    }
                }
            }

            if (_showLength)
            {
                EditorGUI.PrefixLabel(_lengthLabelRect, _lengthLabel);
                _sequenceLength.intValue = Mathf.Clamp(EditorGUI.IntField(_lengthFieldRect, _sequenceLength.intValue, _numberFieldStyle), 1, int.MaxValue);
            }

            GUIStyle s = new GUIStyle(EditorStyles.miniButton);

            s.padding = new RectOffset(1, 1, 1, 1);

            if (_showAddContainer)
            {
                if (FGUI.Button(_addContainerRect, _addContainerLabel))
                {
                    AddContainer();
                }
            }

            if (FGUI.Button(_openInspectorRect, _openInspectorLabel))
            {
                FInspectorWindow.Open();
            }

            _sequenceSO.ApplyModifiedProperties();

            GUI.enabled = true;
        }
コード例 #11
0
        public void OnGUI()
        {
            FSequence sequence = _sequenceWindow.GetSequenceEditor().Sequence;

            if ((_selectedSequenceIndex < 0 && sequence != null) || (_selectedSequenceIndex >= 0 && _sequences[_selectedSequenceIndex] != sequence))
            {
                for (int i = 0; i != _sequences.Length; ++i)
                {
                    if (_sequences[i] == sequence)
                    {
                        _selectedSequenceIndex = i;
                        break;
                    }
                }
            }
            if (FGUI.Button(_loadRect, _loadLabel))
            {
                LoadSequence();
            }
            EditorGUI.BeginChangeCheck();
            EditorGUI.PrefixLabel(_sequenceLabelRect, _sequenceLabel);
            int newSequenceIndex = EditorGUI.Popup(_sequencePopupRect, _selectedSequenceIndex, _sequenceNames);

            if (EditorGUI.EndChangeCheck())
            {
                if (newSequenceIndex == _sequenceNames.Length - 1)
                {
                    FSequence newSequence = FSequenceEditorWindow.CreateSequence();
                    Selection.activeTransform = newSequence.transform;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(newSequence);
                }
                else
                {
                    _selectedSequenceIndex = newSequenceIndex;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(_sequences[_selectedSequenceIndex]);
                    _sequenceWindow.RemoveNotification();
                }
                EditorGUIUtility.keyboardControl = 0; // deselect it
                EditorGUIUtility.ExitGUI();
            }

            if (sequence == null)
            {
                return;
            }

            if (_sequenceSO == null || _sequenceSO.targetObject != sequence)
            {
                _sequenceSO     = new SerializedObject(sequence);
                _sequenceLength = _sequenceSO.FindProperty("_length");
            }
            _sequenceSO.Update();

            EditorGUI.PrefixLabel(_lengthLabelRect, _lengthLabel);
            _sequenceLength.intValue = Mathf.Clamp(EditorGUI.IntField(_lengthFieldRect, _sequenceLength.intValue, _numberFieldStyle), 1, int.MaxValue);

            GUIStyle s = new GUIStyle(EditorStyles.miniButton);

            s.padding = new RectOffset(1, 1, 1, 1);

            if (FGUI.Button(_addContainerRect, _addContainerLabel))
            {
                AddContainer();
            }

            if (FGUI.Button(_openInspectorRect, _openInspectorLabel))
            {
                FInspectorWindow.Open();
            }
            if (FGUI.Button(_saveRect, _saveLabel))
            {
                Save(sequence);
            }
            if (FGUI.Button(_saveAllRect, _saveAllLabel))
            {
                SaveAll();
            }

            _sequenceSO.ApplyModifiedProperties();

            GUI.enabled = true;
        }