|
Hi,
I want to get the value of an attribute. How do I get that? I can’t find anything on it.
|
|
|
|
In the MEl input field, for example:
getAttr polySurface1.tx;
my MEL knowledge is very rusty, so won’t say more…
|
|
|
|
I was talking about the C++ version :)
I’m looking up the MFnAttribute of the shader node, like so:
// Custom Hardware Shader found!
if(srcnode.hasFn(MFn::kPluginHwShaderNode))
{
MFnDependencyNode shader(srcnode)
MFnTypedAttribute typedAttr(shader.attribute("s"))
// ... etc
However, I can’t seem to find the functions to get the VALUE of the attribute. It does find it, but what I need is the file name of a custom hardware shader that the user added. I can’t seem to find the function that I need.
|
|
|
|
Who makes this crap up?
MFnDependencyNode shader(srcnode)
MPlug shaderplug(srcnode, shader.attribute("s"))
MString shaderstring;
shaderplug.getValue(shaderstring)
So for everyone else getting suicidal over the API:
1. Create a dependency node from your node that you’re traversing.
2. Create a “plug” (seriously guys… what the hell)
3. Plug the “plug” “into” the node and the attribute you got out of the dependency node…
4. Get the value from the “plug”
REALLY? What ever happened to: shader.attribute("s").getValue(outString)
|
|
|