[Bf-extensions-cvs] [65812c69] master: BlenderKit: fix quadview + drag cancelation when leaving active area.
Vilém Duha
noreply at git.blender.org
Mon Aug 12 16:05:29 CEST 2019
Commit: 65812c69ccfe132eaad408379b1aca84d755acc5
Author: Vilém Duha
Date: Mon Aug 12 15:54:47 2019 +0200
Branches: master
https://developer.blender.org/rBA65812c69ccfe132eaad408379b1aca84d755acc5
BlenderKit: fix quadview + drag cancelation when leaving active area.
===================================================================
M blenderkit/ui.py
===================================================================
diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index ede37280..d33c124f 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -602,9 +602,9 @@ def draw_callback_2d(self, context):
# self.area might throw error just by itself.
a1 = self.area
go = True
- if len(a.spaces[0].region_quadviews)>0:
- # print(dir(bpy.context.region_data))
- #print('quad', a.spaces[0].region_3d, a.spaces[0].region_quadviews[0])
+ if len(a.spaces[0].region_quadviews) > 0:
+ # print(dir(bpy.context.region_data))
+ # print('quad', a.spaces[0].region_3d, a.spaces[0].region_quadviews[0])
if a.spaces[0].region_3d != context.region_data:
go = False
except:
@@ -980,7 +980,7 @@ def is_rating_possible():
return True, rated, b, ad
if ao is not None:
ad = None
- #crawl parents to reach active asset. there could have been parenting so we need to find the first onw
+ # crawl parents to reach active asset. there could have been parenting so we need to find the first onw
ao_check = ao
while ad is None or (ad is None and ao_check.parent is not None):
ad = ao_check.get('asset_data')
@@ -993,7 +993,6 @@ def is_rating_possible():
else:
break;
-
# check also materials
m = ao.active_material
if m is not None:
@@ -1134,7 +1133,7 @@ def update_ui_size(area, region):
(ui.bar_width - 2 * ui.drawoffset) / (ui.thumb_size + ui.margin))
search_results = bpy.context.scene.get('search results')
- if search_results != None and ui.wcount>0:
+ if search_results != None and ui.wcount > 0:
ui.hcount = min(user_preferences.max_assetbar_rows, math.ceil(len(search_results) / ui.wcount))
else:
ui.hcount = 1
@@ -1194,20 +1193,20 @@ class AssetBarOperator(bpy.types.Operator):
areas = []
- for w in context.window_manager.windows:
- areas.extend(w.screen.areas)
if bpy.context.scene != self.scene:
self.exit_modal()
- ui_props.assetbar_on = False
return {'CANCELLED'}
- if self.area not in areas or self.area.type != 'VIEW_3D':
- # print('search areas')
+ for w in context.window_manager.windows:
+ areas.extend(w.screen.areas)
+
+ if self.area not in areas or self.area.type != 'VIEW_3D' or self.has_quad_views != (
+ len(self.area.spaces[0].region_quadviews) > 0):
+ # print('search areas') bpy.context.area.spaces[0].region_quadviews
# stopping here model by now - because of:
# switching layouts or maximizing area now fails to assign new area throwing the bug
# internal error: modal gizmo-map handler has invalid area
self.exit_modal()
- ui_props.assetbar_on = False
return {'CANCELLED'}
newarea = None
@@ -1234,6 +1233,7 @@ class AssetBarOperator(bpy.types.Operator):
bg_blender.bg_update()
if context.region != self.region:
+ print(time.time(), 'pass trough because of region')
return {'PASS_THROUGH'}
# this was here to check if sculpt stroke is running, but obviously that didn't help,
@@ -1349,10 +1349,16 @@ class AssetBarOperator(bpy.types.Operator):
ui_props.dragging = True
ui_props.drag_init = False
- if not (ui_props.dragging and mouse_in_region(r, mx, my)) and not mouse_in_asset_bar(mx, my):
+ if not (ui_props.dragging and mouse_in_region(r, mx, my)) and not mouse_in_asset_bar(mx, my): #
+
+ ui_props.dragging = False
+ ui_props.has_hit = False
ui_props.active_index = -3
+ ui_props.draw_drag_image = False
+ ui_props.draw_snapped_bounds = False
ui_props.draw_tooltip = False
bpy.context.window.cursor_set("DEFAULT")
+ print('out of region')
return {'PASS_THROUGH'}
sr = bpy.context.scene['search results']
@@ -1635,6 +1641,7 @@ class AssetBarOperator(bpy.types.Operator):
args = (self, context)
self.area = context.area
self.scene = bpy.context.scene
+ self.has_quad_views = len(bpy.context.area.spaces[0].region_quadviews) > 0
for r in self.area.regions:
if r.type == 'WINDOW':
More information about the Bf-extensions-cvs
mailing list