[BUG] Cannot create Groups if there are links going in or out of the new Group.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
**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: :-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: :-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: :-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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.