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 sys | |
if sys.version_info >= (3,4): | |
print('at least 3.4!') |
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 sys | |
# import method depends on python version | |
if sys.version_info.major > 2: | |
import importlib | |
importlib.reload(my_module) | |
else: | |
reload(my_module) |
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
""" | |
Keep a node close to its buddy whenever the buddy is moved | |
- uses event call back which is only persisstant in session :( | |
""" | |
# create geo | |
geo = hou.node('obj').createNode('geo') | |
# create two nodes |
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) |
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
""" | |
A HDA version is inside the name | |
So the logic is node > type > name | |
There is a convience function that splits the namespace, from docs: | |
# parse the full name into components | |
>>> node_type = hou.nodeType(hou.dopNodeTypeCategory(), 'pyrosolver::2.0') | |
>>> node_type.nameComponents() | |
('', '', 'pyrosolver', '2.0') |
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
# usage | |
# convert /path/to/myfile.mov | |
alias convert=convert_to_mp4 | |
convert_to_mp4() { | |
out_file="$(echo $1 | sed 's/\.[^.]*$//').mp4" | |
ffmpeg -y -i "$1" -crf 20 "${out_file}" | |
} |
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
# Find 3 digit string version with prefix 'v' - but dont incliude the v in the result | |
# v### - with postive lookbehind for the v | |
filename = '/mydir_v012/myfile_v012.1001.exr' | |
# wil' return list of all found results | |
find_versions = re.findall('(?<=v)\d{3}', filename) |
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
// get first point on each prim | |
i@point_zero = primpoints(0, @primnum)[0]; | |
// get that point's emit frame | |
i@emit_frame = point(0, '__frame', @point_zero)*.01; | |
// subtract emit frame from current frame to create age | |
i@age = @Frame - @emit_frame; | |
// at a certain frame lower the strength |
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
node = hou.pwd() | |
geo = node.geometry() | |
# loop through prims on geometry | |
for prim in geo.prims(): | |
# get attribute | |
path = prim.attribValue("path") | |
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
# run this with hython | |
geo_obj = hou.node('obj').createNode('geo') | |
sphere = geo_obj.createNode('sphere') | |
# make polygons instead of prim | |
sphere.parm('type').set(1) | |
sphere.parm('freq').set(8) | |
sphere.parm('scale').set(.45) |
NewerOlder