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