Compare commits
260 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b84ccc2cbc | |||
| 775e978fed | |||
| e450658834 | |||
| 1a8827ba76 | |||
| eed227aa79 | |||
| 27ee42b0a1 | |||
| fd8ae9bc2b | |||
| e0f234c667 | |||
| bdeb89538c | |||
| 0f86537099 | |||
| f6f7bbb3d0 | |||
| 422300adbd | |||
| 89a1f00c57 | |||
| f4be035f04 | |||
| c2ec3fe2cb | |||
| fca6ed43cc | |||
| 84ccb9df0c | |||
| 777602fee6 | |||
| 24654e5b02 | |||
| 44117084c8 | |||
| 2531a4b918 | |||
| 9ce6026192 | |||
| a12c5e2203 | |||
| ff526ecafb | |||
| 1badeda31c | |||
| 018c7cf33d | |||
| a544cbcfde | |||
| 45f7c1f0a0 | |||
| 13aa6ce4a0 | |||
| c2b2d6973b | |||
| 96835b856d | |||
| caeecf2aea | |||
| db963f9191 | |||
| 4b6c22c43f | |||
| d3be79fdc4 | |||
| 8231bae16b | |||
| f55ac81fe4 | |||
| d181f8d726 | |||
| 2a37a529b9 | |||
| 7f370a7c5b | |||
| 0f38fca0b1 | |||
| 0b47e63ba3 | |||
| a0663666bb | |||
| 6daec81db1 | |||
| c36c39df37 | |||
| b7a59447a3 | |||
| 6fa38b75d5 | |||
| de1b515f1e | |||
| b004e90606 | |||
| b7185bfe72 | |||
| 7a41e7d6d8 | |||
| 3e670f5e80 | |||
| 7e19ffbe40 | |||
| 80e20744aa | |||
| 16effd8328 | |||
| e7c5f257e9 | |||
| 320d37d9a2 | |||
| 791fb785cf | |||
| ab6b5927f8 | |||
| 7c1df5c980 | |||
| 14ad3f892e | |||
| bd3129e9e7 | |||
| 45cc04d434 | |||
| f78954c174 | |||
| e43a12a9a8 | |||
| 1e6fdb7f02 | |||
| 067c8ae5b8 | |||
| 95aa04c334 | |||
| efd6bc27b8 | |||
| 3140c711a4 | |||
| 848e9c92aa | |||
| 6dad8259d6 | |||
| 9f72c465fe | |||
| 285762bfdb | |||
| 571821bf3d | |||
| 96a081bf93 | |||
| 637f3dc176 | |||
| 5010597bd2 | |||
| 17ff4623e7 | |||
| 0a39d88221 | |||
| 92a0a40d16 | |||
| 4d4d1a589f | |||
| 1176dc515d | |||
| 96d670efb7 | |||
| 8d8d69b847 | |||
| 5dac5d3f2d | |||
| 03126e1840 | |||
| 9e96206d67 | |||
| 00e4b09e7e | |||
| 3bf3264f48 | |||
| ec73cc6b0d | |||
| b043490413 | |||
| 3542f20787 | |||
| 43511a96b0 | |||
| 48f302b4fd | |||
| d9c787a661 | |||
| 97bcdacd9a | |||
| 253442abd1 | |||
| c8912ad100 | |||
| 40413edbab | |||
| c10cfc8e45 | |||
| 5739c0bef4 | |||
| 4f97225c46 | |||
| 2c8da4ea04 | |||
| d697bd7402 | |||
| 0bcc01c3c7 | |||
| de76d3623e | |||
| 33caae6935 | |||
| 75d9e36bd2 | |||
| 72f2c8f5cd | |||
| 9cfb3dd220 | |||
| 62d6658444 | |||
| 66818802b1 | |||
| cc4fdf5cc2 | |||
| fde40949b2 | |||
| 65c1a8258e | |||
| 6e89f152ef | |||
| e71f43ea79 | |||
| d33ebc3105 | |||
| 0de61ba218 | |||
| 283a3e6bf9 | |||
| ec9f05fe11 | |||
| b039e3779d | |||
| fc8a9b69d2 | |||
| b38f6c5721 | |||
| 8281e743cd | |||
| 0c1af2f243 | |||
| ba48b2e4f3 | |||
| 64708a14d9 | |||
| 7f2ba7a81e | |||
| fb21ffd3be | |||
| 7127ccda37 | |||
| af3836d611 | |||
| ead71e6836 | |||
| a421effd1b | |||
| 241441d5b9 | |||
| 14b0fb355a | |||
| 4489f43777 | |||
| c17a9f653e | |||
| e7fd901807 | |||
| bdabcd5e43 | |||
| 6cc8f693f3 | |||
| 811bf0d630 | |||
| 1079791bed | |||
| 627f3a2dec | |||
| 2f05a0987e | |||
| 6335bcdc93 | |||
| 650fa781d3 | |||
| 000d786d49 | |||
| 3eb85000aa | |||
| 9c5daf419b | |||
| 9a85ae7142 | |||
| fad0f7a345 | |||
| aac399c6a1 | |||
| 4c5035e433 | |||
| b14c2cfc74 | |||
| cbcfa4013b | |||
| 429f8e5336 | |||
| 6cc0edf0eb | |||
| f7d8f36add | |||
| 2e98300693 | |||
| 83de99877c | |||
| 94e529e801 | |||
| 7a569d4f14 | |||
| 24675ace93 | |||
| 3a5d831e71 | |||
| 0aecb35ab1 | |||
| c4bb39aeac | |||
| 61431a6400 | |||
| d4da1d80d0 | |||
| 3bede1d6bc | |||
| ce4ad8aa71 | |||
| 75bd206416 | |||
| 578af12f2b | |||
| acbbd34ecf | |||
| c8b06ba7ec | |||
| ad46b74f6a | |||
| 47a9d76938 | |||
| 442cb8f2dd | |||
| 45e121bf77 | |||
| 8e76d0d9d8 | |||
| f4905cfccc | |||
| bf9a015959 | |||
| 4fd7f51fdf | |||
| f5e483069d | |||
| 0bd28ecb65 | |||
| 9eec54171c | |||
| 486781661e | |||
| b201897ae6 | |||
| c33ada2715 | |||
| dcb9b5150f | |||
| f905b4013b | |||
| b0033a35b7 | |||
| f47a2909fe | |||
| b1c76ec7f9 | |||
| db2130f340 | |||
| edb3badcb3 | |||
| c33b2cc11e | |||
| 135110387d | |||
| 6b3502675a | |||
| 615e847e01 | |||
| 468e05c6e8 | |||
| a46402df6b | |||
| 1fa9aadebd | |||
| c0f52235c6 | |||
| c782f07b76 | |||
| dc9a8a2f84 | |||
| 49943e13de | |||
| 1988fae929 | |||
| 804315bb3e | |||
| 0cacc58b53 | |||
| 7437b69d52 | |||
| f5f4fb29f2 | |||
| 33617a702a | |||
| 84b53bb9c8 | |||
| c3ea883b21 | |||
| f41d01f4a9 | |||
| 141a8de0da | |||
| 63b6fafa1b | |||
| 2ce1103530 | |||
| 6121a6fadf | |||
| 145134f145 | |||
| a7c9eff959 | |||
| a831e15bf7 | |||
| d77e1e9a53 | |||
| 699fb12604 | |||
| 9505be310f | |||
| 503a0e6763 | |||
| 65b35a4b8a | |||
| c2e8e492d7 | |||
| c916fb1844 | |||
| 004339b81e | |||
| 3f78e47918 | |||
| 7b4a9f1a63 | |||
| 561d40fd71 | |||
| 133340b2ea | |||
| 344665e34f | |||
| 5d188c8c2d | |||
| 9447f3d569 | |||
| df8dc9173a | |||
| b186d19faa | |||
| ea749f12a3 | |||
| 74750fd604 | |||
| b52e8bad4c | |||
| 44f8e86245 | |||
| b036692154 | |||
| 5d050ca020 | |||
| 1b6a31b6e5 | |||
| ab4743fdb1 | |||
| 49629222c1 | |||
| 9d6778ff1e | |||
| ce73394531 | |||
| 463c8dba0d | |||
| 9bb6104cf7 | |||
| 151f4a4923 | |||
| 36f588a792 | |||
| 07c7a250cc | |||
| eab4a8c404 | |||
| cde3e3d710 | |||
| a8dc67a1b2 |
@@ -3,7 +3,7 @@ description: Downloads and installs Vulkan SDK.
|
||||
inputs:
|
||||
vulkan-version:
|
||||
description: 'Vulkan SDK release version (e.g. 1.2.198.1).'
|
||||
default: '1.3.290.0'
|
||||
default: '1.4.350.0'
|
||||
required: false
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -24,13 +24,13 @@ runs:
|
||||
;;
|
||||
Darwin)
|
||||
export VULKAN_SDK_ROOT=`pwd`/../VulkanSDK
|
||||
curl -LO "https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VER/mac/vulkan-sdk.dmg"
|
||||
hdiutil attach vulkan-sdk.dmg -mountpoint /Volumes/vulkan-sdk
|
||||
sudo "/Volumes/vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan" --root $VULKAN_SDK_ROOT --accept-licenses --default-answer --confirm-command install
|
||||
curl -LO "https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VER/mac/vulkansdk-macos-$VULKAN_SDK_VER.zip"
|
||||
unzip vulkansdk-macos-$VULKAN_SDK_VER.zip
|
||||
sudo "vulkansdk-macos-$VULKAN_SDK_VER.app/Contents/MacOS/vulkansdk-macOS-$VULKAN_SDK_VER" --root $VULKAN_SDK_ROOT --accept-licenses --default-answer --confirm-command install
|
||||
export VULKAN_SDK=$VULKAN_SDK_ROOT/macOS
|
||||
;;
|
||||
*) # Windows
|
||||
curl -L -o vulkan-sdk.exe https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VER/windows/VulkanSDK-$VULKAN_SDK_VER-Installer.exe
|
||||
curl -L -o vulkan-sdk.exe https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VER/windows/vulkansdk-windows-X64-$VULKAN_SDK_VER.exe
|
||||
./vulkan-sdk.exe --root "C:\VulkanSDK" --accept-licenses --default-answer --confirm-command install
|
||||
export VULKAN_SDK="C:\VulkanSDK"
|
||||
;;
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.419
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup .NET Workload
|
||||
run: |
|
||||
dotnet workload install android
|
||||
@@ -37,4 +37,4 @@ jobs:
|
||||
PowerShell "(Get-Content global.json).Replace('latestMajor', 'minor') | Set-Content global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/global.json).Replace('latestMajor', 'minor') | Set-Content Source/Tools/Flax.Build/global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/Flax.Build.csproj).Replace('LatestMajor', 'Minor') | Set-Content Source/Tools/Flax.Build/Flax.Build.csproj"
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=8 -arch=ARM64 -platform=Android -configuration=Release -buildtargets=FlaxGame
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=10 -arch=ARM64 -platform=Android -configuration=Release -buildtargets=FlaxGame
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup .NET Workload
|
||||
run: |
|
||||
dotnet workload install ios
|
||||
@@ -33,4 +33,4 @@ jobs:
|
||||
git lfs pull
|
||||
- name: Build
|
||||
run: |
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -dotnet=9 -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -dotnet=10 -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame
|
||||
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
git lfs pull
|
||||
- name: Build
|
||||
run: |
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxEditor
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=10 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxEditor
|
||||
|
||||
# Game
|
||||
game-linux:
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -63,4 +63,4 @@ jobs:
|
||||
git lfs pull
|
||||
- name: Build
|
||||
run: |
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Linux -configuration=Release -buildtargets=FlaxGame
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=10 -arch=x64 -platform=Linux -configuration=Release -buildtargets=FlaxGame
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
git lfs pull
|
||||
- name: Build
|
||||
run: |
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=ARM64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=10 -arch=ARM64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor
|
||||
|
||||
# Game
|
||||
game-mac:
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -55,4 +55,4 @@ jobs:
|
||||
git lfs pull
|
||||
- name: Build
|
||||
run: |
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=ARM64 -platform=Mac -configuration=Release -buildtargets=FlaxGame
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=10 -arch=ARM64 -platform=Mac -configuration=Release -buildtargets=FlaxGame
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.419
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
PowerShell "(Get-Content global.json).Replace('latestMajor', 'minor') | Set-Content global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/global.json).Replace('latestMajor', 'minor') | Set-Content Source/Tools/Flax.Build/global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/Flax.Build.csproj).Replace('LatestMajor', 'Minor') | Set-Content Source/Tools/Flax.Build/Flax.Build.csproj"
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxEditor
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=10 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxEditor
|
||||
|
||||
# Game
|
||||
game-windows:
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.419
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -62,4 +62,4 @@ jobs:
|
||||
PowerShell "(Get-Content global.json).Replace('latestMajor', 'minor') | Set-Content global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/global.json).Replace('latestMajor', 'minor') | Set-Content Source/Tools/Flax.Build/global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/Flax.Build.csproj).Replace('LatestMajor', 'Minor') | Set-Content Source/Tools/Flax.Build/Flax.Build.csproj"
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=8 -arch=x64 -platform=Windows -configuration=Release -buildtargets=FlaxGame
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=10 -arch=x64 -platform=Windows -configuration=Release -buildtargets=FlaxGame
|
||||
|
||||
+12
-12
@@ -28,7 +28,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.419
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
PowerShell "(Get-Content global.json).Replace('latestMajor', 'minor') | Set-Content global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/global.json).Replace('latestMajor', 'minor') | Set-Content Source/Tools/Flax.Build/global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/Flax.Build.csproj).Replace('LatestMajor', 'Minor') | Set-Content Source/Tools/Flax.Build/Flax.Build.csproj"
|
||||
.\PackageEditor.bat -arch=x64 -platform=Windows -deployOutput=Output -dotnet=8
|
||||
.\PackageEditor.bat -arch=x64 -platform=Windows -deployOutput=Output -dotnet=10
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.419
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
PowerShell "(Get-Content global.json).Replace('latestMajor', 'minor') | Set-Content global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/global.json).Replace('latestMajor', 'minor') | Set-Content Source/Tools/Flax.Build/global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/Flax.Build.csproj).Replace('LatestMajor', 'Minor') | Set-Content Source/Tools/Flax.Build/Flax.Build.csproj"
|
||||
.\PackagePlatforms.bat -arch=x64 -platform=Windows -deployOutput=Output -dotnet=8
|
||||
.\PackagePlatforms.bat -arch=x64 -platform=Windows -deployOutput=Output -dotnet=10
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -101,14 +101,14 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
dotnet workload --info
|
||||
- name: Build
|
||||
run: |
|
||||
./PackageEditor.sh -arch=x64 -platform=Linux -deployOutput=Output -dotnet=8
|
||||
./PackageEditor.sh -arch=x64 -platform=Linux -deployOutput=Output -dotnet=10
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -133,14 +133,14 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
dotnet workload --info
|
||||
- name: Build
|
||||
run: |
|
||||
./PackagePlatforms.sh -arch=x64 -platform=Linux -deployOutput=Output -dotnet=8
|
||||
./PackagePlatforms.sh -arch=x64 -platform=Linux -deployOutput=Output -dotnet=10
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -163,14 +163,14 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
dotnet workload --info
|
||||
- name: Build
|
||||
run: |
|
||||
./PackageEditor.command -arch=ARM64 -platform=Mac -deployOutput=Output -dotnet=8
|
||||
./PackageEditor.command -arch=ARM64 -platform=Mac -deployOutput=Output -dotnet=10
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -191,14 +191,14 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
dotnet workload --info
|
||||
- name: Build
|
||||
run: |
|
||||
./PackagePlatforms.command -arch=ARM64 -platform=Mac -deployOutput=Output -dotnet=8
|
||||
./PackagePlatforms.command -arch=ARM64 -platform=Mac -deployOutput=Output -dotnet=10
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup .NET Workload
|
||||
run: |
|
||||
dotnet workload install ios
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
cp ".github/data/Build Settings.json" "FlaxSamples/MaterialsFeaturesTour/Content/Settings"
|
||||
- name: Build Editor
|
||||
run: |
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=8 -arch=ARM64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor
|
||||
./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=10 -arch=ARM64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor
|
||||
- name: Cook Game (iOS)
|
||||
run: |
|
||||
./Binaries/Editor/Mac/Development/FlaxEditor -std -headless -mute -null -project "FlaxSamples/MaterialsFeaturesTour" -build "Development.iOS"
|
||||
|
||||
+10
-10
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -34,18 +34,18 @@ jobs:
|
||||
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 -UseLargeWorlds=true
|
||||
./GenerateProjectFiles.sh -vs2026 -log -verbose -printSDKs -dotnet=10
|
||||
./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=10 -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}/.github/data/bt.sh ./Binaries/Editor/Linux/Development/FlaxTests -headless
|
||||
dotnet test -f net8.0 Binaries/Tests/Flax.Build.Tests.dll
|
||||
dotnet test -f net10.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
|
||||
dotnet test -f net10.0 Binaries/Tests/FlaxEngine.CSharp.dll
|
||||
|
||||
# Tests on Windows
|
||||
tests-windows:
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.419
|
||||
dotnet-version: 10.0.x
|
||||
- name: Print .NET info
|
||||
run: |
|
||||
dotnet --info
|
||||
@@ -71,8 +71,8 @@ jobs:
|
||||
PowerShell "(Get-Content global.json).Replace('latestMajor', 'minor') | Set-Content global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/global.json).Replace('latestMajor', 'minor') | Set-Content Source/Tools/Flax.Build/global.json"
|
||||
PowerShell "(Get-Content Source/Tools/Flax.Build/Flax.Build.csproj).Replace('LatestMajor', 'Minor') | Set-Content Source/Tools/Flax.Build/Flax.Build.csproj"
|
||||
.\GenerateProjectFiles.bat -vs2022 -log -verbose -printSDKs -dotnet=8
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -dotnet=8 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxTestsTarget
|
||||
.\GenerateProjectFiles.bat -vs2026 -log -verbose -printSDKs -dotnet=10
|
||||
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -dotnet=10 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxTestsTarget
|
||||
dotnet msbuild Source\Tools\Flax.Build.Tests\Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo
|
||||
- name: Test
|
||||
shell: pwsh
|
||||
@@ -80,8 +80,8 @@ jobs:
|
||||
$ErrorActionPreference = "Stop"
|
||||
.\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
|
||||
dotnet test -f net10.0 Binaries\Tests\Flax.Build.Tests.dll
|
||||
xcopy /y Binaries\Editor\Win64\Development\FlaxEngine.CSharp.dll Binaries\Tests
|
||||
xcopy /y Binaries\Editor\Win64\Development\FlaxEngine.CSharp.runtimeconfig.json Binaries\Tests
|
||||
xcopy /y Binaries\Editor\Win64\Development\Newtonsoft.Json.dll Binaries\Tests
|
||||
dotnet test -f net8.0 Binaries\Tests\FlaxEngine.CSharp.dll
|
||||
dotnet test -f net10.0 Binaries\Tests\FlaxEngine.CSharp.dll
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Redirect to our own Git LFS server
|
||||
[lfs]
|
||||
url="https://gitlab.flaxengine.com/flax/flaxengine.git/info/lfs"
|
||||
url="https://git.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.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -1,17 +0,0 @@
|
||||
## Mono
|
||||
|
||||
Custom fork: [https://github.com/FlaxEngine/mono](https://github.com/FlaxEngine/mono) with custom features for C# assemblies hot-reloading at runtime without domain unload (more: [https://flaxengine.com/blog/flax-facts-16-scripts-hot-reload/](https://flaxengine.com/blog/flax-facts-16-scripts-hot-reload/)).
|
||||
|
||||
Startup docs about building mono: [https://www.mono-project.com/docs/compiling-mono/](https://www.mono-project.com/docs/compiling-mono/)
|
||||
|
||||
### Notes
|
||||
|
||||
Some useful notes and tips for devs:
|
||||
* Use `-monolog` to print Mono logs to Flax logs
|
||||
* When working with mono fork set `localRepoPath` to local repo location in `Source\Tools\Flax.Build\Deps\Dependencies\mono.cs`
|
||||
* To update mono deps when developing/updating use `.\Development\Scripts\Windows\CallBuildTool.bat -log -ReBuildDeps -verbose -depsToBuild=mono -platform=Windows`, then build engine and run it
|
||||
* `MONO_GC_DEBUG=check-remset-consistency` - it will do additional checks at each collection to see if there are any missing write barriers
|
||||
* `MONO_GC_DEBUG=nursery-canaries` - it might catch some buffer overflows in case of problems in code.
|
||||
* `MONO_GC_DEBUG=<log-level>:<log-file>` - will print GC debug to the log file (eg. `4:sgen-gc`).
|
||||
* Methods `mono_custom_attrs_from_property` and `mono_custom_attrs_get_attr` are internally cached
|
||||
* If C++ mono call a method in c# that will throw an error, error will be handled but, not completly. Calling relase domain will return random `Access memory violation`. First search for error in c# code. No workaround yet.
|
||||
@@ -34,7 +34,7 @@ goto Exit
|
||||
echo CallBuildTool ERROR: The script is in invalid directory.
|
||||
goto Exit
|
||||
:Error_NoVisualStudioEnvironment
|
||||
echo CallBuildTool ERROR: Missing Visual Studio 2022 or newer.
|
||||
echo CallBuildTool ERROR: Missing Visual Studio 2026 or newer.
|
||||
goto Exit
|
||||
:Error_CompilationFailed
|
||||
echo CallBuildTool ERROR: Failed to compile Flax.Build project.
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
"Name": "Flax",
|
||||
"Version": {
|
||||
"Major": 1,
|
||||
"Minor": 12,
|
||||
"Minor": 13,
|
||||
"Revision": 0,
|
||||
"Build": 6912
|
||||
"Build": 7005
|
||||
},
|
||||
"Company": "Flax",
|
||||
"Copyright": "Copyright (c) 2012-2026 Wojciech Figat. All rights reserved.",
|
||||
@@ -13,7 +13,7 @@
|
||||
"Configuration": {
|
||||
"UseCSharp": true,
|
||||
"UseLargeWorlds": false,
|
||||
"UseDotNet": true,
|
||||
"UseReverseZ": true,
|
||||
"Windows": {
|
||||
"UseSDL": false,
|
||||
},
|
||||
|
||||
@@ -257,6 +257,7 @@
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=Try_0020to_0020scripting/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=will_0020fallback/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/GrammarAndSpelling/GrammarChecking/RulesStates/=LanguageTool_002EEN_002EE_005FG/@EntryIndexedValue">DisabledByUser</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=EEA05B0ED8200E4BA9D2D3F1052EBFFD/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=EEA05B0ED8200E4BA9D2D3F1052EBFFD/Color/@EntryValue">Blue</s:String>
|
||||
|
||||
@@ -28,10 +28,10 @@ Follow the instructions below to compile and run the engine from source.
|
||||
|
||||
## Windows
|
||||
|
||||
* Install Visual Studio 2022 or newer
|
||||
* Install Windows 8.1 SDK or newer (via Visual Studio Installer)
|
||||
* Install Visual Studio 2026 or newer
|
||||
* Install Windows 10 SDK or newer (via Visual Studio Installer)
|
||||
* Install Microsoft Visual C++ 2015 v140 toolset or newer (via Visual Studio Installer)
|
||||
* Install .NET 8 SDK (or newer) for **Windows x64** (via Visual Studio Installer or [from web](https://dotnet.microsoft.com/en-us/download/dotnet/8.0))
|
||||
* Install .NET 10 SDK (or newer) for **Windows x64** (via Visual Studio Installer or [from web](https://dotnet.microsoft.com/en-us/download/dotnet/10.0))
|
||||
* Install Git with LFS
|
||||
* Clone repo (with LFS)
|
||||
* Run **GenerateProjectFiles.bat**
|
||||
@@ -44,10 +44,10 @@ Follow the instructions below to compile and run the engine from source.
|
||||
## Linux
|
||||
|
||||
* Install Visual Studio Code
|
||||
* Install .NET 8 or 9 SDK ([https://dotnet.microsoft.com/en-us/download/dotnet/8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0))
|
||||
* Ubuntu: `sudo apt install dotnet-sdk-8.0`
|
||||
* Fedora: `sudo dnf install dotnet-sdk-8.0`
|
||||
* Arch: `sudo pacman -S dotnet-sdk-8.0 dotnet-runtime-8.0 dotnet-targeting-pack-8.0 dotnet-host`
|
||||
* Install .NET 10 SDK (or newer) ([https://dotnet.microsoft.com/en-us/download/dotnet/10.0](https://dotnet.microsoft.com/en-us/download/dotnet/10.0))
|
||||
* Ubuntu: `sudo apt install dotnet-sdk-10.0`
|
||||
* Fedora: `sudo dnf install dotnet-sdk-10.0`
|
||||
* Arch: `sudo pacman -S dotnet-sdk-10.0 dotnet-runtime-10.0 dotnet-targeting-pack-10.0 dotnet-host`
|
||||
* Install Vulkan SDK ([https://vulkan.lunarg.com/](https://vulkan.lunarg.com/))
|
||||
* Ubuntu: `sudo apt install vulkan-sdk` (deprecated, follow official docs)
|
||||
* Fedora: `sudo dnf install vulkan-headers vulkan-tools vulkan-validation-layers`
|
||||
@@ -73,7 +73,7 @@ Follow the instructions below to compile and run the engine from source.
|
||||
## Mac
|
||||
|
||||
* Install XCode 16.4 (or newer)
|
||||
* Install .NET 8 SDK (or newer) ([https://dotnet.microsoft.com/en-us/download/dotnet/8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0))
|
||||
* Install .NET 10 SDK (or newer) ([https://dotnet.microsoft.com/en-us/download/dotnet/10.0](https://dotnet.microsoft.com/en-us/download/dotnet/10.0))
|
||||
* Install Vulkan SDK ([https://vulkan.lunarg.com/](https://vulkan.lunarg.com/))
|
||||
* Clone repo (with LFS)
|
||||
* Run `GenerateProjectFiles.command`
|
||||
@@ -86,17 +86,17 @@ Follow the instructions below to compile and run the engine from source.
|
||||
|
||||
Restart PC - ensure DotNet is added to PATH for command line tools execution.
|
||||
|
||||
* `Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 8.0`
|
||||
* `Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 10.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 10.0`
|
||||
|
||||
Use Visual Studio 2022, older versions are not supported by .NET SDK 8.
|
||||
Use Visual Studio 2026 (or newer), old Visual Studio versions are not supported by .NET SDK 10.
|
||||
|
||||
* `Building for Windows without Vulkan rendering backend (Vulkan SDK is missing)`
|
||||
|
||||
Install the Vulkan SDK then set an environment variable to provide the path to the SDK prior to running GenerateProjectFiles.bat: `set VULKAN_SDK=%sdk_path%`.
|
||||
|
||||
* `The NuGetSdkResolver did not resolve this SDK`
|
||||
* `The NuGetSdkResolver did not resolve this SDK` / `Could not resolve SDK "Microsoft.NET.Sdk"`
|
||||
|
||||
Install `.NET SDK`, `NuGet package manager` and `NuGet targets and build tasks` in Visual Studio components.
|
||||
Install `.NET SDK` 10, `NuGet package manager` and `NuGet targets and build tasks` in Visual Studio components.
|
||||
|
||||
## Workspace directory
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace FlaxEngine.Tools
|
||||
{
|
||||
partial struct Options
|
||||
{
|
||||
private bool ShowBtiDepth => Format != AudioFormat.Vorbis;
|
||||
private bool ShowBitDepth => Format != AudioFormat.Vorbis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace FlaxEngine.Tools
|
||||
private bool ShowRootMotion => ShowAnimation && RootMotion != RootMotionMode.None;
|
||||
private bool ShowSmoothingNormalsAngle => ShowGeometry && CalculateNormals;
|
||||
private bool ShowSmoothingTangentsAngle => ShowGeometry && CalculateTangents;
|
||||
private bool ShowGenerateLODs => ShowGeometry && GenerateLODs;
|
||||
private bool ShowFramesRange => ShowAnimation && Duration == AnimationDuration.Custom;
|
||||
private bool ShowSplitting => Type != ModelType.Prefab;
|
||||
}
|
||||
|
||||
@@ -98,12 +98,12 @@ namespace FlaxEditor.Content
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the asset (if it's loaded).
|
||||
/// Reloads the asset (if it's loaded or failed to load).
|
||||
/// </summary>
|
||||
public void Reload()
|
||||
{
|
||||
var asset = FlaxEngine.Content.GetAsset(ID);
|
||||
if (asset != null && asset.IsLoaded)
|
||||
if (asset != null && (asset.IsLoaded || asset.LastLoadFailed))
|
||||
{
|
||||
asset.Reload();
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace FlaxEditor.Content
|
||||
}
|
||||
else
|
||||
{
|
||||
_parameters = Utils.GetEmptyArray<ScriptMemberInfo.Parameter>();
|
||||
_parameters = Array.Empty<ScriptMemberInfo.Parameter>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,9 +283,9 @@ namespace FlaxEditor.Content
|
||||
{
|
||||
if (!_asset)
|
||||
{
|
||||
_parameters = Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
_methods = Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
_attributes = Utils.GetEmptyArray<Attribute>();
|
||||
_parameters = Array.Empty<ScriptMemberInfo>();
|
||||
_methods = Array.Empty<ScriptMemberInfo>();
|
||||
_attributes = Array.Empty<Attribute>();
|
||||
return;
|
||||
}
|
||||
if (_parameters != null)
|
||||
@@ -303,7 +303,7 @@ namespace FlaxEditor.Content
|
||||
_parameters[i] = new ScriptMemberInfo(new VisualScriptParameterInfo(this, parameters[i]));
|
||||
}
|
||||
else
|
||||
_parameters = Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
_parameters = Array.Empty<ScriptMemberInfo>();
|
||||
|
||||
// Cache Visual Script methods info
|
||||
var methodsCount = _asset.GetMethodsCount();
|
||||
@@ -314,7 +314,7 @@ namespace FlaxEditor.Content
|
||||
_methods[i] = new ScriptMemberInfo(new VisualScriptMethodInfo(this, i));
|
||||
}
|
||||
else
|
||||
_methods = Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
_methods = Array.Empty<ScriptMemberInfo>();
|
||||
|
||||
// Cache Visual Script attributes
|
||||
{
|
||||
@@ -525,7 +525,7 @@ namespace FlaxEditor.Content
|
||||
var baseType = BaseType;
|
||||
if (baseType)
|
||||
return baseType.GetProperties(bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEditor.Content.Thumbnails;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.Viewport.Previews;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Content
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class for <see cref="MaterialBase"/> asset proxy object.
|
||||
/// </summary>
|
||||
/// <seealso cref="FlaxEditor.Content.BinaryAssetProxy" />
|
||||
public abstract class MaterialBaseProxy : BinaryAssetProxy
|
||||
{
|
||||
/// <summary>
|
||||
/// The material preview drawer.
|
||||
/// </summary>
|
||||
protected MaterialPreview _preview;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanCreate(ContentFolder targetLocation)
|
||||
{
|
||||
return targetLocation.CanHaveAssets;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnContentWindowContextMenu(ContextMenu menu, ContentItem item)
|
||||
{
|
||||
base.OnContentWindowContextMenu(menu, item);
|
||||
|
||||
if (item is BinaryAssetItem binaryAssetItem)
|
||||
{
|
||||
var button = menu.AddButton("Create Material Instance", CreateMaterialInstanceClicked);
|
||||
button.Tag = binaryAssetItem;
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateMaterialInstanceClicked(ContextMenuButton button)
|
||||
{
|
||||
var binaryAssetItem = (BinaryAssetItem)button.Tag;
|
||||
CreateMaterialInstance(binaryAssetItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the material instance from the given material.
|
||||
/// </summary>
|
||||
/// <param name="materialItem">The material item to use as a base material.</param>
|
||||
public static void CreateMaterialInstance(BinaryAssetItem materialItem)
|
||||
{
|
||||
var materialInstanceName = materialItem.ShortName + " Instance";
|
||||
var materialInstanceProxy = Editor.Instance.ContentDatabase.GetProxy<MaterialInstance>();
|
||||
Editor.Instance.Windows.ContentWin.NewItem(materialInstanceProxy, null, item => OnMaterialInstanceCreated(item, materialItem), materialInstanceName);
|
||||
}
|
||||
|
||||
private static void OnMaterialInstanceCreated(ContentItem item, BinaryAssetItem materialItem)
|
||||
{
|
||||
var assetItem = (AssetItem)item;
|
||||
var materialInstance = FlaxEngine.Content.LoadAsync<MaterialInstance>(assetItem.ID);
|
||||
if (materialInstance == null || materialInstance.WaitForLoaded())
|
||||
{
|
||||
Editor.LogError("Failed to load created material instance.");
|
||||
return;
|
||||
}
|
||||
materialInstance.BaseMaterial = FlaxEngine.Content.LoadAsync<MaterialBase>(materialItem.ID);
|
||||
materialInstance.Save();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawPrepare(ThumbnailRequest request)
|
||||
{
|
||||
if (_preview == null)
|
||||
{
|
||||
_preview = new MaterialPreview(false);
|
||||
InitAssetPreview(_preview);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawBegin(ThumbnailRequest request, ContainerControl guiRoot, GPUContext context)
|
||||
{
|
||||
_preview.Material = (MaterialBase)request.Asset;
|
||||
_preview.Parent = guiRoot;
|
||||
_preview.SyncBackbufferSize();
|
||||
|
||||
_preview.Task.OnDraw();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawEnd(ThumbnailRequest request, ContainerControl guiRoot)
|
||||
{
|
||||
_preview.Material = null;
|
||||
_preview.Parent = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
if (_preview != null)
|
||||
{
|
||||
_preview.Dispose();
|
||||
_preview = null;
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,23 +2,18 @@
|
||||
|
||||
using System;
|
||||
using FlaxEditor.Content.Thumbnails;
|
||||
using FlaxEditor.Viewport.Previews;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEditor.Windows.Assets;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Content
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="MaterialInstance"/> asset proxy object.
|
||||
/// </summary>
|
||||
/// <seealso cref="FlaxEditor.Content.BinaryAssetProxy" />
|
||||
[ContentContextMenu("New/Material/Material Instance")]
|
||||
public class MaterialInstanceProxy : BinaryAssetProxy
|
||||
public class MaterialInstanceProxy : MaterialBaseProxy
|
||||
{
|
||||
private MaterialPreview _preview;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Name => "Material Instance";
|
||||
|
||||
@@ -34,12 +29,6 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override Type AssetType => typeof(MaterialInstance);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanCreate(ContentFolder targetLocation)
|
||||
{
|
||||
return targetLocation.CanHaveAssets;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
@@ -47,49 +36,10 @@ namespace FlaxEditor.Content
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawPrepare(ThumbnailRequest request)
|
||||
{
|
||||
if (_preview == null)
|
||||
{
|
||||
_preview = new MaterialPreview(false);
|
||||
InitAssetPreview(_preview);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanDrawThumbnail(ThumbnailRequest request)
|
||||
{
|
||||
return _preview.HasLoadedAssets && ThumbnailsModule.HasMinimumQuality((MaterialInstance)request.Asset);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawBegin(ThumbnailRequest request, ContainerControl guiRoot, GPUContext context)
|
||||
{
|
||||
_preview.Material = (MaterialInstance)request.Asset;
|
||||
_preview.Parent = guiRoot;
|
||||
_preview.SyncBackbufferSize();
|
||||
|
||||
_preview.Task.OnDraw();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawEnd(ThumbnailRequest request, ContainerControl guiRoot)
|
||||
{
|
||||
_preview.Material = null;
|
||||
_preview.Parent = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
if (_preview != null)
|
||||
{
|
||||
_preview.Dispose();
|
||||
_preview = null;
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,18 @@
|
||||
|
||||
using System;
|
||||
using FlaxEditor.Content.Thumbnails;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.Viewport.Previews;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEditor.Windows.Assets;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Content
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="Material"/> asset proxy object.
|
||||
/// </summary>
|
||||
/// <seealso cref="FlaxEditor.Content.BinaryAssetProxy" />
|
||||
[ContentContextMenu("New/Material/Material")]
|
||||
public class MaterialProxy : BinaryAssetProxy
|
||||
public class MaterialProxy : MaterialBaseProxy
|
||||
{
|
||||
private MaterialPreview _preview;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Name => "Material";
|
||||
|
||||
@@ -35,12 +29,6 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override Type AssetType => typeof(Material);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanCreate(ContentFolder targetLocation)
|
||||
{
|
||||
return targetLocation.CanHaveAssets;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
@@ -48,92 +36,10 @@ namespace FlaxEditor.Content
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnContentWindowContextMenu(ContextMenu menu, ContentItem item)
|
||||
{
|
||||
base.OnContentWindowContextMenu(menu, item);
|
||||
|
||||
if (item is BinaryAssetItem binaryAssetItem)
|
||||
{
|
||||
var button = menu.AddButton("Create Material Instance", CreateMaterialInstanceClicked);
|
||||
button.Tag = binaryAssetItem;
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateMaterialInstanceClicked(ContextMenuButton obj)
|
||||
{
|
||||
var binaryAssetItem = (BinaryAssetItem)obj.Tag;
|
||||
CreateMaterialInstance(binaryAssetItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the material instance from the given material.
|
||||
/// </summary>
|
||||
/// <param name="materialItem">The material item to use as a base material.</param>
|
||||
public static void CreateMaterialInstance(BinaryAssetItem materialItem)
|
||||
{
|
||||
var materialInstanceName = materialItem.ShortName + " Instance";
|
||||
var materialInstanceProxy = Editor.Instance.ContentDatabase.GetProxy<MaterialInstance>();
|
||||
Editor.Instance.Windows.ContentWin.NewItem(materialInstanceProxy, null, item => OnMaterialInstanceCreated(item, materialItem), materialInstanceName);
|
||||
}
|
||||
|
||||
private static void OnMaterialInstanceCreated(ContentItem item, BinaryAssetItem materialItem)
|
||||
{
|
||||
var assetItem = (AssetItem)item;
|
||||
var materialInstance = FlaxEngine.Content.LoadAsync<MaterialInstance>(assetItem.ID);
|
||||
if (materialInstance == null || materialInstance.WaitForLoaded())
|
||||
{
|
||||
Editor.LogError("Failed to load created material instance.");
|
||||
return;
|
||||
}
|
||||
|
||||
materialInstance.BaseMaterial = FlaxEngine.Content.LoadAsync<Material>(materialItem.ID);
|
||||
materialInstance.Save();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawPrepare(ThumbnailRequest request)
|
||||
{
|
||||
if (_preview == null)
|
||||
{
|
||||
_preview = new MaterialPreview(false);
|
||||
InitAssetPreview(_preview);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanDrawThumbnail(ThumbnailRequest request)
|
||||
{
|
||||
return _preview.HasLoadedAssets && ThumbnailsModule.HasMinimumQuality((Material)request.Asset);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawBegin(ThumbnailRequest request, ContainerControl guiRoot, GPUContext context)
|
||||
{
|
||||
_preview.Material = (Material)request.Asset;
|
||||
_preview.Parent = guiRoot;
|
||||
_preview.SyncBackbufferSize();
|
||||
|
||||
_preview.Task.OnDraw();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnThumbnailDrawEnd(ThumbnailRequest request, ContainerControl guiRoot)
|
||||
{
|
||||
_preview.Material = null;
|
||||
_preview.Parent = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
if (_preview != null)
|
||||
{
|
||||
_preview.Dispose();
|
||||
_preview = null;
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,6 +360,11 @@ public:
|
||||
/// </summary>
|
||||
Array<BinaryModuleInfo, InlinedAllocation<64>> BinaryModules;
|
||||
|
||||
/// <summary>
|
||||
/// Cached version of the built binaries from project Version Control.
|
||||
/// </summary>
|
||||
String VersionControlInfo;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -191,7 +191,7 @@ bool WebPlatformTools::OnPostProcess(CookingData& data)
|
||||
FileSystem::GetChildDirectories(pythons, emscriptenSdk / TEXT("/python"));
|
||||
if (pythons.HasItems())
|
||||
{
|
||||
procSettings.Arguments = procSettings.FileName + TEXT(".py ") + procSettings.Arguments;
|
||||
procSettings.Arguments = String::Format(TEXT("\"{}.py\" {}"), procSettings.FileName, procSettings.Arguments);
|
||||
#if PLATFORM_WINDOWS
|
||||
procSettings.FileName = pythons[0] / TEXT("/python.exe");
|
||||
#else
|
||||
|
||||
@@ -42,6 +42,13 @@ bool CompileScriptsStep::DeployBinaries(CookingData& data, const String& path, c
|
||||
return true;
|
||||
}
|
||||
|
||||
// Metadata
|
||||
auto versionControlInfoMember = document.FindMember("VersionControlInfo");
|
||||
if (versionControlInfoMember != document.MemberEnd() && data.VersionControlInfo.IsEmpty())
|
||||
{
|
||||
data.VersionControlInfo = versionControlInfoMember->value.GetText();
|
||||
}
|
||||
|
||||
// Deploy all references
|
||||
auto referencesMember = document.FindMember("References");
|
||||
if (referencesMember != document.MemberEnd())
|
||||
@@ -245,8 +252,15 @@ bool CompileScriptsStep::Perform(CookingData& data)
|
||||
writer.String(target);
|
||||
writer.JKEY("Platform");
|
||||
writer.String(platform);
|
||||
writer.JKEY("Architecture");
|
||||
writer.String(architecture);
|
||||
writer.JKEY("Configuration");
|
||||
writer.String(configuration);
|
||||
if (data.VersionControlInfo.HasChars())
|
||||
{
|
||||
writer.JKEY("VersionControlInfo");
|
||||
writer.String(data.VersionControlInfo);
|
||||
}
|
||||
|
||||
writer.JKEY("BinaryModules");
|
||||
writer.StartArray();
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
#endif
|
||||
#include "FlaxEngine.Gen.h"
|
||||
|
||||
#ifndef REVERSE_Z
|
||||
#define REVERSE_Z 0
|
||||
#endif
|
||||
|
||||
Dictionary<String, CookAssetsStep::ProcessAssetFunc> CookAssetsStep::AssetProcessors;
|
||||
|
||||
void IBuildCache::InvalidateCacheShaders()
|
||||
@@ -233,6 +237,11 @@ void CookAssetsStep::CacheData::Load(CookingData& data)
|
||||
LOG(Info, "{0} option has been modified.", TEXT("ShadersGenerateDebugData"));
|
||||
invalidateShaders = true;
|
||||
}
|
||||
if (REVERSE_Z != Settings.Global.ShadersReverseZ)
|
||||
{
|
||||
LOG(Info, "{0} option has been modified.", TEXT("ShadersReverseZ"));
|
||||
invalidateShaders = true;
|
||||
}
|
||||
#if PLATFORM_TOOLS_WINDOWS
|
||||
if (data.Platform == BuildPlatform::Windows32 || data.Platform == BuildPlatform::Windows64)
|
||||
{
|
||||
@@ -424,6 +433,7 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
options.GenerateDebugData = data.Cache.Settings.Global.ShadersGenerateDebugData;
|
||||
options.TreatWarningsAsErrors = false;
|
||||
options.Output = &cacheStream;
|
||||
options.Platform = data.Data.Tools->GetPlatform();
|
||||
Array<String> includes;
|
||||
|
||||
#define COMPILE_PROFILE(profile, cacheChunk) \
|
||||
@@ -526,7 +536,6 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
#if PLATFORM_TOOLS_XBOX_SCARLETT
|
||||
case BuildPlatform::XboxScarlett:
|
||||
{
|
||||
options.Platform = PlatformType::XboxScarlett;
|
||||
const char* platformDefineName = "PLATFORM_XBOX_SCARLETT";
|
||||
COMPILE_PROFILE(DirectX_SM6, SHADER_FILE_CHUNK_INTERNAL_D3D_SM6_CACHE);
|
||||
break;
|
||||
@@ -1076,6 +1085,7 @@ bool CookAssetsStep::Perform(CookingData& data)
|
||||
{
|
||||
cache.Settings.Global.ShadersNoOptimize = buildSettings->ShadersNoOptimize;
|
||||
cache.Settings.Global.ShadersGenerateDebugData = buildSettings->ShadersGenerateDebugData;
|
||||
cache.Settings.Global.ShadersReverseZ = REVERSE_Z;
|
||||
cache.Settings.Global.StreamingSettingsAssetId = gameSettings->Streaming;
|
||||
cache.Settings.Global.ShadersVersion = GPU_SHADER_CACHE_VERSION;
|
||||
cache.Settings.Global.MaterialGraphVersion = MATERIAL_GRAPH_VERSION;
|
||||
|
||||
@@ -97,6 +97,7 @@ public:
|
||||
{
|
||||
bool ShadersNoOptimize;
|
||||
bool ShadersGenerateDebugData;
|
||||
bool ShadersReverseZ;
|
||||
Guid StreamingSettingsAssetId;
|
||||
int32 ShadersVersion;
|
||||
int32 MaterialGraphVersion;
|
||||
|
||||
@@ -30,13 +30,6 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
Platform::Sleep(10);
|
||||
}
|
||||
FileSystem::CreateDirectory(contentDir);
|
||||
const String dstMono = data.DataOutputPath / TEXT("Mono");
|
||||
#if USE_NETCORE
|
||||
{
|
||||
// Remove old Mono files
|
||||
FileSystem::DeleteDirectory(dstMono);
|
||||
FileSystem::DeleteFile(data.DataOutputPath / TEXT("MonoPosixHelper.dll"));
|
||||
}
|
||||
String dstDotnet = data.DataOutputPath / TEXT("Dotnet");
|
||||
const DotNetAOTModes aotMode = data.Tools->UseAOT();
|
||||
const bool usAOT = aotMode != DotNetAOTModes::None && aotMode != DotNetAOTModes::NoDotnet;
|
||||
@@ -386,23 +379,6 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!FileSystem::DirectoryExists(dstMono))
|
||||
{
|
||||
// Deploy Mono files (from platform data folder)
|
||||
const String srcMono = depsRoot / TEXT("Mono");
|
||||
if (!FileSystem::DirectoryExists(srcMono))
|
||||
{
|
||||
data.Error(TEXT("Missing Mono runtime data files."));
|
||||
return true;
|
||||
}
|
||||
if (FileSystem::CopyDirectory(dstMono, srcMono))
|
||||
{
|
||||
data.Error(TEXT("Failed to copy Mono runtime data files."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Deploy engine data for the target platform
|
||||
if (data.Tools->OnDeployBinaries(data))
|
||||
|
||||
@@ -343,6 +343,7 @@ namespace FlaxEditor.CustomEditors
|
||||
}
|
||||
|
||||
private bool _buildOnUpdate;
|
||||
private bool _initialized;
|
||||
private bool _readOnly;
|
||||
|
||||
/// <summary>
|
||||
@@ -430,6 +431,7 @@ namespace FlaxEditor.CustomEditors
|
||||
|
||||
ClearLayout();
|
||||
_buildOnUpdate = false;
|
||||
_initialized = true;
|
||||
Editor.Setup(this);
|
||||
|
||||
Panel.IsLayoutLocked = false;
|
||||
@@ -506,7 +508,11 @@ namespace FlaxEditor.CustomEditors
|
||||
/// </summary>
|
||||
protected virtual void OnSelectionChanged()
|
||||
{
|
||||
BuildLayout();
|
||||
// Defer building the layout after we have initialized to improve initial loading times
|
||||
if (!_initialized)
|
||||
_buildOnUpdate = true;
|
||||
else
|
||||
BuildLayout();
|
||||
SelectionChanged?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,16 +52,15 @@ void OnAssemblyLoaded(MAssembly* assembly);
|
||||
void OnAssemblyUnloading(MAssembly* assembly);
|
||||
void OnBinaryModuleLoaded(BinaryModule* module);
|
||||
|
||||
MTypeObject* CustomEditorsUtil::GetCustomEditor(MTypeObject* refType)
|
||||
MType* CustomEditorsUtil::GetCustomEditor(MType* type)
|
||||
{
|
||||
if (!refType)
|
||||
if (!type)
|
||||
return nullptr;
|
||||
MType* type = INTERNAL_TYPE_OBJECT_GET(refType);
|
||||
Entry result;
|
||||
if (Cache.TryGet(type, result))
|
||||
{
|
||||
if (result.CustomEditorType)
|
||||
return INTERNAL_TYPE_GET_OBJECT(result.CustomEditorType);
|
||||
return result.CustomEditorType;
|
||||
MClass* editor = result.CustomEditor ? result.CustomEditor : result.DefaultEditor;
|
||||
if (editor)
|
||||
return MUtils::GetType(editor);
|
||||
@@ -127,12 +126,8 @@ void OnAssemblyLoaded(MAssembly* assembly)
|
||||
continue;
|
||||
|
||||
// Check if attribute references a valid class
|
||||
MTypeObject* refType = nullptr;
|
||||
customEditorTypeField->GetValue(attribute, &refType);
|
||||
if (refType == nullptr)
|
||||
continue;
|
||||
|
||||
MType* type = INTERNAL_TYPE_OBJECT_GET(refType);
|
||||
MType* type = nullptr;
|
||||
customEditorTypeField->GetValue(attribute, &type);
|
||||
if (type == nullptr)
|
||||
continue;
|
||||
MClass* typeClass = MCore::Type::GetClass(type);
|
||||
|
||||
@@ -12,6 +12,6 @@ class CustomEditorsUtil
|
||||
public:
|
||||
|
||||
#if USE_CSHARP
|
||||
static MTypeObject* GetCustomEditor(MTypeObject* refType);
|
||||
static MType* GetCustomEditor(MType* type);
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -261,6 +261,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
public static List<ItemInfo> GetItemsForType(ScriptType type, bool useProperties, bool useFields, bool usePropertiesWithoutSetter = false)
|
||||
{
|
||||
var items = new List<ItemInfo>();
|
||||
var isPlayMode = Editor.IsPlayMode;
|
||||
|
||||
if (useProperties)
|
||||
{
|
||||
@@ -278,7 +279,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
continue;
|
||||
|
||||
// Skip hidden fields, handle special attributes
|
||||
if ((!p.IsPublic && !showInEditor) || attributes.Any(x => x is HideInEditorAttribute))
|
||||
if ((!p.IsPublic && !showInEditor) || attributes.Any(x => x is HideInEditorAttribute hide && (!isPlayMode || !hide.ShowInPlayMode)))
|
||||
continue;
|
||||
|
||||
items.Add(new ItemInfo(p, attributes));
|
||||
@@ -293,11 +294,10 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
var f = fields[i];
|
||||
|
||||
var attributes = f.GetAttributes(true);
|
||||
|
||||
// Skip hidden fields, handle special attributes
|
||||
if ((!f.IsPublic && !attributes.Any(x => x is ShowInEditorAttribute)) || attributes.Any(x => x is HideInEditorAttribute))
|
||||
if ((!f.IsPublic && !attributes.Any(x => x is ShowInEditorAttribute)) || attributes.Any(x => x is HideInEditorAttribute hide && (!isPlayMode || !hide.ShowInPlayMode)))
|
||||
continue;
|
||||
|
||||
items.Add(new ItemInfo(f, attributes));
|
||||
|
||||
@@ -679,7 +679,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
return asArray;
|
||||
if (Values[0] is List<Tag> asList)
|
||||
return asList.ToArray();
|
||||
return Utils.GetEmptyArray<Tag>();
|
||||
return Array.Empty<Tag>();
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using System;
|
||||
|
||||
namespace FlaxEditor.CustomEditors.Editors
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the inspector used to edit TimeSpan value type properties.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(TimeSpan)), DefaultEditor]
|
||||
class TimeSpanEditor : CustomEditor
|
||||
{
|
||||
private TextBox _textBox;
|
||||
private bool _isRefreshing;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override DisplayStyle Style => DisplayStyle.Inline;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(LayoutElementsContainer layout)
|
||||
{
|
||||
if (HasDifferentTypes)
|
||||
return;
|
||||
|
||||
_textBox = layout.Custom<TextBox>().CustomControl;
|
||||
_textBox.EditEnd += OnEditEnd;
|
||||
}
|
||||
|
||||
private void OnEditEnd()
|
||||
{
|
||||
if (_isRefreshing)
|
||||
return;
|
||||
if (TimeSpan.TryParse(_textBox.Text, out var timeSpan))
|
||||
SetValue(timeSpan);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
|
||||
_isRefreshing = true;
|
||||
_textBox.Text = HasDifferentValues ? "Multiple Values" : ((TimeSpan)Values[0]).ToString("G");
|
||||
_isRefreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default implementation of the inspector used to edit DateTime value type properties.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(DateTime)), DefaultEditor]
|
||||
class DateTimeEditor : CustomEditor
|
||||
{
|
||||
private TextBox _textBox;
|
||||
private bool _isRefreshing;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override DisplayStyle Style => DisplayStyle.Inline;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(LayoutElementsContainer layout)
|
||||
{
|
||||
if (HasDifferentTypes)
|
||||
return;
|
||||
|
||||
_textBox = layout.Custom<TextBox>().CustomControl;
|
||||
_textBox.EditEnd += OnEditEnd;
|
||||
}
|
||||
|
||||
private void OnEditEnd()
|
||||
{
|
||||
if (_isRefreshing)
|
||||
return;
|
||||
if (DateTime.TryParse(_textBox.Text, out var timeSpan))
|
||||
SetValue(timeSpan);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
|
||||
_isRefreshing = true;
|
||||
_textBox.Text = HasDifferentValues ? "Multiple Values" : ((DateTime)Values[0]).ToString("g");
|
||||
_isRefreshing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ using Microsoft.Win32;
|
||||
/// </summary>
|
||||
public class Editor : EditorModule
|
||||
{
|
||||
private static bool _logDotnetVersionsRange;
|
||||
|
||||
private void AddPlatformTools(BuildOptions options, string platformToolsRoot, string platformToolsRootExternal, string platform, params string[] macros)
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(platformToolsRoot, platform)))
|
||||
@@ -107,7 +109,7 @@ public class Editor : EditorModule
|
||||
var maxVer = DotNetSdk.MaximumVersion.Major;
|
||||
options.PrivateDefinitions.Add("GAME_BUILD_DOTNET_RUNTIME_MIN_VER=" + minVer);
|
||||
options.PrivateDefinitions.Add("GAME_BUILD_DOTNET_RUNTIME_MAX_VER=" + DotNetSdk.MaximumVersion.Major);
|
||||
Log.Verbose($"Using Dotnet runtime versions range {minVer}-{maxVer} for Game Cooker");
|
||||
Log.VerboseOnce($"Using Dotnet runtime versions range {minVer}-{maxVer} for Game Cooker", ref _logDotnetVersionsRange);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -486,6 +486,15 @@ namespace FlaxEditor.GUI
|
||||
button.TooltipText = _tooltips[index];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the text for selected item(s).
|
||||
/// </summary>
|
||||
/// <returns>The display text.</returns>
|
||||
protected virtual string GetSelectedText()
|
||||
{
|
||||
return _selectedIndices.Count == 1 ? (_selectedIndices[0] >= 0 && _selectedIndices[0] < _items.Count ? _items[_selectedIndices[0]] : "") : "Multiple Values";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the popup menu.
|
||||
/// </summary>
|
||||
@@ -554,7 +563,7 @@ namespace FlaxEditor.GUI
|
||||
// Check if has selected item
|
||||
if (_selectedIndices != null && _selectedIndices.Count > 0)
|
||||
{
|
||||
string text = _selectedIndices.Count == 1 ? (_selectedIndices[0] >= 0 && _selectedIndices[0] < _items.Count ? _items[_selectedIndices[0]] : "") : "Multiple Values";
|
||||
string text = GetSelectedText();
|
||||
|
||||
// Draw text of the selected item
|
||||
float textScale = Height / DefaultHeight;
|
||||
|
||||
@@ -355,7 +355,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
if (_previouslyFocused != null)
|
||||
{
|
||||
_previouslyFocused.RootWindow?.Focus();
|
||||
_previouslyFocused.Focus();
|
||||
_previouslyFocused?.Focus();
|
||||
_previouslyFocused = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace FlaxEditor.GUI.Drag
|
||||
return results;
|
||||
}
|
||||
}
|
||||
return Utils.GetEmptyArray<ScriptType>();
|
||||
return Array.Empty<ScriptType>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DragControlType<U> : DragHelper<ScriptType, U> where U : DragEventA
|
||||
return results;
|
||||
}
|
||||
}
|
||||
return Utils.GetEmptyArray<ScriptType>();
|
||||
return Array.Empty<ScriptType>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace FlaxEditor.GUI.Drag
|
||||
return results.ToArray();
|
||||
}
|
||||
}
|
||||
return Utils.GetEmptyArray<Script>();
|
||||
return Array.Empty<Script>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEditor.CustomEditors.Elements;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.Scripting;
|
||||
@@ -106,16 +105,6 @@ namespace FlaxEditor.GUI
|
||||
if (_cachedValue == value && _hasValueCached)
|
||||
return;
|
||||
|
||||
// Single value
|
||||
for (int i = 0; i < _entries.Count; i++)
|
||||
{
|
||||
if (_entries[i].Value == value)
|
||||
{
|
||||
SelectedIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsFlags)
|
||||
{
|
||||
// Collection of flags
|
||||
@@ -123,7 +112,7 @@ namespace FlaxEditor.GUI
|
||||
for (int i = 0; i < _entries.Count; i++)
|
||||
{
|
||||
var e = _entries[i].Value;
|
||||
if (e != 0 && (e & value) == e)
|
||||
if ((e != 0 || value == 0) && (e & value) == e)
|
||||
{
|
||||
selection.Add(i);
|
||||
}
|
||||
@@ -132,7 +121,17 @@ namespace FlaxEditor.GUI
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedIndex = -1;
|
||||
// Single value
|
||||
var toSelect = -1;
|
||||
for (int i = 0; i < _entries.Count; i++)
|
||||
{
|
||||
if (_entries[i].Value == value)
|
||||
{
|
||||
toSelect = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SelectedIndex = toSelect;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,6 +294,22 @@ namespace FlaxEditor.GUI
|
||||
button.CloseMenuOnClick = false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override string GetSelectedText()
|
||||
{
|
||||
// If multiple values are selected then try to find an enum item that matches the mask value
|
||||
if (_selectedIndices.Count > 1)
|
||||
{
|
||||
foreach (var e in _entries)
|
||||
{
|
||||
if (e.Value == Value)
|
||||
return e.Name;
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetSelectedText();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnItemClicked(int index)
|
||||
{
|
||||
@@ -310,43 +325,22 @@ namespace FlaxEditor.GUI
|
||||
}
|
||||
|
||||
// Calculate value that will be set after change
|
||||
long valueAfter = 0;
|
||||
long valueAfter = Value;
|
||||
bool isSelected = _selectedIndices.Contains(index);
|
||||
long selectedValue = entries[index].Value;
|
||||
for (int i = 0; i < _selectedIndices.Count; i++)
|
||||
if (isSelected)
|
||||
{
|
||||
int selectedIndex = _selectedIndices[i];
|
||||
if (selectedIndex != index && (isSelected || (entries[selectedIndex].Value & selectedValue) == 0))
|
||||
valueAfter |= entries[selectedIndex].Value;
|
||||
// Remove from flags selection
|
||||
valueAfter &= ~selectedValue;
|
||||
}
|
||||
if (!isSelected)
|
||||
else
|
||||
{
|
||||
// Add to flags selection
|
||||
valueAfter |= selectedValue;
|
||||
|
||||
// Skip if value won't change
|
||||
if (Value == valueAfter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Build new selection
|
||||
for (int i = 0; i < entries.Count; i++)
|
||||
{
|
||||
if (entries[i].Value == valueAfter)
|
||||
{
|
||||
SelectedIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_selectedIndices.Clear();
|
||||
for (int i = 0; i < entries.Count; i++)
|
||||
{
|
||||
var e = entries[i].Value;
|
||||
if (e != 0 && (e & valueAfter) == e)
|
||||
{
|
||||
_selectedIndices.Add(i);
|
||||
}
|
||||
}
|
||||
OnSelectedIndexChanged();
|
||||
// Change value (incl. multiselection for flags)
|
||||
Value = valueAfter;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -589,6 +589,8 @@ namespace FlaxEditor.GUI
|
||||
// Get the next item
|
||||
bool controlDown = Root.GetKey(KeyboardKeys.Control);
|
||||
var items = GetVisibleItems(!controlDown);
|
||||
if (items.Count == 0)
|
||||
return true;
|
||||
var focusedIndex = items.IndexOf(focusedItem);
|
||||
|
||||
int delta = key == KeyboardKeys.ArrowDown ? -1 : 1;
|
||||
|
||||
@@ -229,6 +229,7 @@ namespace FlaxEditor.GUI.Timeline
|
||||
private List<Track> _mediaMoveStartTracks;
|
||||
private byte[][] _mediaMoveStartData;
|
||||
private float _zoom = 1.0f;
|
||||
private float _tracksVScrollTarget;
|
||||
private bool _isMovingPositionHandle;
|
||||
private bool _canPlayPause = true, _canStop = true;
|
||||
private List<IUndoAction> _batchedUndoActions;
|
||||
@@ -1301,10 +1302,13 @@ namespace FlaxEditor.GUI.Timeline
|
||||
if (track.ParentTrack != null)
|
||||
OnTracksOrderChanged();
|
||||
track.OnSpawned();
|
||||
_tracksPanelArea.ScrollViewTo(track);
|
||||
MarkAsEdited();
|
||||
if (withUndo)
|
||||
Undo?.AddAction(new AddRemoveTrackAction(this, track, true));
|
||||
|
||||
// Scroll to track
|
||||
_tracksPanelArea.ScrollViewTo(track);
|
||||
_tracksVScrollTarget = _tracksPanelArea.VScrollBar.TargetValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2033,12 +2037,24 @@ namespace FlaxEditor.GUI.Timeline
|
||||
base.Update(deltaTime);
|
||||
|
||||
// Synchronize scroll vertical bars for tracks and media panels to keep the view in sync
|
||||
var scroll1 = _tracksPanelArea.VScrollBar;
|
||||
var scroll2 = _backgroundArea.VScrollBar;
|
||||
if (scroll1.IsThumbClicked || _tracksPanelArea.IsMouseOver)
|
||||
scroll2.TargetValue = scroll1.Value;
|
||||
var tracksVScroll = _tracksPanelArea.VScrollBar;
|
||||
var backgroundVScroll = _backgroundArea.VScrollBar;
|
||||
bool forceBackgroundToTracksScroll = _tracksVScrollTarget > 0;
|
||||
if (forceBackgroundToTracksScroll)
|
||||
{
|
||||
backgroundVScroll.TargetValue = tracksVScroll.Value;
|
||||
|
||||
if (Mathf.Abs(tracksVScroll.Value - _tracksVScrollTarget) < 0.5f)
|
||||
_tracksVScrollTarget = 0f;
|
||||
}
|
||||
else if (tracksVScroll.IsThumbClicked || _tracksPanelArea.IsMouseOver)
|
||||
{
|
||||
backgroundVScroll.TargetValue = tracksVScroll.Value;
|
||||
}
|
||||
else
|
||||
scroll1.TargetValue = scroll2.Value;
|
||||
{
|
||||
tracksVScroll.TargetValue = backgroundVScroll.Value;
|
||||
}
|
||||
|
||||
// Batch undo actions
|
||||
if (_batchedUndoActions != null && _batchedUndoActions.Count != 0)
|
||||
|
||||
@@ -146,12 +146,12 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
/// <summary>
|
||||
/// The event parameters data sizes collection.
|
||||
/// </summary>
|
||||
public int[] EventParamsSizes = Utils.GetEmptyArray<int>();
|
||||
public int[] EventParamsSizes = Array.Empty<int>();
|
||||
|
||||
/// <summary>
|
||||
/// The event parameters types collection.
|
||||
/// </summary>
|
||||
public Type[] EventParamsTypes = Utils.GetEmptyArray<Type>();
|
||||
public Type[] EventParamsTypes = Array.Empty<Type>();
|
||||
|
||||
/// <summary>
|
||||
/// The event key data.
|
||||
@@ -380,7 +380,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
}
|
||||
else
|
||||
{
|
||||
EventParamsTypes = Utils.GetEmptyArray<Type>();
|
||||
EventParamsTypes = Array.Empty<Type>();
|
||||
}
|
||||
OnEventParamsChanged();
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class WindowDecorations : ContainerControl
|
||||
return WindowHitCodes.NoWhere;
|
||||
|
||||
var dpiScale = _window.DpiScale;
|
||||
var pos = _window.ScreenToClient(mouse * dpiScale); // pos is not DPI adjusted
|
||||
var pos = _window.ScreenToClient(mouse * dpiScale); // pos is DPI adjusted in window space
|
||||
if (!_window.IsMaximized)
|
||||
{
|
||||
var winSize = _window.Size;
|
||||
@@ -214,6 +214,7 @@ public class WindowDecorations : ContainerControl
|
||||
return WindowHitCodes.Bottom;
|
||||
}
|
||||
|
||||
pos /= dpiScale; // The position should not be DPI adjusted in control space
|
||||
var controlUnderMouse = GetChildAt(pos, control => control != _title);
|
||||
if (_title.Bounds.Contains(pos) && controlUnderMouse == null)
|
||||
return WindowHitCodes.Caption;
|
||||
|
||||
@@ -36,8 +36,10 @@ internal class DirectionGizmo : ContainerControl
|
||||
private List<AxisData> _axisData = new List<AxisData>();
|
||||
private int _hoveredAxisIndex = -1;
|
||||
|
||||
private bool _mouseDown;
|
||||
private Float2 _mouseDownLocation;
|
||||
|
||||
private SpriteHandle _posHandle;
|
||||
private SpriteHandle _negHandle;
|
||||
|
||||
private FontReference _fontReference;
|
||||
|
||||
@@ -110,7 +112,6 @@ internal class DirectionGizmo : ContainerControl
|
||||
|
||||
var editor = Editor.Instance;
|
||||
_posHandle = editor.Icons.VisjectBoxClosed32;
|
||||
_negHandle = editor.Icons.VisjectBoxOpen32;
|
||||
|
||||
_fontReference = new FontReference(Style.Current.FontSmall);
|
||||
|
||||
@@ -142,7 +143,25 @@ internal class DirectionGizmo : ContainerControl
|
||||
public override void OnMouseMove(Float2 location)
|
||||
{
|
||||
_hoveredAxisIndex = -1;
|
||||
|
||||
if (_mouseDown)
|
||||
{
|
||||
StartMouseCapture(true);
|
||||
Cursor = CursorType.Hidden;
|
||||
|
||||
const float sensitivity = 0.125f;
|
||||
Float2 delta = Input.MousePositionDelta;
|
||||
delta *= Mathf.DegreesToRadians;
|
||||
delta *= sensitivity;
|
||||
|
||||
const float orbitRadius = 500f;
|
||||
Quaternion newOrientation = _viewport.ViewOrientation * Quaternion.RotationYawPitchRoll(delta.X , delta.Y, 0f);
|
||||
Vector3 orbitCenter = _viewport.ViewPosition + _viewport.ViewDirection * orbitRadius;
|
||||
_viewport.ViewportCamera.SetArcBallView(newOrientation, orbitCenter, orbitRadius);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Check which axis is being hovered - check from closest to farthest for proper layering
|
||||
for (int i = _spritePositions.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -156,9 +175,30 @@ internal class DirectionGizmo : ContainerControl
|
||||
base.OnMouseMove(location);
|
||||
}
|
||||
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
_mouseDown = true;
|
||||
_mouseDownLocation = location;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
if (_mouseDown)
|
||||
{
|
||||
_mouseDown = false;
|
||||
|
||||
if (_mouseDownLocation != location)
|
||||
{
|
||||
_mouseDown = false;
|
||||
EndMouseCapture();
|
||||
Root.MousePosition = PointToParent(Root, _mouseDownLocation);
|
||||
Cursor = CursorType.Default;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (base.OnMouseUp(location, button))
|
||||
return true;
|
||||
|
||||
@@ -222,7 +262,10 @@ internal class DirectionGizmo : ContainerControl
|
||||
else
|
||||
{
|
||||
// This could be some actual math expression, not that hack
|
||||
var fov = _owner.Viewport.FieldOfView / 60.0f;
|
||||
float fov = _owner.Viewport.FieldOfView;
|
||||
if (_owner.Viewport.ViewportCamera is Viewport.Cameras.FPSCamera fpsCam)
|
||||
fov += fpsCam.AdditionalZoomFOV;
|
||||
fov /= 60.0f;
|
||||
float scaleAt30 = 0.1f, scaleAt60 = 1.0f, scaleAt120 = 1.5f, scaleAt180 = 3.0f;
|
||||
heightNormalization /= Mathf.Lerp(scaleAt30, scaleAt60, fov);
|
||||
heightNormalization /= Mathf.Lerp(scaleAt60, scaleAt120, Mathf.Saturate(fov - 1));
|
||||
@@ -266,7 +309,12 @@ internal class DirectionGizmo : ContainerControl
|
||||
// Rebuild sprite positions list for hover detection
|
||||
_spritePositions.Clear();
|
||||
|
||||
Render2D.DrawSprite(_posHandle, new Rectangle(0, 0, Size), Color.Black.AlphaMultiplied(_backgroundOpacity));
|
||||
if (IsMouseOver)
|
||||
{
|
||||
Rectangle backgroundRect = new Rectangle(0, 0, Size);
|
||||
Color backgroundColor = Color.DarkGray.AlphaMultiplied(_backgroundOpacity);
|
||||
Render2D.DrawSprite(_posHandle, backgroundRect, backgroundColor);
|
||||
}
|
||||
|
||||
// Draw in order from farthest to closest
|
||||
for (int i = 0; i < _axisData.Count; i++)
|
||||
|
||||
@@ -139,15 +139,11 @@ namespace FlaxEditor.Gizmo
|
||||
DrawSelectionDepth(context, renderContext.Task, customDepth);
|
||||
_actors.Clear();
|
||||
|
||||
var near = renderContext.View.Near;
|
||||
var far = renderContext.View.Far;
|
||||
var projection = renderContext.View.Projection;
|
||||
|
||||
// Render outline
|
||||
_material.SetParameterValue("OutlineColor0", _color0);
|
||||
_material.SetParameterValue("OutlineColor1", _color1);
|
||||
_material.SetParameterValue("CustomDepth", customDepth);
|
||||
_material.SetParameterValue("ViewInfo", new Float4(1.0f / projection.M11, 1.0f / projection.M22, far / (far - near), (-far * near) / (far - near) / far));
|
||||
_material.SetParameterValue("ViewInfo", renderContext.View.ViewInfo);
|
||||
Renderer.DrawPostFxMaterial(context, ref renderContext, _material, output, input.View());
|
||||
|
||||
// Cleanup
|
||||
|
||||
@@ -526,7 +526,7 @@ DEFINE_INTERNAL_CALL(void) EditorInternal_SetAnimationTime(AnimatedModel* animat
|
||||
animatedModel->GraphInstance.State[0].Animation.TimePosition = time;
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(MTypeObject*) CustomEditorsUtilInternal_GetCustomEditor(MTypeObject* targetType)
|
||||
DEFINE_INTERNAL_CALL(MType*) CustomEditorsUtilInternal_GetCustomEditor(MType* targetType)
|
||||
{
|
||||
return CustomEditorsUtil::GetCustomEditor(targetType);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace FlaxEditor.Modules
|
||||
private bool _rebuildInitFlag;
|
||||
private int _itemsCreated;
|
||||
private int _itemsDeleted;
|
||||
private readonly HashSet<MainContentFolderTreeNode> _dirtyNodes = new HashSet<MainContentFolderTreeNode>();
|
||||
private readonly HashSet<ContentFolderTreeNode> _dirtyNodes = new HashSet<ContentFolderTreeNode>();
|
||||
|
||||
/// <summary>
|
||||
/// The project directory.
|
||||
@@ -1309,26 +1309,31 @@ namespace FlaxEditor.Modules
|
||||
|
||||
internal void OnDirectoryEvent(MainContentFolderTreeNode node, FileSystemEventArgs e)
|
||||
{
|
||||
// Ensure to be ready for external events
|
||||
// Ignore events during fast setup
|
||||
if (_isDuringFastSetup)
|
||||
return;
|
||||
ContentFolderTreeNode dirtyNode = node;
|
||||
|
||||
// TODO: maybe we could make it faster! since we have a path so it would be easy to just create or delete given file. but remember about subdirectories
|
||||
// Filter the node based on modified path
|
||||
// (eg. if we have event for 'Content/Folder1/Folder2' and node is 'Content/Folder1' then we should process but skip other 'Content' subfolders)
|
||||
var path = StringUtils.NormalizePath(Path.GetDirectoryName(e.FullPath));
|
||||
var pathItem = node.Folder.Find(path) as ContentFolder;
|
||||
if (pathItem != null)
|
||||
{
|
||||
dirtyNode = pathItem.Node;
|
||||
}
|
||||
|
||||
// Switch type
|
||||
switch (e.ChangeType)
|
||||
{
|
||||
case WatcherChangeTypes.Created:
|
||||
case WatcherChangeTypes.Deleted:
|
||||
case WatcherChangeTypes.Renamed:
|
||||
{
|
||||
lock (_dirtyNodes)
|
||||
{
|
||||
_dirtyNodes.Add(node);
|
||||
_dirtyNodes.Add(dirtyNode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnScriptsReload()
|
||||
@@ -1383,14 +1388,15 @@ namespace FlaxEditor.Modules
|
||||
// Update all dirty content tree nodes
|
||||
lock (_dirtyNodes)
|
||||
{
|
||||
Profiler.BeginEvent("ContentDatabase.Refresh");
|
||||
foreach (var node in _dirtyNodes)
|
||||
{
|
||||
LoadFolder(node, true);
|
||||
|
||||
if (_enableEvents)
|
||||
WorkspaceModified?.Invoke();
|
||||
}
|
||||
if (_enableEvents && _dirtyNodes.Count != 0)
|
||||
WorkspaceModified?.Invoke();
|
||||
_dirtyNodes.Clear();
|
||||
Profiler.EndEvent();
|
||||
}
|
||||
|
||||
// Lazy-rebuilds
|
||||
|
||||
@@ -381,9 +381,6 @@ namespace FlaxEditor.Modules
|
||||
Thread.Sleep(0);
|
||||
|
||||
_workerThread.Join(1000);
|
||||
#if !USE_NETCORE
|
||||
_workerThread.Abort(); // Deprecated in .NET 7
|
||||
#endif
|
||||
_workerThread = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEngine;
|
||||
|
||||
@@ -21,7 +17,6 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
{
|
||||
private Dictionary<ScriptType, string> _typeCache = new Dictionary<ScriptType, string>();
|
||||
private Dictionary<ScriptMemberInfo, string> _memberCache = new Dictionary<ScriptMemberInfo, string>();
|
||||
private Dictionary<Assembly, Dictionary<string, string>> _xmlCache = new Dictionary<Assembly, Dictionary<string, string>>();
|
||||
|
||||
internal CodeDocsModule(Editor editor)
|
||||
: base(editor)
|
||||
@@ -61,13 +56,9 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
else if (type.Type != null)
|
||||
{
|
||||
// Try to use xml docs for managed type
|
||||
var xml = GetXmlDocs(type.Type.Assembly);
|
||||
if (xml != null)
|
||||
{
|
||||
var key = "T:" + GetXmlKey(type.Type.FullName);
|
||||
if (xml.TryGetValue(key, out var xmlDoc))
|
||||
text += '\n' + FilterWhitespaces(xmlDoc);
|
||||
}
|
||||
var xmlDoc = DebugCommands.GetXml(type.Type);
|
||||
if (xmlDoc != null)
|
||||
text += '\n' + xmlDoc;
|
||||
}
|
||||
|
||||
_typeCache.Add(type, text);
|
||||
@@ -108,242 +99,20 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
else if (member.Type != null)
|
||||
{
|
||||
// Try to use xml docs for managed member
|
||||
var memberInfo = member.Type;
|
||||
var xml = GetXmlDocs(memberInfo.DeclaringType.Assembly);
|
||||
if (xml != null)
|
||||
{
|
||||
// [Reference: MSDN Magazine, October 2019, Volume 34 Number 10, "Accessing XML Documentation via Reflection"]
|
||||
// https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/october/csharp-accessing-xml-documentation-via-reflection
|
||||
var memberType = memberInfo.MemberType;
|
||||
string key = null;
|
||||
if (memberType.HasFlag(MemberTypes.Field))
|
||||
{
|
||||
var fieldInfo = (FieldInfo)memberInfo;
|
||||
key = "F:" + GetXmlKey(fieldInfo.DeclaringType.FullName) + "." + fieldInfo.Name;
|
||||
}
|
||||
else if (memberType.HasFlag(MemberTypes.Property))
|
||||
{
|
||||
var propertyInfo = (PropertyInfo)memberInfo;
|
||||
key = "P:" + GetXmlKey(propertyInfo.DeclaringType.FullName) + "." + propertyInfo.Name;
|
||||
}
|
||||
else if (memberType.HasFlag(MemberTypes.Event))
|
||||
{
|
||||
var eventInfo = (EventInfo)memberInfo;
|
||||
key = "E:" + GetXmlKey(eventInfo.DeclaringType.FullName) + "." + eventInfo.Name;
|
||||
}
|
||||
else if (memberType.HasFlag(MemberTypes.Constructor))
|
||||
{
|
||||
var constructorInfo = (ConstructorInfo)memberInfo;
|
||||
key = GetXmlKey(constructorInfo);
|
||||
}
|
||||
else if (memberType.HasFlag(MemberTypes.Method))
|
||||
{
|
||||
var methodInfo = (MethodInfo)memberInfo;
|
||||
key = GetXmlKey(methodInfo);
|
||||
}
|
||||
else if (memberType.HasFlag(MemberTypes.TypeInfo) || memberType.HasFlag(MemberTypes.NestedType))
|
||||
{
|
||||
var typeInfo = (TypeInfo)memberInfo;
|
||||
key = "T:" + GetXmlKey(typeInfo.FullName);
|
||||
}
|
||||
if (key != null)
|
||||
xml.TryGetValue(key, out text);
|
||||
|
||||
// Customize tooltips for properties to be more human-readable in UI
|
||||
if (text != null && memberType.HasFlag(MemberTypes.Property) && text.StartsWith("Gets or sets ", StringComparison.Ordinal))
|
||||
{
|
||||
text = text.Substring(13);
|
||||
unsafe
|
||||
{
|
||||
fixed (char* e = text)
|
||||
e[0] = char.ToUpper(e[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var xmlDoc = DebugCommands.GetXml(member.Type);
|
||||
if (xmlDoc != null)
|
||||
text = xmlDoc;
|
||||
}
|
||||
|
||||
_memberCache.Add(member, text);
|
||||
return text;
|
||||
}
|
||||
|
||||
// [Reference: MSDN Magazine, October 2019, Volume 34 Number 10, "Accessing XML Documentation via Reflection"]
|
||||
// https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/october/csharp-accessing-xml-documentation-via-reflection
|
||||
|
||||
private string GetXmlKey(MethodInfo methodInfo)
|
||||
{
|
||||
var typeGenericMap = new Dictionary<string, int>();
|
||||
var methodGenericMap = new Dictionary<string, int>();
|
||||
ParameterInfo[] parameterInfos = methodInfo.GetParameters();
|
||||
|
||||
if (methodInfo.DeclaringType.IsGenericType)
|
||||
{
|
||||
var methods = methodInfo.DeclaringType.GetGenericTypeDefinition().GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
methodInfo = methods.First(x => x.MetadataToken == methodInfo.MetadataToken);
|
||||
}
|
||||
|
||||
Type[] typeGenericArguments = methodInfo.DeclaringType.GetGenericArguments();
|
||||
for (int i = 0; i < typeGenericArguments.Length; i++)
|
||||
{
|
||||
Type typeGeneric = typeGenericArguments[i];
|
||||
typeGenericMap[typeGeneric.Name] = i;
|
||||
}
|
||||
|
||||
Type[] methodGenericArguments = methodInfo.GetGenericArguments();
|
||||
for (int i = 0; i < methodGenericArguments.Length; i++)
|
||||
{
|
||||
Type methodGeneric = methodGenericArguments[i];
|
||||
methodGenericMap[methodGeneric.Name] = i;
|
||||
}
|
||||
|
||||
string declarationTypeString = GetXmlKey(methodInfo.DeclaringType, false, typeGenericMap, methodGenericMap);
|
||||
string memberNameString = methodInfo.Name;
|
||||
string methodGenericArgumentsString = methodGenericMap.Count > 0 ? "``" + methodGenericMap.Count : string.Empty;
|
||||
string parametersString = parameterInfos.Length > 0 ? "(" + string.Join(",", methodInfo.GetParameters().Select(x => GetXmlKey(x.ParameterType, true, typeGenericMap, methodGenericMap))) + ")" : string.Empty;
|
||||
|
||||
string key = "M:" + declarationTypeString + "." + memberNameString + methodGenericArgumentsString + parametersString;
|
||||
if (methodInfo.Name is "op_Implicit" || methodInfo.Name is "op_Explicit")
|
||||
{
|
||||
key += "~" + GetXmlKey(methodInfo.ReturnType, true, typeGenericMap, methodGenericMap);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
private string GetXmlKey(ConstructorInfo constructorInfo)
|
||||
{
|
||||
var typeGenericMap = new Dictionary<string, int>();
|
||||
var methodGenericMap = new Dictionary<string, int>();
|
||||
ParameterInfo[] parameterInfos = constructorInfo.GetParameters();
|
||||
|
||||
Type[] typeGenericArguments = constructorInfo.DeclaringType.GetGenericArguments();
|
||||
for (int i = 0; i < typeGenericArguments.Length; i++)
|
||||
{
|
||||
Type typeGeneric = typeGenericArguments[i];
|
||||
typeGenericMap[typeGeneric.Name] = i;
|
||||
}
|
||||
|
||||
string declarationTypeString = GetXmlKey(constructorInfo.DeclaringType, false, typeGenericMap, methodGenericMap);
|
||||
string methodGenericArgumentsString = methodGenericMap.Count > 0 ? "``" + methodGenericMap.Count : string.Empty;
|
||||
string parametersString = parameterInfos.Length > 0 ? "(" + string.Join(",", constructorInfo.GetParameters().Select(x => GetXmlKey(x.ParameterType, true, typeGenericMap, methodGenericMap))) + ")" : string.Empty;
|
||||
|
||||
return "M:" + declarationTypeString + "." + "#ctor" + methodGenericArgumentsString + parametersString;
|
||||
}
|
||||
|
||||
internal static string GetXmlKey(Type type, bool isMethodParameter, Dictionary<string, int> typeGenericMap, Dictionary<string, int> methodGenericMap)
|
||||
{
|
||||
if (type.IsGenericParameter)
|
||||
{
|
||||
if (methodGenericMap.TryGetValue(type.Name, out var methodIndex))
|
||||
return "``" + methodIndex;
|
||||
if (typeGenericMap.TryGetValue(type.Name, out var typeKey))
|
||||
return "`" + typeKey;
|
||||
return "`";
|
||||
}
|
||||
if (type.HasElementType)
|
||||
{
|
||||
string elementTypeString = GetXmlKey(type.GetElementType(), isMethodParameter, typeGenericMap, methodGenericMap);
|
||||
if (type.IsPointer)
|
||||
return elementTypeString + "*";
|
||||
if (type.IsByRef)
|
||||
return elementTypeString + "@";
|
||||
if (type.IsArray)
|
||||
{
|
||||
int rank = type.GetArrayRank();
|
||||
string arrayDimensionsString = rank > 1 ? "[" + string.Join(",", Enumerable.Repeat("0:", rank)) + "]" : "[]";
|
||||
return elementTypeString + arrayDimensionsString;
|
||||
}
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
string prefaceString = type.IsNested ? GetXmlKey(type.DeclaringType, isMethodParameter, typeGenericMap, methodGenericMap) + "." : type.Namespace + ".";
|
||||
string typeNameString = isMethodParameter ? Regex.Replace(type.Name, @"`\d+", string.Empty) : type.Name;
|
||||
string genericArgumentsString = type.IsGenericType && isMethodParameter ? "{" + string.Join(",", type.GetGenericArguments().Select(argument => GetXmlKey(argument, true, typeGenericMap, methodGenericMap))) + "}" : string.Empty;
|
||||
return prefaceString + typeNameString + genericArgumentsString;
|
||||
}
|
||||
|
||||
private static string GetXmlKey(string typeFullNameString)
|
||||
{
|
||||
return Regex.Replace(typeFullNameString, @"\[.*\]", string.Empty).Replace('+', '.');
|
||||
}
|
||||
|
||||
private static string FilterWhitespaces(string str)
|
||||
{
|
||||
if (str.Contains(" ", StringComparison.Ordinal))
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var prev = str[0];
|
||||
sb.Append(prev);
|
||||
for (int i = 1; i < str.Length; i++)
|
||||
{
|
||||
var c = str[i];
|
||||
if (prev != ' ' || c != ' ')
|
||||
{
|
||||
sb.Append(c);
|
||||
}
|
||||
prev = c;
|
||||
}
|
||||
str = sb.ToString();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetXmlDocs(Assembly assembly)
|
||||
{
|
||||
if (!_xmlCache.TryGetValue(assembly, out var result))
|
||||
{
|
||||
Profiler.BeginEvent("GetXmlDocs");
|
||||
|
||||
var assemblyPath = Utils.GetAssemblyLocation(assembly);
|
||||
var assemblyName = assembly.GetName().Name;
|
||||
var xmlFilePath = Path.ChangeExtension(assemblyPath, ".xml");
|
||||
if (!File.Exists(assemblyPath) && !string.IsNullOrEmpty(assemblyPath))
|
||||
{
|
||||
var uri = new UriBuilder(assemblyPath);
|
||||
var path = Uri.UnescapeDataString(uri.Path);
|
||||
xmlFilePath = Path.Combine(Path.GetDirectoryName(path), assemblyName + ".xml");
|
||||
}
|
||||
if (File.Exists(xmlFilePath))
|
||||
{
|
||||
Profiler.BeginEvent(assemblyName);
|
||||
try
|
||||
{
|
||||
// Parse xml documentation
|
||||
using (var xmlReader = XmlReader.Create(new StreamReader(xmlFilePath)))
|
||||
{
|
||||
result = new Dictionary<string, string>();
|
||||
while (xmlReader.Read())
|
||||
{
|
||||
if (xmlReader.NodeType == XmlNodeType.Element && string.Equals(xmlReader.Name, "member", StringComparison.Ordinal))
|
||||
{
|
||||
string rawName = xmlReader["name"];
|
||||
var memberReader = xmlReader.ReadSubtree();
|
||||
if (memberReader.ReadToDescendant("summary"))
|
||||
{
|
||||
// Remove <see cref=""/> and replace them with the captured group (the content of the cref). Additionally, getting rid of prefixes
|
||||
const string crefPattern = @"<see\s+cref=""(?:[A-Z]:FlaxEngine\.)?([^""]+)""\s*\/>";
|
||||
result[rawName] = Regex.Replace(memberReader.ReadInnerXml(), crefPattern, "$1").Replace('\n', ' ').Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore errors
|
||||
}
|
||||
Profiler.EndEvent();
|
||||
}
|
||||
|
||||
_xmlCache[assembly] = result;
|
||||
Profiler.EndEvent();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void OnTypesCleared()
|
||||
{
|
||||
_typeCache.Clear();
|
||||
_memberCache.Clear();
|
||||
_xmlCache.Clear();
|
||||
DebugCommands.ClearXml();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -584,7 +584,6 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
var codeBase = Utils.GetAssemblyLocation(assembly);
|
||||
if (string.IsNullOrEmpty(codeBase))
|
||||
return true;
|
||||
#if USE_NETCORE
|
||||
if (assembly.ManifestModule.FullyQualifiedName == "<In Memory Module>")
|
||||
return false;
|
||||
|
||||
@@ -592,11 +591,6 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
||||
string repositoryUrl = assembly.GetCustomAttributes<AssemblyMetadataAttribute>().FirstOrDefault(x => x.Key == "RepositoryUrl")?.Value ?? "";
|
||||
if (repositoryUrl != "https://github.com/dotnet/runtime")
|
||||
return true;
|
||||
#else
|
||||
// Skip assemblies from in-build Mono directory
|
||||
if (!codeBase.Contains("/Mono/lib/mono/"))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -465,6 +465,8 @@ namespace FlaxEditor.Modules
|
||||
|
||||
internal void ProgressFailed(string message)
|
||||
{
|
||||
if (StatusBar == null)
|
||||
return;
|
||||
_progressFailed = true;
|
||||
StatusBar.StatusColor = Style.Current.Statusbar.Failed;
|
||||
StatusBar.Text = message;
|
||||
|
||||
@@ -347,6 +347,14 @@ namespace FlaxEditor.Options
|
||||
[EditorDisplay("Viewport"), EditorOrder(1550)]
|
||||
public InputBinding Down = new InputBinding(KeyboardKeys.Q);
|
||||
|
||||
[DefaultValue(typeof(InputBinding), "C")]
|
||||
[EditorDisplay("Viewport"), EditorOrder(1551)]
|
||||
public InputBinding ZoomIn = new InputBinding(KeyboardKeys.C);
|
||||
|
||||
[DefaultValue(typeof(InputBinding), "Z")]
|
||||
[EditorDisplay("Viewport"), EditorOrder(1552)]
|
||||
public InputBinding ZoomOut = new InputBinding(KeyboardKeys.Z);
|
||||
|
||||
[DefaultValue(typeof(InputBinding), "None")]
|
||||
[EditorDisplay("Viewport", "Toggle Camera Rotation"), EditorOrder(1560)]
|
||||
public InputBinding CameraToggleRotation = new InputBinding(KeyboardKeys.None);
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace FlaxEditor.Options
|
||||
public float DirectionGizmoScale { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value for the opacity of the main viewports <see cref="Gizmo.DirectionGizmo"/> background.
|
||||
/// Gets or sets a value for the opacity of the main viewports <see cref="Gizmo.DirectionGizmo"/> background. Background will only show when the gizmo is hovered.
|
||||
/// </summary>
|
||||
[DefaultValue(0.1f), Limit(0.0f, 1.0f)]
|
||||
[EditorDisplay("Direction Gizmo"), EditorOrder(502), Tooltip("The background opacity of the of the direction gizmo in the main viewport.")]
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
#include "Engine/Platform/Win32/IncludeWindowsHeaders.h"
|
||||
#elif PLATFORM_MAC
|
||||
#include "Engine/Platform/Apple/AppleUtils.h"
|
||||
#include <AppKit/AppKit.h>
|
||||
#endif
|
||||
|
||||
namespace
|
||||
@@ -68,10 +71,14 @@ namespace
|
||||
if (!launcherPath.HasChars() || !FileSystem::FileExists(exePath))
|
||||
return;
|
||||
|
||||
if (launchOverridePath != String::Empty)
|
||||
installations->Add(New<RiderInstallation>(launchOverridePath, versionMember->value.GetText()));
|
||||
else
|
||||
installations->Add(New<RiderInstallation>(exePath, versionMember->value.GetText()));
|
||||
String installPath = launchOverridePath != String::Empty ? launchOverridePath : exePath;
|
||||
StringUtils::PathRemoveRelativeParts(installPath);
|
||||
for (RiderInstallation* installation : *installations)
|
||||
{
|
||||
if (installation->path == installPath)
|
||||
return;
|
||||
}
|
||||
installations->Add(New<RiderInstallation>(installPath, versionMember->value.GetText()));
|
||||
}
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
@@ -221,17 +228,29 @@ void RiderCodeEditor::FindEditors(Array<CodeEditor*>* output)
|
||||
String applicationSupportFolder;
|
||||
FileSystem::GetSpecialFolderPath(SpecialFolder::ProgramData, applicationSupportFolder);
|
||||
|
||||
NSURL* appURL = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:@"com.jetbrains.rider"];
|
||||
if (appURL != nullptr)
|
||||
{
|
||||
const String appPath = AppleUtils::ToString((CFStringRef)[appURL path]);
|
||||
SearchDirectory(&installations, appPath / TEXT("Contents/Resources"), appPath);
|
||||
}
|
||||
|
||||
Array<String> subMacDirectories;
|
||||
FileSystem::GetChildDirectories(subMacDirectories, applicationSupportFolder / TEXT("JetBrains/Toolbox/apps/Rider/ch-0/"));
|
||||
FileSystem::GetChildDirectories(subMacDirectories, applicationSupportFolder / TEXT("JetBrains/Toolbox/apps/Rider/ch-1/"));
|
||||
for (const String& directory : subMacDirectories)
|
||||
{
|
||||
String riderAppDirectory = directory / TEXT("Rider.app/Contents/Resources");
|
||||
SearchDirectory(&installations, riderAppDirectory);
|
||||
String riderAppPath = directory / TEXT("Rider.app");
|
||||
SearchDirectory(&installations, riderAppPath / TEXT("Contents/Resources"), riderAppPath);
|
||||
}
|
||||
|
||||
// Check the local installer version
|
||||
SearchDirectory(&installations, TEXT("/Applications/Rider.app/Contents/Resources"));
|
||||
SearchDirectory(&installations, TEXT("/Applications/Rider.app/Contents/Resources"), TEXT("/Applications/Rider.app"));
|
||||
|
||||
String userFolder;
|
||||
FileSystem::GetSpecialFolderPath(SpecialFolder::Documents, userFolder);
|
||||
String riderAppPath = userFolder / TEXT("../Applications/Rider.app");
|
||||
SearchDirectory(&installations, riderAppPath / TEXT("Contents/Resources"), riderAppPath);
|
||||
#endif
|
||||
|
||||
for (const String& directory : subDirectories)
|
||||
@@ -259,7 +278,7 @@ String RiderCodeEditor::GetName() const
|
||||
|
||||
String RiderCodeEditor::GetGenerateProjectCustomArgs() const
|
||||
{
|
||||
return TEXT("-vs2022");
|
||||
return TEXT("-vs2026");
|
||||
}
|
||||
|
||||
void RiderCodeEditor::OpenFile(const String& path, int32 line)
|
||||
|
||||
@@ -130,7 +130,7 @@ String VisualStudioCodeEditor::GetName() const
|
||||
|
||||
String VisualStudioCodeEditor::GetGenerateProjectCustomArgs() const
|
||||
{
|
||||
return TEXT("-vs2022 -vscode");
|
||||
return TEXT("-vs2026 -vscode");
|
||||
}
|
||||
|
||||
void VisualStudioCodeEditor::OpenFile(const String& path, int32 line)
|
||||
@@ -138,7 +138,7 @@ void VisualStudioCodeEditor::OpenFile(const String& path, int32 line)
|
||||
// Generate VS solution files for intellisense
|
||||
if (!FileSystem::FileExists(Globals::ProjectFolder / Editor::Project->Name + TEXT(".sln")))
|
||||
{
|
||||
ScriptsBuilder::GenerateProject(TEXT("-vs2022"));
|
||||
ScriptsBuilder::GenerateProject(TEXT("-vs2026"));
|
||||
}
|
||||
|
||||
// Generate project files if missing
|
||||
@@ -165,7 +165,7 @@ void VisualStudioCodeEditor::OpenSolution()
|
||||
// Generate VS solution files for intellisense
|
||||
if (!FileSystem::FileExists(Globals::ProjectFolder / Editor::Project->Name + TEXT(".sln")))
|
||||
{
|
||||
ScriptsBuilder::GenerateProject(TEXT("-vs2022"));
|
||||
ScriptsBuilder::GenerateProject(TEXT("-vs2026"));
|
||||
}
|
||||
|
||||
// Generate project files if solution is missing
|
||||
|
||||
@@ -112,37 +112,37 @@ namespace FlaxEditor.Scripting
|
||||
/// <inheritdoc />
|
||||
public object[] GetAttributes(bool inherit)
|
||||
{
|
||||
return Utils.GetEmptyArray<object>();
|
||||
return Array.Empty<object>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ScriptMemberInfo[] GetMembers(string name, MemberTypes type, BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ScriptMemberInfo[] GetMembers(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ScriptMemberInfo[] GetFields(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ScriptMemberInfo[] GetProperties(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ScriptMemberInfo[] GetMethods(BindingFlags bindingAttr)
|
||||
{
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -447,7 +447,7 @@ namespace FlaxEditor.Scripting
|
||||
{
|
||||
var parameters = methodInfo.GetParameters();
|
||||
if (parameters.Length == 0)
|
||||
return Utils.GetEmptyArray<Parameter>();
|
||||
return Array.Empty<Parameter>();
|
||||
var result = new Parameter[parameters.Length];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
{
|
||||
@@ -593,7 +593,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
if (_custom != null)
|
||||
return _custom.GetAttributes(inherit);
|
||||
return Utils.GetEmptyArray<object>();
|
||||
return Array.Empty<object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1116,7 +1116,7 @@ namespace FlaxEditor.Scripting
|
||||
return _managed.GetCustomAttributes(inherit);
|
||||
if (_custom != null)
|
||||
return _custom.GetAttributes(inherit);
|
||||
return Utils.GetEmptyArray<object>();
|
||||
return Array.Empty<object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1191,12 +1191,12 @@ namespace FlaxEditor.Scripting
|
||||
if (_managed != null)
|
||||
{
|
||||
managedMembers = _managed.GetMember(name, type, bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
managedMembers = null;
|
||||
if (_custom != null)
|
||||
return _custom.GetMembers(name, type, bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1218,7 +1218,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
if (_custom != null)
|
||||
return _custom.GetMembers(name, type, bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1282,12 +1282,12 @@ namespace FlaxEditor.Scripting
|
||||
if (_managed != null)
|
||||
{
|
||||
managedMembers = _managed.GetMembers(bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
managedMembers = null;
|
||||
if (_custom != null)
|
||||
return _custom.GetMembers(bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1307,7 +1307,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
if (_custom != null)
|
||||
return _custom.GetMembers(bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1327,7 +1327,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
if (_custom != null)
|
||||
return _custom.GetFields(bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1365,7 +1365,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
if (_custom != null)
|
||||
return _custom.GetProperties(bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1403,7 +1403,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
if (_custom != null)
|
||||
return _custom.GetMethods(bindingAttr);
|
||||
return Utils.GetEmptyArray<ScriptMemberInfo>();
|
||||
return Array.Empty<ScriptMemberInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -141,10 +141,10 @@ int32 ScriptsBuilder::GetCompilationsCount()
|
||||
|
||||
String ScriptsBuilder::GetBuildToolPath()
|
||||
{
|
||||
#if USE_NETCORE && (PLATFORM_LINUX || PLATFORM_MAC)
|
||||
return Globals::StartupFolder / TEXT("Binaries/Tools/Flax.Build");
|
||||
#else
|
||||
#if PLATFORM_WINDOWS_FAMILY
|
||||
return Globals::StartupFolder / TEXT("Binaries/Tools/Flax.Build.exe");
|
||||
#else
|
||||
return Globals::StartupFolder / TEXT("Binaries/Tools/Flax.Build");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -244,18 +244,6 @@ bool ScriptsBuilder::RunBuildTool(const StringView& args, const StringView& work
|
||||
|
||||
// Prepare build options
|
||||
StringBuilder cmdLine(args.Length() + buildToolPath.Length() + 200);
|
||||
#if !USE_NETCORE && (PLATFORM_LINUX || PLATFORM_MAC)
|
||||
const String monoPath = Globals::MonoPath / TEXT("bin/mono");
|
||||
if (!FileSystem::FileExists(monoPath))
|
||||
{
|
||||
Log::FileNotFoundException(monoPath).SetLevel(LogType::Fatal);
|
||||
return true;
|
||||
}
|
||||
const String monoPath = TEXT("mono");
|
||||
cmdLine.Append(monoPath);
|
||||
cmdLine.Append(TEXT(" "));
|
||||
// TODO: Set env var for the mono MONO_GC_PARAMS=nursery-size64m to boost build performance -> profile it
|
||||
#endif
|
||||
cmdLine.Append(buildToolPath);
|
||||
|
||||
// Call build tool
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace FlaxEditor.Surface
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
"State",
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
},
|
||||
Size = new Float2(100, 0),
|
||||
},
|
||||
@@ -54,7 +54,7 @@ namespace FlaxEditor.Surface
|
||||
Size = new Float2(100, 0),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
byte[] value;
|
||||
if (Transitions.Count == 0)
|
||||
{
|
||||
value = Utils.GetEmptyArray<byte>();
|
||||
value = Array.Empty<byte>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1807,7 +1807,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
get => _ruleGraph;
|
||||
set
|
||||
{
|
||||
_ruleGraph = value ?? Utils.GetEmptyArray<byte>();
|
||||
_ruleGraph = value ?? Array.Empty<byte>();
|
||||
SourceState.SaveTransitions();
|
||||
}
|
||||
}
|
||||
@@ -1849,7 +1849,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DestinationState = destination;
|
||||
_data = data;
|
||||
_data.Destination = destination.ID;
|
||||
_ruleGraph = ruleGraph ?? Utils.GetEmptyArray<byte>();
|
||||
_ruleGraph = ruleGraph ?? Array.Empty<byte>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -784,7 +784,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
"Locomotion",
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
3,
|
||||
true,
|
||||
true,
|
||||
@@ -818,8 +818,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
"State",
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
@@ -1089,7 +1089,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Size = new Float2(100, 0),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
var decorator = Context.SpawnNode(19, 3, Location, new object[]
|
||||
{
|
||||
nodeType.TypeName,
|
||||
Utils.GetEmptyArray<byte>(),
|
||||
Array.Empty<byte>(),
|
||||
});
|
||||
|
||||
// Add decorator to the node
|
||||
@@ -646,7 +646,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
return new[] { uint.Parse(id[0]) };
|
||||
}
|
||||
}
|
||||
return Utils.GetEmptyArray<uint>();
|
||||
return Array.Empty<uint>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
string.Empty, // Type Name
|
||||
Utils.GetEmptyArray<byte>(), // Instance Data
|
||||
Array.Empty<byte>(), // Instance Data
|
||||
null, // List of Decorator Nodes IDs
|
||||
},
|
||||
Size = new Float2(100, 0),
|
||||
@@ -967,7 +967,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
typeof(BehaviorTreeRootNode).FullName, // Root node
|
||||
Utils.GetEmptyArray<byte>(), // Instance Data
|
||||
Array.Empty<byte>(), // Instance Data
|
||||
},
|
||||
Size = new Float2(100, 0),
|
||||
Elements = new[]
|
||||
@@ -984,7 +984,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
string.Empty, // Type Name
|
||||
Utils.GetEmptyArray<byte>(), // Instance Data
|
||||
Array.Empty<byte>(), // Instance Data
|
||||
},
|
||||
Size = new Float2(100, 0),
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.Scripting;
|
||||
@@ -84,7 +85,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
const int firstBox = 2;
|
||||
const int maxBoxes = 40;
|
||||
bool isInvalid = false;
|
||||
var data = Utils.GetEmptyArray<byte>();
|
||||
var data = Array.Empty<byte>();
|
||||
|
||||
if (valueBox.HasAnyConnection)
|
||||
{
|
||||
@@ -216,7 +217,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Description = "Returns one of the input values based on the enum value",
|
||||
Flags = NodeFlags.VisualScriptGraph | NodeFlags.AnimGraph,
|
||||
Size = new Float2(160, 60),
|
||||
DefaultValues = new object[] { Utils.GetEmptyArray<byte>() },
|
||||
DefaultValues = new object[] { Array.Empty<byte>() },
|
||||
ConnectionsHints = ConnectionsHint.Enum,
|
||||
Elements = new[]
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.Scripting;
|
||||
@@ -140,7 +141,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
const int firstBox = 2;
|
||||
const int maxBoxes = 40;
|
||||
bool isInvalid = false;
|
||||
var data = Utils.GetEmptyArray<byte>();
|
||||
var data = Array.Empty<byte>();
|
||||
|
||||
if (valueBox.HasAnyConnection)
|
||||
{
|
||||
@@ -285,7 +286,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Description = "Performs the flow logic branch based on the enum value",
|
||||
Flags = NodeFlags.VisualScriptGraph,
|
||||
Size = new Float2(160, 60),
|
||||
DefaultValues = new object[] { Utils.GetEmptyArray<byte>() },
|
||||
DefaultValues = new object[] { Array.Empty<byte>() },
|
||||
ConnectionsHints = ConnectionsHint.Enum,
|
||||
Elements = new[]
|
||||
{
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
if (_parameters.Length == 0 && methodInfo.ValueType.IsVoid)
|
||||
{
|
||||
// Skip allocations if method is void and parameter-less
|
||||
Values[2] = Utils.GetEmptyArray<byte>();
|
||||
Values[2] = Array.Empty<byte>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -714,7 +714,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
method.Name, // Method name
|
||||
parametersCount, // Method parameters count
|
||||
false, // Is Pure?
|
||||
Utils.GetEmptyArray<byte>(), // Cached function signature data
|
||||
Array.Empty<byte>(), // Cached function signature data
|
||||
// Default value for parameters (27 entries)
|
||||
// @formatter:off
|
||||
null,null,null,null,null,null,null,null,null,null,
|
||||
@@ -810,7 +810,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
signature.IsStatic = reader.ReadBoolean(); // Is Static
|
||||
signature.ReturnType = VariantUtils.ReadVariantScriptType(reader); // Return type
|
||||
var parametersCount = reader.ReadInt32(); // Parameters count
|
||||
signature.Params = parametersCount != 0 ? new SignatureParamInfo[parametersCount] : Utils.GetEmptyArray<SignatureParamInfo>();
|
||||
signature.Params = parametersCount != 0 ? new SignatureParamInfo[parametersCount] : Array.Empty<SignatureParamInfo>();
|
||||
for (int i = 0; i < parametersCount; i++)
|
||||
{
|
||||
ref var param = ref signature.Params[i];
|
||||
@@ -831,7 +831,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
signature.IsStatic = reader.ReadBoolean(); // Is Static
|
||||
signature.ReturnType = VariantUtils.ReadVariantScriptType(reader); // Return type
|
||||
var parametersCount = reader.ReadInt32(); // Parameters count
|
||||
signature.Params = parametersCount != 0 ? new SignatureParamInfo[parametersCount] : Utils.GetEmptyArray<SignatureParamInfo>();
|
||||
signature.Params = parametersCount != 0 ? new SignatureParamInfo[parametersCount] : Array.Empty<SignatureParamInfo>();
|
||||
for (int i = 0; i < parametersCount; i++)
|
||||
{
|
||||
ref var param = ref signature.Params[i];
|
||||
@@ -2489,7 +2489,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
{
|
||||
string.Empty, // Overriden method name
|
||||
0, // Overriden method parameters count
|
||||
Utils.GetEmptyArray<byte>(), // Cached function signature data
|
||||
Array.Empty<byte>(), // Cached function signature data
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
@@ -2507,7 +2507,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
string.Empty, // Method name
|
||||
0, // Method parameters count
|
||||
false, // Is Pure?
|
||||
Utils.GetEmptyArray<byte>(), // Cached function signature data
|
||||
Array.Empty<byte>(), // Cached function signature data
|
||||
|
||||
// Default value for parameters (27 entries)
|
||||
// @formatter:off
|
||||
@@ -2546,7 +2546,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Size = new Float2(240, 20),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Utils.GetEmptyArray<byte>(), // Function signature data
|
||||
Array.Empty<byte>(), // Function signature data
|
||||
},
|
||||
},
|
||||
new NodeArchetype
|
||||
|
||||
@@ -807,8 +807,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Input(0, "A", true, null, 0),
|
||||
NodeElementArchetype.Factory.Input(1, "B", true, null, 1),
|
||||
NodeElementArchetype.Factory.Input(0, "UV", true, null, 0),
|
||||
NodeElementArchetype.Factory.Input(1, "Center", true, null, 1),
|
||||
NodeElementArchetype.Factory.Input(2, "Radius", true, typeof(float), 2, 0),
|
||||
NodeElementArchetype.Factory.Input(3, "Hardness", true, typeof(float), 3, 1),
|
||||
NodeElementArchetype.Factory.Input(4, "Invert", true, typeof(bool), 4, 2),
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
if (fieldsLength == 0)
|
||||
{
|
||||
// Skip allocations if structure is empty
|
||||
Values[1] = Utils.GetEmptyArray<byte>();
|
||||
Values[1] = Array.Empty<byte>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -471,7 +471,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
string.Empty, // Typename
|
||||
Utils.GetEmptyArray<byte>(), // Cached structure layout data
|
||||
Array.Empty<byte>(), // Cached structure layout data
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
@@ -591,7 +591,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
string.Empty, // Typename
|
||||
Utils.GetEmptyArray<byte>(), // Cached structure layout data
|
||||
Array.Empty<byte>(), // Cached structure layout data
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace FlaxEditor.Surface
|
||||
|
||||
private object Creator(Type type)
|
||||
{
|
||||
var ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, null, Utils.GetEmptyArray<Type>(), null);
|
||||
return ctor.Invoke(Utils.GetEmptyArray<object>());
|
||||
var ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, null, Array.Empty<Type>(), null);
|
||||
return ctor.Invoke(Array.Empty<object>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1484,7 +1484,7 @@ namespace FlaxEditor.Surface.Elements
|
||||
protected override void OnAttributesChanged()
|
||||
{
|
||||
OnCurrentTypeChanged();
|
||||
_editor?.UpdateAttributes(this, _attributes ?? Utils.GetEmptyArray<object>(), _defaultValueEditor);
|
||||
_editor?.UpdateAttributes(this, _attributes ?? Array.Empty<object>(), _defaultValueEditor);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace FlaxEditor.Surface
|
||||
}
|
||||
}
|
||||
}
|
||||
return Utils.GetEmptyArray<Attribute>();
|
||||
return Array.Empty<Attribute>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -106,7 +106,7 @@ namespace FlaxEditor.Surface
|
||||
var json = FlaxEngine.Json.JsonSerializer.Serialize(attributes);
|
||||
return Encoding.Unicode.GetBytes(json);
|
||||
}
|
||||
return Utils.GetEmptyArray<byte>();
|
||||
return Array.Empty<byte>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace FlaxEditor.Surface
|
||||
surfaceParameters.Remove(surfaceParameter);
|
||||
surfaceParameters.Add(surfaceParameter);
|
||||
}
|
||||
var attributes = surfaceParameter?.Meta.GetAttributes() ?? FlaxEngine.Utils.GetEmptyArray<Attribute>();
|
||||
var attributes = surfaceParameter?.Meta.GetAttributes() ?? Array.Empty<Attribute>();
|
||||
data[i] = new GraphParameterData(null, index++, parameter.Name, parameter.IsPublic, ToType(parameter.ParameterType), attributes, parameter);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace FlaxEditor.Tools.Foliage
|
||||
private int _selectedInstanceIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// The foliage painting gizmo.
|
||||
/// The foliage editing gizmo.
|
||||
/// </summary>
|
||||
public EditFoliageGizmo Gizmo;
|
||||
|
||||
@@ -66,8 +66,6 @@ namespace FlaxEditor.Tools.Foliage
|
||||
base.Init(owner);
|
||||
|
||||
Gizmo = new EditFoliageGizmo(owner, this);
|
||||
SelectionOutline = FlaxEngine.Object.New<EditFoliageSelectionOutline>();
|
||||
SelectionOutline.GizmoMode = this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -84,6 +82,11 @@ namespace FlaxEditor.Tools.Foliage
|
||||
base.OnActivated();
|
||||
|
||||
Owner.Gizmos.Active = Gizmo;
|
||||
if (SelectionOutline == null)
|
||||
{
|
||||
SelectionOutline = FlaxEngine.Object.New<EditFoliageSelectionOutline>();
|
||||
SelectionOutline.GizmoMode = this;
|
||||
}
|
||||
((MainEditorGizmoViewport)Owner).OverrideSelectionOutline(SelectionOutline);
|
||||
SelectedInstanceIndex = -1;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using FlaxEngine;
|
||||
namespace FlaxEditor.Tools.Foliage
|
||||
{
|
||||
/// <summary>
|
||||
/// The custom outline for drawing the selected foliage instances outlines.
|
||||
/// The custom outline for drawing the selected foliage instance.
|
||||
/// </summary>
|
||||
/// <seealso cref="FlaxEditor.Gizmo.SelectionOutline" />
|
||||
[HideInEditor]
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Collections.Generic;
|
||||
using FlaxEditor.GUI.Tabs;
|
||||
using FlaxEditor.Modules;
|
||||
using FlaxEditor.SceneGraph.Actors;
|
||||
using FlaxEditor.Viewport.Modes;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -214,7 +213,7 @@ namespace FlaxEditor.Tools.Foliage
|
||||
|
||||
private void InitSculptMode()
|
||||
{
|
||||
var tab = _modes.AddTab(FoliageTypes = new FoliageTypesTab(this));
|
||||
var tab = _modes.AddTab(FoliageTypes = new FoliageTypesTab(this, Editor.Windows.EditWin.Viewport.EditFoliageTypesGizmo));
|
||||
tab.Selected += OnTabSelected;
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@ namespace FlaxEditor.Tools.Foliage
|
||||
switch (_modes.SelectedTabIndex)
|
||||
{
|
||||
case 0:
|
||||
Editor.Windows.EditWin.Viewport.Gizmos.SetActiveMode<NoGizmoMode>();
|
||||
Editor.Windows.EditWin.Viewport.Gizmos.SetActiveMode<FoliageTypesGizmoMode>();
|
||||
break;
|
||||
case 1:
|
||||
Editor.Windows.EditWin.Viewport.Gizmos.SetActiveMode<PaintFoliageGizmoMode>();
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEditor.Gizmo;
|
||||
|
||||
namespace FlaxEditor.Tools.Foliage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gizmo for editing foliage types.
|
||||
/// </summary>
|
||||
public sealed class FoliageTypesGizmo : GizmoBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The parent mode.
|
||||
/// </summary>
|
||||
public readonly FoliageTypesGizmoMode GizmoMode;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EditFoliageGizmo"/> class.
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner.</param>
|
||||
/// <param name="mode">The mode.</param>
|
||||
public FoliageTypesGizmo(IGizmoOwner owner, FoliageTypesGizmoMode mode)
|
||||
: base(owner)
|
||||
{
|
||||
GizmoMode = mode;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Pick()
|
||||
{
|
||||
// Get mouse ray and try to hit foliage instance
|
||||
var foliage = GizmoMode.SelectedFoliage;
|
||||
if (!foliage)
|
||||
return;
|
||||
var ray = Owner.MouseRay;
|
||||
if (foliage.Intersects(ref ray, out _, out _, out var instanceIndex))
|
||||
{
|
||||
// Select hit instance type
|
||||
var instance = foliage.GetInstance(instanceIndex);
|
||||
GizmoMode.SelectedTypeIndex = instance.Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEditor.Gizmo;
|
||||
using FlaxEditor.SceneGraph.Actors;
|
||||
using FlaxEditor.Viewport;
|
||||
using FlaxEditor.Viewport.Modes;
|
||||
|
||||
namespace FlaxEditor.Tools.Foliage
|
||||
{
|
||||
/// <summary>
|
||||
/// Foliage types editing mode.
|
||||
/// </summary>
|
||||
/// <seealso cref="FlaxEditor.Viewport.Modes.EditorGizmoMode" />
|
||||
public class FoliageTypesGizmoMode : EditorGizmoMode
|
||||
{
|
||||
/// <summary>
|
||||
/// The foliage types gizmo.
|
||||
/// </summary>
|
||||
public FoliageTypesGizmo Gizmo;
|
||||
|
||||
/// <summary>
|
||||
/// The foliage type editing selection outline.
|
||||
/// </summary>
|
||||
public FoliageTypesOutline SelectionOutline;
|
||||
|
||||
/// <summary>
|
||||
/// The selected foliage type index.
|
||||
/// </summary>
|
||||
public int SelectedTypeIndex
|
||||
{
|
||||
get => Editor.Instance.Windows.ToolboxWin.Foliage.SelectedFoliageTypeIndex;
|
||||
set => Editor.Instance.Windows.ToolboxWin.Foliage.SelectedFoliageTypeIndex = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the selected foliage actor (see <see cref="Modules.SceneEditingModule"/>).
|
||||
/// </summary>
|
||||
public FlaxEngine.Foliage SelectedFoliage
|
||||
{
|
||||
get
|
||||
{
|
||||
var sceneEditing = Editor.Instance.SceneEditing;
|
||||
var foliageNode = sceneEditing.SelectionCount == 1 ? sceneEditing.Selection[0] as FoliageNode : null;
|
||||
return (FlaxEngine.Foliage)foliageNode?.Actor;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Init(IGizmoOwner owner)
|
||||
{
|
||||
base.Init(owner);
|
||||
|
||||
Gizmo = new FoliageTypesGizmo(owner, this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
FlaxEngine.Object.Destroy(ref SelectionOutline);
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnActivated()
|
||||
{
|
||||
base.OnActivated();
|
||||
|
||||
Owner.Gizmos.Active = Gizmo;
|
||||
if (SelectionOutline == null)
|
||||
{
|
||||
SelectionOutline = FlaxEngine.Object.New<FoliageTypesOutline>();
|
||||
SelectionOutline.GizmoMode = this;
|
||||
}
|
||||
((MainEditorGizmoViewport)Owner).OverrideSelectionOutline(SelectionOutline);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDeactivated()
|
||||
{
|
||||
((MainEditorGizmoViewport)Owner).OverrideSelectionOutline(null);
|
||||
|
||||
base.OnDeactivated();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEditor.Gizmo;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.Tools.Foliage
|
||||
{
|
||||
/// <summary>
|
||||
/// The custom outline for drawing the selected foliage type.
|
||||
/// </summary>
|
||||
/// <seealso cref="FlaxEditor.Gizmo.SelectionOutline" />
|
||||
[HideInEditor]
|
||||
public class FoliageTypesOutline : SelectionOutline
|
||||
{
|
||||
/// <summary>
|
||||
/// The parent mode.
|
||||
/// </summary>
|
||||
public FoliageTypesGizmoMode GizmoMode;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanRender()
|
||||
{
|
||||
if (!HasDataReady)
|
||||
return false;
|
||||
|
||||
var foliage = GizmoMode.SelectedFoliage;
|
||||
if (!foliage)
|
||||
return false;
|
||||
var typeIndex = GizmoMode.SelectedTypeIndex;
|
||||
if (typeIndex < 0 || typeIndex >= foliage.FoliageTypesCount)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Render(GPUContext context, ref RenderContext renderContext, GPUTexture input, GPUTexture output)
|
||||
{
|
||||
base.Render(context, ref renderContext, input, output);
|
||||
|
||||
// Restore debug option
|
||||
var foliage = GizmoMode.SelectedFoliage;
|
||||
if (foliage)
|
||||
foliage._drawFoliageType = -1;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void DrawSelectionDepth(GPUContext context, SceneRenderTask task, GPUTexture customDepth)
|
||||
{
|
||||
var foliage = GizmoMode.SelectedFoliage;
|
||||
if (!foliage)
|
||||
return;
|
||||
var typeIndex = GizmoMode.SelectedTypeIndex;
|
||||
if (typeIndex < 0 || typeIndex >= foliage.FoliageTypesCount)
|
||||
return;
|
||||
|
||||
// Draw instances of the given type
|
||||
foliage._drawFoliageType = typeIndex;
|
||||
_actors.Add(foliage);
|
||||
Renderer.DrawSceneDepth(context, task, customDepth, _actors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,8 @@ namespace FlaxEditor.Tools.Foliage
|
||||
/// Initializes a new instance of the <see cref="FoliageTypesTab"/> class.
|
||||
/// </summary>
|
||||
/// <param name="tab">The parent tab.</param>
|
||||
public FoliageTypesTab(FoliageTab tab)
|
||||
/// <param name="mode">The gizmo mode.</param>
|
||||
public FoliageTypesTab(FoliageTab tab, FoliageTypesGizmoMode mode)
|
||||
: base("Foliage Types")
|
||||
{
|
||||
Tab = tab;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user