Wing IDE > Python Configuation>Python Execuable (check custom)
path to( ~\Side Effects Software\Houdini xx.x.xxx\bin\hython2.6.exe)
Python Path(check custom)
path to (~\Side Effects Software\Houdini xx.x.xxx\python26)
then,in houdini Python Shell:
[code]
import houxmlrpc
houxmlrpc.run(port=50001)
[/code]
Wing IDE
[code]
import houxmlrpc
hou = houxmlrpc.ServerProxy("http://localhost:50001").hou
geo = hou.node("/obj").createNode("geo")
geo.children()[0].destroy()
font = geo.createNode("font")
font.setParms({"text":"wing is connected"})
[/code]
FTW Python
2012년 1월 21일 토요일
2011년 11월 4일 금요일
Custom Particle File
import hou
source = hou.node('/obj/geo1/popnet1')
path_ = hou.expandString("$HIP")
def writeParticlesInCustomFormat(popnet, file_name):
"""Write the particle data in the geometry geometry to a custom file
format."""
geo = popnet.geometry()
f = file(file_name, "w")
# Write out the number of particle attributes, followed by the particle
# attribute information.
f.write("%d attributes:\n" % len(geo.pointAttribs()))
for attrib in geo.pointAttribs():
f.write("%s %s %d\n" %
(attrib.name(), attrib.dataType(), attrib.size()))
f.write("\n")
# Write the number of particles, followed by the particle attribute values.
f.write("%d points:\n" % len(geo.points()))
for point in geo.points():
for attrib in geo.pointAttribs():
f.write("%s = %s\n" % (attrib.name(), point.attribValue(attrib)))
f.write("\n")
f.close()
writeParticlesInCustomFormat(source,path_+"/"+"test.csv")
source = hou.node('/obj/geo1/popnet1')
path_ = hou.expandString("$HIP")
def writeParticlesInCustomFormat(popnet, file_name):
"""Write the particle data in the geometry geometry to a custom file
format."""
geo = popnet.geometry()
f = file(file_name, "w")
# Write out the number of particle attributes, followed by the particle
# attribute information.
f.write("%d attributes:\n" % len(geo.pointAttribs()))
for attrib in geo.pointAttribs():
f.write("%s %s %d\n" %
(attrib.name(), attrib.dataType(), attrib.size()))
f.write("\n")
# Write the number of particles, followed by the particle attribute values.
f.write("%d points:\n" % len(geo.points()))
for point in geo.points():
for attrib in geo.pointAttribs():
f.write("%s = %s\n" % (attrib.name(), point.attribValue(attrib)))
f.write("\n")
f.close()
writeParticlesInCustomFormat(source,path_+"/"+"test.csv")
2011년 9월 15일 목요일
Install PyQt for houdini 11 x64
http://dl.sebr.fr/download/packages/PyQt-Py2.6-gpl-4.6_amd64.exe
install to c:\python26 경로 확인후
C:\Python26\Lib\site-packages 에 깔린걸 볼수 잇고
나머지 3sip파일과 pyqt폴더를
C:\Program Files\Side Effects Software\Houdini xx.xxx\python26\lib\site-packages
에 덥어쓰기
복사를 한 pyqt폴더에 잇는 dll들을 http://dl.sebr.fr/download/packages/patch_x64dll.zip로 다시 덥어쓰기
후니디 python shell에서
import PyQt4 해서 에러없으면 OK
install to c:\python26 경로 확인후
C:\Python26\Lib\site-packages 에 깔린걸 볼수 잇고
나머지 3sip파일과 pyqt폴더를
C:\Program Files\Side Effects Software\Houdini xx.xxx\python26\lib\site-packages
에 덥어쓰기
복사를 한 pyqt폴더에 잇는 dll들을 http://dl.sebr.fr/download/packages/patch_x64dll.zip로 다시 덥어쓰기
후니디 python shell에서
import PyQt4 해서 에러없으면 OK
2011년 9월 8일 목요일
PyQt input item & print path
import sys
sys.path.append("C:\Users\Administrator\Documents\houdini11.0\script")
import pyqt_houdini
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(337, 312)
self.listView = QtGui.QListWidget(Dialog)
self.listView.setGeometry(QtCore.QRect(40, 40, 256, 192))
self.listView.setObjectName(_fromUtf8("listView"))
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(140, 270, 75, 23))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Dialog", "PushButton", None, QtGui.QApplication.UnicodeUTF8))
class myList(QtGui.QMainWindow):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
QtGui.QMainWindow.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)
self.ui = Ui_Dialog()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.pushButton,QtCore.SIGNAL("clicked()"),self.getList)
QtCore.QObject.connect(self.ui.listView,QtCore.SIGNAL("itemClicked(QListWidgetItem *)"),self.tagList)
resolution = QtGui.QDesktopWidget().screenGeometry()
self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
(resolution.height() / 2) - (self.frameSize().height() / 2))
def getList(self):
global a
self.ui.listView.clear()
#self.ui.listView.removeItemWidget()
a = hou.selectedNodes()
for i in a:
b= self.ui.listView.addItem(i.name())
#QtCore.QObject.connect(self.ui.listView,QtCore.SIGNAL("itemClicked(QListWidgetItem *)"),self.tagList)
def tagList(self,item):
print self.ui.listView.count(),len(a)
for i in range(len(a)):
if self.ui.listView.currentRow() == i:
print a[i].path()
else:
pass
app = QtGui.QApplication(["houdini"])
myapp = myList()
sys.path.append("C:\Users\Administrator\Documents\houdini11.0\script")
import pyqt_houdini
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(337, 312)
self.listView = QtGui.QListWidget(Dialog)
self.listView.setGeometry(QtCore.QRect(40, 40, 256, 192))
self.listView.setObjectName(_fromUtf8("listView"))
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(140, 270, 75, 23))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Dialog", "PushButton", None, QtGui.QApplication.UnicodeUTF8))
class myList(QtGui.QMainWindow):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
QtGui.QMainWindow.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)
self.ui = Ui_Dialog()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.pushButton,QtCore.SIGNAL("clicked()"),self.getList)
QtCore.QObject.connect(self.ui.listView,QtCore.SIGNAL("itemClicked(QListWidgetItem *)"),self.tagList)
resolution = QtGui.QDesktopWidget().screenGeometry()
self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
(resolution.height() / 2) - (self.frameSize().height() / 2))
def getList(self):
global a
self.ui.listView.clear()
#self.ui.listView.removeItemWidget()
a = hou.selectedNodes()
for i in a:
b= self.ui.listView.addItem(i.name())
#QtCore.QObject.connect(self.ui.listView,QtCore.SIGNAL("itemClicked(QListWidgetItem *)"),self.tagList)
def tagList(self,item):
print self.ui.listView.count(),len(a)
for i in range(len(a)):
if self.ui.listView.currentRow() == i:
print a[i].path()
else:
pass
app = QtGui.QApplication(["houdini"])
myapp = myList()
2011년 8월 8일 월요일
2011년 8월 7일 일요일
PyQt center and top on window 화면중간 생성,팝업 유지
class MyForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
QtGui.QMainWindow.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)#stay top 팝업 최상단 유지
self.ui = Ui_Form()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.pushButton,QtCore.SIGNAL("clicked()"),self.makeMat)
self.centerScreen()#쌘터함수 실행
def centerScreen(self):#화면중반부에 출력
resolution = QtGui.QDesktopWidget().screenGeometry()
self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
(resolution.height() / 2) - (self.frameSize().height() / 2))
def makeMat(self):
sizex_ = 100
sizey_ = 100
geo = hou.node("/obj").createNode("geo","Ocean")
geo.children()[0].destroy()
grid_ = geo.createNode("grid")
grid_.setParms({"sizex":sizex_,"sizey":sizey_})
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
QtGui.QMainWindow.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)#stay top 팝업 최상단 유지
self.ui = Ui_Form()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.pushButton,QtCore.SIGNAL("clicked()"),self.makeMat)
self.centerScreen()#쌘터함수 실행
def centerScreen(self):#화면중반부에 출력
resolution = QtGui.QDesktopWidget().screenGeometry()
self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
(resolution.height() / 2) - (self.frameSize().height() / 2))
def makeMat(self):
sizex_ = 100
sizey_ = 100
geo = hou.node("/obj").createNode("geo","Ocean")
geo.children()[0].destroy()
grid_ = geo.createNode("grid")
grid_.setParms({"sizex":sizex_,"sizey":sizey_})
2011년 6월 23일 목요일
Python in houdini
#메세지 툴박스 팝업후 실행
geo = hou.node("obj/").createNode("geo")
if hou.ui.displayMessage("BTW",buttons=("GRID","BOX"))==0:
geo.createNode("grid")
else:
geo.createNode("box")
------------------------------------------------------------------------------
#파이썬 샵에서 파라미터 만든후 폴리곤 형성
geo = hou.pwd().geometry()
poly = geo.createPolygon()
num_=hou.Node.evalParm(hou.pwd(),"intnum")
pi_=hou.Node.evalParm(hou.pwd(),"pi")
import math
for x in range(num_):
y=math.sin(x * math.pi * pi_ / num_) *5
z=math.cos(x * math.pi * pi_ / num_) *5
a=geo.createPoint()
a.setPosition((0,y,z))
poly.addVertex(a)
geo = hou.node("obj/").createNode("geo")
if hou.ui.displayMessage("BTW",buttons=("GRID","BOX"))==0:
geo.createNode("grid")
else:
geo.createNode("box")
------------------------------------------------------------------------------
#파이썬 샵에서 파라미터 만든후 폴리곤 형성
geo = hou.pwd().geometry()
poly = geo.createPolygon()
num_=hou.Node.evalParm(hou.pwd(),"intnum")
pi_=hou.Node.evalParm(hou.pwd(),"pi")
import math
for x in range(num_):
y=math.sin(x * math.pi * pi_ / num_) *5
z=math.cos(x * math.pi * pi_ / num_) *5
a=geo.createPoint()
a.setPosition((0,y,z))
poly.addVertex(a)
피드 구독하기:
덧글 (Atom)
