promoting tool interfaces
13944 7 4- cargoyle
- Member
- 5 posts
- Joined: 2月 2010
- Offline
hello, I have been working on procedural applications for building forests and parks. my plan is to provide a host of trees and plants and then use particle scaling to determine the plant size. the bigger the scale the bigger the plant. I also plan to use the paint sop to affect the scale of the particles similar to the forest tutorial, but what I want to do is make the system into an otl and allow the user to paint the scale from the top level interface. I can promote all the attributes from the sop itself but I need a way to access the tool. I imagine I could get at it by writing a script if I could figure out what houdini is doing to access the tool and creating a button or something that will do that from the top, but I'm still kind of new to the software and I'm not sure where to look for this information. any help here would be awesome. thanks
- graham
- Member
- 1922 posts
- Joined: 11月 2006
- Offline
It's pretty straight forward to do but requires a couple things.
First off you need to make sure the Paint SOP is set as an editable node. This way you can have it function while still being inside the locked asset. Secondly all you really need to do to activate the paint state is to create a simple callback script that sets the node to be current and tells the scene viewer to enter the current node's state.
Here's an example of the script in the PythonModule that gets called by the button callback. The file with the actual asset is attached.
def paintIt(scriptargs):
sopnode = scriptargs
viewer = toolutils.sceneViewer()
paint_node = sopnode.node(“paint”)
paint_node.setCurrent(True, True)
viewer.enterCurrentNodeState()
First off you need to make sure the Paint SOP is set as an editable node. This way you can have it function while still being inside the locked asset. Secondly all you really need to do to activate the paint state is to create a simple callback script that sets the node to be current and tells the scene viewer to enter the current node's state.
Here's an example of the script in the PythonModule that gets called by the button callback. The file with the actual asset is attached.
def paintIt(scriptargs):
sopnode = scriptargs
viewer = toolutils.sceneViewer()
paint_node = sopnode.node(“paint”)
paint_node.setCurrent(True, True)
viewer.enterCurrentNodeState()
Graham Thompson, Technical Artist @ Rockstar Games
- Sixjames1000
- Member
- 52 posts
- Joined:
- Offline
yeah that works, yet there seems to be an inherent issue with this method.
Since the python module is modifying the paintSop, this seems not to work if the HDA is locked, which I guess is the usual case.
Any tricks on this front? Maybe unlocking-change-locking the HDA via the same python module ?
Any thoughts?
Since the python module is modifying the paintSop, this seems not to work if the HDA is locked, which I guess is the usual case.
Any tricks on this front? Maybe unlocking-change-locking the HDA via the same python module ?
Any thoughts?
- Sixjames1000
- Member
- 52 posts
- Joined:
- Offline
- Liquos
- Member
- 6 posts
- Joined: 9月 2012
- Offline
- omgeric
- Member
- 48 posts
- Joined: 2月 2013
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: 10月 2010
- Offline
you can do this by making your python script also lock the network panel when it dives (although I have not tested this as it has not been neccesary with my approach). My recommendation on these kinds of setups is to add two python modules to your digital asset:
- one that handles the dive into the paint node, which has a modified parameter interface to best suit the paint operation you are doing (for example, if you are making a scalar map, modify your paint node parameter interface to simply have a slider as the color… you can do this with any houdini native node by simply right clicking and choosing edit parameter interface)
- next, add a module to “exit” the paint state (which sets the focus to your parent digital asset outside of the network), and trigger this module from the modified paint node with a simple spare button that calls to the python module on the parent
using this method makes the paint action quite invisible to the user… I would also recommend (if you are using 13), to explore the stroke SOP, which has promotable brush strokes as params
hope this makes sense!
- one that handles the dive into the paint node, which has a modified parameter interface to best suit the paint operation you are doing (for example, if you are making a scalar map, modify your paint node parameter interface to simply have a slider as the color… you can do this with any houdini native node by simply right clicking and choosing edit parameter interface)
- next, add a module to “exit” the paint state (which sets the focus to your parent digital asset outside of the network), and trigger this module from the modified paint node with a simple spare button that calls to the python module on the parent
using this method makes the paint action quite invisible to the user… I would also recommend (if you are using 13), to explore the stroke SOP, which has promotable brush strokes as params
hope this makes sense!
-G
- Mihai Barbu
- Member
- 4 posts
- Joined: 12月 2017
- Offline
For those still struggling, check this attribute paint masterclass at 54:00 https://youtu.be/gAT8ueaKAvs?t=3243 [youtu.be]
-
- Quick Links