Add a script for converting usdnc to usd inside houdini
This commit is contained in:
parent
ba1a922470
commit
d4d46af96c
17
configs/houdini19.5/scripts/post_frame_usdnc_to_usd.py
Normal file
17
configs/houdini19.5/scripts/post_frame_usdnc_to_usd.py
Normal file
@ -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))
|
@ -97,6 +97,10 @@ def main() -> int:
|
|||||||
str(hou_path / "bin" / get_binary_name_for_edition(args.type)),
|
str(hou_path / "bin" / get_binary_name_for_edition(args.type)),
|
||||||
"-foreground",
|
"-foreground",
|
||||||
] + get_houdini_edition_args(args.type)
|
] + 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)}")
|
logger.info(f"Running: {' '.join(cmd)}")
|
||||||
status = subprocess.run(cmd, env=environment_vars, cwd=project_path).returncode
|
status = subprocess.run(cmd, env=environment_vars, cwd=project_path).returncode
|
||||||
return status
|
return status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user