fxconv: don't require py param to be set in manual calls

This commit is contained in:
Lephenixnoir 2024-04-21 12:13:44 +02:00
parent ccbe0e594a
commit a443fa59e1
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 4 additions and 4 deletions

View File

@ -513,7 +513,7 @@ def convert_bopti_fx(input, params):
data[n] = layer[4 * longword + i]
n += 1
if params["py"]["enabled"]:
if "py" in params and params["py"]["enabled"]:
w, h = img.size
return ["import gint\n",
f"{params['name']} = gint.image({p.id}, {w}, {h}, ", data, ")\n"]
@ -602,7 +602,7 @@ def convert_image_cg(input, params):
data, stride, palette, color_count = image_encode(img, format)
if params["py"]["enabled"]:
if "py" in params and params["py"]["enabled"]:
w, h = img.size
return [
"import gint\n",
@ -807,7 +807,7 @@ def convert_topti(input, params):
# Object file generation
#---
if params["py"]["enabled"]:
if "py" in params and params["py"]["enabled"]:
l = [ "import gint\n",
f"{params['name']} = gint.font({title or None}, {flags}, ",
f"{line_height}, {grid.h}, {len(blocks)}, {glyph_count}, ",
@ -1185,7 +1185,7 @@ def convert(input, params, target, output=None, model=None, custom=None):
raise FxconvError(f'unknown resource type \'{t}\'')
# PythonExtra conversion: output a file
if params["py"]["enabled"]:
if "py" in params and params["py"]["enabled"]:
if isinstance(o, ObjectData):
raise FxconvError(f'conversion doe not support Python output')
pyout(o, output, params)