Feedback

What's your question?

By: Asked

Make compound attributes visible in the Hypershade swatch

Hello,

In some shaders, I want to create a RGBA output (it is for an external renderer which doesn't support multiple outputs). So I want a compound attribute named output with 4 elements : cr, cg, cb, and ca.

For now, I just want a compound output attribute named "output", with only one component : "alpha".

Here is what I did :

MFnNumericAttribute nAttr;
MFnCompoundAttribute    cAttr;

aOutAlpha = nAttr.create("ca", "ca", MFnNumericData::kFloat);
aOutput = cAttr.create("output", "out");
cAttr.addChild(aOutAlpha);
cAttr.setHidden(false);
cAttr.setReadable(true);
cAttr.setWritable(false);

addAttribute(aOutAlpha);
addAttribute(aOutput);

attributeAffects(aOutAlpha, aOutput);

I didn't report here the input stuff.

The outputs appear as they should in the connection editor, but when I click in the triangle in the swatch's bottom-right corner, there is no output.

Add comment viewed 171 times Latest activity 7 months ago

or Cancel

1 answer

  • 0

julian [ Admin ]

This might be wrong , or useless - (I'll test later)

MFnAttribute::setUsedAsColor (bool state )

Sets whether this attribute should be presented as a color in the UI.

NN comments
oodini
-

This flag is by default set to false. And it used for attribute editor.

Thanks anyway.

or Cancel