diff --git a/configs/houdini19.5/scripts/post_frame_usdnc_to_usd.py b/configs/houdini19.5/scripts/post_frame_usdnc_to_usd.py new file mode 100644 index 0000000..22ed009 --- /dev/null +++ b/configs/houdini19.5/scripts/post_frame_usdnc_to_usd.py @@ -0,0 +1,17 @@ +from pxr import Usd +from pathlib import Path + +# Figure out what file just got exported +# NOTE: The filename the user enters is not the actual filename due to the NC suffix +output_file_field = Path(hou.pwd().parm("lopoutput").eval()) +rendered_file = output_file_field.with_suffix(".usdnc") +print(f"[USDNC To USD]: Converting {rendered_file} to USD") + +# Load the rendered stage +print("[USDNC To USD]: Loading stage") +stage = Usd.Stage.Open(str(rendered_file)) + +# Write it again with the appropriate extension +output_file = rendered_file.with_suffix(output_file_field.suffix) +print(f"[USDNC To USD]: Exporting to: {output_file}") +stage.Export(str(output_file)) diff --git a/configs/scripts/houdini-tool.py b/configs/scripts/houdini-tool.py index a2a0dec..4e45e38 100755 --- a/configs/scripts/houdini-tool.py +++ b/configs/scripts/houdini-tool.py @@ -97,6 +97,10 @@ def main() -> int: str(hou_path / "bin" / get_binary_name_for_edition(args.type)), "-foreground", ] + get_houdini_edition_args(args.type) + if (project_path / f"{project_path.name}.hip").exists(): + cmd.append(f"{project_path}/{project_path.name}.hip") + if (project_path / f"{project_path.name}.hipnc").exists(): + cmd.append(f"{project_path}/{project_path.name}.hipnc") logger.info(f"Running: {' '.join(cmd)}") status = subprocess.run(cmd, env=environment_vars, cwd=project_path).returncode return status