11"""This slightly messy and large file is used to create the SGTK Karma OTL.
22We build the OTL using this file so we can easily change things and rebuild the OTL
3- without going into Houdini and clicking a bunch of messy buttons. This file is
3+ without going into Houdini and clicking a bunch of messy buttons. This file is
44long and a bit unorganized, however this is still better than the alternative.
55
66To build the OTL you must run this from a Houdini python shell:
77
88exec(open(r"path-to-app\t k-houdini-karma\otls\create_otl.py").read())
99
10- exec(open(r"C:/Users/Mervin.vanBrakel/Documents/ShotGrid/DevApps /tk-houdini-karma/otls/create_otl_20.0.py").read())
10+ exec(open(r"C:/Users/Mervin.vanBrakel/Documents/GitHub /tk-houdini-karma/otls/create_otl_20.0.py").read())
1111"""
1212
1313import os
1717
1818# Set the path to the OTL folder here. We can't use something like os.path.realpath because
1919# we're running this from within an interactive shell.
20- OTL_FOLDER = (
21- "C:/Users/Mervin.vanBrakel/Documents/ShotGrid/DevApps/tk-houdini-karma/otls/"
22- )
20+ OTL_FOLDER = "C:/Users/Mervin.vanBrakel/Documents/GitHub/tk-houdini-karma/otls/"
2321
2422pRef_caller_file = open (
25- r"C:/Users/Mervin.vanBrakel/Documents/ShotGrid/DevApps /tk-houdini-karma/otls/pRef_caller.py"
23+ r"C:/Users/Mervin.vanBrakel/Documents/GitHub /tk-houdini-karma/otls/pRef_caller.py"
2624).read ()
2725
2826
@@ -268,6 +266,7 @@ def _get_metadata_block():
268266motionblur = hda .createNode ("motionblur" , "motionblur" )
269267motionblur_switch = hda .createNode ("switch" , "motionblur_switch" )
270268render_product_edit = hda .createNode ("renderproduct" , "renderproduct_edit" )
269+ uv_rendervar_edit = hda .createNode ("rendervar" , "uv_rendervar_edit" )
271270node_user_metadata = hda .createNode ("attribwrangle" , "user_metadata" )
272271node_sg_metadata = hda .createNode ("attribwrangle" , "sg_metadata" )
273272python_node = hda .createNode ("pythonscript" , "pRef_caller" )
@@ -283,7 +282,8 @@ def _get_metadata_block():
283282motionblur_switch .setInput (0 , crypto_switch )
284283motionblur_switch .setInput (1 , motionblur )
285284render_product_edit .setInput (0 , motionblur_switch )
286- node_user_metadata .setInput (0 , render_product_edit )
285+ uv_rendervar_edit .setInput (0 , render_product_edit )
286+ node_user_metadata .setInput (0 , uv_rendervar_edit )
287287node_sg_metadata .setInput (0 , node_user_metadata )
288288python_node .setInput (0 , node_sg_metadata )
289289usdrender_rop .setInput (0 , python_node )
@@ -299,6 +299,7 @@ def _get_metadata_block():
299299 motionblur ,
300300 motionblur_switch ,
301301 render_product_edit ,
302+ uv_rendervar_edit ,
302303 node_user_metadata ,
303304 node_sg_metadata ,
304305 python_node ,
@@ -335,6 +336,15 @@ def _get_metadata_block():
335336render_product_edit .parm ("productType_control" ).set ("none" )
336337render_product_edit .parm ("xn__karmaproductdcmzbias_control_nmbh" ).set ("set" )
337338
339+ # Changing the UV var to use the ST product instead of hituv.
340+ # HitUV is like, totally not useful and I'm not sure what that's the default.
341+ uv_rendervar_edit .parm ("createprims" ).set ("off" )
342+ uv_rendervar_edit .parm ("primpattern" ).set ("/Render/Products/Vars/UV" )
343+ uv_rendervar_edit .parm ("sourceName" ).set ("st" )
344+ uv_rendervar_edit .parm ("sourceType" ).set ("primvar" )
345+ uv_rendervar_edit .parm ("xn__driverparametersaovname_jebkd" ).set ("UV" )
346+ uv_rendervar_edit .parm ("xn__driverparametersaovformat_shbkd" ).set ("color3f" )
347+
338348# Setting the metadata wrangle settings
339349for i , node in enumerate ([node_user_metadata , node_sg_metadata ]):
340350 node .parm ("primpattern" ).set ("/Render/** & %type:RenderProduct" )
@@ -885,7 +895,6 @@ def _get_metadata_block():
885895
886896
887897# AOVs -> pRefs
888- # Still working on this, will be functional in the next update :)
889898prefs = hou .FolderParmTemplate (
890899 "prefs" ,
891900 "pRefs" ,
0 commit comments