18 Commits

Author SHA1 Message Date
0f881fbc7a Enforce pointer alignment for InlinedAllocation
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
AssetReferences stored in inlined allocation needs to be aligned to
pointer sized boundary due to atomic operations having strict
requirements for such. Unaligned access seems to only crash on
Windows on ARM systems when trying to allocate TextRender draw chunks.
2025-10-19 22:13:40 +03:00
0898f3d020 Fix wrong build configuration used in ogg and vorbis for Windows
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
2025-10-19 17:24:10 +03:00
c63e79efa4 Add dependency build script for Visual Studio EnvDTE 2025-10-19 13:47:58 +03:00
d0eb85c04f Add dependency build script for WinPixEventRuntime
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
2025-10-18 04:20:58 +03:00
a7749abdcc Fix compiler error and wrong CPU architecture warnings on WoA 2025-10-18 04:20:58 +03:00
242d24d1a6 Fix building vorbis on Windows 2025-10-18 04:20:58 +03:00
853a7510f6 Check VS2026 toolset before trying to compile PhysX 2025-10-18 04:20:58 +03:00
88bd636cbe Fix building ogg+vorbis on macOS 2025-10-18 04:20:57 +03:00
65df32f5d7 Fix NvCloth compilation on Linux and macOS 2025-10-18 04:20:57 +03:00
4baa7fb7b8 Fix PhysX compilation on Linux and macOS 2025-10-18 04:20:57 +03:00
1644c9c5e0 Fix python tool call on macOS for glslang 2025-10-18 04:20:57 +03:00
e130ac7d80 Fix building PhysX on Linux and macOS 2025-10-18 04:20:56 +03:00
45e1d28ba2 Support building OpenAL from Git repository in other platforms 2025-10-18 04:20:56 +03:00
12f686262c Fix building curl on Linux 2025-10-18 02:33:54 +03:00
c76b9f206f Fix building Assimp on Linux
Versioned clang++ symlinks are not available on Arch
2025-10-18 02:33:44 +03:00
078485892f Add support for building dependencies with specific architecture 2025-10-18 02:33:22 +03:00
44b2db5d5d Fix CMake compatibility errors with dependencies 2025-10-18 02:19:57 +03:00
cc401f0316 Support Visual Studio 2026 as a generator for CMake dependencies 2025-10-18 02:19:57 +03:00
729 changed files with 7705 additions and 89430 deletions

View File

@@ -31,7 +31,7 @@ body:
- '1.10' - '1.10'
- '1.11' - '1.11'
- master branch - master branch
default: 3 default: 2
validations: validations:
required: true required: true
- type: textarea - type: textarea

View File

@@ -16,8 +16,7 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
- name: Setup Vulkan - name: Setup Vulkan
uses: ./.github/actions/vulkan uses: ./.github/actions/vulkan
- name: Setup .NET - name: Setup .NET

View File

@@ -87,8 +87,7 @@ jobs:
git ${{ env.GIT_LFS_PULL_OPTIONS }} lfs pull git ${{ env.GIT_LFS_PULL_OPTIONS }} lfs pull
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
- name: Setup Vulkan - name: Setup Vulkan
uses: ./.github/actions/vulkan uses: ./.github/actions/vulkan
- name: Setup .NET - name: Setup .NET
@@ -119,8 +118,7 @@ jobs:
git ${{ env.GIT_LFS_PULL_OPTIONS }} lfs pull git ${{ env.GIT_LFS_PULL_OPTIONS }} lfs pull
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
- name: Setup Vulkan - name: Setup Vulkan
uses: ./.github/actions/vulkan uses: ./.github/actions/vulkan
- name: Setup .NET - name: Setup .NET

View File

@@ -28,8 +28,7 @@ jobs:
git lfs pull git lfs pull
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
- name: Build - name: Build
run: | run: |
./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs -dotnet=8 ./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs -dotnet=8

BIN
Content/Editor/Camera/M_Camera.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Editor/DefaultFontMaterial.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Editor/Gizmo/Material.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/Gizmo/MaterialWire.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Editor/Highlight Material.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/Icons/IconsMaterial.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

View File

@@ -4,8 +4,8 @@
#define MAX_LOCAL_LIGHTS 4 #define MAX_LOCAL_LIGHTS 4
@1// Forward Shading: Includes @1// Forward Shading: Includes
#include "./Flax/LightingCommon.hlsl" #include "./Flax/LightingCommon.hlsl"
#include "./Flax/ReflectionsCommon.hlsl"
#if USE_REFLECTIONS #if USE_REFLECTIONS
#include "./Flax/ReflectionsCommon.hlsl"
#define MATERIAL_REFLECTIONS_SSR 1 #define MATERIAL_REFLECTIONS_SSR 1
#if MATERIAL_REFLECTIONS == MATERIAL_REFLECTIONS_SSR #if MATERIAL_REFLECTIONS == MATERIAL_REFLECTIONS_SSR
#include "./Flax/SSR.hlsl" #include "./Flax/SSR.hlsl"
@@ -14,13 +14,11 @@
#include "./Flax/Lighting.hlsl" #include "./Flax/Lighting.hlsl"
#include "./Flax/ShadowsSampling.hlsl" #include "./Flax/ShadowsSampling.hlsl"
#include "./Flax/ExponentialHeightFog.hlsl" #include "./Flax/ExponentialHeightFog.hlsl"
#include "./Flax/VolumetricFog.hlsl"
@2// Forward Shading: Constants @2// Forward Shading: Constants
LightData DirectionalLight; LightData DirectionalLight;
LightData SkyLight; LightData SkyLight;
EnvProbeData EnvironmentProbe; ProbeData EnvironmentProbe;
ExponentialHeightFogData ExponentialHeightFog; ExponentialHeightFogData ExponentialHeightFog;
VolumetricFogData VolumetricFog;
float3 Dummy2; float3 Dummy2;
uint LocalLightsCount; uint LocalLightsCount;
LightData LocalLights[MAX_LOCAL_LIGHTS]; LightData LocalLights[MAX_LOCAL_LIGHTS];
@@ -30,14 +28,12 @@ TextureCube SkyLightTexture : register(t__SRV__);
Buffer<float4> ShadowsBuffer : register(t__SRV__); Buffer<float4> ShadowsBuffer : register(t__SRV__);
Texture2D<float> ShadowMap : register(t__SRV__); Texture2D<float> ShadowMap : register(t__SRV__);
Texture3D VolumetricFogTexture : register(t__SRV__); Texture3D VolumetricFogTexture : register(t__SRV__);
Texture2D PreIntegratedGF : register(t__SRV__);
@4// Forward Shading: Utilities @4// Forward Shading: Utilities
// Public accessors for lighting data, use them as data binding might change but those methods will remain. // Public accessors for lighting data, use them as data binding might change but those methods will remain.
LightData GetDirectionalLight() { return DirectionalLight; } LightData GetDirectionalLight() { return DirectionalLight; }
LightData GetSkyLight() { return SkyLight; } LightData GetSkyLight() { return SkyLight; }
EnvProbeData GetEnvironmentProbe() { return EnvironmentProbe; } ProbeData GetEnvironmentProbe() { return EnvironmentProbe; }
ExponentialHeightFogData GetExponentialHeightFog() { return ExponentialHeightFog; } ExponentialHeightFogData GetExponentialHeightFog() { return ExponentialHeightFog; }
VolumetricFogData GetVolumetricFog() { return VolumetricFog; }
uint GetLocalLightsCount() { return LocalLightsCount; } uint GetLocalLightsCount() { return LocalLightsCount; }
LightData GetLocalLight(uint i) { return LocalLights[i]; } LightData GetLocalLight(uint i) { return LocalLights[i]; }
@5// Forward Shading: Shaders @5// Forward Shading: Shaders
@@ -112,8 +108,7 @@ void PS_Forward(
// Calculate reflections // Calculate reflections
#if USE_REFLECTIONS #if USE_REFLECTIONS
float4 reflections = SampleReflectionProbe(ViewPos, EnvProbe, EnvironmentProbe, gBuffer.WorldPos, gBuffer.Normal, gBuffer.Roughness); float3 reflections = SampleReflectionProbe(ViewPos, EnvProbe, EnvironmentProbe, gBuffer.WorldPos, gBuffer.Normal, gBuffer.Roughness).rgb;
reflections.rgb *= reflections.a;
#if MATERIAL_REFLECTIONS == MATERIAL_REFLECTIONS_SSR #if MATERIAL_REFLECTIONS == MATERIAL_REFLECTIONS_SSR
// Screen Space Reflections // Screen Space Reflections
@@ -121,7 +116,7 @@ void PS_Forward(
Texture2D sceneColorTexture = MATERIAL_REFLECTIONS_SSR_COLOR; Texture2D sceneColorTexture = MATERIAL_REFLECTIONS_SSR_COLOR;
float2 screenUV = materialInput.SvPosition.xy * ScreenSize.zw; float2 screenUV = materialInput.SvPosition.xy * ScreenSize.zw;
float stepSize = ScreenSize.z; // 1 / screenWidth float stepSize = ScreenSize.z; // 1 / screenWidth
float maxSamples = 50; float maxSamples = 48;
float worldAntiSelfOcclusionBias = 0.1f; float worldAntiSelfOcclusionBias = 0.1f;
float brdfBias = 0.82f; float brdfBias = 0.82f;
float drawDistance = 5000.0f; float drawDistance = 5000.0f;
@@ -129,7 +124,7 @@ void PS_Forward(
if (hit.z > 0) if (hit.z > 0)
{ {
float3 screenColor = sceneColorTexture.SampleLevel(SamplerPointClamp, hit.xy, 0).rgb; float3 screenColor = sceneColorTexture.SampleLevel(SamplerPointClamp, hit.xy, 0).rgb;
reflections.rgb = lerp(reflections.rgb, screenColor, hit.z); reflections = lerp(reflections, screenColor, hit.z);
} }
// Fallback to software tracing if possible // Fallback to software tracing if possible
@@ -141,17 +136,17 @@ void PS_Forward(
if (TraceSDFSoftwareReflections(gBuffer, reflectWS, surfaceAtlas)) if (TraceSDFSoftwareReflections(gBuffer, reflectWS, surfaceAtlas))
{ {
float3 screenColor = sceneColorTexture.SampleLevel(SamplerPointClamp, hit.xy, 0).rgb; float3 screenColor = sceneColorTexture.SampleLevel(SamplerPointClamp, hit.xy, 0).rgb;
reflections.rgb = lerp(surfaceAtlas, float4(screenColor, 1), hit.z); reflections = lerp(surfaceAtlas, float4(screenColor, 1), hit.z);
} }
} }
#endif #endif
#endif #endif
light.rgb += reflections.rgb * GetReflectionSpecularLighting(PreIntegratedGF, ViewPos, gBuffer); light.rgb += reflections * GetReflectionSpecularLighting(ViewPos, gBuffer) * light.a;
#endif #endif
// Add lighting // Add lighting (apply ambient occlusion)
output.rgb += light.rgb; output.rgb += light.rgb * gBuffer.AO;
#endif #endif
@@ -163,13 +158,17 @@ void PS_Forward(
#else #else
float fogSceneDistance = gBuffer.ViewPos.z; float fogSceneDistance = gBuffer.ViewPos.z;
#endif #endif
float fogSkipDistance = max(ExponentialHeightFog.VolumetricFogMaxDistance - 100, 0); float4 fog = GetExponentialHeightFog(ExponentialHeightFog, materialInput.WorldPosition, ViewPos, 0, fogSceneDistance);
float4 fog = GetExponentialHeightFog(ExponentialHeightFog, materialInput.WorldPosition, ViewPos, fogSkipDistance, fogSceneDistance);
if (ExponentialHeightFog.VolumetricFogMaxDistance > 0) if (ExponentialHeightFog.VolumetricFogMaxDistance > 0)
{ {
// Sample volumetric fog and mix it in // Sample volumetric fog and mix it in
float2 screenUV = materialInput.SvPosition.xy * ScreenSize.zw; float2 screenUV = materialInput.SvPosition.xy * ScreenSize.zw;
float4 volumetricFog = SampleVolumetricFog(VolumetricFogTexture, VolumetricFog, materialInput.WorldPosition - ViewPos, screenUV, TemporalAAJitter); float3 viewVector = materialInput.WorldPosition - ViewPos;
float sceneDepth = length(viewVector);
float depthSlice = sceneDepth / ExponentialHeightFog.VolumetricFogMaxDistance;
float3 volumeUV = float3(screenUV, depthSlice);
float4 volumetricFog = VolumetricFogTexture.SampleLevel(SamplerLinearClamp, volumeUV, 0);
fog = CombineVolumetricFog(fog, volumetricFog); fog = CombineVolumetricFog(fog, volumetricFog);
} }

View File

@@ -38,7 +38,6 @@ struct VertexOutput
#endif #endif
float4 ClipExtents : TEXCOORD3; float4 ClipExtents : TEXCOORD3;
float2 ClipOrigin : TEXCOORD4; float2 ClipOrigin : TEXCOORD4;
float2 CustomData : TEXCOORD5; // x-per-geometry type, y-features mask
#if USE_CUSTOM_VERTEX_INTERPOLATORS #if USE_CUSTOM_VERTEX_INTERPOLATORS
float4 CustomVSToPS[CUSTOM_VERTEX_INTERPOLATORS_COUNT] : TEXCOORD9; float4 CustomVSToPS[CUSTOM_VERTEX_INTERPOLATORS_COUNT] : TEXCOORD9;
#endif #endif
@@ -56,7 +55,6 @@ struct PixelInput
#endif #endif
float4 ClipExtents : TEXCOORD3; float4 ClipExtents : TEXCOORD3;
float2 ClipOrigin : TEXCOORD4; float2 ClipOrigin : TEXCOORD4;
float2 CustomData : TEXCOORD5; // x-per-geometry type, y-features mask
#if USE_CUSTOM_VERTEX_INTERPOLATORS #if USE_CUSTOM_VERTEX_INTERPOLATORS
float4 CustomVSToPS[CUSTOM_VERTEX_INTERPOLATORS_COUNT] : TEXCOORD9; float4 CustomVSToPS[CUSTOM_VERTEX_INTERPOLATORS_COUNT] : TEXCOORD9;
#endif #endif
@@ -69,7 +67,6 @@ struct MaterialInput
float3 WorldPosition; float3 WorldPosition;
float TwoSidedSign; float TwoSidedSign;
float2 TexCoord; float2 TexCoord;
float2 CustomData; // x-per-geometry type, y-features mask
#if USE_VERTEX_COLOR #if USE_VERTEX_COLOR
half4 VertexColor; half4 VertexColor;
#endif #endif
@@ -87,7 +84,6 @@ MaterialInput GetMaterialInput(Render2DVertex input, VertexOutput output)
MaterialInput result; MaterialInput result;
result.WorldPosition = output.WorldPosition; result.WorldPosition = output.WorldPosition;
result.TexCoord = output.TexCoord; result.TexCoord = output.TexCoord;
result.CustomData = input.CustomDataAndClipOrigin.xy;
#if USE_VERTEX_COLOR #if USE_VERTEX_COLOR
result.VertexColor = output.VertexColor; result.VertexColor = output.VertexColor;
#endif #endif
@@ -107,7 +103,6 @@ MaterialInput GetMaterialInput(PixelInput input)
MaterialInput result; MaterialInput result;
result.WorldPosition = input.WorldPosition; result.WorldPosition = input.WorldPosition;
result.TexCoord = input.TexCoord; result.TexCoord = input.TexCoord;
result.CustomData = input.CustomData;
#if USE_VERTEX_COLOR #if USE_VERTEX_COLOR
result.VertexColor = input.VertexColor; result.VertexColor = input.VertexColor;
#endif #endif
@@ -234,7 +229,6 @@ VertexOutput VS_GUI(Render2DVertex input)
#if USE_VERTEX_COLOR #if USE_VERTEX_COLOR
output.VertexColor = input.Color; output.VertexColor = input.Color;
#endif #endif
output.CustomData = input.CustomDataAndClipOrigin.xy;
output.ClipOrigin = input.CustomDataAndClipOrigin.zw; output.ClipOrigin = input.CustomDataAndClipOrigin.zw;
output.ClipExtents = input.ClipExtents; output.ClipExtents = input.ClipExtents;

View File

@@ -8,7 +8,6 @@
#include "./Flax/Common.hlsl" #include "./Flax/Common.hlsl"
#include "./Flax/MaterialCommon.hlsl" #include "./Flax/MaterialCommon.hlsl"
#include "./Flax/GBufferCommon.hlsl" #include "./Flax/GBufferCommon.hlsl"
#include "./Flax/VolumetricFog.hlsl"
@7 @7
// Primary constant buffer (with additional material parameters) // Primary constant buffer (with additional material parameters)
@@ -22,7 +21,6 @@ float Dummy0;
float VolumetricFogMaxDistance; float VolumetricFogMaxDistance;
int ParticleStride; int ParticleStride;
int ParticleIndex; int ParticleIndex;
float4 GridSliceParameters;
@1META_CB_END @1META_CB_END
// Particles attributes buffer // Particles attributes buffer
@@ -204,19 +202,19 @@ Material GetMaterialPS(MaterialInput input)
META_PS(true, FEATURE_LEVEL_SM5) META_PS(true, FEATURE_LEVEL_SM5)
void PS_VolumetricFog(Quad_GS2PS input, out float4 VBufferA : SV_Target0, out float4 VBufferB : SV_Target1) void PS_VolumetricFog(Quad_GS2PS input, out float4 VBufferA : SV_Target0, out float4 VBufferB : SV_Target1)
{ {
// Reproject grid position back to the screen and world space
uint3 gridCoordinate = uint3(input.Vertex.Position.xy, input.LayerIndex); uint3 gridCoordinate = uint3(input.Vertex.Position.xy, input.LayerIndex);
float3 cellOffset = 0.5f; float3 cellOffset = 0.5f;
float2 volumeUV = (gridCoordinate.xy + cellOffset.xy) / GridSize.xy; float2 volumeUV = (gridCoordinate.xy + cellOffset.xy) / GridSize.xy;
float sceneDepth = GetDepthFromSlice(GridSliceParameters, gridCoordinate.z + cellOffset.z) / ViewFar; float zSlice = gridCoordinate.z + cellOffset.z;
float sceneDepth = (zSlice / GridSize.z) * VolumetricFogMaxDistance / ViewFar;
float deviceDepth = (ViewInfo.w / sceneDepth) + ViewInfo.z; float deviceDepth = (ViewInfo.w / sceneDepth) + ViewInfo.z;
float4 clipPos = float4(volumeUV * float2(2.0, -2.0) + float2(-1.0, 1.0), deviceDepth, 1.0); float4 clipPos = float4(volumeUV * float2(2.0, -2.0) + float2(-1.0, 1.0), deviceDepth, 1.0);
float4 wsPos = mul(clipPos, InverseViewProjectionMatrix); float4 wsPos = mul(clipPos, InverseViewProjectionMatrix);
wsPos.xyz /= wsPos.w; float3 positionWS = wsPos.xyz / wsPos.w;
// Get material parameters // Get material parameters
MaterialInput materialInput = (MaterialInput)0; MaterialInput materialInput = (MaterialInput)0;
materialInput.WorldPosition = wsPos.xyz; materialInput.WorldPosition = positionWS;
materialInput.TexCoord = input.Vertex.TexCoord; materialInput.TexCoord = input.Vertex.TexCoord;
materialInput.ParticleIndex = ParticleIndex; materialInput.ParticleIndex = ParticleIndex;
materialInput.TBN = float3x3(float3(1, 0, 0), float3(0, 1, 0), float3(0, 0, 1)); materialInput.TBN = float3x3(float3(1, 0, 0), float3(0, 1, 0), float3(0, 0, 1));
@@ -227,10 +225,9 @@ void PS_VolumetricFog(Quad_GS2PS input, out float4 VBufferA : SV_Target0, out fl
Material material = GetMaterialPS(materialInput); Material material = GetMaterialPS(materialInput);
// Compute fog properties // Compute fog properties
material.Opacity *= material.Mask;
float3 albedo = material.Color; float3 albedo = material.Color;
float extinction = material.Opacity * 0.001f; float extinction = material.Opacity * material.Mask * 0.001f;
float3 emission = material.Emissive * material.Opacity; float3 emission = material.Emissive;
float3 scattering = albedo * extinction; float3 scattering = albedo * extinction;
float absorption = max(0.0f, extinction - Luminance(scattering)); float absorption = max(0.0f, extinction - Luminance(scattering));

Binary file not shown.

Binary file not shown.

BIN
Content/Editor/Primitives/Cube.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/SpriteMaterial.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Editor/TexturePreviewMaterial.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/Wires Debug Material.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Engine/DefaultMaterial.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Engine/DefaultRadialMenu.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Engine/DefaultTerrainMaterial.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Engine/SingleColorMaterial.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Engine/SkyboxMaterial.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/ColorGrading.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/Fog.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/GI/DDGI.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/GI/GlobalSurfaceAtlas.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/GUI.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Shaders/Histogram.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/Lights.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/MotionBlur.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/MultiScaler.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/PostProcessing.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/Reflections.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/SDF.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/SSAO.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/SSR.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/Sky.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/TAA.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/VolumetricFog.flax (Stored with Git LFS)

Binary file not shown.

View File

@@ -2,12 +2,12 @@
"Name": "Flax", "Name": "Flax",
"Version": { "Version": {
"Major": 1, "Major": 1,
"Minor": 12, "Minor": 11,
"Revision": 0, "Revision": 0,
"Build": 6905 "Build": 6801
}, },
"Company": "Flax", "Company": "Flax",
"Copyright": "Copyright (c) 2012-2026 Wojciech Figat. All rights reserved.", "Copyright": "Copyright (c) 2012-2025 Wojciech Figat. All rights reserved.",
"GameTarget": "FlaxGame", "GameTarget": "FlaxGame",
"EditorTarget": "FlaxEditor", "EditorTarget": "FlaxEditor",
"Configuration": { "Configuration": {

View File

@@ -188,7 +188,7 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean> <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String> <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean> <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_CASE_STATEMENT_ON_SAME_LINE/@EntryValue">ALWAYS</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">NEVER</s:String> <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_CASE_STATEMENT_STYLE/@EntryValue">ON_SINGLE_LINE</s:String> <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_CASE_STATEMENT_STYLE/@EntryValue">ON_SINGLE_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean> <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>

View File

@@ -12,6 +12,6 @@ cd "`dirname "$0"`"
bash ./Development/Scripts/Mac/CallBuildTool.sh --genproject "$@" bash ./Development/Scripts/Mac/CallBuildTool.sh --genproject "$@"
# Build bindings for all editor configurations # Build bindings for all editor configurations
#echo Building C# bindings... echo Building C# bindings...
# TODO: Detect the correct architecture here # TODO: Detect the correct architecture here
#Binaries/Tools/Flax.Build -build -BuildBindingsOnly -arch=ARM64 -platform=Mac --buildTargets=FlaxEditor Binaries/Tools/Flax.Build -build -BuildBindingsOnly -arch=ARM64 -platform=Mac --buildTargets=FlaxEditor

View File

@@ -49,7 +49,7 @@ Follow the instructions below to compile and run the engine from source.
* Fedora: `sudo dnf 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` * Arch: `sudo pacman -S dotnet-sdk-8.0 dotnet-runtime-8.0 dotnet-targeting-pack-8.0 dotnet-host`
* Install Vulkan SDK ([https://vulkan.lunarg.com/](https://vulkan.lunarg.com/)) * Install Vulkan SDK ([https://vulkan.lunarg.com/](https://vulkan.lunarg.com/))
* Ubuntu: `sudo apt install vulkan-sdk` (deprecated, follow official docs) * Ubuntu: `sudo apt install vulkan-sdk`
* Fedora: `sudo dnf install vulkan-headers vulkan-tools vulkan-validation-layers` * Fedora: `sudo dnf install vulkan-headers vulkan-tools vulkan-validation-layers`
* Arch: `sudo pacman -S vulkan-headers vulkan-tools vulkan-validation-layers` * Arch: `sudo pacman -S vulkan-headers vulkan-tools vulkan-validation-layers`
* Install Git with LFS * Install Git with LFS
@@ -60,7 +60,7 @@ Follow the instructions below to compile and run the engine from source.
* Ubuntu: `sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev zlib1g-dev` * Ubuntu: `sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev zlib1g-dev`
* Fedora: `sudo dnf install libX11-devel libXcursor-devel libXinerama-devel ghc-zlib-devel` * Fedora: `sudo dnf install libX11-devel libXcursor-devel libXinerama-devel ghc-zlib-devel`
* Arch: `sudo pacman -S base-devel libx11 libxcursor libxinerama zlib` * Arch: `sudo pacman -S base-devel libx11 libxcursor libxinerama zlib`
* Install Clang compiler (version 14 or later): * Install Clang compiler (version 6 or later):
* Ubuntu: `sudo apt-get install clang lldb lld` * Ubuntu: `sudo apt-get install clang lldb lld`
* Fedora: `sudo dnf install clang llvm lldb lld` * Fedora: `sudo dnf install clang llvm lldb lld`
* Arch: `sudo pacman -S clang lldb lld` * Arch: `sudo pacman -S clang lldb lld`

View File

@@ -187,11 +187,6 @@ namespace FlaxEditor.Content.Import
// Glossiness, metalness, ambient occlusion, displacement, height, cavity or specular // Glossiness, metalness, ambient occlusion, displacement, height, cavity or specular
_settings.Settings.Type = TextureFormatType.GrayScale; _settings.Settings.Type = TextureFormatType.GrayScale;
} }
else if (_settings.Settings.Type == TextureFormatType.ColorRGB)
{
// Blind guess that common color texture is sRGB
_settings.Settings.sRGB = true;
}
// Try to restore target asset texture import options (useful for fast reimport) // Try to restore target asset texture import options (useful for fast reimport)
Editor.TryRestoreImportOptions(ref _settings.Settings, ResultUrl); Editor.TryRestoreImportOptions(ref _settings.Settings, ResultUrl);

View File

@@ -281,13 +281,6 @@ namespace FlaxEditor.Content
private void CacheData() private void CacheData()
{ {
if (!_asset)
{
_parameters = Utils.GetEmptyArray<ScriptMemberInfo>();
_methods = Utils.GetEmptyArray<ScriptMemberInfo>();
_attributes = Utils.GetEmptyArray<Attribute>();
return;
}
if (_parameters != null) if (_parameters != null)
return; return;
if (_asset.WaitForLoaded()) if (_asset.WaitForLoaded())
@@ -351,13 +344,13 @@ namespace FlaxEditor.Content
} }
/// <inheritdoc /> /// <inheritdoc />
public string Name => _asset ? Path.GetFileNameWithoutExtension(_asset.Path) : null; public string Name => Path.GetFileNameWithoutExtension(_asset.Path);
/// <inheritdoc /> /// <inheritdoc />
public string Namespace => string.Empty; public string Namespace => string.Empty;
/// <inheritdoc /> /// <inheritdoc />
public string TypeName => _asset ? JsonSerializer.GetStringID(_asset.ID) : null; public string TypeName => JsonSerializer.GetStringID(_asset.ID);
/// <inheritdoc /> /// <inheritdoc />
public bool IsPublic => true; public bool IsPublic => true;

View File

@@ -130,11 +130,6 @@ namespace FlaxEditor.Content
eyeAdaptation.Mode = EyeAdaptationMode.None; eyeAdaptation.Mode = EyeAdaptationMode.None;
eyeAdaptation.OverrideFlags |= EyeAdaptationSettingsOverride.Mode; eyeAdaptation.OverrideFlags |= EyeAdaptationSettingsOverride.Mode;
preview.PostFxVolume.EyeAdaptation = eyeAdaptation; preview.PostFxVolume.EyeAdaptation = eyeAdaptation;
var antiAliasing = preview.PostFxVolume.AntiAliasing;
antiAliasing.Mode = AntialiasingMode.FastApproximateAntialiasing;
antiAliasing.OverrideFlags |= AntiAliasingSettingsOverride.Mode;
preview.PostFxVolume.AntiAliasing = antiAliasing;
} }
} }
} }

View File

@@ -15,32 +15,26 @@
#include "Editor/ProjectInfo.h" #include "Editor/ProjectInfo.h"
#include "Editor/Utilities/EditorUtilities.h" #include "Editor/Utilities/EditorUtilities.h"
String GetGDK() GDKPlatformTools::GDKPlatformTools()
{ {
String gdk; // Find GDK
Platform::GetEnvironmentVariable(TEXT("GameDKLatest"), gdk); Platform::GetEnvironmentVariable(TEXT("GameDKLatest"), _gdkPath);
if (gdk.IsEmpty() || !FileSystem::DirectoryExists(gdk)) if (_gdkPath.IsEmpty() || !FileSystem::DirectoryExists(_gdkPath))
{ {
gdk.Clear(); _gdkPath.Clear();
Platform::GetEnvironmentVariable(TEXT("GRDKLatest"), gdk); Platform::GetEnvironmentVariable(TEXT("GRDKLatest"), _gdkPath);
if (gdk.IsEmpty() || !FileSystem::DirectoryExists(gdk)) if (_gdkPath.IsEmpty() || !FileSystem::DirectoryExists(_gdkPath))
{ {
gdk.Clear(); _gdkPath.Clear();
} }
else else
{ {
if (gdk.EndsWith(TEXT("GRDK\\"))) if (_gdkPath.EndsWith(TEXT("GRDK\\")))
gdk.Remove(gdk.Length() - 6); _gdkPath.Remove(_gdkPath.Length() - 6);
else if (gdk.EndsWith(TEXT("GRDK"))) else if (_gdkPath.EndsWith(TEXT("GRDK")))
gdk.Remove(gdk.Length() - 5); _gdkPath.Remove(_gdkPath.Length() - 5);
} }
} }
return gdk;
}
GDKPlatformTools::GDKPlatformTools()
{
_gdkPath = GetGDK();
} }
DotNetAOTModes GDKPlatformTools::UseAOT() const DotNetAOTModes GDKPlatformTools::UseAOT() const
@@ -127,7 +121,7 @@ bool GDKPlatformTools::OnPostProcess(CookingData& data, GDKPlatformSettings* pla
validName.Add('\0'); validName.Add('\0');
sb.Append(TEXT("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")); sb.Append(TEXT("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
sb.Append(TEXT("<Game configVersion=\"1\">\n")); sb.Append(TEXT("<Game configVersion=\"0\">\n"));
sb.AppendFormat(TEXT(" <Identity Name=\"{0}\" Publisher=\"{1}\" Version=\"{2}\"/>\n"), sb.AppendFormat(TEXT(" <Identity Name=\"{0}\" Publisher=\"{1}\" Version=\"{2}\"/>\n"),
validName.Get(), validName.Get(),
platformSettings->PublisherName.HasChars() ? platformSettings->PublisherName : TEXT("CN=") + gameSettings->CompanyName, platformSettings->PublisherName.HasChars() ? platformSettings->PublisherName : TEXT("CN=") + gameSettings->CompanyName,

View File

@@ -10,10 +10,9 @@
#include "Engine/Serialization/JsonTools.h" #include "Engine/Serialization/JsonTools.h"
#include "Engine/Serialization/JsonWriters.h" #include "Engine/Serialization/JsonWriters.h"
#include "Editor/Cooker/PlatformTools.h" #include "Editor/Cooker/PlatformTools.h"
#include "Engine/Engine/Globals.h"
#include "Editor/Editor.h" #include "Editor/Editor.h"
#include "Editor/ProjectInfo.h" #include "Editor/ProjectInfo.h"
#include "Editor/Utilities/EditorUtilities.h" #include "Engine/Engine/Globals.h"
#if PLATFORM_MAC #if PLATFORM_MAC
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
@@ -128,7 +127,7 @@ bool CompileScriptsStep::DeployBinaries(CookingData& data, const String& path, c
const String dst = dstPath / StringUtils::GetFileName(file); const String dst = dstPath / StringUtils::GetFileName(file);
if (dst == file) if (dst == file)
continue; continue;
if (EditorUtilities::CopyFileIfNewer(dst, file)) if (FileSystem::CopyFile(dst, file))
{ {
data.Error(String::Format(TEXT("Failed to copy file from {0} to {1}."), file, dst)); data.Error(String::Format(TEXT("Failed to copy file from {0} to {1}."), file, dst));
return true; return true;

View File

@@ -526,7 +526,6 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
#if PLATFORM_TOOLS_XBOX_SCARLETT #if PLATFORM_TOOLS_XBOX_SCARLETT
case BuildPlatform::XboxScarlett: case BuildPlatform::XboxScarlett:
{ {
options.Platform = PlatformType::XboxScarlett;
const char* platformDefineName = "PLATFORM_XBOX_SCARLETT"; const char* platformDefineName = "PLATFORM_XBOX_SCARLETT";
COMPILE_PROFILE(DirectX_SM6, SHADER_FILE_CHUNK_INTERNAL_D3D_SM6_CACHE); COMPILE_PROFILE(DirectX_SM6, SHADER_FILE_CHUNK_INTERNAL_D3D_SM6_CACHE);
break; break;
@@ -1368,9 +1367,6 @@ bool CookAssetsStep::Perform(CookingData& data)
{ {
typeName = e.TypeName; typeName = e.TypeName;
} }
if (e.Count == 1)
LOG(Info, "{0}: 1 asset of total size {1}", typeName, Utilities::BytesToText(e.ContentSize));
else
LOG(Info, "{0}: {1:>4} assets of total size {2}", typeName, e.Count, Utilities::BytesToText(e.ContentSize)); LOG(Info, "{0}: {1:>4} assets of total size {2}", typeName, e.Count, Utilities::BytesToText(e.ContentSize));
} }
LOG(Info, ""); LOG(Info, "");

View File

@@ -265,7 +265,7 @@ bool DeployDataStep::Perform(CookingData& data)
} }
if (version.IsEmpty()) if (version.IsEmpty())
{ {
data.Error(String::Format(TEXT("Failed to find supported .NET {} version (min {}) for {} platform."), maxVer, minVer, platformName)); data.Error(String::Format(TEXT("Failed to find supported .NET {} version (min {}) for the current host platform."), maxVer, minVer));
return true; return true;
} }
} }

View File

@@ -59,7 +59,6 @@ bool PrecompileAssembliesStep::Perform(CookingData& data)
data.StepProgress(infoMsg, 0); data.StepProgress(infoMsg, 0);
// Override Newtonsoft.Json with AOT-version (one that doesn't use System.Reflection.Emit) // Override Newtonsoft.Json with AOT-version (one that doesn't use System.Reflection.Emit)
// TODO: remove it since EngineModule does properly reference AOT lib now
EditorUtilities::CopyFileIfNewer(data.ManagedCodeOutputPath / TEXT("Newtonsoft.Json.dll"), Globals::StartupFolder / TEXT("Source/Platforms/DotNet/AOT/Newtonsoft.Json.dll")); EditorUtilities::CopyFileIfNewer(data.ManagedCodeOutputPath / TEXT("Newtonsoft.Json.dll"), Globals::StartupFolder / TEXT("Source/Platforms/DotNet/AOT/Newtonsoft.Json.dll"));
FileSystem::DeleteFile(data.ManagedCodeOutputPath / TEXT("Newtonsoft.Json.xml")); FileSystem::DeleteFile(data.ManagedCodeOutputPath / TEXT("Newtonsoft.Json.xml"));
FileSystem::DeleteFile(data.ManagedCodeOutputPath / TEXT("Newtonsoft.Json.pdb")); FileSystem::DeleteFile(data.ManagedCodeOutputPath / TEXT("Newtonsoft.Json.pdb"));

View File

@@ -1,7 +1,6 @@
// Copyright (c) Wojciech Figat. All rights reserved. // Copyright (c) Wojciech Figat. All rights reserved.
using FlaxEngine; using FlaxEngine;
using FlaxEngine.GUI;
namespace FlaxEditor.CustomEditors.Dedicated namespace FlaxEditor.CustomEditors.Dedicated
{ {
@@ -12,7 +11,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
[CustomEditor(typeof(EnvironmentProbe)), DefaultEditor] [CustomEditor(typeof(EnvironmentProbe)), DefaultEditor]
public class EnvironmentProbeEditor : ActorEditor public class EnvironmentProbeEditor : ActorEditor
{ {
private Button _bake; private FlaxEngine.GUI.Button _bake;
/// <inheritdoc /> /// <inheritdoc />
public override void Initialize(LayoutElementsContainer layout) public override void Initialize(LayoutElementsContainer layout)
@@ -21,12 +20,9 @@ namespace FlaxEditor.CustomEditors.Dedicated
if (Values.HasDifferentTypes == false) if (Values.HasDifferentTypes == false)
{ {
var group = layout.Group("Probe"); layout.Space(10);
group.Panel.ItemsMargin = new Margin(Utilities.Constants.UIMargin * 2); _bake = layout.Button("Bake").Button;
_bake = group.Button("Bake").Button;
_bake.Clicked += BakeButtonClicked; _bake.Clicked += BakeButtonClicked;
var view = group.Button("View", "Opens the probe texture viewer");
view.Button.Clicked += OnViewButtonClicked;
} }
} }
@@ -52,14 +48,5 @@ namespace FlaxEditor.CustomEditors.Dedicated
} }
} }
} }
private void OnViewButtonClicked()
{
foreach (var value in Values)
{
if (value is EnvironmentProbe probe && probe.ProbeAsset)
Editor.Instance.ContentEditing.Open(probe.ProbeAsset);
}
}
} }
} }

View File

@@ -195,7 +195,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
filesCount += files.Length; filesCount += files.Length;
foreach (var file in files) foreach (var file in files)
FindNewKeysCpp(file, newKeys, allKeys); FindNewKeysCpp(file, newKeys, allKeys);
files = Directory.GetFiles(Globals.ProjectSourceFolder, "*.h", SearchOption.AllDirectories).Concat(Directory.GetFiles(Globals.ProjectSourceFolder, "*.hpp", SearchOption.AllDirectories)).ToArray(); files = Directory.GetFiles(Globals.ProjectSourceFolder, "*.h", SearchOption.AllDirectories).Concat(Directory.GetFiles(Globals.ProjectSourceFolder, "*.hpp", SearchOption.AllDirectories)).ToArray();;
filesCount += files.Length; filesCount += files.Length;
foreach (var file in files) foreach (var file in files)
FindNewKeysCpp(file, newKeys, allKeys); FindNewKeysCpp(file, newKeys, allKeys);

View File

@@ -1,38 +0,0 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using FlaxEngine;
namespace FlaxEditor.CustomEditors.Dedicated
{
/// <summary>
/// Custom editor for <see cref="NavMeshBoundsVolume"/>.
/// </summary>
/// <seealso cref="ActorEditor" />
[CustomEditor(typeof(NavMeshBoundsVolume)), DefaultEditor]
internal class NavMeshBoundsVolumeEditor : ActorEditor
{
/// <inheritdoc />
public override void Initialize(LayoutElementsContainer layout)
{
base.Initialize(layout);
if (Values.HasDifferentTypes == false)
{
var button = layout.Button("Build");
button.Button.Clicked += OnBuildClicked;
}
}
private void OnBuildClicked()
{
foreach (var value in Values)
{
if (value is NavMeshBoundsVolume volume)
{
Navigation.BuildNavMesh(volume.Box, volume.Scene);
Editor.Instance.Scene.MarkSceneEdited(volume.Scene);
}
}
}
}
}

View File

@@ -1,6 +1,7 @@
// Copyright (c) Wojciech Figat. All rights reserved. // Copyright (c) Wojciech Figat. All rights reserved.
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection.Emit;
using FlaxEditor.CustomEditors.GUI; using FlaxEditor.CustomEditors.GUI;
using FlaxEngine; using FlaxEngine;
using FlaxEngine.GUI; using FlaxEngine.GUI;

View File

@@ -909,17 +909,14 @@ namespace FlaxEditor.CustomEditors.Dedicated
settingsButton.Tag = script; settingsButton.Tag = script;
settingsButton.Clicked += OnSettingsButtonClicked; settingsButton.Clicked += OnSettingsButtonClicked;
// Adjust margin to not overlap with other ui elements in the header group.Panel.HeaderTextMargin = new Margin(scriptDrag.Right - 12, 15, 2, 2);
group.Panel.HeaderTextMargin = group.Panel.HeaderTextMargin with { Left = scriptDrag.Right - 12, Right = settingsButton.Width + Utilities.Constants.UIMargin };
group.Object(values, editor); group.Object(values, editor);
// Remove drop down arrows and containment lines if no objects in the group // Remove drop down arrows and containment lines if no objects in the group
if (group.Children.Count == 0) if (group.Children.Count == 0)
{ {
group.Panel.Close();
group.Panel.ArrowImageOpened = null; group.Panel.ArrowImageOpened = null;
group.Panel.ArrowImageClosed = null; group.Panel.ArrowImageClosed = null;
group.Panel.EnableContainmentLines = false; group.Panel.EnableContainmentLines = false;
group.Panel.CanOpenClose = false;
} }
// Scripts arrange bar // Scripts arrange bar

View File

@@ -1,7 +1,6 @@
// Copyright (c) Wojciech Figat. All rights reserved. // Copyright (c) Wojciech Figat. All rights reserved.
using FlaxEngine; using FlaxEngine;
using FlaxEngine.GUI;
namespace FlaxEditor.CustomEditors.Dedicated namespace FlaxEditor.CustomEditors.Dedicated
{ {
@@ -20,9 +19,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
if (Values.HasDifferentTypes == false) if (Values.HasDifferentTypes == false)
{ {
// Add 'Bake' button // Add 'Bake' button
var group = layout.Group("Bake"); layout.Space(10);
group.Panel.ItemsMargin = new Margin(Utilities.Constants.UIMargin * 2); var button = layout.Button("Bake");
var button = group.Button("Bake");
button.Button.Clicked += BakeButtonClicked; button.Button.Clicked += BakeButtonClicked;
} }
} }

View File

@@ -123,8 +123,6 @@ namespace FlaxEditor.CustomEditors.Editors
{ {
base.Refresh(); base.Refresh();
if (Picker == null)
return;
var differentValues = HasDifferentValues; var differentValues = HasDifferentValues;
Picker.DifferentValues = differentValues; Picker.DifferentValues = differentValues;
if (!differentValues) if (!differentValues)

View File

@@ -71,7 +71,7 @@ namespace FlaxEditor.CustomEditors.Editors
menu.AddButton("Copy", linkedEditor.Copy); menu.AddButton("Copy", linkedEditor.Copy);
var b = menu.AddButton("Duplicate", () => Editor.Duplicate(Index)); var b = menu.AddButton("Duplicate", () => Editor.Duplicate(Index));
b.Enabled = !Editor._readOnly && Editor._canResize; b.Enabled = linkedEditor.CanPaste && !Editor._readOnly && Editor._canResize;
b = menu.AddButton("Paste", linkedEditor.Paste); b = menu.AddButton("Paste", linkedEditor.Paste);
b.Enabled = linkedEditor.CanPaste && !Editor._readOnly; b.Enabled = linkedEditor.CanPaste && !Editor._readOnly;
@@ -407,7 +407,7 @@ namespace FlaxEditor.CustomEditors.Editors
menu.AddButton("Copy", linkedEditor.Copy); menu.AddButton("Copy", linkedEditor.Copy);
var b = menu.AddButton("Duplicate", () => Editor.Duplicate(Index)); var b = menu.AddButton("Duplicate", () => Editor.Duplicate(Index));
b.Enabled = !Editor._readOnly && Editor._canResize; b.Enabled = linkedEditor.CanPaste && !Editor._readOnly && Editor._canResize;
var paste = menu.AddButton("Paste", linkedEditor.Paste); var paste = menu.AddButton("Paste", linkedEditor.Paste);
paste.Enabled = linkedEditor.CanPaste && !Editor._readOnly; paste.Enabled = linkedEditor.CanPaste && !Editor._readOnly;
@@ -450,7 +450,6 @@ namespace FlaxEditor.CustomEditors.Editors
protected bool NotNullItems; protected bool NotNullItems;
private IntValueBox _sizeBox; private IntValueBox _sizeBox;
private Label _label;
private Color _background; private Color _background;
private int _elementsCount, _minCount, _maxCount; private int _elementsCount, _minCount, _maxCount;
private bool _readOnly; private bool _readOnly;
@@ -567,7 +566,7 @@ namespace FlaxEditor.CustomEditors.Editors
Parent = dropPanel, Parent = dropPanel,
}; };
_label = new Label var label = new Label
{ {
Text = "Size", Text = "Size",
AnchorPreset = AnchorPresets.TopRight, AnchorPreset = AnchorPresets.TopRight,
@@ -593,12 +592,11 @@ namespace FlaxEditor.CustomEditors.Editors
panel.Panel.Offsets = new Margin(7, 7, 0, 0); panel.Panel.Offsets = new Margin(7, 7, 0, 0);
panel.Panel.BackgroundColor = _background; panel.Panel.BackgroundColor = _background;
var elementType = ElementType; var elementType = ElementType;
var bindingAttr = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public;
bool single = elementType.IsPrimitive || bool single = elementType.IsPrimitive ||
elementType.Equals(new ScriptType(typeof(string))) || elementType.Equals(new ScriptType(typeof(string))) ||
elementType.IsEnum || elementType.IsEnum ||
(elementType.GetFields(bindingAttr).Length == 1 && elementType.GetProperties(bindingAttr).Length == 0) || (elementType.GetFields().Length == 1 && elementType.GetProperties().Length == 0) ||
(elementType.GetProperties(bindingAttr).Length == 1 && elementType.GetFields(bindingAttr).Length == 0) || (elementType.GetProperties().Length == 1 && elementType.GetFields().Length == 0) ||
elementType.Equals(new ScriptType(typeof(JsonAsset))) || elementType.Equals(new ScriptType(typeof(JsonAsset))) ||
elementType.Equals(new ScriptType(typeof(SettingsBase))); elementType.Equals(new ScriptType(typeof(SettingsBase)));
if (_cachedDropPanels == null) if (_cachedDropPanels == null)
@@ -652,7 +650,7 @@ namespace FlaxEditor.CustomEditors.Editors
panel.Panel.Size = new Float2(0, 18); panel.Panel.Size = new Float2(0, 18);
panel.Panel.Margin = new Margin(0, 0, Utilities.Constants.UIMargin, 0); panel.Panel.Margin = new Margin(0, 0, Utilities.Constants.UIMargin, 0);
var removeButton = panel.Button("-", "Remove the last item."); var removeButton = panel.Button("-", "Remove the last item");
removeButton.Button.Size = new Float2(16, 16); removeButton.Button.Size = new Float2(16, 16);
removeButton.Button.Enabled = size > _minCount; removeButton.Button.Enabled = size > _minCount;
removeButton.Button.AnchorPreset = AnchorPresets.TopRight; removeButton.Button.AnchorPreset = AnchorPresets.TopRight;
@@ -663,7 +661,7 @@ namespace FlaxEditor.CustomEditors.Editors
Resize(Count - 1); Resize(Count - 1);
}; };
var addButton = panel.Button("+", "Add a new item."); var addButton = panel.Button("+", "Add a new item");
addButton.Button.Size = new Float2(16, 16); addButton.Button.Size = new Float2(16, 16);
addButton.Button.Enabled = (!NotNullItems || size > 0) && size < _maxCount; addButton.Button.Enabled = (!NotNullItems || size > 0) && size < _maxCount;
addButton.Button.AnchorPreset = AnchorPresets.TopRight; addButton.Button.AnchorPreset = AnchorPresets.TopRight;
@@ -674,8 +672,6 @@ namespace FlaxEditor.CustomEditors.Editors
Resize(Count + 1); Resize(Count + 1);
}; };
} }
Layout.ContainerControl.SizeChanged += OnLayoutSizeChanged;
} }
private void OnSetupContextMenu(ContextMenu menu, DropPanel panel) private void OnSetupContextMenu(ContextMenu menu, DropPanel panel)
@@ -700,24 +696,10 @@ namespace FlaxEditor.CustomEditors.Editors
}); });
} }
private void OnLayoutSizeChanged(Control control)
{
if (Layout.ContainerControl is DropPanel dropPanel)
{
// Hide "Size" text when array editor title overlaps
var headerTextSize = dropPanel.HeaderTextFont.GetFont().MeasureText(dropPanel.HeaderText);
if (headerTextSize.X + DropPanel.DropDownIconSize >= _label.Left)
_label.TextColor = _label.TextColorHighlighted = Color.Transparent;
else
_label.TextColor = _label.TextColorHighlighted = FlaxEngine.GUI.Style.Current.Foreground;
}
}
/// <inheritdoc /> /// <inheritdoc />
protected override void Deinitialize() protected override void Deinitialize()
{ {
_sizeBox = null; _sizeBox = null;
Layout.ContainerControl.SizeChanged -= OnLayoutSizeChanged;
base.Deinitialize(); base.Deinitialize();
} }

View File

@@ -47,8 +47,6 @@ namespace FlaxEditor.CustomEditors.Editors
return inputEvent; return inputEvent;
if (Values[0] is string str) if (Values[0] is string str)
return str; return str;
if (Values.Type.Type == typeof(InputEvent))
return new InputEvent();
if (Values.Type.Type == typeof(string)) if (Values.Type.Type == typeof(string))
return string.Empty; return string.Empty;
return null; return null;

View File

@@ -104,7 +104,7 @@ namespace FlaxEditor.CustomEditors.Editors
public event Action<TypePickerControl> TypePickerValueChanged; public event Action<TypePickerControl> TypePickerValueChanged;
/// <summary> /// <summary>
/// The custom callback for types validation. Can be used to implement a rule for types to pick. /// The custom callback for types validation. Cane be used to implement a rule for types to pick.
/// </summary> /// </summary>
public Func<ScriptType, bool> CheckValid; public Func<ScriptType, bool> CheckValid;
@@ -353,13 +353,7 @@ namespace FlaxEditor.CustomEditors.Editors
} }
if (!string.IsNullOrEmpty(typeReference.CheckMethod)) if (!string.IsNullOrEmpty(typeReference.CheckMethod))
{ {
var parentEditor = ParentEditor; var parentType = ParentEditor.Values[0].GetType();
// Find actual parent editor if parent editor is collection editor
while (parentEditor.GetType().IsAssignableTo(typeof(CollectionEditor)))
parentEditor = parentEditor.ParentEditor;
var parentType = parentEditor.Values[0].GetType();
var method = parentType.GetMethod(typeReference.CheckMethod, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); var method = parentType.GetMethod(typeReference.CheckMethod, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (method != null) if (method != null)
{ {

View File

@@ -44,8 +44,7 @@ namespace FlaxEditor.CustomEditors.Elements
{ {
var style = Style.Current; var style = Style.Current;
var settingsButtonSize = Panel.HeaderHeight; var settingsButtonSize = Panel.HeaderHeight;
Panel.HeaderTextMargin = Panel.HeaderTextMargin with { Right = settingsButtonSize + Utilities.Constants.UIMargin }; return new Image
; return new Image
{ {
TooltipText = "Settings", TooltipText = "Settings",
AutoFocus = true, AutoFocus = true,

View File

@@ -23,7 +23,6 @@ using FlaxEngine.Assertions;
using FlaxEngine.GUI; using FlaxEngine.GUI;
using FlaxEngine.Interop; using FlaxEngine.Interop;
using FlaxEngine.Json; using FlaxEngine.Json;
using FlaxEngine.Utilities;
#pragma warning disable CS1591 #pragma warning disable CS1591
@@ -1371,7 +1370,7 @@ namespace FlaxEditor
public void BuildCSG() public void BuildCSG()
{ {
var scenes = Level.Scenes; var scenes = Level.Scenes;
scenes.ForEach(x => x.BuildCSG(0)); scenes.ToList().ForEach(x => x.BuildCSG(0));
Scene.MarkSceneEdited(scenes); Scene.MarkSceneEdited(scenes);
} }
@@ -1381,7 +1380,7 @@ namespace FlaxEditor
public void BuildNavMesh() public void BuildNavMesh()
{ {
var scenes = Level.Scenes; var scenes = Level.Scenes;
Navigation.BuildNavMesh(); scenes.ToList().ForEach(x => Navigation.BuildNavMesh(x, 0));
Scene.MarkSceneEdited(scenes); Scene.MarkSceneEdited(scenes);
} }
@@ -1391,7 +1390,6 @@ namespace FlaxEditor
public void BuildAllMeshesSDF() public void BuildAllMeshesSDF()
{ {
var models = new List<Model>(); var models = new List<Model>();
var forceRebuild = Input.GetKey(KeyboardKeys.F);
Scene.ExecuteOnGraph(node => Scene.ExecuteOnGraph(node =>
{ {
if (node is StaticModelNode staticModelNode && staticModelNode.Actor is StaticModel staticModel) if (node is StaticModelNode staticModelNode && staticModelNode.Actor is StaticModel staticModel)
@@ -1401,7 +1399,7 @@ namespace FlaxEditor
model != null && model != null &&
!models.Contains(model) && !models.Contains(model) &&
!model.IsVirtual && !model.IsVirtual &&
(forceRebuild || model.SDF.Texture == null)) model.SDF.Texture == null)
{ {
models.Add(model); models.Add(model);
} }
@@ -1414,17 +1412,7 @@ namespace FlaxEditor
{ {
var model = models[i]; var model = models[i];
Log($"[{i}/{models.Count}] Generating SDF for {model}"); Log($"[{i}/{models.Count}] Generating SDF for {model}");
float resolutionScale = 1.0f, backfacesThreshold = 0.6f; if (!model.GenerateSDF())
int lodIndex = 6;
bool useGPU = true;
var sdf = model.SDF;
if (sdf.Texture != null)
{
// Preserve options set on this model
resolutionScale = sdf.ResolutionScale;
lodIndex = sdf.LOD;
}
if (!model.GenerateSDF(resolutionScale, lodIndex, true, backfacesThreshold, useGPU))
model.Save(); model.Save();
} }
}); });
@@ -1599,7 +1587,7 @@ namespace FlaxEditor
if (dockedTo != null && dockedTo.SelectedTab != gameWin && dockedTo.SelectedTab != null) if (dockedTo != null && dockedTo.SelectedTab != gameWin && dockedTo.SelectedTab != null)
result = dockedTo.SelectedTab.Size; result = dockedTo.SelectedTab.Size;
else else
result = gameWin.Viewport.ContentSize; result = gameWin.Viewport.Size;
result *= root.DpiScale; result *= root.DpiScale;
result = Float2.Round(result); result = Float2.Round(result);

View File

@@ -502,7 +502,6 @@ namespace FlaxEditor.GUI.ContextMenu
if (base.OnKeyDown(key)) if (base.OnKeyDown(key))
return true; return true;
// Keyboard navigation around the menu
switch (key) switch (key)
{ {
case KeyboardKeys.ArrowDown: case KeyboardKeys.ArrowDown:
@@ -527,20 +526,6 @@ namespace FlaxEditor.GUI.ContextMenu
} }
} }
break; break;
case KeyboardKeys.ArrowRight:
for (int i = 0; i < _panel.Children.Count; i++)
{
if (_panel.Children[i] is ContextMenuChildMenu item && item.Visible && item.IsFocused && !item.ContextMenu.IsOpened)
{
item.ShowChild(this);
item.ContextMenu._panel.Children.FirstOrDefault(x => x is ContextMenuButton && x.Visible)?.Focus();
break;
}
}
break;
case KeyboardKeys.ArrowLeft:
ParentCM?.RootWindow.Focus();
break;
} }
return false; return false;

View File

@@ -75,11 +75,6 @@ namespace FlaxEditor.GUI.ContextMenu
/// </summary> /// </summary>
public bool HasChildCMOpened => _childCM != null; public bool HasChildCMOpened => _childCM != null;
/// <summary>
/// Gets the parent context menu (if exists).
/// </summary>
public ContextMenuBase ParentCM => _parentCM;
/// <summary> /// <summary>
/// Gets the topmost context menu. /// Gets the topmost context menu.
/// </summary> /// </summary>
@@ -89,7 +84,9 @@ namespace FlaxEditor.GUI.ContextMenu
{ {
var cm = this; var cm = this;
while (cm._parentCM != null && cm._isSubMenu) while (cm._parentCM != null && cm._isSubMenu)
{
cm = cm._parentCM; cm = cm._parentCM;
}
return cm; return cm;
} }
} }
@@ -114,11 +111,6 @@ namespace FlaxEditor.GUI.ContextMenu
/// </summary> /// </summary>
public bool UseInput = true; public bool UseInput = true;
/// <summary>
/// Optional flag that can disable UI navigation (tab/enter).
/// </summary>
public bool UseNavigation = true;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ContextMenuBase"/> class. /// Initializes a new instance of the <see cref="ContextMenuBase"/> class.
/// </summary> /// </summary>
@@ -630,21 +622,6 @@ namespace FlaxEditor.GUI.ContextMenu
case KeyboardKeys.Escape: case KeyboardKeys.Escape:
Hide(); Hide();
return true; return true;
case KeyboardKeys.Return:
if (UseNavigation && Root?.FocusedControl != null)
{
Root.SubmitFocused();
return true;
}
break;
case KeyboardKeys.Tab:
if (UseNavigation && Root != null)
{
bool shiftDown = Root.GetKey(KeyboardKeys.Shift);
Root.Navigate(shiftDown ? NavDirection.Previous : NavDirection.Next);
return true;
}
break;
} }
return false; return false;
} }

View File

@@ -29,7 +29,7 @@ namespace FlaxEditor.GUI.ContextMenu
CloseMenuOnClick = false; CloseMenuOnClick = false;
} }
internal void ShowChild(ContextMenu parentContextMenu) private void ShowChild(ContextMenu parentContextMenu)
{ {
// Hide parent CM popups and set itself as child // Hide parent CM popups and set itself as child
var vAlign = parentContextMenu.ItemsAreaMargin.Top; var vAlign = parentContextMenu.ItemsAreaMargin.Top;

View File

@@ -522,16 +522,6 @@ namespace FlaxEditor.GUI
cm.AddButton("Show whole curve", _editor.ShowWholeCurve); cm.AddButton("Show whole curve", _editor.ShowWholeCurve);
cm.AddButton("Reset view", _editor.ResetView); cm.AddButton("Reset view", _editor.ResetView);
} }
cm.AddSeparator();
var presetCm = cm.AddChildMenu("Apply preset");
foreach (var value in Enum.GetValues(typeof(CurvePreset)))
{
CurvePreset preset = (CurvePreset)value;
string name = Utilities.Utils.GetPropertyNameUI(preset.ToString());
var b = presetCm.ContextMenu.AddButton(name, () => _editor.ApplyPreset(preset));
b.Enabled = !(_editor is LinearCurveEditor<T> && (preset != CurvePreset.Constant && preset != CurvePreset.Linear));
}
_editor.OnShowContextMenu(cm, selectionCount); _editor.OnShowContextMenu(cm, selectionCount);
cm.Show(this, location); cm.Show(this, location);
} }
@@ -629,33 +619,6 @@ namespace FlaxEditor.GUI
} }
} }
/// <summary>
/// A list of avaliable curve presets for the <see cref="CurveEditor{T}"/>.
/// </summary>
public enum CurvePreset
{
/// <summary>
/// A curve where every point has the same value.
/// </summary>
Constant,
/// <summary>
/// A curve linear curve.
/// </summary>
Linear,
/// <summary>
/// A curve that starts a slowly and then accelerates until the end.
/// </summary>
EaseIn,
/// <summary>
/// A curve that starts a steep and then flattens until the end.
/// </summary>
EaseOut,
/// <summary>
/// A combination of the <see cref="CurvePreset.EaseIn"/> and <see cref="CurvePreset.EaseOut"/> preset.
/// </summary>
Smoothstep
}
/// <inheritdoc /> /// <inheritdoc />
public override void OnKeyframesDeselect(IKeyframesEditor editor) public override void OnKeyframesDeselect(IKeyframesEditor editor)
{ {

View File

@@ -19,48 +19,6 @@ namespace FlaxEditor.GUI
/// <seealso cref="CurveEditorBase" /> /// <seealso cref="CurveEditorBase" />
public abstract partial class CurveEditor<T> : CurveEditorBase where T : new() public abstract partial class CurveEditor<T> : CurveEditorBase where T : new()
{ {
/// <summary>
/// Represents a single point in a <see cref="CurveEditorPreset"/>.
/// </summary>
protected struct CurvePresetPoint
{
/// <summary>
/// The time.
/// </summary>
public float Time;
/// <summary>
/// The value.
/// </summary>
public float Value;
/// <summary>
/// The in tangent. Will be ignored in <see cref="LinearCurveEditor{T}"/>
/// </summary>
public float TangentIn;
/// <summary>
/// The out tangent. Will be ignored in <see cref="LinearCurveEditor{T}"/>
/// </summary>
public float TangentOut;
}
/// <summary>
/// A curve preset.
/// </summary>
protected struct CurveEditorPreset()
{
/// <summary>
/// If the tangents will be linear or smooth.
/// </summary>
public bool LinearTangents;
/// <summary>
/// The points of the preset.
/// </summary>
public List<CurvePresetPoint> Points;
}
private class Popup : ContextMenuBase private class Popup : ContextMenuBase
{ {
private CustomEditorPresenter _presenter; private CustomEditorPresenter _presenter;
@@ -68,12 +26,11 @@ namespace FlaxEditor.GUI
private List<int> _keyframeIndices; private List<int> _keyframeIndices;
private bool _isDirty; private bool _isDirty;
public Popup(CurveEditor<T> editor, object[] selection, List<int> keyframeIndices = null, float maxHeight = 140.0f) public Popup(CurveEditor<T> editor, object[] selection, List<int> keyframeIndices = null, float height = 140.0f)
: this(editor, maxHeight) : this(editor, height)
{ {
_presenter.Select(selection); _presenter.Select(selection);
_presenter.OpenAllGroups(); _presenter.OpenAllGroups();
Size = new Float2(Size.X, Mathf.Min(_presenter.ContainerControl.Size.Y, maxHeight));
_keyframeIndices = keyframeIndices; _keyframeIndices = keyframeIndices;
if (keyframeIndices != null && selection.Length != keyframeIndices.Count) if (keyframeIndices != null && selection.Length != keyframeIndices.Count)
throw new Exception(); throw new Exception();
@@ -212,7 +169,7 @@ namespace FlaxEditor.GUI
if (IsSelected) if (IsSelected)
color = Editor.ContainsFocus ? style.SelectionBorder : Color.Lerp(style.ForegroundDisabled, style.SelectionBorder, 0.4f); color = Editor.ContainsFocus ? style.SelectionBorder : Color.Lerp(style.ForegroundDisabled, style.SelectionBorder, 0.4f);
if (IsMouseOver) if (IsMouseOver)
color *= 1.5f; color *= 1.1f;
Render2D.FillRectangle(rect, color); Render2D.FillRectangle(rect, color);
} }
@@ -328,7 +285,7 @@ namespace FlaxEditor.GUI
/// <summary> /// <summary>
/// The keyframes size. /// The keyframes size.
/// </summary> /// </summary>
protected static readonly Float2 KeyframesSize = new Float2(8.0f); protected static readonly Float2 KeyframesSize = new Float2(7.0f);
/// <summary> /// <summary>
/// The colors for the keyframe points. /// The colors for the keyframe points.
@@ -369,63 +326,6 @@ namespace FlaxEditor.GUI
private Color _labelsColor; private Color _labelsColor;
private Font _labelsFont; private Font _labelsFont;
/// <summary>
/// Preset values for <see cref="CurvePreset"/> to be applied to a <see cref="CurveEditor{T}"/>.
/// </summary>
protected Dictionary<CurvePreset, CurveEditorPreset> Presets = new Dictionary<CurvePreset, CurveEditorPreset>
{
{ CurvePreset.Constant, new CurveEditorPreset
{
LinearTangents = true,
Points = new List<CurvePresetPoint>
{
new CurvePresetPoint { Time = 0f, Value = 0.5f, TangentIn = 0f, TangentOut = 0f },
new CurvePresetPoint { Time = 1f, Value = 0.5f, TangentIn = 0f, TangentOut = 0f },
}
}
},
{ CurvePreset.EaseIn, new CurveEditorPreset
{
LinearTangents = false,
Points = new List<CurvePresetPoint>
{
new CurvePresetPoint { Time = 0f, Value = 0f, TangentIn = 0f, TangentOut = 0f },
new CurvePresetPoint { Time = 1f, Value = 1f, TangentIn = -1.4f, TangentOut = 0f },
}
}
},
{ CurvePreset.EaseOut, new CurveEditorPreset
{
LinearTangents = false,
Points = new List<CurvePresetPoint>
{
new CurvePresetPoint { Time = 1f, Value = 1f, TangentIn = 0f, TangentOut = 0f },
new CurvePresetPoint { Time = 0f, Value = 0f, TangentIn = 0f, TangentOut = 1.4f },
}
}
},
{ CurvePreset.Linear, new CurveEditorPreset
{
LinearTangents = true,
Points = new List<CurvePresetPoint>
{
new CurvePresetPoint { Time = 0f, Value = 0f, TangentIn = 0f, TangentOut = 0f },
new CurvePresetPoint { Time = 1f, Value = 1f, TangentIn = 0f, TangentOut = 0f },
}
}
},
{ CurvePreset.Smoothstep, new CurveEditorPreset
{
LinearTangents = false,
Points = new List<CurvePresetPoint>
{
new CurvePresetPoint { Time = 0f, Value = 0f, TangentIn = 0f, TangentOut = 0f },
new CurvePresetPoint { Time = 1f, Value = 1f, TangentIn = 0f, TangentOut = 0f },
}
}
},
};
/// <summary> /// <summary>
/// The keyframe UI points. /// The keyframe UI points.
/// </summary> /// </summary>
@@ -668,28 +568,6 @@ namespace FlaxEditor.GUI
/// <param name="indicesToRemove">The list of indices of the keyframes to remove.</param> /// <param name="indicesToRemove">The list of indices of the keyframes to remove.</param>
protected abstract void RemoveKeyframesInternal(HashSet<int> indicesToRemove); protected abstract void RemoveKeyframesInternal(HashSet<int> indicesToRemove);
/// <summary>
/// Tries to convert a float to the type of the type wildcard of the curve editor.
/// </summary>
/// <param name="value">The float.</param>
/// <returns>The converted value.</returns>
public static object ConvertCurvePresetValueToCurveEditorType(float value)
{
if (typeof(T) == typeof(Float2))
return new Float2(value);
if (typeof(T) == typeof(Float3))
return new Float3(value);
if (typeof(T) == typeof(Float4))
return new Float4(value);
if (typeof(T) == typeof(Vector2))
return new Vector2(value);
if (typeof(T) == typeof(Vector3))
return new Vector3(value);
if (typeof(T) == typeof(Vector4))
return new Vector4(value);
return value;
}
/// <summary> /// <summary>
/// Called when showing a context menu. Can be used to add custom buttons with actions. /// Called when showing a context menu. Can be used to add custom buttons with actions.
/// </summary> /// </summary>
@@ -874,17 +752,6 @@ namespace FlaxEditor.GUI
ShowCurve(false); ShowCurve(false);
} }
/// <summary>
/// Applies a <see cref="CurvePreset"/> to the curve editor.
/// </summary>
/// <param name="preset">The preset.</param>
public virtual void ApplyPreset(CurvePreset preset)
{
// Remove existing keyframes
SelectAll();
RemoveKeyframes();
}
/// <inheritdoc /> /// <inheritdoc />
public override void Evaluate(out object result, float time, bool loop = false) public override void Evaluate(out object result, float time, bool loop = false)
{ {
@@ -1161,31 +1028,6 @@ namespace FlaxEditor.GUI
return true; return true;
} }
bool left = key == KeyboardKeys.ArrowLeft;
bool right = key == KeyboardKeys.ArrowRight;
bool up = key == KeyboardKeys.ArrowUp;
bool down = key == KeyboardKeys.ArrowDown;
if (left || right || up || down)
{
bool shift = Root.GetKey(KeyboardKeys.Shift);
bool alt = Root.GetKey(KeyboardKeys.Alt);
float deltaValue = 10f;
if (shift || alt)
deltaValue = shift ? 2.5f : 5f;
Float2 moveDelta = Float2.Zero;
if (left || right)
moveDelta.X = left ? -deltaValue : deltaValue;
if (up || down)
moveDelta.Y = up ? -deltaValue : deltaValue;
_contents.OnMoveStart(Float2.Zero);
_contents.OnMove(moveDelta);
_contents.OnMoveEnd(Float2.Zero);
return true;
}
return false; return false;
} }
@@ -1684,22 +1526,6 @@ namespace FlaxEditor.GUI
_tangents[i].Visible = false; _tangents[i].Visible = false;
} }
/// <inheritdoc />
public override void ApplyPreset(CurvePreset preset)
{
base.ApplyPreset(preset);
CurveEditorPreset data = Presets[preset];
foreach (var point in data.Points)
{
float time = point.Time;
object value = ConvertCurvePresetValueToCurveEditorType((float)point.Value);
AddKeyframe(time, value);
}
ShowWholeCurve();
}
/// <inheritdoc /> /// <inheritdoc />
protected override void DrawCurve(ref Rectangle viewRect) protected override void DrawCurve(ref Rectangle viewRect)
{ {
@@ -2486,30 +2312,6 @@ namespace FlaxEditor.GUI
} }
} }
/// <inheritdoc />
public override void ApplyPreset(CurvePreset preset)
{
base.ApplyPreset(preset);
CurveEditorPreset data = Presets[preset];
foreach (var point in data.Points)
{
float time = point.Time;
object value = ConvertCurvePresetValueToCurveEditorType((float)point.Value);
object tangentIn = ConvertCurvePresetValueToCurveEditorType((float)point.TangentIn);
object tangentOut = ConvertCurvePresetValueToCurveEditorType((float)point.TangentOut);
AddKeyframe(time, value, tangentIn, tangentOut);
}
SelectAll();
if (data.LinearTangents)
SetTangentsLinear();
ShowWholeCurve();
}
/// <inheritdoc /> /// <inheritdoc />
protected override void SetScaleInternal(ref Float2 scale) protected override void SetScaleInternal(ref Float2 scale)
{ {

View File

@@ -41,7 +41,6 @@ namespace FlaxEditor.GUI.Dialogs
private bool _useDynamicEditing; private bool _useDynamicEditing;
private bool _activeEyedropper; private bool _activeEyedropper;
private bool _canPassLastChangeEvent = true; private bool _canPassLastChangeEvent = true;
private bool _linear;
private ColorValueBox.ColorPickerEvent _onChanged; private ColorValueBox.ColorPickerEvent _onChanged;
private ColorValueBox.ColorPickerClosedEvent _onClosed; private ColorValueBox.ColorPickerClosedEvent _onClosed;
@@ -57,7 +56,6 @@ namespace FlaxEditor.GUI.Dialogs
private Button _cCancel; private Button _cCancel;
private Button _cOK; private Button _cOK;
private Button _cEyedropper; private Button _cEyedropper;
private Button _cLinearSRGB;
private List<Color> _savedColors = new List<Color>(); private List<Color> _savedColors = new List<Color>();
private List<Button> _savedColorButtons = new List<Button>(); private List<Button> _savedColorButtons = new List<Button>();
@@ -120,7 +118,6 @@ namespace FlaxEditor.GUI.Dialogs
_value = Color.Transparent; _value = Color.Transparent;
_onChanged = colorChanged; _onChanged = colorChanged;
_onClosed = pickerClosed; _onClosed = pickerClosed;
_linear = !Graphics.GammaColorSpace;
// Get saved colors if they exist // Get saved colors if they exist
if (Editor.Instance.ProjectCache.TryGetCustomData("ColorPickerSavedColors", out string savedColors)) if (Editor.Instance.ProjectCache.TryGetCustomData("ColorPickerSavedColors", out string savedColors))
@@ -230,25 +227,6 @@ namespace FlaxEditor.GUI.Dialogs
_cEyedropper.Width = _cEyedropper.Height; _cEyedropper.Width = _cEyedropper.Height;
_cEyedropper.X -= _cEyedropper.Width; _cEyedropper.X -= _cEyedropper.Width;
// Linear/sRGB toggle button
_cLinearSRGB = new Button(_cOK.X - EyedropperMargin, _cHex.Bottom + PickerMargin)
{
TooltipText = "Toggles between color preview in Linear and sRGB",
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.SplineAligned64),
BackgroundColor = _cEyedropper.BackgroundColor,
BackgroundColorHighlighted = _cEyedropper.BackgroundColorHighlighted,
BorderColor = _linear ? Color.Transparent : style.Foreground,
BorderColorHighlighted = _cEyedropper.BorderColorHighlighted,
Size = _cEyedropper.Size,
Parent = this,
Location = _cEyedropper.BottomLeft + new Float2(0, 4),
};
_cLinearSRGB.Clicked += () =>
{
_linear = !_linear;
_cLinearSRGB.BorderColor = _linear ? Color.Transparent : style.Foreground;
};
// Set initial color // Set initial color
SelectedColor = initialValue; SelectedColor = initialValue;
} }
@@ -303,22 +281,16 @@ namespace FlaxEditor.GUI.Dialogs
if (_activeEyedropper) if (_activeEyedropper)
{ {
_activeEyedropper = false; _activeEyedropper = false;
if (colorPicked != Color.Transparent) SelectedColor = colorPicked;
{ ScreenUtilities.PickColorDone -= OnColorPicked;
Color color = colorPicked;
if (_linear)
color = color.ToLinear();
SelectedColor = color;
}
Platform.PickScreenColorDone -= OnColorPicked;
} }
} }
private void OnEyedropStart() private void OnEyedropStart()
{ {
_activeEyedropper = true; _activeEyedropper = true;
Platform.PickScreenColor(); ScreenUtilities.PickColor();
Platform.PickScreenColorDone += OnColorPicked; ScreenUtilities.PickColorDone += OnColorPicked;
} }
private void OnRGBAChanged() private void OnRGBAChanged()
@@ -356,15 +328,11 @@ namespace FlaxEditor.GUI.Dialogs
{ {
// Try reading the color under the cursor in realtime if supported by the platform // Try reading the color under the cursor in realtime if supported by the platform
Float2 mousePosition = Platform.MousePosition; Float2 mousePosition = Platform.MousePosition;
Color color = Platform.GetScreenColorAt(mousePosition); Color color = ScreenUtilities.GetColorAt(mousePosition);
if (color != Color.Transparent) if (color != Color.Transparent)
{
if (_linear)
color = color.ToLinear();
SelectedColor = color; SelectedColor = color;
} }
} }
}
/// <inheritdoc /> /// <inheritdoc />
public override void Draw() public override void Draw()
@@ -423,7 +391,7 @@ namespace FlaxEditor.GUI.Dialogs
} }
} }
} }
Render2D.FillRectangle(newRect, _linear ? _value.ToSRgb() : _value); Render2D.FillRectangle(newRect, _value);
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -444,7 +412,7 @@ namespace FlaxEditor.GUI.Dialogs
{ {
// Cancel eye dropping // Cancel eye dropping
_activeEyedropper = false; _activeEyedropper = false;
Platform.PickScreenColorDone -= OnColorPicked; ScreenUtilities.PickColorDone -= OnColorPicked;
return true; return true;
} }

View File

@@ -310,26 +310,6 @@ namespace FlaxEditor.GUI.Dialogs
Render2D.DrawRectangle(_slider1Rect, _isMouseDownSlider1 ? style.BackgroundSelected : Color.Black); Render2D.DrawRectangle(_slider1Rect, _isMouseDownSlider1 ? style.BackgroundSelected : Color.Black);
Render2D.DrawRectangle(valueR, _isMouseDownSlider1 ? Color.White : Color.Gray); Render2D.DrawRectangle(valueR, _isMouseDownSlider1 ? Color.White : Color.Gray);
// Draw checkerboard pattern to part of the alpha slider background
var alphaRect = _slider2Rect;
Render2D.FillRectangle(alphaRect, Color.White);
var smallRectSize = alphaRect.Width * 0.5f;
var numHor = Mathf.CeilToInt(alphaRect.Width / smallRectSize);
var numVer = Mathf.CeilToInt(alphaRect.Height / smallRectSize);
for (int i = 0; i < numHor; i++)
{
for (int j = 0; j < numVer; j++)
{
if ((i + j) % 2 == 0)
{
var rect = new Rectangle(alphaRect.X + smallRectSize * i, alphaRect.Y + smallRectSize * j, new Float2(smallRectSize));
Render2D.PushClip(alphaRect);
Render2D.FillRectangle(rect, Color.Gray);
Render2D.PopClip();
}
}
}
// Alpha // Alpha
float alphaY = _slider2Rect.Height * (1 - _color.A); float alphaY = _slider2Rect.Height * (1 - _color.A);
var alphaR = new Rectangle(_slider2Rect.X - slidersOffset, _slider2Rect.Y + alphaY - slidersThickness / 2, _slider2Rect.Width + slidersOffset * 2, slidersThickness); var alphaR = new Rectangle(_slider2Rect.X - slidersOffset, _slider2Rect.Y + alphaY - slidersThickness / 2, _slider2Rect.Width + slidersOffset * 2, slidersThickness);

View File

@@ -469,7 +469,7 @@ namespace FlaxEditor.GUI.Docking
var childPanels = _childPanels.ToArray(); var childPanels = _childPanels.ToArray();
if (childPanels.Length != 0) if (childPanels.Length != 0)
{ {
// Fallback: move tabs from child panels into this one. // Move tabs from child panels into this one
DockWindow selectedTab = null; DockWindow selectedTab = null;
foreach (var childPanel in childPanels) foreach (var childPanel in childPanels)
{ {
@@ -490,8 +490,7 @@ namespace FlaxEditor.GUI.Docking
{ {
// Unlink splitter // Unlink splitter
var splitterParent = splitter.Parent; var splitterParent = splitter.Parent;
if (splitterParent == null) Assert.IsNotNull(splitterParent);
return;
splitter.Parent = null; splitter.Parent = null;
// Move controls from second split panel to the split panel parent // Move controls from second split panel to the split panel parent
@@ -508,63 +507,17 @@ namespace FlaxEditor.GUI.Docking
splitter.Dispose(); splitter.Dispose();
} }
} }
else if (IsMaster && _childPanels.Count != 0)
{
if (TryCollapseSplitter(_tabsProxy?.Parent as Panel))
return;
}
else if (!IsMaster) else if (!IsMaster)
{ {
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
} }
else if (_childPanels.Count != 0)
{
if (TryCollapseSplitter(_tabsProxy?.Parent as Panel))
return;
}
else if (!IsMaster) else if (!IsMaster)
{ {
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
} }
internal bool CollapseEmptyTabsProxy()
{
if (TabsCount == 0 && ChildPanelsCount > 0)
{
return TryCollapseSplitter(_tabsProxy?.Parent as Panel);
}
return false;
}
private bool TryCollapseSplitter(Panel removedPanelParent)
{
if (removedPanelParent == null)
return false;
if (!(removedPanelParent.Parent is SplitPanel tabsSplitter))
return false;
var splitterParent = tabsSplitter.Parent;
if (splitterParent == null)
return false;
tabsSplitter.Parent = null;
var scrPanel = removedPanelParent == tabsSplitter.Panel2 ? tabsSplitter.Panel1 : tabsSplitter.Panel2;
var srcPanelChildrenCount = scrPanel.ChildrenCount;
for (int i = srcPanelChildrenCount - 1; i >= 0 && scrPanel.ChildrenCount > 0; i--)
{
scrPanel.GetChild(i).Parent = splitterParent;
}
Assert.IsTrue(scrPanel.ChildrenCount == 0);
Assert.IsTrue(splitterParent.ChildrenCount == srcPanelChildrenCount);
tabsSplitter.Dispose();
if (_tabsProxy != null && _tabsProxy.Parent == removedPanelParent)
_tabsProxy = null;
return true;
}
internal virtual void DockWindowInternal(DockState state, DockWindow window, bool autoSelect = true, float? splitterValue = null) internal virtual void DockWindowInternal(DockState state, DockWindow window, bool autoSelect = true, float? splitterValue = null)
{ {
DockWindow(state, window, autoSelect, splitterValue); DockWindow(state, window, autoSelect, splitterValue);

View File

@@ -193,7 +193,6 @@ namespace FlaxEditor.GUI.Docking
{ {
CreateFloating(Float2.Zero, Float2.Zero); CreateFloating(Float2.Zero, Float2.Zero);
} }
/// <summary> /// <summary>
/// Creates the window in a floating state. /// Creates the window in a floating state.
/// </summary> /// </summary>

View File

@@ -108,11 +108,7 @@ namespace FlaxEditor.GUI.Docking
return; return;
// Create docking hint window // Create docking hint window
Window dragSourceWindow = null; WindowDragHelper.StartDragging(this);
#if !PLATFORM_SDL
dragSourceWindow = _window?.Window;
#endif
WindowDragHelper.StartDragging(this, dragSourceWindow);
} }
/// <summary> /// <summary>
@@ -131,15 +127,11 @@ namespace FlaxEditor.GUI.Docking
settings.Title = title; settings.Title = title;
settings.Size = size; settings.Size = size;
settings.Position = location; settings.Position = location;
settings.MinimumSize = new Float2(100, 100); settings.MinimumSize = new Float2(200, 150);
settings.MaximumSize = Float2.Zero; // Unlimited size settings.MaximumSize = Float2.Zero; // Unlimited size
settings.Fullscreen = false; settings.Fullscreen = false;
settings.HasBorder = true; settings.HasBorder = true;
#if PLATFORM_SDL
settings.SupportsTransparency = true; settings.SupportsTransparency = true;
#else
settings.SupportsTransparency = false;
#endif
settings.ActivateWhenFirstShown = true; settings.ActivateWhenFirstShown = true;
settings.AllowInput = true; settings.AllowInput = true;
settings.AllowMinimize = true; settings.AllowMinimize = true;
@@ -221,12 +213,7 @@ namespace FlaxEditor.GUI.Docking
base.OnSelectedTabChanged(); base.OnSelectedTabChanged();
if (_window != null && SelectedTab != null) if (_window != null && SelectedTab != null)
{
_window.Title = SelectedTab.Title; _window.Title = SelectedTab.Title;
var decorations = Parent.GetChild<FloatWindowDecorations>();
if (decorations != null)
decorations.PerformLayout();
}
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@@ -26,7 +26,7 @@ namespace FlaxEditor.GUI.Docking
/// <summary> /// <summary>
/// The hint control size. /// The hint control size.
/// </summary> /// </summary>
public const float HintControlSize = 48.0f; public const float HintControlSize = 32.0f;
/// <summary> /// <summary>
/// The opacity of the dragged window when hint controls are shown. /// The opacity of the dragged window when hint controls are shown.
@@ -44,33 +44,13 @@ namespace FlaxEditor.GUI.Docking
_toMove = toMove; _toMove = toMove;
_toSet = DockState.Float; _toSet = DockState.Float;
var window = toMove.Window.Window; var window = toMove.Window.Window;
var mousePos = Platform.MousePosition;
// Check if window is maximized and restore window for correct dragging
if (window.IsMaximized)
{
var windowMousePos = mousePos - window.Position;
var previousSize = window.Size;
window.Restore();
window.Position = mousePos - windowMousePos * window.Size / previousSize;
}
// When drag starts from a tabs the window might not be shown yet
if (!window.IsVisible)
{
window.Show();
window.Position = mousePos - new Float2(40, 10);
}
// Bind events // Bind events
FlaxEngine.Scripting.Update += OnUpdate; FlaxEngine.Scripting.Update += OnUpdate;
window.MouseUp += OnMouseUp; window.MouseUp += OnMouseUp;
#if !PLATFORM_SDL
window.StartTrackingMouse(false);
#endif
// Update rectangles // Update rectangles
UpdateRects(mousePos); UpdateRects(Platform.MousePosition);
// Ensure the dragged window stays on top of every other window // Ensure the dragged window stays on top of every other window
window.IsAlwaysOnTop = true; window.IsAlwaysOnTop = true;
@@ -78,21 +58,13 @@ namespace FlaxEditor.GUI.Docking
_dragSourceWindow = dragSourceWindow; _dragSourceWindow = dragSourceWindow;
if (_dragSourceWindow != null) // Detaching a tab from existing window if (_dragSourceWindow != null) // Detaching a tab from existing window
{ {
#if PLATFORM_SDL
_dragOffset = new Float2(window.Size.X / 2, 10.0f); _dragOffset = new Float2(window.Size.X / 2, 10.0f);
#else
_dragOffset = mousePos - window.Position;
#endif
// The mouse up event is sent to the source window on Windows _dragSourceWindow.MouseUp += OnMouseUp; // The mouse up event is sent to the source window on Windows
_dragSourceWindow.MouseUp += OnMouseUp;
// TODO: when detaching tab in floating window (not main window), the drag source window is still main window? // TODO: when detaching tab in floating window (not main window), the drag source window is still main window?
var dragSourceWindowWayland = toMove.MasterPanel?.RootWindow.Window ?? Editor.Instance.Windows.MainWindow; var dragSourceWindowWayland = toMove.MasterPanel?.RootWindow.Window ?? Editor.Instance.Windows.MainWindow;
window.DoDragDrop(window.Title, _dragOffset, dragSourceWindowWayland); window.DoDragDrop(window.Title, _dragOffset, dragSourceWindowWayland);
#if !PLATFORM_SDL
_dragSourceWindow.BringToFront();
#endif
} }
else else
{ {
@@ -112,12 +84,7 @@ namespace FlaxEditor.GUI.Docking
// Unbind events // Unbind events
FlaxEngine.Scripting.Update -= OnUpdate; FlaxEngine.Scripting.Update -= OnUpdate;
if (window != null) if (window != null)
{
window.MouseUp -= OnMouseUp; window.MouseUp -= OnMouseUp;
#if !PLATFORM_SDL
window.EndTrackingMouse();
#endif
}
if (_dragSourceWindow != null) if (_dragSourceWindow != null)
_dragSourceWindow.MouseUp -= OnMouseUp; _dragSourceWindow.MouseUp -= OnMouseUp;
@@ -193,14 +160,13 @@ namespace FlaxEditor.GUI.Docking
/// Start dragging a floating dock panel. /// Start dragging a floating dock panel.
/// </summary> /// </summary>
/// <param name="toMove">Floating dock panel to move.</param> /// <param name="toMove">Floating dock panel to move.</param>
/// <param name="dragSourceWindow">The window where dragging started from.</param>
/// <returns>The window drag helper object.</returns> /// <returns>The window drag helper object.</returns>
public static WindowDragHelper StartDragging(FloatWindowDockPanel toMove, Window dragSourceWindow = null) public static WindowDragHelper StartDragging(FloatWindowDockPanel toMove)
{ {
if (toMove == null) if (toMove == null)
throw new ArgumentNullException(); throw new ArgumentNullException();
return new WindowDragHelper(toMove, dragSourceWindow); return new WindowDragHelper(toMove, null);
} }
/// <summary> /// <summary>
@@ -302,8 +268,7 @@ namespace FlaxEditor.GUI.Docking
} }
// Prefer panel in the same window we hit earlier // Prefer panel in the same window we hit earlier
// TODO: this doesn't allow docking window into another floating window over the main window if (dockPanel?.RootWindow != _toDock?.RootWindow)
/*if (dockPanel?.RootWindow != _toDock?.RootWindow)
{ {
foreach (var hit in hitResults) foreach (var hit in hitResults)
{ {
@@ -313,7 +278,7 @@ namespace FlaxEditor.GUI.Docking
break; break;
} }
} }
}*/ }
} }
if (dockPanel != _toDock) if (dockPanel != _toDock)
@@ -323,18 +288,11 @@ namespace FlaxEditor.GUI.Docking
AddDockHints(); AddDockHints();
// Make sure the all the dock hint areas are not under other windows // Make sure the all the dock hint areas are not under other windows
if (_toDock != Editor.Instance.UI.MasterPanel)
_toDock?.RootWindow.Window.BringToFront(); _toDock?.RootWindow.Window.BringToFront();
//_toDock?.RootWindow.Window.Focus(); //_toDock?.RootWindow.Window.Focus();
#if PLATFORM_SDL
// Make the dragged window transparent when dock hints are visible // Make the dragged window transparent when dock hints are visible
_toMove.Window.Window.Opacity = _toDock == null ? 1.0f : DragWindowOpacity; _toMove.Window.Window.Opacity = _toDock == null ? 1.0f : DragWindowOpacity;
#else
// Bring the drop source always to the top
if (_dragSourceWindow != null)
_dragSourceWindow.BringToFront();
#endif
} }
// Check dock state to use // Check dock state to use
@@ -342,10 +300,7 @@ namespace FlaxEditor.GUI.Docking
bool showBorderHints = showProxyHints; bool showBorderHints = showProxyHints;
bool showCenterHint = showProxyHints; bool showCenterHint = showProxyHints;
Control hoveredHintControl = null; Control hoveredHintControl = null;
Float2 hoveredLocationOffset = Float2.Zero;
Float2 hoveredSizeOverride = Float2.Zero; Float2 hoveredSizeOverride = Float2.Zero;
DockState prevToSet = _toSet;
float hoveredMargin = 1.0f;
if (showProxyHints) if (showProxyHints)
{ {
// If moved window has not only tabs but also child panels disable docking as tab // If moved window has not only tabs but also child panels disable docking as tab
@@ -362,7 +317,7 @@ namespace FlaxEditor.GUI.Docking
// Cache dock rectangles // Cache dock rectangles
var size = _rectDock.Size / Platform.DpiScale; var size = _rectDock.Size / Platform.DpiScale;
var offset = _toDock.PointFromScreen(_rectDock.Location); var offset = _toDock.PointFromScreen(_rectDock.Location);
var borderMargin = 10.0f; var borderMargin = 4.0f;
var hintWindowsSize = HintControlSize; var hintWindowsSize = HintControlSize;
var hintWindowsSize2 = hintWindowsSize * 0.5f; var hintWindowsSize2 = hintWindowsSize * 0.5f;
var hintPreviewSize = new Float2(Math.Max(HintControlSize * 2, size.X * 0.5f), Math.Max(HintControlSize * 2, size.Y * 0.5f)); var hintPreviewSize = new Float2(Math.Max(HintControlSize * 2, size.X * 0.5f), Math.Max(HintControlSize * 2, size.Y * 0.5f));
@@ -375,40 +330,35 @@ namespace FlaxEditor.GUI.Docking
_rCenter = new Rectangle(centerX - hintWindowsSize2, centerY - hintWindowsSize2, hintWindowsSize, hintWindowsSize) + offset; _rCenter = new Rectangle(centerX - hintWindowsSize2, centerY - hintWindowsSize2, hintWindowsSize, hintWindowsSize) + offset;
// Hit test, and calculate the approximation for filled area when hovered over the hint // Hit test, and calculate the approximation for filled area when hovered over the hint
var toSet = DockState.Float; DockState toSet = DockState.Float;
var hintTestPoint = _toDock.PointFromScreen(_mouse);
if (showBorderHints) if (showBorderHints)
{ {
if (_rUpper.Contains(ref hintTestPoint)) if (_rUpper.Contains(_toDock.PointFromScreen(_mouse)))
{ {
toSet = DockState.DockTop; toSet = DockState.DockTop;
hoveredHintControl = _dockHintUp; hoveredHintControl = _dockHintUp;
hoveredSizeOverride = new Float2(size.X, size.Y * DockPanel.DefaultSplitterValue); hoveredSizeOverride = new Float2(size.X, hintPreviewSize.Y);
hoveredLocationOffset.Y -= borderMargin - hoveredMargin;
} }
else if (_rBottom.Contains(ref hintTestPoint)) else if (_rBottom.Contains(_toDock.PointFromScreen(_mouse)))
{ {
toSet = DockState.DockBottom; toSet = DockState.DockBottom;
hoveredHintControl = _dockHintDown; hoveredHintControl = _dockHintDown;
hoveredSizeOverride = new Float2(size.X, size.Y * DockPanel.DefaultSplitterValue); hoveredSizeOverride = new Float2(size.X, hintPreviewSize.Y);
hoveredLocationOffset.Y += borderMargin - hoveredMargin;
} }
else if (_rLeft.Contains(ref hintTestPoint)) else if (_rLeft.Contains(_toDock.PointFromScreen(_mouse)))
{ {
toSet = DockState.DockLeft; toSet = DockState.DockLeft;
hoveredHintControl = _dockHintLeft; hoveredHintControl = _dockHintLeft;
hoveredSizeOverride = new Float2(size.X * DockPanel.DefaultSplitterValue, size.Y); hoveredSizeOverride = new Float2(hintPreviewSize.X, size.Y);
hoveredLocationOffset.X -= borderMargin - hoveredMargin;
} }
else if (_rRight.Contains(ref hintTestPoint)) else if (_rRight.Contains(_toDock.PointFromScreen(_mouse)))
{ {
toSet = DockState.DockRight; toSet = DockState.DockRight;
hoveredHintControl = _dockHintRight; hoveredHintControl = _dockHintRight;
hoveredSizeOverride = new Float2(size.X * DockPanel.DefaultSplitterValue, size.Y); hoveredSizeOverride = new Float2(hintPreviewSize.X, size.Y);
hoveredLocationOffset.X += borderMargin - hoveredMargin;
} }
} }
if (showCenterHint && _rCenter.Contains(ref hintTestPoint)) if (showCenterHint && _rCenter.Contains(_toDock.PointFromScreen(_mouse)))
{ {
toSet = DockState.DockFill; toSet = DockState.DockFill;
hoveredHintControl = _dockHintCenter; hoveredHintControl = _dockHintCenter;
@@ -425,41 +375,38 @@ namespace FlaxEditor.GUI.Docking
// Update sizes and opacity of hint controls // Update sizes and opacity of hint controls
if (_toDock != null) if (_toDock != null)
{ {
var mainColor = Style.Current.Selection;
if (hoveredHintControl != _dockHintDown) if (hoveredHintControl != _dockHintDown)
{ {
_dockHintDown.Size = new Float2(HintControlSize); _dockHintDown.Size = new Float2(HintControlSize);
_dockHintDown.BackgroundColor = mainColor.AlphaMultiplied(0.6f); _dockHintDown.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
} }
if (hoveredHintControl != _dockHintLeft) if (hoveredHintControl != _dockHintLeft)
{ {
_dockHintLeft.Size = new Float2(HintControlSize); _dockHintLeft.Size = new Float2(HintControlSize);
_dockHintLeft.BackgroundColor = mainColor.AlphaMultiplied(0.6f); _dockHintLeft.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
} }
if (hoveredHintControl != _dockHintRight) if (hoveredHintControl != _dockHintRight)
{ {
_dockHintRight.Size = new Float2(HintControlSize); _dockHintRight.Size = new Float2(HintControlSize);
_dockHintRight.BackgroundColor = mainColor.AlphaMultiplied(0.6f); _dockHintRight.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
} }
if (hoveredHintControl != _dockHintUp) if (hoveredHintControl != _dockHintUp)
{ {
_dockHintUp.Size = new Float2(HintControlSize); _dockHintUp.Size = new Float2(HintControlSize);
_dockHintUp.BackgroundColor = mainColor.AlphaMultiplied(0.6f); _dockHintUp.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
} }
if (hoveredHintControl != _dockHintCenter) if (hoveredHintControl != _dockHintCenter)
{ {
_dockHintCenter.Size = new Float2(HintControlSize); _dockHintCenter.Size = new Float2(HintControlSize);
_dockHintCenter.BackgroundColor = mainColor.AlphaMultiplied(0.6f); _dockHintCenter.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
} }
if (_toSet != DockState.Float) if (_toSet != DockState.Float)
{ {
if (hoveredHintControl != null) if (hoveredHintControl != null)
{ {
hoveredHintControl.BackgroundColor = mainColor; hoveredHintControl.BackgroundColor = Style.Current.Selection.AlphaMultiplied(1.0f);
if (_toSet != prevToSet) hoveredHintControl.Size = hoveredSizeOverride;
hoveredHintControl.Location += hoveredLocationOffset;
hoveredHintControl.Size = hoveredSizeOverride - hoveredMargin;
} }
} }
} }
@@ -494,15 +441,13 @@ namespace FlaxEditor.GUI.Docking
private void OnUpdate() private void OnUpdate()
{ {
// If the engine lost focus during dragging, end the action var mousePos = Platform.MousePosition;
if (!Engine.HasFocus)
{ if (_mouse != mousePos)
Dispose(); OnMouseMove(mousePos);
return;
} }
var mousePos = Platform.MousePosition; private void OnMouseMove(Float2 mousePos)
if (_mouse != mousePos)
{ {
if (_dragSourceWindow != null) if (_dragSourceWindow != null)
_toMove.Window.Window.Position = mousePos - _dragOffset; _toMove.Window.Window.Position = mousePos - _dragOffset;
@@ -511,4 +456,3 @@ namespace FlaxEditor.GUI.Docking
} }
} }
} }
}

View File

@@ -242,15 +242,6 @@ namespace FlaxEditor.GUI
{ {
FieldInfo[] fields = type.GetFields(); FieldInfo[] fields = type.GetFields();
entries.Capacity = Mathf.Max(fields.Length - 1, entries.Capacity); entries.Capacity = Mathf.Max(fields.Length - 1, entries.Capacity);
if (formatMode == EnumDisplayAttribute.FormatMode.Default)
{
// Override display mode from enum itself
var attr = type.GetCustomAttribute<EnumDisplayAttribute>();
if (attr != null)
{
formatMode = attr.Mode;
}
}
for (int i = 0; i < fields.Length; i++) for (int i = 0; i < fields.Length; i++)
{ {
var field = fields[i]; var field = fields[i];

View File

@@ -15,7 +15,6 @@ namespace FlaxEditor.GUI.Input
public class ColorValueBox : Control public class ColorValueBox : Control
{ {
private bool _isMouseDown; private bool _isMouseDown;
private bool _linear;
/// <summary> /// <summary>
/// Delegate function used for the color picker events handling. /// Delegate function used for the color picker events handling.
@@ -102,7 +101,6 @@ namespace FlaxEditor.GUI.Input
public ColorValueBox() public ColorValueBox()
: base(0, 0, 32, 18) : base(0, 0, 32, 18)
{ {
_linear = !Graphics.GammaColorSpace;
} }
/// <summary> /// <summary>
@@ -115,7 +113,6 @@ namespace FlaxEditor.GUI.Input
: base(x, y, 32, 18) : base(x, y, 32, 18)
{ {
_value = value; _value = value;
_linear = !Graphics.GammaColorSpace;
} }
/// <summary> /// <summary>
@@ -132,10 +129,8 @@ namespace FlaxEditor.GUI.Input
{ {
base.Draw(); base.Draw();
var value = _value; bool isTransparent = _value.A < 1;
if (_linear)
value = value.ToSRgb();
var isTransparent = value.A < 1;
var style = Style.Current; var style = Style.Current;
var fullRect = new Rectangle(0, 0, Width, Height); var fullRect = new Rectangle(0, 0, Width, Height);
var colorRect = new Rectangle(0, 0, isTransparent ? Width * 0.7f : Width, Height); var colorRect = new Rectangle(0, 0, isTransparent ? Width * 0.7f : Width, Height);
@@ -162,10 +157,10 @@ namespace FlaxEditor.GUI.Input
} }
} }
} }
Render2D.FillRectangle(alphaRect, value); Render2D.FillRectangle(alphaRect, _value);
} }
Render2D.FillRectangle(colorRect, value with { A = 1 }); Render2D.FillRectangle(colorRect, _value with { A = 1 });
Render2D.DrawRectangle(fullRect, IsMouseOver || IsNavFocused ? style.BackgroundSelected : Color.Black); Render2D.DrawRectangle(fullRect, IsMouseOver || IsNavFocused ? style.BackgroundSelected : Color.Black);
} }

View File

@@ -99,11 +99,6 @@ namespace FlaxEditor.GUI.Input
/// </summary> /// </summary>
public event Action SlidingEnd; public event Action SlidingEnd;
/// <summary>
/// If enabled, pressing the arrow up or down key increments/ decrements the value.
/// </summary>
public bool ArrowKeysIncrement = true;
/// <summary> /// <summary>
/// Gets or sets the slider speed. Use value 0 to disable and hide slider UI. /// Gets or sets the slider speed. Use value 0 to disable and hide slider UI.
/// </summary> /// </summary>
@@ -244,27 +239,6 @@ namespace FlaxEditor.GUI.Input
ResetViewOffset(); ResetViewOffset();
} }
/// <inheritdoc />
public override bool OnKeyDown(KeyboardKeys key)
{
if (ArrowKeysIncrement && (key == KeyboardKeys.ArrowUp || key == KeyboardKeys.ArrowDown))
{
bool altDown = Root.GetKey(KeyboardKeys.Alt);
bool shiftDown = Root.GetKey(KeyboardKeys.Shift);
bool controlDown = Root.GetKey(KeyboardKeys.Control);
float deltaValue = altDown ? 0.1f : (shiftDown ? 10f : (controlDown ? 100f : 1f));
float slideDelta = key == KeyboardKeys.ArrowUp ? deltaValue : -deltaValue;
_startSlideValue = Value;
ApplySliding(slideDelta);
EndSliding();
Focus();
return true;
}
return base.OnKeyDown(key);
}
/// <inheritdoc /> /// <inheritdoc />
public override bool OnMouseDown(Float2 location, MouseButton button) public override bool OnMouseDown(Float2 location, MouseButton button)
{ {
@@ -322,7 +296,7 @@ namespace FlaxEditor.GUI.Input
#else #else
/// <inheritdoc /> /// <inheritdoc />
public override void OnMouseMoveRelative(Float2 motion) public override void OnMouseMoveRelative(Float2 mouseMotion)
{ {
var location = Root.TrackingMouseOffset; var location = Root.TrackingMouseOffset;
if (_isSliding) if (_isSliding)
@@ -344,7 +318,7 @@ namespace FlaxEditor.GUI.Input
_cursorChanged = false; _cursorChanged = false;
} }
base.OnMouseMoveRelative(motion); base.OnMouseMoveRelative(mouseMotion);
} }
#endif #endif

View File

@@ -59,12 +59,12 @@ namespace FlaxEditor.GUI
/// <summary> /// <summary>
/// Occurs when items gets clicked by the user. /// Occurs when items gets clicked by the user.
/// </summary> /// </summary>
public event Action<Item> ItemClicked; public event Action<Item> Clicked;
/// <summary> /// <summary>
/// Occurs when items gets focused. /// Occurs when items gets focused.
/// </summary> /// </summary>
public event Action<Item> ItemFocused; public event Action<Item> Focused;
/// <summary> /// <summary>
/// The tint color of the text. /// The tint color of the text.
@@ -203,7 +203,7 @@ namespace FlaxEditor.GUI
if (button == MouseButton.Left && _isMouseDown) if (button == MouseButton.Left && _isMouseDown)
{ {
_isMouseDown = false; _isMouseDown = false;
ItemClicked?.Invoke(this); Clicked?.Invoke(this);
} }
return base.OnMouseUp(location, button); return base.OnMouseUp(location, button);
@@ -222,7 +222,7 @@ namespace FlaxEditor.GUI
{ {
base.OnGotFocus(); base.OnGotFocus();
ItemFocused?.Invoke(this); Focused?.Invoke(this);
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -434,7 +434,7 @@ namespace FlaxEditor.GUI
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
public void AddItem(Item item) public void AddItem(Item item)
{ {
item.ItemClicked += OnClickItem; item.Clicked += OnClickItem;
ContainerControl parent = ItemsPanel; ContainerControl parent = ItemsPanel;
if (!string.IsNullOrEmpty(item.Category)) if (!string.IsNullOrEmpty(item.Category))
{ {

View File

@@ -447,8 +447,8 @@ namespace FlaxEditor.GUI.Tree
// Select previous parent child // Select previous parent child
var select = nodeParent.GetChild(myIndex - 1) as TreeNode; var select = nodeParent.GetChild(myIndex - 1) as TreeNode;
// Get bottom most child node // Select last child if is valid and expanded and has any children
while (select != null && select.IsExpanded && select.HasAnyVisibleChild) if (select != null && select.IsExpanded && select.HasAnyVisibleChild)
{ {
select = select.GetChild(select.ChildrenCount - 1) as TreeNode; select = select.GetChild(select.ChildrenCount - 1) as TreeNode;
} }

View File

@@ -1140,11 +1140,8 @@ namespace FlaxEditor.GUI.Tree
ParentTree.DraggedOverNode = this; ParentTree.DraggedOverNode = this;
// Expand node if mouse goes over arrow // Expand node if mouse goes over arrow
if (ArrowRect.Contains(location) && HasAnyVisibleChild && IsCollapsed) if (ArrowRect.Contains(location) && HasAnyVisibleChild)
{
Expand(true); Expand(true);
ParentTree?.FlushPendingPerformLayout();
}
result = OnDragEnterHeader(data); result = OnDragEnterHeader(data);
} }
@@ -1175,11 +1172,8 @@ namespace FlaxEditor.GUI.Tree
ParentTree.DraggedOverNode = this; ParentTree.DraggedOverNode = this;
// Expand node if mouse goes over arrow // Expand node if mouse goes over arrow
if (ArrowRect.Contains(location) && HasAnyVisibleChild && IsCollapsed) if (ArrowRect.Contains(location) && HasAnyVisibleChild)
{
Expand(true); Expand(true);
ParentTree?.FlushPendingPerformLayout();
}
if (!_isDragOverHeader) if (!_isDragOverHeader)
result = OnDragEnterHeader(data); result = OnDragEnterHeader(data);

View File

@@ -1,5 +1,8 @@
// Copyright (c) Wojciech Figat. All rights reserved. // Copyright (c) Wojciech Figat. All rights reserved.
using System;
using FlaxEditor.GUI.Docking;
using FlaxEditor.Options;
using FlaxEngine; using FlaxEngine;
using FlaxEngine.GUI; using FlaxEngine.GUI;

View File

@@ -13,7 +13,6 @@ namespace FlaxEditor.Gizmo
public abstract class GizmoBase public abstract class GizmoBase
{ {
private IGizmoOwner _owner; private IGizmoOwner _owner;
private bool _visible = true;
/// <summary> /// <summary>
/// Gets the gizmo owner. /// Gets the gizmo owner.
@@ -35,11 +34,6 @@ namespace FlaxEditor.Gizmo
/// </summary> /// </summary>
public virtual BoundingSphere FocusBounds => BoundingSphere.Empty; public virtual BoundingSphere FocusBounds => BoundingSphere.Empty;
/// <summary>
/// Gets or sets a value indicating whether this gizmo is visible.
/// </summary>
public bool Visible { get { return _visible; } set { _visible = value; } }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GizmoBase"/> class. /// Initializes a new instance of the <see cref="GizmoBase"/> class.
/// </summary> /// </summary>

View File

@@ -36,12 +36,11 @@ public sealed class ViewportRubberBandSelector
/// Triggers the start of a rubber band selection. /// Triggers the start of a rubber band selection.
/// </summary> /// </summary>
/// <returns>True if selection started, otherwise false.</returns> /// <returns>True if selection started, otherwise false.</returns>
public bool TryStartingRubberBandSelection(Float2 mousePosition) public bool TryStartingRubberBandSelection()
{ {
if (!_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown) if (!_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown)
{ {
_tryStartRubberBand = true; _tryStartRubberBand = true;
_cachedStartingMousePosition = mousePosition;
return true; return true;
} }
return false; return false;
@@ -83,16 +82,13 @@ public sealed class ViewportRubberBandSelector
return; return;
} }
if (_tryStartRubberBand && canStart) if (_tryStartRubberBand && (Mathf.Abs(_owner.MouseDelta.X) > 0.1f || Mathf.Abs(_owner.MouseDelta.Y) > 0.1f) && canStart)
{
var delta = mousePosition - _cachedStartingMousePosition;
if (Mathf.Abs(delta.X) > 0.1f || Mathf.Abs(delta.Y) > 0.1f)
{ {
_isRubberBandSpanning = true; _isRubberBandSpanning = true;
_cachedStartingMousePosition = mousePosition;
_rubberBandRect = new Rectangle(_cachedStartingMousePosition, Float2.Zero); _rubberBandRect = new Rectangle(_cachedStartingMousePosition, Float2.Zero);
_tryStartRubberBand = false; _tryStartRubberBand = false;
} }
}
else if (_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown) else if (_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown)
{ {
_rubberBandRect.Width = mousePosition.X - _cachedStartingMousePosition.X; _rubberBandRect.Width = mousePosition.X - _cachedStartingMousePosition.X;

Some files were not shown because too many files have changed in this diff Show More