Since 2.82 CurveMap has no 'evaluate' method anymore?

I use a shaderNodeRGBCurve in my add on to control some profiles. To read the curve i use something similiar to y=curve.evaluate(x)
this worked fine until 2.81, but since 2.82 i get an error message that " ‘CurveMap’ object has no attribute ‘evaluate’ "
Is there any fellow Blendercoder who can point me in the right direction? Does anyone have an idea what changed, or where to find some documentation on this?

I don’t know if that helps, but from looking at the documentation, there seems to be a CurveMapping object that calls evaluate with a curve as argument: So maybe somethig like curve_mapping.evaluate(curve, x) would work? No idea how to get this CurveMapping object though

1 Like

yes, thanks. the api changed (of course, hence the issue)
now the evaluate is as you said. and the curvemapping is the container which holds the different curves (for example the shadernodeRGBcurve has 4 curves for r,g,b, and composite)

so a small codesnippet that works in 2.82 would be for example:

import bpy‘myCurve’, ‘ShaderNodeTree’) #creating nodegroup as container[‘myCurve’] #call the nodegroup nt
cn =‘ShaderNodeRGBCurve’) #add a rgbcurve into the nodegroup
myCurveMapping =[‘myCurve’].nodes[0].mapping #the CurveMapping
myCurveMapping.initialize() #it needs to be initialized
curve = myCurveMapping.curves[3] #the Composite-Curve of the RGB Curves
print([‘myCurve’].nodes[0].mapping.evaluate(curve, 0.5)) #prints value

1 Like