Merge remote-tracking branch 'origin/master' into gi

This commit is contained in:
Wojciech Figat
2022-04-21 12:57:08 +02:00
78 changed files with 604 additions and 311 deletions

View File

@@ -29,7 +29,7 @@ namespace FlaxEditor.CustomEditors
/// Enables using prefab-related features of the properties editor (eg. revert to prefab option).
/// </summary>
UsePrefab = 1 << 1,
/// <summary>
/// Enables using default-value-related features of the properties editor (eg. revert to default option).
/// </summary>
@@ -88,7 +88,6 @@ namespace FlaxEditor.CustomEditors
/// <seealso cref="FlaxEditor.CustomEditors.SyncPointEditor" />
protected class RootEditor : SyncPointEditor
{
private readonly string _noSelectionText;
private CustomEditor _overrideEditor;
/// <summary>
@@ -109,13 +108,18 @@ namespace FlaxEditor.CustomEditors
}
}
/// <summary>
/// The text to show when no object is selected.
/// </summary>
public string NoSelectionText;
/// <summary>
/// Initializes a new instance of the <see cref="RootEditor"/> class.
/// </summary>
/// <param name="noSelectionText">The text to show when no item is selected.</param>
public RootEditor(string noSelectionText)
{
_noSelectionText = noSelectionText ?? "No selection";
NoSelectionText = noSelectionText ?? "No selection";
}
/// <summary>
@@ -154,7 +158,7 @@ namespace FlaxEditor.CustomEditors
}
else
{
var label = layout.Label(_noSelectionText, TextAlignment.Center);
var label = layout.Label(NoSelectionText, TextAlignment.Center);
label.Label.Height = 20.0f;
}
@@ -251,6 +255,20 @@ namespace FlaxEditor.CustomEditors
/// </summary>
public object Owner;
/// <summary>
/// Gets or sets the text to show when no object is selected.
/// </summary>
public string NoSelectionText
{
get => Editor.NoSelectionText;
set
{
Editor.NoSelectionText = value;
if (SelectionCount == 0)
BuildLayoutOnUpdate();
}
}
private bool _buildOnUpdate;
/// <summary>

View File

@@ -49,10 +49,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
Parent = this,
Bounds = new Rectangle((Width - addScriptButtonWidth) / 2, 1, addScriptButtonWidth, 18),
};
addScriptButton.ButtonClicked += AddScriptButtonOnClicked;
addScriptButton.ButtonClicked += OnAddScriptButtonClicked;
}
private void AddScriptButtonOnClicked(Button button)
private void OnAddScriptButtonClicked(Button button)
{
var scripts = Editor.Instance.CodeEditing.Scripts.Get();
if (scripts.Count == 0)

View File

@@ -716,7 +716,7 @@ namespace FlaxEditor.CustomEditors.Editors
// Header
if (item.Header != null)
itemLayout.Header(item.Header.Text);
itemLayout.Header(item.Header);
try
{

View File

@@ -279,6 +279,16 @@ namespace FlaxEditor.CustomEditors
return element;
}
internal LabelElement Header(HeaderAttribute header)
{
var element = Header(header.Text);
if (header.FontSize != -1)
element.Label.Font = new FontReference(element.Label.Font.Font, header.FontSize);
if (header.Color != 0)
element.Label.TextColor = Color.FromRGBA(header.Color);
return element;
}
/// <summary>
/// Adds new text box element.
/// </summary>