From 3b08cb3236d506f89bde23f494e9883dd0bb5ed9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 10 Aug 2020 18:18:59 +0200 Subject: [PATCH 1/2] Cleanup: follow code style regarding braces --- intern/sky/source/sky_model.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/intern/sky/source/sky_model.cpp b/intern/sky/source/sky_model.cpp index 64cf14ec030..e835e04d164 100644 --- a/intern/sky/source/sky_model.cpp +++ b/intern/sky/source/sky_model.cpp @@ -178,8 +178,9 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset, pow(solar_elevation, 5.0) * elev_matrix[i + 45]); } - if (int_turbidity == 10) + if (int_turbidity == 10) { return; + } // alb 0 high turb elev_matrix = dataset + (9 * 6 * (int_turbidity)); @@ -243,8 +244,9 @@ static double ArHosekSkyModel_CookRadianceConfiguration(ArHosekSkyModel_Radiance 10.0 * pow(1.0 - solar_elevation, 2.0) * pow(solar_elevation, 3.0) * elev_matrix[3] + 5.0 * (1.0 - solar_elevation) * pow(solar_elevation, 4.0) * elev_matrix[4] + pow(solar_elevation, 5.0) * elev_matrix[5]); - if (int_turbidity == 10) + if (int_turbidity == 10) { return res; + } // alb 0 high turb elev_matrix = dataset + (6 * (int_turbidity)); @@ -298,16 +300,18 @@ double SKY_arhosekskymodel_radiance(SKY_ArHosekSkyModelState *state, { int low_wl = (int)((wavelength - 320.0) / 40.0); - if (low_wl < 0 || low_wl >= 11) + if (low_wl < 0 || low_wl >= 11) { return 0.0; + } double interp = fmod((wavelength - 320.0) / 40.0, 1.0); double val_low = ArHosekSkyModel_GetRadianceInternal(state->configs[low_wl], theta, gamma) * state->radiances[low_wl] * state->emission_correction_factor_sky[low_wl]; - if (interp < 1e-6) + if (interp < 1e-6) { return val_low; + } double result = (1.0 - interp) * val_low; From 8ef05d3180b1b54c7647d059a1f8a6c610937bc9 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 10 Aug 2020 18:24:31 +0200 Subject: [PATCH 2/2] Fix T79636: Inserting special characters with Ctrl+Alt broken on Windows We can't exactly follow what we do for macOS here. On Windows special characters can be inserted with Ctrl+Alt. So make sure we expect UTF-8 characters when Alt is held. Mistake in 87062d4d670c. --- intern/ghost/intern/GHOST_SystemWin32.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index db26bd6a614..f59b106afd6 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1143,9 +1143,11 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA BYTE state[256] = {0}; int r; GetKeyboardState((PBYTE)state); + bool ctrl_pressed = state[VK_CONTROL] & 0x80; + bool alt_pressed = state[VK_MENU] & 0x80; - /* No text with control key pressed. */ - if (state[VK_CONTROL] & 0x80) { + /* No text with control key pressed (Alt can be used to insert special characters though!). */ + if (ctrl_pressed && !alt_pressed) { utf8_char[0] = '\0'; } // Don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical