Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Harmony: template extraction and palettes thumbnails on mac #768

Merged
merged 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pype/hosts/harmony/js/PypeHarmony.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
7 changes: 6 additions & 1 deletion pype/plugins/harmony/publish/extract_palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def process(self, instance):
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)

Expand All @@ -52,6 +52,11 @@ def process(self, instance):
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.")

Expand Down
6 changes: 5 additions & 1 deletion pype/plugins/harmony/publish/extract_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def process(self, instance):
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]:
Expand Down