Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions nk_parser/nuke_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
_VERSION_RE = re.compile(r"version[ ]+(?P<version>[\d\.]+([ ]v\d)?)")
_CLONE_RE = re.compile(r"clone \$(?P<key>\w+)\s\{")
_NODE_KNOB_RE = re.compile(r"^\s*(?P<key>[\w_\.]+)[ ]+(?P<value>(:?\"|\w|\{|-|/).*)")
_BINARY_RE = re.compile(r"[0-9a-fA-F;]{100,}")


_GROUP_NODE_CLASSES = ("Group", "Gizmo", "VariableGroup")
Expand Down Expand Up @@ -497,6 +498,13 @@ def _parseNk(file_path: str, gizmos: Optional[dict] = None) -> Node:
if "push 0" in line:
main_stack.push(None)
continue

elif _BINARY_RE.search(line):
# Some lines contain extremely long character sequences, making regex processing very slow
# (e.g., knob render options from Nuke OpticalFlares).
# These lines are skipped since they are not needed for graph creation.
continue

elif _BRANCH_STACK_RE.search(line): # set stack-key
key = _BRANCH_STACK_RE.search(line).group("key")
if key in "cut_paste_input":
Expand Down