fix extract template and palettes thumbnails on mac

This commit is contained in:
Ondrej Samohel 2020-12-01 21:55:09 +01:00
parent 762789d145
commit 0dacc5ca0e
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
3 changed files with 14 additions and 5 deletions

View file

@ -183,11 +183,11 @@ PypeHarmony.color = function(rgba) {
/**
* get all dependencies for given node.
* @function
* @param {string} node node path.
* @param {string} _node node path.
* @return {array} List of dependent nodes.
*/
PypeHarmony.getDependencies = function(node) {
var target_node = node;
PypeHarmony.getDependencies = function(_node) {
var target_node = _node;
var numInput = node.numberOfInputPorts(target_node);
var dependencies = [];
for (var i = 0 ; i < numInput; i++) {

View file

@ -38,7 +38,7 @@ class ExtractPalette(pype.api.Extractor):
os.path.basename(palette_file)
.split(".plt")[0] + "_swatches.png"
)
self.log.info(f"Temporary humbnail path {tmp_thumb_path}")
self.log.info(f"Temporary thumbnail path {tmp_thumb_path}")
palette_version = str(instance.data.get("version")).zfill(3)
@ -52,6 +52,11 @@ class ExtractPalette(pype.api.Extractor):
palette_version,
palette_file,
tmp_thumb_path)
except OSError as e:
# FIXME: this happens on Mac where PIL cannot access fonts
# for some reason.
self.log.warning("Thumbnail generation failed")
self.log.warning(e)
except ValueError:
self.log.error("Unsupported palette type for thumbnail.")

View file

@ -31,7 +31,11 @@ class ExtractTemplate(pype.api.Extractor):
for backdrop in self.get_backdrops(dependency):
backdrops[backdrop["title"]["text"]] = backdrop
unique_backdrops = [backdrops[x] for x in set(backdrops.keys())]
if not unique_backdrops:
self.log.error(("No backdrops detected for template. "
"Please move template instance node onto "
"some backdrop and try again."))
raise AssertionError("No backdrop detected")
# Get non-connected nodes within backdrops.
all_nodes = instance.context.data.get("allNodes")
for node in [x for x in all_nodes if x not in dependencies]: