diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index ac9c2c50df2..e1ce58ba69b 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -272,8 +272,8 @@ typedef struct ModifierTypeInfo { * This function is optional. */ void (*updateDepsgraph)(struct ModifierData *md, - const ModifierUpdateDepsgraphContext* ctx); - + const ModifierUpdateDepsgraphContext *ctx); + /* Should return true if the modifier needs to be recalculated on time * changes. * diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h index 278771e9611..73b52125904 100644 --- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h +++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h @@ -18,8 +18,8 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifndef __BLI_POLYFILL2D_BEAUTIFY_H__ -#define __BLI_POLYFILL2D_BEAUTIFY_H__ +#ifndef __BLI_POLYFILL_2D_BEAUTIFY_H__ +#define __BLI_POLYFILL_2D_BEAUTIFY_H__ struct Heap; struct MemArena; @@ -42,4 +42,4 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex( /* avoid realloc's when creating new structures for polyfill ngons */ #define BLI_POLYFILL_ALLOC_NGON_RESERVE 64 -#endif /* __BLI_POLYFILL2D_BEAUTIFY_H__ */ +#endif /* __BLI_POLYFILL_2D_BEAUTIFY_H__ */ diff --git a/source/blender/blenlib/BLI_voronoi_2d.h b/source/blender/blenlib/BLI_voronoi_2d.h index 51d1d5aa88e..8d1ff2d4c2b 100644 --- a/source/blender/blenlib/BLI_voronoi_2d.h +++ b/source/blender/blenlib/BLI_voronoi_2d.h @@ -23,8 +23,8 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifndef __BLI_VORONOI_H__ -#define __BLI_VORONOI_H__ +#ifndef __BLI_VORONOI_2D_H__ +#define __BLI_VORONOI_2D_H__ struct ListBase; @@ -67,4 +67,4 @@ void BLI_voronoi_triangulate(const VoronoiSite *sites, int sites_total, struct L VoronoiTriangulationPoint **triangulated_points_r, int *triangulated_points_total_r, int (**triangles_r)[3], int *triangles_total_r); -#endif /* __BLI_VORONOI_H__ */ +#endif /* __BLI_VORONOI_2D_H__ */ diff --git a/source/blender/blenlib/intern/boxpack_2d.c b/source/blender/blenlib/intern/boxpack_2d.c index b3beff0b78b..cf9e29209fb 100644 --- a/source/blender/blenlib/intern/boxpack_2d.c +++ b/source/blender/blenlib/intern/boxpack_2d.c @@ -20,7 +20,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/blenlib/intern/boxpack2d.c +/** \file blender/blenlib/intern/boxpack_2d.c * \ingroup bli */ diff --git a/source/blender/blenlib/intern/jitter_2d.c b/source/blender/blenlib/intern/jitter_2d.c index 6c51eeb36d9..26351f52c7f 100644 --- a/source/blender/blenlib/intern/jitter_2d.c +++ b/source/blender/blenlib/intern/jitter_2d.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/blenlib/intern/jitter.c +/** \file blender/blenlib/intern/jitter_2d.c * \ingroup bli * \brief Jitter offset table */ diff --git a/source/blender/blenlib/intern/polyfill_2d_beautify.c b/source/blender/blenlib/intern/polyfill_2d_beautify.c index 93bfb02bce4..9eb2ebc0bab 100644 --- a/source/blender/blenlib/intern/polyfill_2d_beautify.c +++ b/source/blender/blenlib/intern/polyfill_2d_beautify.c @@ -18,7 +18,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/blenlib/intern/polyfill2d_beautify.c +/** \file blender/blenlib/intern/polyfill_2d_beautify.c * \ingroup bli * * This function is to improve the tessellation resulting from polyfill2d, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.cc b/source/blender/depsgraph/intern/builder/deg_builder_map.cc index 8c8446c1686..67cb04d1b98 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.cc @@ -24,7 +24,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/depsgraph/intern/builder/deg_builder.cc +/** \file blender/depsgraph/intern/builder/deg_builder_map.cc * \ingroup depsgraph */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.h b/source/blender/depsgraph/intern/builder/deg_builder_map.h index 0e6d7c81396..5ad22a9aa77 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.h @@ -24,7 +24,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/depsgraph/intern/builder/deg_builder.h +/** \file blender/depsgraph/intern/builder/deg_builder_map.h * \ingroup depsgraph */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 9e1d5e4ec93..56c3c8ab976 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -317,8 +317,10 @@ typedef struct wmKeyMap { short kmi_id; /* last kmi id */ /* runtime */ - int (*poll)(struct bContext *); /* verify if enabled in the current context */ - const void *modal_items; /* for modal, EnumPropertyItem for now */ + /** Verify if enabled in the current context, use #WM_keymap_poll instead of direct calls. */ + int (*poll)(struct bContext *); + /** For modal, #EnumPropertyItem for now. */ + const void *modal_items; } wmKeyMap; /* wmKeyMap.flag */ diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index 8a94472aaf5..b4d4d55479d 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -76,7 +76,8 @@ wmKeyMap *WM_keymap_find_all(const struct bContext *C, const char *idname, int s wmKeyMap *WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap); wmKeyMap *WM_keymap_guess_opname(const struct bContext *C, const char *opname); bool WM_keymap_remove(struct wmKeyConfig *keyconfig, struct wmKeyMap *keymap); - +bool WM_keymap_poll(struct bContext *C, struct wmKeyMap *keymap); + wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id); int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 38f9a2bccae..b6a9115cca4 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2180,7 +2180,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers PRINT("%s: checking '%s' ...", __func__, keymap->idname); - if (!keymap->poll || keymap->poll(C)) { + if (WM_keymap_poll(C, keymap)) { PRINT("pass\n"); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 910b7eadf4c..45ed44d83d6 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -398,6 +398,15 @@ bool WM_keymap_remove(wmKeyConfig *keyconf, wmKeyMap *keymap) } } + +bool WM_keymap_poll(bContext *C, wmKeyMap *keymap) +{ + if (keymap->poll != NULL) { + return keymap->poll(C); + } + return true; +} + static void keymap_event_set(wmKeyMapItem *kmi, short type, short val, int modifier, short keymodifier) { kmi->type = type; @@ -1087,7 +1096,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers( for (handler = handlers->first; handler; handler = handler->next) { keymap = WM_keymap_active(wm, handler->keymap); - if (keymap && (!keymap->poll || keymap->poll((bContext *)C))) { + if (keymap && WM_keymap_poll((bContext *)C, keymap)) { for (kmi = keymap->items.first; kmi; kmi = kmi->next) { /* skip disabled keymap items [T38447] */ if (kmi->flag & KMI_INACTIVE) @@ -1719,7 +1728,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) km = WM_keymap_find_all(C, "Mesh", 0, 0); /* some mesh operators are active in object mode too, like add-prim */ - if (km && km->poll && km->poll((bContext *)C) == 0) { + if (km && !WM_keymap_poll((bContext *)C, km)) { km = WM_keymap_find_all(C, "Object Mode", 0, 0); } } @@ -1729,7 +1738,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) km = WM_keymap_find_all(C, "Curve", 0, 0); /* some curve operators are active in object mode too, like add-prim */ - if (km && km->poll && km->poll((bContext *)C) == 0) { + if (km && !WM_keymap_poll((bContext *)C, km)) { km = WM_keymap_find_all(C, "Object Mode", 0, 0); } } @@ -1757,7 +1766,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) km = WM_keymap_find_all(C, "Metaball", 0, 0); /* some mball operators are active in object mode too, like add-prim */ - if (km && km->poll && km->poll((bContext *)C) == 0) { + if (km && !WM_keymap_poll((bContext *)C, km)) { km = WM_keymap_find_all(C, "Object Mode", 0, 0); } } @@ -1809,7 +1818,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) * Mesh keymap is probably not ideal, but best place I could find to put those. */ if (sl->spacetype == SPACE_VIEW3D) { km = WM_keymap_find_all(C, "Mesh", 0, 0); - if (km && km->poll && !km->poll((bContext *)C)) { + if (km && !WM_keymap_poll((bContext *)C, km)) { km = NULL; } }