diff options
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/manipulators/WM_manipulator_api.h | 9 | ||||
-rw-r--r-- | source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c | 25 |
2 files changed, 29 insertions, 5 deletions
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h index 726e560a061..14cc5e9f137 100644 --- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h +++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h @@ -274,7 +274,7 @@ void WM_manipulatormaptype_group_free(struct wmManipulatorGroupTypeRef *wgt); /* -------------------------------------------------------------------- */ /* ManipulatorGroup */ -/* Add/Remove (High level API) */ +/* Add/Ensure/Remove (High level API) */ void WM_manipulator_group_type_add_ptr_ex( struct wmManipulatorGroupType *wgt, @@ -283,6 +283,13 @@ void WM_manipulator_group_type_add_ptr( struct wmManipulatorGroupType *wgt); void WM_manipulator_group_type_add(const char *idname); +void WM_manipulator_group_type_ensure_ptr_ex( + struct wmManipulatorGroupType *wgt, + struct wmManipulatorMapType *mmap_type); +void WM_manipulator_group_type_ensure_ptr( + struct wmManipulatorGroupType *wgt); +void WM_manipulator_group_type_ensure(const char *idname); + void WM_manipulator_group_type_remove_ptr_ex( struct Main *bmain, struct wmManipulatorGroupType *wgt, struct wmManipulatorMapType *mmap_type); diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c index 1675be861d6..cc902f2acdb 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c @@ -700,14 +700,12 @@ void WM_manipulator_group_type_add_ptr_ex( WM_manipulatorconfig_update_tag_init(mmap_type, wgt); } - void WM_manipulator_group_type_add_ptr( wmManipulatorGroupType *wgt) { wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); WM_manipulator_group_type_add_ptr_ex(wgt, mmap_type); } - void WM_manipulator_group_type_add(const char *idname) { wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); @@ -715,6 +713,27 @@ void WM_manipulator_group_type_add(const char *idname) WM_manipulator_group_type_add_ptr(wgt); } +void WM_manipulator_group_type_ensure_ptr_ex( + wmManipulatorGroupType *wgt, + wmManipulatorMapType *mmap_type) +{ + wmManipulatorGroupTypeRef *wgt_ref = WM_manipulatormaptype_group_find_ptr(mmap_type, wgt); + if (wgt_ref == NULL) { + WM_manipulator_group_type_add_ptr_ex(wgt, mmap_type); + } +} +void WM_manipulator_group_type_ensure_ptr( + wmManipulatorGroupType *wgt) +{ + wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); + WM_manipulator_group_type_ensure_ptr_ex(wgt, mmap_type); +} +void WM_manipulator_group_type_ensure(const char *idname) +{ + wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + BLI_assert(wgt != NULL); + WM_manipulator_group_type_ensure_ptr(wgt); +} void WM_manipulator_group_type_remove_ptr_ex( struct Main *bmain, wmManipulatorGroupType *wgt, @@ -723,14 +742,12 @@ void WM_manipulator_group_type_remove_ptr_ex( WM_manipulatormaptype_group_unlink(NULL, bmain, mmap_type, wgt); WM_manipulatorgrouptype_free_ptr(wgt); } - void WM_manipulator_group_type_remove_ptr( struct Main *bmain, wmManipulatorGroupType *wgt) { wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); WM_manipulator_group_type_remove_ptr_ex(bmain, wgt, mmap_type); } - void WM_manipulator_group_type_remove(struct Main *bmain, const char *idname) { wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); |