From 24d51a05a937269da39c06971b4e4388766baa39 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Feb 2018 23:52:20 +1100 Subject: [PATCH] Manipulator: rename is_visible -> poll Rename to WM_manipulator_group_type_poll, use convention of other poll functions. --- .../windowmanager/manipulators/WM_manipulator_api.h | 2 ++ .../manipulators/intern/wm_manipulator_group.c | 4 ++-- .../manipulators/intern/wm_manipulator_intern.h | 1 - .../manipulators/intern/wm_manipulator_map.c | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h index 53bee9c6775..97fcb4513be 100644 --- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h +++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h @@ -331,4 +331,6 @@ void WM_manipulator_group_type_unlink_delayed(const char *idname); /* Utilities */ bool WM_manipulator_context_check_drawstep(const struct bContext *C, eWM_ManipulatorMapDrawStep step); +bool WM_manipulator_group_type_poll(const struct bContext *C, const struct wmManipulatorGroupType *wgt); + #endif /* __WM_MANIPULATOR_API_H__ */ diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c index 0e63f3d6ffe..591e76dc37d 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c @@ -201,10 +201,10 @@ void wm_manipulatorgroup_ensure_initialized(wmManipulatorGroup *mgroup, const bC } } -bool wm_manipulatorgroup_is_visible(const wmManipulatorGroup *mgroup, const bContext *C) +bool WM_manipulator_group_type_poll(const bContext *C, const struct wmManipulatorGroupType *wgt) { /* Check for poll function, if manipulator-group belongs to an operator, also check if the operator is running. */ - return (!mgroup->type->poll || mgroup->type->poll(C, mgroup->type)); + return (!wgt->poll || wgt->poll(C, (wmManipulatorGroupType *)wgt)); } bool wm_manipulatorgroup_is_visible_in_drawstep( diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h index b7982cf00df..a131c6c5069 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h @@ -75,7 +75,6 @@ struct wmManipulator *wm_manipulatorgroup_find_intersected_manipulator( void wm_manipulatorgroup_intersectable_manipulators_to_list( const struct wmManipulatorGroup *mgroup, struct ListBase *listbase); void wm_manipulatorgroup_ensure_initialized(struct wmManipulatorGroup *mgroup, const struct bContext *C); -bool wm_manipulatorgroup_is_visible(const struct wmManipulatorGroup *mgroup, const struct bContext *C); bool wm_manipulatorgroup_is_visible_in_drawstep( const struct wmManipulatorGroup *mgroup, const eWM_ManipulatorMapDrawStep drawstep); diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c index 153052d7e1c..d774c4e4a2e 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c @@ -272,7 +272,7 @@ static GHash *WM_manipulatormap_manipulator_hash_new( /* collect manipulators */ for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { - if (!mgroup->type->poll || mgroup->type->poll(C, mgroup->type)) { + if (WM_manipulator_group_type_poll(C, mgroup->type)) { for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { if ((include_hidden || (mpr->flag & WM_MANIPULATOR_HIDDEN) == 0) && (!poll || poll(mpr, data))) @@ -350,7 +350,7 @@ static void manipulatormap_prepare_drawing( for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { /* check group visibility - drawstep first to avoid unnecessary call of group poll callback */ if (!wm_manipulatorgroup_is_visible_in_drawstep(mgroup, drawstep) || - !wm_manipulatorgroup_is_visible(mgroup, C)) + !WM_manipulator_group_type_poll(C, mgroup->type)) { continue; } @@ -597,7 +597,7 @@ wmManipulator *wm_manipulatormap_highlight_find( continue; } - if (wm_manipulatorgroup_is_visible(mgroup, C)) { + if (WM_manipulator_group_type_poll(C, mgroup->type)) { eWM_ManipulatorMapDrawStep step; if (mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { step = WM_MANIPULATORMAP_DRAWSTEP_3D; @@ -984,7 +984,7 @@ void WM_manipulatormap_message_subscribe( bContext *C, wmManipulatorMap *mmap, ARegion *ar, struct wmMsgBus *mbus) { for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { - if (!wm_manipulatorgroup_is_visible(mgroup, C)) { + if (!WM_manipulator_group_type_poll(C, mgroup->type)) { continue; } for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) {