Cleanup 1
This commit is contained in:
@@ -78,8 +78,10 @@ namespace FlaxEditor.Content
|
||||
if (actor == null)
|
||||
{
|
||||
// Create default prefab root object
|
||||
actor = new EmptyActor();
|
||||
actor.Name = "Root";
|
||||
actor = new EmptyActor
|
||||
{
|
||||
Name = "Root"
|
||||
};
|
||||
|
||||
// Cleanup it after usage
|
||||
Object.Destroy(actor, 20.0f);
|
||||
|
||||
@@ -120,9 +120,8 @@ namespace FlaxEditor.Content
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryFilterHelper.Range[] ranges;
|
||||
var text = Text;
|
||||
if (QueryFilterHelper.Match(filterText, text, out ranges))
|
||||
if (QueryFilterHelper.Match(filterText, text, out QueryFilterHelper.Range[] ranges))
|
||||
{
|
||||
// Update highlights
|
||||
if (_highlights == null)
|
||||
|
||||
@@ -70,8 +70,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var scriptsMember = type.GetProperty("Scripts");
|
||||
if (scriptsMember != ScriptMemberInfo.Null)
|
||||
{
|
||||
var item = new ItemInfo(scriptsMember);
|
||||
item.CustomEditor = new CustomEditorAttribute(typeof(ScriptsEditor));
|
||||
var item = new ItemInfo(scriptsMember)
|
||||
{
|
||||
CustomEditor = new CustomEditorAttribute(typeof(ScriptsEditor))
|
||||
};
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
@@ -232,9 +234,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
|
||||
private TreeNode CreateDiffNode(CustomEditor editor)
|
||||
{
|
||||
var node = new TreeNode(false);
|
||||
|
||||
node.Tag = editor;
|
||||
var node = new TreeNode(false)
|
||||
{
|
||||
Tag = editor
|
||||
};
|
||||
|
||||
// Removed Script
|
||||
if (editor is RemovedScriptDummy removed)
|
||||
|
||||
@@ -493,8 +493,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
|
||||
var index = (int)image.Tag;
|
||||
|
||||
var cm = new ContextMenu();
|
||||
cm.Tag = index;
|
||||
var cm = new ContextMenu
|
||||
{
|
||||
Tag = index
|
||||
};
|
||||
cm.AddButton("Remove", OnClickMissingRemove);
|
||||
cm.Show(image, image.Size);
|
||||
}
|
||||
@@ -746,8 +748,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var scriptType = TypeUtils.GetType(script.TypeName);
|
||||
var item = scriptType.ContentItem;
|
||||
|
||||
var cm = new ContextMenu();
|
||||
cm.Tag = script;
|
||||
var cm = new ContextMenu
|
||||
{
|
||||
Tag = script
|
||||
};
|
||||
cm.AddButton("Remove", OnClickRemove).Icon = Editor.Instance.Icons.Cross12;
|
||||
cm.AddButton("Move up", OnClickMoveUp).Enabled = script.OrderInParent > 0;
|
||||
cm.AddButton("Move down", OnClickMoveDown).Enabled = script.OrderInParent < script.Actor.Scripts.Length - 1;
|
||||
|
||||
@@ -21,8 +21,10 @@ namespace FlaxEditor.CustomEditors.Elements
|
||||
/// </summary>
|
||||
public LabelElement()
|
||||
{
|
||||
Label = new Label(0, 0, 100, 18);
|
||||
Label.HorizontalAlignment = TextAlignment.Near;
|
||||
Label = new Label(0, 0, 100, 18)
|
||||
{
|
||||
HorizontalAlignment = TextAlignment.Near
|
||||
};
|
||||
// TODO: auto height for label
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +193,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
SortButtons();
|
||||
return item;
|
||||
}
|
||||
@@ -207,8 +209,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, string shortKeys)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text, shortKeys);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text, shortKeys)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
SortButtons();
|
||||
return item;
|
||||
}
|
||||
@@ -221,8 +225,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, Action clicked)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
item.Clicked += clicked;
|
||||
SortButtons();
|
||||
return item;
|
||||
@@ -236,8 +242,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, Action<ContextMenuButton> clicked)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
item.ButtonClicked += clicked;
|
||||
SortButtons();
|
||||
return item;
|
||||
@@ -252,8 +260,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuButton AddButton(string text, string shortKeys, Action clicked)
|
||||
{
|
||||
var item = new ContextMenuButton(this, text, shortKeys);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuButton(this, text, shortKeys)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
item.Clicked += clicked;
|
||||
SortButtons();
|
||||
return item;
|
||||
@@ -285,8 +295,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
var item = GetChildMenu(text);
|
||||
if (item == null)
|
||||
{
|
||||
item = new ContextMenuChildMenu(this, text);
|
||||
item.Parent = _panel;
|
||||
item = new ContextMenuChildMenu(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
}
|
||||
|
||||
return item;
|
||||
@@ -299,8 +311,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuChildMenu AddChildMenu(string text)
|
||||
{
|
||||
var item = new ContextMenuChildMenu(this, text);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuChildMenu(this, text)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -310,8 +324,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// <returns>Created context menu item control.</returns>
|
||||
public ContextMenuSeparator AddSeparator()
|
||||
{
|
||||
var item = new ContextMenuSeparator(this);
|
||||
item.Parent = _panel;
|
||||
var item = new ContextMenuSeparator(this)
|
||||
{
|
||||
Parent = _panel
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,53 +113,71 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
_onClosed = pickerClosed;
|
||||
|
||||
// Selector
|
||||
_cSelector = new ColorSelectorWithSliders(180, 18);
|
||||
_cSelector.Location = new Vector2(PickerMargin, PickerMargin);
|
||||
_cSelector = new ColorSelectorWithSliders(180, 18)
|
||||
{
|
||||
Location = new Vector2(PickerMargin, PickerMargin),
|
||||
Parent = this
|
||||
};
|
||||
_cSelector.ColorChanged += x => SelectedColor = x;
|
||||
_cSelector.Parent = this;
|
||||
|
||||
// Red
|
||||
_cRed = new FloatValueBox(0, _cSelector.Right + PickerMargin + RGBAMargin + ChannelTextWidth, PickerMargin, 100, 0, float.MaxValue, 0.001f);
|
||||
_cRed = new FloatValueBox(0, _cSelector.Right + PickerMargin + RGBAMargin + ChannelTextWidth, PickerMargin, 100, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cRed.ValueChanged += OnRGBAChanged;
|
||||
_cRed.Parent = this;
|
||||
|
||||
// Green
|
||||
_cGreen = new FloatValueBox(0, _cRed.X, _cRed.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f);
|
||||
_cGreen = new FloatValueBox(0, _cRed.X, _cRed.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cGreen.ValueChanged += OnRGBAChanged;
|
||||
_cGreen.Parent = this;
|
||||
|
||||
// Blue
|
||||
_cBlue = new FloatValueBox(0, _cRed.X, _cGreen.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f);
|
||||
_cBlue = new FloatValueBox(0, _cRed.X, _cGreen.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cBlue.ValueChanged += OnRGBAChanged;
|
||||
_cBlue.Parent = this;
|
||||
|
||||
// Alpha
|
||||
_cAlpha = new FloatValueBox(0, _cRed.X, _cBlue.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f);
|
||||
_cAlpha = new FloatValueBox(0, _cRed.X, _cBlue.Bottom + ChannelsMargin, _cRed.Width, 0, float.MaxValue, 0.001f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cAlpha.ValueChanged += OnRGBAChanged;
|
||||
_cAlpha.Parent = this;
|
||||
|
||||
// Hue
|
||||
_cHue = new FloatValueBox(0, PickerMargin + HSVMargin + ChannelTextWidth, _cSelector.Bottom + PickerMargin, 100, 0, 360);
|
||||
_cHue = new FloatValueBox(0, PickerMargin + HSVMargin + ChannelTextWidth, _cSelector.Bottom + PickerMargin, 100, 0, 360)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cHue.ValueChanged += OnHSVChanged;
|
||||
_cHue.Parent = this;
|
||||
|
||||
// Saturation
|
||||
_cSaturation = new FloatValueBox(0, _cHue.X, _cHue.Bottom + ChannelsMargin, _cHue.Width, 0, 100.0f, 0.1f);
|
||||
_cSaturation = new FloatValueBox(0, _cHue.X, _cHue.Bottom + ChannelsMargin, _cHue.Width, 0, 100.0f, 0.1f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cSaturation.ValueChanged += OnHSVChanged;
|
||||
_cSaturation.Parent = this;
|
||||
|
||||
// Value
|
||||
_cValue = new FloatValueBox(0, _cHue.X, _cSaturation.Bottom + ChannelsMargin, _cHue.Width, 0, float.MaxValue, 0.1f);
|
||||
_cValue = new FloatValueBox(0, _cHue.X, _cSaturation.Bottom + ChannelsMargin, _cHue.Width, 0, float.MaxValue, 0.1f)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cValue.ValueChanged += OnHSVChanged;
|
||||
_cValue.Parent = this;
|
||||
|
||||
// Set valid dialog size based on UI content
|
||||
_dialogSize = Size = new Vector2(_cRed.Right + PickerMargin, 300);
|
||||
|
||||
// Hex
|
||||
const float hexTextBoxWidth = 80;
|
||||
_cHex = new TextBox(false, Width - hexTextBoxWidth - PickerMargin, _cSelector.Bottom + PickerMargin, hexTextBoxWidth);
|
||||
_cHex.Parent = this;
|
||||
_cHex = new TextBox(false, Width - hexTextBoxWidth - PickerMargin, _cSelector.Bottom + PickerMargin, hexTextBoxWidth)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_cHex.EditEnd += OnHexChanged;
|
||||
|
||||
// Cancel
|
||||
|
||||
@@ -597,8 +597,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
if (_tabsProxy == null)
|
||||
{
|
||||
// Create proxy and make set simple full dock
|
||||
_tabsProxy = new DockPanelProxy(this);
|
||||
_tabsProxy.Parent = this;
|
||||
_tabsProxy = new DockPanelProxy(this)
|
||||
{
|
||||
Parent = this
|
||||
};
|
||||
_tabsProxy.UnlockChildrenRecursive();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,8 +496,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
|
||||
private void ShowContextMenu(DockWindow tab, ref Vector2 location)
|
||||
{
|
||||
var menu = new ContextMenu.ContextMenu();
|
||||
menu.Tag = tab;
|
||||
var menu = new ContextMenu.ContextMenu
|
||||
{
|
||||
Tag = tab
|
||||
};
|
||||
tab.OnShowContextMenu(menu);
|
||||
menu.AddButton("Close", OnTabMenuCloseClicked);
|
||||
menu.AddButton("Close All", OnTabMenuCloseAllClicked);
|
||||
|
||||
@@ -41,13 +41,19 @@ namespace FlaxEditor.GUI
|
||||
// Buttons
|
||||
float buttonsWidth = (width - 6.0f) * 0.5f;
|
||||
float buttonsHeight = 20.0f;
|
||||
var revertAll = new Button(2.0f, 2.0f, buttonsWidth, buttonsHeight);
|
||||
revertAll.Text = "Revert All";
|
||||
revertAll.Parent = this;
|
||||
|
||||
var revertAll = new Button(2.0f, 2.0f, buttonsWidth, buttonsHeight)
|
||||
{
|
||||
Text = "Revert All",
|
||||
Parent = this
|
||||
};
|
||||
revertAll.Clicked += OnRevertAllClicked;
|
||||
var applyAll = new Button(revertAll.Right + 2.0f, 2.0f, buttonsWidth, buttonsHeight);
|
||||
applyAll.Text = "Apply All";
|
||||
applyAll.Parent = this;
|
||||
|
||||
var applyAll = new Button(revertAll.Right + 2.0f, 2.0f, buttonsWidth, buttonsHeight)
|
||||
{
|
||||
Text = "Apply All",
|
||||
Parent = this
|
||||
};
|
||||
applyAll.Clicked += OnApplyAllClicked;
|
||||
|
||||
// Actual panel
|
||||
@@ -56,6 +62,7 @@ namespace FlaxEditor.GUI
|
||||
Bounds = new Rectangle(0, applyAll.Bottom + 2.0f, Width, Height - applyAll.Bottom - 2.0f),
|
||||
Parent = this
|
||||
};
|
||||
|
||||
Tree = new Tree.Tree
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchTop,
|
||||
|
||||
@@ -72,8 +72,11 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
{
|
||||
var time = stream.ReadSingle();
|
||||
|
||||
var key = new EventKey();
|
||||
key.Parameters = new object[paramsCount];
|
||||
var key = new EventKey
|
||||
{
|
||||
Parameters = new object[paramsCount]
|
||||
};
|
||||
|
||||
for (int j = 0; j < paramsCount; j++)
|
||||
{
|
||||
stream.Read(dataBuffer, 0, e.EventParamsSizes[j]);
|
||||
@@ -316,8 +319,11 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
}
|
||||
|
||||
// Build default value
|
||||
var defaultValue = new EventKey();
|
||||
defaultValue.Parameters = new object[EventParamsTypes.Length];
|
||||
var defaultValue = new EventKey
|
||||
{
|
||||
Parameters = new object[EventParamsTypes.Length]
|
||||
};
|
||||
|
||||
for (int i = 0; i < EventParamsTypes.Length; i++)
|
||||
defaultValue.Parameters[i] = Activator.CreateInstance(EventParamsTypes[i]);
|
||||
Events.DefaultValue = defaultValue;
|
||||
|
||||
@@ -89,13 +89,11 @@ namespace FlaxEngine.GUI
|
||||
/// <exception cref="System.ArgumentNullException">Invalid task.</exception>
|
||||
public RenderOutputControl(SceneRenderTask task)
|
||||
{
|
||||
if (task == null)
|
||||
throw new ArgumentNullException();
|
||||
_task = task ?? throw new ArgumentNullException();
|
||||
|
||||
_backBuffer = GPUDevice.Instance.CreateTexture();
|
||||
_resizeTime = ResizeCheckTime;
|
||||
|
||||
_task = task;
|
||||
_task.Output = _backBuffer;
|
||||
_task.End += OnEnd;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user