mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +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)
|
cmds.loadPlugin("pgYetiMaya", quiet=True)
|
||||||
|
|
||||||
# Get JSON
|
# Get JSON
|
||||||
fname, ext = os.path.splitext(self.fname)
|
fbase = re.search(r'^(.+)\.(\d+|#+)\.fur', self.fname)
|
||||||
settings_fname = "{}.fursettings".format(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:
|
with open(settings_fname, "r") as fp:
|
||||||
fursettings = json.load(fp)
|
fursettings = json.load(fp)
|
||||||
|
|
||||||
|
|
@ -102,7 +104,6 @@ class YetiCacheLoader(api.Loader):
|
||||||
namespace = container["namespace"]
|
namespace = container["namespace"]
|
||||||
container_node = container["objectName"]
|
container_node = container["objectName"]
|
||||||
path = api.get_representation_path(representation)
|
path = api.get_representation_path(representation)
|
||||||
|
|
||||||
# Get all node data
|
# Get all node data
|
||||||
fname, ext = os.path.splitext(path)
|
fname, ext = os.path.splitext(path)
|
||||||
settings_fname = "{}.fursettings".format(fname)
|
settings_fname = "{}.fursettings".format(fname)
|
||||||
|
|
@ -151,7 +152,8 @@ class YetiCacheLoader(api.Loader):
|
||||||
# Update cache file name
|
# Update cache file name
|
||||||
file_name = data["name"].replace(":", "_")
|
file_name = data["name"].replace(":", "_")
|
||||||
cache_file_path = "{}.%04d.fur".format(file_name)
|
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:
|
if cb_id not in scene_lookup:
|
||||||
|
|
||||||
|
|
@ -284,10 +286,15 @@ class YetiCacheLoader(api.Loader):
|
||||||
attributes = node_settings["attrs"]
|
attributes = node_settings["attrs"]
|
||||||
|
|
||||||
# Check if cache file name is stored
|
# 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:
|
if "cacheFileName" not in attributes:
|
||||||
file_name = original_node.replace(":", "_")
|
cache = "{}.%0{}d.fur".format(fbase.group(1), padding)
|
||||||
cache_name = "{}.%04d.fur".format(file_name)
|
|
||||||
cache = os.path.join(self.fname, cache_name)
|
|
||||||
|
|
||||||
self.validate_cache(cache)
|
self.validate_cache(cache)
|
||||||
attributes["cacheFileName"] = cache
|
attributes["cacheFileName"] = cache
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class ExtractYetiCache(pype.api.Extractor):
|
||||||
self.log.info("cache files: {}".format(cache_files[0]))
|
self.log.info("cache files: {}".format(cache_files[0]))
|
||||||
instance.data["representations"].append(
|
instance.data["representations"].append(
|
||||||
{
|
{
|
||||||
'name': cache_files[0].split(".")[0],
|
'name': 'fur',
|
||||||
'ext': 'fur',
|
'ext': 'fur',
|
||||||
'files': cache_files[0] if len(cache_files) == 1 else cache_files,
|
'files': cache_files[0] if len(cache_files) == 1 else cache_files,
|
||||||
'stagingDir': dirname,
|
'stagingDir': dirname,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue