I am wondering if there is any way to define a texture using python. For example, imagine that I have a python function that takes co-ordinates as an input, does some calculation, and returns a colour or a value. Is there a way to use that function as a texture?
The reason I ask is, I was thinking that it would be nice to have a way to use python scripts as nodes in the material nodes editor. Then I realised that all I would have to do is write a texture plugin that does nothing except call a specified python script.
Well, it’s a bit tricky because I don’t remember how to call python functions from C, so I don’t want to write it if there’s another way to do it. But otherwise I’ll write the plugin. The idea is to have the plugin simply as a wrapper for a python script. The user supplies a python script that takes co-ordinates and defines patterns or whatever with them, rather than writing a separate plugin for each pattern. Suppose I have a one-line python function that says return_value =sin(x). Instead of writing a plugin in C just to do that, I take my generic plugin, give it the name of my python file, and I’m done.