-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Houdini model and lighting integration (#56)
* add houdini integration - add UI button "Open in Houdini" in the metadata section - launch the Update.hipnc template by default * open the correct houdini template based on new/existing assets * copy template to asset folder if it doesn't exist * add lighting integration * add houdini lighting integration * Delete Pipfile * Add "DCC Integrations" UI --------- Co-authored-by: Linda Zhu <[email protected]> Co-authored-by: Thomas Shaw <[email protected]>
- Loading branch information
1 parent
6ac3ee8
commit 5319c74
Showing
11 changed files
with
312 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
houdini/backup |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# hou is the Houdini module, which will only be available after Houdini launches | ||
import hou | ||
import argparse | ||
import os | ||
|
||
def is_class_asset_structure(source_folder, asset_name): | ||
is_root_existing = os.path.exists(os.path.join(source_folder, f'{asset_name}.usda')) | ||
# only check if one LOD exists | ||
is_LOD_existing = os.path.exists(os.path.join(source_folder, f'{asset_name}LOD0.usda')) | ||
is_geometry_existing = os.path.exists(os.path.join(source_folder, f'{asset_name}_model.usda')) | ||
is_material_existing = os.path.exists(os.path.join(source_folder, f'{asset_name}_material.usda')) | ||
return is_root_existing and is_LOD_existing and is_geometry_existing and is_material_existing | ||
|
||
def is_houdini_asset_structure(source_folder): | ||
is_root_existing = os.path.exists(os.path.join(source_folder, 'root.usda')) | ||
is_geometry_dir = os.path.isdir(os.path.join(source_folder, 'Geometry')) | ||
is_material_dir = os.path.isdir(os.path.join(source_folder, 'Material')) | ||
return is_root_existing and is_material_dir and is_geometry_dir | ||
|
||
if __name__ == "__main__": | ||
# command line flags | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-a", "--assetname", required=True, help="Enter the asset name") | ||
parser.add_argument("-o", "--original", required=True, help="Enter the original asset directory to read your old asset USDs from") | ||
parser.add_argument("-n", "--new", help="Enter the new asset directory you want your asset USDs to output to") | ||
args = parser.parse_args() | ||
|
||
assetname = args.assetname | ||
source_folder = args.original | ||
|
||
if os.path.isdir(source_folder): | ||
# launching Update.hipnc template | ||
# assets in old hw10 structure | ||
if is_class_asset_structure(source_folder, assetname): | ||
print('Old asset structure') | ||
|
||
# get and set houdini node parameters | ||
class_structure_node = hou.node("stage/load_class_asset_update") | ||
asset_name = class_structure_node.parm("asset_name") | ||
original_asset_directory = class_structure_node.parm("original_asset_directory") | ||
new_asset_directory = class_structure_node.parm("new_asset_directory") | ||
|
||
asset_name.set(assetname) | ||
original_asset_directory.set(source_folder) | ||
new_asset_directory.set(args.new) | ||
|
||
# set this node as the current selected and display output in viewport | ||
class_structure_node.setCurrent(True, True) | ||
class_structure_node.setDisplayFlag(True) | ||
|
||
# assets in new houdini structure | ||
elif is_houdini_asset_structure(source_folder): | ||
print('New houdini asset structure') | ||
|
||
new_structure_node = hou.node("stage/load_new_asset_update") | ||
asset_name = new_structure_node.parm("asset_name") | ||
asset_root_directory = new_structure_node.parm("asset_root_directory") | ||
asset_name.set(assetname) | ||
asset_root_directory.set(source_folder) | ||
|
||
new_structure_node.setCurrent(True, True) | ||
new_structure_node.setDisplayFlag(True) | ||
|
||
# launching CreateNew.hipnc template | ||
else: | ||
print('Creating new asset') | ||
|
||
create_asset_node = hou.node("stage/create_new_asset") | ||
asset_name = create_asset_node.parm("asset_name") | ||
asset_root_directory = create_asset_node.parm("temp_asset_directory") | ||
# todo: specify LOD paths | ||
asset_name.set(assetname) | ||
asset_root_directory.set(source_folder) | ||
|
||
create_asset_node.setCurrent(True, True) | ||
create_asset_node.setDisplayFlag(True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# hou is the Houdini module, which will only be available after Houdini launches | ||
import hou | ||
import argparse | ||
import os | ||
|
||
if __name__ == "__main__": | ||
# command line flags | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-a", "--assetpath", required=True, help="Enter the asset USD full path") | ||
parser.add_argument("-o", "--outputpath", required=True, help="Enter the output render full path") | ||
args = parser.parse_args() | ||
|
||
# NOTE: Must have the lighting .hip in the same directory as this script | ||
currentDir = os.path.dirname(os.path.realpath(__file__)) | ||
hou.hipFile.load(os.path.join(currentDir, "KarmaRendering.hipnc")) | ||
|
||
# retrieve node parameters/objects | ||
render_node = hou.node("stage/render_USD_geom") | ||
asset_path = render_node.parm("asset_path") | ||
output_path = render_node.parm("render_output_path") | ||
save_render_button = render_node.parm("save_render_button") | ||
|
||
# set input paths | ||
asset_path.set(args.assetpath) | ||
output_path.set(args.outputpath) | ||
|
||
# execute ROP render to disk | ||
save_render_button.pressButton() | ||
|
||
print(f"Render image saved to {args.outputpath}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.