Change to use view CM and set inital ui mode to use if the prefab has ui.
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FlaxEditor.Content;
|
using FlaxEditor.Content;
|
||||||
using FlaxEditor.Gizmo;
|
using FlaxEditor.Gizmo;
|
||||||
|
using FlaxEditor.GUI.ContextMenu;
|
||||||
using FlaxEditor.SceneGraph;
|
using FlaxEditor.SceneGraph;
|
||||||
using FlaxEditor.Scripting;
|
using FlaxEditor.Scripting;
|
||||||
using FlaxEditor.Viewport.Cameras;
|
using FlaxEditor.Viewport.Cameras;
|
||||||
@@ -71,7 +72,7 @@ namespace FlaxEditor.Viewport
|
|||||||
private PrefabUIEditorRoot _uiRoot;
|
private PrefabUIEditorRoot _uiRoot;
|
||||||
private bool _showUI = false;
|
private bool _showUI = false;
|
||||||
|
|
||||||
private ViewportWidgetButton _uiModeButton;
|
private ContextMenuButton _uiModeButton;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event fired when the UI Mode is toggled.
|
/// Event fired when the UI Mode is toggled.
|
||||||
@@ -208,12 +209,11 @@ namespace FlaxEditor.Viewport
|
|||||||
_uiRoot = new PrefabUIEditorRoot(this);
|
_uiRoot = new PrefabUIEditorRoot(this);
|
||||||
_uiRoot.IndexInParent = 0; // Move viewport down below other widgets in the viewport
|
_uiRoot.IndexInParent = 0; // Move viewport down below other widgets in the viewport
|
||||||
_uiParentLink = _uiRoot.UIRoot;
|
_uiParentLink = _uiRoot.UIRoot;
|
||||||
|
|
||||||
var container = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperLeft);
|
// UI mode buton
|
||||||
container.Parent = this;
|
_uiModeButton = ViewWidgetShowMenu.AddButton("UI Mode", (button) => ShowUI = button.Checked);
|
||||||
_uiModeButton = new ViewportWidgetButton("UI Mode", SpriteHandle.Invalid, null, true);
|
_uiModeButton.AutoCheck = true;
|
||||||
_uiModeButton.Clicked += button => ShowUI = button.Checked;
|
_uiModeButton.VisibleChanged += control => (control as ContextMenuButton).Checked = ShowUI;
|
||||||
_uiModeButton.Parent = container;
|
|
||||||
|
|
||||||
EditorGizmoViewport.AddGizmoViewportWidgets(this, TransformGizmo);
|
EditorGizmoViewport.AddGizmoViewportWidgets(this, TransformGizmo);
|
||||||
|
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
if (Editor.ProjectCache.TryGetCustomData($"UIMode:{_asset.ID}", out bool value))
|
if (Editor.ProjectCache.TryGetCustomData($"UIMode:{_asset.ID}", out bool value))
|
||||||
_viewport.SetInitialUIMode(value);
|
_viewport.SetInitialUIMode(value);
|
||||||
else
|
else
|
||||||
_viewport.SetInitialUIMode(false);
|
_viewport.SetInitialUIMode(_viewport._hasUILinked);
|
||||||
_viewport.UIModeToggled += OnUIModeToggled;
|
_viewport.UIModeToggled += OnUIModeToggled;
|
||||||
Graph.MainActor = _viewport.Instance;
|
Graph.MainActor = _viewport.Instance;
|
||||||
Selection.Clear();
|
Selection.Clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user