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
My problems here are, that I am not able to find a way to -
- extract the data given to
- 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.
Thanks in advance, to anybody who tries to help...