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 11:10:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-06-28 11:22:53 +0300
commit9bcab8050f44e5bd36a0715811ee0355e4b221b6 (patch)
tree31d3d4abe5027df7759ae8dd8174fccd02fcb45b /source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
parenteac11046a151dd1dfc175f2c3faf00a3baa99956 (diff)
Fix T63694: Crash using tool gizmos with multiple windows
Gizmo group types now store a user count so they aren't unlinked while other tools are using them. The tool system now works with multiple windows.
Diffstat (limited to 'source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c')
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index edf376b1259..be123bee5df 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -69,8 +69,13 @@ static ListBase gizmomaptypes = {NULL, NULL};
*/
/* so operator removal can trigger update */
typedef enum eWM_GizmoFlagGroupTypeGlobalFlag {
+ /** Initialize by #wmGroupType.type_update_flag. */
WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT = (1 << 0),
+ /** Remove by #wmGroupType.type_update_flag. */
WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE = (1 << 1),
+
+ /** Remove by #wmGroup.tag_remove. */
+ WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE = (1 << 2),
} eWM_GizmoFlagGroupTypeGlobalFlag;
static eWM_GizmoFlagGroupTypeGlobalFlag wm_gzmap_type_update_flag = 0;
@@ -1257,6 +1262,13 @@ void WM_gizmoconfig_update_tag_group_type_remove(wmGizmoMapType *gzmap_type,
wm_gzmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE;
}
+void WM_gizmoconfig_update_tag_group_remove(wmGizmoMap *gzmap)
+{
+ gzmap->tag_remove_group = true;
+
+ wm_gzmap_type_update_flag |= WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE;
+}
+
/**
* Run in case new types have been added (runs often, early exit where possible).
* Follows #WM_keyconfig_update conventions.
@@ -1271,6 +1283,32 @@ void WM_gizmoconfig_update(struct Main *bmain)
return;
}
+ if (wm_gzmap_type_update_flag & WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ if (gzmap != NULL && gzmap->tag_remove_group) {
+ gzmap->tag_remove_group = false;
+
+ for (wmGizmoGroup *gzgroup = gzmap->groups.first, *gzgroup_next; gzgroup;
+ gzgroup = gzgroup_next) {
+ gzgroup_next = gzgroup->next;
+ if (gzgroup->tag_remove) {
+ wm_gizmogroup_free(NULL, gzgroup);
+ ED_region_tag_redraw(ar);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ wm_gzmap_type_update_flag &= ~WM_GIZMOTYPE_GLOBAL_UPDATE_REMOVE;
+ }
+
if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type;
gzmap_type = gzmap_type->next) {