Flamenco: Allow BAT-packing of only relative-path assets
This commit is contained in:
parent
1f13b4d249
commit
4f32b49ad3
@ -3,13 +3,16 @@
|
||||
|
||||
## Version 1.9.5 (in development)
|
||||
|
||||
- Requires Blender-Asset-Tracer 0.7 or newer.
|
||||
- Fix crashing Blender when running in background mode (e.g. without GUI).
|
||||
- Flamenco: Include extra job parameters to allow for encoding a video at the end of a render
|
||||
job that produced an image sequence.
|
||||
- Flamenco: Compress all blend files, and not just the one we save from Blender.
|
||||
Requires BAT 0.5 or newer.
|
||||
- Flamenco: Store more info in the `jobinfo.json` file. This is mostly useful for debugging issues
|
||||
on the render farm, as now things like the exclusion filter and Manager settings are logged too.
|
||||
- Flamenco: Allow BAT-packing of only those assets that are referred to by relative path (e.g.
|
||||
a path starting with `//`). Assets with an absolute path are ignored, and assumed to be reachable
|
||||
at the same path by the Workers.
|
||||
|
||||
|
||||
## Version 1.9.4 (2018-11-01)
|
||||
|
@ -248,6 +248,15 @@ class BlenderCloudPreferences(AddonPreferences):
|
||||
soft_max=4,
|
||||
update=project_specific.store,
|
||||
)
|
||||
flamenco_relative_only = BoolProperty(
|
||||
name='Relative Paths Only',
|
||||
description='When enabled, only assets that are referred to with a relative path are '
|
||||
'packed, and assets referred to by an absolute path are excluded from the '
|
||||
'BAT pack. When disabled, all assets are packed.',
|
||||
default=False,
|
||||
update=project_specific.store,
|
||||
)
|
||||
|
||||
flamenco_open_browser_after_submit = BoolProperty(
|
||||
name='Open Browser after Submitting Job',
|
||||
description='When enabled, Blender will open a webbrowser',
|
||||
@ -473,6 +482,7 @@ class BlenderCloudPreferences(AddonPreferences):
|
||||
path_box.label(text='Blend file is not in your project path, '
|
||||
'unable to give output path example.')
|
||||
|
||||
flamenco_box.prop(self, 'flamenco_relative_only')
|
||||
flamenco_box.prop(self, 'flamenco_open_browser_after_submit')
|
||||
|
||||
|
||||
|
@ -87,10 +87,9 @@ def manager_updated(self: 'FlamencoManagerGroup', context):
|
||||
return
|
||||
|
||||
with project_specific.mark_as_loading():
|
||||
for name in project_specific.FLAMENCO_PER_PROJECT_PER_MANAGER:
|
||||
if name not in pppm:
|
||||
continue
|
||||
setattr(prefs, name, pppm[name])
|
||||
project_specific.update_preferences(prefs,
|
||||
project_specific.FLAMENCO_PER_PROJECT_PER_MANAGER,
|
||||
pppm)
|
||||
|
||||
|
||||
class FlamencoManagerGroup(PropertyGroup):
|
||||
@ -422,6 +421,7 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
|
||||
proj_abspath = bpy.path.abspath(prefs.cloud_project_local_path)
|
||||
projdir = Path(proj_abspath).resolve()
|
||||
exclusion_filter = (prefs.flamenco_exclude_filter or '').strip()
|
||||
relative_only = prefs.flamenco_relative_only
|
||||
|
||||
self.log.debug('outdir : %s', outdir)
|
||||
self.log.debug('projdir: %s', projdir)
|
||||
@ -436,7 +436,8 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
|
||||
|
||||
try:
|
||||
outfile, missing_sources = await bat_interface.copy(
|
||||
bpy.context, filepath, projdir, outdir, exclusion_filter)
|
||||
bpy.context, filepath, projdir, outdir, exclusion_filter,
|
||||
relative_only=relative_only)
|
||||
except bat_interface.FileTransferError as ex:
|
||||
self.log.error('Could not transfer %d files, starting with %s',
|
||||
len(ex.files_remaining), ex.files_remaining[0])
|
||||
|
@ -10,7 +10,6 @@ import bpy
|
||||
from blender_asset_tracer import pack
|
||||
from blender_asset_tracer.pack import progress, transfer
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
_running_packer = None # type: pack.Packer
|
||||
@ -97,7 +96,9 @@ async def copy(context,
|
||||
base_blendfile: pathlib.Path,
|
||||
project: pathlib.Path,
|
||||
target: pathlib.Path,
|
||||
exclusion_filter: str) -> typing.Tuple[pathlib.Path, typing.Set[pathlib.Path]]:
|
||||
exclusion_filter: str,
|
||||
*,
|
||||
relative_only: bool) -> typing.Tuple[pathlib.Path, typing.Set[pathlib.Path]]:
|
||||
"""Use BAT🦇 to copy the given file and dependencies to the target location.
|
||||
|
||||
:raises: FileTransferError if a file couldn't be transferred.
|
||||
@ -109,7 +110,8 @@ async def copy(context,
|
||||
|
||||
wm = bpy.context.window_manager
|
||||
|
||||
with pack.Packer(base_blendfile, project, target, compress=True) as packer:
|
||||
with pack.Packer(base_blendfile, project, target, compress=True, relative_only=relative_only) \
|
||||
as packer:
|
||||
with _packer_lock:
|
||||
if exclusion_filter:
|
||||
packer.exclude(*exclusion_filter.split())
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import typing
|
||||
|
||||
# Names of BlenderCloudPreferences properties that are both project-specific
|
||||
# and simple enough to store directly in a dict.
|
||||
@ -16,6 +17,7 @@ FLAMENCO_PER_PROJECT_PER_MANAGER = (
|
||||
'flamenco_job_file_path',
|
||||
'flamenco_job_output_path',
|
||||
'flamenco_job_output_strip_components',
|
||||
'flamenco_relative_only',
|
||||
)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -36,6 +38,27 @@ def mark_as_loading():
|
||||
project_settings_loading -= 1
|
||||
|
||||
|
||||
def update_preferences(prefs, names_to_update: typing.Iterable[str],
|
||||
new_values: typing.Mapping[str, typing.Any]):
|
||||
for name in names_to_update:
|
||||
if not hasattr(prefs, name):
|
||||
log.debug('not setting %r, property cannot be found', name)
|
||||
continue
|
||||
|
||||
if name in new_values:
|
||||
log.debug('setting %r = %r', name, new_values[name])
|
||||
setattr(prefs, name, new_values[name])
|
||||
else:
|
||||
# The property wasn't stored, so set the default value instead.
|
||||
bl_type, args = getattr(prefs.bl_rna, name)
|
||||
log.debug('finding default value for %r', name)
|
||||
if 'default' not in args:
|
||||
log.debug('no default value for %r, not touching', name)
|
||||
continue
|
||||
log.debug('found default value for %r = %r', name, args['default'])
|
||||
setattr(prefs, name, args['default'])
|
||||
|
||||
|
||||
def handle_project_update(_=None, _2=None):
|
||||
"""Handles changing projects, which may cause extensions to be disabled/enabled.
|
||||
|
||||
@ -78,9 +101,7 @@ def handle_project_update(_=None, _2=None):
|
||||
log.debug('loading project-specific settings:\n%s', pformat(ps.to_dict()))
|
||||
|
||||
# Restore simple properties.
|
||||
for name in PROJECT_SPECIFIC_SIMPLE_PROPS:
|
||||
if name in ps and hasattr(prefs, name):
|
||||
setattr(prefs, name, ps[name])
|
||||
update_preferences(prefs, PROJECT_SPECIFIC_SIMPLE_PROPS, ps)
|
||||
|
||||
# Restore Flamenco settings.
|
||||
prefs.flamenco_manager.available_managers = ps.get('flamenco_available_managers', [])
|
||||
|
@ -3,7 +3,7 @@
|
||||
lockfile==0.12.2
|
||||
pillarsdk==1.7.0
|
||||
wheel==0.29.0
|
||||
blender-asset-tracer>=0.5
|
||||
blender-asset-tracer>=0.7
|
||||
|
||||
# Secondary requirements:
|
||||
asn1crypto==0.24.0
|
||||
|
Reference in New Issue
Block a user