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:
@@ -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