Hello Tech Artists!
First off, I would like to thank the community for keeping up such a great site, especially one that has contributed to my studies as a Tech Artist. :):
I have a question about the “add new item” button that occurs with attributes of type array in the Maya API.
How can I achieve this button?
I am creatiing an MFnNumericAttribute of type array as such in the initialize function:
MStatus BumpyNode::initialize()
{
MStatus status;
MFnNumericAttribute numFn; mainTexture = numFn.create("mainTexture", "mainTexture", MFnNumericData::kFloat); numFn.setWritable(true); numFn.setKeyable(true); numFn.setStorable(true); numFn.setChannelBox(false); addAttribute(mainTexture);
inputTextures = numFn.create("inputTextures", "inputTextures", MFnNumericData::kFloat); numFn.setWritable(true); numFn.setKeyable(true); numFn.setStorable(true); numFn.setChannelBox(false); numFn.setArray(true); addAttribute(inputTextures); blendValues = numFn.create("blendValues", "blendValues", MFnNumericData::kFloat); numFn.setArray(true); numFn.setKeyable(true); numFn.setConnectable(false); numFn.setUsesArrayDataBuilder(true); addAttribute(blendValues);
outputNormalValue = numFn.create("outputNormalValue", "outNormal", MFnNumericData::kFloat); addAttribute(outputNormalValue);
attributeAffects(mainTexture, outputNormalValue); attributeAffects(inputTextures, outputNormalValue); attributeAffects(blendValues, outputNormalValue);
return MS::kSuccess;
}
I am using the ArrayDataBuilder to create elements inside of my compute function, but I would like the user to be able to create an array value at runtime.
This is my output:
Thanks for reading!