Skip to content

Commit

Permalink
fix hip_script input validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pedohorse committed Sep 1, 2024
1 parent 0922bea commit 507d9ba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lifeblood/stock_nodes/houdini/nodes/hip_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def process_task(self, context) -> ProcessingResult:
script = 'import os, hou\n'

source_hip = context.param_value('hip path')
if not source_hip:
raise ProcessingError('hip path is empty')
dest_hip = source_hip
if context.param_value('save different hip'):
dest_hip = context.param_value('save hip path')
Expand All @@ -69,7 +71,12 @@ def process_task(self, context) -> ProcessingResult:
'hou.hipFile.addEventCallback(__fix_hip_env__)\n'

script += 'def __main_body__():\n'
script += '\n'.join(f' {line}' for line in context.param_value('script').splitlines())

code_lines = '\n'.join(f' {line}' for line in context.param_value('script').splitlines())
if code_lines.strip() == '':
script += ' pass'
else:
script += code_lines

script += '\n\n' \
f'hou.hipFile.load({repr(source_hip)}, ignore_load_warnings=True)\n' \
Expand Down

0 comments on commit 507d9ba

Please sign in to comment.