Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-10-19 14:44:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-10-19 14:44:51 +0300
commit8f495326bf12c5f23bd6bd7c1e4d71147593f663 (patch)
tree3010abf0c8212d4d71ca89e143a79a5025bd3e99 /source/blender/windowmanager
parent42dbae5d28b182684026a8791354819b0da907fc (diff)
Fix operators adding manipulators multiple times
Running spin or bisect twice in a row added widget groups each time.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/manipulators/WM_manipulator_api.h9
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c25
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);