mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
fixed cache loader
This commit is contained in:
parent
f549710a64
commit
6914371872
2 changed files with 15 additions and 8 deletions
|
|
@ -39,8 +39,10 @@ class YetiCacheLoader(api.Loader):
|
|||
cmds.loadPlugin("pgYetiMaya", quiet=True)
|
||||
|
||||
# Get JSON
|
||||
fname, ext = os.path.splitext(self.fname)
|
||||
settings_fname = "{}.fursettings".format(fname)
|
||||
fbase = re.search(r'^(.+)\.(\d+|#+)\.fur', self.fname)
|
||||
if not fbase:
|
||||
raise RuntimeError('Cannot determine fursettings file path')
|
||||
settings_fname = "{}.fursettings".format(fbase.group(1))
|
||||
with open(settings_fname, "r") as fp:
|
||||
fursettings = json.load(fp)
|
||||
|
||||
|
|
@ -102,7 +104,6 @@ class YetiCacheLoader(api.Loader):
|
|||
namespace = container["namespace"]
|
||||
container_node = container["objectName"]
|
||||
path = api.get_representation_path(representation)
|
||||
|
||||
# Get all node data
|
||||
fname, ext = os.path.splitext(path)
|
||||
settings_fname = "{}.fursettings".format(fname)
|
||||
|
|
@ -151,7 +152,8 @@ class YetiCacheLoader(api.Loader):
|
|||
# Update cache file name
|
||||
file_name = data["name"].replace(":", "_")
|
||||
cache_file_path = "{}.%04d.fur".format(file_name)
|
||||
data["attrs"]["cacheFileName"] = os.path.join(path, cache_file_path)
|
||||
data["attrs"]["cacheFileName"] = os.path.join(
|
||||
path, cache_file_path)
|
||||
|
||||
if cb_id not in scene_lookup:
|
||||
|
||||
|
|
@ -284,10 +286,15 @@ class YetiCacheLoader(api.Loader):
|
|||
attributes = node_settings["attrs"]
|
||||
|
||||
# Check if cache file name is stored
|
||||
|
||||
# get number of # in path and convert it to C prinf format
|
||||
# like %04d expected by Yeti
|
||||
fbase = re.search(r'^(.+)\.(\d+|#+)\.fur', self.fname)
|
||||
if not fbase:
|
||||
raise RuntimeError('Cannot determine file path')
|
||||
padding = len(fbase.group(2))
|
||||
if "cacheFileName" not in attributes:
|
||||
file_name = original_node.replace(":", "_")
|
||||
cache_name = "{}.%04d.fur".format(file_name)
|
||||
cache = os.path.join(self.fname, cache_name)
|
||||
cache = "{}.%0{}d.fur".format(fbase.group(1), padding)
|
||||
|
||||
self.validate_cache(cache)
|
||||
attributes["cacheFileName"] = cache
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class ExtractYetiCache(pype.api.Extractor):
|
|||
self.log.info("cache files: {}".format(cache_files[0]))
|
||||
instance.data["representations"].append(
|
||||
{
|
||||
'name': cache_files[0].split(".")[0],
|
||||
'name': 'fur',
|
||||
'ext': 'fur',
|
||||
'files': cache_files[0] if len(cache_files) == 1 else cache_files,
|
||||
'stagingDir': dirname,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue