Made AsyncModalOperatorMixin.invoke() start self.async_execute(context).
This was already common practice in all subclasses, and has now been moved into the mixin.
This commit is contained in:
parent
f41ea8c5a3
commit
143456ae1d
@ -182,8 +182,19 @@ class AsyncModalOperatorMixin:
|
|||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
context.window_manager.modal_handler_add(self)
|
context.window_manager.modal_handler_add(self)
|
||||||
self.timer = context.window_manager.event_timer_add(1 / 15, context.window)
|
self.timer = context.window_manager.event_timer_add(1 / 15, context.window)
|
||||||
|
|
||||||
|
self.log.info('Starting')
|
||||||
|
self._new_async_task(self.async_execute(context))
|
||||||
|
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
async def async_execute(self, context):
|
||||||
|
"""Entry point of the asynchronous operator.
|
||||||
|
|
||||||
|
Implement in a subclass.
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
return self.invoke(context, None)
|
return self.invoke(context, None)
|
||||||
|
|
||||||
|
@ -107,11 +107,7 @@ class PILLAR_OT_image_share(pillar.PillarOperatorMixin,
|
|||||||
self.report({'ERROR'}, 'Datablock is dirty, save it first.')
|
self.report({'ERROR'}, 'Datablock is dirty, save it first.')
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
async_loop.AsyncModalOperatorMixin.invoke(self, context, event)
|
return async_loop.AsyncModalOperatorMixin.invoke(self, context, event)
|
||||||
|
|
||||||
self.log.info('Starting sharing')
|
|
||||||
self._new_async_task(self.async_execute(context))
|
|
||||||
return {'RUNNING_MODAL'}
|
|
||||||
|
|
||||||
async def async_execute(self, context):
|
async def async_execute(self, context):
|
||||||
"""Entry point of the asynchronous operator."""
|
"""Entry point of the asynchronous operator."""
|
||||||
|
@ -234,11 +234,7 @@ class PILLAR_OT_sync(pillar.PillarOperatorMixin,
|
|||||||
self.bss_report({'ERROR'}, 'No Blender version to sync for was given.')
|
self.bss_report({'ERROR'}, 'No Blender version to sync for was given.')
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
async_loop.AsyncModalOperatorMixin.invoke(self, context, event)
|
return async_loop.AsyncModalOperatorMixin.invoke(self, context, event)
|
||||||
|
|
||||||
self.log.info('Starting synchronisation')
|
|
||||||
self._new_async_task(self.async_execute(context))
|
|
||||||
return {'RUNNING_MODAL'}
|
|
||||||
|
|
||||||
def action_select(self, context):
|
def action_select(self, context):
|
||||||
"""Allows selection of the Blender version to use.
|
"""Allows selection of the Blender version to use.
|
||||||
|
@ -288,10 +288,7 @@ class BlenderCloudBrowser(pillar.PillarOperatorMixin,
|
|||||||
self._scroll_reset()
|
self._scroll_reset()
|
||||||
|
|
||||||
context.window.cursor_modal_set('DEFAULT')
|
context.window.cursor_modal_set('DEFAULT')
|
||||||
async_loop.AsyncModalOperatorMixin.invoke(self, context, event)
|
return async_loop.AsyncModalOperatorMixin.invoke(self, context, event)
|
||||||
self._new_async_task(self.async_execute(context))
|
|
||||||
|
|
||||||
return {'RUNNING_MODAL'}
|
|
||||||
|
|
||||||
def modal(self, context, event):
|
def modal(self, context, event):
|
||||||
result = async_loop.AsyncModalOperatorMixin.modal(self, context, event)
|
result = async_loop.AsyncModalOperatorMixin.modal(self, context, event)
|
||||||
@ -850,13 +847,6 @@ class PILLAR_OT_switch_hdri(pillar.PillarOperatorMixin,
|
|||||||
file_uuid = bpy.props.StringProperty(name='file_uuid',
|
file_uuid = bpy.props.StringProperty(name='file_uuid',
|
||||||
description='File ID to download')
|
description='File ID to download')
|
||||||
|
|
||||||
def invoke(self, context, event):
|
|
||||||
async_loop.AsyncModalOperatorMixin.invoke(self, context, event)
|
|
||||||
|
|
||||||
self.log.info('Starting')
|
|
||||||
self._new_async_task(self.async_execute(context))
|
|
||||||
return {'RUNNING_MODAL'}
|
|
||||||
|
|
||||||
async def async_execute(self, context):
|
async def async_execute(self, context):
|
||||||
"""Entry point of the asynchronous operator."""
|
"""Entry point of the asynchronous operator."""
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user