Use StringTemplate to allow for optional template keys

This commit is contained in:
Fabia Serra Arrizabalaga 2023-06-14 09:12:08 -05:00
parent 079f7a935a
commit e769a76ac3

View file

@ -30,6 +30,7 @@ from openpype.lib import (
env_value_to_bool,
Logger,
get_version_from_path,
StringTemplate,
)
from openpype.settings import (
@ -1300,10 +1301,8 @@ def create_write_node(
# build file path to workfiles
fdir = str(anatomy_filled["work"]["folder"]).replace("\\", "/")
fpath = data["fpath_template"].format(
work=fdir,
**data,
)
data["work"] = fdir
fpath = StringTemplate(data["fpath_template"]).format_strict(data)
# create directory
if not os.path.isdir(os.path.dirname(fpath)):