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
from PySide.QtGui import * | |
# create a modal message box with a single 'Ok' button | |
box = QMessageBox() | |
box.setWindowTitle('Title') | |
box.setText('Text') | |
box.exec_() | |
# create a modal message box that offers some choices (Yes|No|Cancel) |
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 | |
from Qt import QtCore | |
from Qt import QtGui | |
from Qt import QtCompat | |
from Qt import QtWidgets | |
class my_dialog(QtWidgets.QDialog): | |
def __init__(self): | |
QtWidgets.QDialog.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint) |
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
# toolsutil part came from a built-in shelf tool so I could get the correct context pwd | |
import toolutils | |
pane = toolutils.activePane(kwargs) | |
new_node = pane.pwd().createNode('subnet', 'lights') | |
new_node.setColor(hou.Color(0.97, 0.8, 0.27)) | |
new_node.setUserData('nodeshape', 'light') |
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
// point wrangle using 'lage' attribute generated from L-System SOP | |
// looping over points is like doing a promote max sop | |
// get the max by looping over the points | |
float lage_max = 0; | |
// get point count | |
int pc = npoints(0); | |
// loop over points |
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 the max by looping over the points | |
int pc = npoints(0); | |
printf('pc %s\n', pc); | |
for(int i=0; i < pc; i++) { | |
// careful with printing on a large mesh | |
// printf('point: %s\n', i); | |
} |
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 node's input parm | |
# like opinputpath('.') | |
hou.node('.').inputs()[0].parm('scale').eval() * hou.node('.').inputs()[0].parm('sx').eval() |
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
def nulls_from_x(): | |
for node in hou.selectedNodes(): | |
print(node.name()) | |
t = node.parmTuple('t').eval() | |
r = node.parmTuple('r').eval() | |
s = node.parmTuple('s').eval() | |
scale = node.parm('scale').eval() | |
new_null = hou.node('obj/').createNode('null') | |
new_null.parmTuple('t').set(t) |
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
# Set log level to 'debug' | |
hou.hscript("Redshift_setLogLevel -L 5") | |
# Toggle Redshift console log | |
hou.hscript("Redshift_switchConsoleLog") |
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 nearest point index of second input | |
int np = nearpoint(1, @P); | |
// get that point's position | |
vector np_pos = point(1, 'P', np); | |
// measure distance | |
float dist = distance(@P, np_pos); | |
// normalise distance |
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
# not complete but an example | |
def n(): | |
# get child nodes from a node | |
prop_nodes = hou.node('/obj/action/props/').children() | |
# loop through children | |
for prop in prop_nodes: | |
# filter by name |
OlderNewer