Merge branch 'IconPatch' of git://github.com/W2Wizard/FlaxEngine into W2Wizard-IconPatch

This commit is contained in:
Wojtek Figat
2021-06-14 10:47:20 +02:00
14 changed files with 82 additions and 85 deletions

View File

@@ -22,7 +22,7 @@ namespace FlaxEditor.Content
public JsonAssetItem(string path, Guid id, string typeName)
: base(path, typeName, ref id)
{
_thumbnail = Editor.Instance.Icons.Document128;
_thumbnail = Editor.Instance.Icons.Json128;
}
/// <summary>

View File

@@ -46,6 +46,12 @@ namespace FlaxEditor
public SpriteHandle Down32;
public SpriteHandle FolderClosed32;
public SpriteHandle FolderOpen32;
public SpriteHandle Folder32;
public SpriteHandle CameraFill32;
public SpriteHandle Search32;
public SpriteHandle Info32;
public SpriteHandle Warning32;
public SpriteHandle Error32;
// Visject
public SpriteHandle VisjectBoxOpen32;
@@ -128,6 +134,10 @@ namespace FlaxEditor
public SpriteHandle AndroidIcon128;
public SpriteHandle PS4Icon128;
public SpriteHandle FlaxLogo128;
public SpriteHandle SwitchIcon128;
public SpriteHandle SwitchSettings128;
public SpriteHandle LocalizationSettings128;
public SpriteHandle Json128;
internal void LoadIcons()
{

View File

@@ -84,7 +84,7 @@ namespace FlaxEditor.GUI.Docking
/// <summary>
/// The default tabs header buttons size.
/// </summary>
public const float DefaultButtonsSize = 12;
public const float DefaultButtonsSize = 15;
/// <summary>
/// The default tabs header buttons margin.

View File

@@ -89,11 +89,10 @@ namespace FlaxEditor.GUI
new PlatformData(PlatformType.PS4, icons.PS4Icon128, "PlayStation 4"),
new PlatformData(PlatformType.XboxScarlett, icons.XBoxScarletIcon128, "Xbox Scarlett"),
new PlatformData(PlatformType.Android, icons.AndroidIcon128, "Android"),
new PlatformData(PlatformType.Switch, icons.ColorWheel128, "Switch"),
new PlatformData(PlatformType.Switch, icons.SwitchIcon128, "Switch"),
};
const float IconSize = 48.0f;
const float IconSize = 64.0f;
TileSize = new Vector2(IconSize);
AutoResize = true;
Offsets = new Margin(0, 0, 0, IconSize);

View File

@@ -70,7 +70,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
: base(ref options)
{
// Select Actor button
const float buttonSize = 14;
const float buttonSize = 18;
var icons = Editor.Instance.Icons;
_selectActor = new Image
{
@@ -80,7 +80,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
IsScrollable = false,
Color = Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(icons.Search12),
Brush = new SpriteBrush(icons.Search32),
Offsets = new Margin(-buttonSize - 2 + _addButton.Offsets.Left, buttonSize, buttonSize * -0.5f, buttonSize),
Parent = this,
};

View File

@@ -312,7 +312,8 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Curve.UnlockChildrenRecursive();
// Navigation buttons
const float buttonSize = 14;
const float keySize = 18;
const float addSize = 20;
var icons = Editor.Instance.Icons;
var rightKey = new Image
{
@@ -323,7 +324,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Color = Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(icons.Right32),
Offsets = new Margin(-buttonSize - 2 + _muteCheckbox.Offsets.Left, buttonSize, buttonSize * -0.5f, buttonSize),
Offsets = new Margin(-keySize - 2 + _muteCheckbox.Offsets.Left, keySize, keySize * -0.5f, keySize),
Parent = this,
};
rightKey.Clicked += OnRightKeyClicked;
@@ -336,7 +337,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Color = Style.Current.ForegroundGrey,
Margin = new Margin(3),
Brush = new SpriteBrush(icons.Add32),
Offsets = new Margin(-buttonSize - 2 + rightKey.Offsets.Left, buttonSize, buttonSize * -0.5f, buttonSize),
Offsets = new Margin(-addSize - 2 + rightKey.Offsets.Left, addSize, addSize * -0.5f, addSize),
Parent = this,
};
addKey.Clicked += OnAddKeyClicked;
@@ -349,7 +350,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
Color = Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(icons.Left32),
Offsets = new Margin(-buttonSize - 2 + addKey.Offsets.Left, buttonSize, buttonSize * -0.5f, buttonSize),
Offsets = new Margin(-keySize - 2 + addKey.Offsets.Left, keySize, keySize * -0.5f, keySize),
Parent = this,
};
leftKey.Clicked += OnLeftKeyClicked;

View File

@@ -682,10 +682,10 @@ namespace FlaxEditor.GUI.Timeline.Tracks
public CameraCutTrack(ref TrackCreateOptions options)
: base(ref options)
{
Height = CameraCutThumbnailRenderer.Height + 4 + 4;
Height = CameraCutThumbnailRenderer.Height + 8;
// Pilot Camera button
const float buttonSize = 14;
const float buttonSize = 18;
var icons = Editor.Instance.Icons;
_pilotCamera = new Image
{
@@ -695,7 +695,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
IsScrollable = false,
Color = Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(icons.Camera64),
Brush = new SpriteBrush(icons.CameraFill32),
Offsets = new Margin(-buttonSize - 2 + _selectActor.Offsets.Left, buttonSize, buttonSize * -0.5f, buttonSize),
Parent = this,
};

View File

@@ -24,7 +24,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
{
TypeId = 1,
Name = "Folder",
Icon = Editor.Instance.Icons.Folder64,
Icon = Editor.Instance.Icons.Folder32,
Create = options => new FolderTrack(ref options),
Load = LoadTrack,
Save = SaveTrack,

View File

@@ -118,7 +118,8 @@ namespace FlaxEditor.GUI.Timeline.Tracks
if (useNavigationButtons)
{
// Navigation buttons
const float buttonSize = 14;
const float keySize = 18;
const float addSize = 20;
var icons = Editor.Instance.Icons;
_rightKey = new Image
{
@@ -128,8 +129,8 @@ namespace FlaxEditor.GUI.Timeline.Tracks
IsScrollable = false,
Color = Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(icons.Right64),
Offsets = new Margin(-buttonSize - 2 + uiLeft, buttonSize, buttonSize * -0.5f, buttonSize),
Brush = new SpriteBrush(icons.Right32),
Offsets = new Margin(-keySize - 2 + uiLeft, keySize, keySize * -0.5f, keySize),
Parent = this,
};
_addKey = new Image
@@ -138,10 +139,10 @@ namespace FlaxEditor.GUI.Timeline.Tracks
AutoFocus = true,
AnchorPreset = AnchorPresets.MiddleRight,
IsScrollable = false,
Color = Style.Current.Foreground,
Color = Style.Current.ForegroundGrey,
Margin = new Margin(3),
Brush = new SpriteBrush(icons.Add64),
Offsets = new Margin(-buttonSize - 2 + _rightKey.Offsets.Left, buttonSize, buttonSize * -0.5f, buttonSize),
Brush = new SpriteBrush(icons.Add32),
Offsets = new Margin(-addSize - 2 + _rightKey.Offsets.Left, addSize, addSize * -0.5f, addSize),
Parent = this,
};
_leftKey = new Image
@@ -150,10 +151,10 @@ namespace FlaxEditor.GUI.Timeline.Tracks
AutoFocus = true,
AnchorPreset = AnchorPresets.MiddleRight,
IsScrollable = false,
Color = Style.Current.Foreground,
Color = Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(icons.Left64),
Offsets = new Margin(-buttonSize - 2 + _addKey.Offsets.Left, buttonSize, buttonSize * -0.5f, buttonSize),
Brush = new SpriteBrush(icons.Left32),
Offsets = new Margin(-keySize - 2 + _addKey.Offsets.Left, keySize, keySize * -0.5f, keySize),
Parent = this,
};
uiLeft = _leftKey.Offsets.Left;

View File

@@ -936,23 +936,26 @@ namespace FlaxEditor.Modules
Proxy.Add(new SettingsProxy(typeof(PhysicsSettings), Editor.Instance.Icons.PhysicsSettings128));
Proxy.Add(new SettingsProxy(typeof(GraphicsSettings), Editor.Instance.Icons.GraphicsSettings128));
Proxy.Add(new SettingsProxy(typeof(NavigationSettings), Editor.Instance.Icons.NavigationSettings128));
Proxy.Add(new SettingsProxy(typeof(LocalizationSettings), Editor.Instance.Icons.Document128));
Proxy.Add(new SettingsProxy(typeof(LocalizationSettings), Editor.Instance.Icons.LocalizationSettings128));
Proxy.Add(new SettingsProxy(typeof(AudioSettings), Editor.Instance.Icons.AudioSettings128));
Proxy.Add(new SettingsProxy(typeof(BuildSettings), Editor.Instance.Icons.BuildSettings128));
Proxy.Add(new SettingsProxy(typeof(InputSettings), Editor.Instance.Icons.InputSettings128));
Proxy.Add(new SettingsProxy(typeof(WindowsPlatformSettings), Editor.Instance.Icons.WindowsSettings128));
Proxy.Add(new SettingsProxy(typeof(UWPPlatformSettings), Editor.Instance.Icons.UWPSettings128));
Proxy.Add(new SettingsProxy(typeof(LinuxPlatformSettings), Editor.Instance.Icons.LinuxSettings128));
Proxy.Add(new SettingsProxy(typeof(AndroidPlatformSettings), Editor.Instance.Icons.AndroidSettings128));
var typePS4PlatformSettings = TypeUtils.GetManagedType(GameSettings.PS4PlatformSettingsTypename);
if (typePS4PlatformSettings != null)
Proxy.Add(new SettingsProxy(typePS4PlatformSettings, Editor.Instance.Icons.PlaystationSettings128));
var typeXboxScarlettPlatformSettings = TypeUtils.GetManagedType(GameSettings.XboxScarlettPlatformSettingsTypename);
if (typeXboxScarlettPlatformSettings != null)
Proxy.Add(new SettingsProxy(typeXboxScarlettPlatformSettings, Editor.Instance.Icons.XBoxScarletIcon128));
Proxy.Add(new SettingsProxy(typeof(AndroidPlatformSettings), Editor.Instance.Icons.AndroidSettings128));
var typeSwitchPlatformSettings = TypeUtils.GetManagedType(GameSettings.SwitchPlatformSettingsTypename);
if (typeSwitchPlatformSettings != null)
Proxy.Add(new SettingsProxy(typeSwitchPlatformSettings, Editor.Instance.Icons.Document128));
Proxy.Add(new SettingsProxy(typeof(AudioSettings), Editor.Instance.Icons.AudioSettings128));
Proxy.Add(new SettingsProxy(typeSwitchPlatformSettings, Editor.Instance.Icons.SwitchSettings128));
// Last add generic json (won't override other json proxies)
Proxy.Add(new GenericJsonAssetProxy());

View File

@@ -48,7 +48,7 @@ namespace FlaxEditor.Surface
/// <summary>
/// The box size (with and height).
/// </summary>
public const float BoxSize = 16.0f;
public const float BoxSize = 20.0f;
/// <summary>
/// The node layout offset on the y axis (height of the boxes rows, etc.). It's used to make the design more consistent.

View File

@@ -167,6 +167,8 @@ namespace FlaxEditor.Windows.Assets
/// <inheritdoc />
public override DisplayStyle Style => DisplayStyle.InlineIntoParent;
private Control _overrideButton;
/// <inheritdoc />
public override void Initialize(LayoutElementsContainer layout)
{
@@ -178,6 +180,21 @@ namespace FlaxEditor.Windows.Assets
var group = layout.Group("Functions");
var nodes = window.VisjectSurface.Nodes;
var grid = group.CustomContainer<UniformGridPanel>();
var gridControl = grid.CustomControl;
gridControl.ClipChildren = false;
gridControl.Height = Button.DefaultHeight;
gridControl.SlotsHorizontally = 2;
gridControl.SlotsVertically = 1;
var addOverride = grid.Button("Add Override");
addOverride.Button.Clicked += OnOverrideMethodClicked;
// TODO: Add sender arg to button clicked action?
_overrideButton = addOverride.Control;
var addFuncction = grid.Button("Add Function");
addFuncction.Button.Clicked += OnAddNewFunctionClicked;
// List of functions in the graph
for (int i = 0; i < nodes.Count; i++)
{
@@ -192,60 +209,20 @@ namespace FlaxEditor.Windows.Assets
}
else if (node is Surface.Archetypes.Function.MethodOverrideNode overrideNode)
{
var label = group.ClickableLabel(overrideNode.Title + " (override)").CustomControl;
var label = group.ClickableLabel($"{overrideNode.Title} (override)").CustomControl;
label.TextColorHighlighted = Color.FromBgra(0xFFA0A0A0);
label.TooltipText = overrideNode.TooltipText;
label.DoubleClick += () => ((VisualScriptWindow)Values[0]).Surface.FocusNode(overrideNode);
label.RightClick += () => ShowContextMenu(overrideNode, label);
}
}
// New function button
const float groupPanelButtonSize = 14;
var addNewFunction = new Image
{
TooltipText = "Add new function",
AutoFocus = true,
AnchorPreset = AnchorPresets.TopRight,
Parent = group.Panel,
Bounds = new Rectangle(group.Panel.Width - groupPanelButtonSize, 0, groupPanelButtonSize, groupPanelButtonSize),
IsScrollable = false,
Color = FlaxEngine.GUI.Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(Editor.Instance.Icons.Add64),
};
addNewFunction.Clicked += OnAddNewFunctionClicked;
// Override method button
var overrideMethod = new Image
{
TooltipText = "Override method",
AutoFocus = true,
AnchorPreset = AnchorPresets.TopRight,
Parent = group.Panel,
Bounds = new Rectangle(group.Panel.Width - groupPanelButtonSize * 2, 0, groupPanelButtonSize, groupPanelButtonSize),
IsScrollable = false,
Color = FlaxEngine.GUI.Style.Current.ForegroundGrey,
Margin = new Margin(1),
Brush = new SpriteBrush(Editor.Instance.Icons.Import64),
};
overrideMethod.Clicked += OnOverrideMethodClicked;
}
private void OnAddNewFunctionClicked(Image image, MouseButton button)
{
if (button != MouseButton.Left)
return;
var surface = ((VisualScriptWindow)Values[0]).Surface;
var surfaceBounds = surface.AllNodesBounds;
surface.ShowArea(new Rectangle(surfaceBounds.BottomLeft, new Vector2(200, 150)).MakeExpanded(400.0f));
var node = surface.Context.SpawnNode(16, 6, surfaceBounds.BottomLeft + new Vector2(0, 50));
surface.Select(node);
}
private void ShowContextMenu(SurfaceNode node, ClickableLabel label)
{
// TODO: Execute only on "Edit Signature...", this makes the "Show" button useless
((VisualScriptWindow)Values[0]).Surface.FocusNode(node);
var cm = new ContextMenu();
cm.AddButton("Show", () => ((VisualScriptWindow)Values[0]).Surface.FocusNode(node)).Icon = Editor.Instance.Icons.Search12;
cm.AddButton("Delete", () => ((VisualScriptWindow)Values[0]).Surface.Delete(node)).Icon = Editor.Instance.Icons.Cross12;
@@ -253,11 +230,17 @@ namespace FlaxEditor.Windows.Assets
cm.Show(label, new Vector2(0, label.Height));
}
private void OnOverrideMethodClicked(Image image, MouseButton button)
private void OnAddNewFunctionClicked()
{
if (button != MouseButton.Left)
return;
var surface = ((VisualScriptWindow)Values[0]).Surface;
var surfaceBounds = surface.AllNodesBounds;
surface.ShowArea(new Rectangle(surfaceBounds.BottomLeft, new Vector2(200, 150)).MakeExpanded(400.0f));
var node = surface.Context.SpawnNode(16, 6, surfaceBounds.BottomLeft + new Vector2(0, 50));
surface.Select(node);
}
private void OnOverrideMethodClicked()
{
var cm = new ContextMenu();
var window = (VisualScriptWindow)Values[0];
var scriptMeta = window.Asset.Meta;
@@ -310,7 +293,7 @@ namespace FlaxEditor.Windows.Assets
{
cm.AddButton("Nothing to override");
}
cm.Show(image, new Vector2(0, image.Height));
cm.Show(_overrideButton, new Vector2(0, _overrideButton.Height));
}
}

View File

@@ -66,7 +66,7 @@ namespace FlaxEditor.Windows
: base(editor, true, ScrollBars.None)
{
Title = "Content";
Icon = editor.Icons.Folder64;
Icon = editor.Icons.Folder32;
// Content database events
editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true;

View File

@@ -312,9 +312,9 @@ namespace FlaxEditor.Windows
_clearOnPlayButton = (ToolStripButton)toolstrip.AddButton("Clear on Play").SetAutoCheck(true).SetChecked(true).LinkTooltip("Clears all log entries on enter playmode");
_pauseOnErrorButton = (ToolStripButton)toolstrip.AddButton("Pause on Error").SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
toolstrip.AddSeparator();
_groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error64, () => UpdateLogTypeVisibility(LogGroup.Error, _groupButtons[0].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides error messages");
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning64, () => UpdateLogTypeVisibility(LogGroup.Warning, _groupButtons[1].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides warning messages");
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info64, () => UpdateLogTypeVisibility(LogGroup.Info, _groupButtons[2].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides info messages");
_groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () => UpdateLogTypeVisibility(LogGroup.Error, _groupButtons[0].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides error messages");
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => UpdateLogTypeVisibility(LogGroup.Warning, _groupButtons[1].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides warning messages");
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => UpdateLogTypeVisibility(LogGroup.Info, _groupButtons[2].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides info messages");
UpdateCount();
// Split panel
@@ -387,10 +387,10 @@ namespace FlaxEditor.Windows
switch (_timestampsFormats)
{
case InterfaceOptions.TimestampsFormats.Utc:
desc.Title = string.Format("[{0}] ", DateTime.UtcNow) + desc.Title;
desc.Title = $"[{DateTime.UtcNow}] {desc.Title}";
break;
case InterfaceOptions.TimestampsFormats.LocalTime:
desc.Title = string.Format("[{0}] ", DateTime.Now) + desc.Title;
desc.Title = $"[{DateTime.Now}] {desc.Title}";
break;
case InterfaceOptions.TimestampsFormats.TimeSinceStartup:
desc.Title = string.Format("[{0:g}] ", TimeSpan.FromSeconds(Time.TimeSinceStartup)) + desc.Title;
@@ -480,15 +480,15 @@ namespace FlaxEditor.Windows
{
if (_iconType == LogType.Warning)
{
Icon = IconWarning;
Icon = Editor.Icons.Warning32;
}
else if (_iconType == LogType.Error)
{
Icon = IconError;
Icon = Editor.Icons.Error32;
}
else
{
Icon = IconInfo;
Icon = Editor.Icons.Info32;
}
}