How can we implement a CurveMapping widget in a script using python api?

Hi guys,

How do we implement a CurveMapping widget (similar to RGB curves) in our own scripts using the python API to remap a range of values?

Hi @jacqueslucke,

Could you share some insight on this?

Unfortunately, you can’t do that without any hacks. At least you could not a couple of years ago when I looked into this the last time.

Since this was an important feature for Animation Nodes, it is implemented using a well contained hack. It is creating a material with nodes and “steals” the curve widget from there. The source code for that hack is here: https://github.com/JacquesLucke/animation_nodes/blob/master/animation_nodes/nodes/interpolation/from_curve.py.

1 Like

Thank you, Jacques, for your quick response!

I will tinker with your code and try to wrap my head around this.

Out of curiosity, is there any plans to make this available through the API sometime in the future without the need for any hacks?

@jacqueslucke

There are no immediate plans to support that afaik. However, I think that we will get it eventually. I’m not aware of any fundamental reason for why this should not be possible.

1 Like