maxWiklund / nuke_parser

Nuke script (.nk) parser in python
Apache License 2.0
18 stars 1 forks source link

Parser fails with a SwitchMatte Node #3

Open Liametc opened 9 hours ago

Liametc commented 9 hours ago

Hi Max,

Using the parser to figure out what nodes are connected to the script and it keeps failing in nodes that have weird input strings, such as the SwitchMatte node It's representation is such:

SwitchMatte {
inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0inputs 0inputs 0  inputs 0inputs 2
name SwitchMatte1
xpos -223
ypos -74
from0 rgba.alpha
...

Therefore is failing with

2024-11-05 12:56:04: <class 'SyntaxError'>
2024-11-05 12:56:04: Traceback (most recent call last):
...
2024-11-05 12:56:04:   File "python3.9/site-packages/nuke_parser/parser.py", line 575, in parseNk
2024-11-05 12:56:04:     return _parseNk(file_path, _parseGizmos())
2024-11-05 12:56:04:   File "python3.9/site-packages/nuke_parser/parser.py", line 485, in _parseNk
2024-11-05 12:56:04:     nk_node = Node(class_, knobs)
2024-11-05 12:56:04:   File "python3.9/site-packages/nuke_parser/parser.py", line 82, in __init__
2024-11-05 12:56:04:     self._inputs = [None] * eval(str(self._knobs.get("inputs")))
2024-11-05 12:56:04:   File "<string>", line 1
2024-11-05 12:56:04:     0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0  inputs 0inputs 0inputs 0  inputs 0inputs 2
2024-11-05 12:56:04:      ^
2024-11-05 12:56:04: SyntaxError: invalid syntax
maxWiklund commented 9 hours ago

Hi @Liametc. Can you provide me with a nuke script ( 3 or 4 nodes) that reproduce the bug?

Liametc commented 9 hours ago

Sorry it's a production script and I apparently don't have access to that gizmo