Using explicit status EnumProperty to show Flamenco status
By Andy's request, I've removed the window_manager.progress_xxx stuff (so no longer hijacking the mouse cursor) and instead show the Flamenco status in the Flamenco Render panel.
This commit is contained in:
parent
5f73837d3c
commit
60018cd78c
@ -128,9 +128,6 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
|
|||||||
if not await self.authenticate(context):
|
if not await self.authenticate(context):
|
||||||
return
|
return
|
||||||
|
|
||||||
context.window_manager.progress_begin(0, 4)
|
|
||||||
context.window_manager.progress_update(1)
|
|
||||||
|
|
||||||
from pillarsdk import exceptions as sdk_exceptions
|
from pillarsdk import exceptions as sdk_exceptions
|
||||||
from ..blender import preferences
|
from ..blender import preferences
|
||||||
|
|
||||||
@ -143,6 +140,7 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
|
|||||||
# Save to a different file, specifically for Flamenco. We shouldn't overwrite
|
# Save to a different file, specifically for Flamenco. We shouldn't overwrite
|
||||||
# the artist's file. We can compress, since this file won't be managed by SVN
|
# the artist's file. We can compress, since this file won't be managed by SVN
|
||||||
# and doesn't need diffability.
|
# and doesn't need diffability.
|
||||||
|
context.window_manager.flamenco_status = 'PACKING'
|
||||||
filepath = Path(context.blend_data.filepath).with_suffix('.flamenco.blend')
|
filepath = Path(context.blend_data.filepath).with_suffix('.flamenco.blend')
|
||||||
self.log.info('Saving copy to temporary file %s', filepath)
|
self.log.info('Saving copy to temporary file %s', filepath)
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=str(filepath),
|
bpy.ops.wm.save_as_mainfile(filepath=str(filepath),
|
||||||
@ -162,11 +160,10 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
|
|||||||
if not outfile:
|
if not outfile:
|
||||||
return
|
return
|
||||||
|
|
||||||
context.window_manager.progress_update(3)
|
|
||||||
|
|
||||||
# Create the job at Flamenco Server.
|
# Create the job at Flamenco Server.
|
||||||
prefs = preferences()
|
prefs = preferences()
|
||||||
|
|
||||||
|
context.window_manager.flamenco_status = 'COMMUNICATING'
|
||||||
settings = {'blender_cmd': '{blender}',
|
settings = {'blender_cmd': '{blender}',
|
||||||
'chunk_size': scene.flamenco_render_chunk_size,
|
'chunk_size': scene.flamenco_render_chunk_size,
|
||||||
'filepath': str(outfile),
|
'filepath': str(outfile),
|
||||||
@ -215,7 +212,7 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
|
|||||||
|
|
||||||
def quit(self):
|
def quit(self):
|
||||||
super().quit()
|
super().quit()
|
||||||
bpy.context.window_manager.progress_end()
|
bpy.context.window_manager.flamenco_status = 'IDLE'
|
||||||
|
|
||||||
async def bam_pack(self, filepath: Path) -> (typing.Optional[Path], typing.List[Path]):
|
async def bam_pack(self, filepath: Path) -> (typing.Optional[Path], typing.List[Path]):
|
||||||
"""BAM-packs the blendfile to the destination directory.
|
"""BAM-packs the blendfile to the destination directory.
|
||||||
@ -287,6 +284,8 @@ class FLAMENCO_OT_copy_files(Operator,
|
|||||||
from . import bam_interface
|
from . import bam_interface
|
||||||
from ..blender import preferences
|
from ..blender import preferences
|
||||||
|
|
||||||
|
context.window_manager.flamenco_status = 'PACKING'
|
||||||
|
|
||||||
missing_sources = await bam_interface.bam_copy(
|
missing_sources = await bam_interface.bam_copy(
|
||||||
Path(context.blend_data.filepath),
|
Path(context.blend_data.filepath),
|
||||||
Path(preferences().flamenco_job_file_path),
|
Path(preferences().flamenco_job_file_path),
|
||||||
@ -298,6 +297,10 @@ class FLAMENCO_OT_copy_files(Operator,
|
|||||||
|
|
||||||
self.quit()
|
self.quit()
|
||||||
|
|
||||||
|
def quit(self):
|
||||||
|
super().quit()
|
||||||
|
bpy.context.window_manager.flamenco_status = 'IDLE'
|
||||||
|
|
||||||
|
|
||||||
class FLAMENCO_OT_explore_file_path(Operator):
|
class FLAMENCO_OT_explore_file_path(Operator):
|
||||||
"""Opens the Flamenco job storage path in a file explorer."""
|
"""Opens the Flamenco job storage path in a file explorer."""
|
||||||
@ -467,6 +470,7 @@ class FLAMENCO_PT_render(bpy.types.Panel):
|
|||||||
labeled_row.label('Output:')
|
labeled_row.label('Output:')
|
||||||
prop_btn_row = labeled_row.row(align=True)
|
prop_btn_row = labeled_row.row(align=True)
|
||||||
render_output = render_output_path(context)
|
render_output = render_output_path(context)
|
||||||
|
|
||||||
if render_output is None:
|
if render_output is None:
|
||||||
prop_btn_row.label('Unable to render with Flamenco, outside of project directory.')
|
prop_btn_row.label('Unable to render with Flamenco, outside of project directory.')
|
||||||
else:
|
else:
|
||||||
@ -475,9 +479,17 @@ class FLAMENCO_PT_render(bpy.types.Panel):
|
|||||||
text='', icon='DISK_DRIVE')
|
text='', icon='DISK_DRIVE')
|
||||||
props.path = str(render_output.parent)
|
props.path = str(render_output.parent)
|
||||||
|
|
||||||
layout.operator(FLAMENCO_OT_render.bl_idname,
|
flamenco_status = context.window_manager.flamenco_status
|
||||||
text='Render on Flamenco',
|
if flamenco_status == 'IDLE':
|
||||||
icon='RENDER_ANIMATION')
|
layout.operator(FLAMENCO_OT_render.bl_idname,
|
||||||
|
text='Render on Flamenco',
|
||||||
|
icon='RENDER_ANIMATION')
|
||||||
|
elif flamenco_status == 'PACKING':
|
||||||
|
layout.label('Flamenco is packing your file + dependencies')
|
||||||
|
elif flamenco_status == 'COMMUNICATING':
|
||||||
|
layout.label('Communicating with Flamenco Server')
|
||||||
|
else:
|
||||||
|
layout.label('Unknown Flamenco status %s' % flamenco_status)
|
||||||
|
|
||||||
if not context.scene.render.use_overwrite:
|
if not context.scene.render.use_overwrite:
|
||||||
warnbox = layout.box().column(align=True)
|
warnbox = layout.box().column(align=True)
|
||||||
@ -486,6 +498,8 @@ class FLAMENCO_PT_render(bpy.types.Panel):
|
|||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
from ..utils import redraw
|
||||||
|
|
||||||
bpy.utils.register_class(FlamencoManagerGroup)
|
bpy.utils.register_class(FlamencoManagerGroup)
|
||||||
bpy.utils.register_class(FLAMENCO_OT_fmanagers)
|
bpy.utils.register_class(FLAMENCO_OT_fmanagers)
|
||||||
bpy.utils.register_class(FLAMENCO_OT_render)
|
bpy.utils.register_class(FLAMENCO_OT_render)
|
||||||
@ -519,6 +533,16 @@ def register():
|
|||||||
description='Higher numbers mean higher priority'
|
description='Higher numbers mean higher priority'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
bpy.types.WindowManager.flamenco_status = EnumProperty(
|
||||||
|
items=[
|
||||||
|
('IDLE', 'IDLE', 'Not doing anything.'),
|
||||||
|
('PACKING', 'PACKING', 'BAM-packing all dependencies.'),
|
||||||
|
('COMMUNICATING', 'COMMUNICATING', 'Communicating with Flamenco Server.'),
|
||||||
|
],
|
||||||
|
name='flamenco_status',
|
||||||
|
default='IDLE',
|
||||||
|
description='Current status of the Flamenco add-on',
|
||||||
|
update=redraw)
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
bpy.utils.unregister_module(__name__)
|
bpy.utils.unregister_module(__name__)
|
||||||
@ -539,3 +563,7 @@ def unregister():
|
|||||||
del bpy.types.Scene.flamenco_render_job_priority
|
del bpy.types.Scene.flamenco_render_job_priority
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
try:
|
||||||
|
del bpy.types.WindowManager.flamenco_status
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
Reference in New Issue
Block a user