mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-26 19:43:36 +01:00
fxconv: add new return type convention for custom converters
Previously converters had to return: - 0 on success, having called fxconv.elf() themselves - 1 on failure Now they also have the (preferred option) to return: - a bytes or ObjectData on success, without calling fxconv.elf() - None of failure
This commit is contained in:
parent
96c035ff4a
commit
8d6bc9c14f
1 changed files with 7 additions and 1 deletions
|
@ -1178,7 +1178,13 @@ def convert(input, params, target, output=None, model=None, custom=None):
|
|||
o = convert_libimg_cg(input, params)
|
||||
elif custom is not None:
|
||||
for converter in custom:
|
||||
if converter(input, output, params, target) == 0:
|
||||
rc = converter(input, output, params, target)
|
||||
# Old convention: 0 on success, 1 on failure
|
||||
if rc == 0:
|
||||
return
|
||||
# New convention: bytes() or ObjectData() on success
|
||||
if isinstance(rc, bytes) or isinstance(rc, ObjectData):
|
||||
elf(rc, output, "_" + params["name"], **target)
|
||||
return
|
||||
raise FxconvError(f'unknown custom resource type \'{t}\'')
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue