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

Commit

Permalink
Merge pull request #2518 from BigRoy/fix/extract_look_space_filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolar authored Jan 21, 2022
2 parents 9a8d8db + 3b10162 commit 8674523
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions openpype/hosts/maya/plugins/publish/extract_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
HARDLINK = 2


def escape_space(path):
"""Ensure path is enclosed by quotes to allow paths with spaces"""
return '"{}"'.format(path) if " " in path else path


def find_paths_by_hash(texture_hash):
"""Find the texture hash key in the dictionary.
Expand Down Expand Up @@ -76,7 +81,7 @@ def maketx(source, destination, *args):
]

cmd.extend(args)
cmd.extend(["-o", destination, source])
cmd.extend(["-o", escape_space(destination), escape_space(source)])

cmd = " ".join(cmd)

Expand Down Expand Up @@ -314,7 +319,6 @@ def process_resources(self, instance, staging_dir):
do_maketx = instance.data.get("maketx", False)

# Collect all unique files used in the resources
files = set()
files_metadata = {}
for resource in resources:
# Preserve color space values (force value after filepath change)
Expand All @@ -325,15 +329,13 @@ def process_resources(self, instance, staging_dir):
for f in resource["files"]:
files_metadata[os.path.normpath(f)] = {
"color_space": color_space}
# files.update(os.path.normpath(f))

# Process the resource files
transfers = []
hardlinks = []
hashes = {}
force_copy = instance.data.get("forceCopy", False)

self.log.info(files)
for filepath in files_metadata:

linearize = False
Expand Down Expand Up @@ -492,7 +494,7 @@ def _process_texture(self, filepath, do_maketx, staging, linearize, force):
# Include `source-hash` as string metadata
"-sattrib",
"sourceHash",
texture_hash,
escape_space(texture_hash),
colorconvert,
)

Expand Down

0 comments on commit 8674523

Please sign in to comment.