Merge branch 'master' into 1.5
# Conflicts: # Content/Shaders/GI/DDGI.flax # Content/Shaders/GI/GlobalSurfaceAtlas.flax # Content/Shaders/TAA.flax # Content/Shaders/VolumetricFog.flax # Source/Editor/Utilities/Utils.cs
This commit is contained in:
BIN
Content/Shaders/AtmospherePreCompute.flax
(Stored with Git LFS)
BIN
Content/Shaders/AtmospherePreCompute.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/BakeLightmap.flax
(Stored with Git LFS)
BIN
Content/Shaders/BakeLightmap.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/BitonicSort.flax
(Stored with Git LFS)
BIN
Content/Shaders/BitonicSort.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/ColorGrading.flax
(Stored with Git LFS)
BIN
Content/Shaders/ColorGrading.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/DebugDraw.flax
(Stored with Git LFS)
BIN
Content/Shaders/DebugDraw.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Editor/LightmapUVsDensity.flax
(Stored with Git LFS)
BIN
Content/Shaders/Editor/LightmapUVsDensity.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Editor/MaterialComplexity.flax
(Stored with Git LFS)
BIN
Content/Shaders/Editor/MaterialComplexity.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Editor/QuadOverdraw.flax
(Stored with Git LFS)
BIN
Content/Shaders/Editor/QuadOverdraw.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Editor/VertexColors.flax
(Stored with Git LFS)
BIN
Content/Shaders/Editor/VertexColors.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/EyeAdaptation.flax
(Stored with Git LFS)
BIN
Content/Shaders/EyeAdaptation.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/FXAA.flax
(Stored with Git LFS)
BIN
Content/Shaders/FXAA.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Fog.flax
(Stored with Git LFS)
BIN
Content/Shaders/Fog.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Forward.flax
(Stored with Git LFS)
BIN
Content/Shaders/Forward.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/GBuffer.flax
(Stored with Git LFS)
BIN
Content/Shaders/GBuffer.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/GPUParticlesSorting.flax
(Stored with Git LFS)
BIN
Content/Shaders/GPUParticlesSorting.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/GUI.flax
(Stored with Git LFS)
BIN
Content/Shaders/GUI.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/GlobalSignDistanceField.flax
(Stored with Git LFS)
BIN
Content/Shaders/GlobalSignDistanceField.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Histogram.flax
(Stored with Git LFS)
BIN
Content/Shaders/Histogram.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Lights.flax
(Stored with Git LFS)
BIN
Content/Shaders/Lights.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/MotionBlur.flax
(Stored with Git LFS)
BIN
Content/Shaders/MotionBlur.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/MultiScaler.flax
(Stored with Git LFS)
BIN
Content/Shaders/MultiScaler.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/PostProcessing.flax
(Stored with Git LFS)
BIN
Content/Shaders/PostProcessing.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/ProbesFilter.flax
(Stored with Git LFS)
BIN
Content/Shaders/ProbesFilter.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Quad.flax
(Stored with Git LFS)
BIN
Content/Shaders/Quad.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Reflections.flax
(Stored with Git LFS)
BIN
Content/Shaders/Reflections.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/SMAA.flax
(Stored with Git LFS)
BIN
Content/Shaders/SMAA.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/SSAO.flax
(Stored with Git LFS)
BIN
Content/Shaders/SSAO.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Shadows.flax
(Stored with Git LFS)
BIN
Content/Shaders/Shadows.flax
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Shaders/Sky.flax
(Stored with Git LFS)
BIN
Content/Shaders/Sky.flax
(Stored with Git LFS)
Binary file not shown.
@@ -95,19 +95,17 @@ namespace FlaxEditor.Content
|
||||
{
|
||||
if (!_folder.CanRename)
|
||||
return;
|
||||
Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(false);
|
||||
|
||||
// Start renaming the folder
|
||||
var dialog = RenamePopup.Show(this, HeaderRect, _folder.ShortName, false);
|
||||
Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(false);
|
||||
var dialog = RenamePopup.Show(this, TextRect, _folder.ShortName, false);
|
||||
dialog.Tag = _folder;
|
||||
dialog.Renamed += popup =>
|
||||
{
|
||||
Editor.Instance.Windows.ContentWin.Rename((ContentFolder)popup.Tag, popup.Text);
|
||||
Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(true);
|
||||
};
|
||||
dialog.Closed += popup =>
|
||||
{
|
||||
Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(true);
|
||||
};
|
||||
dialog.Closed += popup => { Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(true); };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
cm.ItemClicked += item => AddScript((ScriptType)item.Tag);
|
||||
cm.SortItems();
|
||||
cm.Show(this, button.BottomLeft);
|
||||
cm.Show(this, button.BottomLeft - new Float2((cm.Width - button.Width) / 2, 0));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -407,6 +407,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
public class UIControlControlEditor : GenericEditor
|
||||
{
|
||||
private Type _cachedType;
|
||||
private bool _anchorDropDownClosed = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(LayoutElementsContainer layout)
|
||||
@@ -498,7 +499,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
ItemInfo maxItem = new ItemInfo(maxInfo);
|
||||
|
||||
GroupElement ng = main.Group("Anchors", true);
|
||||
ng.Panel.Close(false);
|
||||
ng.Panel.IsClosed = _anchorDropDownClosed;
|
||||
ng.Panel.IsClosedChanged += panel => _anchorDropDownClosed = panel.IsClosed;
|
||||
ng.Property("Min", minItem.GetValues(Values));
|
||||
ng.Property("Max", maxItem.GetValues(Values));
|
||||
}
|
||||
|
||||
56
Source/Editor/GUI/Input/SearchBox.cs
Normal file
56
Source/Editor/GUI/Input/SearchBox.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.GUI.Input
|
||||
{
|
||||
/// <summary>
|
||||
/// Search box control which can gather text search input from the user.
|
||||
/// </summary>
|
||||
public class SearchBox : TextBox
|
||||
{
|
||||
/// <summary>
|
||||
/// A button that clears the search bar.
|
||||
/// </summary>
|
||||
public Button ClearSearchButton { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Init search box
|
||||
/// </summary>
|
||||
public SearchBox()
|
||||
: this(false, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init search box
|
||||
/// </summary>
|
||||
public SearchBox(bool isMultiline, float x, float y, float width = 120)
|
||||
: base(isMultiline, x, y, width)
|
||||
{
|
||||
WatermarkText = "Search...";
|
||||
|
||||
ClearSearchButton = new Button
|
||||
{
|
||||
Parent = this,
|
||||
Width = 14.0f,
|
||||
Height = 14.0f,
|
||||
AnchorPreset = AnchorPresets.TopRight,
|
||||
Text = "",
|
||||
TooltipText = "Cancel Search.",
|
||||
BackgroundColor = TextColor,
|
||||
BorderColor = Color.Transparent,
|
||||
BackgroundColorHighlighted = Style.Current.ForegroundGrey,
|
||||
BorderColorHighlighted = Color.Transparent,
|
||||
BackgroundColorSelected = Style.Current.ForegroundGrey,
|
||||
BorderColorSelected = Color.Transparent,
|
||||
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Cross12),
|
||||
Visible = false,
|
||||
};
|
||||
ClearSearchButton.LocalY += 2;
|
||||
ClearSearchButton.LocalX -= 2;
|
||||
ClearSearchButton.Clicked += Clear;
|
||||
|
||||
TextChanged += () => ClearSearchButton.Visible = !string.IsNullOrEmpty(Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,6 +173,7 @@ namespace FlaxEditor.GUI.Input
|
||||
private void EndSliding()
|
||||
{
|
||||
_isSliding = false;
|
||||
EndEditOnClick = true;
|
||||
EndMouseCapture();
|
||||
if (_cursorChanged)
|
||||
{
|
||||
@@ -245,6 +246,7 @@ namespace FlaxEditor.GUI.Input
|
||||
_startSlideLocation = location;
|
||||
_startSlideValue = _value;
|
||||
StartMouseCapture(true);
|
||||
EndEditOnClick = false;
|
||||
|
||||
// Hide cursor and cache location
|
||||
Cursor = CursorType.Hidden;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.Utilities;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -204,11 +205,10 @@ namespace FlaxEditor.GUI
|
||||
Size = new Float2(width, height);
|
||||
|
||||
// Search box
|
||||
_searchBox = new TextBox(false, 1, 1)
|
||||
_searchBox = new SearchBox(false, 1, 1)
|
||||
{
|
||||
Parent = this,
|
||||
Width = Width - 3,
|
||||
WatermarkText = "Search...",
|
||||
};
|
||||
_searchBox.TextChanged += OnSearchFilterChanged;
|
||||
|
||||
|
||||
@@ -741,7 +741,9 @@ namespace FlaxEditor.Modules
|
||||
return;
|
||||
|
||||
// Find layout to use
|
||||
var searchFolder = Globals.ProjectCacheFolder;
|
||||
var searchFolder = StringUtils.CombinePaths(Editor.LocalCachePath, "LayoutsCache");
|
||||
if (!Directory.Exists(searchFolder))
|
||||
Directory.CreateDirectory(searchFolder);
|
||||
var files = Directory.GetFiles(searchFolder, "Layout_*.xml", SearchOption.TopDirectoryOnly);
|
||||
var layouts = _menuWindowApplyWindowLayout.ContextMenu;
|
||||
layouts.DisposeAllItems();
|
||||
@@ -749,8 +751,11 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
var file = files[i];
|
||||
var name = file.Substring(searchFolder.Length + 8, file.Length - searchFolder.Length - 12);
|
||||
var button = layouts.AddButton(name, OnApplyLayoutButtonClicked);
|
||||
button.Tag = file;
|
||||
var nameCM = layouts.AddChildMenu(name);
|
||||
var applyButton = nameCM.ContextMenu.AddButton("Apply", OnApplyLayoutButtonClicked);
|
||||
applyButton.TooltipText = "Applies the selected layout.";
|
||||
nameCM.ContextMenu.AddButton("Delete", () => File.Delete(file)).TooltipText = "Permanently deletes the selected layout.";
|
||||
applyButton.Tag = file;
|
||||
}
|
||||
_menuWindowApplyWindowLayout.Enabled = files.Length > 0;
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace FlaxEditor.Modules
|
||||
|
||||
base.OnSubmit();
|
||||
|
||||
var path = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "Layout_" + name + ".xml");
|
||||
var path = StringUtils.CombinePaths(Editor.LocalCachePath, "LayoutsCache", "Layout_" + name + ".xml");
|
||||
Editor.Instance.Windows.SaveLayout(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
(window as PrefabWindow).ScrollingOnTreeView(false);
|
||||
|
||||
// Start renaming the actor
|
||||
var dialog = RenamePopup.Show(this, HeaderRect, _actorNode.Name, false);
|
||||
var dialog = RenamePopup.Show(this, TextRect, _actorNode.Name, false);
|
||||
dialog.Renamed += OnRenamed;
|
||||
dialog.Closed += popup =>
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -128,10 +129,9 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
Size = new Float2(320, 220);
|
||||
|
||||
// Search box
|
||||
_searchBox = new TextBox(false, 1, 1)
|
||||
_searchBox = new SearchBox(false, 1, 1)
|
||||
{
|
||||
Width = Width - 3,
|
||||
WatermarkText = "Search...",
|
||||
Parent = this
|
||||
};
|
||||
_searchBox.TextChanged += OnSearchFilterChanged;
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
using FlaxEditor.SceneGraph;
|
||||
using FlaxEditor.Scripting;
|
||||
@@ -957,10 +958,9 @@ namespace FlaxEditor.Utilities
|
||||
{
|
||||
Size = new Float2(320, 220 + headerHeight),
|
||||
};
|
||||
searchBox = new TextBox(false, 1, headerHeight + 1)
|
||||
searchBox = new SearchBox(false, 1, headerHeight + 1)
|
||||
{
|
||||
Width = menu.Width - 3,
|
||||
WatermarkText = "Search...",
|
||||
Parent = menu,
|
||||
};
|
||||
var panel1 = new Panel(ScrollBars.Vertical)
|
||||
|
||||
@@ -93,6 +93,7 @@ namespace FlaxEditor.Windows
|
||||
"Stefan Brandmair",
|
||||
"Lukáš Jech",
|
||||
"Jean-Baptiste Perrier",
|
||||
"Chandler Cox",
|
||||
});
|
||||
authors.Sort();
|
||||
var authorsLabel = new Label(4, topParentControl.Bottom + 20, Width - 8, 70)
|
||||
|
||||
@@ -6,6 +6,7 @@ using FlaxEditor.Content;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEditor.Gizmo;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.SceneGraph;
|
||||
using FlaxEditor.Viewport;
|
||||
using FlaxEngine;
|
||||
@@ -124,10 +125,9 @@ namespace FlaxEditor.Windows.Assets
|
||||
IsScrollable = false,
|
||||
Offsets = new Margin(0, 0, 0, 18 + 6),
|
||||
};
|
||||
_searchBox = new TextBox
|
||||
_searchBox = new SearchBox()
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchMiddle,
|
||||
WatermarkText = "Search...",
|
||||
Parent = headerPanel,
|
||||
Bounds = new Rectangle(4, 4, headerPanel.Width - 8, 18),
|
||||
};
|
||||
|
||||
@@ -113,10 +113,9 @@ namespace FlaxEditor.Windows
|
||||
IsScrollable = false,
|
||||
Offsets = new Margin(0, 0, 0, 18 + 6),
|
||||
};
|
||||
_foldersSearchBox = new TextBox
|
||||
_foldersSearchBox = new SearchBox
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchMiddle,
|
||||
WatermarkText = "Search...",
|
||||
Parent = headerPanel,
|
||||
Bounds = new Rectangle(4, 4, headerPanel.Width - 8, 18),
|
||||
};
|
||||
@@ -149,10 +148,9 @@ namespace FlaxEditor.Windows
|
||||
Parent = _split.Panel2,
|
||||
};
|
||||
const float viewDropdownWidth = 50.0f;
|
||||
_itemsSearchBox = new TextBox
|
||||
_itemsSearchBox = new SearchBox
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchMiddle,
|
||||
WatermarkText = "Search...",
|
||||
Parent = contentItemsSearchPanel,
|
||||
Bounds = new Rectangle(viewDropdownWidth + 8, 4, contentItemsSearchPanel.Width - 12 - viewDropdownWidth, 18),
|
||||
};
|
||||
@@ -837,13 +835,20 @@ namespace FlaxEditor.Windows
|
||||
};
|
||||
_root.Expand(true);
|
||||
|
||||
// Add game project on top, plugins in the middle and engine at bottom
|
||||
_root.AddChild(Editor.ContentDatabase.Game);
|
||||
foreach (var project in Editor.ContentDatabase.Projects)
|
||||
{
|
||||
project.SortChildrenRecursive();
|
||||
if (project == Editor.ContentDatabase.Game || project == Editor.ContentDatabase.Engine)
|
||||
continue;
|
||||
_root.AddChild(project);
|
||||
}
|
||||
_root.AddChild(Editor.ContentDatabase.Engine);
|
||||
|
||||
Editor.ContentDatabase.Game?.Expand(true);
|
||||
_tree.Margin = new Margin(0.0f, 0.0f, -16.0f, 2.0f); // Hide root node
|
||||
_tree.AddChild(_root);
|
||||
_root.SortChildrenRecursive();
|
||||
|
||||
// Setup navigation
|
||||
_navigationUnlocked = true;
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.Options;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -157,9 +158,8 @@ namespace FlaxEditor.Windows
|
||||
Parent = this,
|
||||
};
|
||||
_viewDropdown.Clicked += OnViewButtonClicked;
|
||||
_searchBox = new TextBox(false, _viewDropdown.Right + 2, 2, Width - _viewDropdown.Right - 2 - _scrollSize)
|
||||
_searchBox = new SearchBox(false, _viewDropdown.Right + 2, 2, Width - _viewDropdown.Right - 2 - _scrollSize)
|
||||
{
|
||||
WatermarkText = "Search...",
|
||||
Parent = this,
|
||||
};
|
||||
_searchBox.TextChanged += Refresh;
|
||||
|
||||
@@ -6,6 +6,7 @@ using FlaxEditor.Gizmo;
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
using FlaxEditor.GUI.Drag;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.SceneGraph;
|
||||
using FlaxEditor.SceneGraph.GUI;
|
||||
using FlaxEditor.Scripting;
|
||||
@@ -49,10 +50,9 @@ namespace FlaxEditor.Windows
|
||||
IsScrollable = false,
|
||||
Offsets = new Margin(0, 0, 0, 18 + 6),
|
||||
};
|
||||
_searchBox = new TextBox
|
||||
_searchBox = new SearchBox
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchMiddle,
|
||||
WatermarkText = "Search...",
|
||||
Parent = headerPanel,
|
||||
Bounds = new Rectangle(4, 4, headerPanel.Width - 8, 18),
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@ using FlaxEditor;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Docking;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEditor.Surface;
|
||||
@@ -224,10 +225,9 @@ namespace FlaxEngine.Windows.Search
|
||||
Parent = topPanel,
|
||||
};
|
||||
optionsButton.ButtonClicked += OnOptionsDropdownClicked;
|
||||
_searchBox = new TextBox
|
||||
_searchBox = new SearchBox
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchMiddle,
|
||||
WatermarkText = "Search...",
|
||||
Parent = topPanel,
|
||||
Bounds = new Rectangle(optionsButton.Right + 2.0f, 2, topPanel.Width - 4.0f - optionsButton.Width, 18.0f),
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.GUI.Tabs;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
using FlaxEditor.Scripting;
|
||||
@@ -130,10 +131,9 @@ namespace FlaxEditor.Windows
|
||||
};
|
||||
|
||||
_groupSearch = CreateGroupWithList(_actorGroups, "Search", 26);
|
||||
_searchBox = new TextBox
|
||||
_searchBox = new SearchBox
|
||||
{
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchTop,
|
||||
WatermarkText = "Search...",
|
||||
Parent = _groupSearch.Parent.Parent,
|
||||
Bounds = new Rectangle(4, 4, _actorGroups.Width - 8, 18),
|
||||
};
|
||||
|
||||
@@ -32,12 +32,14 @@ CreateAssetResult ImportShader::Import(CreateAssetContext& context)
|
||||
LOG(Warning, "Empty shader source file.");
|
||||
return CreateAssetResult::Error;
|
||||
}
|
||||
context.Data.Header.Chunks[SourceCodeChunk]->Data.Allocate(sourceCodeSize + 1);
|
||||
const auto sourceCode = context.Data.Header.Chunks[SourceCodeChunk]->Get();
|
||||
const auto& sourceCodeChunk = context.Data.Header.Chunks[SourceCodeChunk];
|
||||
sourceCodeChunk->Data.Allocate(sourceCodeSize + 1);
|
||||
const auto sourceCode = sourceCodeChunk->Get();
|
||||
Platform::MemoryCopy(sourceCode, sourceCodeText.Get(), sourceCodeSize);
|
||||
|
||||
// Encrypt source code
|
||||
Encryption::EncryptBytes(sourceCode, sourceCodeSize);
|
||||
sourceCode[sourceCodeSize] = 0;
|
||||
|
||||
// Set Custom Data with Header
|
||||
ShaderStorage::Header20 shaderHeader;
|
||||
|
||||
@@ -55,8 +55,8 @@ struct AxisData
|
||||
|
||||
namespace InputImpl
|
||||
{
|
||||
Dictionary<StringView, ActionData> Actions;
|
||||
Dictionary<StringView, AxisData> Axes;
|
||||
Dictionary<String, ActionData> Actions;
|
||||
Dictionary<String, AxisData> Axes;
|
||||
bool GamepadsChanged = true;
|
||||
Array<AxisEvaluation> AxesValues;
|
||||
InputDevice::EventQueue InputEvents;
|
||||
|
||||
@@ -123,6 +123,9 @@ namespace FlaxEngine
|
||||
/// <returns>The child actor.</returns>
|
||||
public Actor AddChild(Type type)
|
||||
{
|
||||
if (type.IsAbstract)
|
||||
return null;
|
||||
|
||||
var result = (Actor)New(type);
|
||||
result.SetParent(this, false, false);
|
||||
return result;
|
||||
@@ -135,6 +138,9 @@ namespace FlaxEngine
|
||||
/// <returns>The child actor.</returns>
|
||||
public T AddChild<T>() where T : Actor
|
||||
{
|
||||
if (typeof(T).IsAbstract)
|
||||
return null;
|
||||
|
||||
var result = New<T>();
|
||||
result.SetParent(this, false, false);
|
||||
return result;
|
||||
@@ -172,6 +178,9 @@ namespace FlaxEngine
|
||||
var result = GetChild<T>();
|
||||
if (result == null)
|
||||
{
|
||||
if (typeof(T).IsAbstract)
|
||||
return null;
|
||||
|
||||
result = New<T>();
|
||||
result.SetParent(this, false, false);
|
||||
}
|
||||
@@ -185,6 +194,9 @@ namespace FlaxEngine
|
||||
/// <returns>The created script instance, null otherwise.</returns>
|
||||
public Script AddScript(Type type)
|
||||
{
|
||||
if (type.IsAbstract)
|
||||
return null;
|
||||
|
||||
var script = (Script)New(type);
|
||||
script.Parent = this;
|
||||
return script;
|
||||
@@ -197,6 +209,9 @@ namespace FlaxEngine
|
||||
/// <returns>The created script instance, null otherwise.</returns>
|
||||
public T AddScript<T>() where T : Script
|
||||
{
|
||||
if (typeof(T).IsAbstract)
|
||||
return null;
|
||||
|
||||
var script = New<T>();
|
||||
script.Parent = this;
|
||||
return script;
|
||||
|
||||
@@ -207,6 +207,9 @@ public:
|
||||
T* result = (T*)GetChild(T::GetStaticClass());
|
||||
if (!result)
|
||||
{
|
||||
if (T::GetStaticClass()->IsAbstract())
|
||||
return nullptr;
|
||||
|
||||
result = New<T>();
|
||||
result->SetParent(this, false, false);
|
||||
}
|
||||
|
||||
@@ -176,6 +176,12 @@ bool LevelImpl::spawnActor(Actor* actor, Actor* parent)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (actor->GetType().ManagedClass->IsAbstract())
|
||||
{
|
||||
Log::Exception(TEXT("Cannot spawn abstract actor type."));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (actor->Is<Scene>())
|
||||
{
|
||||
// Spawn scene
|
||||
|
||||
@@ -71,6 +71,16 @@ namespace FlaxEngine.GUI
|
||||
/// </summary>
|
||||
public event Action<Button> ButtonClicked;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when users mouse enters the control.
|
||||
/// </summary>
|
||||
public event Action HoverBegin;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when users mouse leaves the control.
|
||||
/// </summary>
|
||||
public event Action HoverEnd;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the brush used for background drawing.
|
||||
/// </summary>
|
||||
@@ -232,6 +242,14 @@ namespace FlaxEngine.GUI
|
||||
Render2D.DrawText(_font?.GetFont(), TextMaterial, _text, clientRect, textColor, TextAlignment.Center, TextAlignment.Center);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseEnter(Float2 location)
|
||||
{
|
||||
base.OnMouseEnter(location);
|
||||
|
||||
HoverBegin?.Invoke();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseLeave()
|
||||
{
|
||||
@@ -240,6 +258,8 @@ namespace FlaxEngine.GUI
|
||||
OnPressEnd();
|
||||
}
|
||||
|
||||
HoverEnd?.Invoke();
|
||||
|
||||
base.OnMouseLeave();
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,12 @@ namespace FlaxEngine.GUI
|
||||
/// </summary>
|
||||
public event Action<KeyboardKeys> KeyUp;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the text box can end edit via left click outside of the control
|
||||
/// </summary>
|
||||
[HideInEditor]
|
||||
public bool EndEditOnClick { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this is a multiline text box control.
|
||||
/// </summary>
|
||||
@@ -1042,9 +1048,37 @@ namespace FlaxEngine.GUI
|
||||
// Animate view offset
|
||||
_viewOffset = isDeltaSlow ? _targetViewOffset : Float2.Lerp(_viewOffset, _targetViewOffset, deltaTime * 20.0f);
|
||||
|
||||
// Clicking outside of the text box will end text editing. Left will keep the value, right will restore original value
|
||||
if (_isEditing && EndEditOnClick)
|
||||
{
|
||||
if (!IsMouseOver && RootWindow.ContainsFocus)
|
||||
{
|
||||
if (Input.GetMouseButtonDown(MouseButton.Left))
|
||||
{
|
||||
RemoveFocus();
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(MouseButton.Right))
|
||||
{
|
||||
RestoreTextFromStart();
|
||||
RemoveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.Update(deltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restores the Text from the start.
|
||||
/// </summary>
|
||||
public void RestoreTextFromStart()
|
||||
{
|
||||
// Restore text from start
|
||||
SetSelection(-1);
|
||||
_text = _onStartEditValue;
|
||||
OnTextChanged();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnGotFocus()
|
||||
{
|
||||
@@ -1300,13 +1334,10 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
case KeyboardKeys.Escape:
|
||||
{
|
||||
// Restore text from start
|
||||
SetSelection(-1);
|
||||
_text = _onStartEditValue;
|
||||
RestoreTextFromStart();
|
||||
|
||||
if (!IsNavFocused)
|
||||
RemoveFocus();
|
||||
OnTextChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user