Merge remote-tracking branch 'origin/master' into 1.8
# Conflicts: # Flax.flaxproj
This commit is contained in:
@@ -186,6 +186,10 @@ namespace FlaxEditor.Windows.Assets
|
||||
|
||||
base.Initialize(layout);
|
||||
|
||||
// Ignore import settings GUI if the type is not animation. This removes the import UI if the animation asset was not created using an import.
|
||||
if (proxy.ImportSettings.Settings.Type != FlaxEngine.Tools.ModelTool.ModelType.Animation)
|
||||
return;
|
||||
|
||||
// Import Settings
|
||||
{
|
||||
var group = layout.Group("Import Settings");
|
||||
|
||||
@@ -360,10 +360,9 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// </summary>
|
||||
/// <param name="parent">The parent control.</param>
|
||||
/// <param name="location">The location (within a given control).</param>
|
||||
private void ShowContextMenu(Control parent, ref Float2 location)
|
||||
internal void ShowContextMenu(Control parent, ref Float2 location)
|
||||
{
|
||||
var contextMenu = CreateContextMenu();
|
||||
|
||||
contextMenu.Show(parent, location);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Gizmo;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
using FlaxEditor.SceneGraph;
|
||||
using FlaxEditor.SceneGraph.GUI;
|
||||
using FlaxEditor.Viewport.Cameras;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.Windows.Assets
|
||||
@@ -64,8 +62,11 @@ namespace FlaxEditor.Windows.Assets
|
||||
private void OnSelectionUndo(SceneGraphNode[] toSelect)
|
||||
{
|
||||
Selection.Clear();
|
||||
Selection.AddRange(toSelect);
|
||||
|
||||
foreach (var e in toSelect)
|
||||
{
|
||||
if (e != null)
|
||||
Selection.Add(e);
|
||||
}
|
||||
OnSelectionChanges();
|
||||
}
|
||||
|
||||
@@ -118,11 +119,13 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// <param name="nodes">The nodes.</param>
|
||||
public void Select(List<SceneGraphNode> nodes)
|
||||
{
|
||||
nodes?.RemoveAll(x => x == null);
|
||||
if (nodes == null || nodes.Count == 0)
|
||||
{
|
||||
Deselect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utils.ArraysEqual(Selection, nodes))
|
||||
return;
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
IsScrollable = false,
|
||||
Offsets = new Margin(0, 0, 0, 18 + 6),
|
||||
};
|
||||
_searchBox = new SearchBox()
|
||||
_searchBox = new SearchBox
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchMiddle,
|
||||
Parent = headerPanel,
|
||||
@@ -140,7 +140,8 @@ namespace FlaxEditor.Windows.Assets
|
||||
};
|
||||
_searchBox.TextChanged += OnSearchBoxTextChanged;
|
||||
|
||||
_treePanel = new Panel()
|
||||
// Prefab structure tree
|
||||
_treePanel = new Panel
|
||||
{
|
||||
AnchorPreset = AnchorPresets.StretchAll,
|
||||
Offsets = new Margin(0.0f, 0.0f, headerPanel.Bottom, 0.0f),
|
||||
@@ -148,8 +149,6 @@ namespace FlaxEditor.Windows.Assets
|
||||
IsScrollable = true,
|
||||
Parent = sceneTreePanel,
|
||||
};
|
||||
|
||||
// Prefab structure tree
|
||||
Graph = new LocalSceneGraph(new CustomRootNode(this));
|
||||
Graph.Root.TreeNode.Expand(true);
|
||||
_tree = new PrefabTree
|
||||
@@ -316,11 +315,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
return;
|
||||
|
||||
// Restore
|
||||
_viewport.Prefab = _asset;
|
||||
Graph.MainActor = _viewport.Instance;
|
||||
Selection.Clear();
|
||||
Select(Graph.Main);
|
||||
Graph.Root.TreeNode.Expand(true);
|
||||
OnPrefabOpened();
|
||||
_undo.Clear();
|
||||
ClearEditedFlag();
|
||||
}
|
||||
@@ -346,6 +341,16 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPrefabOpened()
|
||||
{
|
||||
_viewport.Prefab = _asset;
|
||||
_viewport.UpdateGizmoMode();
|
||||
Graph.MainActor = _viewport.Instance;
|
||||
Selection.Clear();
|
||||
Select(Graph.Main);
|
||||
Graph.Root.TreeNode.Expand(true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Save()
|
||||
{
|
||||
@@ -355,7 +360,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
|
||||
try
|
||||
{
|
||||
Editor.Scene.OnSaveStart(_viewport);
|
||||
Editor.Scene.OnSaveStart(_viewport._uiParentLink);
|
||||
|
||||
// Simply update changes
|
||||
Editor.Prefabs.ApplyAll(_viewport.Instance);
|
||||
@@ -375,7 +380,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
finally
|
||||
{
|
||||
Editor.Scene.OnSaveEnd(_viewport);
|
||||
Editor.Scene.OnSaveEnd(_viewport._uiParentLink);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,13 +422,8 @@ namespace FlaxEditor.Windows.Assets
|
||||
return;
|
||||
}
|
||||
|
||||
_viewport.Prefab = _asset;
|
||||
Graph.MainActor = _viewport.Instance;
|
||||
OnPrefabOpened();
|
||||
_focusCamera = true;
|
||||
Selection.Clear();
|
||||
Select(Graph.Main);
|
||||
Graph.Root.TreeNode.Expand(true);
|
||||
|
||||
_undo.Clear();
|
||||
ClearEditedFlag();
|
||||
|
||||
@@ -468,11 +468,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
_viewport.Prefab = null;
|
||||
if (_asset.IsLoaded)
|
||||
{
|
||||
_viewport.Prefab = _asset;
|
||||
Graph.MainActor = _viewport.Instance;
|
||||
Selection.Clear();
|
||||
Select(Graph.Main);
|
||||
Graph.Root.TreeNode.ExpandAll(true);
|
||||
OnPrefabOpened();
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -484,7 +480,6 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (_focusCamera && _viewport.Task.FrameCount > 1)
|
||||
{
|
||||
_focusCamera = false;
|
||||
|
||||
Editor.GetActorEditorSphere(_viewport.Instance, out BoundingSphere bounds);
|
||||
_viewport.ViewPosition = bounds.Center - _viewport.ViewDirection * (bounds.Radius * 1.2f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user