Skip to content

Instantly share code, notes, and snippets.

@chordee
chordee / avalonpublish.py
Created March 14, 2024 07:16
Houdini USD output processor
import hou
import husd.outputprocessor as base
import os
import time
class AvalonPublish(base.OutputProcessor):
def __init__(self):
super(AvalonPublish, self).__init__()
@chordee
chordee / create_rest_primvar.py
Created December 25, 2023 10:53
Create World Space primvars:rest
node = hou.pwd()
stage = node.editableStage()
# Add code to modify the stage.
# Use drop down menu to select examples.
from pxr import Usd, UsdGeom
asset_root = '/ROOT'
primvar_name = 'rset'
@chordee
chordee / arImage_string_to_assetpath.py
Last active December 19, 2023 06:31
Convert Arnold Image shader filename input from String type to Asset Path
node = hou.pwd()
stage = node.editableStage()
from pxr import Usd, UsdShade, Sdf
source_node = node.parent().input(0)
source_stage = source_node.stage()
rule = hou.LopSelectionRule('%shadertype(arnold:image)')
paths = rule.expandedPaths(stage=source_stage)
@chordee
chordee / ai_to_mtlx.py
Last active December 21, 2023 12:09
Python script: convert htoa ai shaders to materialx shaders in Houdini Solaris
from pxr import Usd, UsdShade, Sdf
from typing import Type
import hou
node = hou.pwd()
stage = node.editableStage()
class Shader_Mapping:
from pathlib import Path
import argparse
import matplotlib.pyplot as plt
import time
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('root', type=str, help='Path to folder')
parser.add_argument('ext', type=str, help='Extension name')
parser.add_argument('num_step', type=int, help='Numbers part postion')
_Pragma("opname fisheye_lens_vex");
_Pragma("oplabel \"Fisheye Lens VEX\"");
_Pragma("hint x hidden");
_Pragma("hint y hidden");
_Pragma("hint P hidden");
_Pragma("hint I hidden");
_Pragma("hint valid hidden");
_Pragma("hint aspect hidden");
_Pragma("hint mask toggle");