Merge remote-tracking branch 'origin/master' into 1.10
This commit is contained in:
@@ -511,11 +511,12 @@ bool WindowsPlatformTools::OnDeployBinaries(CookingData& data)
|
||||
|
||||
// Rename app
|
||||
const String newName = EditorUtilities::GetOutputName();
|
||||
if (newName != StringUtils::GetFileNameWithoutExtension(files[0]))
|
||||
const StringView oldName = StringUtils::GetFileNameWithoutExtension(files[0]);
|
||||
if (newName != oldName)
|
||||
{
|
||||
if (FileSystem::MoveFile(data.NativeCodeOutputPath / newName + TEXT(".exe"), files[0], true))
|
||||
{
|
||||
data.Error(TEXT("Failed to change output executable name."));
|
||||
data.Error(String::Format(TEXT("Failed to change output executable name from '{}' to '{}'."), oldName, newName));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
DEPLOY_NATIVE_FILE("libmonosgen-2.0.dylib");
|
||||
DEPLOY_NATIVE_FILE("libSystem.IO.Compression.Native.dylib");
|
||||
DEPLOY_NATIVE_FILE("libSystem.Native.dylib");
|
||||
DEPLOY_NATIVE_FILE("libSystem.NET.Security.Native.dylib");
|
||||
DEPLOY_NATIVE_FILE("libSystem.Net.Security.Native.dylib");
|
||||
DEPLOY_NATIVE_FILE("libSystem.Security.Cryptography.Native.Apple.dylib");
|
||||
break;
|
||||
#undef DEPLOY_NATIVE_FILE
|
||||
|
||||
@@ -95,7 +95,21 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var cm = new ItemsListContextMenu(180);
|
||||
for (int i = 0; i < scripts.Count; i++)
|
||||
{
|
||||
cm.AddItem(new TypeSearchPopup.TypeItemView(scripts[i]));
|
||||
var script = scripts[i];
|
||||
var item = new TypeSearchPopup.TypeItemView(script);
|
||||
if (script.GetAttributes(false).FirstOrDefault(x => x is RequireActorAttribute) is RequireActorAttribute requireActor)
|
||||
{
|
||||
var actors = ScriptsEditor.ParentEditor.Values;
|
||||
foreach (var a in actors)
|
||||
{
|
||||
if (a.GetType() != requireActor.RequiredType)
|
||||
{
|
||||
item.Enabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cm.AddItem(item);
|
||||
}
|
||||
cm.TextChanged += text =>
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using FlaxEditor.GUI.Docking;
|
||||
using FlaxEditor.Utilities;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Options
|
||||
{
|
||||
@@ -217,6 +218,21 @@ namespace FlaxEditor.Options
|
||||
[EditorDisplay("Interface"), EditorOrder(320), Tooltip("Toggles tree line visibility in places like the Scene or Content Panel.")]
|
||||
public bool ShowTreeLines { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets tooltip text alignment.
|
||||
/// </summary>
|
||||
[DefaultValue(TextAlignment.Center)]
|
||||
[EditorDisplay("Interface"), EditorOrder(321)]
|
||||
public TextAlignment TooltipTextAlignment { get => _tooltipTextAlignment;
|
||||
set
|
||||
{
|
||||
_tooltipTextAlignment = value;
|
||||
Style.Current.SharedTooltip.HorizontalTextAlignment = value;
|
||||
}
|
||||
}
|
||||
|
||||
private TextAlignment _tooltipTextAlignment = TextAlignment.Center;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamps prefix mode for output log messages.
|
||||
/// </summary>
|
||||
|
||||
@@ -331,6 +331,7 @@ namespace FlaxEditor.Options
|
||||
|
||||
SharedTooltip = new Tooltip(),
|
||||
};
|
||||
style.SharedTooltip.HorizontalTextAlignment = Editor.Instance.Options.Options.Interface.TooltipTextAlignment;
|
||||
style.DragWindow = style.BackgroundSelected * 0.7f;
|
||||
return style;
|
||||
}
|
||||
@@ -386,6 +387,7 @@ namespace FlaxEditor.Options
|
||||
|
||||
SharedTooltip = new Tooltip(),
|
||||
};
|
||||
style.SharedTooltip.HorizontalTextAlignment = Editor.Instance.Options.Options.Interface.TooltipTextAlignment;
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
#include "Engine/Platform/File.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Platform/CreateProcessSettings.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
#include "Engine/Graphics/PixelFormatExtensions.h"
|
||||
#include "Engine/Tools/TextureTool/TextureTool.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/StringBuilder.h"
|
||||
#include "Engine/Core/Config/GameSettings.h"
|
||||
#include "Engine/Core/Config/BuildSettings.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
@@ -28,6 +29,7 @@ String EditorUtilities::GetOutputName()
|
||||
outputName.Replace(TEXT("${COMPANY_NAME}"), *gameSettings->CompanyName, StringSearchCase::IgnoreCase);
|
||||
if (outputName.IsEmpty())
|
||||
outputName = TEXT("FlaxGame");
|
||||
ValidatePathChars(outputName, 0);
|
||||
return outputName;
|
||||
}
|
||||
|
||||
@@ -360,6 +362,28 @@ bool EditorUtilities::IsInvalidPathChar(Char c)
|
||||
return false;
|
||||
}
|
||||
|
||||
void EditorUtilities::ValidatePathChars(String& filename, char invalidCharReplacement)
|
||||
{
|
||||
if (invalidCharReplacement == 0)
|
||||
{
|
||||
StringBuilder result;
|
||||
for (int32 i = 0; i < filename.Length(); i++)
|
||||
{
|
||||
if (!IsInvalidPathChar(filename[i]))
|
||||
result.Append(filename[i]);
|
||||
}
|
||||
filename = result.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int32 i = 0; i < filename.Length(); i++)
|
||||
{
|
||||
if (IsInvalidPathChar(filename[i]))
|
||||
filename[i] = invalidCharReplacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorUtilities::ReplaceInFiles(const String& folderPath, const Char* searchPattern, DirectorySearchOption searchOption, const String& findWhat, const String& replaceWith)
|
||||
{
|
||||
Array<String> files;
|
||||
@@ -391,7 +415,7 @@ bool EditorUtilities::ReplaceInFile(const StringView& file, const Dictionary<Str
|
||||
|
||||
bool EditorUtilities::CopyFileIfNewer(const StringView& dst, const StringView& src)
|
||||
{
|
||||
if (FileSystem::FileExists(dst) &&
|
||||
if (FileSystem::FileExists(dst) &&
|
||||
FileSystem::GetFileLastEditTime(src) <= FileSystem::GetFileLastEditTime(dst) &&
|
||||
FileSystem::GetFileSize(dst) == FileSystem::GetFileSize(src))
|
||||
return false;
|
||||
|
||||
@@ -57,6 +57,13 @@ public:
|
||||
/// <returns><c>true</c> if the given character cannot be used as a path because it is illegal character; otherwise, <c>false</c>.</returns>
|
||||
static bool IsInvalidPathChar(Char c);
|
||||
|
||||
/// <summary>
|
||||
/// Validates path characters and replaces any incorrect ones.
|
||||
/// </summary>
|
||||
/// <param name="filename">The input and output filename string to process.</param>
|
||||
/// <param name="invalidCharReplacement">The character to use for replacement for any invalid characters in the path. Use '0' to remove them.</param>
|
||||
static void ValidatePathChars(String& filename, char invalidCharReplacement = ' ');
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the given text with other one in the files.
|
||||
/// </summary>
|
||||
|
||||
@@ -638,12 +638,14 @@ namespace FlaxEditor.Windows
|
||||
var toDelete = new List<ContentItem>(items);
|
||||
toDelete.Sort((a, b) => a.IsFolder ? 1 : b.IsFolder ? -1 : a.Compare(b));
|
||||
|
||||
string singularPlural = toDelete.Count > 1 ? "s" : "";
|
||||
|
||||
string msg = toDelete.Count == 1
|
||||
? string.Format("Are you sure to delete \'{0}\'?\nThis action cannot be undone. Files will be deleted permanently.", items[0].Path)
|
||||
: string.Format("Are you sure to delete {0} selected items?\nThis action cannot be undone. Files will be deleted permanently.", items.Count);
|
||||
? string.Format("Delete \'{0}\'?\n\nThis action cannot be undone.\nFile will be deleted permanently.", items[0].Path)
|
||||
: string.Format("Delete {0} selected items?\n\nThis action cannot be undone.\nFiles will be deleted permanently.", items.Count);
|
||||
|
||||
// Ask user
|
||||
if (MessageBox.Show(msg, "Delete asset(s)", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||||
if (MessageBox.Show(msg, "Delete asset" + singularPlural, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
// Clear navigation
|
||||
|
||||
@@ -328,6 +328,19 @@ namespace FlaxEditor.Windows
|
||||
|
||||
group.Object(new ReadOnlyValueContainer(platformObj));
|
||||
|
||||
layout.Space(2);
|
||||
var openOutputButton = layout.Button("Open output folder").Button;
|
||||
openOutputButton.TooltipText = "Opens the defined out folder if the path exists.";
|
||||
openOutputButton.Clicked += () =>
|
||||
{
|
||||
string output = StringUtils.ConvertRelativePathToAbsolute(Globals.ProjectFolder, StringUtils.NormalizePath(proxy.PerPlatformOptions[_platform].Output));
|
||||
if (Directory.Exists(output))
|
||||
FlaxEngine.FileSystem.ShowFileExplorer(output);
|
||||
else
|
||||
FlaxEditor.Editor.LogWarning($"Can not open path: {output} because it does not exist.");
|
||||
};
|
||||
layout.Space(2);
|
||||
|
||||
_buildButton = layout.Button("Build").Button;
|
||||
_buildButton.Clicked += OnBuildClicked;
|
||||
}
|
||||
|
||||
@@ -2145,4 +2145,8 @@ void DebugDraw::DrawText(const StringView& text, const Transform& transform, con
|
||||
t.TimeLeft = duration;
|
||||
}
|
||||
|
||||
void DebugDraw::Clear(void* context)
|
||||
{
|
||||
DebugDraw::UpdateContext(context, MAX_float);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -689,6 +689,12 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
/// <param name="size">The font size.</param>
|
||||
/// <param name="duration">The duration (in seconds). Use 0 to draw it only once.</param>
|
||||
API_FUNCTION() static void DrawText(const StringView& text, const Transform& transform, const Color& color = Color::White, int32 size = 32, float duration = 0.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Clear all debug draw displayed on sceen.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
API_FUNCTION() static void Clear(void* context = nullptr);
|
||||
};
|
||||
|
||||
#define DEBUG_DRAW_AXIS_FROM_DIRECTION(origin, direction, size, duration, depthTest) DebugDraw::DrawAxisFromDirection(origin, direction, size, duration, depthTest);
|
||||
@@ -721,6 +727,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
#define DEBUG_DRAW_WIRE_ARC(position, orientation, radius, angle, color, duration, depthTest) DebugDraw::DrawWireArc(position, orientation, radius, angle, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARROW(position, orientation, scale, capScale, color, duration, depthTest) DebugDraw::DrawWireArrow(position, orientation, scale, capScale, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_TEXT(text, position, color, size, duration) DebugDraw::DrawText(text, position, color, size, duration)
|
||||
#define DEBUG_DRAW_CLEAR(context) DebugDraw::Clear(context)
|
||||
|
||||
#else
|
||||
|
||||
@@ -753,5 +760,6 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
#define DEBUG_DRAW_WIRE_ARC(position, orientation, radius, angle, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_WIRE_ARROW(position, orientation, scale, capScale, color, duration, depthTest)
|
||||
#define DEBUG_DRAW_TEXT(text, position, color, size, duration)
|
||||
#define DEBUG_DRAW_CLEAR(context)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -190,6 +190,11 @@ void WheeledVehicle::SetThrottle(float value)
|
||||
_throttle = Math::Clamp(value, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
float WheeledVehicle::GetThrottle()
|
||||
{
|
||||
return _throttle;
|
||||
}
|
||||
|
||||
void WheeledVehicle::SetSteering(float value)
|
||||
{
|
||||
_steering = Math::Clamp(value, -1.0f, 1.0f);
|
||||
|
||||
@@ -541,6 +541,12 @@ public:
|
||||
/// <param name="value">The value (-1,1 range). When using UseReverseAsBrake it can be negative and will be used as brake and backward driving.</param>
|
||||
API_FUNCTION() void SetThrottle(float value);
|
||||
|
||||
/// <summary>
|
||||
/// Get the vehicle throttle. It is the analog accelerator pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
|
||||
/// </summary>
|
||||
/// <returns>The vehicle throttle.</returns>
|
||||
API_FUNCTION() float GetThrottle();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the input for vehicle steering. Steer is the analog steer value in range (-1,1) where -1 represents the steering wheel at left lock and +1 represents the steering wheel at right lock.
|
||||
/// </summary>
|
||||
|
||||
@@ -8,6 +8,35 @@
|
||||
#include "Engine/Scripting/ScriptingObject.h"
|
||||
#include "Engine/Scripting/SerializableScriptingObject.h"
|
||||
|
||||
// Test default values init on fields.
|
||||
API_STRUCT(NoDefault) struct TestDefaultValues
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(TestDefaultValues);
|
||||
|
||||
// Default value case 1
|
||||
API_FIELD() float TestFloat1 = {};
|
||||
// Default value case 2
|
||||
API_FIELD() float TestFloat2 = { };
|
||||
// Default value case 3
|
||||
API_FIELD() float TestFloat3 = {1.0f};
|
||||
// Default value case 4
|
||||
API_FIELD() float TestFloat4 = float{};
|
||||
// Default value case 5
|
||||
API_FIELD() float TestFloat5 = float{ };
|
||||
// Default value case 6
|
||||
API_FIELD() float TestFloat6 = float{1.0f};
|
||||
// Default value case 7
|
||||
API_FIELD() float TestFloat7 {};
|
||||
// Default value case 8
|
||||
API_FIELD() float TestFloat8 {1.0f};
|
||||
// Default value case 9
|
||||
API_FIELD() float TestFloat9 = 1.0f;
|
||||
// Default value case 10
|
||||
API_FIELD() float TestFloat10 = 1.f;
|
||||
// Default value case 11
|
||||
API_FIELD() float TestFloat11 = 1;
|
||||
};
|
||||
|
||||
// Test interface (name conflict with namespace)
|
||||
API_INTERFACE(Namespace="Foo") class FLAXENGINE_API IFoo
|
||||
{
|
||||
|
||||
@@ -1080,11 +1080,7 @@ void TrySetupMaterialParameter(MaterialInstance* instance, Span<const Char*> par
|
||||
String GetAdditionalImportPath(const String& autoImportOutput, Array<String>& importedFileNames, const String& name)
|
||||
{
|
||||
String filename = name;
|
||||
for (int32 j = filename.Length() - 1; j >= 0; j--)
|
||||
{
|
||||
if (EditorUtilities::IsInvalidPathChar(filename[j]))
|
||||
filename[j] = ' ';
|
||||
}
|
||||
EditorUtilities::ValidatePathChars(filename);
|
||||
if (importedFileNames.Contains(filename))
|
||||
{
|
||||
int32 counter = 1;
|
||||
|
||||
@@ -17,6 +17,11 @@ namespace FlaxEngine.GUI
|
||||
private string _currentText;
|
||||
private Window _window;
|
||||
|
||||
/// <summary>
|
||||
/// The horizontal alignment of the text.
|
||||
/// </summary>
|
||||
public TextAlignment HorizontalTextAlignment = TextAlignment.Center;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time in seconds that mouse have to be over the target to show the tooltip.
|
||||
/// </summary>
|
||||
@@ -236,7 +241,14 @@ namespace FlaxEngine.GUI
|
||||
|
||||
// Padding for text
|
||||
var textRect = GetClientArea();
|
||||
textRect.X += 5;
|
||||
float textX = HorizontalTextAlignment switch
|
||||
{
|
||||
TextAlignment.Near => 15,
|
||||
TextAlignment.Center => 5,
|
||||
TextAlignment.Far => -5,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
textRect.X += textX;
|
||||
textRect.Width -= 10;
|
||||
|
||||
// Tooltip text
|
||||
@@ -245,7 +257,7 @@ namespace FlaxEngine.GUI
|
||||
_currentText,
|
||||
textRect,
|
||||
style.Foreground,
|
||||
TextAlignment.Center,
|
||||
HorizontalTextAlignment,
|
||||
TextAlignment.Center,
|
||||
TextWrapping.WrapWords
|
||||
);
|
||||
|
||||
BIN
Source/Platforms/Windows/Binaries/ThirdParty/x64/OpenAL32.dll
(Stored with Git LFS)
vendored
BIN
Source/Platforms/Windows/Binaries/ThirdParty/x64/OpenAL32.dll
(Stored with Git LFS)
vendored
Binary file not shown.
BIN
Source/Platforms/Windows/Binaries/ThirdParty/x64/OpenAL32.lib
(Stored with Git LFS)
vendored
BIN
Source/Platforms/Windows/Binaries/ThirdParty/x64/OpenAL32.lib
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -153,6 +153,28 @@ namespace Flax.Build.Bindings
|
||||
case "false": return value;
|
||||
}
|
||||
|
||||
// Handle float{_} style type of default values
|
||||
if (valueType != null && value.StartsWith($"{valueType.Type}") && value.EndsWith("}"))
|
||||
{
|
||||
value = value.Replace($"{valueType.Type}", "").Replace("{", "").Replace("}", "").Trim();
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
value = $"default({valueType.Type})";
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle C++ bracket default values that are not arrays
|
||||
if (value.StartsWith("{") && value.EndsWith("}") && valueType != null && !valueType.IsArray && valueType.Type != "Array")
|
||||
{
|
||||
value = value.Replace("{", "").Replace("}", "").Trim();
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
value = $"default({valueType.Type})";
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// Numbers
|
||||
if (float.TryParse(value, out _) || (value[value.Length - 1] == 'f' && float.TryParse(value.Substring(0, value.Length - 1), out _)))
|
||||
{
|
||||
|
||||
@@ -1352,11 +1352,17 @@ namespace Flax.Build.Bindings
|
||||
desc.Name = ParseName(ref context);
|
||||
|
||||
// Read ';' or default value or array size or bit-field size
|
||||
token = context.Tokenizer.ExpectAnyTokens(new[] { TokenType.SemiColon, TokenType.Equal, TokenType.LeftBracket, TokenType.Colon });
|
||||
token = context.Tokenizer.ExpectAnyTokens(new[] { TokenType.SemiColon, TokenType.Equal, TokenType.LeftBracket, TokenType.LeftCurlyBrace, TokenType.Colon });
|
||||
if (token.Type == TokenType.Equal)
|
||||
{
|
||||
context.Tokenizer.SkipUntil(TokenType.SemiColon, out desc.DefaultValue, false);
|
||||
}
|
||||
// Handle ex: API_FIELD() Type FieldName {DefaultValue};
|
||||
else if (token.Type == TokenType.LeftCurlyBrace)
|
||||
{
|
||||
context.Tokenizer.SkipUntil(TokenType.SemiColon, out desc.DefaultValue, false);
|
||||
desc.DefaultValue = '{' + desc.DefaultValue;
|
||||
}
|
||||
else if (token.Type == TokenType.LeftBracket)
|
||||
{
|
||||
// Read the fixed array length
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Flax.Deps.Dependencies
|
||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
var solutionPath = Path.Combine(buildDir, "OpenAL.sln");
|
||||
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_SHARED_LIBS=OFF");
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\" -DCMAKE_CXX_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\"");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopy)
|
||||
|
||||
@@ -301,7 +301,8 @@ namespace Flax.Build.Projects.VisualStudioCode
|
||||
json.BeginArray("configurations");
|
||||
{
|
||||
var cppProject = solution.Projects.FirstOrDefault(x => x.BaseName == solution.Name || x.Name == solution.Name);
|
||||
var csharpProject = solution.Projects.FirstOrDefault(x => x.BaseName == solution.MainProject.Targets[0].Modules[0] || x.Name == solution.MainProject.Targets[0].Modules[0]);
|
||||
var mainProjectModule = solution.MainProject?.Targets.Length != 0 ? solution.MainProject.Targets[0].Modules[0] : null;
|
||||
var csharpProject = mainProjectModule != null ? solution.Projects.FirstOrDefault(x => x.BaseName == mainProjectModule || x.Name == mainProjectModule) : null;
|
||||
|
||||
if (cppProject != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user