Sorcar icon indicating copy to clipboard operation
Sorcar copied to clipboard

[BUG] Cannot create Groups if there are links going in or out of the new Group.

Open josephbburg opened this issue 3 years ago • 5 comments

Describe the bug Creating Node Groups doesn't work in Blender 3.0.0+

To Reproduce Create a few Sorcar nodes and connect them together in a sensible way. (I used a Bool node and an If-Else node and some other node.) Try and create a group with some links going in or out. Notice how the node groups cannot create links for sockets created by Sorcar, but it seems socket classes from the bpy.types built-ins work just fine. Try a few different kinds of links.

Expected behavior The node group is created and linked.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Manjaro GNU/Linux
  • Blender Version 3.0
  • Sorcar Version master branch hash: 650cb6585c3f8a92af029ae7f5c2d7453e9459ef

Additional context Terminal output:

Error: Python: Traceback (most recent call last):
  File "/home/joseph/.config/blender/3.0/scripts/addons/Sorcar-master/operators/ScGroupNodes.py", line 97, in execute
    node_tree.links.new(group_node.outputs[i], link.to_node.inputs[link.to_socket.name])
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

location: <unknown location>:-1


Error: Python: Traceback (most recent call last):
  File "/home/joseph/.config/blender/3.0/scripts/addons/Sorc
[sorcar_bug.blend.zip](https://github.com/aachman98/Sorcar/files/7841231/sorcar_bug.blend.zip)
ar-master/operators/ScGroupNodes.py", line 94, in execute
    node_tree.links.new(link.from_node.outputs[link.from_socket.name], group_node.inputs[i])
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

location: <unknown location>:-1


Error: Python: Traceback (most recent call last):
  File "/home/joseph/.config/blender/3.0/scripts/addons/Sorcar-master/operators/ScGroupNodes.py", line 94, in execute
    node_tree.links.new(link.from_node.outputs[link.from_socket.name], group_node.inputs[i])
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

location: <unknown location>:-1

File Attached.

My guess is that the Blender devs added a well-meaning poll function to the builtin Group node... but it breaks Sorcar, and since my addon is using your wonderful Create Group operator as a template, mine is broken, too! Anyhow I think the solution is to create your own custom NodeGroupIn or Out nodes, or find a way to overwrite the builtin nodes poll() method.

I don't use Sorcar myself, but since I am borrowing your code, I wanted to pass this on. I'll try to keep you updated with my own solution to the problem.

josephbburg avatar Jan 10 '22 18:01 josephbburg

sorcar_bug.blend.zip Oops, here is the .blend file.

josephbburg avatar Jan 10 '22 18:01 josephbburg

Investigating the bug here

josephbburg avatar Jan 10 '22 19:01 josephbburg

Bug report: https://developer.blender.org/T94827 I will look into making a workaround now

josephbburg avatar Jan 11 '22 19:01 josephbburg

Fixed on Blender's side by https://developer.blender.org/D13817

josephbburg avatar Jan 12 '22 16:01 josephbburg

The fix has been accepted. https://developer.blender.org/rB85df7036f76b87102466079cc46c2bbfb9b17d9c Please note that 2.93.7 and 3.0 will still have this bug!

josephbburg avatar Jan 14 '22 15:01 josephbburg