David Grzesik
FortifiedOatMilk
About Me
専門知識
VFX Artist
業界:
Advertising / Motion Graphics
Connect
LOCATION
Not Specified
ウェブサイト
Houdini Engine
Availability
Not Specified
Recent Forum Posts
How to expand variables like $HFS to actual absolute paths? 2024年7月24日17:10
I'm not sure if it would work, but possibly expand it through a python expression? Something like hou.expandString('$HFS') docs [www.sidefx.com].
You could also just put the whole file path in there if you have multiple variables and it will then return the whole path string for you.
You could also just put the whole file path in there if you have multiple variables and it will then return the whole path string for you.
Add new item to Ordered Menu via Python 2024年7月9日18:22
A word to the wise here, using node.type().definition().setParmTemplateGroup(ptg) will update that menu item for each instance of that hda so they will all receive this menu change as it is updating the definition's menu parm template. If that's what you want, then cool and perfect.
If you want it differing per instance of your hda, you can definitely add it as spare parms, but I don't like them living separately from the hda's parameter interface as you would have to manually add them after the node is created or add them to your node with your "OnCreated" script callback. Both leave them open to being tweaked or deleted or forgotten about.
I think a better way of doing all of this while keeping the updates unique to each individual instance of the node would be to use the node's User Data [www.sidefx.com]. For example, use this as your menu script:
And in your Scripts>Python Module, add something like this:
Then in your parameter interface just get a button and 2 string parms like Viklc has.
Add this callback script to the button:
And when you pres your button it should add into that menu. I didn't use this exact code, adapting it from something else I have written so I havent tested this example, but you get the gist.
I did run into the issue when writing an item the menu doesn't automatically update, you kinda have to poke it to make it refresh. I would put a little callback whenever the menu should update where I would go:
Just to force it to set itself to its current value. This solved my issues. A little annoying to have to spread this code into multiple locations, but it's possible and works pretty well, so Im happy.
Hope this helps!
If you want it differing per instance of your hda, you can definitely add it as spare parms, but I don't like them living separately from the hda's parameter interface as you would have to manually add them after the node is created or add them to your node with your "OnCreated" script callback. Both leave them open to being tweaked or deleted or forgotten about.
I think a better way of doing all of this while keeping the updates unique to each individual instance of the node would be to use the node's User Data [www.sidefx.com]. For example, use this as your menu script:
hou.phm().readItems(kwargs)
import json def readItems(kwargs): node = kwargs['node'] info = json.loads(kwargs['node'].userData('Menu1Data')) menu = [] for i in range(len(info['labels'])): menu.append(info['items'][i]) menu.append(info['labels'][i]) return menu def writeItem(kwargs,item,label): info = json.loads(kwargs['node'].userData('Menu1Data')) if info == '': info == {'labels':[],'items':[]} info['labels'].append(str(label)) info['items'].append(str(item)) kwargs['node'].setUserData('Menu1Data',json.dumps(info))
Add this callback script to the button:
hou.phm().writeItem(kwargs,kwargs['node'].parm('itemString').evalAsString(),kwargs['node'].parm('labelString').evalAsString())
I did run into the issue when writing an item the menu doesn't automatically update, you kinda have to poke it to make it refresh. I would put a little callback whenever the menu should update where I would go:
kwargs['node'].parm('menu').set(kwargs['node'].parm('menu').eval())
Hope this helps!
Karma Toon Shader 2024年5月15日21:58
Just bumping this, I absolutely want to use Karma and LOPs for rendering some projects but unable to work out just how to get karma to do what I want. Was thinking of baking a simple diffuse shader into a texture and sample that in the shader. It's effectively what I would do for a toon shader in say Blender to then use to create banding, but its not exactly realistic as a scene gets anything other than small. Im going to keep looking, but wish I knew more about shading :S