Merge remote-tracking branch 'origin/master' into 1.7
This commit is contained in:
@@ -905,7 +905,7 @@ void SceneAnimationPlayer::Tick(SceneAnimation* anim, float time, float dt, int3
|
||||
MException ex(exception);
|
||||
ex.Log(LogType::Error, TEXT("Property"));
|
||||
}
|
||||
else if (!MCore::Type::IsPointer(valueType))
|
||||
else if (!MCore::Type::IsPointer(valueType) && !MCore::Type::IsReference(valueType))
|
||||
{
|
||||
if (boxed)
|
||||
Platform::MemoryCopy(value, MCore::Object::Unbox(boxed), valueSize);
|
||||
|
||||
@@ -58,6 +58,7 @@ using Mathr = FlaxEngine.Mathf;
|
||||
*/
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -953,6 +954,91 @@ namespace FlaxEngine
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a gradual change of a vector towards a specified target over time
|
||||
/// </summary>
|
||||
/// <param name="current">Current vector.</param>
|
||||
/// <param name="target">Target vector.</param>
|
||||
/// <param name="currentVelocity">Used to store the current velocity.</param>
|
||||
/// <param name="smoothTime">Determines the approximate time it should take to reach the target vector.</param>
|
||||
/// <param name="maxSpeed">Defines the upper limit on the speed of the Smooth Damp.</param>
|
||||
public static Vector2 SmoothDamp(Vector2 current, Vector2 target, ref Vector2 currentVelocity, float smoothTime, float maxSpeed)
|
||||
{
|
||||
return SmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, Time.DeltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a gradual change of a vector towards a specified target over time
|
||||
/// </summary>
|
||||
/// <param name="current">Current vector.</param>
|
||||
/// <param name="target">Target vector.</param>
|
||||
/// <param name="currentVelocity">Used to store the current velocity.</param>
|
||||
/// <param name="smoothTime">Determines the approximate time it should take to reach the target vector.</param>
|
||||
public static Vector2 SmoothDamp(Vector2 current, Vector2 target, ref Vector2 currentVelocity, float smoothTime)
|
||||
{
|
||||
return SmoothDamp(current, target, ref currentVelocity, smoothTime, float.PositiveInfinity, Time.DeltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a gradual change of a vector towards a specified target over time
|
||||
/// </summary>
|
||||
/// <param name="current">Current vector.</param>
|
||||
/// <param name="target">Target vector.</param>
|
||||
/// <param name="currentVelocity">Used to store the current velocity.</param>
|
||||
/// <param name="smoothTime">Determines the approximate time it should take to reach the target vector.</param>
|
||||
/// <param name="maxSpeed">Defines the upper limit on the speed of the Smooth Damp.</param>
|
||||
/// <param name="deltaTime">Delta Time, represents the time elapsed since last frame.</param>
|
||||
public static Vector2 SmoothDamp(Vector2 current, Vector2 target, ref Vector2 currentVelocity, float smoothTime, [DefaultValue("float.PositiveInfinity")] float maxSpeed, [DefaultValue("Time.DeltaTime")] float deltaTime)
|
||||
{
|
||||
smoothTime = Mathf.Max(0.0001f, smoothTime);
|
||||
Real a = 2f / smoothTime;
|
||||
Real b = a * deltaTime;
|
||||
Real e = 1f / (1f + b + 0.48f * b * b + 0.235f * b * b * b);
|
||||
|
||||
Real change_x = current.X - target.X;
|
||||
Real change_y = current.Y - target.Y;
|
||||
Vector2 originalTo = target;
|
||||
|
||||
Real maxChangeSpeed = maxSpeed * smoothTime;
|
||||
Real changeSq = maxChangeSpeed * maxChangeSpeed;
|
||||
Real sqrDist = change_x * change_x + change_y * change_y;
|
||||
if (sqrDist > changeSq)
|
||||
{
|
||||
var dist = (Real)Math.Sqrt(sqrDist);
|
||||
change_x = change_x / dist * maxChangeSpeed;
|
||||
change_y = change_y / dist * maxChangeSpeed;
|
||||
}
|
||||
|
||||
target.X = current.X - change_x;
|
||||
target.Y = current.Y - change_y;
|
||||
|
||||
Real temp_x = (currentVelocity.X + a * change_x) * deltaTime;
|
||||
Real temp_y = (currentVelocity.Y + a * change_y) * deltaTime;
|
||||
|
||||
currentVelocity.X = (currentVelocity.X - a * temp_x) * e;
|
||||
currentVelocity.Y = (currentVelocity.Y - a * temp_y) * e;
|
||||
|
||||
Real output_x = target.X + (change_x + temp_x) * e;
|
||||
Real output_y = target.Y + (change_y + temp_y) * e;
|
||||
|
||||
Real x1 = originalTo.X - current.X;
|
||||
Real y1 = originalTo.Y - current.Y;
|
||||
|
||||
Real x2 = output_x - originalTo.X;
|
||||
Real y2 = output_y - originalTo.Y;
|
||||
|
||||
if (x1 * x2 + y1 * y2 > 0)
|
||||
{
|
||||
output_x = originalTo.X;
|
||||
output_y = originalTo.Y;
|
||||
|
||||
currentVelocity.X = (output_x - originalTo.X) / deltaTime;
|
||||
currentVelocity.Y = (output_y - originalTo.Y) / deltaTime;
|
||||
}
|
||||
|
||||
return new Vector2(output_x, output_y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a cubic interpolation between two vectors.
|
||||
/// </summary>
|
||||
|
||||
@@ -58,6 +58,7 @@ using Mathr = FlaxEngine.Mathf;
|
||||
*/
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -1042,6 +1043,103 @@ namespace FlaxEngine
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a gradual change of a vector towards a specified target over time
|
||||
/// </summary>
|
||||
/// <param name="current">Current vector.</param>
|
||||
/// <param name="target">Target vector.</param>
|
||||
/// <param name="currentVelocity">Used to store the current velocity.</param>
|
||||
/// <param name="smoothTime">Determines the approximate time it should take to reach the target vector.</param>
|
||||
/// <param name="maxSpeed">Defines the upper limit on the speed of the Smooth Damp.</param>
|
||||
public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime, float maxSpeed)
|
||||
{
|
||||
return SmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, Time.DeltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a gradual change of a vector towards a specified target over time
|
||||
/// </summary>
|
||||
/// <param name="current">Current vector.</param>
|
||||
/// <param name="target">Target vector.</param>
|
||||
/// <param name="currentVelocity">Used to store the current velocity.</param>
|
||||
/// <param name="smoothTime">Determines the approximate time it should take to reach the target vector.</param>
|
||||
public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime)
|
||||
{
|
||||
return SmoothDamp(current, target, ref currentVelocity, smoothTime, float.PositiveInfinity, Time.DeltaTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a gradual change of a vector towards a specified target over time
|
||||
/// </summary>
|
||||
/// <param name="current">Current vector.</param>
|
||||
/// <param name="target">Target vector.</param>
|
||||
/// <param name="currentVelocity">Used to store the current velocity.</param>
|
||||
/// <param name="smoothTime">Determines the approximate time it should take to reach the target vector.</param>
|
||||
/// <param name="maxSpeed">Defines the upper limit on the speed of the Smooth Damp.</param>
|
||||
/// <param name="deltaTime">Delta Time, represents the time elapsed since last frame.</param>
|
||||
public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime, [DefaultValue("float.PositiveInfinity")] float maxSpeed, [DefaultValue("Time.DeltaTime")] float deltaTime)
|
||||
{
|
||||
smoothTime = Mathf.Max(0.0001f, smoothTime);
|
||||
Real a = 2f / smoothTime;
|
||||
Real b = a * deltaTime;
|
||||
Real e = 1f / (1f + b + 0.48f * b * b + 0.235f * b * b * b);
|
||||
|
||||
Real change_x = current.X - target.X;
|
||||
Real change_y = current.Y - target.Y;
|
||||
Real change_z = current.Z - target.Z;
|
||||
|
||||
Vector3 originalTo = target;
|
||||
|
||||
Real maxChangeSpeed = maxSpeed * smoothTime;
|
||||
Real changeSq = maxChangeSpeed * maxChangeSpeed;
|
||||
Real sqrLen = change_x * change_x + change_y * change_y + change_z * change_z;
|
||||
if (sqrLen > changeSq)
|
||||
{
|
||||
var len = (Real)Math.Sqrt(sqrLen);
|
||||
change_x = change_x / len * maxChangeSpeed;
|
||||
change_y = change_y / len * maxChangeSpeed;
|
||||
change_z = change_z / len * maxChangeSpeed;
|
||||
}
|
||||
|
||||
target.X = current.X - change_x;
|
||||
target.Y = current.Y - change_y;
|
||||
target.Z = current.Z - change_z;
|
||||
|
||||
Real temp_x = (currentVelocity.X + a * change_x) * deltaTime;
|
||||
Real temp_y = (currentVelocity.Y + a * change_y) * deltaTime;
|
||||
Real temp_z = (currentVelocity.Z + a * change_z) * deltaTime;
|
||||
|
||||
currentVelocity.X = (currentVelocity.X - a * temp_x) * e;
|
||||
currentVelocity.Y = (currentVelocity.Y - a * temp_y) * e;
|
||||
currentVelocity.Z = (currentVelocity.Z - a * temp_z) * e;
|
||||
|
||||
Real output_x = target.X + (change_x + temp_x) * e;
|
||||
Real output_y = target.Y + (change_y + temp_y) * e;
|
||||
Real output_z = target.Z + (change_z + temp_z) * e;
|
||||
|
||||
Real x1 = originalTo.X - current.X;
|
||||
Real y1 = originalTo.Y - current.Y;
|
||||
Real z1 = originalTo.Z - current.Z;
|
||||
|
||||
Real x2 = output_x - originalTo.X;
|
||||
Real y2 = output_y - originalTo.Y;
|
||||
Real z2 = output_z - originalTo.Z;
|
||||
|
||||
if (x1 * x2 + y1 * y2 + z1 * z2 > 0)
|
||||
{
|
||||
output_x = originalTo.X;
|
||||
output_y = originalTo.Y;
|
||||
output_z = originalTo.Z;
|
||||
|
||||
currentVelocity.X = (output_x - originalTo.X) / deltaTime;
|
||||
currentVelocity.Y = (output_y - originalTo.Y) / deltaTime;
|
||||
currentVelocity.Z = (output_z - originalTo.Z) / deltaTime;
|
||||
}
|
||||
|
||||
return new Vector3(output_x, output_y, output_z);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Performs a cubic interpolation between two vectors.
|
||||
/// </summary>
|
||||
|
||||
@@ -1230,7 +1230,7 @@ namespace FlaxEngine.Interop
|
||||
internal static bool GetTypeIsReference(ManagedHandle typeHandle)
|
||||
{
|
||||
Type type = Unsafe.As<TypeHolder>(typeHandle.Target);
|
||||
return type.IsByRef;
|
||||
return !type.IsValueType; // Maybe also type.IsByRef?
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly]
|
||||
|
||||
@@ -181,6 +181,11 @@ void Screen::SetGameWindowMode(GameWindowMode windowMode)
|
||||
#endif
|
||||
}
|
||||
|
||||
Window* Screen::GetMainWindow()
|
||||
{
|
||||
return Engine::MainWindow;
|
||||
}
|
||||
|
||||
void ScreenService::Update()
|
||||
{
|
||||
#if USE_EDITOR
|
||||
|
||||
@@ -96,4 +96,10 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screen);
|
||||
/// </remarks>
|
||||
/// <param name="windowMode">The window mode.</param>
|
||||
API_PROPERTY() static void SetGameWindowMode(GameWindowMode windowMode);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the main window.
|
||||
/// </summary>
|
||||
/// <returns>The current window. Will be null if fails.</returns>
|
||||
API_PROPERTY() static Window* GetMainWindow();
|
||||
};
|
||||
|
||||
@@ -364,13 +364,20 @@ namespace FlaxEngine
|
||||
/// <param name="point">The point (world-space).</param>
|
||||
/// <param name="axis">The axis (normalized).</param>
|
||||
/// <param name="angle">The angle (in degrees).</param>
|
||||
public void RotateAround(Vector3 point, Vector3 axis, float angle)
|
||||
/// /// <param name="orientActor">Whether to orient the actor the same amount as rotation.</param>
|
||||
public void RotateAround(Vector3 point, Vector3 axis, float angle, bool orientActor = true)
|
||||
{
|
||||
var transform = Transform;
|
||||
var q = Quaternion.RotationAxis(axis, angle * Mathf.DegreesToRadians);
|
||||
var dif = (transform.Translation - point) * q;
|
||||
transform.Translation = point + dif;
|
||||
transform.Orientation = q;
|
||||
if (Vector3.NearEqual(point, transform.Translation) && orientActor)
|
||||
transform.Orientation *= q;
|
||||
else
|
||||
{
|
||||
var dif = (transform.Translation - point) * q;
|
||||
transform.Translation = point + dif;
|
||||
if (orientActor)
|
||||
transform.Orientation *= q;
|
||||
}
|
||||
Transform = transform;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,8 +129,15 @@ void ProfilerCPU::Thread::EndEvent()
|
||||
{
|
||||
const double time = Platform::GetTimeSeconds() * 1000.0;
|
||||
_depth--;
|
||||
Event& e = (Buffer.Last()--).Event();
|
||||
e.End = time;
|
||||
for (auto i = Buffer.Last(); i != Buffer.Begin(); --i)
|
||||
{
|
||||
Event& e = i.Event();
|
||||
if (e.End <= 0)
|
||||
{
|
||||
e.End = time;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ProfilerCPU::IsProfilingCurrentThread()
|
||||
|
||||
@@ -121,15 +121,39 @@ public:
|
||||
EventBuffer* _buffer;
|
||||
int32 _index;
|
||||
|
||||
Iterator(EventBuffer* buffer, const int32 index)
|
||||
FORCE_INLINE Iterator(EventBuffer* buffer, const int32 index)
|
||||
: _buffer(buffer)
|
||||
, _index(index)
|
||||
{
|
||||
}
|
||||
|
||||
Iterator(const Iterator& i) = default;
|
||||
|
||||
public:
|
||||
FORCE_INLINE Iterator(const Iterator& other)
|
||||
: _buffer(other._buffer)
|
||||
, _index(other._index)
|
||||
{
|
||||
}
|
||||
|
||||
FORCE_INLINE Iterator(Iterator&& other) noexcept
|
||||
: _buffer(other._buffer)
|
||||
, _index(other._index)
|
||||
{
|
||||
}
|
||||
|
||||
FORCE_INLINE Iterator& operator=(Iterator&& other)
|
||||
{
|
||||
_buffer = other._buffer;
|
||||
_index = other._index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FORCE_INLINE Iterator& operator=(const Iterator& other)
|
||||
{
|
||||
_buffer = other._buffer;
|
||||
_index = other._index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32 Index() const
|
||||
{
|
||||
return _index;
|
||||
@@ -141,15 +165,13 @@ public:
|
||||
return _buffer->Get(_index);
|
||||
}
|
||||
|
||||
bool IsEnd() const
|
||||
FORCE_INLINE bool IsEnd() const
|
||||
{
|
||||
ASSERT_LOW_LAYER(_buffer);
|
||||
return _index == _buffer->_head;
|
||||
}
|
||||
|
||||
bool IsNotEnd() const
|
||||
FORCE_INLINE bool IsNotEnd() const
|
||||
{
|
||||
ASSERT_LOW_LAYER(_buffer);
|
||||
return _index != _buffer->_head;
|
||||
}
|
||||
|
||||
@@ -164,31 +186,27 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
Iterator& operator++()
|
||||
FORCE_INLINE Iterator& operator++()
|
||||
{
|
||||
ASSERT(_buffer);
|
||||
_index = (_index + 1) & _buffer->_capacityMask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Iterator operator++(int)
|
||||
FORCE_INLINE Iterator operator++(int)
|
||||
{
|
||||
ASSERT(_buffer);
|
||||
Iterator temp = *this;
|
||||
_index = (_index + 1) & _buffer->_capacityMask;
|
||||
return temp;
|
||||
}
|
||||
|
||||
Iterator& operator--()
|
||||
FORCE_INLINE Iterator& operator--()
|
||||
{
|
||||
ASSERT(_buffer);
|
||||
_index = (_index - 1) & _buffer->_capacityMask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Iterator operator--(int)
|
||||
FORCE_INLINE Iterator operator--(int)
|
||||
{
|
||||
ASSERT(_buffer);
|
||||
Iterator temp = *this;
|
||||
_index = (_index - 1) & _buffer->_capacityMask;
|
||||
return temp;
|
||||
|
||||
@@ -1240,8 +1240,12 @@ bool ManagedBinaryModule::InvokeMethod(void* method, const Variant& instance, Sp
|
||||
return true;
|
||||
}
|
||||
|
||||
#if USE_NETCORE
|
||||
mInstance = instanceObject;
|
||||
#else
|
||||
// For value-types instance is the actual boxed object data, not te object itself
|
||||
mInstance = instanceObjectClass->IsValueType() ? MCore::Object::Unbox(instanceObject) : instanceObject;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Marshal parameters
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace
|
||||
MMethod* _method_LateFixedUpdate = nullptr;
|
||||
MMethod* _method_Draw = nullptr;
|
||||
MMethod* _method_Exit = nullptr;
|
||||
Array<BinaryModule*, InlinedAllocation<64>> _nonNativeModules;
|
||||
Dictionary<StringAnsi, BinaryModule*, InlinedAllocation<64>> _nonNativeModules;
|
||||
#if USE_EDITOR
|
||||
bool LastBinariesLoadTriggeredCompilation = false;
|
||||
#endif
|
||||
@@ -329,6 +329,8 @@ bool Scripting::LoadBinaryModules(const String& path, const String& projectFolde
|
||||
|
||||
// Check if that module has been already registered
|
||||
BinaryModule* module = BinaryModule::GetModule(nameAnsi);
|
||||
if (!module)
|
||||
_nonNativeModules.TryGet(nameAnsi, module);
|
||||
if (!module)
|
||||
{
|
||||
// C++
|
||||
@@ -398,7 +400,7 @@ bool Scripting::LoadBinaryModules(const String& path, const String& projectFolde
|
||||
{
|
||||
// Create module if native library is not used
|
||||
module = New<ManagedBinaryModule>(nameAnsi);
|
||||
_nonNativeModules.Add(module);
|
||||
_nonNativeModules.Add(nameAnsi, module);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,6 +282,12 @@ namespace FlaxEngine
|
||||
TextBoxBackgroundSelected = Color.FromBgra(0xFF3F3F46),
|
||||
CollectionBackgroundColor = Color.FromBgra(0x14CCCCCC),
|
||||
SharedTooltip = new Tooltip(),
|
||||
Statusbar = new Style.StatusbarStyle()
|
||||
{
|
||||
PlayMode = Color.FromBgra(0xFF2F9135),
|
||||
Failed = Color.FromBgra(0xFF9C2424),
|
||||
Loading = Color.FromBgra(0xFF2D2D30)
|
||||
}
|
||||
};
|
||||
style.DragWindow = style.BackgroundSelected * 0.7f;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Float2 Size => Texture?.Size ?? Float2.Zero;
|
||||
public Float2 Size => Texture != null ? Texture.Size : Float2.Zero;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Draw(Rectangle rect, Color color)
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Float2 Size => Texture?.Size ?? Float2.Zero;
|
||||
public Float2 Size => Texture != null ? Texture.Size : Float2.Zero;
|
||||
|
||||
/// <inheritdoc />
|
||||
public unsafe void Draw(Rectangle rect, Color color)
|
||||
|
||||
@@ -74,10 +74,16 @@ namespace FlaxEngine.GUI
|
||||
[EditorDisplay("Text Style"), EditorOrder(2022), Tooltip("The text wrapping within the control bounds.")]
|
||||
public TextWrapping Wrapping { get; set; } = TextWrapping.NoWrap;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the text wrapping within the control bounds.
|
||||
/// </summary>
|
||||
[EditorDisplay("Text Style"), EditorOrder(2023), Tooltip("The gap between lines when wrapping and more than a single line is displayed."), Limit(0f)]
|
||||
public float BaseLinesGapScale { get; set; } = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the font.
|
||||
/// </summary>
|
||||
[EditorDisplay("Text Style"), EditorOrder(2023)]
|
||||
[EditorDisplay("Text Style"), EditorOrder(2024)]
|
||||
public FontReference Font
|
||||
{
|
||||
get => _font;
|
||||
@@ -99,7 +105,7 @@ namespace FlaxEngine.GUI
|
||||
/// <summary>
|
||||
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
|
||||
/// </summary>
|
||||
[EditorDisplay("Text Style"), EditorOrder(2024)]
|
||||
[EditorDisplay("Text Style"), EditorOrder(2025)]
|
||||
public MaterialBase Material { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -227,7 +233,7 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
}
|
||||
|
||||
Render2D.DrawText(_font.GetFont(), Material, _text, rect, color, hAlignment, wAlignment, Wrapping, 1.0f, scale);
|
||||
Render2D.DrawText(_font.GetFont(), Material, _text, rect, color, hAlignment, wAlignment, Wrapping, BaseLinesGapScale, scale);
|
||||
|
||||
if (ClipText)
|
||||
Render2D.PopClip();
|
||||
@@ -249,6 +255,7 @@ namespace FlaxEngine.GUI
|
||||
else if (_autoWidth && !_autoHeight)
|
||||
layout.Bounds.Size.Y = Height - Margin.Height;
|
||||
_textSize = font.MeasureText(_text, ref layout);
|
||||
_textSize.Y *= BaseLinesGapScale;
|
||||
|
||||
// Check if size is controlled via text
|
||||
if (_autoWidth || _autoHeight)
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace FlaxEngine.GUI
|
||||
/// <summary>
|
||||
/// Gets or sets the blur strength. Defines how blurry the background is. Larger numbers increase blur, resulting in a larger runtime cost on the GPU.
|
||||
/// </summary>
|
||||
[EditorOrder(0), Limit(0, 100, 0.0f)]
|
||||
[EditorOrder(0), Limit(0, 100, 0.1f)]
|
||||
public float BlurStrength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -29,10 +29,9 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
public override void DrawSelf()
|
||||
{
|
||||
base.Draw();
|
||||
|
||||
base.DrawSelf();
|
||||
var size = Size;
|
||||
var strength = BlurStrength;
|
||||
if (BlurScaleWithSize)
|
||||
|
||||
@@ -164,6 +164,12 @@ namespace FlaxEngine.GUI
|
||||
[EditorOrder(200)]
|
||||
public Color ProgressNormal;
|
||||
|
||||
/// <summary>
|
||||
/// The status bar style
|
||||
/// </summary>
|
||||
[EditorOrder(210)]
|
||||
public StatusbarStyle Statusbar;
|
||||
|
||||
/// <summary>
|
||||
/// The arrow right icon.
|
||||
/// </summary>
|
||||
@@ -241,5 +247,27 @@ namespace FlaxEngine.GUI
|
||||
/// </summary>
|
||||
[EditorOrder(340)]
|
||||
public Tooltip SharedTooltip;
|
||||
|
||||
/// <summary>
|
||||
/// Style for the Statusbar
|
||||
/// </summary>
|
||||
[System.Serializable, ShowInEditor]
|
||||
public struct StatusbarStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// Color of the Statusbar when in Play Mode
|
||||
/// </summary>
|
||||
public Color PlayMode;
|
||||
|
||||
/// <summary>
|
||||
/// Color of the Statusbar when in loading state (e.g. when importing assets)
|
||||
/// </summary>
|
||||
public Color Loading;
|
||||
|
||||
/// <summary>
|
||||
/// Color of the Statusbar in its failed state (e.g. with compilation errors)
|
||||
/// </summary>
|
||||
public Color Failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +181,9 @@ namespace FlaxEngine.GUI
|
||||
|
||||
private void WrapPosition(ref Float2 locationSS, float flipOffset = 0.0f)
|
||||
{
|
||||
if (_showTarget?.RootWindow == null)
|
||||
return;
|
||||
|
||||
// Calculate popup direction
|
||||
var dpiScale = _showTarget.RootWindow.DpiScale;
|
||||
var dpiSize = Size * dpiScale;
|
||||
@@ -207,7 +210,8 @@ namespace FlaxEngine.GUI
|
||||
// Move window with mouse location
|
||||
var mousePos = Input.MouseScreenPosition;
|
||||
WrapPosition(ref mousePos, 10);
|
||||
_window.Position = mousePos + new Float2(15, 10);
|
||||
if (_window)
|
||||
_window.Position = mousePos + new Float2(15, 10);
|
||||
|
||||
// Auto hide if mouse leaves control area
|
||||
var location = _showTarget.PointFromScreen(mousePos);
|
||||
|
||||
@@ -493,7 +493,8 @@ namespace FlaxEngine
|
||||
if (_renderer)
|
||||
{
|
||||
#if FLAX_EDITOR
|
||||
_editorTask?.RemoveCustomPostFx(_renderer);
|
||||
if (_editorTask != null)
|
||||
_editorTask.RemoveCustomPostFx(_renderer);
|
||||
#endif
|
||||
SceneRenderTask.RemoveGlobalCustomPostFx(_renderer);
|
||||
_renderer.Canvas = null;
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace FlaxEngine
|
||||
up = value;
|
||||
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
|
||||
if (_control != null)
|
||||
_control.NavTargetUp = value?.Control;
|
||||
_control.NavTargetUp = value != null ? value.Control : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace FlaxEngine
|
||||
down = value;
|
||||
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
|
||||
if (_control != null)
|
||||
_control.NavTargetDown = value?.Control;
|
||||
_control.NavTargetDown = value != null ? value.Control : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace FlaxEngine
|
||||
left = value;
|
||||
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
|
||||
if (_control != null)
|
||||
_control.NavTargetLeft = value?.Control;
|
||||
_control.NavTargetLeft = value != null ? value.Control : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace FlaxEngine
|
||||
right = value;
|
||||
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
|
||||
if (_control != null)
|
||||
_control.NavTargetRight = value?.Control;
|
||||
_control.NavTargetRight = value != null ? value.Control : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user