Houdini Python、ダイアログ系のサンプル。
シェルフにでも張り付けてポチると出てくる・・・たぶんね。
ポップアップメッセージ
hou.ui.displayMessage("hoge")
テキストフィールド付きダイアログ
import hou Dialog = hou.ui.readInput(message ="Text Field Dialog\n",title = "TextField Dialog",severity=hou.severityType.Warning,buttons=["Accept","Cancel"]) if Dialog[0]==0: hou.ui.displayMessage(Dialog[1], buttons=('OK','NO',))
テキストフィールド付きダイアログ(Multi)
import hou Dialog = hou.ui.readMultiInput(message ="Multi Text Field Dialog\n",input_labels = [" text1"," text2"," text3"," text4", " text5"], title = "Multi TextField Dialog",initial_contents =['watashi','ha','houdini','choto','dekiru'],buttons=["Accept","Cancel"]) #Dialog[0]-button, Dialog[1]-textfield if Dialog[0]==0: Namespace = Dialog[1]; sTextA = Namespace[0] sTextB = Namespace[1] sTextC = Namespace[2] sTextD = Namespace[3] sTextE = Namespace[4] sNewText = "{} {} {} {} {}".format(sTextA,sTextB,sTextC,sTextD,sTextE) hou.ui.displayMessage(sNewText, buttons=('OK','NO',))
List Selection ダイアログ
list = ["text1","text2","text3","text4"] Dialog = hou.ui.selectFromList(list, message='Select!!') if len(Dialog)!=0: for i in Dialog: hou.ui.displayMessage(list[i] , buttons=('OK','NO',))
Node Selectionダイアログ
oNode = hou.ui.selectNode() hou.ui.displayMessage(oNode, buttons=('OK','NO',))
File Selectionダイアログ
oFile = hou.ui.selectFile() hou.ui.displayMessage(oFile, buttons=('OK','NO',))
コメント