示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AnimationPreview"/> class.
        /// </summary>
        /// <param name="useWidgets">if set to <c>true</c> use widgets.</param>
        public AnimationPreview(bool useWidgets)
            : base(useWidgets)
        {
            PlayAnimation         = true;
            PlayAnimationChanged += OnPlayAnimationChanged;

            // Playback Speed
            {
                var playbackSpeed      = ViewWidgetButtonMenu.AddButton("Playback Speed");
                var playbackSpeedValue = new FloatValueBox(-1, 90, 2, 70.0f, 0.0f, 10000.0f, 0.001f)
                {
                    Parent = playbackSpeed
                };
                playbackSpeedValue.ValueChanged     += () => PlaySpeed = playbackSpeedValue.Value;
                ViewWidgetButtonMenu.VisibleChanged += control => playbackSpeedValue.Value = PlaySpeed;
            }

            // Play/Pause widget
            {
                var playPauseWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
                _playPauseButton = new ViewportWidgetButton(null, Editor.Instance.Icons.Pause64)
                {
                    TooltipText = "Animation playback play (F5) or pause (F6)",
                    Parent      = playPauseWidget,
                };
                _playPauseButton.Clicked += button => PlayAnimation = !PlayAnimation;
                playPauseWidget.Parent    = this;
            }

            // Enable shadows
            PreviewLight.ShadowsMode     = ShadowsCastingMode.All;
            PreviewLight.CascadeCount    = 2;
            PreviewLight.ShadowsDistance = 1000.0f;
            Task.ViewFlags |= ViewFlags.Shadows;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PrefabWindowViewport"/> class.
        /// </summary>
        /// <param name="window">Editor window.</param>
        public PrefabWindowViewport(PrefabWindow window)
            : base(true)
        {
            _window = window;
            _window.SelectionChanged += OnSelectionChanged;
            Undo           = window.Undo;
            ViewportCamera = new FPSCamera();

            // Prepare rendering task
            Task.ActorsSource = ActorsSources.CustomActors;
            Task.ViewFlags    = ViewFlags.DefaultEditor & ~ViewFlags.EditorSprites;
            Task.PostRender  += OnPostRender;

            // Create post effects
            SelectionOutline = FlaxEngine.Object.New <SelectionOutline>();
            SelectionOutline.SelectionGetter = () => TransformGizmo.SelectedParents;
            Task.CustomPostFx.Add(SelectionOutline);
            EditorPrimitives          = FlaxEngine.Object.New <EditorPrimitives>();
            EditorPrimitives.Viewport = this;
            Task.CustomPostFx.Add(EditorPrimitives);

            // Add transformation gizmo
            TransformGizmo = new TransformGizmo(this);
            TransformGizmo.ApplyTransformation += ApplyTransform;
            TransformGizmo.ModeChanged         += OnGizmoModeChanged;
            TransformGizmo.Duplicate           += _window.Duplicate;
            Gizmos.Active = TransformGizmo;

            // Transform space widget
            var transformSpaceWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var transformSpaceToggle = new ViewportWidgetButton(string.Empty, window.Editor.Icons.World16, null, true)
            {
                Checked     = TransformGizmo.ActiveTransformSpace == TransformGizmoBase.TransformSpace.World,
                TooltipText = "Gizmo transform space (world or local)",
                Parent      = transformSpaceWidget
            };

            transformSpaceToggle.Toggled += OnTransformSpaceToggle;
            transformSpaceWidget.Parent   = this;

            // Scale snapping widget
            var scaleSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableScaleSnapping = new ViewportWidgetButton(string.Empty, window.Editor.Icons.ScaleStep16, null, true)
            {
                Checked     = TransformGizmo.ScaleSnapEnabled,
                TooltipText = "Enable scale snapping",
                Parent      = scaleSnappingWidget
            };

            enableScaleSnapping.Toggled += OnScaleSnappingToggle;

            var scaleSnappingCM = new ContextMenu();

            _scaleSnapping = new ViewportWidgetButton(TransformGizmo.ScaleSnapValue.ToString(), SpriteHandle.Invalid, scaleSnappingCM)
            {
                TooltipText = "Scale snapping values"
            };

            for (int i = 0; i < EditorViewportScaleSnapValues.Length; i++)
            {
                var v      = EditorViewportScaleSnapValues[i];
                var button = scaleSnappingCM.AddButton(v.ToString());
                button.Tag = v;
            }
            scaleSnappingCM.ButtonClicked  += OnWidgetScaleSnapClick;
            scaleSnappingCM.VisibleChanged += OnWidgetScaleSnapShowHide;
            _scaleSnapping.Parent           = scaleSnappingWidget;
            scaleSnappingWidget.Parent      = this;

            // Rotation snapping widget
            var rotateSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableRotateSnapping = new ViewportWidgetButton(string.Empty, window.Editor.Icons.RotateStep16, null, true)
            {
                Checked     = TransformGizmo.RotationSnapEnabled,
                TooltipText = "Enable rotation snapping",
                Parent      = rotateSnappingWidget
            };

            enableRotateSnapping.Toggled += OnRotateSnappingToggle;

            var rotateSnappingCM = new ContextMenu();

            _rotateSnapping = new ViewportWidgetButton(TransformGizmo.RotationSnapValue.ToString(), SpriteHandle.Invalid, rotateSnappingCM)
            {
                TooltipText = "Rotation snapping values"
            };

            for (int i = 0; i < EditorViewportRotateSnapValues.Length; i++)
            {
                var v      = EditorViewportRotateSnapValues[i];
                var button = rotateSnappingCM.AddButton(v.ToString());
                button.Tag = v;
            }
            rotateSnappingCM.ButtonClicked  += OnWidgetRotateSnapClick;
            rotateSnappingCM.VisibleChanged += OnWidgetRotateSnapShowHide;
            _rotateSnapping.Parent           = rotateSnappingWidget;
            rotateSnappingWidget.Parent      = this;

            // Translation snapping widget
            var translateSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableTranslateSnapping = new ViewportWidgetButton(string.Empty, window.Editor.Icons.Grid16, null, true)
            {
                Checked     = TransformGizmo.TranslationSnapEnable,
                TooltipText = "Enable position snapping",
                Parent      = translateSnappingWidget
            };

            enableTranslateSnapping.Toggled += OnTranslateSnappingToggle;

            var translateSnappingCM = new ContextMenu();

            _translateSnappng = new ViewportWidgetButton(TransformGizmo.TranslationSnapValue.ToString(), SpriteHandle.Invalid, translateSnappingCM)
            {
                TooltipText = "Position snapping values"
            };

            for (int i = 0; i < EditorViewportTranslateSnapValues.Length; i++)
            {
                var v      = EditorViewportTranslateSnapValues[i];
                var button = translateSnappingCM.AddButton(v.ToString());
                button.Tag = v;
            }
            translateSnappingCM.ButtonClicked  += OnWidgetTranslateSnapClick;
            translateSnappingCM.VisibleChanged += OnWidgetTranslateSnapShowHide;
            _translateSnappng.Parent            = translateSnappingWidget;
            translateSnappingWidget.Parent      = this;

            // Gizmo mode widget
            var gizmoMode = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);

            _gizmoModeTranslate = new ViewportWidgetButton(string.Empty, window.Editor.Icons.Translate16, null, true)
            {
                Tag         = TransformGizmoBase.Mode.Translate,
                TooltipText = "Translate gizmo mode",
                Checked     = true,
                Parent      = gizmoMode
            };
            _gizmoModeTranslate.Toggled += OnGizmoModeToggle;
            _gizmoModeRotate             = new ViewportWidgetButton(string.Empty, window.Editor.Icons.Rotate16, null, true)
            {
                Tag         = TransformGizmoBase.Mode.Rotate,
                TooltipText = "Rotate gizmo mode",
                Parent      = gizmoMode
            };
            _gizmoModeRotate.Toggled += OnGizmoModeToggle;
            _gizmoModeScale           = new ViewportWidgetButton(string.Empty, window.Editor.Icons.Scale16, null, true)
            {
                Tag         = TransformGizmoBase.Mode.Scale,
                TooltipText = "Scale gizmo mode",
                Parent      = gizmoMode
            };
            _gizmoModeScale.Toggled += OnGizmoModeToggle;
            gizmoMode.Parent         = this;

            _dragHandlers.Add(_dragActorType);
            _dragHandlers.Add(_dragAssets);

            // Setup input actions
            InputActions.Add(options => options.TranslateMode, () => TransformGizmo.ActiveMode = TransformGizmoBase.Mode.Translate);
            InputActions.Add(options => options.RotateMode, () => TransformGizmo.ActiveMode    = TransformGizmoBase.Mode.Rotate);
            InputActions.Add(options => options.ScaleMode, () => TransformGizmo.ActiveMode     = TransformGizmoBase.Mode.Scale);
            InputActions.Add(options => options.FocusSelection, ShowSelectedActors);

            SetUpdate(ref _update, OnUpdate);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainEditorGizmoViewport"/> class.
        /// </summary>
        /// <param name="editor">Editor instance.</param>
        public MainEditorGizmoViewport(Editor editor)
            : base(FlaxEngine.Rendering.RenderTask.Create <SceneRenderTask>(), editor.Undo)
        {
            _editor = editor;

            // Prepare rendering task
            Task.ActorsSource = ActorsSources.ScenesAndCustomActors;
            Task.Flags        = ViewFlags.DefaultEditor;
            Task.Begin       += RenderTaskOnBegin;
            Task.Draw        += RenderTaskOnDraw;
            Task.End         += RenderTaskOnEnd;

            // Render task after the main game task so streaming and render state data will use main game task instead of editor preview
            Task.Order = 1;

            // Create post effects
            SelectionOutline = FlaxEngine.Object.New <SelectionOutline>();
            SelectionOutline.SelectionGetter = () => _editor.SceneEditing.Selection;
            Task.CustomPostFx.Add(SelectionOutline);
            EditorPrimitives = FlaxEngine.Object.New <EditorPrimitives>();
            EditorPrimitives.DrawDebugDraw = true;
            EditorPrimitives.Viewport      = this;
            Task.CustomPostFx.Add(EditorPrimitives);

            // Add transformation gizmo
            TransformGizmo = new TransformGizmo(this);
            TransformGizmo.OnApplyTransformation += ApplyTransform;
            TransformGizmo.ModeChanged           += OnGizmoModeChanged;
            TransformGizmo.Duplicate             += Editor.Instance.SceneEditing.Duplicate;
            Gizmos.Active = TransformGizmo;

            // Add grid
            Grid = new GridGizmo(this);
            Grid.EnabledChanged += gizmo => _showGridButton.Icon = gizmo.Enabled ? Style.Current.CheckBoxTick : Sprite.Invalid;

            editor.SceneEditing.SelectionChanged += OnSelectionChanged;

            // Transform space widget
            var transformSpaceWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var transformSpaceToggle = new ViewportWidgetButton(string.Empty, editor.Icons.World16, null, true)
            {
                Checked     = TransformGizmo.ActiveTransformSpace == TransformGizmo.TransformSpace.World,
                TooltipText = "Gizmo transform space (world or local)",
                Parent      = transformSpaceWidget
            };

            transformSpaceToggle.OnToggle += OnTransformSpaceToggle;
            transformSpaceWidget.Parent    = this;

            // Scale snapping widget
            var scaleSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableScaleSnapping = new ViewportWidgetButton(string.Empty, editor.Icons.ScaleStep16, null, true)
            {
                Checked     = TransformGizmo.ScaleSnapEnabled,
                TooltipText = "Enable scale snapping",
                Parent      = scaleSnappingWidget
            };

            enableScaleSnapping.OnToggle += OnScaleSnappingToggle;
            var scaleSnappingCM = new ContextMenu();

            _scaleSnapping             = new ViewportWidgetButton(TransformGizmo.ScaleSnapValue.ToString(), Sprite.Invalid, scaleSnappingCM);
            _scaleSnapping.TooltipText = "Scale snapping values";
            for (int i = 0; i < EditorViewportScaleSnapValues.Length; i++)
            {
                var v      = EditorViewportScaleSnapValues[i];
                var button = scaleSnappingCM.AddButton(v.ToString());
                button.Tag = v;
            }
            scaleSnappingCM.ButtonClicked  += OnWidgetScaleSnapClick;
            scaleSnappingCM.VisibleChanged += OnWidgetScaleSnapShowHide;
            _scaleSnapping.Parent           = scaleSnappingWidget;
            scaleSnappingWidget.Parent      = this;

            // Rotation snapping widget
            var rotateSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableRotateSnapping = new ViewportWidgetButton(string.Empty, editor.Icons.RotateStep16, null, true)
            {
                Checked     = TransformGizmo.RotationSnapEnabled,
                TooltipText = "Enable rotation snapping",
                Parent      = rotateSnappingWidget
            };

            enableRotateSnapping.OnToggle += OnRotateSnappingToggle;
            var rotateSnappingCM = new ContextMenu();

            _rotateSnapping             = new ViewportWidgetButton(TransformGizmo.RotationSnapValue.ToString(), Sprite.Invalid, rotateSnappingCM);
            _rotateSnapping.TooltipText = "Rotation snapping values";
            for (int i = 0; i < EditorViewportRotateSnapValues.Length; i++)
            {
                var v      = EditorViewportRotateSnapValues[i];
                var button = rotateSnappingCM.AddButton(v.ToString());
                button.Tag = v;
            }
            rotateSnappingCM.ButtonClicked  += OnWidgetRotateSnapClick;
            rotateSnappingCM.VisibleChanged += OnWidgetRotateSnapShowHide;
            _rotateSnapping.Parent           = rotateSnappingWidget;
            rotateSnappingWidget.Parent      = this;

            // Translation snapping widget
            var translateSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableTranslateSnapping = new ViewportWidgetButton(string.Empty, editor.Icons.Grid16, null, true)
            {
                Checked     = TransformGizmo.TranslationSnapEnable,
                TooltipText = "Enable position snapping",
                Parent      = translateSnappingWidget
            };

            enableTranslateSnapping.OnToggle += OnTranslateSnappingToggle;
            var translateSnappingCM = new ContextMenu();

            _translateSnapping             = new ViewportWidgetButton(TransformGizmo.TranslationSnapValue.ToString(), Sprite.Invalid, translateSnappingCM);
            _translateSnapping.TooltipText = "Position snapping values";
            for (int i = 0; i < EditorViewportTranslateSnapValues.Length; i++)
            {
                var v      = EditorViewportTranslateSnapValues[i];
                var button = translateSnappingCM.AddButton(v.ToString());
                button.Tag = v;
            }
            translateSnappingCM.ButtonClicked  += OnWidgetTranslateSnapClick;
            translateSnappingCM.VisibleChanged += OnWidgetTranslateSnapShowHide;
            _translateSnapping.Parent           = translateSnappingWidget;
            translateSnappingWidget.Parent      = this;

            // Gizmo mode widget
            var gizmoMode = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);

            _gizmoModeTranslate = new ViewportWidgetButton(string.Empty, editor.Icons.Translate16, null, true)
            {
                Tag         = TransformGizmo.Mode.Translate,
                TooltipText = "Translate gizmo mode",
                Checked     = true,
                Parent      = gizmoMode
            };
            _gizmoModeTranslate.OnToggle += OnGizmoModeToggle;
            _gizmoModeRotate              = new ViewportWidgetButton(string.Empty, editor.Icons.Rotate16, null, true)
            {
                Tag         = TransformGizmo.Mode.Rotate,
                TooltipText = "Rotate gizmo mode",
                Parent      = gizmoMode
            };
            _gizmoModeRotate.OnToggle += OnGizmoModeToggle;
            _gizmoModeScale            = new ViewportWidgetButton(string.Empty, editor.Icons.Scale16, null, true)
            {
                Tag         = TransformGizmo.Mode.Scale,
                TooltipText = "Scale gizmo mode",
                Parent      = gizmoMode
            };
            _gizmoModeScale.OnToggle += OnGizmoModeToggle;
            gizmoMode.Parent          = this;

            // Show grid widget
            _showGridButton               = ViewWidgetButtonMenu.AddButton("Show grid", () => Grid.Enabled = !Grid.Enabled);
            _showGridButton.Icon          = Style.Current.CheckBoxTick;
            _showGridButton.IndexInParent = 1;

            // Create camera widget
            ViewWidgetButtonMenu.AddSeparator();
            ViewWidgetButtonMenu.AddButton("Create camera here", CreateCameraAtView);

            DragHandlers.Add(_dragActorType);
            DragHandlers.Add(_dragAssets);

            InitModes();
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainEditorGizmoViewport"/> class.
        /// </summary>
        /// <param name="editor">Editor instance.</param>
        public MainEditorGizmoViewport(Editor editor)
            : base(RenderTask.Create <SceneRenderTask>(), editor.Undo)
        {
            _editor = editor;

            // Prepare rendering task
            Task.ActorsSource = ActorsSources.ScenesAndCustomActors;
            Task.Flags        = ViewFlags.DefaultEditor;
            Task.Begin       += RenderTaskOnBegin;
            Task.End         += RenderTaskOnEnd;
            Task.Draw        += RenderTaskOnDraw;

            // Create selection outline postFx
            SelectionOutline = FlaxEngine.Object.New <SelectionOutline>();
            Task.CustomPostFx.Add(SelectionOutline);

            // Add transformation gizmo
            TransformGizmo = new TransformGizmo(this);
            TransformGizmo.OnApplyTransformation += ApplyTransform;
            TransformGizmo.OnModeChanged         += OnGizmoModeChanged;
            Gizmos.Active = TransformGizmo;

            // Add grid
            Grid = new GridGizmo(this);
            Grid.EnabledChanged += gizmo => _showGridButton.Icon = gizmo.Enabled ? Style.Current.CheckBoxTick : Sprite.Invalid;

            editor.SceneEditing.OnSelectionChanged += OnSelectionChanged;

            // Transform space widget
            var transformSpaceWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var transformSpaceToggle = new ViewportWidgetButton(string.Empty, editor.UI.GetIcon("World16"), null, true)
            {
                Checked     = TransformGizmo.ActiveTransformSpace == TransformGizmo.TransformSpace.World,
                TooltipText = "Gizmo transform space (world or local)",
                Parent      = transformSpaceWidget
            };

            transformSpaceToggle.OnToggle += onTransformSpaceToggle;
            transformSpaceWidget.Parent    = this;

            // Scale snapping widget
            var scaleSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableScaleSnapping = new ViewportWidgetButton(string.Empty, editor.UI.GetIcon("ScaleStep16"), null, true)
            {
                Checked     = TransformGizmo.ScaleSnapEnabled,
                TooltipText = "Enable scale snapping",
                Parent      = scaleSnappingWidget
            };

            enableScaleSnapping.OnToggle += onScaleSnappingToggle;
            var scaleSnappingCM = new ContextMenu();
            var scaleSnappng    = new ViewportWidgetButton(TransformGizmo.ScaleSnapValue.ToString(), Sprite.Invalid, scaleSnappingCM);

            scaleSnappng.TooltipText = "Scale snapping values";
            for (int i = 0; i < EditorViewportScaleSnapValues.Length; i++)
            {
                var button = scaleSnappingCM.AddButton(i, EditorViewportScaleSnapValues[i].ToString());
                button.Tag = scaleSnappng;
            }
            scaleSnappingCM.OnButtonClicked += widgetScaleSnapClick;
            scaleSnappingCM.VisibleChanged  += widgetScaleSnapShowHide;
            scaleSnappng.Parent              = scaleSnappingWidget;
            scaleSnappingWidget.Parent       = this;

            // Rotation snapping widget
            var rotateSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableRotateSnapping = new ViewportWidgetButton(string.Empty, editor.UI.GetIcon("RotateStep16"), null, true)
            {
                Checked     = TransformGizmo.RotationSnapEnabled,
                TooltipText = "Enable rotation snapping",
                Parent      = rotateSnappingWidget
            };

            enableRotateSnapping.OnToggle += onRotateSnappingToggle;
            var rotateSnappingCM = new ContextMenu();
            var rotateSnappng    = new ViewportWidgetButton(TransformGizmo.RotationSnapValue.ToString(), Sprite.Invalid, rotateSnappingCM);

            rotateSnappng.TooltipText = "Rotation snapping values";
            for (int i = 0; i < EditorViewportRotateSnapValues.Length; i++)
            {
                var button = rotateSnappingCM.AddButton(i, EditorViewportRotateSnapValues[i].ToString());
                button.Tag = rotateSnappng;
            }
            rotateSnappingCM.OnButtonClicked += widgetRotateSnapClick;
            rotateSnappingCM.VisibleChanged  += widgetRotateSnapShowHide;
            rotateSnappng.Parent              = rotateSnappingWidget;
            rotateSnappingWidget.Parent       = this;

            // Translation snapping widget
            var translateSnappingWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
            var enableTranslateSnapping = new ViewportWidgetButton(string.Empty, editor.UI.GetIcon("Grid16"), null, true)
            {
                Checked     = TransformGizmo.TranslationSnapEnable,
                TooltipText = "Enable position snapping",
                Parent      = translateSnappingWidget
            };

            enableTranslateSnapping.OnToggle += onTranslateSnappingToggle;
            var translateSnappingCM = new ContextMenu();
            var translateSnappng    = new ViewportWidgetButton(TransformGizmo.TranslationSnapValue.ToString(), Sprite.Invalid, translateSnappingCM);

            translateSnappng.TooltipText = "Position snapping values";
            for (int i = 0; i < EditorViewportTranslateSnapValues.Length; i++)
            {
                var button = translateSnappingCM.AddButton(i, EditorViewportTranslateSnapValues[i].ToString());
                button.Tag = translateSnappng;
            }
            translateSnappingCM.OnButtonClicked += widgetTranslateSnapClick;
            translateSnappingCM.VisibleChanged  += widgetTranslateSnapShowHide;
            translateSnappng.Parent              = translateSnappingWidget;
            translateSnappingWidget.Parent       = this;

            // Gizmo mode widget
            var gizmoMode = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);

            _gizmoModeTranslate = new ViewportWidgetButton(string.Empty, editor.UI.GetIcon("Translate16"), null, true)
            {
                Tag         = TransformGizmo.Mode.Translate,
                TooltipText = "Translate gizmo mode",
                Checked     = true,
                Parent      = gizmoMode
            };
            _gizmoModeTranslate.OnToggle += onGizmoModeToggle;
            _gizmoModeRotate              = new ViewportWidgetButton(string.Empty, editor.UI.GetIcon("Rotate16"), null, true)
            {
                Tag         = TransformGizmo.Mode.Rotate,
                TooltipText = "Rotate gizmo mode",
                Parent      = gizmoMode
            };
            _gizmoModeRotate.OnToggle += onGizmoModeToggle;
            _gizmoModeScale            = new ViewportWidgetButton(string.Empty, editor.UI.GetIcon("Scale16"), null, true)
            {
                Tag         = TransformGizmo.Mode.Scale,
                TooltipText = "Scale gizmo mode",
                Parent      = gizmoMode
            };
            _gizmoModeScale.OnToggle += onGizmoModeToggle;
            gizmoMode.Parent          = this;

            // Create Camera Here widget
            _showGridButton               = ViewWidgetButtonMenu.AddButton("Show grid", () => Grid.Enabled = !Grid.Enabled);
            _showGridButton.Icon          = Style.Current.CheckBoxTick;
            _showGridButton.IndexInParent = 1;
            ViewWidgetButtonMenu.AddSeparator();
            ViewWidgetButtonMenu.AddButton("Create camera here", CreateCameraAtView);
        }