Merge remote-tracking branch 'origin/master' into 1.6
# Conflicts: # Flax.flaxproj # Source/Editor/Content/Items/AssetItem.cs
This commit is contained in:
@@ -23,6 +23,11 @@ namespace FlaxEditor.Content
|
||||
/// </summary>
|
||||
public string TypeName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if asset is now loaded.
|
||||
/// </summary>
|
||||
public bool IsLoaded => FlaxEngine.Content.GetAsset(ID)?.IsLoaded ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AssetItem"/> class.
|
||||
/// </summary>
|
||||
@@ -89,7 +94,19 @@ namespace FlaxEditor.Content
|
||||
/// <returns>The asset object.</returns>
|
||||
public Asset LoadAsync()
|
||||
{
|
||||
return FlaxEngine.Content.LoadAsync<BinaryAsset>(ID);
|
||||
return FlaxEngine.Content.LoadAsync<Asset>(ID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the asset (if it's loaded).
|
||||
/// </summary>
|
||||
public void Reload()
|
||||
{
|
||||
var asset = FlaxEngine.Content.GetAsset(ID);
|
||||
if (asset != null && asset.IsLoaded)
|
||||
{
|
||||
asset.Reload();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -27,16 +27,6 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
element.ComboBox.SelectedIndexChanged += OnSelectedIndexChanged;
|
||||
}
|
||||
|
||||
private void GetActorsTree(List<Actor> list, Actor a)
|
||||
{
|
||||
list.Add(a);
|
||||
int cnt = a.ChildrenCount;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
GetActorsTree(list, a.GetChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectedIndexChanged(ComboBox comboBox)
|
||||
{
|
||||
int value = comboBox.SelectedIndex;
|
||||
@@ -60,7 +50,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
// Note: this possibly breaks the design a little bit
|
||||
// But it's the easiest way to set value for selected actor and its children with one undo action
|
||||
List<Actor> actors = new List<Actor>(32);
|
||||
GetActorsTree(actors, actor);
|
||||
Utilities.Utils.GetActorsTree(actors, actor);
|
||||
if (Presenter.Undo != null)
|
||||
{
|
||||
using (new UndoMultiBlock(Presenter.Undo, actors.ToArray(), "Change layer"))
|
||||
|
||||
@@ -10,16 +10,6 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
/// </summary>
|
||||
public sealed class ActorStaticFlagsEditor : EnumEditor
|
||||
{
|
||||
private void GetActorsTree(List<Actor> list, Actor a)
|
||||
{
|
||||
list.Add(a);
|
||||
int cnt = a.ChildrenCount;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
GetActorsTree(list, a.GetChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnValueChanged()
|
||||
{
|
||||
@@ -40,7 +30,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
// Note: this possibly breaks the design a little bit
|
||||
// But it's the easiest way to set value for selected actor and its children with one undo action
|
||||
List<Actor> actors = new List<Actor>(32);
|
||||
GetActorsTree(actors, actor);
|
||||
Utilities.Utils.GetActorsTree(actors, actor);
|
||||
if (Presenter.Undo != null && Presenter.Undo.Enabled)
|
||||
{
|
||||
using (new UndoMultiBlock(Presenter.Undo, actors.ToArray(), "Change static flags"))
|
||||
|
||||
@@ -630,7 +630,7 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
{
|
||||
// Set all Actors static flags to match parents
|
||||
List<Actor> childActors = new List<Actor>();
|
||||
GetActorsTree(childActors, actor);
|
||||
Utilities.Utils.GetActorsTree(childActors, actor);
|
||||
foreach (var child in childActors)
|
||||
{
|
||||
child.StaticFlags = spawnParent.StaticFlags;
|
||||
@@ -676,16 +676,6 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void GetActorsTree(List<Actor> list, Actor a)
|
||||
{
|
||||
list.Add(a);
|
||||
int cnt = a.ChildrenCount;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
GetActorsTree(list, a.GetChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidateDragActor(ActorNode actorNode)
|
||||
{
|
||||
|
||||
@@ -192,6 +192,16 @@ namespace FlaxEditor.Utilities
|
||||
return str;
|
||||
}
|
||||
|
||||
internal static void GetActorsTree(List<Actor> list, Actor a)
|
||||
{
|
||||
list.Add(a);
|
||||
int cnt = a.ChildrenCount;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
GetActorsTree(list, a.GetChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The colors for the keyframes used by the curve editor.
|
||||
/// </summary>
|
||||
|
||||
@@ -98,6 +98,8 @@ namespace FlaxEditor.Windows
|
||||
|
||||
if (item is AssetItem assetItem)
|
||||
{
|
||||
if (assetItem.IsLoaded)
|
||||
cm.AddButton("Reload", assetItem.Reload);
|
||||
cm.AddButton("Copy asset ID", () => Clipboard.Text = JsonSerializer.GetStringID(assetItem.ID));
|
||||
cm.AddButton("Select actors using this asset", () => Editor.SceneEditing.SelectActorsUsingAsset(assetItem.ID));
|
||||
cm.AddButton("Show asset references graph", () => Editor.Windows.Open(new AssetReferencesGraphWindow(Editor, assetItem)));
|
||||
|
||||
Reference in New Issue
Block a user