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>2019-06-28 03:04:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-06-28 04:27:11 +0300
commit83d92f55b81f3d2b6b20c2c39a140df30caef5e4 (patch)
treedcd6acc52c27f28c97dada6a9119b30435ba42c8 /source/blender/windowmanager/gizmo/intern
parent651e574153ac7295c0061f1518000cc3b1b8b4ca (diff)
Fix error for tools that share gizmo types doubling up gizmos
Introduced in recent commit c93af8529dfec
Diffstat (limited to 'source/blender/windowmanager/gizmo/intern')
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c33
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h2
2 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 2ec0e4e7ec3..f996d938dd7 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -80,6 +80,11 @@ wmGizmoGroup *wm_gizmogroup_new_from_type(wmGizmoMap *gzmap, wmGizmoGroupType *g
return gzgroup;
}
+wmGizmoGroup *wm_gizmogroup_find_by_type(const wmGizmoMap *gzmap, const wmGizmoGroupType *gzgt)
+{
+ return BLI_findptr(&gzmap->groups, gzgt, offsetof(wmGizmoGroup, type));
+}
+
void wm_gizmogroup_free(bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmoMap *gzmap = gzgroup->parent_gzmap;
@@ -285,6 +290,34 @@ bool WM_gizmo_group_type_poll(const bContext *C, const struct wmGizmoGroupType *
return (!gzgt->poll || gzgt->poll(C, (wmGizmoGroupType *)gzgt));
}
+void WM_gizmo_group_remove_by_tool(bContext *C,
+ Main *bmain,
+ const wmGizmoGroupType *gzgt,
+ const bToolRef *tref)
+{
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_find(&gzgt->gzmap_params);
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
+ for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+ if (sa->runtime.tool == tref) {
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ if (gzmap && gzmap->type == gzmap_type) {
+ wmGizmoGroup *gzgroup, *gzgroup_next;
+ for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup_next) {
+ gzgroup_next = gzgroup->next;
+ if (gzgroup->type == gzgt) {
+ BLI_assert(gzgroup->parent_gzmap == gzmap);
+ wm_gizmogroup_free(C, gzgroup);
+ ED_region_tag_redraw(ar);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
bool wm_gizmogroup_is_visible_in_drawstep(const wmGizmoGroup *gzgroup,
const eWM_GizmoFlagMapDrawStep drawstep)
{
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
index 1018cc4d58b..98c3ad8295c 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
@@ -61,6 +61,8 @@ struct wmGizmoGroup *wm_gizmogroup_new_from_type(struct wmGizmoMap *gzmap,
struct wmGizmoGroupType *gzgt);
void wm_gizmogroup_free(bContext *C, struct wmGizmoGroup *gzgroup);
void wm_gizmogroup_gizmo_register(struct wmGizmoGroup *gzgroup, struct wmGizmo *gz);
+struct wmGizmoGroup *wm_gizmogroup_find_by_type(const struct wmGizmoMap *gzmap,
+ const struct wmGizmoGroupType *gzgt);
struct wmGizmo *wm_gizmogroup_find_intersected_gizmo(wmWindowManager *wm,
const struct wmGizmoGroup *gzgroup,
struct bContext *C,