Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AnimationTimeline"/> class.
        /// </summary>
        /// <param name="undo">The undo/redo to use for the history actions recording. Optional, can be null to disable undo support.</param>
        public AnimationTimeline(FlaxEditor.Undo undo)
            : base(PlaybackButtons.None, undo, false, false)
        {
            PlaybackState        = PlaybackStates.Seeking;
            ShowPreviewValues    = false;
            PropertiesEditObject = new Proxy(this);

            // Setup track types
            TrackArchetypes.Add(AnimationChannelTrack.GetArchetype());
            TrackArchetypes.Add(AnimationChannelDataTrack.GetArchetype());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParticleSystemTimeline"/> class.
        /// </summary>
        /// <param name="preview">The particle system preview.</param>
        /// <param name="undo">The undo/redo to use for the history actions recording. Optional, can be null to disable undo support.</param>
        public ParticleSystemTimeline(ParticleSystemPreview preview, FlaxEditor.Undo undo = null)
            : base(PlaybackButtons.Play | PlaybackButtons.Stop, undo)
        {
            PlaybackState        = PlaybackStates.Playing;
            PropertiesEditObject = new Proxy(this);

            _preview = preview;

            // Setup track types
            TrackArchetypes.Add(ParticleEmitterTrack.GetArchetype());
            TrackArchetypes.Add(FolderTrack.GetArchetype());
        }
Exemplo n.º 3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Tab"/> class.
            /// </summary>
            /// <param name="text">The tab title text.</param>
            /// <param name="undo">The undo to use for the editing.</param>
            public Tab(string text, FlaxEditor.Undo undo = null)
                : base(text)
            {
                var scrollPanel = new Panel(ScrollBars.Vertical)
                {
                    AnchorPreset = AnchorPresets.StretchAll,
                    Offsets      = Margin.Zero,
                    Parent       = this
                };

                Presenter = new CustomEditorPresenter(undo);
                Presenter.Panel.Parent = scrollPanel;
            }
Exemplo n.º 4
0
        /// <inheritdoc />
        public AnimGraphSurface(IVisjectSurfaceOwner owner, Action onSave, FlaxEditor.Undo undo)
            : base(owner, onSave, undo, CreateStyle())
        {
            // Find custom nodes for Anim Graph
            var customNodes = Editor.Instance.CodeEditing.AnimGraphNodes.GetArchetypes();

            if (customNodes != null && customNodes.Count > 0)
            {
                AddCustomNodes(customNodes);

                // Check if any of the nodes comes from the game scripts - those can be reloaded at runtime so prevent crashes
                if (Editor.Instance.CodeEditing.AnimGraphNodes.HasTypeFromGameScripts)
                {
                    _isRegisteredForScriptsReload      = true;
                    ScriptsBuilder.ScriptsReloadBegin += OnScriptsReloadBegin;
                }
            }
        }
Exemplo n.º 5
0
 /// <inheritdoc />
 public ParticleEmitterSurface(IVisjectSurfaceOwner owner, Action onSave, FlaxEditor.Undo undo)
     : base(owner, onSave, undo)
 {
 }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VisjectSurfaceWindow{TAsset, TSurface, TPreview}"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="item">The item.</param>
        /// <param name="useTabs">if set to <c>true</c> [use tabs].</param>
        protected VisjectSurfaceWindow(Editor editor, AssetItem item, bool useTabs = false)
            : base(editor, item)
        {
            // Undo
            _undo             = new FlaxEditor.Undo();
            _undo.UndoDone   += OnUndoRedo;
            _undo.RedoDone   += OnUndoRedo;
            _undo.ActionDone += OnUndoRedo;

            // Split Panel 1
            _split1 = new SplitPanel(Orientation.Horizontal, ScrollBars.None, ScrollBars.None)
            {
                AnchorPreset  = AnchorPresets.StretchAll,
                Offsets       = new Margin(0, 0, _toolstrip.Bottom, 0),
                SplitterValue = 0.7f,
                Parent        = this
            };

            // Split Panel 2
            _split2 = new SplitPanel(Orientation.Vertical, ScrollBars.None, ScrollBars.Vertical)
            {
                AnchorPreset  = AnchorPresets.StretchAll,
                Offsets       = Margin.Zero,
                SplitterValue = 0.4f,
                Parent        = _split1.Panel2
            };

            // Properties editor
            if (useTabs)
            {
                _tabs = new Tabs
                {
                    AnchorPreset = AnchorPresets.StretchAll,
                    Offsets      = Margin.Zero,
                    TabsSize     = new Vector2(60, 20),
                    TabsTextHorizontalAlignment = TextAlignment.Center,
                    UseScroll = true,
                    Parent    = _split2.Panel2
                };
                var propertiesTab = new Tab("Properties", _undo);
                _propertiesEditor = propertiesTab.Presenter;
                _tabs.AddTab(propertiesTab);
            }
            else
            {
                _propertiesEditor = new CustomEditorPresenter(_undo);
                _propertiesEditor.Panel.Parent = _split2.Panel2;
            }
            _propertiesEditor.Modified += OnPropertyEdited;

            // Toolstrip
            _saveButton = (ToolStripButton)_toolstrip.AddButton(Editor.Icons.Save64, Save).LinkTooltip("Save");
            _toolstrip.AddSeparator();
            _undoButton = (ToolStripButton)_toolstrip.AddButton(Editor.Icons.Undo64, _undo.PerformUndo).LinkTooltip("Undo (Ctrl+Z)");
            _redoButton = (ToolStripButton)_toolstrip.AddButton(Editor.Icons.Redo64, _undo.PerformRedo).LinkTooltip("Redo (Ctrl+Y)");
            _toolstrip.AddSeparator();
            _toolstrip.AddButton(editor.Icons.CenterView64, ShowWholeGraph).LinkTooltip("Show whole graph");

            // Setup input actions
            InputActions.Add(options => options.Undo, _undo.PerformUndo);
            InputActions.Add(options => options.Redo, _undo.PerformRedo);
        }
Exemplo n.º 7
0
 /// <inheritdoc />
 public VisualScriptSurface(IVisjectSurfaceOwner owner, Action onSave, FlaxEditor.Undo undo)
     : base(owner, onSave, undo, null, null, true)
 {
     _supportsImplicitCastFromObjectToBoolean = true;
     DragHandlers.Add(_dragActors             = new DragActors(ValidateDragActor));
 }
Exemplo n.º 8
0
 /// <inheritdoc />
 public AnimationGraphFunctionSurface(IVisjectSurfaceOwner owner, Action onSave, FlaxEditor.Undo undo)
     : base(owner, onSave, undo)
 {
 }
Exemplo n.º 9
0
 /// <inheritdoc />
 public MaterialSurface(IVisjectSurfaceOwner owner, Action onSave, FlaxEditor.Undo undo)
     : base(owner, onSave, undo)
 {
 }