I am basically making a ramp shader and trying to find the proper way to get values from a ramp attribute in the compute()
function for a node.
I know it can be done with
MObject oThis = thisMObject();
MRampAttribute rampAttribute(oThis, aRamp); // aRamp is our ramp MObject.
but is it safe to do this in compute
?
The Maya documentation mentions in a few places that, in compute
, we should only use attributes in the MDataBlock
to get input data, but I can't find a way to get a ramp attribute from the MDataBlock
. I couldn't find any official code samples using MRampAttribute
in compute()
either.
Its fine to do this. I don't think you can access MRampAttribute from the data block. I have some plugins nodes that use it exactly as you wrote and I've not noticed any problem.
It's not the only occasion where you need to use the MObject to get a plug in compute() either.