Change to use static method for import path ui.
This commit is contained in:
@@ -383,6 +383,28 @@ namespace FlaxEditor.Utilities
|
|||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an Import path ui that show the asset import path and adds a button to show the folder in the file system.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parentLayout">The parent layout container.</param>
|
||||||
|
/// <param name="assetItem">The asset item to get the import path of.</param>
|
||||||
|
public static void CreateImportPathUI(CustomEditors.LayoutElementsContainer parentLayout, Content.BinaryAssetItem assetItem)
|
||||||
|
{
|
||||||
|
assetItem.GetImportPath(out var path);
|
||||||
|
if (!string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
parentLayout.Space(5);
|
||||||
|
parentLayout.Label("Import Path:");
|
||||||
|
var textBox = parentLayout.TextBox().TextBox;
|
||||||
|
textBox.TooltipText = "Path is not editable here.";
|
||||||
|
textBox.IsReadOnly = true;
|
||||||
|
textBox.Text = path;
|
||||||
|
parentLayout.Space(2);
|
||||||
|
var button = parentLayout.Button(Constants.ShowInExplorer).Button;
|
||||||
|
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies the directory. Supports subdirectories copy with files override option.
|
/// Copies the directory. Supports subdirectories copy with files override option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -210,20 +210,9 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
var importSettingsField = typeof(PropertiesProxy).GetField("ImportSettings", BindingFlags.NonPublic | BindingFlags.Instance);
|
var importSettingsField = typeof(PropertiesProxy).GetField("ImportSettings", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
var importSettingsValues = new ValueContainer(new ScriptMemberInfo(importSettingsField)) { proxy.ImportSettings };
|
var importSettingsValues = new ValueContainer(new ScriptMemberInfo(importSettingsField)) { proxy.ImportSettings };
|
||||||
group.Object(importSettingsValues);
|
group.Object(importSettingsValues);
|
||||||
|
|
||||||
(proxy.Window.Item as BinaryAssetItem).GetImportPath(out var path);
|
// Creates the import path UI
|
||||||
if (!string.IsNullOrEmpty(path))
|
Utilities.Utils.CreateImportPathUI(layout, proxy.Window.Item as BinaryAssetItem);
|
||||||
{
|
|
||||||
layout.Space(5);
|
|
||||||
layout.Label("Import Path:");
|
|
||||||
var textBox = layout.TextBox().TextBox;
|
|
||||||
textBox.TooltipText = "Path is not editable here.";
|
|
||||||
textBox.IsReadOnly = true;
|
|
||||||
textBox.Text = path;
|
|
||||||
layout.Space(2);
|
|
||||||
var button = layout.Button("Open Import Path in Explorer").Button;
|
|
||||||
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.Space(5);
|
layout.Space(5);
|
||||||
var reimportButton = layout.Button("Reimport");
|
var reimportButton = layout.Button("Reimport");
|
||||||
|
|||||||
@@ -100,20 +100,9 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
}
|
}
|
||||||
|
|
||||||
base.Initialize(layout);
|
base.Initialize(layout);
|
||||||
|
|
||||||
(window.Item as BinaryAssetItem).GetImportPath(out var path);
|
// Creates the import path UI
|
||||||
if (!string.IsNullOrEmpty(path))
|
Utilities.Utils.CreateImportPathUI(layout, window.Item as BinaryAssetItem);
|
||||||
{
|
|
||||||
layout.Space(5);
|
|
||||||
layout.Label("Import Path:");
|
|
||||||
var textBox = layout.TextBox().TextBox;
|
|
||||||
textBox.TooltipText = "Path is not editable here.";
|
|
||||||
textBox.IsReadOnly = true;
|
|
||||||
textBox.Text = path;
|
|
||||||
layout.Space(2);
|
|
||||||
var button = layout.Button("Open Import Path in Explorer").Button;
|
|
||||||
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.Space(10);
|
layout.Space(10);
|
||||||
var reimportButton = layout.Button("Reimport");
|
var reimportButton = layout.Button("Reimport");
|
||||||
|
|||||||
@@ -53,20 +53,9 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
}
|
}
|
||||||
|
|
||||||
base.Initialize(layout);
|
base.Initialize(layout);
|
||||||
|
|
||||||
(window.Item as BinaryAssetItem).GetImportPath(out var path);
|
// Creates the import path UI
|
||||||
if (!string.IsNullOrEmpty(path))
|
Utilities.Utils.CreateImportPathUI(layout, window.Item as BinaryAssetItem);
|
||||||
{
|
|
||||||
layout.Space(5);
|
|
||||||
layout.Label("Import Path:");
|
|
||||||
var textBox = layout.TextBox().TextBox;
|
|
||||||
textBox.TooltipText = "Path is not editable here.";
|
|
||||||
textBox.IsReadOnly = true;
|
|
||||||
textBox.Text = path;
|
|
||||||
layout.Space(2);
|
|
||||||
var button = layout.Button("Open Import Path in Explorer").Button;
|
|
||||||
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.Space(10);
|
layout.Space(10);
|
||||||
var reimportButton = layout.Button("Reimport");
|
var reimportButton = layout.Button("Reimport");
|
||||||
|
|||||||
@@ -759,19 +759,8 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
var importSettingsValues = new ValueContainer(new ScriptMemberInfo(importSettingsField)) { proxy.ImportSettings };
|
var importSettingsValues = new ValueContainer(new ScriptMemberInfo(importSettingsField)) { proxy.ImportSettings };
|
||||||
group.Object(importSettingsValues);
|
group.Object(importSettingsValues);
|
||||||
|
|
||||||
(proxy.Window.Item as BinaryAssetItem).GetImportPath(out var path);
|
// Creates the import path UI
|
||||||
if (!string.IsNullOrEmpty(path))
|
Utilities.Utils.CreateImportPathUI(layout, proxy.Window.Item as BinaryAssetItem);
|
||||||
{
|
|
||||||
layout.Space(5);
|
|
||||||
layout.Label("Import Path:");
|
|
||||||
var textBox = layout.TextBox().TextBox;
|
|
||||||
textBox.TooltipText = "Path is not editable here.";
|
|
||||||
textBox.IsReadOnly = true;
|
|
||||||
textBox.Text = path;
|
|
||||||
layout.Space(2);
|
|
||||||
var button = layout.Button("Open Import Path in Explorer").Button;
|
|
||||||
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.Space(5);
|
layout.Space(5);
|
||||||
var reimportButton = layout.Button("Reimport");
|
var reimportButton = layout.Button("Reimport");
|
||||||
|
|||||||
@@ -1022,20 +1022,9 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
var importSettingsField = typeof(ImportPropertiesProxy).GetField("ImportSettings", BindingFlags.NonPublic | BindingFlags.Instance);
|
var importSettingsField = typeof(ImportPropertiesProxy).GetField("ImportSettings", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
var importSettingsValues = new ValueContainer(new ScriptMemberInfo(importSettingsField)) { proxy.ImportSettings };
|
var importSettingsValues = new ValueContainer(new ScriptMemberInfo(importSettingsField)) { proxy.ImportSettings };
|
||||||
group.Object(importSettingsValues);
|
group.Object(importSettingsValues);
|
||||||
|
|
||||||
(proxy.Window.Item as BinaryAssetItem).GetImportPath(out var path);
|
// Creates the import path UI
|
||||||
if (!string.IsNullOrEmpty(path))
|
Utilities.Utils.CreateImportPathUI(layout, proxy.Window.Item as BinaryAssetItem);
|
||||||
{
|
|
||||||
layout.Space(5);
|
|
||||||
layout.Label("Import Path:");
|
|
||||||
var textBox = layout.TextBox().TextBox;
|
|
||||||
textBox.TooltipText = "Path is not editable here.";
|
|
||||||
textBox.IsReadOnly = true;
|
|
||||||
textBox.Text = path;
|
|
||||||
layout.Space(2);
|
|
||||||
var button = layout.Button("Open Import Path in Explorer").Button;
|
|
||||||
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.Space(5);
|
layout.Space(5);
|
||||||
var reimportButton = layout.Button("Reimport");
|
var reimportButton = layout.Button("Reimport");
|
||||||
|
|||||||
@@ -119,20 +119,9 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
}
|
}
|
||||||
|
|
||||||
base.Initialize(layout);
|
base.Initialize(layout);
|
||||||
|
|
||||||
(proxy._window.Item as BinaryAssetItem).GetImportPath(out var path);
|
// Creates the import path UI
|
||||||
if (!string.IsNullOrEmpty(path))
|
Utilities.Utils.CreateImportPathUI(layout, proxy._window.Item as BinaryAssetItem);
|
||||||
{
|
|
||||||
layout.Space(5);
|
|
||||||
layout.Label("Import Path:");
|
|
||||||
var textBox = layout.TextBox().TextBox;
|
|
||||||
textBox.TooltipText = "Path is not editable here.";
|
|
||||||
textBox.IsReadOnly = true;
|
|
||||||
textBox.Text = path;
|
|
||||||
layout.Space(2);
|
|
||||||
var button = layout.Button("Open Import Path in Explorer").Button;
|
|
||||||
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
layout.Space(10);
|
layout.Space(10);
|
||||||
var reimportButton = layout.Button("Reimport");
|
var reimportButton = layout.Button("Reimport");
|
||||||
|
|||||||
@@ -144,20 +144,9 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
|
|
||||||
// Import settings
|
// Import settings
|
||||||
base.Initialize(layout);
|
base.Initialize(layout);
|
||||||
|
|
||||||
(proxy._window.Item as BinaryAssetItem).GetImportPath(out var path);
|
// Creates the import path UI
|
||||||
if (!string.IsNullOrEmpty(path))
|
Utilities.Utils.CreateImportPathUI(layout, proxy._window.Item as BinaryAssetItem);
|
||||||
{
|
|
||||||
layout.Space(5);
|
|
||||||
layout.Label("Import Path:");
|
|
||||||
var textBox = layout.TextBox().TextBox;
|
|
||||||
textBox.TooltipText = "Path is not editable here.";
|
|
||||||
textBox.IsReadOnly = true;
|
|
||||||
textBox.Text = path;
|
|
||||||
layout.Space(2);
|
|
||||||
var button = layout.Button("Open Import Path in Explorer").Button;
|
|
||||||
button.Clicked += () => FileSystem.ShowFileExplorer(Path.GetDirectoryName(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reimport
|
// Reimport
|
||||||
layout.Space(10);
|
layout.Space(10);
|
||||||
|
|||||||
Reference in New Issue
Block a user