Erik_JE Posted January 12, 2010 Share Posted January 12, 2010 Im writing a python script for setting up an avalanche rig for a school project. I have created a subnetwork with a dop setup. To the first input of the subnetwork i connect a painted grid which specifies on what and where on an object the avalanche should start. Inside the subnetwork i have geometry nodes with various stuff in them. I connect the sub network input #1 to these nodes. To then inside the geometry nodes grab the geometry i use `opinputpath("/obj/subnetwork/geometry1",0)` in an object_merge node. Continuing to the problem that when the python script creates the subnetwork there is nothing connected to the subnetwork so it do not work. If i after i have added a grid as input forces updates of the values by disconnecting and connecting the geometry nodes the RBD setup works fine. So my question is: Is there a way to force an update of the opinputpath expression or another better way to solve my problem? Regards Erik Quote Link to comment Share on other sites More sharing options...
symek Posted January 12, 2010 Share Posted January 12, 2010 Im writing a python script for setting up an avalanche rig for a school project. I have created a subnetwork with a dop setup. To the first input of the subnetwork i connect a painted grid which specifies on what and where on an object the avalanche should start. Inside the subnetwork i have geometry nodes with various stuff in them. I connect the sub network input #1 to these nodes. To then inside the geometry nodes grab the geometry i use `opinputpath("/obj/subnetwork/geometry1",0)` in an object_merge node. Continuing to the problem that when the python script creates the subnetwork there is nothing connected to the subnetwork so it do not work. If i after i have added a grid as input forces updates of the values by disconnecting and connecting the geometry nodes the RBD setup works fine. So my question is: Is there a way to force an update of the opinputpath expression or another better way to solve my problem? Regards Erik Hi, Not sure if I understand your correctly, but if I'm right, you can instead of hard wiring subnet input to object merge sop, use parameter reference with chs(). Add spare parameter to a subnet that will point to your external object, then add chs() to an object_merge. Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 13, 2010 Author Share Posted January 13, 2010 Hi, Not sure if I understand your correctly, but if I'm right, you can instead of hard wiring subnet input to object merge sop, use parameter reference with chs(). Add spare parameter to a subnet that will point to your external object, then add chs() to an object_merge. Thanks for the response. I think you got what i meant even tho the explanation were not the best. I added chs() as objectmerge.parm("objpath1").set("`chs(opinputpath(\"" + mountain_geometry.path() + "\",0))`") and this seems to be almost working. It updates the path when connecting and seems to get the correct path /obj/grid_object1 but the object merge node screams "Bad parameter reference: "/obj/grid_object1"" Here is a code snippet with important parts of what i am doing subnetwork = root.createNode("subnet", "Subnetwork") inputs = subnetwork.indirectInputs() geometry.insertInput(0,inputs[0]) objectmerge.parm("objpath1").set("`chs(opinputpath(\"" + geometry.path() + "\",0))`") Quote Link to comment Share on other sites More sharing options...
symek Posted January 13, 2010 Share Posted January 13, 2010 could you provide simplified version of this asset? I think we're still in a fog here Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 13, 2010 Author Share Posted January 13, 2010 could you provide simplified version of this asset? I think we're still in a fog here I put it up on my page. Currently it is in a py file so we can run it with hython and code outside houdini but it will be moved into an shelf tool later. http://www.evegard.se/skola/avalancheCreate.py Haven't used Houdini or python too much so be gentle. Regards Erik Quote Link to comment Share on other sites More sharing options...
symek Posted January 13, 2010 Share Posted January 13, 2010 I put it up on my page. Currently it is in a py file so we can run it with hython and code outside houdini but it will be moved into an shelf tool later. http://www.evegard.s...lancheCreate.py Haven't used Houdini or python too much so be gentle. Regards Erik See the example. I added operator path on a subnet level, and referenced it inside object_merge. hth. ps I think you should avoid using object level inputs as a way of referencing geometry since it parents your object to another node (trans/rot/scale changes). It's technically possible, but conceptually misleading. ps2 is there any reason besides educational, you're doing it in a script, not in HDA? avalancheCreate.hip Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 13, 2010 Author Share Posted January 13, 2010 See the example. I added operator path on a subnet level, and referenced it inside object_merge. hth. ps I think you should avoid using object level inputs as a way of referencing geometry since it parents your object to another node (trans/rot/scale changes). It's technically possible, but conceptually misleading. ps2 is there any reason besides educational, you're doing it in a script, not in HDA? Ahh yes that is a good solution, I got a little too focused on the whole connecting nodes part. Thank you for the help ill go with that setup it updates perfectly when switching between different grids. There is no reason besides educational for doing it as script. The course is focused on developing for houdini and we have also coded SOPs and VOPs with HDK earlier. It could have been done alot easier rigging it up in houdini inside a HDA. Especially the whole rbd part and spare parameters for the node. 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.