Skip to content

Commit d4ae7c5

Browse files
authored
Merge pull request #8 from nfa-vfxim/feature/change_uv_rendervar
Changed UV rendervar primvar to st instead of hituv
2 parents 5aa12c4 + a1563cf commit d4ae7c5

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

otls/create_otl_20.0.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""This slightly messy and large file is used to create the SGTK Karma OTL.
22
We 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
44
long and a bit unorganized, however this is still better than the alternative.
55
66
To build the OTL you must run this from a Houdini python shell:
77
88
exec(open(r"path-to-app\tk-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

1313
import os
@@ -17,12 +17,10 @@
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

2422
pRef_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():
268266
motionblur = hda.createNode("motionblur", "motionblur")
269267
motionblur_switch = hda.createNode("switch", "motionblur_switch")
270268
render_product_edit = hda.createNode("renderproduct", "renderproduct_edit")
269+
uv_rendervar_edit = hda.createNode("rendervar", "uv_rendervar_edit")
271270
node_user_metadata = hda.createNode("attribwrangle", "user_metadata")
272271
node_sg_metadata = hda.createNode("attribwrangle", "sg_metadata")
273272
python_node = hda.createNode("pythonscript", "pRef_caller")
@@ -283,7 +282,8 @@ def _get_metadata_block():
283282
motionblur_switch.setInput(0, crypto_switch)
284283
motionblur_switch.setInput(1, motionblur)
285284
render_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)
287287
node_sg_metadata.setInput(0, node_user_metadata)
288288
python_node.setInput(0, node_sg_metadata)
289289
usdrender_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():
335336
render_product_edit.parm("productType_control").set("none")
336337
render_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
339349
for 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 :)
889898
prefs = hou.FolderParmTemplate(
890899
"prefs",
891900
"pRefs",

otls/python_functions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import hou
55
import re
66

7-
from pxr import Sdf, UsdGeom
8-
97

108
class ValidationError(Exception):
119
pass

otls/sgtk_karma.otl

6.24 KB
Binary file not shown.

0 commit comments

Comments
 (0)