variables shuffle

This commit is contained in:
iLLiCiTiT 2020-04-03 10:32:55 +02:00
parent d8d5ccb2f0
commit a8d1fc9cc6

View file

@ -887,20 +887,15 @@ def load_containers_by_asset_data(
} }
for subset_id, repres in valid_repres_by_subset_id.items(): for subset_id, repres in valid_repres_by_subset_id.items():
subset = valid_subsets_by_id[subset_id] subset_name = valid_subsets_by_id[subset_id]["name"]
subset_name = subset["name"]
variant = variants_per_subset_id[subset_id] variant = variants_per_subset_id[subset_id]
loaders_last_idx = len(variant["loaders"]) - 1
variant_loader_names = variant["loaders"] repre_names_last_idx = len(variant["repre_names"]) - 1
variant_loader_count = len(variant_loader_names)
variant_repre_names = variant["repre_names"]
variant_repre_count = len(variant_repre_names)
is_loaded = False is_loaded = False
for repre_name_idx, variant_repre_name in enumerate( for repre_name_idx, variant_repre_name in enumerate(
variant_repre_names variant["repre_names"]
): ):
found_repre = None found_repre = None
for repre in repres: for repre in repres:
@ -912,7 +907,7 @@ def load_containers_by_asset_data(
if not found_repre: if not found_repre:
continue continue
for loader_idx, loader_name in enumerate(variant_loader_names): for loader_idx, loader_name in enumerate(variant["loaders"]):
if is_loaded: if is_loaded:
break break
@ -942,9 +937,9 @@ def load_containers_by_asset_data(
) )
msg = "Loading failed." msg = "Loading failed."
if loader_idx < (variant_loader_count - 1): if loader_idx < loaders_last_idx:
msg += " Trying next loader." msg += " Trying next loader."
elif repre_name_idx < (variant_repre_count - 1): elif repre_name_idx < repre_names_last_idx:
msg += ( msg += (
" Loading of subset `{}` was not successful." " Loading of subset `{}` was not successful."
).format(subset_name) ).format(subset_name)
@ -1106,7 +1101,7 @@ def load_containers_to_workfile():
# Skip if there are any loaders # Skip if there are any loaders
if not loaders_by_name: if not loaders_by_name:
print("There are no registered loaders.") log.warning("There are no registered loaders.")
return return
# Get current task name # Get current task name
@ -1137,7 +1132,8 @@ def load_containers_to_workfile():
elif not current_context: elif not current_context:
log.warning(( log.warning((
"Current task `{}` doesn't have any loading preset for it's context." "Current task `{}` doesn't have any loading"
" preset for it's context."
).format(current_task_name)) ).format(current_task_name))
elif not link_context: elif not link_context:
@ -1160,8 +1156,8 @@ def load_containers_to_workfile():
if link_assets: if link_assets:
assets.extend(link_assets) assets.extend(link_assets)
# Skip if there are any assets # Skip if there are no assets. This can happen if only linked mapping is
# - this may happend if only linked mapping is set and there are not links # set and there are no links for his asset.
if not assets: if not assets:
log.warning("Asset does not have linked assets. Nothing to process.") log.warning("Asset does not have linked assets. Nothing to process.")
return return