I am trying to create a custom node of my own, where I get the input from node sockets, process it (all in code, without involving node groups) and put that processed data to an output node socket to be further used in the Shader Editor (Much like the inbuilt nodes work - musgrave, voronoi, noise etc.)

As of my first attempt to create a node using python, I want to create and Inverter node, which clamps all the value it gets from input socket between 0 and 1, then subtracts them form 1 and give the result as the output.

class MyCustomNode(Node):
    bl_idname = 'CustomNodeType'
    bl_label = "Inverter"

    def init(self, context):
        self.inputSocket = self.inputs.new('NodeSocketFloat', 'Input')
        self.outputSocket = self.outputs.new('NodeSocketFloat', 'Output')

This much I was able to figure out, but because of lack of proper documentation, I was not able to go any further...

I created two node sockets, one for input and another one for output, and stored them in inputSocket and outputSocket

My problems here are, that I am not able to find a way to -

  • extract the data given to inputSocket
  • process that input data (since I can't get it in the first place)
  • pass that processed data to outputSocket (if I were able to process it, but that's not the case)

I posted the same thing on r/blenderhelp subreddit and didn't got one single reply...

Please if anybody can help me out, I would be more than grateful

Even if you have no idea about the solution, but happen to know some place where I can get answers, please direct me there. I have already wasted more than 3 days sweeping out the internet about this topic, and trying different things on own.

This is how the situation looks like

Thanks in advance, to anybody who tries to help...


I got to know the answer from one of the Chief Software Architect at Blender

If anybody, like me, is stuck trying to figure this out, and find this thread. The answer is NO, you cannot do it using python API.

Instead, you need to go for either node groups or OSL...



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.