From 5d21efcd21cd46c336404d37ebf8e80b6ed77c11 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 27 Jan 2020 15:10:48 +0100 Subject: Fix T73409: error deleting preset saved on different drive than Blender install --- release/scripts/modules/bpy/utils/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index abe33b0e8ea..ae1e3495cba 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -486,7 +486,10 @@ def is_path_builtin(path): ): return True except FileNotFoundError: - #The path we tried to look up doesn't exist + # The path we tried to look up doesn't exist. + pass + except ValueError: + # Happens on Windows when paths don't have the same drive. pass return False -- cgit v1.2.3 From 2662ba24380471be0972fcaa545995c1514dbc24 Mon Sep 17 00:00:00 2001 From: mano-wii Date: Mon, 27 Jan 2020 12:59:11 -0300 Subject: Fix T59804: Expose hidden bmesh.ops.symmetrize options in python The operator actually supports a 6-item enum Differential Revision: https://developer.blender.org/D6613 --- source/blender/bmesh/intern/bmesh_opdefines.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 74d01dca66a..4fa7bf64834 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -102,6 +102,16 @@ static BMO_FlagSet bmo_enum_axis_xyz[] = { {0, NULL}, }; +static BMO_FlagSet bmo_enum_axis_neg_xyz_and_xyz[] = { + {0, "-X"}, + {1, "-Y"}, + {2, "-Z"}, + {3, "X"}, + {4, "Y"}, + {5, "Z"}, + {0, NULL}, +}; + static BMO_FlagSet bmo_enum_falloff_type[] = { {SUBD_FALLOFF_SMOOTH, "SMOOTH"}, {SUBD_FALLOFF_SPHERE, "SPHERE"}, @@ -2046,7 +2056,7 @@ static BMOpDefine bmo_symmetrize_def = { "symmetrize", /* slots_in */ {{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"direction", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_axis_xyz}, /* axis to use */ + {"direction", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_axis_neg_xyz_and_xyz}, /* axis to use */ {"dist", BMO_OP_SLOT_FLT}, /* minimum distance */ {{'\0'}}, }, -- cgit v1.2.3 From f4f57ed21aa639e962fb3a28a63cc277e9f5c3ed Mon Sep 17 00:00:00 2001 From: Yevgeny Makarov Date: Mon, 27 Jan 2020 16:07:55 +0100 Subject: Fix part of T65404: quit dialog doesn't show if Blender is minimized This solves the problem for macOS and Linux, but not Windows yet. Differential Revision: https://developer.blender.org/D6673 --- intern/ghost/intern/GHOST_WindowCocoa.mm | 1 + source/blender/windowmanager/intern/wm_window.c | 1 + 2 files changed, 2 insertions(+) diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 1d89da90a32..43e35faf808 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -799,6 +799,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order) GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setOrder(): window invalid"); if (order == GHOST_kWindowOrderTop) { + [NSApp activateIgnoringOtherApps:YES]; [m_window makeKeyAndOrderFront:nil]; } else { diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index e68d4902c66..583a11f1244 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -395,6 +395,7 @@ void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win) if (U.uiflag & USER_SAVE_PROMPT) { if (wm_file_or_image_is_modified(C) && !G.background) { + wm_window_raise(win); wm_confirm_quit(C); } else { -- cgit v1.2.3 From 6bf0e9dbb1c68c183cf48ee2c7c0ca10c53f9075 Mon Sep 17 00:00:00 2001 From: Miguel Pozo Date: Mon, 27 Jan 2020 17:36:50 +0100 Subject: Fix particle instance modifier generating NaN polygons in some cases Particles that don't exist should not be used, for example due to a density texture. Differential Revision: https://developer.blender.org/D6561 --- source/blender/modifiers/intern/MOD_particleinstance.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 49bb8691764..f4c2e78d1ac 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -164,6 +164,9 @@ static bool particle_skip(ParticleInstanceModifierData *pimd, ParticleSystem *ps if (pa->alive == PARS_DEAD && (pimd->flag & eParticleInstanceFlag_Dead) == 0) { return true; } + if (pa->flag & (PARS_UNEXIST | PARS_NO_DISP)) { + return true; + } } if (pimd->particle_amount == 1.0f) { -- cgit v1.2.3 From c8103efbe3bfa2487a2866a7cf22e3b7681338ef Mon Sep 17 00:00:00 2001 From: Simon G Date: Mon, 27 Jan 2020 17:53:49 +0100 Subject: Fix undefined behavior in tangent space computation Use an improved implementation for circular shift. Differential Revision: https://developer.blender.org/D6677 --- intern/mikktspace/mikktspace.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c index 4f120b7d83c..285529298eb 100644 --- a/intern/mikktspace/mikktspace.c +++ b/intern/mikktspace/mikktspace.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "mikktspace.h" @@ -135,6 +136,17 @@ MIKK_INLINE tbool VNotZero(const SVec3 v) } #endif +// Shift operations in C are only defined for shift values which are +// not negative and smaller than sizeof(value) * CHAR_BIT. +// The mask, used with bitwise-and (&), prevents undefined behaviour +// when the shift count is 0 or >= the width of unsigned int. +MIKK_INLINE unsigned int rotl(unsigned int value, unsigned int count) +{ + const unsigned int mask = CHAR_BIT * sizeof(value) - 1; + count &= mask; + return (value << count) | (value >> (-count & mask)); +} + typedef struct { int iNrFaces; int *pTriMembers; @@ -1605,7 +1617,7 @@ static void QuickSortEdges( // Random t = uSeed & 31; - t = (uSeed << t) | (uSeed >> (32 - t)); + t = rotl(uSeed, t); uSeed = uSeed + t + 3; // Random end -- cgit v1.2.3