BlenderKit: Fix replace active model button

Dowload operator invoke had no return in some cases
This commit is contained in:
Vilém Duha 2021-05-11 17:47:11 +02:00
parent bc70499326
commit 2d689e6b48
3 changed files with 27 additions and 2 deletions

View File

@ -426,8 +426,6 @@ class ReGenerateThumbnailOperator(bpy.types.Operator):
json_args=args_dict,
wait=False)
return {'FINISHED'}
start_thumbnailer(self, context)
return {'FINISHED'}
def invoke(self, context, event):
wm = context.window_manager

View File

@ -1278,6 +1278,9 @@ class BlenderkitDownloadOperator(bpy.types.Operator):
description="",
default="")
# close_window: BoolProperty(name='Close window',
# description='Try to close the window below mouse before download',
# default=False)
# @classmethod
# def poll(cls, context):
# return bpy.context.window_manager.BlenderKitModelThumbnails is not ''
@ -1376,6 +1379,9 @@ class BlenderkitDownloadOperator(bpy.types.Operator):
layout.prop(self, 'resolution', expand=True, icon_only=False)
def invoke(self, context, event):
# if self.close_window:
# context.window.cursor_warp(event.mouse_x-1000, event.mouse_y - 1000);
print(self.asset_base_id)
wm = context.window_manager
# only make a pop up in case of switching resolutions
@ -1393,6 +1399,15 @@ class BlenderkitDownloadOperator(bpy.types.Operator):
self.resolution = 'ORIGINAL'
return wm.invoke_props_dialog(self)
# if self.close_window:
# time.sleep(0.1)
# context.area.tag_redraw()
# time.sleep(0.1)
#
# context.window.cursor_warp(event.mouse_x, event.mouse_y);
return self.execute(context)
def register_download():
bpy.utils.register_class(BlenderkitDownloadOperator)

View File

@ -1406,6 +1406,11 @@ class SearchOperator(Operator):
options={'SKIP_SAVE'}
)
# close_window: BoolProperty(name='Close window',
# description='Try to close the window below mouse before download',
# default=False)
tooltip: bpy.props.StringProperty(default='Runs search and displays the asset bar at the same time')
@classmethod
@ -1429,6 +1434,13 @@ class SearchOperator(Operator):
return {'FINISHED'}
# def invoke(self, context, event):
# if self.close_window:
# context.window.cursor_warp(event.mouse_x, event.mouse_y - 100);
# context.area.tag_redraw()
#
# context.window.cursor_warp(event.mouse_x, event.mouse_y);
# return self. execute(context)
class UrlOperator(Operator):
""""""