Annon Posted March 17, 2014 Share Posted March 17, 2014 Urghh, scripting is not my strong suit... I'm trying to set some parameters on creation, I can do them after creation, but can't initialize them straight away, this is what I currently have, which works if I just call force(), but not calling it on creation. def force(): hou.pwd().cook(True) hou.pwd().parm("name1").set("density") hou.pwd().parm("name2").set("temperature") With an "oncreated" handler with this in it: kwargs['node'].hdaModule().force() #stuck Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted March 17, 2014 Share Posted March 17, 2014 (edited) Try to pass kwargs['node'] also to fucnction and replace hou.pwd() with this passed parameter. Edited March 17, 2014 by mantragora Quote Link to comment Share on other sites More sharing options...
Annon Posted March 17, 2014 Author Share Posted March 17, 2014 Thanks, that didn't seem to work. I've now just disabled everything by default making the user initialize the node to get the right settings, instead of setting a default on creation. If anyone can see away around this I'd love to know though. Thanks Christian Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted March 17, 2014 Share Posted March 17, 2014 Is this is what you want? example.otl Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted March 17, 2014 Share Posted March 17, 2014 Another thing you may do is to supply node creation scripts in your $HOME/HoudiniX.XXX/scripts/ folder.For example, if you want to have groupSOP always to start with $OS expression in group name field, you can create in this scripts directory $HOME/HoudiniX.XXX/scripts/sop/group.py and the in this file set it by writing kwargs['node'].parm('crname').set('$OS') Quote Link to comment Share on other sites More sharing options...
edward Posted March 18, 2014 Share Posted March 18, 2014 To be absolutely safe, you need to: - Set the multiparm to the number of instances that you want - Then *evaluate* the parameter to force it to create the instances - Now the multiparm instances should exist - Call cook() last, although I'm not sure why you need it. Quote Link to comment Share on other sites More sharing options...
Annon Posted March 21, 2014 Author Share Posted March 21, 2014 Ok thanks guys, I got around this particular issue but not in a scripty way I am hitting the same issue somewhere else though. So I am creating some children nodes on creation, which works fine and I'm using node.layoutChildren() etc to try to give them a good place to create them. But ideally what I'd like to do is get the position of the node and move them exactly where I want, but you can't get the position until the node exists etc so it just returns [0, 0]. Is there a way of getting around this, or am I to just live with it? Quote Link to comment Share on other sites More sharing options...
edward Posted March 22, 2014 Share Posted March 22, 2014 I'm not sure I understand. If you can create the children enough to call layoutChildren(), then you should be able to move the nodes? 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.