Last active
April 13, 2021 17:29
-
-
Save simonreeves/263496c63da38b2973b77cdf7c7f3ebe to your computer and use it in GitHub Desktop.
create #pdg #tops #topnet and nodes #houdini #python
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
import os | |
import subproocess | |
import hou | |
def make_rs_convert_topnet(path): | |
""" | |
Create topnet and some nodes | |
""" | |
texfiles_dir = os.path.dirname(path) | |
# get redshift path from environ variables | |
rs_tex_processor_path = hou.getenv('REDSHIFT_COREDATAPATH') + '/bin/redshiftTextureProcessor.exe' | |
# create topnet and cook in background | |
topnet = hou.node('/tasks').createNode('topnet', 'rs_tex_convert') | |
# tidy layout | |
hou.node('/tasks').layoutChildren() | |
# ignore errors to skip non convertable files which is fine | |
topnet.children()[0].parm('local_echandleby').set(3) | |
fp_node = topnet.createNode('filepattern') | |
fp_node.parm('pattern').set(texfiles_dir + '/*') | |
gg_node = fp_node.createOutputNode('genericgenerator') | |
gg_node.parm('pdg_command').set('{} `pdgattribvals("directory")`/`pdgattribvals("filename")`'.format(rs_tex_processor_path)) | |
# tidy layout | |
topnet.layoutChildren() | |
# execute in background | |
gg_node.executeGraph() | |
make_rs_convert_topnet('/c/path/to/wall.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment