Skip to content
Snippets Groups Projects
Commit 2d689e6b authored by Vilém Duha's avatar Vilém Duha
Browse files

BlenderKit: Fix replace active model button

Dowload operator invoke had no return in some cases
parent bc704993
No related branches found
No related tags found
No related merge requests found
...@@ -426,8 +426,6 @@ class ReGenerateThumbnailOperator(bpy.types.Operator): ...@@ -426,8 +426,6 @@ class ReGenerateThumbnailOperator(bpy.types.Operator):
json_args=args_dict, json_args=args_dict,
wait=False) wait=False)
return {'FINISHED'} return {'FINISHED'}
start_thumbnailer(self, context)
return {'FINISHED'}
def invoke(self, context, event): def invoke(self, context, event):
wm = context.window_manager wm = context.window_manager
......
...@@ -1278,6 +1278,9 @@ class BlenderkitDownloadOperator(bpy.types.Operator): ...@@ -1278,6 +1278,9 @@ class BlenderkitDownloadOperator(bpy.types.Operator):
description="", description="",
default="") default="")
# close_window: BoolProperty(name='Close window',
# description='Try to close the window below mouse before download',
# default=False)
# @classmethod # @classmethod
# def poll(cls, context): # def poll(cls, context):
# return bpy.context.window_manager.BlenderKitModelThumbnails is not '' # return bpy.context.window_manager.BlenderKitModelThumbnails is not ''
...@@ -1376,6 +1379,9 @@ class BlenderkitDownloadOperator(bpy.types.Operator): ...@@ -1376,6 +1379,9 @@ class BlenderkitDownloadOperator(bpy.types.Operator):
layout.prop(self, 'resolution', expand=True, icon_only=False) layout.prop(self, 'resolution', expand=True, icon_only=False)
def invoke(self, context, event): 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) print(self.asset_base_id)
wm = context.window_manager wm = context.window_manager
# only make a pop up in case of switching resolutions # only make a pop up in case of switching resolutions
...@@ -1393,6 +1399,15 @@ class BlenderkitDownloadOperator(bpy.types.Operator): ...@@ -1393,6 +1399,15 @@ class BlenderkitDownloadOperator(bpy.types.Operator):
self.resolution = 'ORIGINAL' self.resolution = 'ORIGINAL'
return wm.invoke_props_dialog(self) 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(): def register_download():
bpy.utils.register_class(BlenderkitDownloadOperator) bpy.utils.register_class(BlenderkitDownloadOperator)
......
...@@ -1406,6 +1406,11 @@ class SearchOperator(Operator): ...@@ -1406,6 +1406,11 @@ class SearchOperator(Operator):
options={'SKIP_SAVE'} 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') tooltip: bpy.props.StringProperty(default='Runs search and displays the asset bar at the same time')
@classmethod @classmethod
...@@ -1429,6 +1434,13 @@ class SearchOperator(Operator): ...@@ -1429,6 +1434,13 @@ class SearchOperator(Operator):
return {'FINISHED'} 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): class UrlOperator(Operator):
"""""" """"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment