start removing conform

This commit is contained in:
“christopheseux”
2022-12-28 17:44:15 +01:00
parent 92f275fcea
commit ab72a15a2c
6 changed files with 35 additions and 37 deletions
+2 -2
View File
@@ -85,7 +85,7 @@ def get_active_catalog():
return ''
"""
def norm_asset_datas(asset_file_datas):
''' Return a new flat list of asset data
the filepath keys are merge with the assets keys'''
@@ -180,7 +180,7 @@ def get_asset_source(replace_local=False):
source_path = re.sub(actionlib_dir_local, actionlib_dir, source_path)
return source_path
""""
'''
def get_catalog_path(filepath=None):
filepath = filepath or bpy.data.filepath
+7 -7
View File
@@ -12,17 +12,17 @@ class Template:
def __init__(self, template):
#asset_data_path = Path(lib_path) / ASSETLIB_FILENAME
self.template = template
self.raw = template
@property
def glob_pattern(self):
pattern = self.field_pattern_recursive.sub('**', self.template)
pattern = self.field_pattern_recursive.sub('**', self.raw)
pattern = self.field_pattern.sub('*', pattern)
return pattern
@property
def re_pattern(self):
pattern = self.field_pattern_recursive.sub('([\\\w -_.\/]+)', self.template)
pattern = self.field_pattern_recursive.sub('([\\\w -_.\/]+)', self.raw)
pattern = self.field_pattern.sub('([\\\w -_.]+)', pattern)
pattern = pattern.replace('?', '.')
pattern = pattern.replace('*', '.*')
@@ -31,7 +31,7 @@ class Template:
@property
def fields(self):
return self.field_pattern.findall(self.template)
return self.field_pattern.findall(self.raw)
#return [f or '0' for f in fields]
def parse(self, path):
@@ -57,9 +57,9 @@ class Template:
data = {**(data or {}), **kargs}
try:
path = self.template.format(**data)
path = self.raw.format(**data)
except KeyError as e:
print(f'Cannot format {self.template} with {data}, field {e} is missing')
print(f'Cannot format {self.raw} with {data}, field {e} is missing')
return
path = os.path.expandvars(path)
@@ -84,4 +84,4 @@ class Template:
return Path(paths[0])
def __repr__(self):
return f'Template({self.template})'
return f'Template({self.raw})'