Page MenuHome

ShaderNodeCustomGroup insert_link is not listening to inserts
Closed, ResolvedPublic

Description

System Information
Operating system: Windows 8 64 bit
Graphics card: notebook integrated, render with CPU

Blender Version
Broken: 2.8. cc5bdf029324
Worked: worked in 2.8 with NodeCustomGroup

Short description of error
The new ShaderNodeCustomGroup seems to inherit all methods of the old NodeCustomGroup but insert_link doesn't seem to be working properlty unless I have bugs in my code

Exact steps for others to reproduce the error

  1. run the script, you will see the new node pop up
  2. note that in the script, the insert_link function is defined:
insert_link(self, link):
    print("insert_link reporting")
    return
  1. try linking any input/output of the custom node
  2. there's no printing to console{F6837513}

Event Timeline

To respond to new link events you need to use the update() and check if there's any changes in your existent sockets.

The insert_link() is used internally to add and verify if links are valid (for example if an input socket has more than 1 link, etc). Not to respond to link changes.

I'll probably hide this function from the api, as it has little meaning for Shader and Compositor Nodetrees... You need a NodeLink struct to call the function, and the api doesn't let you create NodeLinks independently, except when calling new() from a NodeLink Collection (which then makes the insert_link() desnecessary because the link is already in the collection..).

Sergey (sergey1994_m) claimed this task.EditedMar 17 2019, 11:51 AM

So, how do I use it? update() takes no arguments... how can I determine which socket was affected and where the link was created? to check for new changes, you have to keep the old state in some form or? the only thing I can think of... IFF the function update() function runs automatically on update, one could check the last link in the node_tree and so on... but honestly, that's just not serious:( plus there's even no documentation on it.

please, gentlemen, I don't understand the approach. insert_link() worked just f i n e for my purposes in bpy.types.CustomNodeGroup. now it stopped working - that's an obvious bug... why not simply get it back? how do you even use update()? it does not take a single argument. to handle an event, you gotta have the event passed as argument...