yesyes Posted January 19, 2016 Share Posted January 19, 2016 I know basic python scripting in houdini so this question is easy one. I have a shelf tool, when clicked runs a python code. I want that tool to ask for a number when clicked and use it in the script. basically, I want to select a node and click that shelf tool to ask for a number, when given that code should copy and paste (duplicate) that node the number of times which is entered. i know i will have to use copyNodeTo function in python, just want to know about getting user input. Thanks! Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted January 19, 2016 Share Posted January 19, 2016 res = hou.ui.readInput("Enter number:", buttons=("OK", "Cancel")) if res[0] == 0: print "You have entered ", res[1] http://www.sidefx.com/docs/houdini15.0/hom/hou/ui 3 Quote Link to comment Share on other sites More sharing options...
yesyes Posted January 20, 2016 Author Share Posted January 20, 2016 by using this code res = hou.ui.readInput("Enter number:", buttons=("OK", "Cancel")) geo = hou.node('obj/geo1') xax = res[1] times = int(xax) if res[0] == 0: for i in range(0,times): hou.copyNodesTo(geo, 'obj/') I am getting this error Quote Link to comment Share on other sites More sharing options...
Atom Posted January 20, 2016 Share Posted January 20, 2016 The help for copyNodesTo claims you need a sequence of nodes, have you tried a list? hou.copyNodesTo([geo],'obj/') Quote Link to comment Share on other sites More sharing options...
yesyes Posted January 20, 2016 Author Share Posted January 20, 2016 The help for copyNodesTo claims you need a sequence of nodes, have you tried a list? hou.copyNodesTo([geo],'obj/') now its giving the error on second argument Quote Link to comment Share on other sites More sharing options...
yesyes Posted January 20, 2016 Author Share Posted January 20, 2016 this code worked res = hou.ui.readInput("Enter number:", buttons=("OK", "Cancel")) geo = hou.node('obj/geo1') dst = hou.node('obj/') xax = res[1] times = int(xax) if res[0] == 0: for i in range(0,times): hou.copyNodesTo([geo],dst) Thanks for everyone's help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.