Compare commits
365 Commits
c7326ea483
...
mac_change
| Author | SHA1 | Date | |
|---|---|---|---|
| fd5c50635c | |||
|
|
07f031e4c5 | ||
|
|
06c31a39f2 | ||
|
|
2a6e38e020 | ||
|
|
cc69e5d966 | ||
|
|
d68969dbe2 | ||
|
|
c4d20f06ee | ||
|
|
3c5c6f9883 | ||
|
|
8e7dc2a91e | ||
|
|
4ddbc8ba5c | ||
|
|
15f379e87f | ||
|
|
d4a7b3074e | ||
|
|
a3492e59ef | ||
|
|
515ad56fa2 | ||
|
|
ebd20dd816 | ||
|
|
019a9f6089 | ||
|
|
273b110db4 | ||
|
|
0bea701a83 | ||
|
|
ee22b9dc25 | ||
|
|
a1096aaf92 | ||
|
|
885ee15767 | ||
|
|
c978ab2b84 | ||
|
|
f045b5b6b6 | ||
|
|
c51a023e61 | ||
|
|
645df4fb06 | ||
|
|
b53028782f | ||
|
|
ef551c36ae | ||
|
|
e851efa0a8 | ||
| 0084bc051c | |||
|
|
9c8023d64f | ||
|
|
6d02f5d9da | ||
|
|
1f9f281c31 | ||
|
|
846b64048f | ||
|
|
55f73b6cf7 | ||
|
|
0f6c1aea62 | ||
|
|
d2ee61ef8d | ||
|
|
a1399c5157 | ||
|
|
7b7a92758f | ||
|
|
bd300651ec | ||
|
|
a2b0d0714e | ||
|
|
3d66316716 | ||
|
|
9c32f978fb | ||
|
|
ed5ad91a32 | ||
|
|
ecddb8aae5 | ||
|
|
a855b17cc0 | ||
|
|
27dd1bda25 | ||
|
|
4afd9fd8df | ||
|
|
73c19b278f | ||
|
|
b4cb1028ed | ||
|
|
4a7f1a5fde | ||
|
|
5d0fdc8313 | ||
|
|
70b324cdec | ||
|
|
20516bb8bc | ||
|
|
c18b9163ca | ||
|
|
db5b65beac | ||
|
|
78e5baf6a5 | ||
|
|
4833c19366 | ||
|
|
65fd22f5b6 | ||
|
|
f57df83d26 | ||
|
|
66894b71fa | ||
|
|
7e9ee0610a | ||
|
|
f733611213 | ||
|
|
780e78f056 | ||
|
|
4d447b7544 | ||
|
|
9a44902949 | ||
|
|
e84b5410ec | ||
|
|
9ac19cbd2f | ||
|
|
39a2bc2535 | ||
|
|
15771355cb | ||
|
|
f3111e855d | ||
|
|
3c6838ee35 | ||
|
|
36ab08e60d | ||
|
|
834c4553b2 | ||
|
|
5a95336601 | ||
|
|
f26fae2daf | ||
|
|
20df4289c2 | ||
|
|
217701ae05 | ||
|
|
f1509bab28 | ||
|
|
30fdd7336e | ||
|
|
3b120cc5a4 | ||
|
|
4cf0c38940 | ||
|
|
0f383d2fc6 | ||
| 483df22929 | |||
|
|
07f21a1520 | ||
| f870fc3ae2 | |||
|
|
bbb5354e9c | ||
|
|
21e2c830e5 | ||
|
|
c828c90161 | ||
|
|
f725f4c0b9 | ||
|
|
1535f95cf1 | ||
|
|
b1f85b7462 | ||
|
|
3a0af54f48 | ||
|
|
4e3e9386cc | ||
|
|
449fc597b5 | ||
|
|
0e91a2d25b | ||
|
|
aba995a42f | ||
|
|
bf0c7fe0dc | ||
|
|
2ab8b9dd55 | ||
|
|
e1ffdee57a | ||
|
|
7c44767d4d | ||
|
|
87ccaa9dd8 | ||
|
|
e8c2f18a4d | ||
|
|
6b36543717 | ||
|
|
bb2a883dc7 | ||
|
|
be7e88de36 | ||
|
|
4a1490f0b1 | ||
|
|
e0d0acc33c | ||
|
|
e2f2d3e6f6 | ||
|
|
afc04dc41c | ||
|
|
bdfa503c05 | ||
|
|
205a8b2ebe | ||
|
|
d18c245730 | ||
|
|
e4eb064562 | ||
|
|
9fc9382e58 | ||
|
|
2bf9efaf30 | ||
|
|
528b4c89ce | ||
|
|
277dabc8b4 | ||
|
|
9a5bc444ba | ||
|
|
e834fc5a42 | ||
|
|
6b87985a44 | ||
|
|
a65a74b866 | ||
|
|
b2124201d5 | ||
|
|
29b8326042 | ||
|
|
81bfa6edc9 | ||
|
|
8ed6a92022 | ||
|
|
c9d16e16cc | ||
|
|
d9f9401c5a | ||
|
|
1e9918b9cc | ||
|
|
6c84b7a259 | ||
|
|
43b337e163 | ||
|
|
45306ca20e | ||
|
|
259d93f95c | ||
|
|
61b6aeb252 | ||
|
|
d694c35db4 | ||
|
|
f105d6f84f | ||
|
|
b1b6953200 | ||
|
|
fa428e343b | ||
|
|
dbbb67f398 | ||
|
|
a9bddfa784 | ||
|
|
f9b784a42a | ||
|
|
d47bd5d6e7 | ||
|
|
e1013aec94 | ||
|
|
1c294059df | ||
|
|
305296883d | ||
|
|
a7016d1186 | ||
|
|
004e02af73 | ||
|
|
143d714037 | ||
|
|
da8376bba1 | ||
|
|
f773a0755d | ||
|
|
d8343dae8e | ||
|
|
b09fbe2d9b | ||
|
|
6dbfd25bdb | ||
|
|
ecfd03f79c | ||
|
|
66a295d5af | ||
|
|
d7458d81a5 | ||
|
|
cc5e4c19e1 | ||
|
|
0c5cb59875 | ||
|
|
85ed0ecb06 | ||
|
|
95b9392f51 | ||
|
|
c7c1bbe35f | ||
|
|
192d3d1a8e | ||
|
|
877d57681d | ||
|
|
0a9bc084f4 | ||
|
|
ec4f8ce239 | ||
|
|
d049a16882 | ||
|
|
ee75cab73e | ||
|
|
0072e21ffa | ||
|
|
f44dde89db | ||
|
|
e6fd761b80 | ||
|
|
62a378e01a | ||
|
|
e67b705397 | ||
|
|
847f6411e7 | ||
|
|
0d7c04682d | ||
|
|
baf068330c | ||
|
|
593646061e | ||
|
|
9ac231c403 | ||
|
|
d2d7a871ce | ||
|
|
b172b08782 | ||
|
|
18778aa511 | ||
|
|
b7e32e13ab | ||
|
|
610c76578b | ||
|
|
e721fbd89f | ||
|
|
ff2c5290b5 | ||
|
|
2b4dc97a97 | ||
|
|
14842183f2 | ||
|
|
b4b13d8dd4 | ||
|
|
e3d1e8a5ea | ||
|
|
d9f90f726b | ||
|
|
e0062a6ff1 | ||
|
|
e494c9ec76 | ||
|
|
2501095500 | ||
|
|
3cfc5db54a | ||
|
|
840835fad2 | ||
|
|
41f136ce0f | ||
|
|
32cae3aacd | ||
|
|
832c524c3c | ||
|
|
a18ca9a4ad | ||
|
|
05e7e6630c | ||
|
|
788d8660b8 | ||
|
|
ab806b2a9b | ||
|
|
610ba00915 | ||
|
|
e60bd165f4 | ||
|
|
223d4f64eb | ||
|
|
827ad85651 | ||
|
|
69c5d65318 | ||
|
|
b834dddb11 | ||
|
|
baddfec6d1 | ||
|
|
fc2f56aca6 | ||
|
|
0364fd629b | ||
|
|
5dbaf3f94e | ||
|
|
c5b7ea9c44 | ||
|
|
7b856fdc95 | ||
|
|
890df65970 | ||
|
|
ab6dfca36e | ||
|
|
72bb2dd932 | ||
|
|
ca09852898 | ||
|
|
e21cb9154a | ||
|
|
af124ce163 | ||
|
|
c28381fb09 | ||
|
|
973ff0efa0 | ||
|
|
27896b6410 | ||
|
|
4bb9de21b4 | ||
|
|
890538c667 | ||
|
|
4b9fa0dcf5 | ||
|
|
14d1b7dd24 | ||
|
|
6788844270 | ||
|
|
b2f2537338 | ||
|
|
450b998a29 | ||
|
|
688d9c77cb | ||
|
|
d71ea5a72b | ||
|
|
01e3ece2af | ||
|
|
afc65f7557 | ||
|
|
d60484b917 | ||
| feceb4e00f | |||
| 67b33a575a | |||
|
|
76b869146d | ||
|
|
32e725392b | ||
|
|
0975ac2a25 | ||
|
|
cf3bcc4549 | ||
|
|
11ea889fa9 | ||
|
|
c5a28a5734 | ||
|
|
6c79a17c7a | ||
|
|
b24d98df9e | ||
|
|
400e2f1b0e | ||
|
|
22e6139ca3 | ||
|
|
859fa16a74 | ||
|
|
8facb46def | ||
|
|
b87f8b96e1 | ||
|
|
37df16a3e4 | ||
|
|
ce45fa3d54 | ||
|
|
7f56d9456b | ||
|
|
1cad2489a3 | ||
|
|
7cdc2456cd | ||
|
|
6b0ee3eeed | ||
|
|
57330e39ca | ||
|
|
af29f2f3dc | ||
|
|
1bdb577b60 | ||
|
|
329ea1c9b4 | ||
|
|
728da6354f | ||
|
|
d5456d6eb3 | ||
|
|
e65714988f | ||
|
|
4e4df736f9 | ||
|
|
5bfe5b0035 | ||
|
|
b30553ea65 | ||
|
|
2550763808 | ||
|
|
6f6dd2f4a3 | ||
|
|
c30d457b1c | ||
|
|
b786fa1c22 | ||
|
|
bbcbe305a8 | ||
|
|
222df16f11 | ||
|
|
8b924d13c1 | ||
|
|
66e25c81b0 | ||
|
|
e12f99ee53 | ||
|
|
387f0cf457 | ||
|
|
f11acdf5db | ||
|
|
3af7dddcc2 | ||
|
|
543e2ecd13 | ||
| 35f8051a62 | |||
| 4453453d46 | |||
|
|
23f5f4d85f | ||
|
|
90a21696f6 | ||
|
|
fa38f0ac91 | ||
| e3f5af530b | |||
|
|
38d8832468 | ||
|
|
c68aa3b371 | ||
| d031649bbd | |||
| 21b8d1838d | |||
| c8ee2fc155 | |||
|
|
dc22fa4061 | ||
| 3eb690fe58 | |||
| 52e2327527 | |||
| f95cbb0e52 | |||
| 518a19c857 | |||
| c0b54be692 | |||
|
|
c2c92eba82 | ||
| d64c28f672 | |||
| 2a959d0531 | |||
|
|
4504d0ae96 | ||
| f14ba6ace6 | |||
| 518f9dc9dc | |||
| 8db29a30e0 | |||
|
|
0e76585709 | ||
|
|
8bf51512ac | ||
|
|
779e8e7169 | ||
|
|
3c8b80152b | ||
|
|
f280412ef4 | ||
| 1327fa40cb | |||
| b70ab01308 | |||
| ae03bc2dd2 | |||
| 5cd27032b4 | |||
| 7445064d97 | |||
|
|
e47fc5a54a | ||
|
|
26e24769be | ||
|
|
394860656a | ||
|
|
b07d74d28d | ||
|
|
dacb3b0891 | ||
|
|
a8db0086b1 | ||
|
|
e46b6d5b06 | ||
|
|
dfc8c1fac2 | ||
|
|
f8de118288 | ||
|
|
887311d1f1 | ||
|
|
f8e4f54c77 | ||
| ea20dc6da0 | |||
| 9becddd84f | |||
| b08c765400 | |||
| afd59d7eb3 | |||
| 47cdd0582c | |||
| af54d04f9d | |||
| 1d2b3bc858 | |||
| 4b552563be | |||
| ebd929176c | |||
| 430e685a7c | |||
| d5bd857c45 | |||
| b8b9ba3069 | |||
| 84c79d5192 | |||
| 028f3a7871 | |||
| 0c462315f0 | |||
| 26261a2090 | |||
|
|
b5de4d78ad | ||
|
|
0913e6f738 | ||
|
|
99c26ff9af | ||
|
|
a2d91d989d | ||
|
|
881154e9f4 | ||
|
|
5ec2476aec | ||
|
|
79351f0c4d | ||
|
|
25744986a3 | ||
|
|
48100cf9fc | ||
|
|
76f0768b99 | ||
|
|
b2b855200f | ||
|
|
241a8bc764 | ||
|
|
13dd80d429 | ||
|
|
6e9902a966 | ||
|
|
fd1e0a4e80 | ||
|
|
b130b81863 | ||
|
|
b38a7e6eb2 | ||
|
|
4f3f1cd163 | ||
|
|
4d77646f26 | ||
|
|
187592b673 | ||
|
|
215467ae42 | ||
|
|
facd7d39dc | ||
|
|
6810e5f2a4 | ||
|
|
ee6fae8956 | ||
|
|
bb6c3233d2 | ||
|
|
499228cc98 | ||
|
|
f2699892e0 |
3
.github/workflows/build_linux.yml
vendored
3
.github/workflows/build_linux.yml
vendored
@@ -16,7 +16,8 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
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 update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
|
||||
- name: Setup Vulkan
|
||||
uses: ./.github/actions/vulkan
|
||||
- name: Setup .NET
|
||||
|
||||
6
.github/workflows/cd.yml
vendored
6
.github/workflows/cd.yml
vendored
@@ -87,7 +87,8 @@ jobs:
|
||||
git ${{ env.GIT_LFS_PULL_OPTIONS }} lfs pull
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
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 update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
|
||||
- name: Setup Vulkan
|
||||
uses: ./.github/actions/vulkan
|
||||
- name: Setup .NET
|
||||
@@ -118,7 +119,8 @@ jobs:
|
||||
git ${{ env.GIT_LFS_PULL_OPTIONS }} lfs pull
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
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 update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev
|
||||
- name: Setup Vulkan
|
||||
uses: ./.github/actions/vulkan
|
||||
- name: Setup .NET
|
||||
|
||||
3
.github/workflows/tests.yml
vendored
3
.github/workflows/tests.yml
vendored
@@ -28,7 +28,8 @@ jobs:
|
||||
git lfs pull
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
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 update
|
||||
sudo apt-get install -y --fix-missing libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev libwayland-dev
|
||||
- name: Build
|
||||
run: |
|
||||
./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs -dotnet=8
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,8 +4,8 @@
|
||||
#define MAX_LOCAL_LIGHTS 4
|
||||
@1// Forward Shading: Includes
|
||||
#include "./Flax/LightingCommon.hlsl"
|
||||
#if USE_REFLECTIONS
|
||||
#include "./Flax/ReflectionsCommon.hlsl"
|
||||
#if USE_REFLECTIONS
|
||||
#define MATERIAL_REFLECTIONS_SSR 1
|
||||
#if MATERIAL_REFLECTIONS == MATERIAL_REFLECTIONS_SSR
|
||||
#include "./Flax/SSR.hlsl"
|
||||
@@ -14,11 +14,13 @@
|
||||
#include "./Flax/Lighting.hlsl"
|
||||
#include "./Flax/ShadowsSampling.hlsl"
|
||||
#include "./Flax/ExponentialHeightFog.hlsl"
|
||||
#include "./Flax/VolumetricFog.hlsl"
|
||||
@2// Forward Shading: Constants
|
||||
LightData DirectionalLight;
|
||||
LightData SkyLight;
|
||||
ProbeData EnvironmentProbe;
|
||||
EnvProbeData EnvironmentProbe;
|
||||
ExponentialHeightFogData ExponentialHeightFog;
|
||||
VolumetricFogData VolumetricFog;
|
||||
float3 Dummy2;
|
||||
uint LocalLightsCount;
|
||||
LightData LocalLights[MAX_LOCAL_LIGHTS];
|
||||
@@ -28,12 +30,14 @@ TextureCube SkyLightTexture : register(t__SRV__);
|
||||
Buffer<float4> ShadowsBuffer : register(t__SRV__);
|
||||
Texture2D<float> ShadowMap : register(t__SRV__);
|
||||
Texture3D VolumetricFogTexture : register(t__SRV__);
|
||||
Texture2D PreIntegratedGF : register(t__SRV__);
|
||||
@4// Forward Shading: Utilities
|
||||
// Public accessors for lighting data, use them as data binding might change but those methods will remain.
|
||||
LightData GetDirectionalLight() { return DirectionalLight; }
|
||||
LightData GetSkyLight() { return SkyLight; }
|
||||
ProbeData GetEnvironmentProbe() { return EnvironmentProbe; }
|
||||
EnvProbeData GetEnvironmentProbe() { return EnvironmentProbe; }
|
||||
ExponentialHeightFogData GetExponentialHeightFog() { return ExponentialHeightFog; }
|
||||
VolumetricFogData GetVolumetricFog() { return VolumetricFog; }
|
||||
uint GetLocalLightsCount() { return LocalLightsCount; }
|
||||
LightData GetLocalLight(uint i) { return LocalLights[i]; }
|
||||
@5// Forward Shading: Shaders
|
||||
@@ -108,7 +112,8 @@ void PS_Forward(
|
||||
|
||||
// Calculate reflections
|
||||
#if USE_REFLECTIONS
|
||||
float3 reflections = SampleReflectionProbe(ViewPos, EnvProbe, EnvironmentProbe, gBuffer.WorldPos, gBuffer.Normal, gBuffer.Roughness).rgb;
|
||||
float4 reflections = SampleReflectionProbe(ViewPos, EnvProbe, EnvironmentProbe, gBuffer.WorldPos, gBuffer.Normal, gBuffer.Roughness);
|
||||
reflections.rgb *= reflections.a;
|
||||
|
||||
#if MATERIAL_REFLECTIONS == MATERIAL_REFLECTIONS_SSR
|
||||
// Screen Space Reflections
|
||||
@@ -116,7 +121,7 @@ void PS_Forward(
|
||||
Texture2D sceneColorTexture = MATERIAL_REFLECTIONS_SSR_COLOR;
|
||||
float2 screenUV = materialInput.SvPosition.xy * ScreenSize.zw;
|
||||
float stepSize = ScreenSize.z; // 1 / screenWidth
|
||||
float maxSamples = 48;
|
||||
float maxSamples = 50;
|
||||
float worldAntiSelfOcclusionBias = 0.1f;
|
||||
float brdfBias = 0.82f;
|
||||
float drawDistance = 5000.0f;
|
||||
@@ -124,7 +129,7 @@ void PS_Forward(
|
||||
if (hit.z > 0)
|
||||
{
|
||||
float3 screenColor = sceneColorTexture.SampleLevel(SamplerPointClamp, hit.xy, 0).rgb;
|
||||
reflections = lerp(reflections, screenColor, hit.z);
|
||||
reflections.rgb = lerp(reflections.rgb, screenColor, hit.z);
|
||||
}
|
||||
|
||||
// Fallback to software tracing if possible
|
||||
@@ -136,17 +141,17 @@ void PS_Forward(
|
||||
if (TraceSDFSoftwareReflections(gBuffer, reflectWS, surfaceAtlas))
|
||||
{
|
||||
float3 screenColor = sceneColorTexture.SampleLevel(SamplerPointClamp, hit.xy, 0).rgb;
|
||||
reflections = lerp(surfaceAtlas, float4(screenColor, 1), hit.z);
|
||||
reflections.rgb = lerp(surfaceAtlas, float4(screenColor, 1), hit.z);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
light.rgb += reflections * GetReflectionSpecularLighting(ViewPos, gBuffer) * light.a;
|
||||
light.rgb += reflections.rgb * GetReflectionSpecularLighting(PreIntegratedGF, ViewPos, gBuffer);
|
||||
#endif
|
||||
|
||||
// Add lighting (apply ambient occlusion)
|
||||
output.rgb += light.rgb * gBuffer.AO;
|
||||
// Add lighting
|
||||
output.rgb += light.rgb;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -158,17 +163,13 @@ void PS_Forward(
|
||||
#else
|
||||
float fogSceneDistance = gBuffer.ViewPos.z;
|
||||
#endif
|
||||
float4 fog = GetExponentialHeightFog(ExponentialHeightFog, materialInput.WorldPosition, ViewPos, 0, fogSceneDistance);
|
||||
|
||||
float fogSkipDistance = max(ExponentialHeightFog.VolumetricFogMaxDistance - 100, 0);
|
||||
float4 fog = GetExponentialHeightFog(ExponentialHeightFog, materialInput.WorldPosition, ViewPos, fogSkipDistance, fogSceneDistance);
|
||||
if (ExponentialHeightFog.VolumetricFogMaxDistance > 0)
|
||||
{
|
||||
// Sample volumetric fog and mix it in
|
||||
float2 screenUV = materialInput.SvPosition.xy * ScreenSize.zw;
|
||||
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);
|
||||
float4 volumetricFog = SampleVolumetricFog(VolumetricFogTexture, VolumetricFog, materialInput.WorldPosition - ViewPos, screenUV, TemporalAAJitter);
|
||||
fog = CombineVolumetricFog(fog, volumetricFog);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ struct VertexOutput
|
||||
#endif
|
||||
float4 ClipExtents : TEXCOORD3;
|
||||
float2 ClipOrigin : TEXCOORD4;
|
||||
float2 CustomData : TEXCOORD5; // x-per-geometry type, y-features mask
|
||||
#if USE_CUSTOM_VERTEX_INTERPOLATORS
|
||||
float4 CustomVSToPS[CUSTOM_VERTEX_INTERPOLATORS_COUNT] : TEXCOORD9;
|
||||
#endif
|
||||
@@ -55,6 +56,7 @@ struct PixelInput
|
||||
#endif
|
||||
float4 ClipExtents : TEXCOORD3;
|
||||
float2 ClipOrigin : TEXCOORD4;
|
||||
float2 CustomData : TEXCOORD5; // x-per-geometry type, y-features mask
|
||||
#if USE_CUSTOM_VERTEX_INTERPOLATORS
|
||||
float4 CustomVSToPS[CUSTOM_VERTEX_INTERPOLATORS_COUNT] : TEXCOORD9;
|
||||
#endif
|
||||
@@ -67,6 +69,7 @@ struct MaterialInput
|
||||
float3 WorldPosition;
|
||||
float TwoSidedSign;
|
||||
float2 TexCoord;
|
||||
float2 CustomData; // x-per-geometry type, y-features mask
|
||||
#if USE_VERTEX_COLOR
|
||||
half4 VertexColor;
|
||||
#endif
|
||||
@@ -84,6 +87,7 @@ MaterialInput GetMaterialInput(Render2DVertex input, VertexOutput output)
|
||||
MaterialInput result;
|
||||
result.WorldPosition = output.WorldPosition;
|
||||
result.TexCoord = output.TexCoord;
|
||||
result.CustomData = input.CustomDataAndClipOrigin.xy;
|
||||
#if USE_VERTEX_COLOR
|
||||
result.VertexColor = output.VertexColor;
|
||||
#endif
|
||||
@@ -103,6 +107,7 @@ MaterialInput GetMaterialInput(PixelInput input)
|
||||
MaterialInput result;
|
||||
result.WorldPosition = input.WorldPosition;
|
||||
result.TexCoord = input.TexCoord;
|
||||
result.CustomData = input.CustomData;
|
||||
#if USE_VERTEX_COLOR
|
||||
result.VertexColor = input.VertexColor;
|
||||
#endif
|
||||
@@ -229,6 +234,7 @@ VertexOutput VS_GUI(Render2DVertex input)
|
||||
#if USE_VERTEX_COLOR
|
||||
output.VertexColor = input.Color;
|
||||
#endif
|
||||
output.CustomData = input.CustomDataAndClipOrigin.xy;
|
||||
output.ClipOrigin = input.CustomDataAndClipOrigin.zw;
|
||||
output.ClipExtents = input.ClipExtents;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "./Flax/Common.hlsl"
|
||||
#include "./Flax/MaterialCommon.hlsl"
|
||||
#include "./Flax/GBufferCommon.hlsl"
|
||||
#include "./Flax/VolumetricFog.hlsl"
|
||||
@7
|
||||
|
||||
// Primary constant buffer (with additional material parameters)
|
||||
@@ -21,6 +22,7 @@ float Dummy0;
|
||||
float VolumetricFogMaxDistance;
|
||||
int ParticleStride;
|
||||
int ParticleIndex;
|
||||
float4 GridSliceParameters;
|
||||
@1META_CB_END
|
||||
|
||||
// Particles attributes buffer
|
||||
@@ -202,19 +204,19 @@ Material GetMaterialPS(MaterialInput input)
|
||||
META_PS(true, FEATURE_LEVEL_SM5)
|
||||
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);
|
||||
float3 cellOffset = 0.5f;
|
||||
float2 volumeUV = (gridCoordinate.xy + cellOffset.xy) / GridSize.xy;
|
||||
float zSlice = gridCoordinate.z + cellOffset.z;
|
||||
float sceneDepth = (zSlice / GridSize.z) * VolumetricFogMaxDistance / ViewFar;
|
||||
float sceneDepth = GetDepthFromSlice(GridSliceParameters, gridCoordinate.z + cellOffset.z) / ViewFar;
|
||||
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 wsPos = mul(clipPos, InverseViewProjectionMatrix);
|
||||
float3 positionWS = wsPos.xyz / wsPos.w;
|
||||
wsPos.xyz /= wsPos.w;
|
||||
|
||||
// Get material parameters
|
||||
MaterialInput materialInput = (MaterialInput)0;
|
||||
materialInput.WorldPosition = positionWS;
|
||||
materialInput.WorldPosition = wsPos.xyz;
|
||||
materialInput.TexCoord = input.Vertex.TexCoord;
|
||||
materialInput.ParticleIndex = ParticleIndex;
|
||||
materialInput.TBN = float3x3(float3(1, 0, 0), float3(0, 1, 0), float3(0, 0, 1));
|
||||
@@ -225,9 +227,10 @@ void PS_VolumetricFog(Quad_GS2PS input, out float4 VBufferA : SV_Target0, out fl
|
||||
Material material = GetMaterialPS(materialInput);
|
||||
|
||||
// Compute fog properties
|
||||
material.Opacity *= material.Mask;
|
||||
float3 albedo = material.Color;
|
||||
float extinction = material.Opacity * material.Mask * 0.001f;
|
||||
float3 emission = material.Emissive;
|
||||
float extinction = material.Opacity * 0.001f;
|
||||
float3 emission = material.Emissive * material.Opacity;
|
||||
float3 scattering = albedo * extinction;
|
||||
float absorption = max(0.0f, extinction - Luminance(scattering));
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/Fog.flax
LFS
BIN
Content/Shaders/Fog.flax
LFS
Binary file not shown.
BIN
Content/Shaders/GI/DDGI.flax
LFS
BIN
Content/Shaders/GI/DDGI.flax
LFS
Binary file not shown.
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0f34bf867df5f4296ca66ac691c2bca4efa168fb9e21ca4e613e8086669575cf
|
||||
size 13296
|
||||
oid sha256:615dff65b01507be6c4de722e126324aba20fc197f8e12dafaa94a05e46cba6e
|
||||
size 13222
|
||||
|
||||
BIN
Content/Shaders/GUI.flax
LFS
BIN
Content/Shaders/GUI.flax
LFS
Binary file not shown.
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:064f54786958f109222c49cbc0358ff4f345b30010fcd5e8cc1fab7bdc68c4fe
|
||||
size 13349
|
||||
oid sha256:1f07ebb16820897e8598ae7a0627cb75b3d28e9dceea3ad4bd9ff543d5cdd01c
|
||||
size 13979
|
||||
|
||||
BIN
Content/Shaders/Histogram.flax
LFS
BIN
Content/Shaders/Histogram.flax
LFS
Binary file not shown.
BIN
Content/Shaders/Lights.flax
LFS
BIN
Content/Shaders/Lights.flax
LFS
Binary file not shown.
BIN
Content/Shaders/MultiScaler.flax
LFS
BIN
Content/Shaders/MultiScaler.flax
LFS
Binary file not shown.
Binary file not shown.
BIN
Content/Shaders/Reflections.flax
LFS
BIN
Content/Shaders/Reflections.flax
LFS
Binary file not shown.
BIN
Content/Shaders/SSAO.flax
LFS
BIN
Content/Shaders/SSAO.flax
LFS
Binary file not shown.
BIN
Content/Shaders/SSR.flax
LFS
BIN
Content/Shaders/SSR.flax
LFS
Binary file not shown.
BIN
Content/Shaders/Sky.flax
LFS
BIN
Content/Shaders/Sky.flax
LFS
Binary file not shown.
BIN
Content/Shaders/TAA.flax
LFS
BIN
Content/Shaders/TAA.flax
LFS
Binary file not shown.
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:872ac3560279bfd0aeb989ebac1b49750dd142b985bc40058888dfd2b63fe9b2
|
||||
size 13214
|
||||
oid sha256:706adde844360c2b0e65ecabaf1d2e2cc4eb4ac7ca9d483d0dd04ec8163b3d97
|
||||
size 13081
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
"Name": "Flax",
|
||||
"Version": {
|
||||
"Major": 1,
|
||||
"Minor": 11,
|
||||
"Minor": 12,
|
||||
"Revision": 0,
|
||||
"Build": 6805
|
||||
"Build": 6905
|
||||
},
|
||||
"Company": "Flax",
|
||||
"Copyright": "Copyright (c) 2012-2025 Wojciech Figat. All rights reserved.",
|
||||
"Copyright": "Copyright (c) 2012-2026 Wojciech Figat. All rights reserved.",
|
||||
"GameTarget": "FlaxGame",
|
||||
"EditorTarget": "FlaxEditor",
|
||||
"Configuration": {
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
<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: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/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>
|
||||
|
||||
@@ -12,6 +12,6 @@ cd "`dirname "$0"`"
|
||||
bash ./Development/Scripts/Mac/CallBuildTool.sh --genproject "$@"
|
||||
|
||||
# Build bindings for all editor configurations
|
||||
echo Building C# bindings...
|
||||
#echo Building C# bindings...
|
||||
# TODO: Detect the correct architecture here
|
||||
Binaries/Tools/Flax.Build -build -BuildBindingsOnly -arch=ARM64 -platform=Mac --buildTargets=FlaxEditor
|
||||
#Binaries/Tools/Flax.Build -build -BuildBindingsOnly -arch=ARM64 -platform=Mac --buildTargets=FlaxEditor
|
||||
|
||||
@@ -187,6 +187,11 @@ namespace FlaxEditor.Content.Import
|
||||
// Glossiness, metalness, ambient occlusion, displacement, height, cavity or specular
|
||||
_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)
|
||||
Editor.TryRestoreImportOptions(ref _settings.Settings, ResultUrl);
|
||||
|
||||
@@ -21,10 +21,12 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
|
||||
if (Values.HasDifferentTypes == false)
|
||||
{
|
||||
var group = layout.Group("Bake");
|
||||
var group = layout.Group("Probe");
|
||||
group.Panel.ItemsMargin = new Margin(Utilities.Constants.UIMargin * 2);
|
||||
_bake = group.Button("Bake").Button;
|
||||
_bake.Clicked += BakeButtonClicked;
|
||||
var view = group.Button("View", "Opens the probe texture viewer");
|
||||
view.Button.Clicked += OnViewButtonClicked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +52,14 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
filesCount += files.Length;
|
||||
foreach (var file in files)
|
||||
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;
|
||||
foreach (var file in files)
|
||||
FindNewKeysCpp(file, newKeys, allKeys);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using FlaxEditor.CustomEditors.GUI;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -909,7 +909,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
settingsButton.Tag = script;
|
||||
settingsButton.Clicked += OnSettingsButtonClicked;
|
||||
|
||||
group.Panel.HeaderTextMargin = new Margin(scriptDrag.Right - 12, 15, 2, 2);
|
||||
// Adjust margin to not overlap with other ui elements in the header
|
||||
group.Panel.HeaderTextMargin = group.Panel.HeaderTextMargin with { Left = scriptDrag.Right - 12, Right = settingsButton.Width + Utilities.Constants.UIMargin };
|
||||
group.Object(values, editor);
|
||||
// Remove drop down arrows and containment lines if no objects in the group
|
||||
if (group.Children.Count == 0)
|
||||
|
||||
@@ -450,6 +450,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
protected bool NotNullItems;
|
||||
|
||||
private IntValueBox _sizeBox;
|
||||
private Label _label;
|
||||
private Color _background;
|
||||
private int _elementsCount, _minCount, _maxCount;
|
||||
private bool _readOnly;
|
||||
@@ -566,7 +567,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
Parent = dropPanel,
|
||||
};
|
||||
|
||||
var label = new Label
|
||||
_label = new Label
|
||||
{
|
||||
Text = "Size",
|
||||
AnchorPreset = AnchorPresets.TopRight,
|
||||
@@ -592,11 +593,12 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
panel.Panel.Offsets = new Margin(7, 7, 0, 0);
|
||||
panel.Panel.BackgroundColor = _background;
|
||||
var elementType = ElementType;
|
||||
var bindingAttr = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public;
|
||||
bool single = elementType.IsPrimitive ||
|
||||
elementType.Equals(new ScriptType(typeof(string))) ||
|
||||
elementType.IsEnum ||
|
||||
(elementType.GetFields().Length == 1 && elementType.GetProperties().Length == 0) ||
|
||||
(elementType.GetProperties().Length == 1 && elementType.GetFields().Length == 0) ||
|
||||
(elementType.GetFields(bindingAttr).Length == 1 && elementType.GetProperties(bindingAttr).Length == 0) ||
|
||||
(elementType.GetProperties(bindingAttr).Length == 1 && elementType.GetFields(bindingAttr).Length == 0) ||
|
||||
elementType.Equals(new ScriptType(typeof(JsonAsset))) ||
|
||||
elementType.Equals(new ScriptType(typeof(SettingsBase)));
|
||||
if (_cachedDropPanels == null)
|
||||
@@ -672,8 +674,10 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
Resize(Count + 1);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Layout.ContainerControl.SizeChanged += OnLayoutSizeChanged;
|
||||
}
|
||||
|
||||
private void OnSetupContextMenu(ContextMenu menu, DropPanel panel)
|
||||
{
|
||||
if (menu.Items.Any(x => x is ContextMenuButton b && b.Text.Equals("Open All", StringComparison.Ordinal)))
|
||||
@@ -696,10 +700,24 @@ 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 />
|
||||
protected override void Deinitialize()
|
||||
{
|
||||
_sizeBox = null;
|
||||
Layout.ContainerControl.SizeChanged -= OnLayoutSizeChanged;
|
||||
|
||||
base.Deinitialize();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
return inputEvent;
|
||||
if (Values[0] is string str)
|
||||
return str;
|
||||
if (Values.Type.Type == typeof(InputEvent))
|
||||
return new InputEvent();
|
||||
if (Values.Type.Type == typeof(string))
|
||||
return string.Empty;
|
||||
return null;
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace FlaxEditor.CustomEditors.Elements
|
||||
{
|
||||
var style = Style.Current;
|
||||
var settingsButtonSize = Panel.HeaderHeight;
|
||||
return new Image
|
||||
Panel.HeaderTextMargin = Panel.HeaderTextMargin with { Right = settingsButtonSize + Utilities.Constants.UIMargin };
|
||||
; return new Image
|
||||
{
|
||||
TooltipText = "Settings",
|
||||
AutoFocus = true,
|
||||
|
||||
@@ -23,6 +23,7 @@ using FlaxEngine.Assertions;
|
||||
using FlaxEngine.GUI;
|
||||
using FlaxEngine.Interop;
|
||||
using FlaxEngine.Json;
|
||||
using FlaxEngine.Utilities;
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
@@ -1370,7 +1371,7 @@ namespace FlaxEditor
|
||||
public void BuildCSG()
|
||||
{
|
||||
var scenes = Level.Scenes;
|
||||
scenes.ToList().ForEach(x => x.BuildCSG(0));
|
||||
scenes.ForEach(x => x.BuildCSG(0));
|
||||
Scene.MarkSceneEdited(scenes);
|
||||
}
|
||||
|
||||
@@ -1380,7 +1381,7 @@ namespace FlaxEditor
|
||||
public void BuildNavMesh()
|
||||
{
|
||||
var scenes = Level.Scenes;
|
||||
scenes.ToList().ForEach(x => Navigation.BuildNavMesh(x, 0));
|
||||
Navigation.BuildNavMesh();
|
||||
Scene.MarkSceneEdited(scenes);
|
||||
}
|
||||
|
||||
|
||||
@@ -502,6 +502,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
if (base.OnKeyDown(key))
|
||||
return true;
|
||||
|
||||
// Keyboard navigation around the menu
|
||||
switch (key)
|
||||
{
|
||||
case KeyboardKeys.ArrowDown:
|
||||
@@ -526,6 +527,20 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -75,6 +75,11 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// </summary>
|
||||
public bool HasChildCMOpened => _childCM != null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent context menu (if exists).
|
||||
/// </summary>
|
||||
public ContextMenuBase ParentCM => _parentCM;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the topmost context menu.
|
||||
/// </summary>
|
||||
@@ -84,9 +89,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
{
|
||||
var cm = this;
|
||||
while (cm._parentCM != null && cm._isSubMenu)
|
||||
{
|
||||
cm = cm._parentCM;
|
||||
}
|
||||
return cm;
|
||||
}
|
||||
}
|
||||
@@ -111,6 +114,11 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
/// </summary>
|
||||
public bool UseInput = true;
|
||||
|
||||
/// <summary>
|
||||
/// Optional flag that can disable UI navigation (tab/enter).
|
||||
/// </summary>
|
||||
public bool UseNavigation = true;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContextMenuBase"/> class.
|
||||
/// </summary>
|
||||
@@ -271,7 +279,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
_window.GotFocus += OnWindowGotFocus;
|
||||
_window.LostFocus += OnWindowLostFocus;
|
||||
}
|
||||
|
||||
|
||||
#if USE_IS_FOREGROUND && USE_SDL_WORKAROUNDS
|
||||
// The focus between popup and parent windows doesn't change, force hide the popup when clicked on parent
|
||||
parentWin.Window.MouseDown += OnWindowMouseDown;
|
||||
@@ -622,6 +630,21 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
case KeyboardKeys.Escape:
|
||||
Hide();
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
CloseMenuOnClick = false;
|
||||
}
|
||||
|
||||
private void ShowChild(ContextMenu parentContextMenu)
|
||||
internal void ShowChild(ContextMenu parentContextMenu)
|
||||
{
|
||||
// Hide parent CM popups and set itself as child
|
||||
var vAlign = parentContextMenu.ItemsAreaMargin.Top;
|
||||
|
||||
@@ -522,6 +522,16 @@ namespace FlaxEditor.GUI
|
||||
cm.AddButton("Show whole curve", _editor.ShowWholeCurve);
|
||||
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);
|
||||
cm.Show(this, location);
|
||||
}
|
||||
@@ -619,6 +629,33 @@ 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 />
|
||||
public override void OnKeyframesDeselect(IKeyframesEditor editor)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,48 @@ namespace FlaxEditor.GUI
|
||||
/// <seealso cref="CurveEditorBase" />
|
||||
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 CustomEditorPresenter _presenter;
|
||||
@@ -26,11 +68,12 @@ namespace FlaxEditor.GUI
|
||||
private List<int> _keyframeIndices;
|
||||
private bool _isDirty;
|
||||
|
||||
public Popup(CurveEditor<T> editor, object[] selection, List<int> keyframeIndices = null, float height = 140.0f)
|
||||
: this(editor, height)
|
||||
public Popup(CurveEditor<T> editor, object[] selection, List<int> keyframeIndices = null, float maxHeight = 140.0f)
|
||||
: this(editor, maxHeight)
|
||||
{
|
||||
_presenter.Select(selection);
|
||||
_presenter.OpenAllGroups();
|
||||
Size = new Float2(Size.X, Mathf.Min(_presenter.ContainerControl.Size.Y, maxHeight));
|
||||
_keyframeIndices = keyframeIndices;
|
||||
if (keyframeIndices != null && selection.Length != keyframeIndices.Count)
|
||||
throw new Exception();
|
||||
@@ -169,7 +212,7 @@ namespace FlaxEditor.GUI
|
||||
if (IsSelected)
|
||||
color = Editor.ContainsFocus ? style.SelectionBorder : Color.Lerp(style.ForegroundDisabled, style.SelectionBorder, 0.4f);
|
||||
if (IsMouseOver)
|
||||
color *= 1.1f;
|
||||
color *= 1.5f;
|
||||
Render2D.FillRectangle(rect, color);
|
||||
}
|
||||
|
||||
@@ -285,7 +328,7 @@ namespace FlaxEditor.GUI
|
||||
/// <summary>
|
||||
/// The keyframes size.
|
||||
/// </summary>
|
||||
protected static readonly Float2 KeyframesSize = new Float2(7.0f);
|
||||
protected static readonly Float2 KeyframesSize = new Float2(8.0f);
|
||||
|
||||
/// <summary>
|
||||
/// The colors for the keyframe points.
|
||||
@@ -326,6 +369,63 @@ namespace FlaxEditor.GUI
|
||||
private Color _labelsColor;
|
||||
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>
|
||||
/// The keyframe UI points.
|
||||
/// </summary>
|
||||
@@ -568,6 +668,28 @@ namespace FlaxEditor.GUI
|
||||
/// <param name="indicesToRemove">The list of indices of the keyframes to remove.</param>
|
||||
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>
|
||||
/// Called when showing a context menu. Can be used to add custom buttons with actions.
|
||||
/// </summary>
|
||||
@@ -752,6 +874,17 @@ namespace FlaxEditor.GUI
|
||||
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 />
|
||||
public override void Evaluate(out object result, float time, bool loop = false)
|
||||
{
|
||||
@@ -1028,6 +1161,31 @@ namespace FlaxEditor.GUI
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1526,6 +1684,22 @@ namespace FlaxEditor.GUI
|
||||
_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 />
|
||||
protected override void DrawCurve(ref Rectangle viewRect)
|
||||
{
|
||||
@@ -2312,6 +2486,30 @@ 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 />
|
||||
protected override void SetScaleInternal(ref Float2 scale)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
private bool _useDynamicEditing;
|
||||
private bool _activeEyedropper;
|
||||
private bool _canPassLastChangeEvent = true;
|
||||
private bool _linear;
|
||||
private ColorValueBox.ColorPickerEvent _onChanged;
|
||||
private ColorValueBox.ColorPickerClosedEvent _onClosed;
|
||||
|
||||
@@ -56,6 +57,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
private Button _cCancel;
|
||||
private Button _cOK;
|
||||
private Button _cEyedropper;
|
||||
private Button _cLinearSRGB;
|
||||
|
||||
private List<Color> _savedColors = new List<Color>();
|
||||
private List<Button> _savedColorButtons = new List<Button>();
|
||||
@@ -118,6 +120,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
_value = Color.Transparent;
|
||||
_onChanged = colorChanged;
|
||||
_onClosed = pickerClosed;
|
||||
_linear = !Graphics.GammaColorSpace;
|
||||
|
||||
// Get saved colors if they exist
|
||||
if (Editor.Instance.ProjectCache.TryGetCustomData("ColorPickerSavedColors", out string savedColors))
|
||||
@@ -227,6 +230,25 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
_cEyedropper.Width = _cEyedropper.Height;
|
||||
_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
|
||||
SelectedColor = initialValue;
|
||||
}
|
||||
@@ -281,16 +303,22 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
if (_activeEyedropper)
|
||||
{
|
||||
_activeEyedropper = false;
|
||||
SelectedColor = colorPicked;
|
||||
ScreenUtilities.PickColorDone -= OnColorPicked;
|
||||
if (colorPicked != Color.Transparent)
|
||||
{
|
||||
Color color = colorPicked;
|
||||
if (_linear)
|
||||
color = color.ToLinear();
|
||||
SelectedColor = color;
|
||||
}
|
||||
Platform.PickScreenColorDone -= OnColorPicked;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEyedropStart()
|
||||
{
|
||||
_activeEyedropper = true;
|
||||
ScreenUtilities.PickColor();
|
||||
ScreenUtilities.PickColorDone += OnColorPicked;
|
||||
Platform.PickScreenColor();
|
||||
Platform.PickScreenColorDone += OnColorPicked;
|
||||
}
|
||||
|
||||
private void OnRGBAChanged()
|
||||
@@ -328,9 +356,13 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
{
|
||||
// Try reading the color under the cursor in realtime if supported by the platform
|
||||
Float2 mousePosition = Platform.MousePosition;
|
||||
Color color = ScreenUtilities.GetColorAt(mousePosition);
|
||||
Color color = Platform.GetScreenColorAt(mousePosition);
|
||||
if (color != Color.Transparent)
|
||||
{
|
||||
if (_linear)
|
||||
color = color.ToLinear();
|
||||
SelectedColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +423,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
}
|
||||
}
|
||||
}
|
||||
Render2D.FillRectangle(newRect, _value);
|
||||
Render2D.FillRectangle(newRect, _linear ? _value.ToSRgb() : _value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -412,7 +444,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
{
|
||||
// Cancel eye dropping
|
||||
_activeEyedropper = false;
|
||||
ScreenUtilities.PickColorDone -= OnColorPicked;
|
||||
Platform.PickScreenColorDone -= OnColorPicked;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -310,6 +310,26 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
Render2D.DrawRectangle(_slider1Rect, _isMouseDownSlider1 ? style.BackgroundSelected : Color.Black);
|
||||
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
|
||||
float alphaY = _slider2Rect.Height * (1 - _color.A);
|
||||
var alphaR = new Rectangle(_slider2Rect.X - slidersOffset, _slider2Rect.Y + alphaY - slidersThickness / 2, _slider2Rect.Width + slidersOffset * 2, slidersThickness);
|
||||
|
||||
@@ -469,7 +469,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
var childPanels = _childPanels.ToArray();
|
||||
if (childPanels.Length != 0)
|
||||
{
|
||||
// Move tabs from child panels into this one
|
||||
// Fallback: move tabs from child panels into this one.
|
||||
DockWindow selectedTab = null;
|
||||
foreach (var childPanel in childPanels)
|
||||
{
|
||||
@@ -490,7 +490,8 @@ namespace FlaxEditor.GUI.Docking
|
||||
{
|
||||
// Unlink splitter
|
||||
var splitterParent = splitter.Parent;
|
||||
Assert.IsNotNull(splitterParent);
|
||||
if (splitterParent == null)
|
||||
return;
|
||||
splitter.Parent = null;
|
||||
|
||||
// Move controls from second split panel to the split panel parent
|
||||
@@ -507,17 +508,63 @@ namespace FlaxEditor.GUI.Docking
|
||||
splitter.Dispose();
|
||||
}
|
||||
}
|
||||
else if (IsMaster && _childPanels.Count != 0)
|
||||
{
|
||||
if (TryCollapseSplitter(_tabsProxy?.Parent as Panel))
|
||||
return;
|
||||
}
|
||||
else if (!IsMaster)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
else if (_childPanels.Count != 0)
|
||||
{
|
||||
if (TryCollapseSplitter(_tabsProxy?.Parent as Panel))
|
||||
return;
|
||||
}
|
||||
else if (!IsMaster)
|
||||
{
|
||||
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)
|
||||
{
|
||||
DockWindow(state, window, autoSelect, splitterValue);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// The mouse position.
|
||||
/// </summary>
|
||||
public Float2 MousePosition = Float2.Minimum;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The mouse position.
|
||||
/// </summary>
|
||||
|
||||
@@ -193,6 +193,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
{
|
||||
CreateFloating(Float2.Zero, Float2.Zero);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the window in a floating state.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,13 +14,13 @@ namespace FlaxEditor.GUI.Docking
|
||||
private class FloatWindowDecorations : WindowDecorations
|
||||
{
|
||||
private FloatWindowDockPanel _panel;
|
||||
|
||||
|
||||
public FloatWindowDecorations(FloatWindowDockPanel panel)
|
||||
: base(panel.RootWindow)
|
||||
{
|
||||
_panel = panel;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
@@ -76,19 +76,19 @@ namespace FlaxEditor.GUI.Docking
|
||||
Parent = window;
|
||||
_window.Window.Closing += OnClosing;
|
||||
_window.Window.LeftButtonHit += OnLeftButtonHit;
|
||||
|
||||
|
||||
if (Utilities.Utils.UseCustomWindowDecorations())
|
||||
{
|
||||
var decorations = Parent.AddChild(new FloatWindowDecorations(this));
|
||||
decorations.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void PerformLayoutBeforeChildren()
|
||||
{
|
||||
base.PerformLayoutBeforeChildren();
|
||||
|
||||
|
||||
var decorations = Parent.GetChild<FloatWindowDecorations>();
|
||||
if (decorations != null)
|
||||
{
|
||||
@@ -108,7 +108,11 @@ namespace FlaxEditor.GUI.Docking
|
||||
return;
|
||||
|
||||
// Create docking hint window
|
||||
WindowDragHelper.StartDragging(this);
|
||||
Window dragSourceWindow = null;
|
||||
#if !PLATFORM_SDL
|
||||
dragSourceWindow = _window?.Window;
|
||||
#endif
|
||||
WindowDragHelper.StartDragging(this, dragSourceWindow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -127,11 +131,15 @@ namespace FlaxEditor.GUI.Docking
|
||||
settings.Title = title;
|
||||
settings.Size = size;
|
||||
settings.Position = location;
|
||||
settings.MinimumSize = new Float2(200, 150);
|
||||
settings.MinimumSize = new Float2(100, 100);
|
||||
settings.MaximumSize = Float2.Zero; // Unlimited size
|
||||
settings.Fullscreen = false;
|
||||
settings.HasBorder = true;
|
||||
#if PLATFORM_SDL
|
||||
settings.SupportsTransparency = true;
|
||||
#else
|
||||
settings.SupportsTransparency = false;
|
||||
#endif
|
||||
settings.ActivateWhenFirstShown = true;
|
||||
settings.AllowInput = true;
|
||||
settings.AllowMinimize = true;
|
||||
@@ -143,7 +151,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
settings.ShowAfterFirstPaint = false;
|
||||
settings.ShowInTaskbar = true;
|
||||
settings.StartPosition = startPosition;
|
||||
|
||||
|
||||
if (Utilities.Utils.UseCustomWindowDecorations())
|
||||
{
|
||||
settings.HasBorder = false;
|
||||
@@ -213,7 +221,12 @@ namespace FlaxEditor.GUI.Docking
|
||||
base.OnSelectedTabChanged();
|
||||
|
||||
if (_window != null && SelectedTab != null)
|
||||
{
|
||||
_window.Title = SelectedTab.Title;
|
||||
var decorations = Parent.GetChild<FloatWindowDecorations>();
|
||||
if (decorations != null)
|
||||
decorations.PerformLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// <summary>
|
||||
/// The hint control size.
|
||||
/// </summary>
|
||||
public const float HintControlSize = 32.0f;
|
||||
public const float HintControlSize = 48.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The opacity of the dragged window when hint controls are shown.
|
||||
@@ -44,13 +44,33 @@ namespace FlaxEditor.GUI.Docking
|
||||
_toMove = toMove;
|
||||
_toSet = DockState.Float;
|
||||
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
|
||||
FlaxEngine.Scripting.Update += OnUpdate;
|
||||
window.MouseUp += OnMouseUp;
|
||||
|
||||
#if !PLATFORM_SDL
|
||||
window.StartTrackingMouse(false);
|
||||
#endif
|
||||
|
||||
// Update rectangles
|
||||
UpdateRects(Platform.MousePosition);
|
||||
UpdateRects(mousePos);
|
||||
|
||||
// Ensure the dragged window stays on top of every other window
|
||||
window.IsAlwaysOnTop = true;
|
||||
@@ -58,13 +78,21 @@ namespace FlaxEditor.GUI.Docking
|
||||
_dragSourceWindow = dragSourceWindow;
|
||||
if (_dragSourceWindow != null) // Detaching a tab from existing window
|
||||
{
|
||||
#if PLATFORM_SDL
|
||||
_dragOffset = new Float2(window.Size.X / 2, 10.0f);
|
||||
|
||||
_dragSourceWindow.MouseUp += OnMouseUp; // The mouse up event is sent to the source window on Windows
|
||||
#else
|
||||
_dragOffset = mousePos - window.Position;
|
||||
#endif
|
||||
|
||||
// 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?
|
||||
var dragSourceWindowWayland = toMove.MasterPanel?.RootWindow.Window ?? Editor.Instance.Windows.MainWindow;
|
||||
window.DoDragDrop(window.Title, _dragOffset, dragSourceWindowWayland);
|
||||
#if !PLATFORM_SDL
|
||||
_dragSourceWindow.BringToFront();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -84,7 +112,12 @@ namespace FlaxEditor.GUI.Docking
|
||||
// Unbind events
|
||||
FlaxEngine.Scripting.Update -= OnUpdate;
|
||||
if (window != null)
|
||||
{
|
||||
window.MouseUp -= OnMouseUp;
|
||||
#if !PLATFORM_SDL
|
||||
window.EndTrackingMouse();
|
||||
#endif
|
||||
}
|
||||
if (_dragSourceWindow != null)
|
||||
_dragSourceWindow.MouseUp -= OnMouseUp;
|
||||
|
||||
@@ -160,13 +193,14 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// Start dragging a floating dock panel.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public static WindowDragHelper StartDragging(FloatWindowDockPanel toMove)
|
||||
public static WindowDragHelper StartDragging(FloatWindowDockPanel toMove, Window dragSourceWindow = null)
|
||||
{
|
||||
if (toMove == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
return new WindowDragHelper(toMove, null);
|
||||
return new WindowDragHelper(toMove, dragSourceWindow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -268,7 +302,8 @@ namespace FlaxEditor.GUI.Docking
|
||||
}
|
||||
|
||||
// Prefer panel in the same window we hit earlier
|
||||
if (dockPanel?.RootWindow != _toDock?.RootWindow)
|
||||
// TODO: this doesn't allow docking window into another floating window over the main window
|
||||
/*if (dockPanel?.RootWindow != _toDock?.RootWindow)
|
||||
{
|
||||
foreach (var hit in hitResults)
|
||||
{
|
||||
@@ -278,7 +313,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if (dockPanel != _toDock)
|
||||
@@ -288,19 +323,29 @@ namespace FlaxEditor.GUI.Docking
|
||||
AddDockHints();
|
||||
|
||||
// Make sure the all the dock hint areas are not under other windows
|
||||
_toDock?.RootWindow.Window.BringToFront();
|
||||
if (_toDock != Editor.Instance.UI.MasterPanel)
|
||||
_toDock?.RootWindow.Window.BringToFront();
|
||||
//_toDock?.RootWindow.Window.Focus();
|
||||
|
||||
#if PLATFORM_SDL
|
||||
// Make the dragged window transparent when dock hints are visible
|
||||
_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
|
||||
bool showProxyHints = _toDock != null;
|
||||
bool showBorderHints = showProxyHints;
|
||||
bool showCenterHint = showProxyHints;
|
||||
Control hoveredHintControl = null;
|
||||
Float2 hoveredLocationOffset = Float2.Zero;
|
||||
Float2 hoveredSizeOverride = Float2.Zero;
|
||||
DockState prevToSet = _toSet;
|
||||
float hoveredMargin = 1.0f;
|
||||
if (showProxyHints)
|
||||
{
|
||||
// If moved window has not only tabs but also child panels disable docking as tab
|
||||
@@ -317,7 +362,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
// Cache dock rectangles
|
||||
var size = _rectDock.Size / Platform.DpiScale;
|
||||
var offset = _toDock.PointFromScreen(_rectDock.Location);
|
||||
var borderMargin = 4.0f;
|
||||
var borderMargin = 10.0f;
|
||||
var hintWindowsSize = HintControlSize;
|
||||
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));
|
||||
@@ -330,35 +375,40 @@ namespace FlaxEditor.GUI.Docking
|
||||
_rCenter = new Rectangle(centerX - hintWindowsSize2, centerY - hintWindowsSize2, hintWindowsSize, hintWindowsSize) + offset;
|
||||
|
||||
// Hit test, and calculate the approximation for filled area when hovered over the hint
|
||||
DockState toSet = DockState.Float;
|
||||
var toSet = DockState.Float;
|
||||
var hintTestPoint = _toDock.PointFromScreen(_mouse);
|
||||
if (showBorderHints)
|
||||
{
|
||||
if (_rUpper.Contains(_toDock.PointFromScreen(_mouse)))
|
||||
if (_rUpper.Contains(ref hintTestPoint))
|
||||
{
|
||||
toSet = DockState.DockTop;
|
||||
hoveredHintControl = _dockHintUp;
|
||||
hoveredSizeOverride = new Float2(size.X, hintPreviewSize.Y);
|
||||
hoveredSizeOverride = new Float2(size.X, size.Y * DockPanel.DefaultSplitterValue);
|
||||
hoveredLocationOffset.Y -= borderMargin - hoveredMargin;
|
||||
}
|
||||
else if (_rBottom.Contains(_toDock.PointFromScreen(_mouse)))
|
||||
else if (_rBottom.Contains(ref hintTestPoint))
|
||||
{
|
||||
toSet = DockState.DockBottom;
|
||||
hoveredHintControl = _dockHintDown;
|
||||
hoveredSizeOverride = new Float2(size.X, hintPreviewSize.Y);
|
||||
hoveredSizeOverride = new Float2(size.X, size.Y * DockPanel.DefaultSplitterValue);
|
||||
hoveredLocationOffset.Y += borderMargin - hoveredMargin;
|
||||
}
|
||||
else if (_rLeft.Contains(_toDock.PointFromScreen(_mouse)))
|
||||
else if (_rLeft.Contains(ref hintTestPoint))
|
||||
{
|
||||
toSet = DockState.DockLeft;
|
||||
hoveredHintControl = _dockHintLeft;
|
||||
hoveredSizeOverride = new Float2(hintPreviewSize.X, size.Y);
|
||||
hoveredSizeOverride = new Float2(size.X * DockPanel.DefaultSplitterValue, size.Y);
|
||||
hoveredLocationOffset.X -= borderMargin - hoveredMargin;
|
||||
}
|
||||
else if (_rRight.Contains(_toDock.PointFromScreen(_mouse)))
|
||||
else if (_rRight.Contains(ref hintTestPoint))
|
||||
{
|
||||
toSet = DockState.DockRight;
|
||||
hoveredHintControl = _dockHintRight;
|
||||
hoveredSizeOverride = new Float2(hintPreviewSize.X, size.Y);
|
||||
hoveredSizeOverride = new Float2(size.X * DockPanel.DefaultSplitterValue, size.Y);
|
||||
hoveredLocationOffset.X += borderMargin - hoveredMargin;
|
||||
}
|
||||
}
|
||||
if (showCenterHint && _rCenter.Contains(_toDock.PointFromScreen(_mouse)))
|
||||
if (showCenterHint && _rCenter.Contains(ref hintTestPoint))
|
||||
{
|
||||
toSet = DockState.DockFill;
|
||||
hoveredHintControl = _dockHintCenter;
|
||||
@@ -375,38 +425,41 @@ namespace FlaxEditor.GUI.Docking
|
||||
// Update sizes and opacity of hint controls
|
||||
if (_toDock != null)
|
||||
{
|
||||
var mainColor = Style.Current.Selection;
|
||||
if (hoveredHintControl != _dockHintDown)
|
||||
{
|
||||
_dockHintDown.Size = new Float2(HintControlSize);
|
||||
_dockHintDown.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
|
||||
_dockHintDown.BackgroundColor = mainColor.AlphaMultiplied(0.6f);
|
||||
}
|
||||
if (hoveredHintControl != _dockHintLeft)
|
||||
{
|
||||
_dockHintLeft.Size = new Float2(HintControlSize);
|
||||
_dockHintLeft.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
|
||||
_dockHintLeft.BackgroundColor = mainColor.AlphaMultiplied(0.6f);
|
||||
}
|
||||
if (hoveredHintControl != _dockHintRight)
|
||||
{
|
||||
_dockHintRight.Size = new Float2(HintControlSize);
|
||||
_dockHintRight.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
|
||||
_dockHintRight.BackgroundColor = mainColor.AlphaMultiplied(0.6f);
|
||||
}
|
||||
if (hoveredHintControl != _dockHintUp)
|
||||
{
|
||||
_dockHintUp.Size = new Float2(HintControlSize);
|
||||
_dockHintUp.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
|
||||
_dockHintUp.BackgroundColor = mainColor.AlphaMultiplied(0.6f);
|
||||
}
|
||||
if (hoveredHintControl != _dockHintCenter)
|
||||
{
|
||||
_dockHintCenter.Size = new Float2(HintControlSize);
|
||||
_dockHintCenter.BackgroundColor = Style.Current.Selection.AlphaMultiplied(0.6f);
|
||||
_dockHintCenter.BackgroundColor = mainColor.AlphaMultiplied(0.6f);
|
||||
}
|
||||
|
||||
if (_toSet != DockState.Float)
|
||||
{
|
||||
if (hoveredHintControl != null)
|
||||
{
|
||||
hoveredHintControl.BackgroundColor = Style.Current.Selection.AlphaMultiplied(1.0f);
|
||||
hoveredHintControl.Size = hoveredSizeOverride;
|
||||
hoveredHintControl.BackgroundColor = mainColor;
|
||||
if (_toSet != prevToSet)
|
||||
hoveredHintControl.Location += hoveredLocationOffset;
|
||||
hoveredHintControl.Size = hoveredSizeOverride - hoveredMargin;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -441,18 +494,21 @@ namespace FlaxEditor.GUI.Docking
|
||||
|
||||
private void OnUpdate()
|
||||
{
|
||||
// If the engine lost focus during dragging, end the action
|
||||
if (!Engine.HasFocus)
|
||||
{
|
||||
Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
var mousePos = Platform.MousePosition;
|
||||
|
||||
if (_mouse != mousePos)
|
||||
OnMouseMove(mousePos);
|
||||
}
|
||||
|
||||
private void OnMouseMove(Float2 mousePos)
|
||||
{
|
||||
if (_dragSourceWindow != null)
|
||||
_toMove.Window.Window.Position = mousePos - _dragOffset;
|
||||
{
|
||||
if (_dragSourceWindow != null)
|
||||
_toMove.Window.Window.Position = mousePos - _dragOffset;
|
||||
|
||||
UpdateRects(mousePos);
|
||||
UpdateRects(mousePos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +242,15 @@ namespace FlaxEditor.GUI
|
||||
{
|
||||
FieldInfo[] fields = type.GetFields();
|
||||
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++)
|
||||
{
|
||||
var field = fields[i];
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace FlaxEditor.GUI.Input
|
||||
public class ColorValueBox : Control
|
||||
{
|
||||
private bool _isMouseDown;
|
||||
private bool _linear;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate function used for the color picker events handling.
|
||||
@@ -101,6 +102,7 @@ namespace FlaxEditor.GUI.Input
|
||||
public ColorValueBox()
|
||||
: base(0, 0, 32, 18)
|
||||
{
|
||||
_linear = !Graphics.GammaColorSpace;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -113,6 +115,7 @@ namespace FlaxEditor.GUI.Input
|
||||
: base(x, y, 32, 18)
|
||||
{
|
||||
_value = value;
|
||||
_linear = !Graphics.GammaColorSpace;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -129,8 +132,10 @@ namespace FlaxEditor.GUI.Input
|
||||
{
|
||||
base.Draw();
|
||||
|
||||
bool isTransparent = _value.A < 1;
|
||||
|
||||
var value = _value;
|
||||
if (_linear)
|
||||
value = value.ToSRgb();
|
||||
var isTransparent = value.A < 1;
|
||||
var style = Style.Current;
|
||||
var fullRect = new Rectangle(0, 0, Width, Height);
|
||||
var colorRect = new Rectangle(0, 0, isTransparent ? Width * 0.7f : Width, Height);
|
||||
@@ -157,10 +162,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,11 @@ namespace FlaxEditor.GUI.Input
|
||||
/// </summary>
|
||||
public event Action SlidingEnd;
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, pressing the arrow up or down key increments/ decrements the value.
|
||||
/// </summary>
|
||||
public bool ArrowKeysIncrement = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the slider speed. Use value 0 to disable and hide slider UI.
|
||||
/// </summary>
|
||||
@@ -239,6 +244,27 @@ namespace FlaxEditor.GUI.Input
|
||||
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 />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
@@ -296,7 +322,7 @@ namespace FlaxEditor.GUI.Input
|
||||
#else
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseMoveRelative(Float2 mouseMotion)
|
||||
public override void OnMouseMoveRelative(Float2 motion)
|
||||
{
|
||||
var location = Root.TrackingMouseOffset;
|
||||
if (_isSliding)
|
||||
@@ -318,7 +344,7 @@ namespace FlaxEditor.GUI.Input
|
||||
_cursorChanged = false;
|
||||
}
|
||||
|
||||
base.OnMouseMoveRelative(mouseMotion);
|
||||
base.OnMouseMoveRelative(motion);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,12 +59,12 @@ namespace FlaxEditor.GUI
|
||||
/// <summary>
|
||||
/// Occurs when items gets clicked by the user.
|
||||
/// </summary>
|
||||
public event Action<Item> Clicked;
|
||||
public event Action<Item> ItemClicked;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when items gets focused.
|
||||
/// </summary>
|
||||
public event Action<Item> Focused;
|
||||
public event Action<Item> ItemFocused;
|
||||
|
||||
/// <summary>
|
||||
/// The tint color of the text.
|
||||
@@ -203,7 +203,7 @@ namespace FlaxEditor.GUI
|
||||
if (button == MouseButton.Left && _isMouseDown)
|
||||
{
|
||||
_isMouseDown = false;
|
||||
Clicked?.Invoke(this);
|
||||
ItemClicked?.Invoke(this);
|
||||
}
|
||||
|
||||
return base.OnMouseUp(location, button);
|
||||
@@ -222,7 +222,7 @@ namespace FlaxEditor.GUI
|
||||
{
|
||||
base.OnGotFocus();
|
||||
|
||||
Focused?.Invoke(this);
|
||||
ItemFocused?.Invoke(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -434,7 +434,7 @@ namespace FlaxEditor.GUI
|
||||
/// <param name="item">The item.</param>
|
||||
public void AddItem(Item item)
|
||||
{
|
||||
item.Clicked += OnClickItem;
|
||||
item.ItemClicked += OnClickItem;
|
||||
ContainerControl parent = ItemsPanel;
|
||||
if (!string.IsNullOrEmpty(item.Category))
|
||||
{
|
||||
|
||||
@@ -1140,8 +1140,11 @@ namespace FlaxEditor.GUI.Tree
|
||||
ParentTree.DraggedOverNode = this;
|
||||
|
||||
// Expand node if mouse goes over arrow
|
||||
if (ArrowRect.Contains(location) && HasAnyVisibleChild)
|
||||
if (ArrowRect.Contains(location) && HasAnyVisibleChild && IsCollapsed)
|
||||
{
|
||||
Expand(true);
|
||||
ParentTree?.FlushPendingPerformLayout();
|
||||
}
|
||||
|
||||
result = OnDragEnterHeader(data);
|
||||
}
|
||||
@@ -1172,8 +1175,11 @@ namespace FlaxEditor.GUI.Tree
|
||||
ParentTree.DraggedOverNode = this;
|
||||
|
||||
// Expand node if mouse goes over arrow
|
||||
if (ArrowRect.Contains(location) && HasAnyVisibleChild)
|
||||
if (ArrowRect.Contains(location) && HasAnyVisibleChild && IsCollapsed)
|
||||
{
|
||||
Expand(true);
|
||||
ParentTree?.FlushPendingPerformLayout();
|
||||
}
|
||||
|
||||
if (!_isDragOverHeader)
|
||||
result = OnDragEnterHeader(data);
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using FlaxEditor.GUI.Docking;
|
||||
using FlaxEditor.Options;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -26,12 +23,12 @@ public class WindowDecorations : ContainerControl
|
||||
/// The title label in the title bar.
|
||||
/// </summary>
|
||||
public Label Title => _title;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The icon used in the title bar.
|
||||
/// </summary>
|
||||
public Image Icon => _icon;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The tooltip shown when hovering over the icon.
|
||||
/// </summary>
|
||||
@@ -54,7 +51,7 @@ public class WindowDecorations : ContainerControl
|
||||
: base(0, 0, 0, 20)
|
||||
{
|
||||
_window = window.RootWindow.Window;
|
||||
|
||||
|
||||
AutoFocus = false;
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchTop;
|
||||
BackgroundColor = Color.Transparent;
|
||||
@@ -75,13 +72,13 @@ public class WindowDecorations : ContainerControl
|
||||
{
|
||||
_icon.Margin = new Margin(6, 6, 6, 6);
|
||||
Height = 28;
|
||||
|
||||
|
||||
_window.HitTest += OnHitTest;
|
||||
_window.Closed += OnWindowClosed;
|
||||
|
||||
|
||||
FontAsset windowIconsFont = FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.WindowIconsFont);
|
||||
Font iconFont = windowIconsFont?.CreateFont(9);
|
||||
|
||||
|
||||
_title = new Label(0, 0, Width, Height)
|
||||
{
|
||||
Text = _window.Title,
|
||||
@@ -150,7 +147,7 @@ public class WindowDecorations : ContainerControl
|
||||
_charChromeMaximize = ((char)EditorAssets.SegMDL2Icons.ChromeMaximize).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
@@ -216,20 +213,20 @@ public class WindowDecorations : ContainerControl
|
||||
if (pos.Y > winSize.Y - distance)
|
||||
return WindowHitCodes.Bottom;
|
||||
}
|
||||
|
||||
|
||||
var controlUnderMouse = GetChildAt(pos, control => control != _title);
|
||||
if (_title.Bounds.Contains(pos) && controlUnderMouse == null)
|
||||
return WindowHitCodes.Caption;
|
||||
|
||||
return WindowHitCodes.Client;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
|
||||
{
|
||||
// These may not work with main window due to SDL not passing mouse events
|
||||
// when interacting with hit tests on caption area...
|
||||
|
||||
|
||||
if (Title.Bounds.Contains(location) && button == MouseButton.Left)
|
||||
{
|
||||
if (_window.IsMaximized)
|
||||
@@ -251,7 +248,7 @@ public class WindowDecorations : ContainerControl
|
||||
{
|
||||
// Calculate extents for title bounds area excluding the icon and main menu area
|
||||
float x = 0;
|
||||
|
||||
|
||||
// Icon
|
||||
if (_icon != null)
|
||||
{
|
||||
@@ -273,7 +270,7 @@ public class WindowDecorations : ContainerControl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Buttons
|
||||
float rightMostButtonX = Width;
|
||||
if (_closeButton != null)
|
||||
@@ -302,7 +299,7 @@ public class WindowDecorations : ContainerControl
|
||||
_title.Bounds = new Rectangle(x, 0, rightMostButtonX - x, Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
@@ -321,7 +318,7 @@ public class WindowDecorations : ContainerControl
|
||||
|
||||
if (Editor.Instance.UI.StatusBar == null)
|
||||
return;
|
||||
|
||||
|
||||
const float thickness = 1.0f;
|
||||
Color color = Editor.Instance.UI.StatusBar.StatusColor;
|
||||
Rectangle rect = new Rectangle(thickness * 0.5f, thickness * 0.5f, Parent.Width - thickness, Parent.Height - thickness);
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace FlaxEditor.Gizmo
|
||||
public abstract class GizmoBase
|
||||
{
|
||||
private IGizmoOwner _owner;
|
||||
private bool _visible = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gizmo owner.
|
||||
@@ -34,6 +35,11 @@ namespace FlaxEditor.Gizmo
|
||||
/// </summary>
|
||||
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>
|
||||
/// Initializes a new instance of the <see cref="GizmoBase"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -36,11 +36,12 @@ public sealed class ViewportRubberBandSelector
|
||||
/// Triggers the start of a rubber band selection.
|
||||
/// </summary>
|
||||
/// <returns>True if selection started, otherwise false.</returns>
|
||||
public bool TryStartingRubberBandSelection()
|
||||
public bool TryStartingRubberBandSelection(Float2 mousePosition)
|
||||
{
|
||||
if (!_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown)
|
||||
{
|
||||
_tryStartRubberBand = true;
|
||||
_cachedStartingMousePosition = mousePosition;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -82,12 +83,15 @@ public sealed class ViewportRubberBandSelector
|
||||
return;
|
||||
}
|
||||
|
||||
if (_tryStartRubberBand && (Mathf.Abs(_owner.MouseDelta.X) > 0.1f || Mathf.Abs(_owner.MouseDelta.Y) > 0.1f) && canStart)
|
||||
if (_tryStartRubberBand && canStart)
|
||||
{
|
||||
_isRubberBandSpanning = true;
|
||||
_cachedStartingMousePosition = mousePosition;
|
||||
_rubberBandRect = new Rectangle(_cachedStartingMousePosition, Float2.Zero);
|
||||
_tryStartRubberBand = false;
|
||||
var delta = mousePosition - _cachedStartingMousePosition;
|
||||
if (Mathf.Abs(delta.X) > 0.1f || Mathf.Abs(delta.Y) > 0.1f)
|
||||
{
|
||||
_isRubberBandSpanning = true;
|
||||
_rubberBandRect = new Rectangle(_cachedStartingMousePosition, Float2.Zero);
|
||||
_tryStartRubberBand = false;
|
||||
}
|
||||
}
|
||||
else if (_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace FlaxEditor.Modules
|
||||
/// <seealso cref="FlaxEditor.Modules.EditorModule" />
|
||||
public sealed class SceneEditingModule : EditorModule
|
||||
{
|
||||
private int _lastSelectionStatus = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The selected objects.
|
||||
/// </summary>
|
||||
@@ -193,6 +195,20 @@ namespace FlaxEditor.Modules
|
||||
Undo.AddAction(new SelectionChangeAction(before, Selection.ToArray(), OnSelectionUndo));
|
||||
|
||||
OnSelectionChanged();
|
||||
|
||||
// Display amount of selected actors on the status bar
|
||||
Editor.UI.RemoveStatusMessage(_lastSelectionStatus);
|
||||
var objects = Selection.Count;
|
||||
var actors = CountActors(Selection);
|
||||
_lastSelectionStatus = Editor.UI.AddStatusMessage($"Selected {objects} {(objects > 1 ? "objects" : "object")} (total {actors} {(actors > 1 ? "actors" : "actor")})");
|
||||
}
|
||||
|
||||
private int CountActors(List<SceneGraphNode> nodes)
|
||||
{
|
||||
int result = 0;
|
||||
foreach (var node in nodes)
|
||||
result += 1 + CountActors(node.ChildNodes);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void OnSelectionUndo(SceneGraphNode[] toSelect)
|
||||
@@ -229,7 +245,7 @@ namespace FlaxEditor.Modules
|
||||
if (!isPlayMode && options.General.AutoRebuildNavMesh && actor.Scene && node.AffectsNavigationWithChildren)
|
||||
{
|
||||
var bounds = actor.BoxWithChildren;
|
||||
Navigation.BuildNavMesh(actor.Scene, bounds, options.General.AutoRebuildNavMeshTimeoutMs);
|
||||
Navigation.BuildNavMesh(bounds, options.General.AutoRebuildNavMeshTimeoutMs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
private class MainWindowDecorations : WindowDecorations
|
||||
{
|
||||
public MainWindowDecorations(RootControl window, bool iconOnly)
|
||||
public MainWindowDecorations(RootControl window, bool iconOnly)
|
||||
: base(window, iconOnly)
|
||||
{
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace FlaxEditor.Modules
|
||||
var editor = Editor.Instance;
|
||||
return editor.Windows.EditWin.InputActions.Process(editor, this, key);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void DrawBorders()
|
||||
{
|
||||
@@ -61,16 +61,24 @@ namespace FlaxEditor.Modules
|
||||
Render2D.DrawLine(rect.UpperRight, rect.BottomRight, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private struct Status
|
||||
{
|
||||
public int ID;
|
||||
public string Text;
|
||||
public DateTime EndTime;
|
||||
}
|
||||
|
||||
private Label _progressLabel;
|
||||
private ProgressBar _progressBar;
|
||||
private Button _outputLogButton;
|
||||
private List<KeyValuePair<string, DateTime>> _statusMessages;
|
||||
private List<Status> _statusMessages;
|
||||
private int _statusID = 1;
|
||||
private ContentStats _contentStats;
|
||||
private bool _progressFailed;
|
||||
|
||||
ContextMenuSingleSelectGroup<int> _numberOfClientsGroup = new ContextMenuSingleSelectGroup<int>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines a viewport scaling option.
|
||||
/// </summary>
|
||||
@@ -91,7 +99,7 @@ namespace FlaxEditor.Modules
|
||||
/// </summary>
|
||||
Aspect = 1,
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The name.
|
||||
/// </summary>
|
||||
@@ -107,7 +115,7 @@ namespace FlaxEditor.Modules
|
||||
/// </summary>
|
||||
public Int2 Size;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The default viewport scaling options.
|
||||
/// </summary>
|
||||
@@ -158,6 +166,7 @@ namespace FlaxEditor.Modules
|
||||
private ContextMenuButton _menuToolsProfilerWindow;
|
||||
private ContextMenuButton _menuToolsSetTheCurrentSceneViewAsDefault;
|
||||
private ContextMenuButton _menuToolsTakeScreenshot;
|
||||
private ContextMenuButton _menuToolsOpenLocalFolder;
|
||||
private ContextMenuChildMenu _menuWindowApplyWindowLayout;
|
||||
|
||||
private ToolStripButton _toolStripSaveAll;
|
||||
@@ -378,7 +387,7 @@ namespace FlaxEditor.Modules
|
||||
|
||||
string text;
|
||||
if (_statusMessages != null && _statusMessages.Count != 0)
|
||||
text = _statusMessages[0].Key;
|
||||
text = _statusMessages[0].Text;
|
||||
else if (Editor.StateMachine.CurrentState.Status != null)
|
||||
text = Editor.StateMachine.CurrentState.Status;
|
||||
else if (contentStats.LoadingAssetsCount != 0)
|
||||
@@ -400,13 +409,34 @@ namespace FlaxEditor.Modules
|
||||
/// Adds the status bar message text to be displayed as a notification.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to display.</param>
|
||||
public void AddStatusMessage(string message)
|
||||
/// <returns>The ID of that status message (unique). Can be used to hide it manually.</returns>
|
||||
public int AddStatusMessage(string message)
|
||||
{
|
||||
if (_statusMessages == null)
|
||||
_statusMessages = new List<KeyValuePair<string, DateTime>>();
|
||||
_statusMessages.Add(new KeyValuePair<string, DateTime>(message, DateTime.Now + TimeSpan.FromSeconds(3.0f)));
|
||||
_statusMessages = new List<Status>();
|
||||
var status = new Status { ID = _statusID++, Text = message, EndTime = DateTime.Now + TimeSpan.FromSeconds(3.0f) };
|
||||
_statusMessages.Add(status);
|
||||
if (_statusMessages.Count == 1)
|
||||
UpdateStatusBar();
|
||||
return status.ID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specific status message once it's not needed anymore,
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the message returned by <see cref="AddStatusMessage"/>.</param>
|
||||
public void RemoveStatusMessage(int id)
|
||||
{
|
||||
if (_statusMessages == null || id == 0)
|
||||
return;
|
||||
for (var i = 0; i < _statusMessages.Count; i++)
|
||||
{
|
||||
if (_statusMessages[i].ID == id)
|
||||
{
|
||||
_statusMessages.RemoveAt(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal bool ProgressVisible
|
||||
@@ -456,7 +486,7 @@ namespace FlaxEditor.Modules
|
||||
|
||||
// Update window background
|
||||
mainWindow.BackgroundColor = Style.Current.Background;
|
||||
|
||||
|
||||
InitViewportScaleOptions();
|
||||
|
||||
InitSharedMenus();
|
||||
@@ -467,7 +497,7 @@ namespace FlaxEditor.Modules
|
||||
InitWindowDecorations(mainWindow);
|
||||
|
||||
Editor.Options.OptionsChanged += OnOptionsChanged;
|
||||
|
||||
|
||||
mainWindow.PerformLayout(true);
|
||||
}
|
||||
|
||||
@@ -506,7 +536,7 @@ namespace FlaxEditor.Modules
|
||||
Size = new Int2(2560, 1440),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (Editor.Instance.ProjectCache.TryGetCustomData("CustomViewportScalingOptions", out string data))
|
||||
{
|
||||
CustomViewportScaleOptions = JsonSerializer.Deserialize<List<ViewportScaleOption>>(data);
|
||||
@@ -519,13 +549,13 @@ namespace FlaxEditor.Modules
|
||||
public void SaveCustomViewportScalingOptions()
|
||||
{
|
||||
var customOptions = JsonSerializer.Serialize(CustomViewportScaleOptions);
|
||||
Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions);
|
||||
Editor.Instance.ProjectCache.SetCustomData("CustomViewportScalingOptions", customOptions);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnUpdate()
|
||||
{
|
||||
if (_statusMessages != null && _statusMessages.Count > 0 && _statusMessages[0].Value - DateTime.Now < TimeSpan.Zero)
|
||||
if (_statusMessages != null && _statusMessages.Count > 0 && _statusMessages[0].EndTime - DateTime.Now < TimeSpan.Zero)
|
||||
{
|
||||
_statusMessages.RemoveAt(0);
|
||||
UpdateStatusBar();
|
||||
@@ -733,12 +763,22 @@ namespace FlaxEditor.Modules
|
||||
_menuToolsTakeScreenshot = cm.AddButton("Take screenshot", inputOptions.TakeScreenshot, Editor.Windows.TakeScreenshot);
|
||||
cm.AddSeparator();
|
||||
cm.AddButton("Plugins", () => Editor.Windows.PluginsWin.Show());
|
||||
cm.AddSeparator();
|
||||
var childMenu = cm.AddChildMenu("Open Product Local folder");
|
||||
childMenu.ContextMenu.AddButton("Editor", () => FileSystem.ShowFileExplorer(Globals.ProductLocalFolder));
|
||||
_menuToolsOpenLocalFolder = childMenu.ContextMenu.AddButton("Game", () =>
|
||||
{
|
||||
string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
GameSettings settings = GameSettings.Load<GameSettings>();
|
||||
string path = Path.Combine(localAppData, settings.CompanyName, settings.ProductName);
|
||||
FileSystem.ShowFileExplorer(path);
|
||||
});
|
||||
|
||||
// Window
|
||||
MenuWindow = MainMenu.AddButton("Window");
|
||||
cm = MenuWindow.ContextMenu;
|
||||
cm.VisibleChanged += OnMenuWindowVisibleChanged;
|
||||
cm.AddButton("Content", inputOptions.ContentWindow,Editor.Windows.ContentWin.FocusOrShow);
|
||||
cm.AddButton("Content", inputOptions.ContentWindow, Editor.Windows.ContentWin.FocusOrShow);
|
||||
cm.AddButton("Scene", inputOptions.SceneWindow, Editor.Windows.SceneWin.FocusOrShow);
|
||||
cm.AddButton("Toolbox", inputOptions.ToolboxWindow, Editor.Windows.ToolboxWin.FocusOrShow);
|
||||
cm.AddButton("Properties", inputOptions.PropertiesWindow, Editor.Windows.PropertiesWin.FocusOrShow);
|
||||
@@ -774,17 +814,20 @@ namespace FlaxEditor.Modules
|
||||
private void InitWindowDecorations(RootControl mainWindow)
|
||||
{
|
||||
ScriptsBuilder.GetBinariesConfiguration(out _, out _, out _, out var configuration);
|
||||
var driver = Platform.DisplayServer;
|
||||
string driver = string.Empty;
|
||||
#if PLATFORM_LINUX
|
||||
driver = LinuxPlatform.DisplayServer;
|
||||
if (!string.IsNullOrEmpty(driver))
|
||||
driver = $" ({driver})";
|
||||
|
||||
#endif
|
||||
|
||||
WindowDecorations = new MainWindowDecorations(mainWindow, !Utilities.Utils.UseCustomWindowDecorations(isMainWindow: true))
|
||||
{
|
||||
Parent = mainWindow,
|
||||
IconTooltipText = $"{mainWindow.RootWindow.Title}\nVersion {Globals.EngineVersion}\nConfiguration {configuration}\nGraphics {GPUDevice.Instance.RendererType}{driver}",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void OnOptionsChanged(EditorOptions options)
|
||||
{
|
||||
var inputOptions = options.Input;
|
||||
@@ -1084,6 +1127,10 @@ namespace FlaxEditor.Modules
|
||||
_menuToolsBuildNavMesh.Enabled = canEdit;
|
||||
_menuToolsCancelBuilding.Enabled = GameCooker.IsRunning;
|
||||
_menuToolsSetTheCurrentSceneViewAsDefault.Enabled = Level.ScenesCount > 0;
|
||||
string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
GameSettings settings = GameSettings.Load<GameSettings>();
|
||||
string path = Path.Combine(localAppData, settings.CompanyName, settings.ProductName);
|
||||
_menuToolsOpenLocalFolder.Enabled = Directory.Exists(path);
|
||||
|
||||
c.PerformLayout();
|
||||
}
|
||||
|
||||
@@ -490,10 +490,15 @@ namespace FlaxEditor.Modules
|
||||
Editor.LogWarning("Empty panel inside layout.");
|
||||
p.RemoveIt();
|
||||
}
|
||||
else
|
||||
{
|
||||
p.CollapseEmptyTabsProxy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
panel.SelectTab(selectedTab);
|
||||
panel.CollapseEmptyTabsProxy();
|
||||
}
|
||||
|
||||
private static void SaveBounds(XmlWriter writer, Window win)
|
||||
|
||||
@@ -387,6 +387,14 @@ namespace FlaxEditor.Options
|
||||
[EditorDisplay("Viewport"), EditorOrder(1760)]
|
||||
public InputBinding ToggleOrthographic = new InputBinding(KeyboardKeys.NumpadDecimal);
|
||||
|
||||
[DefaultValue(typeof(InputBinding), "G")]
|
||||
[EditorDisplay("Viewport"), EditorOrder(1770)]
|
||||
public InputBinding ToggleGameView = new InputBinding(KeyboardKeys.G);
|
||||
|
||||
[DefaultValue(typeof(InputBinding), "P")]
|
||||
[EditorDisplay("Viewport"), EditorOrder(1770)]
|
||||
public InputBinding ToggleNavMeshVisibility = new InputBinding(KeyboardKeys.P);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Debug Views
|
||||
@@ -571,6 +579,10 @@ namespace FlaxEditor.Options
|
||||
[EditorDisplay("View Flags"), EditorOrder(3260)]
|
||||
public InputBinding DebugDraw = new InputBinding(KeyboardKeys.Alpha4, KeyboardKeys.Control, KeyboardKeys.Shift);
|
||||
|
||||
[DefaultValue(typeof(InputBinding), "None")]
|
||||
[EditorDisplay("View Flags"), EditorOrder(3270)]
|
||||
public InputBinding Particles = new InputBinding(KeyboardKeys.None);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Interface
|
||||
|
||||
@@ -85,10 +85,12 @@ namespace FlaxEditor.Options
|
||||
/// Never show the close button.
|
||||
/// </summary>
|
||||
Never,
|
||||
|
||||
/// <summary>
|
||||
/// Show the close button on tabs that are currently selected.
|
||||
/// </summary>
|
||||
SelectedTab,
|
||||
|
||||
/// <summary>
|
||||
/// Show the close button on all tabs that can be closed.
|
||||
/// </summary>
|
||||
@@ -188,18 +190,18 @@ namespace FlaxEditor.Options
|
||||
/// Determined automatically based on the system and any known compatibility issues with native decorations.
|
||||
/// </summary>
|
||||
Auto,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Automatically choose most compatible window decorations for child windows, prefer custom decorations on main window.
|
||||
/// </summary>
|
||||
[EditorDisplay(Name = "Auto (Child Only)")]
|
||||
AutoChildOnly,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Use native system window decorations on all windows.
|
||||
/// </summary>
|
||||
Native,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Use custom client-side window decorations on all windows.
|
||||
/// </summary>
|
||||
@@ -322,7 +324,7 @@ namespace FlaxEditor.Options
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating wether the minum tab width should be used. Editor restart required.
|
||||
/// Gets or sets a value indicating whether the minimum tab width should be used. Editor restart required.
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[EditorDisplay("Tabs & Windows"), EditorOrder(99)]
|
||||
@@ -518,7 +520,7 @@ namespace FlaxEditor.Options
|
||||
[DefaultValue(1), Range(1, 4)]
|
||||
[EditorDisplay("Cook & Run"), EditorOrder(600)]
|
||||
public int NumberOfGameClientsToLaunch = 1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the build configuration to use when using Cook and Run option in the editor.
|
||||
/// </summary>
|
||||
@@ -533,7 +535,7 @@ namespace FlaxEditor.Options
|
||||
public float ConnectionCurvature { get; set; } = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value that indicates wether the context menu description panel is shown or not.
|
||||
/// Gets or sets a value that indicates whether the context menu description panel is shown or not.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
[EditorDisplay("Visject"), EditorOrder(550), Tooltip("Shows/hides the description panel in visual scripting context menu.")]
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
if (value is BoxCollider collider)
|
||||
collider.AutoResize(!_keepLocalOrientation);
|
||||
}
|
||||
Presenter.OnModified();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
var options = Editor.Instance.Options.Options.General;
|
||||
if (options.AutoRebuildNavMesh)
|
||||
{
|
||||
Navigation.BuildNavMesh(collider.Scene, collider.Box, options.AutoRebuildNavMeshTimeoutMs);
|
||||
Navigation.BuildNavMesh(collider.Box, options.AutoRebuildNavMeshTimeoutMs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,11 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the model used by this actor.
|
||||
/// </summary>
|
||||
public Model Model => ((StaticModel)Actor).Model;
|
||||
|
||||
/// <inheritdoc />
|
||||
public StaticModelNode(Actor actor)
|
||||
: base(actor)
|
||||
@@ -120,12 +125,12 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
{
|
||||
base.OnContextMenu(contextMenu, window);
|
||||
|
||||
// Check if every selected node is a primitive
|
||||
// Check if every selected node is a primitive or has collision asset
|
||||
var selection = GetSelection(window);
|
||||
bool autoOptionEnabled = true;
|
||||
foreach (var node in selection)
|
||||
{
|
||||
if (node is StaticModelNode staticModelNode && !staticModelNode.IsPrimitive)
|
||||
if (node is StaticModelNode staticModelNode && (!staticModelNode.IsPrimitive && GetCollisionData(staticModelNode.Model) == null))
|
||||
{
|
||||
autoOptionEnabled = false;
|
||||
break;
|
||||
@@ -201,6 +206,54 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
return Array.Empty<SceneGraphNode>();
|
||||
}
|
||||
|
||||
private static bool TryCollisionData(Model model, BinaryAssetItem assetItem, out CollisionData collisionData)
|
||||
{
|
||||
collisionData = FlaxEngine.Content.Load<CollisionData>(assetItem.ID);
|
||||
if (collisionData)
|
||||
{
|
||||
var options = collisionData.Options;
|
||||
if (options.Model == model.ID || options.Model == Guid.Empty)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private CollisionData GetCollisionData(Model model)
|
||||
{
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
// Check if there already is collision data for that model to reuse
|
||||
var modelItem = (AssetItem)Editor.Instance.ContentDatabase.Find(model.ID);
|
||||
if (modelItem?.ParentFolder != null)
|
||||
{
|
||||
foreach (var child in modelItem.ParentFolder.Children)
|
||||
{
|
||||
// Check if there is collision that was made with this model
|
||||
if (child is BinaryAssetItem b && b.IsOfType<CollisionData>())
|
||||
{
|
||||
if (TryCollisionData(model, b, out var collisionData))
|
||||
return collisionData;
|
||||
}
|
||||
|
||||
// Check if there is an auto-imported collision
|
||||
if (child is ContentFolder childFolder && childFolder.ShortName == modelItem.ShortName)
|
||||
{
|
||||
foreach (var childFolderChild in childFolder.Children)
|
||||
{
|
||||
if (childFolderChild is BinaryAssetItem c && c.IsOfType<CollisionData>())
|
||||
{
|
||||
if (TryCollisionData(model, c, out var collisionData))
|
||||
return collisionData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void CreateAuto(StaticModel actor, Spawner spawner, bool singleNode)
|
||||
{
|
||||
// Special case for in-built Editor models that can use analytical collision
|
||||
@@ -243,6 +296,15 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
collider.LocalPosition = new Vector3(0, 50.0f, 0);
|
||||
collider.LocalOrientation = Quaternion.Euler(0, 0, 90.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
var collider = new MeshCollider
|
||||
{
|
||||
Transform = actor.Transform,
|
||||
CollisionData = GetCollisionData(model),
|
||||
};
|
||||
spawner(collider);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateBox(StaticModel actor, Spawner spawner, bool singleNode)
|
||||
|
||||
@@ -304,25 +304,14 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class CustomCodeNode : SurfaceNode
|
||||
internal sealed class CustomCodeNode : ResizableSurfaceNode
|
||||
{
|
||||
private Rectangle _resizeButtonRect;
|
||||
private Float2 _startResizingSize;
|
||||
private Float2 _startResizingCornerOffset;
|
||||
private bool _isResizing;
|
||||
private CustomCodeTextBox _textBox;
|
||||
|
||||
private int SizeValueIndex => Archetype.TypeID == 8 ? 1 : 3; // Index of the Size stored in Values array
|
||||
|
||||
private Float2 SizeValue
|
||||
{
|
||||
get => (Float2)Values[SizeValueIndex];
|
||||
set => SetValue(SizeValueIndex, value, false);
|
||||
}
|
||||
|
||||
public CustomCodeNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
_sizeValueIndex = Archetype.TypeID == 8 ? 1 : 3; // Index of the Size stored in Values array
|
||||
Float2 pos = new Float2(FlaxEditor.Surface.Constants.NodeMarginX, FlaxEditor.Surface.Constants.NodeMarginY + FlaxEditor.Surface.Constants.NodeHeaderSize), size;
|
||||
if (nodeArch.TypeID == 8)
|
||||
{
|
||||
@@ -345,126 +334,19 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
_textBox.EditEnd += () => SetValue(0, _textBox.Text);
|
||||
}
|
||||
|
||||
public override bool CanSelect(ref Float2 location)
|
||||
{
|
||||
return base.CanSelect(ref location) && !_resizeButtonRect.MakeOffsetted(Location).Contains(ref location);
|
||||
}
|
||||
|
||||
public override void OnSurfaceLoaded(SurfaceNodeActions action)
|
||||
{
|
||||
base.OnSurfaceLoaded(action);
|
||||
|
||||
_textBox.Text = (string)Values[0];
|
||||
|
||||
var size = SizeValue;
|
||||
if (Surface != null && Surface.GridSnappingEnabled)
|
||||
size = Surface.SnapToGrid(size, true);
|
||||
Resize(size.X, size.Y);
|
||||
}
|
||||
|
||||
public override void OnValuesChanged()
|
||||
{
|
||||
base.OnValuesChanged();
|
||||
|
||||
var size = SizeValue;
|
||||
Resize(size.X, size.Y);
|
||||
_textBox.Text = (string)Values[0];
|
||||
}
|
||||
|
||||
protected override void UpdateRectangles()
|
||||
{
|
||||
base.UpdateRectangles();
|
||||
|
||||
const float buttonMargin = FlaxEditor.Surface.Constants.NodeCloseButtonMargin;
|
||||
const float buttonSize = FlaxEditor.Surface.Constants.NodeCloseButtonSize;
|
||||
_resizeButtonRect = new Rectangle(_closeButtonRect.Left, Height - buttonSize - buttonMargin - 4, buttonSize, buttonSize);
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
base.Draw();
|
||||
|
||||
var style = Style.Current;
|
||||
if (_isResizing)
|
||||
{
|
||||
Render2D.FillRectangle(_resizeButtonRect, style.Selection);
|
||||
Render2D.DrawRectangle(_resizeButtonRect, style.SelectionBorder);
|
||||
}
|
||||
Render2D.DrawSprite(style.Scale, _resizeButtonRect, _resizeButtonRect.Contains(_mousePosition) && Surface.CanEdit ? style.Foreground : style.ForegroundGrey);
|
||||
}
|
||||
|
||||
public override void OnLostFocus()
|
||||
{
|
||||
if (_isResizing)
|
||||
EndResizing();
|
||||
|
||||
base.OnLostFocus();
|
||||
}
|
||||
|
||||
public override void OnEndMouseCapture()
|
||||
{
|
||||
if (_isResizing)
|
||||
EndResizing();
|
||||
|
||||
base.OnEndMouseCapture();
|
||||
}
|
||||
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
if (base.OnMouseDown(location, button))
|
||||
return true;
|
||||
|
||||
if (button == MouseButton.Left && _resizeButtonRect.Contains(ref location) && Surface.CanEdit)
|
||||
{
|
||||
// Start sliding
|
||||
_isResizing = true;
|
||||
_startResizingSize = Size;
|
||||
_startResizingCornerOffset = Size - location;
|
||||
StartMouseCapture();
|
||||
Cursor = CursorType.SizeNWSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnMouseMove(Float2 location)
|
||||
{
|
||||
if (_isResizing)
|
||||
{
|
||||
var emptySize = CalculateNodeSize(0, 0);
|
||||
var size = Float2.Max(location - emptySize + _startResizingCornerOffset, new Float2(240, 160));
|
||||
Resize(size.X, size.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnMouseMove(location);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
if (button == MouseButton.Left && _isResizing)
|
||||
{
|
||||
EndResizing();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnMouseUp(location, button);
|
||||
}
|
||||
|
||||
private void EndResizing()
|
||||
{
|
||||
Cursor = CursorType.Default;
|
||||
EndMouseCapture();
|
||||
_isResizing = false;
|
||||
if (_startResizingSize != Size)
|
||||
{
|
||||
var emptySize = CalculateNodeSize(0, 0);
|
||||
SizeValue = Size - emptySize;
|
||||
Surface.MarkAsEdited(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal enum MaterialTemplateInputsMapping
|
||||
@@ -1347,6 +1229,32 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.Output(0, "Result", typeof(Float4), 3),
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 52,
|
||||
Title = "Linear to sRGB",
|
||||
Description = "Converts linear color into sRGB.",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
Size = new Float2(150, 20),
|
||||
Elements =
|
||||
[
|
||||
NodeElementArchetype.Factory.Input(0, "Linear", true, typeof(Float3), 0),
|
||||
NodeElementArchetype.Factory.Output(0, "sRGB", typeof(Float3), 1),
|
||||
]
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 53,
|
||||
Title = "sRGB to Linear",
|
||||
Description = "Converts sRGB color into linear.",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
Size = new Float2(150, 20),
|
||||
Elements =
|
||||
[
|
||||
NodeElementArchetype.Factory.Input(0, "sRGB", true, typeof(Float3), 0),
|
||||
NodeElementArchetype.Factory.Output(0, "Linear", typeof(Float3), 1),
|
||||
]
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1100,6 +1100,27 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.ComboBox(2 + 20, 0, 116)
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 5,
|
||||
Create = (id, context, arch, groupArch) => new SurfaceNodeParamsSet(id, context, arch, groupArch),
|
||||
Title = "Set Parameter",
|
||||
Description = "Parameter value setter invoked when the animation pose is evaluated (output pose comes from input)",
|
||||
Flags = NodeFlags.AnimGraph,
|
||||
Size = new Float2(140, 40),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Guid.Empty,
|
||||
null
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
NodeElementArchetype.Factory.Output(0, string.Empty, typeof(void), 0),
|
||||
NodeElementArchetype.Factory.Input(0, string.Empty, true, typeof(void), 2),
|
||||
NodeElementArchetype.Factory.Input(1, string.Empty, true, ScriptType.Null, 1, 1),
|
||||
NodeElementArchetype.Factory.ComboBox(2 + 20, 0, 116)
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,14 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
TextureGroup = 4,
|
||||
}
|
||||
|
||||
internal class SampleTextureNode : SurfaceNode
|
||||
internal class TextureSamplerNode : SurfaceNode
|
||||
{
|
||||
private ComboBox _textureGroupPicker;
|
||||
protected int _samplerTypeValueIndex = -1;
|
||||
protected int _textureGroupValueIndex = -1;
|
||||
protected int _level = 5;
|
||||
|
||||
public SampleTextureNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
protected TextureSamplerNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
}
|
||||
@@ -48,13 +51,13 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
|
||||
private void UpdateUI()
|
||||
{
|
||||
if ((int)Values[0] == (int)CommonSamplerType.TextureGroup)
|
||||
if ((int)Values[_samplerTypeValueIndex] == (int)CommonSamplerType.TextureGroup)
|
||||
{
|
||||
if (_textureGroupPicker == null)
|
||||
{
|
||||
_textureGroupPicker = new ComboBox
|
||||
{
|
||||
Location = new Float2(FlaxEditor.Surface.Constants.NodeMarginX + 50, FlaxEditor.Surface.Constants.NodeMarginY + FlaxEditor.Surface.Constants.NodeHeaderSize + FlaxEditor.Surface.Constants.LayoutOffsetY * 5),
|
||||
Location = new Float2(FlaxEditor.Surface.Constants.NodeMarginX + 50, FlaxEditor.Surface.Constants.NodeMarginY + FlaxEditor.Surface.Constants.NodeHeaderSize + FlaxEditor.Surface.Constants.LayoutOffsetY * _level),
|
||||
Width = 100,
|
||||
Parent = this,
|
||||
};
|
||||
@@ -71,7 +74,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
_textureGroupPicker.Visible = true;
|
||||
}
|
||||
_textureGroupPicker.SelectedIndexChanged -= OnSelectedTextureGroupChanged;
|
||||
_textureGroupPicker.SelectedIndex = (int)Values[2];
|
||||
_textureGroupPicker.SelectedIndex = (int)Values[_textureGroupValueIndex];
|
||||
_textureGroupPicker.SelectedIndexChanged += OnSelectedTextureGroupChanged;
|
||||
}
|
||||
else if (_textureGroupPicker != null)
|
||||
@@ -83,7 +86,39 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
|
||||
private void OnSelectedTextureGroupChanged(ComboBox comboBox)
|
||||
{
|
||||
SetValue(2, _textureGroupPicker.SelectedIndex);
|
||||
SetValue(_textureGroupValueIndex, _textureGroupPicker.SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
internal class SampleTextureNode : TextureSamplerNode
|
||||
{
|
||||
public SampleTextureNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
_samplerTypeValueIndex = 0;
|
||||
_textureGroupValueIndex = 2;
|
||||
}
|
||||
}
|
||||
|
||||
internal class TriplanarSampleTextureNode : TextureSamplerNode
|
||||
{
|
||||
public TriplanarSampleTextureNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
_samplerTypeValueIndex = 3;
|
||||
_textureGroupValueIndex = 5;
|
||||
_level = 5;
|
||||
}
|
||||
}
|
||||
|
||||
internal class ProceduralSampleTextureNode : TextureSamplerNode
|
||||
{
|
||||
public ProceduralSampleTextureNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
_samplerTypeValueIndex = 0;
|
||||
_textureGroupValueIndex = 2;
|
||||
_level = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,9 +315,9 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
ConnectionsHints = ConnectionsHint.Vector,
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
0,
|
||||
-1.0f,
|
||||
0,
|
||||
(int)CommonSamplerType.LinearClamp, // Sampler
|
||||
-1.0f, // Level
|
||||
0, // Texture Group
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
@@ -402,6 +437,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 16,
|
||||
Create = (id, context, arch, groupArch) => new TriplanarSampleTextureNode(id, context, arch, groupArch),
|
||||
Title = "Triplanar Texture",
|
||||
Description = "Projects a texture using world-space coordinates with triplanar mapping.",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
@@ -411,8 +447,9 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Float3.One, // Scale
|
||||
1.0f, // Blend
|
||||
Float2.Zero, // Offset
|
||||
2, // Sampler
|
||||
(int)CommonSamplerType.LinearWrap, // Sampler
|
||||
false, // Local
|
||||
0, // Texture Group
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
@@ -430,17 +467,17 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
new NodeArchetype
|
||||
{
|
||||
TypeID = 17,
|
||||
Create = (id, context, arch, groupArch) => new SampleTextureNode(id, context, arch, groupArch),
|
||||
Create = (id, context, arch, groupArch) => new ProceduralSampleTextureNode(id, context, arch, groupArch),
|
||||
Title = "Procedural Sample Texture",
|
||||
Description = "Samples a texture to create a more natural look with less obvious tiling.",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
Size = new Float2(240, 110),
|
||||
Size = new Float2(240, 130),
|
||||
ConnectionsHints = ConnectionsHint.Vector,
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
2,
|
||||
-1.0f,
|
||||
0,
|
||||
(int)CommonSamplerType.LinearWrap, // Sampler
|
||||
-1.0f, // Level
|
||||
0, // Texture Group
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
@@ -448,8 +485,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
NodeElementArchetype.Factory.Input(1, "UVs", true, null, 1),
|
||||
NodeElementArchetype.Factory.Input(2, "Offset", true, typeof(Float2), 3),
|
||||
NodeElementArchetype.Factory.Output(0, "Color", typeof(Float4), 4),
|
||||
NodeElementArchetype.Factory.Text(0, Surface.Constants.LayoutOffsetY * 4, "Sampler"),
|
||||
NodeElementArchetype.Factory.ComboBox(50, Surface.Constants.LayoutOffsetY * 4, 100, 0, typeof(CommonSamplerType))
|
||||
NodeElementArchetype.Factory.Text(0, Surface.Constants.LayoutOffsetY * 3, "Sampler"),
|
||||
NodeElementArchetype.Factory.ComboBox(50, Surface.Constants.LayoutOffsetY * 3, 100, 0, typeof(CommonSamplerType))
|
||||
}
|
||||
},
|
||||
new NodeArchetype
|
||||
@@ -469,6 +506,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
{
|
||||
TypeID = 23,
|
||||
Title = "Triplanar Normal Map",
|
||||
Create = (id, context, arch, groupArch) => new TriplanarSampleTextureNode(id, context, arch, groupArch),
|
||||
Description = "Projects a normal map texture using world-space coordinates with triplanar mapping.",
|
||||
Flags = NodeFlags.MaterialGraph,
|
||||
Size = new Float2(280, 100),
|
||||
@@ -477,8 +515,9 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Float3.One, // Scale
|
||||
1.0f, // Blend
|
||||
Float2.Zero, // Offset
|
||||
2, // Sampler
|
||||
(int)CommonSamplerType.LinearWrap, // Sampler
|
||||
false, // Local
|
||||
0, // Texture Group
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
|
||||
@@ -453,7 +453,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
}
|
||||
}
|
||||
|
||||
private class CurveNode<T> : SurfaceNode where T : struct
|
||||
private class CurveNode<T> : ResizableSurfaceNode where T : struct
|
||||
{
|
||||
private BezierCurveEditor<T> _curve;
|
||||
private bool _isSavingCurve;
|
||||
@@ -467,7 +467,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Create = (id, context, arch, groupArch) => new CurveNode<T>(id, context, arch, groupArch),
|
||||
Description = "An animation spline represented by a set of keyframes, each representing an endpoint of a Bezier curve.",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
Size = new Float2(400, 180.0f),
|
||||
Size = new Float2(400, 180),
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
// Keyframes count
|
||||
@@ -491,6 +491,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
0.0f, zero, zero, zero,
|
||||
0.0f, zero, zero, zero,
|
||||
0.0f, zero, zero, zero,
|
||||
|
||||
new Float2(400, 180),
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
@@ -504,30 +506,52 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
public CurveNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
_sizeValueIndex = 29; // Index of the Size stored in Values array
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnLoaded(SurfaceNodeActions action)
|
||||
{
|
||||
base.OnLoaded(action);
|
||||
|
||||
// Create curve editor
|
||||
var upperLeft = GetBox(0).BottomLeft;
|
||||
var upperRight = GetBox(1).BottomRight;
|
||||
float curveMargin = 20.0f;
|
||||
|
||||
_curve = new BezierCurveEditor<T>
|
||||
{
|
||||
MaxKeyframes = 7,
|
||||
Bounds = new Rectangle(upperLeft + new Float2(curveMargin, 10.0f), upperRight.X - upperLeft.X - curveMargin * 2.0f, 140.0f),
|
||||
Parent = this
|
||||
Parent = this,
|
||||
AnchorMax = Float2.One,
|
||||
};
|
||||
_curve.Edited += OnCurveEdited;
|
||||
_curve.UnlockChildrenRecursive();
|
||||
_curve.PerformLayout();
|
||||
|
||||
// Sync keyframes
|
||||
UpdateCurveKeyframes();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSurfaceLoaded(SurfaceNodeActions action)
|
||||
{
|
||||
base.OnSurfaceLoaded(action);
|
||||
|
||||
// Ensure the whole curve is shown
|
||||
_curve.ShowWholeCurve();
|
||||
}
|
||||
|
||||
public override void OnValuesChanged()
|
||||
{
|
||||
base.OnValuesChanged();
|
||||
|
||||
if (!_isSavingCurve)
|
||||
{
|
||||
UpdateCurveKeyframes();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCurveEdited()
|
||||
{
|
||||
if (_isSavingCurve)
|
||||
@@ -553,17 +577,6 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
_isSavingCurve = false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnValuesChanged()
|
||||
{
|
||||
base.OnValuesChanged();
|
||||
|
||||
if (!_isSavingCurve)
|
||||
{
|
||||
UpdateCurveKeyframes();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCurveKeyframes()
|
||||
{
|
||||
var count = (int)Values[0];
|
||||
@@ -1575,7 +1588,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
DefaultValues = new object[]
|
||||
{
|
||||
Guid.Empty,
|
||||
string.Empty
|
||||
string.Empty,
|
||||
},
|
||||
Elements = new[]
|
||||
{
|
||||
|
||||
182
Source/Editor/Surface/ResizableSurfaceNode.cs
Normal file
182
Source/Editor/Surface/ResizableSurfaceNode.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Surface
|
||||
{
|
||||
/// <summary>
|
||||
/// Visject Surface node control that cna be resized.
|
||||
/// </summary>
|
||||
/// <seealso cref="SurfaceNode" />
|
||||
[HideInEditor]
|
||||
public class ResizableSurfaceNode : SurfaceNode
|
||||
{
|
||||
private Float2 _startResizingSize;
|
||||
private Float2 _startResizingCornerOffset;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the node is currently being resized.
|
||||
/// </summary>
|
||||
protected bool _isResizing;
|
||||
|
||||
/// <summary>
|
||||
/// Index of the Float2 value in the node values list to store node size.
|
||||
/// </summary>
|
||||
protected int _sizeValueIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum node size.
|
||||
/// </summary>
|
||||
protected Float2 _sizeMin = new Float2(240, 160);
|
||||
|
||||
/// <summary>
|
||||
/// Node resizing rectangle bounds.
|
||||
/// </summary>
|
||||
protected Rectangle _resizeButtonRect;
|
||||
|
||||
private Float2 SizeValue
|
||||
{
|
||||
get => (Float2)Values[_sizeValueIndex];
|
||||
set => SetValue(_sizeValueIndex, value, false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ResizableSurfaceNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanSelect(ref Float2 location)
|
||||
{
|
||||
return base.CanSelect(ref location) && !_resizeButtonRect.MakeOffsetted(Location).Contains(ref location);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSurfaceLoaded(SurfaceNodeActions action)
|
||||
{
|
||||
// Reapply the curve node size
|
||||
var size = SizeValue;
|
||||
if (Surface != null && Surface.GridSnappingEnabled)
|
||||
size = Surface.SnapToGrid(size, true);
|
||||
Resize(size.X, size.Y);
|
||||
|
||||
base.OnSurfaceLoaded(action);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnValuesChanged()
|
||||
{
|
||||
base.OnValuesChanged();
|
||||
|
||||
var size = SizeValue;
|
||||
Resize(size.X, size.Y);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
base.Draw();
|
||||
|
||||
if (Surface.CanEdit)
|
||||
{
|
||||
var style = Style.Current;
|
||||
if (_isResizing)
|
||||
{
|
||||
Render2D.FillRectangle(_resizeButtonRect, style.Selection);
|
||||
Render2D.DrawRectangle(_resizeButtonRect, style.SelectionBorder);
|
||||
}
|
||||
Render2D.DrawSprite(style.Scale, _resizeButtonRect, _resizeButtonRect.Contains(_mousePosition) ? style.Foreground : style.ForegroundGrey);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnLostFocus()
|
||||
{
|
||||
if (_isResizing)
|
||||
EndResizing();
|
||||
|
||||
base.OnLostFocus();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndMouseCapture()
|
||||
{
|
||||
if (_isResizing)
|
||||
EndResizing();
|
||||
|
||||
base.OnEndMouseCapture();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
if (base.OnMouseDown(location, button))
|
||||
return true;
|
||||
|
||||
if (button == MouseButton.Left && _resizeButtonRect.Contains(ref location) && Surface.CanEdit)
|
||||
{
|
||||
// Start resizing
|
||||
_isResizing = true;
|
||||
_startResizingSize = Size;
|
||||
_startResizingCornerOffset = Size - location;
|
||||
StartMouseCapture();
|
||||
Cursor = CursorType.SizeNWSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseMove(Float2 location)
|
||||
{
|
||||
if (_isResizing)
|
||||
{
|
||||
var emptySize = CalculateNodeSize(0, 0);
|
||||
var size = Float2.Max(location - emptySize + _startResizingCornerOffset, _sizeMin);
|
||||
Resize(size.X, size.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnMouseMove(location);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
if (button == MouseButton.Left && _isResizing)
|
||||
{
|
||||
EndResizing();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnMouseUp(location, button);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateRectangles()
|
||||
{
|
||||
base.UpdateRectangles();
|
||||
|
||||
const float buttonMargin = Constants.NodeCloseButtonMargin;
|
||||
const float buttonSize = Constants.NodeCloseButtonSize;
|
||||
_resizeButtonRect = new Rectangle(_closeButtonRect.Left, Height - buttonSize - buttonMargin - 4, buttonSize, buttonSize);
|
||||
}
|
||||
|
||||
private void EndResizing()
|
||||
{
|
||||
Cursor = CursorType.Default;
|
||||
EndMouseCapture();
|
||||
_isResizing = false;
|
||||
if (_startResizingSize != Size)
|
||||
{
|
||||
var emptySize = CalculateNodeSize(0, 0);
|
||||
SizeValue = Size - emptySize;
|
||||
Surface.MarkAsEdited(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,18 +14,11 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
/// <seealso cref="SurfaceNode" />
|
||||
[HideInEditor]
|
||||
public class SurfaceComment : SurfaceNode
|
||||
public class SurfaceComment : ResizableSurfaceNode
|
||||
{
|
||||
private Rectangle _colorButtonRect;
|
||||
private Rectangle _resizeButtonRect;
|
||||
private Float2 _startResizingSize;
|
||||
private readonly TextBox _renameTextBox;
|
||||
|
||||
/// <summary>
|
||||
/// True if sizing tool is in use.
|
||||
/// </summary>
|
||||
protected bool _isResizing;
|
||||
|
||||
/// <summary>
|
||||
/// True if rename textbox is active in order to rename comment
|
||||
/// </summary>
|
||||
@@ -52,12 +45,6 @@ namespace FlaxEditor.Surface
|
||||
set => SetValue(1, value, false);
|
||||
}
|
||||
|
||||
private Float2 SizeValue
|
||||
{
|
||||
get => (Float2)Values[2];
|
||||
set => SetValue(2, value, false);
|
||||
}
|
||||
|
||||
private int OrderValue
|
||||
{
|
||||
get => (int)Values[3];
|
||||
@@ -68,6 +55,8 @@ namespace FlaxEditor.Surface
|
||||
public SurfaceComment(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||
: base(id, context, nodeArch, groupArch)
|
||||
{
|
||||
_sizeValueIndex = 2; // Index of the Size stored in Values array
|
||||
_sizeMin = new Float2(140.0f, Constants.NodeHeaderSize);
|
||||
_renameTextBox = new TextBox(false, 0, 0, Width)
|
||||
{
|
||||
Height = Constants.NodeHeaderSize,
|
||||
@@ -86,10 +75,6 @@ namespace FlaxEditor.Surface
|
||||
// Read node data
|
||||
Title = TitleValue;
|
||||
Color = ColorValue;
|
||||
var size = SizeValue;
|
||||
if (Surface != null && Surface.GridSnappingEnabled)
|
||||
size = Surface.SnapToGrid(size, true);
|
||||
Size = size;
|
||||
|
||||
// Order
|
||||
// Backwards compatibility - When opening with an older version send the old comments to the back
|
||||
@@ -126,27 +111,6 @@ namespace FlaxEditor.Surface
|
||||
// Read node data
|
||||
Title = TitleValue;
|
||||
Color = ColorValue;
|
||||
Size = SizeValue;
|
||||
}
|
||||
|
||||
private void EndResizing()
|
||||
{
|
||||
// Clear state
|
||||
_isResizing = false;
|
||||
|
||||
if (_startResizingSize != Size)
|
||||
{
|
||||
SizeValue = Size;
|
||||
Surface.MarkAsEdited(false);
|
||||
}
|
||||
|
||||
EndMouseCapture();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanSelect(ref Float2 location)
|
||||
{
|
||||
return _headerRect.MakeOffsetted(Location).Contains(ref location) && !_resizeButtonRect.MakeOffsetted(Location).Contains(ref location);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -158,6 +122,8 @@ namespace FlaxEditor.Surface
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateRectangles()
|
||||
{
|
||||
base.UpdateRectangles();
|
||||
|
||||
const float headerSize = Constants.NodeHeaderSize;
|
||||
const float buttonMargin = Constants.NodeCloseButtonMargin;
|
||||
const float buttonSize = Constants.NodeCloseButtonSize;
|
||||
@@ -222,16 +188,13 @@ namespace FlaxEditor.Surface
|
||||
// Color button
|
||||
Render2D.DrawSprite(style.Settings, _colorButtonRect, _colorButtonRect.Contains(_mousePosition) && Surface.CanEdit ? style.Foreground : style.ForegroundGrey);
|
||||
|
||||
// Check if is resizing
|
||||
// Resize button
|
||||
if (_isResizing)
|
||||
{
|
||||
// Draw overlay
|
||||
Render2D.FillRectangle(_resizeButtonRect, style.Selection);
|
||||
Render2D.DrawRectangle(_resizeButtonRect, style.SelectionBorder);
|
||||
}
|
||||
|
||||
// Resize button
|
||||
Render2D.DrawSprite(style.Scale, _resizeButtonRect, _resizeButtonRect.Contains(_mousePosition) && Surface.CanEdit ? style.Foreground : style.ForegroundGrey);
|
||||
Render2D.DrawSprite(style.Scale, _resizeButtonRect, _resizeButtonRect.Contains(_mousePosition) ? style.Foreground : style.ForegroundGrey);
|
||||
}
|
||||
|
||||
// Selection outline
|
||||
@@ -247,88 +210,28 @@ namespace FlaxEditor.Surface
|
||||
/// <inheritdoc />
|
||||
protected override Float2 CalculateNodeSize(float width, float height)
|
||||
{
|
||||
return Size;
|
||||
// No margins or headers
|
||||
return new Float2(width, height);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnLostFocus()
|
||||
{
|
||||
// Check if was resizing
|
||||
if (_isResizing)
|
||||
{
|
||||
EndResizing();
|
||||
}
|
||||
|
||||
// Check if was renaming
|
||||
if (_isRenaming)
|
||||
{
|
||||
Rename(_renameTextBox.Text);
|
||||
StopRenaming();
|
||||
}
|
||||
|
||||
// Base
|
||||
base.OnLostFocus();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndMouseCapture()
|
||||
{
|
||||
// Check if was resizing
|
||||
if (_isResizing)
|
||||
{
|
||||
EndResizing();
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnEndMouseCapture();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool ContainsPoint(ref Float2 location, bool precise)
|
||||
{
|
||||
return _headerRect.Contains(ref location) || _resizeButtonRect.Contains(ref location);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
if (base.OnMouseDown(location, button))
|
||||
return true;
|
||||
|
||||
// Check if can start resizing
|
||||
if (button == MouseButton.Left && _resizeButtonRect.Contains(ref location) && Surface.CanEdit)
|
||||
{
|
||||
// Start sliding
|
||||
_isResizing = true;
|
||||
_startResizingSize = Size;
|
||||
StartMouseCapture();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseMove(Float2 location)
|
||||
{
|
||||
// Check if is resizing
|
||||
if (_isResizing)
|
||||
{
|
||||
// Update size
|
||||
var size = Float2.Max(location, new Float2(140.0f, _headerRect.Bottom));
|
||||
if (Surface.GridSnappingEnabled)
|
||||
size = Surface.SnapToGrid(size, true);
|
||||
Size = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Base
|
||||
base.OnMouseMove(location);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
|
||||
{
|
||||
@@ -394,12 +297,6 @@ namespace FlaxEditor.Surface
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
if (button == MouseButton.Left && _isResizing)
|
||||
{
|
||||
EndResizing();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (base.OnMouseUp(location, button))
|
||||
return true;
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ namespace FlaxEditor.Surface
|
||||
}
|
||||
}
|
||||
}
|
||||
surface.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user