diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-10 18:39:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-10 19:19:51 +0300 |
commit | 63830cd6a924fcba6f6d3e2c458546904c615318 (patch) | |
tree | 5baaee899a4956bc64173eb781c741dce7a28d0b /source | |
parent | 1bd8a82960823268b1cadc2273c2cc1647422041 (diff) |
Manipulator: public highlight utility function
Also utility to find group from a manipulator map.
Diffstat (limited to 'source')
3 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h index afc39fe1005..3011da26851 100644 --- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h +++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h @@ -72,6 +72,7 @@ void WM_manipulator_name_set(struct wmManipulatorGroup *mgroup, struct wmManipul bool WM_manipulator_select_unlink(struct wmManipulatorMap *mmap, struct wmManipulator *mpr); bool WM_manipulator_select_set(struct wmManipulatorMap *mmap, struct wmManipulator *mpr, bool select); +void WM_manipulator_highlight_set(struct wmManipulatorMap *mmap, struct wmManipulator *mpr); struct wmManipulatorOpElem *WM_manipulator_operator_get( struct wmManipulator *mpr, int part_index); @@ -227,6 +228,12 @@ struct wmKeyMap *WM_manipulatorgroup_keymap_common_select( struct wmManipulatorMap *WM_manipulatormap_new_from_type( const struct wmManipulatorMapType_Params *mmap_params); const struct ListBase *WM_manipulatormap_group_list(struct wmManipulatorMap *mmap); +struct wmManipulatorGroup *WM_manipulatormap_group_find( + struct wmManipulatorMap *mmap, + const char *idname); +struct wmManipulatorGroup *WM_manipulatormap_group_find_ptr( + struct wmManipulatorMap *mmap, + const struct wmManipulatorGroupType *wgt); void WM_manipulatormap_tag_refresh(struct wmManipulatorMap *mmap); void WM_manipulatormap_draw( struct wmManipulatorMap *mmap, const struct bContext *C, const eWM_ManipulatorMapDrawStep drawstep); diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c index 3df4124ba65..52c8fb24244 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c @@ -445,6 +445,11 @@ bool WM_manipulator_select_set(wmManipulatorMap *mmap, wmManipulator *mpr, bool return wm_manipulator_select_set_ex(mmap, mpr, select, true, true); } +void WM_manipulator_highlight_set(wmManipulatorMap *mmap, wmManipulator *mpr) +{ + wm_manipulatormap_highlight_set(mmap, NULL, mpr, mpr ? mpr->highlight_part : 0); +} + bool wm_manipulator_select_and_highlight(bContext *C, wmManipulatorMap *mmap, wmManipulator *mpr) { if (WM_manipulator_select_set(mmap, mpr, true)) { diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c index 1d8ee35cd32..b170312d17e 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c @@ -195,6 +195,30 @@ void wm_manipulatormap_remove(wmManipulatorMap *mmap) MEM_freeN(mmap); } + +wmManipulatorGroup *WM_manipulatormap_group_find( + struct wmManipulatorMap *mmap, + const char *idname) +{ + wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + if (wgt) { + return WM_manipulatormap_group_find_ptr(mmap, wgt); + } + return NULL; +} + +wmManipulatorGroup *WM_manipulatormap_group_find_ptr( + struct wmManipulatorMap *mmap, + const struct wmManipulatorGroupType *wgt) +{ + for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { + if (mgroup->type == wgt) { + return mgroup; + } + } + return NULL; +} + const ListBase *WM_manipulatormap_group_list(wmManipulatorMap *mmap) { return &mmap->groups; |