Compare commits
310 Commits
mac_change
...
emscripten
| Author | SHA1 | Date | |
|---|---|---|---|
| 8cf6979f90 | |||
| 1ff4ac0402 | |||
| 801f0f7432 | |||
| 8b605dff89 | |||
|
|
21b2e59fbb | ||
|
|
5fb1ad078b | ||
|
|
1fc5316d12 | ||
|
|
1ceb781903 | ||
|
|
6ae68bc6cc | ||
|
|
a8e7faec3c | ||
|
|
ab6e291976 | ||
|
|
2cb12e3c0f | ||
|
|
c91c209974 | ||
|
|
45a8d82a83 | ||
|
|
b41d25cbce | ||
|
|
3d201ec73f | ||
|
|
fa91e3e3ab | ||
|
|
38c87c158a | ||
|
|
241d37130a | ||
|
|
21981f666f | ||
|
|
afe917a7f3 | ||
|
|
d2a03b90ec | ||
|
|
88587fb6a4 | ||
|
|
895758d27d | ||
|
|
48d86ac7ae | ||
|
|
bc3cddc774 | ||
|
|
d784fddf95 | ||
|
|
fc7abbf541 | ||
|
|
8b4f8de988 | ||
|
|
549ed76e7c | ||
|
|
e7016564b1 | ||
|
|
8318a9c1d0 | ||
|
|
6b1490dac4 | ||
|
|
5c51652e16 | ||
|
|
6736f2f77a | ||
|
|
ab685ccc8c | ||
|
|
b5d841ffc9 | ||
|
|
cb17bcd2ff | ||
|
|
f17b7b3c79 | ||
|
|
1374a0440b | ||
|
|
7fa40eba83 | ||
|
|
62e492452d | ||
|
|
30d7588d9c | ||
|
|
e736048fab | ||
|
|
14e59281e4 | ||
|
|
895dcf4aa6 | ||
|
|
6d9d606085 | ||
|
|
a94b9f9426 | ||
|
|
ace84ae29f | ||
|
|
22c88eb59d | ||
|
|
96bbae8e28 | ||
|
|
479c5f896c | ||
|
|
0d3642f39d | ||
|
|
e47e1998a1 | ||
|
|
62492c7607 | ||
|
|
c3aecc1a11 | ||
|
|
6629ead842 | ||
|
|
14dd70fb3d | ||
|
|
2000a95fa7 | ||
|
|
68ac2f4c79 | ||
|
|
05aaf0dc99 | ||
|
|
f33db8647a | ||
|
|
0ade65036e | ||
|
|
b8bb40fcf8 | ||
|
|
0d133cfbdc | ||
|
|
337fea0f69 | ||
|
|
ee23196548 | ||
|
|
394dc31bb0 | ||
|
|
deadb6f6d0 | ||
|
|
a6c6be9c2e | ||
|
|
93a38566ea | ||
|
|
2a2f046f30 | ||
|
|
73b4b0dcee | ||
|
|
b930ae0ca9 | ||
|
|
8cdb6d77ab | ||
|
|
afc4d0f3d3 | ||
|
|
3bbaa7025a | ||
|
|
5509bc4989 | ||
|
|
3cfa110a48 | ||
|
|
1ab3917332 | ||
|
|
2fb1e5bef7 | ||
|
|
a4cb839c6f | ||
|
|
3b1960b977 | ||
|
|
116f15f4ae | ||
|
|
a0bb8efc2b | ||
|
|
90ffc4e5f9 | ||
|
|
bf11575346 | ||
|
|
8dc8371a7f | ||
|
|
ee38f88562 | ||
|
|
e90de5d815 | ||
|
|
7fe7a8dd0e | ||
|
|
8afc25b19c | ||
|
|
37a39e750f | ||
|
|
59a9137a54 | ||
|
|
f4c1e81f64 | ||
|
|
7391af1c37 | ||
|
|
c376f220ca | ||
|
|
5ce0a1535f | ||
|
|
06bf9def8e | ||
|
|
57489abc3a | ||
|
|
200aca93d3 | ||
|
|
f8eae517f0 | ||
|
|
3a651bc660 | ||
|
|
4b7828f686 | ||
|
|
befb74297a | ||
|
|
c0e16cd34a | ||
|
|
e710a6e2d1 | ||
|
|
c378cd1d47 | ||
|
|
cd74b300f1 | ||
|
|
26cd07933e | ||
|
|
c4342b0a20 | ||
|
|
3038c56af4 | ||
|
|
3dc3e25649 | ||
|
|
e7071fbe43 | ||
|
|
01670ec6ae | ||
|
|
4d4571ee55 | ||
|
|
83bbb4f6ba | ||
|
|
a406d6dba2 | ||
|
|
72bd624384 | ||
|
|
82a02698df | ||
|
|
befac36a4f | ||
|
|
1282dffca9 | ||
|
|
b291cd93c3 | ||
|
|
28257296b9 | ||
|
|
164e380672 | ||
|
|
438a9e4c3d | ||
|
|
5942209114 | ||
|
|
06788055fe | ||
|
|
26838609db | ||
|
|
b408a8ce21 | ||
|
|
6fcc963cf6 | ||
|
|
0fa3472f24 | ||
|
|
c0056f3d9d | ||
|
|
b8fcb51aa3 | ||
|
|
341dc08f7c | ||
|
|
f0873411df | ||
|
|
94789712e8 | ||
|
|
1ef35c3f94 | ||
|
|
ac36840037 | ||
|
|
dfdcd47ad7 | ||
|
|
414c650550 | ||
|
|
2d9ca4c335 | ||
|
|
6c19996f95 | ||
|
|
377d5c00aa | ||
|
|
5fb9cf3be1 | ||
|
|
ceebc68d18 | ||
|
|
aff8090adb | ||
|
|
cee1b72f2f | ||
|
|
bd39e449d7 | ||
|
|
836e1d4f39 | ||
|
|
792393345d | ||
|
|
66be7ebc50 | ||
|
|
f8b161c04e | ||
|
|
bac361baf6 | ||
|
|
10bcf9c9a3 | ||
|
|
075727ab53 | ||
|
|
5a4e94d263 | ||
|
|
ad3c2be510 | ||
|
|
5641bf63e8 | ||
|
|
79a17d8fe3 | ||
|
|
6814a43418 | ||
|
|
6891256afe | ||
|
|
17b097b1a3 | ||
|
|
a96c7e631e | ||
|
|
9df5da2a88 | ||
|
|
3e63551e90 | ||
|
|
2a426e2812 | ||
|
|
c4f4983f6d | ||
|
|
a925c7410a | ||
|
|
f7e2f3a4d5 | ||
|
|
b1befacb84 | ||
|
|
23ebb0e754 | ||
| 5f9e8dedec | |||
|
|
3b2015e816 | ||
|
|
f1e851e1b8 | ||
|
|
b191d3918e | ||
|
|
db46050b16 | ||
|
|
1cf69361a1 | ||
|
|
689fab2ba4 | ||
|
|
b36c757753 | ||
|
|
63f19aa4d6 | ||
|
|
8728d88dde | ||
|
|
f6888b099e | ||
|
|
239ceb75a9 | ||
|
|
20c9ed27fb | ||
|
|
ac4526744a | ||
|
|
d2a8ac54cf | ||
|
|
153b16ebd7 | ||
|
|
b535791c66 | ||
|
|
6ed7e8fa40 | ||
|
|
9d95bbaa8c | ||
|
|
e41ec4ebfd | ||
|
|
195d5b1aa2 | ||
|
|
7ea3fb1500 | ||
|
|
9be8589437 | ||
|
|
ff81d339ef | ||
|
|
7858225565 | ||
|
|
83bd1deafd | ||
|
|
9158e1c270 | ||
|
|
f0d182771d | ||
|
|
6081ed35bc | ||
|
|
4ca10c7869 | ||
|
|
9fc31b1021 | ||
|
|
366a5162b7 | ||
|
|
6fd58c418e | ||
|
|
08d9ae0ae6 | ||
|
|
27eb53e1a1 | ||
|
|
31b5685251 | ||
|
|
894cf2c886 | ||
|
|
5b3079acde | ||
|
|
0f49503abd | ||
|
|
be4e1edc3e | ||
|
|
1982694ef0 | ||
|
|
8b475e9f54 | ||
|
|
2b546eb4b3 | ||
|
|
69cefb6822 | ||
|
|
9772227146 | ||
|
|
34bddc7db1 | ||
|
|
7ff4ce18ff | ||
|
|
6e7a7c9350 | ||
|
|
2a9c6bbd1d | ||
|
|
0835a6559c | ||
|
|
489c4a3661 | ||
|
|
43dca143fa | ||
|
|
6bd13feba6 | ||
|
|
d1557e5292 | ||
|
|
c9fbafe014 | ||
|
|
0612b923e1 | ||
|
|
6f13a33be2 | ||
|
|
4ccf969f7a | ||
|
|
3d206e06d0 | ||
|
|
25e90deed6 | ||
|
|
7bc687194f | ||
|
|
d3bd377264 | ||
|
|
974c55418b | ||
|
|
0870a86a3a | ||
|
|
dd2e2c5b3a | ||
|
|
75a1b14beb | ||
|
|
8a760dc1e2 | ||
|
|
fc0b885a14 | ||
|
|
f12ad5c874 | ||
|
|
fd0584b406 | ||
|
|
374f6e40bb | ||
|
|
9c9e17a9d9 | ||
|
|
865a26cbbe | ||
|
|
56e825cad4 | ||
|
|
1df608e902 | ||
|
|
c631c37a34 | ||
|
|
07b6d3558a | ||
|
|
05a0a6b539 | ||
|
|
ca54313bd8 | ||
|
|
7a96c1ff76 | ||
|
|
83c15c05bb | ||
|
|
ae46520edf | ||
|
|
5d9d64e6e7 | ||
|
|
4e8f54bb61 | ||
|
|
0eac545271 | ||
|
|
ec0877004c | ||
|
|
b171071893 | ||
|
|
91fd32b708 | ||
|
|
564c9ff0ca | ||
| 71b222e0b0 | |||
| 5921f60af2 | |||
| 39269583c3 | |||
| cba3899c62 | |||
|
|
d8c90184b9 | ||
|
|
5b1ca13225 | ||
|
|
0d8ac5b7ac | ||
| f6e9cf644a | |||
| 604bfb5fe6 | |||
| b3ea47b989 | |||
| 5d368e59a0 | |||
| 3afd3ce2d5 | |||
|
|
0094216ff8 | ||
|
|
298ee284e1 | ||
|
|
7f2f73afd8 | ||
| 9f8b15f0d5 | |||
|
|
bb2e22ecf2 | ||
|
|
4b62395d69 | ||
|
|
bbaa2dfc73 | ||
|
|
ab22b88a53 | ||
|
|
eb978c767e | ||
|
|
661dc8ea1c | ||
|
|
b6696564f5 | ||
|
|
316e5b2845 | ||
|
|
c1738bcb0a | ||
|
|
7b3e41efae | ||
|
|
3cef8cfd61 | ||
|
|
09964df198 | ||
|
|
dd8e6bf694 | ||
|
|
58cd3e82f6 | ||
|
|
5dd9171316 | ||
|
|
d6b1478bf1 | ||
|
|
e5bd90f58b | ||
|
|
d1972a56e2 | ||
|
|
69a7e1f25c | ||
|
|
b43ed886b9 | ||
|
|
18a0e8d612 | ||
|
|
0917a743cd | ||
|
|
fb5cedc575 | ||
|
|
e52b7170ce | ||
|
|
dd7233aaf7 | ||
|
|
cd0878f810 | ||
|
|
f588d6da51 | ||
|
|
2901e3898c | ||
|
|
c63200cba0 | ||
|
|
c8a02ac607 | ||
|
|
09a304c214 | ||
|
|
c45cba18a6 | ||
|
|
fccd43502b |
17
.github/data/bt.sh
vendored
Normal file
17
.github/data/bt.sh
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# https://gist.github.com/ongardie/aa15f1f0d0e6b59890a9
|
||||
gdb -q --batch \
|
||||
-ex 'handle SIGHUP nostop pass' \
|
||||
-ex 'handle SIGQUIT nostop pass' \
|
||||
-ex 'handle SIGPIPE nostop pass' \
|
||||
-ex 'handle SIGALRM nostop pass' \
|
||||
-ex 'handle SIGTERM nostop pass' \
|
||||
-ex 'handle SIGUSR1 nostop pass' \
|
||||
-ex 'handle SIGUSR2 nostop pass' \
|
||||
-ex 'handle SIGCHLD nostop pass' \
|
||||
-ex 'set print thread-events off' \
|
||||
-return-child-result \
|
||||
-ex 'run' \
|
||||
-ex 'thread apply all bt' \
|
||||
--tty=/dev/stdout \
|
||||
--args $*
|
||||
3
.github/workflows/build_linux.yml
vendored
3
.github/workflows/build_linux.yml
vendored
@@ -45,7 +45,8 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev libwayland-dev
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
|
||||
- name: Setup Vulkan
|
||||
uses: ./.github/actions/vulkan
|
||||
- name: Setup .NET
|
||||
|
||||
4
.github/workflows/cd.yml
vendored
4
.github/workflows/cd.yml
vendored
@@ -88,7 +88,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
|
||||
- name: Setup Vulkan
|
||||
uses: ./.github/actions/vulkan
|
||||
- name: Setup .NET
|
||||
@@ -120,7 +120,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
|
||||
- name: Setup Vulkan
|
||||
uses: ./.github/actions/vulkan
|
||||
- name: Setup .NET
|
||||
|
||||
13
.github/workflows/tests.yml
vendored
13
.github/workflows/tests.yml
vendored
@@ -29,25 +29,22 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev gdb
|
||||
chmod +x .github/data/bt.sh
|
||||
- name: Build
|
||||
run: |
|
||||
./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs -dotnet=8
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=8 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=8 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget -UseLargeWorlds=true
|
||||
dotnet msbuild Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo
|
||||
dotnet msbuild Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo
|
||||
- name: Test
|
||||
run: |
|
||||
${GITHUB_WORKSPACE}/Binaries/Editor/Linux/Development/FlaxTests
|
||||
${GITHUB_WORKSPACE}/.github/data/bt.sh ./Binaries/Editor/Linux/Development/FlaxTests -headless
|
||||
dotnet test -f net8.0 Binaries/Tests/Flax.Build.Tests.dll
|
||||
cp Binaries/Editor/Linux/Development/FlaxEngine.CSharp.dll Binaries/Tests
|
||||
cp Binaries/Editor/Linux/Development/FlaxEngine.CSharp.runtimeconfig.json Binaries/Tests
|
||||
cp Binaries/Editor/Linux/Development/Newtonsoft.Json.dll Binaries/Tests
|
||||
dotnet test -f net8.0 Binaries/Tests/FlaxEngine.CSharp.dll
|
||||
- name: Test UseLargeWorlds
|
||||
run: |
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=8 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget -UseLargeWorlds=true
|
||||
${GITHUB_WORKSPACE}/Binaries/Editor/Linux/Development/FlaxTests
|
||||
|
||||
# Tests on Windows
|
||||
tests-windows:
|
||||
@@ -77,7 +74,7 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
.\Binaries\Editor\Win64\Development\FlaxTests.exe
|
||||
.\Binaries\Editor\Win64\Development\FlaxTests.exe -headless
|
||||
if(!$?) { Write-Host "Tests failed with exit code $LastExitCode" -ForegroundColor Red; Exit $LastExitCode }
|
||||
dotnet test -f net8.0 Binaries\Tests\Flax.Build.Tests.dll
|
||||
xcopy /y Binaries\Editor\Win64\Development\FlaxEngine.CSharp.dll Binaries\Tests
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Redirect to our own Git LFS server
|
||||
[lfs]
|
||||
url="https://gitlab.flaxengine.com/flax/flaxengine.git/info/lfs"
|
||||
#url="https://gitlab.flaxengine.com/flax/flaxengine.git/info/lfs"
|
||||
locksverify = false
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Editor/IconsAtlas.flax
LFS
BIN
Content/Editor/IconsAtlas.flax
LFS
Binary file not shown.
Binary file not shown.
@@ -42,10 +42,10 @@ struct MaterialInput
|
||||
float2 SvPositionToDecalUV(float4 svPosition)
|
||||
{
|
||||
float2 screenUV = svPosition.xy * ScreenSize.zw;
|
||||
svPosition.z = SAMPLE_RT(DepthBuffer, screenUV).r;
|
||||
float4 positionHS = mul(float4(svPosition.xyz, 1), SvPositionToWorld);
|
||||
svPosition.z = SAMPLE_RT_DEPTH(DepthBuffer, screenUV);
|
||||
float4 positionHS = PROJECT_POINT(float4(svPosition.xyz, 1), SvPositionToWorld);
|
||||
float3 positionWS = positionHS.xyz / positionHS.w;
|
||||
float3 positionOS = mul(float4(positionWS, 1), InvWorld).xyz;
|
||||
float3 positionOS = PROJECT_POINT(float4(positionWS, 1), InvWorld).xyz;
|
||||
return positionOS.xz + 0.5f;
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ META_VS_IN_ELEMENT(POSITION, 0, R32G32B32_FLOAT, 0, 0, PER_VERTEX, 0, true)
|
||||
void VS_Decal(in float3 Position : POSITION0, out float4 SvPosition : SV_Position)
|
||||
{
|
||||
// Compute world space vertex position
|
||||
float3 worldPosition = mul(float4(Position.xyz, 1), WorldMatrix).xyz;
|
||||
float3 worldPosition = PROJECT_POINT(float4(Position.xyz, 1), WorldMatrix).xyz;
|
||||
|
||||
// Compute clip space position
|
||||
SvPosition = mul(float4(worldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
SvPosition = PROJECT_POINT(float4(worldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
}
|
||||
|
||||
// Pixel Shader function for decals rendering
|
||||
@@ -213,11 +213,11 @@ void PS_Decal(
|
||||
}
|
||||
|
||||
float2 screenUV = SvPosition.xy * ScreenSize.zw;
|
||||
SvPosition.z = SAMPLE_RT(DepthBuffer, screenUV).r;
|
||||
SvPosition.z = SAMPLE_RT_DEPTH(DepthBuffer, screenUV);
|
||||
|
||||
float4 positionHS = mul(float4(SvPosition.xyz, 1), SvPositionToWorld);
|
||||
float4 positionHS = PROJECT_POINT(float4(SvPosition.xyz, 1), SvPositionToWorld);
|
||||
float3 positionWS = positionHS.xyz / positionHS.w;
|
||||
float3 positionOS = mul(float4(positionWS, 1), InvWorld).xyz;
|
||||
float3 positionOS = PROJECT_POINT(float4(positionWS, 1), InvWorld).xyz;
|
||||
|
||||
clip(0.5 - abs(positionOS.xyz));
|
||||
float2 decalUVs = positionOS.xz + 0.5f;
|
||||
|
||||
@@ -308,7 +308,7 @@ VertexOutput VS_SplineModel(ModelInput input)
|
||||
world = mul(world, WorldMatrix);
|
||||
|
||||
// Compute clip space position
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
|
||||
// Pass vertex attributes
|
||||
output.Geometry.TexCoord = input.TexCoord0;
|
||||
@@ -338,7 +338,7 @@ VertexOutput VS_SplineModel(ModelInput input)
|
||||
#if USE_POSITION_OFFSET
|
||||
output.Geometry.WorldPosition += material.PositionOffset;
|
||||
output.Geometry.PrevWorldPosition += material.PositionOffset;
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
#endif
|
||||
|
||||
// Get tessalation multiplier (per vertex)
|
||||
|
||||
@@ -67,7 +67,7 @@ float Rand(inout uint seed)
|
||||
float3 ReprojectPosition(float2 uv, float rawDepth)
|
||||
{
|
||||
uv = uv * float2(2.0, -2.0) + float2(-1.0, 1.0);
|
||||
float4 pos = mul(float4(uv.x, uv.y, rawDepth, 1.0f), InvViewProjectionMatrix);
|
||||
float4 pos = PROJECT_POINT(float4(uv.x, uv.y, rawDepth, 1.0f), InvViewProjectionMatrix);
|
||||
return pos.xyz / pos.w;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void SpawnParticle(Context context)
|
||||
@4}
|
||||
|
||||
// Main entry point for the particles simulation and spawning
|
||||
META_CS(true, FEATURE_LEVEL_SM5)
|
||||
META_CS(true, AUTO)
|
||||
[numthreads(THREAD_GROUP_SIZE, 1, 1)]
|
||||
void CS_Main(uint3 dispatchThreadId : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
@@ -227,7 +227,7 @@ VertexOutput VS_GUI(Render2DVertex input)
|
||||
if ((int)input.CustomDataAndClipOrigin.y & 1)
|
||||
input.Position = (int2)input.Position;
|
||||
|
||||
output.Position = mul(float4(input.Position, 0, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(input.Position, 0, 1), ViewProjectionMatrix);
|
||||
output.WorldPosition = mul(float4(input.Position, 0, 1), WorldMatrix).xyz;
|
||||
output.TexCoord = input.TexCoord;
|
||||
output.WindowPos = input.Position;
|
||||
|
||||
@@ -393,7 +393,7 @@ VertexOutput VS_Sprite(SpriteInput input, uint particleIndex : SV_InstanceID)
|
||||
output.WorldPosition = position + spriteVertexPosition;
|
||||
|
||||
// Compute clip space position
|
||||
output.Position = mul(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
|
||||
// Pass vertex attributes
|
||||
output.TexCoord = input.TexCoord;
|
||||
@@ -431,7 +431,7 @@ VertexOutput VS_Sprite(SpriteInput input, uint particleIndex : SV_InstanceID)
|
||||
// Apply world position offset per-vertex
|
||||
#if USE_POSITION_OFFSET
|
||||
output.WorldPosition += material.PositionOffset;
|
||||
output.Position = mul(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
#endif
|
||||
|
||||
// Copy interpolants for other shader stages
|
||||
@@ -511,7 +511,7 @@ VertexOutput VS_Model(ModelInput input, uint particleIndex : SV_InstanceID)
|
||||
output.WorldPosition = mul(float4(input.Position, 1), world).xyz;
|
||||
|
||||
// Compute clip space position
|
||||
output.Position = mul(float4(output.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.WorldPosition, 1), ViewProjectionMatrix);
|
||||
|
||||
// Pass vertex attributes
|
||||
output.TexCoord = input.TexCoord0;
|
||||
@@ -549,7 +549,7 @@ VertexOutput VS_Model(ModelInput input, uint particleIndex : SV_InstanceID)
|
||||
// Apply world position offset per-vertex
|
||||
#if USE_POSITION_OFFSET
|
||||
output.WorldPosition += material.PositionOffset;
|
||||
output.Position = mul(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
#endif
|
||||
|
||||
// Copy interpolants for other shader stages
|
||||
@@ -617,7 +617,7 @@ VertexOutput VS_Ribbon(RibbonInput input, uint vertexIndex : SV_VertexID)
|
||||
output.WorldPosition = position + tangentRight * vertexSign * (ribbonWidth.xxx * 0.5f);
|
||||
|
||||
// Compute clip space position
|
||||
output.Position = mul(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
|
||||
// Pass vertex attributes
|
||||
output.ParticleIndex = particleIndex;
|
||||
@@ -655,7 +655,7 @@ VertexOutput VS_Ribbon(RibbonInput input, uint vertexIndex : SV_VertexID)
|
||||
// Apply world position offset per-vertex
|
||||
#if USE_POSITION_OFFSET
|
||||
output.WorldPosition += material.PositionOffset;
|
||||
output.Position = mul(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.WorldPosition.xyz, 1), ViewProjectionMatrix);
|
||||
#endif
|
||||
|
||||
// Copy interpolants for other shader stages
|
||||
|
||||
@@ -342,7 +342,7 @@ VertexOutput VS(ModelInput input)
|
||||
output.Geometry.PrevWorldPosition = mul(float4(input.Position.xyz, 1), object.PrevWorldMatrix).xyz;
|
||||
|
||||
// Compute clip space position
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
|
||||
// Pass vertex attributes
|
||||
output.Geometry.TexCoords01 = float4(input.TexCoord0, input.TexCoord1);
|
||||
@@ -378,7 +378,7 @@ VertexOutput VS(ModelInput input)
|
||||
#if USE_POSITION_OFFSET
|
||||
output.Geometry.WorldPosition += material.PositionOffset;
|
||||
output.Geometry.PrevWorldPosition += material.PositionOffset;
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
#endif
|
||||
|
||||
// Get tessalation multiplier (per vertex)
|
||||
@@ -412,7 +412,7 @@ float4 VS_Depth(ModelInput_PosOnly input) : SV_Position
|
||||
|
||||
// Transform vertex position into the screen
|
||||
float3 worldPosition = mul(float4(input.Position.xyz, 1), object.WorldMatrix).xyz;
|
||||
float4 position = mul(float4(worldPosition, 1), ViewProjectionMatrix);
|
||||
float4 position = PROJECT_POINT(float4(worldPosition, 1), ViewProjectionMatrix);
|
||||
return position;
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ VertexOutput VS_Skinned(ModelInput_Skinned input)
|
||||
#endif
|
||||
|
||||
// Compute clip space position
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
|
||||
// Pass vertex attributes
|
||||
output.Geometry.TexCoords01 = float4(input.TexCoord0, input.TexCoord1);
|
||||
@@ -549,7 +549,7 @@ VertexOutput VS_Skinned(ModelInput_Skinned input)
|
||||
#if USE_POSITION_OFFSET
|
||||
output.Geometry.WorldPosition += material.PositionOffset;
|
||||
output.Geometry.PrevWorldPosition += material.PositionOffset;
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
#endif
|
||||
|
||||
// Get tessalation multiplier (per vertex)
|
||||
|
||||
@@ -388,7 +388,7 @@ VertexOutput VS(TerrainVertexInput input)
|
||||
output.Geometry.WorldPosition = mul(float4(position, 1), worldMatrix).xyz;
|
||||
|
||||
// Compute clip space position
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
|
||||
// Pass vertex attributes
|
||||
#if USE_SMOOTH_LOD_TRANSITION
|
||||
@@ -436,7 +436,7 @@ VertexOutput VS(TerrainVertexInput input)
|
||||
// Apply world position offset per-vertex
|
||||
#if USE_POSITION_OFFSET
|
||||
output.Geometry.WorldPosition += material.PositionOffset;
|
||||
output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
output.Position = PROJECT_POINT(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix);
|
||||
#endif
|
||||
|
||||
// Get tessalation multiplier (per vertex)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/BitonicSort.flax
LFS
BIN
Content/Shaders/BitonicSort.flax
LFS
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/DebugDraw.flax
LFS
BIN
Content/Shaders/DebugDraw.flax
LFS
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/Fog.flax
LFS
BIN
Content/Shaders/Fog.flax
LFS
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/GUI.flax
LFS
BIN
Content/Shaders/GUI.flax
LFS
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/Histogram.flax
LFS
BIN
Content/Shaders/Histogram.flax
LFS
Binary file not shown.
BIN
Content/Shaders/Lights.flax
LFS
BIN
Content/Shaders/Lights.flax
LFS
Binary file not shown.
BIN
Content/Shaders/MotionBlur.flax
LFS
BIN
Content/Shaders/MotionBlur.flax
LFS
Binary file not shown.
BIN
Content/Shaders/MultiScaler.flax
LFS
BIN
Content/Shaders/MultiScaler.flax
LFS
Binary file not shown.
BIN
Content/Shaders/Quad.flax
LFS
BIN
Content/Shaders/Quad.flax
LFS
Binary file not shown.
BIN
Content/Shaders/Reflections.flax
LFS
BIN
Content/Shaders/Reflections.flax
LFS
Binary file not shown.
BIN
Content/Shaders/SSAO.flax
LFS
BIN
Content/Shaders/SSAO.flax
LFS
Binary file not shown.
BIN
Content/Shaders/Shadows.flax
LFS
BIN
Content/Shaders/Shadows.flax
LFS
Binary file not shown.
BIN
Content/Shaders/Sky.flax
LFS
BIN
Content/Shaders/Sky.flax
LFS
Binary file not shown.
BIN
Content/Shaders/TAA.flax
LFS
BIN
Content/Shaders/TAA.flax
LFS
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
"Major": 1,
|
||||
"Minor": 12,
|
||||
"Revision": 0,
|
||||
"Build": 6905
|
||||
"Build": 6908
|
||||
},
|
||||
"Company": "Flax",
|
||||
"Copyright": "Copyright (c) 2012-2026 Wojciech Figat. All rights reserved.",
|
||||
|
||||
@@ -12,6 +12,6 @@ cd "`dirname "$0"`"
|
||||
bash ./Development/Scripts/Mac/CallBuildTool.sh --genproject "$@"
|
||||
|
||||
# Build bindings for all editor configurations
|
||||
#echo Building C# bindings...
|
||||
echo Building C# bindings...
|
||||
# TODO: Detect the correct architecture here
|
||||
#Binaries/Tools/Flax.Build -build -BuildBindingsOnly -arch=ARM64 -platform=Mac --buildTargets=FlaxEditor
|
||||
Binaries/Tools/Flax.Build -build -BuildBindingsOnly -arch=ARM64 -platform=Mac --buildTargets=FlaxEditor
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace FlaxEditor.Content.Thumbnails
|
||||
{
|
||||
if (item == null)
|
||||
throw new ArgumentNullException();
|
||||
if (_task == null)
|
||||
return;
|
||||
|
||||
// Check if use default icon
|
||||
var defaultThumbnail = item.DefaultThumbnail;
|
||||
@@ -223,11 +225,12 @@ namespace FlaxEditor.Content.Thumbnails
|
||||
/// <inheritdoc />
|
||||
public override void OnInit()
|
||||
{
|
||||
if (Editor.IsHeadlessMode || (GPUDevice.Instance != null && GPUDevice.Instance.RendererType == RendererType.Null))
|
||||
return;
|
||||
|
||||
// Create cache folder
|
||||
if (!Directory.Exists(_cacheFolder))
|
||||
{
|
||||
Directory.CreateDirectory(_cacheFolder);
|
||||
}
|
||||
|
||||
// Find atlases in a Editor cache directory
|
||||
var files = Directory.GetFiles(_cacheFolder, "cache_*.flax", SearchOption.TopDirectoryOnly);
|
||||
@@ -482,7 +485,7 @@ namespace FlaxEditor.Content.Thumbnails
|
||||
public override void OnUpdate()
|
||||
{
|
||||
// Wait some frames before start generating previews (late init feature)
|
||||
if (Time.TimeSinceStartup < 1.0f || HasAllAtlasesLoaded() == false)
|
||||
if (Time.TimeSinceStartup < 1.0f || HasAllAtlasesLoaded() == false || _task == null)
|
||||
return;
|
||||
|
||||
lock (_requests)
|
||||
|
||||
@@ -141,6 +141,11 @@ API_ENUM() enum class BuildPlatform
|
||||
/// </summary>
|
||||
API_ENUM(Attributes="EditorDisplay(null, \"Windows ARM64\")")
|
||||
WindowsARM64 = 15,
|
||||
|
||||
/// <summary>
|
||||
/// Web
|
||||
/// </summary>
|
||||
Web = 16,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -188,6 +193,11 @@ enum class DotNetAOTModes
|
||||
/// Use Mono AOT to cross-compile all used C# assemblies into native platform static libraries which can be linked into a single shared library.
|
||||
/// </summary>
|
||||
MonoAOTStatic,
|
||||
|
||||
/// <summary>
|
||||
/// Target platform doesn't support .NET or it has been disabled.
|
||||
/// </summary>
|
||||
NoDotnet,
|
||||
};
|
||||
|
||||
extern FLAXENGINE_API const Char* ToString(const BuildPlatform platform);
|
||||
|
||||
@@ -69,6 +69,10 @@
|
||||
#include "Platform/iOS/iOSPlatformTools.h"
|
||||
#include "Engine/Platform/iOS/iOSPlatformSettings.h"
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_WEB
|
||||
#include "Platform/Web/WebPlatformTools.h"
|
||||
#include "Engine/Platform/Web/WebPlatformSettings.h"
|
||||
#endif
|
||||
|
||||
namespace GameCookerImpl
|
||||
{
|
||||
@@ -151,6 +155,8 @@ const Char* ToString(const BuildPlatform platform)
|
||||
return TEXT("iOS ARM64");
|
||||
case BuildPlatform::WindowsARM64:
|
||||
return TEXT("Windows ARM64");
|
||||
case BuildPlatform::Web:
|
||||
return TEXT("Web");
|
||||
default:
|
||||
return TEXT("");
|
||||
}
|
||||
@@ -183,6 +189,8 @@ const Char* ToString(const DotNetAOTModes mode)
|
||||
return TEXT("MonoAOTDynamic");
|
||||
case DotNetAOTModes::MonoAOTStatic:
|
||||
return TEXT("MonoAOTStatic");
|
||||
case DotNetAOTModes::NoDotnet:
|
||||
return TEXT("NoDotnet");
|
||||
default:
|
||||
return TEXT("");
|
||||
}
|
||||
@@ -307,6 +315,10 @@ void CookingData::GetBuildPlatformName(const Char*& platform, const Char*& archi
|
||||
platform = TEXT("Windows");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
case BuildPlatform::Web:
|
||||
platform = TEXT("Web");
|
||||
architecture = TEXT("x86");
|
||||
break;
|
||||
default:
|
||||
LOG(Fatal, "Unknown or unsupported build platform.");
|
||||
}
|
||||
@@ -461,6 +473,11 @@ PlatformTools* GameCooker::GetTools(BuildPlatform platform)
|
||||
case BuildPlatform::iOSARM64:
|
||||
result = New<iOSPlatformTools>();
|
||||
break;
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_WEB
|
||||
case BuildPlatform::Web:
|
||||
result = New<WebPlatformTools>();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
Tools.Add(platform, result);
|
||||
@@ -604,6 +621,9 @@ void GameCooker::GetCurrentPlatform(PlatformType& platform, BuildPlatform& build
|
||||
case PlatformType::iOS:
|
||||
buildPlatform = BuildPlatform::iOSARM64;
|
||||
break;
|
||||
case PlatformType::Web:
|
||||
buildPlatform = BuildPlatform::Web;
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ namespace FlaxEditor
|
||||
case BuildPlatform.MacOSARM64:
|
||||
case BuildPlatform.MacOSx64: return PlatformType.Mac;
|
||||
case BuildPlatform.iOSARM64: return PlatformType.iOS;
|
||||
case BuildPlatform.Web: return PlatformType.Web;
|
||||
default: throw new ArgumentOutOfRangeException(nameof(buildPlatform), buildPlatform, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,7 @@ Array<byte> AndroidPlatformTools::SaveCache(CookingData& data, IBuildCache* cach
|
||||
result.Add((const byte*)&platformCache, sizeof(platformCache));
|
||||
return result;
|
||||
}
|
||||
|
||||
void AndroidPlatformTools::OnBuildStarted(CookingData& data)
|
||||
{
|
||||
// Adjust the cooking output folder to be located inside the Gradle assets directory
|
||||
@@ -411,7 +412,6 @@ bool AndroidPlatformTools::OnPostProcess(CookingData& data)
|
||||
return true;
|
||||
}
|
||||
LOG(Info, "Output Android APK application package: {0} (size: {1} MB)", outputApk, FileSystem::GetFileSize(outputApk) / 1024 / 1024);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
271
Source/Editor/Cooker/Platform/Web/WebPlatformTools.cpp
Normal file
271
Source/Editor/Cooker/Platform/Web/WebPlatformTools.cpp
Normal file
@@ -0,0 +1,271 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
#if PLATFORM_TOOLS_WEB
|
||||
|
||||
#include "WebPlatformTools.h"
|
||||
#include "Engine/Platform/File.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Platform/CreateProcessSettings.h"
|
||||
#include "Engine/Platform/Web/WebPlatformSettings.h"
|
||||
#include "Engine/Core/Types/Span.h"
|
||||
#include "Engine/Core/Math/Vector2.h"
|
||||
#include "Engine/Core/Config/GameSettings.h"
|
||||
#include "Engine/Core/Config/BuildSettings.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Content/JsonAsset.h"
|
||||
#include "Engine/Graphics/PixelFormatExtensions.h"
|
||||
#include "Engine/Graphics/Textures/TextureBase.h"
|
||||
#include "Editor/Cooker/GameCooker.h"
|
||||
|
||||
IMPLEMENT_SETTINGS_GETTER(WebPlatformSettings, WebPlatform);
|
||||
|
||||
namespace
|
||||
{
|
||||
struct WebPlatformCache
|
||||
{
|
||||
WebPlatformSettings::TextureCompression TexturesCompression;
|
||||
};
|
||||
}
|
||||
|
||||
const Char* WebPlatformTools::GetDisplayName() const
|
||||
{
|
||||
return TEXT("Web");
|
||||
}
|
||||
|
||||
const Char* WebPlatformTools::GetName() const
|
||||
{
|
||||
return TEXT("Web");
|
||||
}
|
||||
|
||||
PlatformType WebPlatformTools::GetPlatform() const
|
||||
{
|
||||
return PlatformType::Web;
|
||||
}
|
||||
|
||||
ArchitectureType WebPlatformTools::GetArchitecture() const
|
||||
{
|
||||
return ArchitectureType::x86;
|
||||
}
|
||||
|
||||
DotNetAOTModes WebPlatformTools::UseAOT() const
|
||||
{
|
||||
return DotNetAOTModes::MonoAOTDynamic;//MonoAOTStatic;// DotNetAOTModes::None;//DotNetAOTModes::MonoAOTStatic;//DotNetAOTModes::NoDotnet;
|
||||
}
|
||||
|
||||
PixelFormat WebPlatformTools::GetTextureFormat(CookingData& data, TextureBase* texture, PixelFormat format)
|
||||
{
|
||||
const auto platformSettings = WebPlatformSettings::Get();
|
||||
const auto uncompressed = PixelFormatExtensions::FindUncompressedFormat(format);
|
||||
switch (platformSettings->TexturesCompression)
|
||||
{
|
||||
case WebPlatformSettings::TextureCompression::Uncompressed:
|
||||
return uncompressed;
|
||||
case WebPlatformSettings::TextureCompression::BC:
|
||||
return format;
|
||||
case WebPlatformSettings::TextureCompression::ASTC:
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormat::BC4_SNorm:
|
||||
return PixelFormat::R8_SNorm;
|
||||
case PixelFormat::BC5_SNorm:
|
||||
return PixelFormat::R16G16_SNorm;
|
||||
case PixelFormat::BC6H_Typeless:
|
||||
case PixelFormat::BC6H_Uf16:
|
||||
case PixelFormat::BC6H_Sf16:
|
||||
case PixelFormat::BC7_Typeless:
|
||||
case PixelFormat::BC7_UNorm:
|
||||
case PixelFormat::BC7_UNorm_sRGB:
|
||||
return PixelFormat::R16G16B16A16_Float; // TODO: ASTC HDR
|
||||
default:
|
||||
return PixelFormatExtensions::IsSRGB(format) ? PixelFormat::ASTC_6x6_UNorm_sRGB : PixelFormat::ASTC_6x6_UNorm;
|
||||
}
|
||||
case WebPlatformSettings::TextureCompression::Basis:
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormat::BC7_Typeless:
|
||||
case PixelFormat::BC7_UNorm:
|
||||
case PixelFormat::BC7_UNorm_sRGB:
|
||||
return PixelFormat::R16G16B16A16_Float; // Basic Universal doesn't support alpha in BC7 (and it can be loaded only from LDR formats)
|
||||
default:
|
||||
if (uncompressed != format && texture->Size().MinValue() >= 16)
|
||||
return PixelFormat::Basis;
|
||||
return uncompressed;
|
||||
}
|
||||
default:
|
||||
return format;
|
||||
}
|
||||
}
|
||||
|
||||
void WebPlatformTools::LoadCache(CookingData& data, IBuildCache* cache, const Span<byte>& bytes)
|
||||
{
|
||||
const auto platformSettings = WebPlatformSettings::Get();
|
||||
bool invalidTextures = true;
|
||||
if (bytes.Length() == sizeof(WebPlatformCache))
|
||||
{
|
||||
auto* platformCache = (WebPlatformCache*)bytes.Get();
|
||||
invalidTextures = platformCache->TexturesCompression != platformSettings->TexturesCompression;
|
||||
}
|
||||
if (invalidTextures)
|
||||
{
|
||||
LOG(Info, "{0} option has been modified.", TEXT("TexturesQuality"));
|
||||
cache->InvalidateCacheTextures();
|
||||
}
|
||||
}
|
||||
|
||||
Array<byte> WebPlatformTools::SaveCache(CookingData& data, IBuildCache* cache)
|
||||
{
|
||||
const auto platformSettings = WebPlatformSettings::Get();
|
||||
WebPlatformCache platformCache;
|
||||
platformCache.TexturesCompression = platformSettings->TexturesCompression;
|
||||
Array<byte> result;
|
||||
result.Add((const byte*)&platformCache, sizeof(platformCache));
|
||||
return result;
|
||||
}
|
||||
|
||||
bool WebPlatformTools::IsNativeCodeFile(CookingData& data, const String& file)
|
||||
{
|
||||
String extension = FileSystem::GetExtension(file);
|
||||
return extension.IsEmpty() || extension == TEXT("html") || extension == TEXT("js") || extension == TEXT("wasm");
|
||||
}
|
||||
|
||||
void WebPlatformTools::OnBuildStarted(CookingData& data)
|
||||
{
|
||||
// Adjust the cooking output folder for the data files so file_packager tool can compress and output final data inside the cooker output folder
|
||||
data.DataOutputPath = data.CacheDirectory / TEXT("Files");
|
||||
}
|
||||
|
||||
bool WebPlatformTools::OnPostProcess(CookingData& data)
|
||||
{
|
||||
const auto gameSettings = GameSettings::Get();
|
||||
const auto platformSettings = WebPlatformSettings::Get();
|
||||
const auto platformDataPath = data.GetPlatformBinariesRoot();
|
||||
|
||||
// Get name of the output binary (JavaScript and WebAssembly files match)
|
||||
String gameJs;
|
||||
{
|
||||
Array<String> files;
|
||||
FileSystem::DirectoryGetFiles(files, data.OriginalOutputPath, TEXT("*"), DirectorySearchOption::TopDirectoryOnly);
|
||||
for (const String& file : files)
|
||||
{
|
||||
if (file.EndsWith(TEXT(".js")))
|
||||
{
|
||||
String outputWasm = String(StringUtils::GetPathWithoutExtension(file)) + TEXT(".wasm");
|
||||
if (files.Contains(outputWasm))
|
||||
{
|
||||
gameJs = file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gameJs.IsEmpty())
|
||||
{
|
||||
data.Error(TEXT("Failed to find the main JavaScript for the output game"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Move .wasm assemblies into the data files in order for dlopen to work (blocking)
|
||||
{
|
||||
Array<String> files, files2;
|
||||
FileSystem::DirectoryGetFiles(files, data.OriginalOutputPath, TEXT("*.wasm"), DirectorySearchOption::AllDirectories);
|
||||
FileSystem::DirectoryGetFiles(files, data.OriginalOutputPath, TEXT("*.so"), DirectorySearchOption::AllDirectories);
|
||||
StringView gameWasm = StringUtils::GetFileNameWithoutExtension(gameJs);
|
||||
for (const String& file : files)
|
||||
{
|
||||
if (StringUtils::GetFileNameWithoutExtension(file) == gameWasm)
|
||||
continue; // Skip the main game module
|
||||
FileSystem::MoveFile(data.DataOutputPath / StringUtils::GetFileName(file), file, true);
|
||||
}
|
||||
for (const String& file : files2)
|
||||
{
|
||||
if (StringUtils::GetFileNameWithoutExtension(file) == gameWasm)
|
||||
continue; // Skip the main game module
|
||||
FileSystem::MoveFile(data.DataOutputPath / StringUtils::GetFileName(file), file, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Pack data files into a single file using Emscripten's file_packager tool
|
||||
{
|
||||
CreateProcessSettings procSettings;
|
||||
String emscriptenSdk = TEXT("EMSDK");
|
||||
Platform::GetEnvironmentVariable(emscriptenSdk, emscriptenSdk);
|
||||
procSettings.FileName = emscriptenSdk / TEXT("upstream/emscripten/tools/file_packager");
|
||||
#if PLATFORM_WIN32
|
||||
procSettings.FileName += TEXT(".bat");
|
||||
#endif
|
||||
procSettings.Arguments = String::Format(TEXT("files.data --preload \"{}@/\" --lz4 --js-output=files.js"), data.DataOutputPath);
|
||||
procSettings.WorkingDirectory = data.OriginalOutputPath;
|
||||
const int32 result = Platform::CreateProcess(procSettings);
|
||||
if (result != 0)
|
||||
{
|
||||
if (!FileSystem::FileExists(procSettings.FileName))
|
||||
data.Error(TEXT("Missing file_packager.bat. Ensure Emscripten SDK installation is valid and 'EMSDK' environment variable points to it."));
|
||||
data.Error(String::Format(TEXT("Failed to package project files (result code: {0}). See log for more info."), result));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy icon file
|
||||
{
|
||||
String dstIcon = data.OriginalOutputPath / TEXT("favicon.ico");
|
||||
if (!FileSystem::FileExists(dstIcon))
|
||||
FileSystem::CopyFile(dstIcon, platformDataPath / TEXT("favicon.ico"));
|
||||
}
|
||||
|
||||
// TODO: customizable HTML templates
|
||||
|
||||
// Insert packaged file system with game data
|
||||
{
|
||||
String gameJsText;
|
||||
if (File::ReadAllText(gameJs, gameJsText))
|
||||
{
|
||||
data.Error(String::Format(TEXT("Failed to load file '{}'"), gameJs));
|
||||
return true;
|
||||
}
|
||||
const String filesIncludeBegin = TEXT("// include: files.js");
|
||||
const String filesIncludeEnd = TEXT("// end include: files.js");
|
||||
String fileJs = data.OriginalOutputPath / TEXT("files.js");
|
||||
if (!gameJsText.Contains(filesIncludeBegin))
|
||||
{
|
||||
// Insert generated files.js into the main game file after the minimum_runtime_check.js include
|
||||
String fileJsText;
|
||||
if (File::ReadAllText(fileJs, fileJsText))
|
||||
{
|
||||
data.Error(String::Format(TEXT("Failed to load file '{}'"), fileJs));
|
||||
return true;
|
||||
}
|
||||
const String insertPrefixLocation = TEXT("// end include: minimum_runtime_check.js");
|
||||
int32 location = gameJsText.Find(insertPrefixLocation);
|
||||
if (location != -1)
|
||||
{
|
||||
location += insertPrefixLocation.Length() + 1;
|
||||
fileJsText = filesIncludeBegin + TEXT("\n") + fileJsText + TEXT("\n") + filesIncludeEnd + TEXT("\n");
|
||||
gameJsText.Insert(location, fileJsText);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Comments are missing in Release when JS/HTML are minified
|
||||
fileJsText.Insert(0, filesIncludeBegin);
|
||||
fileJsText.Insert(0, TEXT("\n"));
|
||||
gameJsText.Insert(0, fileJsText);
|
||||
}
|
||||
File::WriteAllText(gameJs, gameJsText, Encoding::UTF8);
|
||||
}
|
||||
|
||||
// Remove the generated files.js as it's now included in the main game JS file
|
||||
FileSystem::DeleteFile(fileJs);
|
||||
}
|
||||
|
||||
const auto buildSettings = BuildSettings::Get();
|
||||
if (buildSettings->SkipPackaging)
|
||||
return false;
|
||||
GameCooker::PackageFiles();
|
||||
|
||||
// TODO: minify/compress output JS files (in Release builds)
|
||||
|
||||
LOG(Info, "Output website size: {0} MB", FileSystem::GetDirectorySize(data.OriginalOutputPath) / 1024 / 1024);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
29
Source/Editor/Cooker/Platform/Web/WebPlatformTools.h
Normal file
29
Source/Editor/Cooker/Platform/Web/WebPlatformTools.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if PLATFORM_TOOLS_WEB
|
||||
|
||||
#include "../../PlatformTools.h"
|
||||
|
||||
/// <summary>
|
||||
/// The Web platform support tools.
|
||||
/// </summary>
|
||||
class WebPlatformTools : public PlatformTools
|
||||
{
|
||||
public:
|
||||
// [PlatformTools]
|
||||
const Char* GetDisplayName() const override;
|
||||
const Char* GetName() const override;
|
||||
PlatformType GetPlatform() const override;
|
||||
ArchitectureType GetArchitecture() const override;
|
||||
DotNetAOTModes UseAOT() const override;
|
||||
PixelFormat GetTextureFormat(CookingData& data, TextureBase* texture, PixelFormat format) override;
|
||||
void LoadCache(CookingData& data, IBuildCache* cache, const Span<byte>& bytes) override;
|
||||
Array<byte> SaveCache(CookingData& data, IBuildCache* cache) override;
|
||||
bool IsNativeCodeFile(CookingData& data, const String& file) override;
|
||||
void OnBuildStarted(CookingData& data) override;
|
||||
bool OnPostProcess(CookingData& data) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -572,6 +572,14 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
COMPILE_PROFILE(Vulkan_SM5, SHADER_FILE_CHUNK_INTERNAL_VULKAN_SM5_CACHE);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_WEB
|
||||
case BuildPlatform::Web:
|
||||
{
|
||||
const char* platformDefineName = "PLATFORM_WEB";
|
||||
COMPILE_PROFILE(WebGPU, SHADER_FILE_CHUNK_INTERNAL_GENERIC_CACHE);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
@@ -734,37 +742,8 @@ bool ProcessTextureBase(CookAssetsStep::AssetCookData& data)
|
||||
{
|
||||
auto chunk = New<FlaxChunk>();
|
||||
data.InitData.Header.Chunks[mipIndex] = chunk;
|
||||
|
||||
// Calculate the texture data storage layout
|
||||
uint32 rowPitch, slicePitch;
|
||||
const int32 mipWidth = Math::Max(1, textureData->Width >> mipIndex);
|
||||
const int32 mipHeight = Math::Max(1, textureData->Height >> mipIndex);
|
||||
RenderTools::ComputePitch(textureData->Format, mipWidth, mipHeight, rowPitch, slicePitch);
|
||||
chunk->Data.Allocate(slicePitch * textureData->GetArraySize());
|
||||
|
||||
// Copy array slices into mip data (sequential)
|
||||
for (int32 arrayIndex = 0; arrayIndex < textureData->Items.Count(); arrayIndex++)
|
||||
{
|
||||
auto& mipData = textureData->Items[arrayIndex].Mips[mipIndex];
|
||||
byte* src = mipData.Data.Get();
|
||||
byte* dst = chunk->Data.Get() + (slicePitch * arrayIndex);
|
||||
|
||||
// Faster path if source and destination data layout matches
|
||||
if (rowPitch == mipData.RowPitch && slicePitch == mipData.DepthPitch)
|
||||
{
|
||||
Platform::MemoryCopy(dst, src, slicePitch);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto copyRowSize = Math::Min(mipData.RowPitch, rowPitch);
|
||||
for (uint32 line = 0; line < mipData.Lines; line++)
|
||||
{
|
||||
Platform::MemoryCopy(dst, src, copyRowSize);
|
||||
src += mipData.RowPitch;
|
||||
dst += rowPitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TextureTool::WriteTextureData(chunk->Data, *textureData, mipIndex))
|
||||
return true;
|
||||
}
|
||||
|
||||
// Clone any custom asset chunks (eg. sprite atlas data, mips are in 0-13 chunks)
|
||||
|
||||
@@ -39,17 +39,23 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
}
|
||||
String dstDotnet = data.DataOutputPath / TEXT("Dotnet");
|
||||
const DotNetAOTModes aotMode = data.Tools->UseAOT();
|
||||
const bool usAOT = aotMode != DotNetAOTModes::None;
|
||||
const bool usAOT = aotMode != DotNetAOTModes::None && aotMode != DotNetAOTModes::NoDotnet;
|
||||
if (usAOT)
|
||||
{
|
||||
// Deploy Dotnet files into intermediate cooking directory for AOT
|
||||
FileSystem::DeleteDirectory(dstDotnet);
|
||||
dstDotnet = data.ManagedCodeOutputPath;
|
||||
}
|
||||
if (buildSettings.SkipDotnetPackaging && data.Tools->UseSystemDotnet())
|
||||
if (aotMode == DotNetAOTModes::NoDotnet)
|
||||
{
|
||||
// No .NET
|
||||
FileSystem::DeleteDirectory(dstDotnet);
|
||||
}
|
||||
else if (buildSettings.SkipDotnetPackaging && data.Tools->UseSystemDotnet())
|
||||
{
|
||||
// Use system-installed .NET Runtime
|
||||
FileSystem::DeleteDirectory(dstDotnet);
|
||||
LOG(Info, "Not using .NET Runtime");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
void PrecompileAssembliesStep::OnBuildStarted(CookingData& data)
|
||||
{
|
||||
const DotNetAOTModes aotMode = data.Tools->UseAOT();
|
||||
if (aotMode == DotNetAOTModes::None || EnumHasAllFlags(data.Options, BuildOptions::NoCook))
|
||||
if (aotMode == DotNetAOTModes::None ||
|
||||
aotMode == DotNetAOTModes::NoDotnet ||
|
||||
EnumHasAllFlags(data.Options, BuildOptions::NoCook))
|
||||
return;
|
||||
const auto& buildSettings = *BuildSettings::Get();
|
||||
|
||||
@@ -35,8 +37,8 @@ void PrecompileAssembliesStep::OnBuildStarted(CookingData& data)
|
||||
if (cachedData != aotModeCacheValue)
|
||||
{
|
||||
LOG(Info, "AOT cache invalidation");
|
||||
FileSystem::DeleteDirectory(data.ManagedCodeOutputPath); // Remove AOT cache
|
||||
FileSystem::DeleteDirectory(data.DataOutputPath / TEXT("Dotnet")); // Remove deployed Dotnet libs (be sure to remove any leftovers from previous build)
|
||||
//FileSystem::DeleteDirectory(data.ManagedCodeOutputPath); // Remove AOT cache
|
||||
//FileSystem::DeleteDirectory(data.DataOutputPath / TEXT("Dotnet")); // Remove deployed Dotnet libs (be sure to remove any leftovers from previous build)
|
||||
}
|
||||
}
|
||||
if (!FileSystem::DirectoryExists(data.ManagedCodeOutputPath))
|
||||
@@ -49,7 +51,8 @@ void PrecompileAssembliesStep::OnBuildStarted(CookingData& data)
|
||||
bool PrecompileAssembliesStep::Perform(CookingData& data)
|
||||
{
|
||||
const DotNetAOTModes aotMode = data.Tools->UseAOT();
|
||||
if (aotMode == DotNetAOTModes::None)
|
||||
if (aotMode == DotNetAOTModes::None ||
|
||||
aotMode == DotNetAOTModes::NoDotnet)
|
||||
return false;
|
||||
const auto& buildSettings = *BuildSettings::Get();
|
||||
if (buildSettings.SkipDotnetPackaging && data.Tools->UseSystemDotnet())
|
||||
|
||||
@@ -103,11 +103,12 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var actors = ScriptsEditor.ParentEditor.Values;
|
||||
foreach (var a in actors)
|
||||
{
|
||||
if (a.GetType() != requireActor.RequiredType)
|
||||
{
|
||||
item.Enabled = false;
|
||||
break;
|
||||
}
|
||||
if (a.GetType() == requireActor.RequiredType)
|
||||
continue;
|
||||
if (requireActor.IncludeInheritedTypes && a.GetType().IsSubclassOf(requireActor.RequiredType))
|
||||
continue;
|
||||
item.Enabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cm.AddItem(item);
|
||||
@@ -739,6 +740,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(LayoutElementsContainer layout)
|
||||
{
|
||||
var style = FlaxEngine.GUI.Style.Current;
|
||||
|
||||
// Area for drag&drop scripts
|
||||
var dragArea = layout.CustomContainer<DragAreaControl>();
|
||||
dragArea.CustomControl.ScriptsEditor = this;
|
||||
@@ -800,17 +803,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
bool hasAllRequirements = true;
|
||||
if (scriptType.HasAttribute(typeof(RequireScriptAttribute), false))
|
||||
{
|
||||
RequireScriptAttribute scriptAttribute = null;
|
||||
foreach (var e in scriptType.GetAttributes(false))
|
||||
var attribute = (RequireScriptAttribute)scriptType.GetAttributes(false).FirstOrDefault(x => x is RequireScriptAttribute);
|
||||
if (attribute != null)
|
||||
{
|
||||
if (e is not RequireScriptAttribute requireScriptAttribute)
|
||||
continue;
|
||||
scriptAttribute = requireScriptAttribute;
|
||||
}
|
||||
|
||||
if (scriptAttribute != null)
|
||||
{
|
||||
foreach (var type in scriptAttribute.RequiredTypes)
|
||||
foreach (var type in attribute.RequiredTypes)
|
||||
{
|
||||
if (!type.IsSubclassOf(typeof(Script)))
|
||||
continue;
|
||||
@@ -825,19 +821,11 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
if (scriptType.HasAttribute(typeof(RequireActorAttribute), false))
|
||||
{
|
||||
RequireActorAttribute attribute = null;
|
||||
foreach (var e in scriptType.GetAttributes(false))
|
||||
{
|
||||
if (e is not RequireActorAttribute requireActorAttribute)
|
||||
continue;
|
||||
attribute = requireActorAttribute;
|
||||
break;
|
||||
}
|
||||
|
||||
var attribute = (RequireActorAttribute)scriptType.GetAttributes(false).FirstOrDefault(x => x is RequireActorAttribute);
|
||||
if (attribute != null)
|
||||
{
|
||||
var actor = script.Actor;
|
||||
if (actor.GetType() != attribute.RequiredType && !actor.GetType().IsSubclassOf(attribute.RequiredType))
|
||||
if (actor.GetType() != attribute.RequiredType && (attribute.IncludeInheritedTypes && !actor.GetType().IsSubclassOf(attribute.RequiredType)))
|
||||
{
|
||||
Editor.LogWarning($"`{Utilities.Utils.GetPropertyNameUI(scriptType.Name)}` on `{script.Actor}` is missing a required Actor of type `{attribute.RequiredType}`.");
|
||||
hasAllRequirements = false;
|
||||
@@ -850,7 +838,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var title = Utilities.Utils.GetPropertyNameUI(scriptType.Name);
|
||||
var group = layout.Group(title, editor);
|
||||
if (!hasAllRequirements)
|
||||
group.Panel.HeaderTextColor = FlaxEngine.GUI.Style.Current.Statusbar.Failed;
|
||||
group.Panel.HeaderTextColor = style.Statusbar.Failed;
|
||||
if ((Presenter.Features & FeatureFlags.CacheExpandedGroups) != 0)
|
||||
{
|
||||
if (Editor.Instance.ProjectCache.IsGroupToggled(title))
|
||||
@@ -863,9 +851,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
group.Panel.Open();
|
||||
|
||||
// Customize
|
||||
float totalHeaderButtonsOffset = 0f;
|
||||
group.Panel.TooltipText = Editor.Instance.CodeDocs.GetTooltip(scriptType);
|
||||
if (script.HasPrefabLink)
|
||||
group.Panel.HeaderTextColor = FlaxEngine.GUI.Style.Current.ProgressNormal;
|
||||
group.Panel.HeaderTextColor = style.ProgressNormal;
|
||||
|
||||
// Add toggle button to the group
|
||||
var headerHeight = group.Panel.HeaderHeight;
|
||||
@@ -889,7 +878,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
TooltipText = "Script reference.",
|
||||
AutoFocus = true,
|
||||
IsScrollable = false,
|
||||
Color = FlaxEngine.GUI.Style.Current.ForegroundGrey,
|
||||
Color = style.ForegroundGrey,
|
||||
Parent = group.Panel,
|
||||
Bounds = new Rectangle(scriptToggle.Right, 0.5f, headerHeight, headerHeight),
|
||||
Margin = new Margin(1),
|
||||
@@ -908,10 +897,35 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var settingsButton = group.AddSettingsButton();
|
||||
settingsButton.Tag = script;
|
||||
settingsButton.Clicked += OnSettingsButtonClicked;
|
||||
totalHeaderButtonsOffset += settingsButton.Width + FlaxEditor.Utilities.Constants.UIMargin;
|
||||
|
||||
// Add script obsolete icon to the group
|
||||
if (scriptType.HasAttribute(typeof(ObsoleteAttribute), false))
|
||||
{
|
||||
var attribute = (ObsoleteAttribute)scriptType.GetAttributes(false).First(x => x is ObsoleteAttribute);
|
||||
var tooltip = "Script marked as obsolete." +
|
||||
(string.IsNullOrEmpty(attribute.Message) ? "" : $"\n{attribute.Message}") +
|
||||
(string.IsNullOrEmpty(attribute.DiagnosticId) ? "" : $"\n{attribute.DiagnosticId}");
|
||||
var obsoleteButton = group.AddHeaderButton(tooltip, totalHeaderButtonsOffset, Editor.Instance.Icons.Info32);
|
||||
obsoleteButton.Color = Color.Orange;
|
||||
obsoleteButton.MouseOverColor = Color.DarkOrange;
|
||||
totalHeaderButtonsOffset += obsoleteButton.Width;
|
||||
}
|
||||
|
||||
// Show visual indicator if script only exists in prefab instance and is not part of the prefab
|
||||
bool isPrefabActor = scripts.Any(s => s.Actor.HasPrefabLink);
|
||||
if (isPrefabActor && script.PrefabID == Guid.Empty)
|
||||
{
|
||||
var prefabInstanceButton = group.AddHeaderButton("Script only exists in this prefab instance.", totalHeaderButtonsOffset, Editor.Instance.Icons.Add32);
|
||||
prefabInstanceButton.Color = style.ProgressNormal;
|
||||
prefabInstanceButton.MouseOverColor = style.ProgressNormal * 0.9f;
|
||||
totalHeaderButtonsOffset += prefabInstanceButton.Width;
|
||||
}
|
||||
|
||||
// Adjust margin to not overlap with other ui elements in the header
|
||||
group.Panel.HeaderTextMargin = group.Panel.HeaderTextMargin with { Left = scriptDrag.Right - 12, Right = settingsButton.Width + Utilities.Constants.UIMargin };
|
||||
group.Object(values, editor);
|
||||
|
||||
// Remove drop down arrows and containment lines if no objects in the group
|
||||
if (group.Children.Count == 0)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
public class SplineEditor : ActorEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Storage undo spline data
|
||||
/// Stores undo spline data.
|
||||
/// </summary>
|
||||
private struct UndoData
|
||||
{
|
||||
@@ -83,7 +83,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options manipulate the curve as free mode
|
||||
/// Edit curve options manipulate the curve as free mode.
|
||||
/// </summary>
|
||||
private sealed class FreeTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -98,7 +98,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options to set tangents to linear
|
||||
/// Edit curve options to set tangents to linear.
|
||||
/// </summary>
|
||||
private sealed class LinearTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -107,13 +107,13 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
{
|
||||
SetKeyframeLinear(spline, index);
|
||||
|
||||
// change the selection to tangent parent (a spline point / keyframe)
|
||||
// Change the selection to tangent parent (a spline point / keyframe)
|
||||
Editor.SetSelectSplinePointNode(spline, index);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options to align tangents of selected spline
|
||||
/// Edit curve options to align tangents of selected spline.
|
||||
/// </summary>
|
||||
private sealed class AlignedTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -168,8 +168,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options manipulate the curve setting selected point
|
||||
/// tangent in as smoothed but tangent out as linear
|
||||
/// Edit curve options manipulate the curve setting selected point tangent in as smoothed but tangent out as linear.
|
||||
/// </summary>
|
||||
private sealed class SmoothInTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -182,8 +181,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit curve options manipulate the curve setting selected point
|
||||
/// tangent in as linear but tangent out as smoothed
|
||||
/// Edit curve options manipulate the curve setting selected point tangent in as linear but tangent out as smoothed.
|
||||
/// </summary>
|
||||
private sealed class SmoothOutTangentMode : EditTangentOptionBase
|
||||
{
|
||||
@@ -219,7 +217,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var enabled = EnabledInHierarchy && tab.EnabledInHierarchy;
|
||||
var style = FlaxEngine.GUI.Style.Current;
|
||||
var size = Size;
|
||||
var textHeight = 16.0f;
|
||||
var textHeight = 30.0f;
|
||||
// Make icons smaller when tabs get thinner
|
||||
var iconSize = size.Y - textHeight;
|
||||
var iconRect = new Rectangle((Width - iconSize) / 2, 0, iconSize, iconSize);
|
||||
if (tab._mirrorIcon)
|
||||
@@ -230,8 +229,11 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var color = style.Foreground;
|
||||
if (!enabled)
|
||||
color *= 0.6f;
|
||||
var textRect = new Rectangle(0, size.Y - textHeight, size.X, textHeight);
|
||||
Render2D.PushClip(new Rectangle(Float2.Zero, Size));
|
||||
Render2D.DrawSprite(tab._customIcon, iconRect, color);
|
||||
Render2D.DrawText(style.FontMedium, tab._customText, new Rectangle(0, iconSize, size.X, textHeight), color, TextAlignment.Center, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontMedium, tab._customText, textRect, color, TextAlignment.Center, TextAlignment.Center, TextWrapping.WrapWords, 0.65f);
|
||||
Render2D.PopClip();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,18 +293,21 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
return;
|
||||
_selectedSpline = spline;
|
||||
|
||||
layout.Space(10);
|
||||
var tabSize = 46;
|
||||
//var tabSize = 46;
|
||||
var tabSize = 60;
|
||||
var icons = Editor.Instance.Icons;
|
||||
|
||||
layout.Header("Selected spline point");
|
||||
var group = layout.Group("Selected Point");
|
||||
_selectedPointsTabs = new Tabs
|
||||
{
|
||||
Height = tabSize,
|
||||
TabsSize = new Float2(tabSize),
|
||||
AutoTabsSize = true,
|
||||
Parent = layout.ContainerControl,
|
||||
Parent = group.ContainerControl,
|
||||
};
|
||||
// Move the group above the group containing spline points
|
||||
group.Control.IndexInParent = 3;
|
||||
|
||||
_linearTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedLinear, "Linear", icons.SplineLinear64));
|
||||
_freeTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedFree, "Free", icons.SplineFree64));
|
||||
_alignedTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedAligned, "Aligned", icons.SplineAligned64));
|
||||
@@ -310,13 +315,13 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
_smoothOutTangentTab = _selectedPointsTabs.AddTab(new IconTab(OnSetSelectedSmoothOut, "Smooth Out", icons.SplineSmoothIn64, true));
|
||||
_selectedPointsTabs.SelectedTabIndex = -1;
|
||||
|
||||
layout.Header("All spline points");
|
||||
group = layout.Group("All Points");
|
||||
_allPointsTabs = new Tabs
|
||||
{
|
||||
Height = tabSize,
|
||||
TabsSize = new Float2(tabSize),
|
||||
AutoTabsSize = true,
|
||||
Parent = layout.ContainerControl,
|
||||
Parent = group.ContainerControl,
|
||||
};
|
||||
_setLinearAllTangentsTab = _allPointsTabs.AddTab(new IconTab(OnSetTangentsLinear, "Set Linear Tangents", icons.SplineLinear64));
|
||||
_setSmoothAllTangentsTab = _allPointsTabs.AddTab(new IconTab(OnSetTangentsSmooth, "Set Smooth Tangents", icons.SplineAligned64));
|
||||
|
||||
@@ -690,7 +690,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
return grid;
|
||||
}
|
||||
|
||||
private CustomElementsContainer<UniformGridPanel> UniformPanelCapsuleForObjectWithText(LayoutElementsContainer el, string text, ValueContainer values, Color borderColor, out FloatValueBox valueBox)
|
||||
private CustomElementsContainer<UniformGridPanel> UniformPanelCapsuleForObjectWithText(LayoutElementsContainer el, string text, ValueContainer values, Color highlightColor, out FloatValueBox valueBox)
|
||||
{
|
||||
valueBox = null;
|
||||
var grid = UniformGridTwoByOne(el);
|
||||
@@ -701,8 +701,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
{
|
||||
valueBox = floatEditorElement.ValueBox;
|
||||
var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
|
||||
valueBox.BorderColor = Color.Lerp(borderColor, back, ActorTransformEditor.AxisGreyOutFactor);
|
||||
valueBox.BorderSelectedColor = borderColor;
|
||||
valueBox.HighlightColor = highlightColor;
|
||||
valueBox.BorderSelectedColor = highlightColor;
|
||||
}
|
||||
return grid;
|
||||
}
|
||||
|
||||
@@ -14,22 +14,17 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
/// <summary>
|
||||
/// The X axis color.
|
||||
/// </summary>
|
||||
public static Color AxisColorX = new Color(1.0f, 0.0f, 0.02745f, 1.0f);
|
||||
public static Color AxisColorX = new Color(0.8f, 0.0f, 0.027f, 1.0f);
|
||||
|
||||
/// <summary>
|
||||
/// The Y axis color.
|
||||
/// </summary>
|
||||
public static Color AxisColorY = new Color(0.239215f, 1.0f, 0.047058f, 1.0f);
|
||||
public static Color AxisColorY = new Color(0.239215f, 0.65f, 0.047058f, 1.0f);
|
||||
|
||||
/// <summary>
|
||||
/// The Z axis color.
|
||||
/// </summary>
|
||||
public static Color AxisColorZ = new Color(0.0f, 0.0235294f, 1.0f, 1.0f);
|
||||
|
||||
/// <summary>
|
||||
/// The axes colors grey out scale when input field is not focused.
|
||||
/// </summary>
|
||||
public static float AxisGreyOutFactor = 0.6f;
|
||||
public static Color AxisColorZ = new Color(0.0f, 0.42352f, 0.8f, 1.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Custom editor for actor position property.
|
||||
@@ -43,18 +38,20 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
base.Initialize(layout);
|
||||
|
||||
if (XElement.ValueBox.Parent is UniformGridPanel ug)
|
||||
{
|
||||
ug.SlotPadding = new Margin(3.0f, 0.0f, 0.0f, 0.0f);
|
||||
CheckLayout(ug);
|
||||
}
|
||||
|
||||
// Override colors
|
||||
var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
|
||||
XElement.ValueBox.BorderColor = Color.Lerp(AxisColorX, back, AxisGreyOutFactor);
|
||||
XElement.ValueBox.BorderSelectedColor = AxisColorX;
|
||||
XElement.ValueBox.Category = Utils.ValueCategory.Distance;
|
||||
YElement.ValueBox.BorderColor = Color.Lerp(AxisColorY, back, AxisGreyOutFactor);
|
||||
YElement.ValueBox.BorderSelectedColor = AxisColorY;
|
||||
YElement.ValueBox.Category = Utils.ValueCategory.Distance;
|
||||
ZElement.ValueBox.BorderColor = Color.Lerp(AxisColorZ, back, AxisGreyOutFactor);
|
||||
ZElement.ValueBox.BorderSelectedColor = AxisColorZ;
|
||||
XElement.ValueBox.HighlightColor = AxisColorX;
|
||||
XElement.ValueBox.Category = Utils.ValueCategory.Distance;
|
||||
YElement.ValueBox.HighlightColor = AxisColorY;
|
||||
YElement.ValueBox.Category = Utils.ValueCategory.Distance;
|
||||
ZElement.ValueBox.HighlightColor = AxisColorZ;
|
||||
ZElement.ValueBox.Category = Utils.ValueCategory.Distance;
|
||||
}
|
||||
}
|
||||
@@ -71,18 +68,20 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
base.Initialize(layout);
|
||||
|
||||
if (XElement.ValueBox.Parent is UniformGridPanel ug)
|
||||
{
|
||||
ug.SlotPadding = new Margin(3.0f, 0.0f, 0.0f, 0.0f);
|
||||
CheckLayout(ug);
|
||||
}
|
||||
|
||||
// Override colors
|
||||
var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
|
||||
XElement.ValueBox.BorderColor = Color.Lerp(AxisColorX, back, AxisGreyOutFactor);
|
||||
XElement.ValueBox.BorderSelectedColor = AxisColorX;
|
||||
XElement.ValueBox.Category = Utils.ValueCategory.Angle;
|
||||
YElement.ValueBox.BorderColor = Color.Lerp(AxisColorY, back, AxisGreyOutFactor);
|
||||
YElement.ValueBox.BorderSelectedColor = AxisColorY;
|
||||
YElement.ValueBox.Category = Utils.ValueCategory.Angle;
|
||||
ZElement.ValueBox.BorderColor = Color.Lerp(AxisColorZ, back, AxisGreyOutFactor);
|
||||
ZElement.ValueBox.BorderSelectedColor = AxisColorZ;
|
||||
XElement.ValueBox.HighlightColor = AxisColorX;
|
||||
XElement.ValueBox.Category = Utils.ValueCategory.Angle;
|
||||
YElement.ValueBox.HighlightColor = AxisColorY;
|
||||
YElement.ValueBox.Category = Utils.ValueCategory.Angle;
|
||||
ZElement.ValueBox.HighlightColor = AxisColorZ;
|
||||
ZElement.ValueBox.Category = Utils.ValueCategory.Angle;
|
||||
}
|
||||
}
|
||||
@@ -129,17 +128,19 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
}
|
||||
|
||||
if (XElement.ValueBox.Parent is UniformGridPanel ug)
|
||||
{
|
||||
ug.SlotPadding = new Margin(3.0f, 0.0f, 0.0f, 0.0f);
|
||||
CheckLayout(ug);
|
||||
}
|
||||
|
||||
// Override colors
|
||||
var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
|
||||
var grayOutFactor = 0.6f;
|
||||
XElement.ValueBox.BorderColor = Color.Lerp(AxisColorX, back, grayOutFactor);
|
||||
XElement.ValueBox.BorderSelectedColor = AxisColorX;
|
||||
YElement.ValueBox.BorderColor = Color.Lerp(AxisColorY, back, grayOutFactor);
|
||||
YElement.ValueBox.BorderSelectedColor = AxisColorY;
|
||||
ZElement.ValueBox.BorderColor = Color.Lerp(AxisColorZ, back, grayOutFactor);
|
||||
ZElement.ValueBox.BorderSelectedColor = AxisColorZ;
|
||||
XElement.ValueBox.HighlightColor = AxisColorX;
|
||||
YElement.ValueBox.HighlightColor = AxisColorY;
|
||||
ZElement.ValueBox.HighlightColor = AxisColorZ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -37,25 +37,35 @@ namespace FlaxEditor.CustomEditors.Elements
|
||||
public override ContainerControl ContainerControl => Panel;
|
||||
|
||||
/// <summary>
|
||||
/// Adds utility settings button to the group header.
|
||||
/// Add utility settings button to the group header.
|
||||
/// </summary>
|
||||
/// <returns>The created control.</returns>
|
||||
public Image AddSettingsButton()
|
||||
{
|
||||
return AddHeaderButton("Settings", 0, Style.Current.Settings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a button to the group header.
|
||||
/// </summary>
|
||||
/// <returns>The created control.</returns>
|
||||
public Image AddHeaderButton(string tooltipText, float xOffset, SpriteHandle sprite)
|
||||
{
|
||||
var style = Style.Current;
|
||||
const float padding = 2.0f;
|
||||
var settingsButtonSize = Panel.HeaderHeight;
|
||||
Panel.HeaderTextMargin = Panel.HeaderTextMargin with { Right = settingsButtonSize + Utilities.Constants.UIMargin };
|
||||
; return new Image
|
||||
{
|
||||
TooltipText = "Settings",
|
||||
TooltipText = tooltipText,
|
||||
AutoFocus = true,
|
||||
AnchorPreset = AnchorPresets.TopRight,
|
||||
Parent = Panel,
|
||||
Bounds = new Rectangle(Panel.Width - settingsButtonSize, 0, settingsButtonSize, settingsButtonSize),
|
||||
Bounds = new Rectangle(Panel.Width - settingsButtonSize - xOffset, padding * 0.5f, settingsButtonSize - padding, settingsButtonSize - padding),
|
||||
IsScrollable = false,
|
||||
Color = style.ForegroundGrey,
|
||||
Margin = new Margin(1),
|
||||
Brush = new SpriteBrush(style.Settings),
|
||||
Brush = new SpriteBrush(sprite),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ namespace FlaxEditor.CustomEditors.GUI
|
||||
UpdateSplitRect();
|
||||
}
|
||||
|
||||
private void AutoSizeSplitter()
|
||||
private void AutoSizeSplitter(bool ignoreCustomSplitterValue = false)
|
||||
{
|
||||
if (_hasCustomSplitterValue || !Editor.Instance.Options.Options.Interface.AutoSizePropertiesPanelSplitter)
|
||||
if (_hasCustomSplitterValue && !ignoreCustomSplitterValue)
|
||||
return;
|
||||
|
||||
Font font = Style.Current.FontMedium;
|
||||
@@ -178,6 +178,21 @@ namespace FlaxEditor.CustomEditors.GUI
|
||||
return base.OnMouseDown(location, button);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
|
||||
{
|
||||
if (button == MouseButton.Left && _splitterRect.Contains(location))
|
||||
{
|
||||
if (_splitterClicked)
|
||||
EndTracking();
|
||||
|
||||
AutoSizeSplitter(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnMouseDoubleClick(location, button);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
@@ -220,7 +235,8 @@ namespace FlaxEditor.CustomEditors.GUI
|
||||
// Refresh
|
||||
UpdateSplitRect();
|
||||
PerformLayout(true);
|
||||
AutoSizeSplitter();
|
||||
if (Editor.Instance.Options.Options.Interface.AutoSizePropertiesPanelSplitter)
|
||||
AutoSizeSplitter();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -87,6 +87,7 @@ public class Editor : EditorModule
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "Android", "PLATFORM_TOOLS_ANDROID");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "iOS", "PLATFORM_TOOLS_IOS");
|
||||
}
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "Web", "PLATFORM_TOOLS_WEB");
|
||||
|
||||
// Visual Studio integration
|
||||
if (options.Platform.Target == TargetPlatform.Windows && Flax.Build.Platform.BuildTargetPlatform == TargetPlatform.Windows)
|
||||
|
||||
@@ -526,6 +526,23 @@ int32 Editor::LoadProduct()
|
||||
return 12;
|
||||
}
|
||||
|
||||
// Get the last opened project path
|
||||
String localCachePath;
|
||||
FileSystem::GetSpecialFolderPath(SpecialFolder::AppData, localCachePath);
|
||||
String editorConfigPath = localCachePath / TEXT("Flax");
|
||||
String lastProjectSettingPath = editorConfigPath / TEXT("LastProject.txt");
|
||||
if (!FileSystem::DirectoryExists(editorConfigPath))
|
||||
FileSystem::CreateDirectory(editorConfigPath);
|
||||
String lastProjectPath;
|
||||
if (FileSystem::FileExists(lastProjectSettingPath))
|
||||
File::ReadAllText(lastProjectSettingPath, lastProjectPath);
|
||||
if (!FileSystem::DirectoryExists(lastProjectPath))
|
||||
lastProjectPath = String::Empty;
|
||||
|
||||
// Try to open the last project when requested
|
||||
if (projectPath.IsEmpty() && CommandLine::Options.LastProject.IsTrue() && !lastProjectPath.IsEmpty())
|
||||
projectPath = lastProjectPath;
|
||||
|
||||
// Missing project case
|
||||
if (projectPath.IsEmpty())
|
||||
{
|
||||
@@ -541,7 +558,7 @@ int32 Editor::LoadProduct()
|
||||
Array<String> files;
|
||||
if (FileSystem::ShowOpenFileDialog(
|
||||
nullptr,
|
||||
StringView::Empty,
|
||||
lastProjectPath,
|
||||
TEXT("Project files (*.flaxproj)\0*.flaxproj\0All files (*.*)\0*.*\0"),
|
||||
false,
|
||||
TEXT("Select project to open in Editor"),
|
||||
@@ -625,6 +642,10 @@ int32 Editor::LoadProduct()
|
||||
}
|
||||
}
|
||||
|
||||
// Update the last opened project path
|
||||
if (lastProjectPath.Compare(Project->ProjectFolderPath) != 0)
|
||||
File::WriteAllText(lastProjectSettingPath, Project->ProjectFolderPath, Encoding::UTF8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +407,6 @@ namespace FlaxEditor
|
||||
|
||||
// Close splash and show main window
|
||||
CloseSplashScreen();
|
||||
Assert.IsNotNull(Windows.MainWindow);
|
||||
if (!IsHeadlessMode)
|
||||
{
|
||||
Windows.MainWindow.Show();
|
||||
|
||||
@@ -151,6 +151,8 @@ namespace FlaxEditor
|
||||
public SpriteHandle LocalizationSettings128;
|
||||
public SpriteHandle Json128;
|
||||
public SpriteHandle AppleSettings128;
|
||||
public SpriteHandle Web128;
|
||||
public SpriteHandle WebSettings128;
|
||||
|
||||
internal void LoadIcons()
|
||||
{
|
||||
|
||||
@@ -89,6 +89,11 @@ namespace FlaxEditor.GUI.Input
|
||||
/// </summary>
|
||||
public bool IsSliding => _isSliding;
|
||||
|
||||
/// <summary>
|
||||
/// The color of the highlight to the left of the value box.
|
||||
/// </summary>
|
||||
public Color HighlightColor;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when sliding starts.
|
||||
/// </summary>
|
||||
@@ -211,6 +216,12 @@ namespace FlaxEditor.GUI.Input
|
||||
Render2D.DrawRectangle(bounds, style.SelectionBorder);
|
||||
}
|
||||
}
|
||||
|
||||
if (HighlightColor != Color.Transparent)
|
||||
{
|
||||
var highlightRect = new Rectangle(-3.0f, 0.0f, 3.0f, Height);
|
||||
Render2D.FillRectangle(highlightRect, HighlightColor);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -292,10 +303,10 @@ namespace FlaxEditor.GUI.Input
|
||||
return base.OnMouseDown(location, button);
|
||||
}
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseMove(Float2 location)
|
||||
{
|
||||
#if !PLATFORM_SDL
|
||||
if (_isSliding && !RootWindow.Window.IsMouseFlippingHorizontally)
|
||||
{
|
||||
// Update sliding
|
||||
@@ -303,6 +314,7 @@ namespace FlaxEditor.GUI.Input
|
||||
ApplySliding(Mathf.RoundToInt(slideLocation.X - _startSlideLocation.X) * _slideSpeed);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Update cursor type so user knows they can slide value
|
||||
if (CanUseSliding && SlideRect.Contains(location) && !_isSliding)
|
||||
@@ -319,8 +331,7 @@ namespace FlaxEditor.GUI.Input
|
||||
base.OnMouseMove(location);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if PLATFORM_SDL
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseMoveRelative(Float2 motion)
|
||||
{
|
||||
@@ -346,7 +357,6 @@ namespace FlaxEditor.GUI.Input
|
||||
|
||||
base.OnMouseMoveRelative(motion);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -93,6 +93,7 @@ namespace FlaxEditor.GUI
|
||||
new PlatformData(PlatformType.PS5, icons.PS5Icon128, "PlayStation 5"),
|
||||
new PlatformData(PlatformType.Mac, icons.MacOSIcon128, "macOS"),
|
||||
new PlatformData(PlatformType.iOS, icons.IOSIcon128, "iOS"),
|
||||
new PlatformData(PlatformType.Web, icons.Web128, "Web"),
|
||||
};
|
||||
|
||||
const float IconSize = 64.0f;
|
||||
@@ -120,7 +121,7 @@ namespace FlaxEditor.GUI
|
||||
}
|
||||
|
||||
// Select the first platform
|
||||
_selected = platforms[0].PlatformType;
|
||||
_selected = PlatformType.Web;
|
||||
((Image)Children[0]).Color = _selectedColor;
|
||||
((Image)Children[0]).MouseOverColor = _selectedColor;
|
||||
}
|
||||
|
||||
@@ -201,10 +201,9 @@ namespace FlaxEditor.GUI.Timeline
|
||||
var idx = stream.ReadInt32();
|
||||
var id = stream.ReadGuid();
|
||||
object value = null;
|
||||
if (version == 2)
|
||||
stream.ReadCommonValue(ref value);
|
||||
else
|
||||
value = stream.ReadVariant();
|
||||
if (version <= 2)
|
||||
throw new Exception("Not supported asset version. Open and re-save asset with Flax 1.11.");
|
||||
value = stream.ReadVariant();
|
||||
|
||||
Emitters[idx].ParametersOverrides.Add(id, value);
|
||||
}
|
||||
|
||||
@@ -180,6 +180,11 @@ namespace FlaxEditor
|
||||
/// </summary>
|
||||
public bool EnableCamera => _view != null && EnableBackground;
|
||||
|
||||
/// <summary>
|
||||
/// True if enable grid drawing.
|
||||
/// </summary>
|
||||
public bool ShowGrid { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Transform gizmo to use sync with (selection, snapping, transformation settings).
|
||||
/// </summary>
|
||||
@@ -387,19 +392,53 @@ namespace FlaxEditor
|
||||
if (_mouseMovesWidget && _activeWidget.UIControl)
|
||||
{
|
||||
// Calculate transform delta
|
||||
var resizeAxisAbs = _activeWidget.ResizeAxis.Absolute;
|
||||
var resizeAxisPos = Float2.Clamp(_activeWidget.ResizeAxis, Float2.Zero, Float2.One);
|
||||
var resizeAxisNeg = Float2.Clamp(-_activeWidget.ResizeAxis, Float2.Zero, Float2.One);
|
||||
var delta = location - _mouseMovesPos;
|
||||
// TODO: scale/size snapping?
|
||||
delta *= resizeAxisAbs;
|
||||
|
||||
// Resize control via widget
|
||||
var moveLocation = _mouseMovesPos + delta;
|
||||
var control = _activeWidget.UIControl.Control;
|
||||
var uiControlDelta = GetControlDelta(control, ref _mouseMovesPos, ref moveLocation);
|
||||
control.LocalLocation += uiControlDelta * resizeAxisNeg;
|
||||
control.Size += uiControlDelta * resizeAxisPos - uiControlDelta * resizeAxisNeg;
|
||||
|
||||
// Transform delta to control local space
|
||||
var rotation = GetTotalRotation(control) * Mathf.DegreesToRadians;
|
||||
var cos = Mathf.Cos(rotation);
|
||||
var sin = Mathf.Sin(rotation);
|
||||
var localDeltaX = uiControlDelta.X * cos + uiControlDelta.Y * sin;
|
||||
var localDeltaY = uiControlDelta.Y * cos - uiControlDelta.X * sin;
|
||||
var localDelta = new Float2(localDeltaX, localDeltaY);
|
||||
localDelta *= _activeWidget.ResizeAxis.Absolute;
|
||||
|
||||
// Calculate size change
|
||||
var resizeAxisPos = Float2.Clamp(_activeWidget.ResizeAxis, Float2.Zero, Float2.One);
|
||||
var resizeAxisNeg = Float2.Clamp(-_activeWidget.ResizeAxis, Float2.Zero, Float2.One);
|
||||
var dSizeScaled = localDelta * resizeAxisPos - localDelta * resizeAxisNeg;
|
||||
var scale = control.Scale;
|
||||
var dSize = new Float2(
|
||||
Mathf.Abs(scale.X) > Mathf.Epsilon ? dSizeScaled.X / scale.X : 0,
|
||||
Mathf.Abs(scale.Y) > Mathf.Epsilon ? dSizeScaled.Y / scale.Y : 0);
|
||||
|
||||
// Apply size change
|
||||
control.Size += dSize;
|
||||
|
||||
// Calculate location offset to keep the opposite edge stationary
|
||||
// When PivotRelative is false, resizing keeps Top-Left (Location) constant,
|
||||
// so we only need to slide back if we are resizing Left or Top edges.
|
||||
if (!control.PivotRelative)
|
||||
{
|
||||
var pivotOffset = Float2.Zero;
|
||||
if (_activeWidget.ResizeAxis.X < 0 && Mathf.Abs(dSize.X) > Mathf.Epsilon)
|
||||
pivotOffset.X = -dSize.X * scale.X;
|
||||
if (_activeWidget.ResizeAxis.Y < 0 && Mathf.Abs(dSize.Y) > Mathf.Epsilon)
|
||||
pivotOffset.Y = -dSize.Y * scale.Y;
|
||||
|
||||
// Transform offset back to parent space and apply
|
||||
var dLocationX = pivotOffset.X * cos - pivotOffset.Y * sin;
|
||||
var dLocationY = pivotOffset.X * sin + pivotOffset.Y * cos;
|
||||
var dLocation = new Float2(dLocationX, dLocationY);
|
||||
|
||||
control.LocalLocation += dLocation;
|
||||
}
|
||||
|
||||
// Don't move if layout doesn't allow it
|
||||
if (control.Parent != null)
|
||||
@@ -492,17 +531,20 @@ namespace FlaxEditor
|
||||
// Draw background
|
||||
Surface.VisjectSurface.DrawBackgroundDefault(Editor.Instance.UI.VisjectSurfaceBackground, Width, Height);
|
||||
|
||||
// Draw grid
|
||||
var viewRect = GetClientArea();
|
||||
var upperLeft = _view.PointFromParent(viewRect.Location);
|
||||
var bottomRight = _view.PointFromParent(viewRect.Size);
|
||||
var min = Float2.Min(upperLeft, bottomRight);
|
||||
var max = Float2.Max(upperLeft, bottomRight);
|
||||
var pixelRange = (max - min) * ViewScale;
|
||||
Render2D.PushClip(ref viewRect);
|
||||
DrawAxis(Float2.UnitX, viewRect, min.X, max.X, pixelRange.X);
|
||||
DrawAxis(Float2.UnitY, viewRect, min.Y, max.Y, pixelRange.Y);
|
||||
Render2D.PopClip();
|
||||
if (ShowGrid)
|
||||
{
|
||||
// Draw grid
|
||||
var viewRect = GetClientArea();
|
||||
var upperLeft = _view.PointFromParent(viewRect.Location);
|
||||
var bottomRight = _view.PointFromParent(viewRect.Size);
|
||||
var min = Float2.Min(upperLeft, bottomRight);
|
||||
var max = Float2.Max(upperLeft, bottomRight);
|
||||
var pixelRange = (max - min) * ViewScale;
|
||||
Render2D.PushClip(ref viewRect);
|
||||
DrawAxis(Float2.UnitX, viewRect, min.X, max.X, pixelRange.X);
|
||||
DrawAxis(Float2.UnitY, viewRect, min.Y, max.Y, pixelRange.Y);
|
||||
Render2D.PopClip();
|
||||
}
|
||||
}
|
||||
|
||||
base.Draw();
|
||||
@@ -634,7 +676,7 @@ namespace FlaxEditor
|
||||
// Draw sizing widgets
|
||||
if (_widgets == null)
|
||||
_widgets = new List<Widget>();
|
||||
var widgetSize = 10.0f;
|
||||
var widgetSize = 8.0f;
|
||||
var viewScale = ViewScale;
|
||||
if (viewScale < 0.7f)
|
||||
widgetSize *= viewScale;
|
||||
@@ -685,7 +727,7 @@ namespace FlaxEditor
|
||||
anchorRectSize *= viewScale;
|
||||
|
||||
// Make anchor rects and rotate if parent is rotated.
|
||||
var parentRotation = controlParent.Rotation * Mathf.DegreesToRadians;
|
||||
var parentRotation = GetTotalRotation(controlParent) * Mathf.DegreesToRadians;
|
||||
|
||||
var rect1Axis = new Float2(-1, -1);
|
||||
var rect1 = new Rectangle(anchorUpperLeft +
|
||||
@@ -717,17 +759,25 @@ namespace FlaxEditor
|
||||
}
|
||||
}
|
||||
|
||||
private float GetTotalRotation(Control control)
|
||||
{
|
||||
if (control.Parent != null)
|
||||
return control.Rotation + GetTotalRotation(control.Parent);
|
||||
return control.Rotation;
|
||||
}
|
||||
|
||||
private void DrawControlWidget(UIControl uiControl, ref Float2 pos, ref Float2 mousePos, ref Float2 size, float scale, Float2 resizeAxis, CursorType cursor)
|
||||
{
|
||||
var style = Style.Current;
|
||||
var control = uiControl.Control;
|
||||
var rotation = control.Rotation;
|
||||
var rotation = GetTotalRotation(control);
|
||||
var rotationInRadians = rotation * Mathf.DegreesToRadians;
|
||||
var rect = new Rectangle((pos +
|
||||
new Float2(resizeAxis.X * Mathf.Cos(rotationInRadians) - resizeAxis.Y * Mathf.Sin(rotationInRadians),
|
||||
resizeAxis.Y * Mathf.Cos(rotationInRadians) + resizeAxis.X * Mathf.Sin(rotationInRadians)) * 10 * scale) - size * 0.5f,
|
||||
size);
|
||||
|
||||
var position = (pos + new Float2(resizeAxis.X * Mathf.Cos(rotationInRadians) - resizeAxis.Y * Mathf.Sin(rotationInRadians),
|
||||
resizeAxis.Y * Mathf.Cos(rotationInRadians) + resizeAxis.X * Mathf.Sin(rotationInRadians)) * 4 * (scale < 0.7f ? scale : 1));
|
||||
var halfSize = size * 0.5f;
|
||||
// Keep at 0, 0 rect position until later to correctly render rotation.
|
||||
var rect = new Rectangle(0, 0, size);
|
||||
|
||||
// Find more correct cursor at different angles
|
||||
var unwindRotation = Mathf.UnwindDegrees(rotation);
|
||||
if (unwindRotation is (>= 45 and < 135) or (> -135 and <= -45) )
|
||||
@@ -749,6 +799,10 @@ namespace FlaxEditor
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
Render2D.PushTransform(Matrix3x3.Translation2D(position));
|
||||
Render2D.PushTransform(Matrix3x3.RotationZ(rotationInRadians));
|
||||
Render2D.PushTransform(Matrix3x3.Translation2D(-1 * halfSize));
|
||||
if (rect.Contains(ref mousePos))
|
||||
{
|
||||
Render2D.FillRectangle(rect, style.Foreground);
|
||||
@@ -759,9 +813,14 @@ namespace FlaxEditor
|
||||
Render2D.FillRectangle(rect, style.ForegroundGrey);
|
||||
Render2D.DrawRectangle(rect, style.Foreground);
|
||||
}
|
||||
Render2D.PopTransform();
|
||||
Render2D.PopTransform();
|
||||
Render2D.PopTransform();
|
||||
|
||||
if (!_mouseMovesWidget && uiControl != null)
|
||||
{
|
||||
// Collect widget
|
||||
rect.Location = position - halfSize;
|
||||
_widgets.Add(new Widget
|
||||
{
|
||||
UIControl = uiControl,
|
||||
|
||||
@@ -754,6 +754,10 @@ namespace FlaxEditor.Modules
|
||||
// Delete asset by using content pool
|
||||
FlaxEngine.Content.DeleteAsset(path);
|
||||
}
|
||||
else if (item is ScriptItem)
|
||||
{
|
||||
FlaxEngine.Content.DeleteScript(path);
|
||||
}
|
||||
else if (deletedByUser)
|
||||
{
|
||||
// Delete file
|
||||
@@ -901,7 +905,7 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
// Item doesn't exist anymore
|
||||
Editor.Log(string.Format($"Content item \'{child.Path}\' has been removed"));
|
||||
Delete(child, false);
|
||||
Delete(child);
|
||||
i--;
|
||||
}
|
||||
else if (canHaveAssets && child is AssetItem childAsset)
|
||||
@@ -1188,6 +1192,7 @@ namespace FlaxEditor.Modules
|
||||
Proxy.Add(new SettingsProxy(typeof(AndroidPlatformSettings), Editor.Instance.Icons.AndroidSettings128));
|
||||
Proxy.Add(new SettingsProxy(typeof(MacPlatformSettings), Editor.Instance.Icons.AppleSettings128));
|
||||
Proxy.Add(new SettingsProxy(typeof(iOSPlatformSettings), Editor.Instance.Icons.AppleSettings128));
|
||||
Proxy.Add(new SettingsProxy(typeof(WebPlatformSettings), Editor.Instance.Icons.WebSettings128));
|
||||
|
||||
var typePS4PlatformSettings = TypeUtils.GetManagedType(GameSettings.PS4PlatformSettingsTypename);
|
||||
if (typePS4PlatformSettings != null)
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
var codeEditor = options.SourceCode.SourceCodeEditor;
|
||||
if (codeEditor != "None")
|
||||
{
|
||||
foreach (var e in Editor.Instance.CodeEditing.Editors)
|
||||
foreach (var e in _editors)
|
||||
{
|
||||
if (string.Equals(codeEditor, e.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -334,7 +334,10 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
}
|
||||
}
|
||||
}
|
||||
Editor.Instance.CodeEditing.SelectedEditor = editor;
|
||||
if (editor == null && _editors.Count != 0)
|
||||
editor = _editors[0];
|
||||
|
||||
SelectedEditor = editor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
var vsCode = codeEditing.GetInBuildEditor(CodeEditorTypes.VSCode);
|
||||
var rider = codeEditing.GetInBuildEditor(CodeEditorTypes.Rider);
|
||||
|
||||
#if PLATFORM_WINDOW
|
||||
#if PLATFORM_WINDOWS
|
||||
// Favor the newest Visual Studio
|
||||
for (int i = (int)CodeEditorTypes.VS2019; i >= (int)CodeEditorTypes.VS2008; i--)
|
||||
for (int i = (int)CodeEditorTypes.VS2026; i >= (int)CodeEditorTypes.VS2008; i--)
|
||||
{
|
||||
var visualStudio = codeEditing.GetInBuildEditor((CodeEditorTypes)i);
|
||||
if (visualStudio != null)
|
||||
@@ -74,7 +74,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
public string Name => "Default";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GenerateProjectCustomArgs => null;
|
||||
public string GenerateProjectCustomArgs => _currentEditor?.GenerateProjectCustomArgs;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OpenSolution()
|
||||
|
||||
@@ -22,71 +22,14 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
public InBuildSourceCodeEditor(CodeEditorTypes type)
|
||||
{
|
||||
Type = type;
|
||||
switch (type)
|
||||
{
|
||||
case CodeEditorTypes.Custom:
|
||||
Name = "Custom";
|
||||
break;
|
||||
case CodeEditorTypes.SystemDefault:
|
||||
Name = "System Default";
|
||||
break;
|
||||
case CodeEditorTypes.VS2008:
|
||||
Name = "Visual Studio 2008";
|
||||
break;
|
||||
case CodeEditorTypes.VS2010:
|
||||
Name = "Visual Studio 2010";
|
||||
break;
|
||||
case CodeEditorTypes.VS2012:
|
||||
Name = "Visual Studio 2012";
|
||||
break;
|
||||
case CodeEditorTypes.VS2013:
|
||||
Name = "Visual Studio 2013";
|
||||
break;
|
||||
case CodeEditorTypes.VS2015:
|
||||
Name = "Visual Studio 2015";
|
||||
break;
|
||||
case CodeEditorTypes.VS2017:
|
||||
Name = "Visual Studio 2017";
|
||||
break;
|
||||
case CodeEditorTypes.VS2019:
|
||||
Name = "Visual Studio 2019";
|
||||
break;
|
||||
case CodeEditorTypes.VS2022:
|
||||
Name = "Visual Studio 2022";
|
||||
break;
|
||||
case CodeEditorTypes.VS2026:
|
||||
Name = "Visual Studio 2026";
|
||||
break;
|
||||
case CodeEditorTypes.VSCode:
|
||||
Name = "Visual Studio Code";
|
||||
break;
|
||||
case CodeEditorTypes.VSCodeInsiders:
|
||||
Name = "Visual Studio Code - Insiders";
|
||||
break;
|
||||
case CodeEditorTypes.Rider:
|
||||
Name = "Rider";
|
||||
break;
|
||||
default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||
}
|
||||
Name = CodeEditingManager.GetName(type);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GenerateProjectCustomArgs
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case CodeEditorTypes.VSCodeInsiders:
|
||||
case CodeEditorTypes.VSCode: return "-vscode -vs2022";
|
||||
case CodeEditorTypes.Rider: return "-vs2022";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string GenerateProjectCustomArgs => CodeEditingManager.GetGenerateProjectCustomArgs(Type);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OpenSolution()
|
||||
|
||||
@@ -481,6 +481,8 @@ namespace FlaxEditor.Modules
|
||||
/// <inheritdoc />
|
||||
public override void OnInit()
|
||||
{
|
||||
if (Editor.IsHeadlessMode)
|
||||
return;
|
||||
Editor.Windows.MainWindowClosing += OnMainWindowClosing;
|
||||
var mainWindow = Editor.Windows.MainWindow.GUI;
|
||||
|
||||
|
||||
@@ -758,36 +758,39 @@ namespace FlaxEditor.Modules
|
||||
|
||||
_windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");
|
||||
|
||||
// Create main window
|
||||
var settings = CreateWindowSettings.Default;
|
||||
settings.Title = "Flax Editor";
|
||||
settings.Size = Platform.DesktopSize * 0.75f;
|
||||
settings.MinimumSize = new Float2(200, 150);
|
||||
settings.StartPosition = WindowStartPosition.CenterScreen;
|
||||
settings.ShowAfterFirstPaint = true;
|
||||
|
||||
if (Utilities.Utils.UseCustomWindowDecorations(isMainWindow: true))
|
||||
if (!Editor.IsHeadlessMode)
|
||||
{
|
||||
settings.HasBorder = false;
|
||||
#if PLATFORM_WINDOWS && !PLATFORM_SDL
|
||||
// Skip OS sizing frame and implement it using LeftButtonHit
|
||||
settings.HasSizingFrame = false;
|
||||
#endif
|
||||
}
|
||||
#if PLATFORM_LINUX && !PLATFORM_SDL
|
||||
settings.HasBorder = false;
|
||||
#endif
|
||||
MainWindow = Platform.CreateWindow(ref settings);
|
||||
if (MainWindow == null)
|
||||
{
|
||||
Editor.LogError("Failed to create editor main window!");
|
||||
return;
|
||||
}
|
||||
UpdateWindowTitle();
|
||||
// Create main window
|
||||
var settings = CreateWindowSettings.Default;
|
||||
settings.Title = "Flax Editor";
|
||||
settings.Size = Platform.DesktopSize * 0.75f;
|
||||
settings.MinimumSize = new Float2(200, 150);
|
||||
settings.StartPosition = WindowStartPosition.CenterScreen;
|
||||
settings.ShowAfterFirstPaint = true;
|
||||
|
||||
// Link for main window events
|
||||
MainWindow.Closing += MainWindow_OnClosing;
|
||||
MainWindow.Closed += MainWindow_OnClosed;
|
||||
if (Utilities.Utils.UseCustomWindowDecorations(isMainWindow: true))
|
||||
{
|
||||
settings.HasBorder = false;
|
||||
#if PLATFORM_WINDOWS && !PLATFORM_SDL
|
||||
// Skip OS sizing frame and implement it using LeftButtonHit
|
||||
settings.HasSizingFrame = false;
|
||||
#endif
|
||||
}
|
||||
#if PLATFORM_LINUX && !PLATFORM_SDL
|
||||
settings.HasBorder = false;
|
||||
#endif
|
||||
MainWindow = Platform.CreateWindow(ref settings);
|
||||
if (MainWindow == null)
|
||||
{
|
||||
Editor.LogError("Failed to create editor main window!");
|
||||
return;
|
||||
}
|
||||
UpdateWindowTitle();
|
||||
|
||||
// Link for main window events
|
||||
MainWindow.Closing += MainWindow_OnClosing;
|
||||
MainWindow.Closed += MainWindow_OnClosed;
|
||||
}
|
||||
|
||||
// Create default editor windows
|
||||
ContentWin = new ContentWindow(Editor);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user