Nodegroup crash with custom nodes and sockets #115277

Closed
opened 2023-11-22 17:54:24 +01:00 by Ian Hsieh · 1 comment

System Information
Operating system: macOS 13.6 (Intel), Windows 11
Graphics card:

Blender Version
Broken: 4.0
Worked: 3.6

Short description of error
Creating a nodegroup from a custom node that uses custom sockets in the Shader Graph (ShaderNodeTree) crashes Blender.

Exact steps for others to reproduce the error
The 4.0 API release notes mentions that for the new NodeTree interface, "socket_type accepts only base socket type names". Is there any way around this, or are addons now required to use their own NodeTree?

Right now, if you create a custom node with custom sockets in the Shader Graph, and then try to make NodeGroup out of it, it crashes Blender.

Attached is a blend file that shows the problem (it crashes both on macOS and Windows for me). To reproduce:

  1. Open the attached blend file
  2. Run the script that's in the Text Editor. The code there is based on the custom_nodes.py example that comes with Blender.
  3. In the shader graph, go to the Add menu, CUSTOM->My Custom Node
  4. Right click on My Custom Node and click "Make Group"
  5. Blender should crash.

One thing I did notice is that if I manually create the node group and then create the nodes inside with all of the links, then it works as expected. So it sounds like it's something about the node.group_make operator that's failing.

The only ways I can see to workaround this:

  • create our own NodeTree
  • create our own custom node.group_make operator

I'm not fond of either option.

**System Information** Operating system: macOS 13.6 (Intel), Windows 11 Graphics card: **Blender Version** Broken: 4.0 Worked: 3.6 **Short description of error** Creating a nodegroup from a custom node that uses custom sockets in the Shader Graph (ShaderNodeTree) crashes Blender. **Exact steps for others to reproduce the error** The 4.0 API release notes mentions that for the new NodeTree interface, "socket_type accepts only base socket type names". Is there any way around this, or are addons now required to use their own NodeTree? Right now, if you create a custom node with custom sockets in the Shader Graph, and then try to make NodeGroup out of it, it crashes Blender. Attached is a blend file that shows the problem (it crashes both on macOS and Windows for me). To reproduce: 1. Open the attached blend file 2. Run the script that's in the Text Editor. The code there is based on the custom_nodes.py example that comes with Blender. 3. In the shader graph, go to the Add menu, CUSTOM->My Custom Node 4. Right click on My Custom Node and click "Make Group" 5. Blender should crash. One thing I did notice is that if I manually create the node group and then create the nodes inside with all of the links, then it works as expected. So it sounds like it's something about the node.group_make operator that's failing. The only ways I can see to workaround this: * create our own NodeTree * create our own custom node.group_make operator I'm not fond of either option.
Ian Hsieh added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-11-22 17:54:25 +01:00

Thank you for bringing this issue to our attention, @ianhsieh. I can confirm that Blender is indeed crashing when trying to create a node group from a custom node that uses custom sockets in the Shader Graph.

The call stack indicates that there is a problem within the node interface when attempting to refine from a custom socket:

>	blender.exe!rna_Node_refine(PointerRNA * ptr) Line 1333	C++
 	blender.exe!RNA_pointer_create(ID * id, StructRNA * type, void * data) Line 163	C++
 	blender.exe!pyrna_param_to_py(PointerRNA * ptr, PropertyRNA * prop, void * data) Line 6238	C++
 	blender.exe!bpy_class_call(bContext * C, PointerRNA * ptr, FunctionRNA * func, ParameterList * parms) Line 8652	C++
 	blender.exe!rna_NodeTreeInterfaceSocket_from_socket_custom(ID * id, bNodeTreeInterfaceSocket * interface_socket, const bNode * node, const bNodeSocket * socket) Line 245	C++
 	blender.exe!blender::bke::node_interface::add_interface_socket_from_node(bNodeTree & ntree, const bNode & from_node, const bNodeSocket & from_sock, const blender::StringRef socket_type, const blender::StringRef name) Line 1048	C++
 	blender.exe!blender::bke::node_interface::add_interface_socket_from_node(bNodeTree & ntree, const bNode & from_node, const bNodeSocket & from_sock) Line 287	C++
 	blender.exe!blender::ed::space_node::node_group_make_insert_selected(const bContext & C, bNodeTree & ntree, bNode * gnode, const blender::VectorSet<bNode *,blender::PythonProbingStrategy<1,0>,blender::DefaultHash<bNode *>,blender::DefaultEquality<bNode *>,blender::SimpleVectorSetSlot<bNode *>,blender::GuardedAllocator> & nodes_to_move) Line 1064	C++
 	blender.exe!blender::ed::space_node::node_group_make_from_nodes(const bContext & C, bNodeTree & ntree, const blender::VectorSet<bNode *,blender::PythonProbingStrategy<1,0>,blender::DefaultHash<bNode *>,blender::DefaultEquality<bNode *>,blender::SimpleVectorSetSlot<bNode *>,blender::GuardedAllocator> & nodes_to_group, const char * ntype, const char * ntreetype) Line 1229	C++
 	blender.exe!blender::ed::space_node::node_group_make_exec(bContext * C, wmOperator * op) Line 1248	C++
 	blender.exe!wm_operator_invoke(bContext * C, wmOperatorType * ot, const wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1562	C++
 	blender.exe!wm_operator_call_internal(bContext * C, wmOperatorType * ot, PointerRNA * properties, ReportList * reports, const wmOperatorCallContext context, const bool poll_only, const wmEvent * event) Line 1751	C++
 	blender.exe!WM_operator_name_call_ptr(bContext * C, wmOperatorType * ot, wmOperatorCallContext context, PointerRNA * properties, const wmEvent * event) Line 1800	C++
 	blender.exe!WM_operator_name_call_ptr_with_depends_on_cursor(bContext * C, wmOperatorType * ot, wmOperatorCallContext opcontext, PointerRNA * properties, const wmEvent * event, const char * drawstr) Line 1989	C++
 	blender.exe!ui_apply_but_funcs_after(bContext * C) Line 1047	C++
 	blender.exe!ui_popup_handler(bContext * C, const wmEvent * event, void * userdata) Line 11745	C++
 	blender.exe!wm_handler_ui_call(bContext * C, wmEventHandler_UI * handler, const wmEvent * event, const bool always_pass) Line 831	C++
 	blender.exe!wm_handlers_do_intern(bContext * C, wmWindow * win, wmEvent * event, ListBase * handlers) Line 3333	C++
 	blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 3450	C++
 	blender.exe!wm_event_do_handlers(bContext * C) Line 4077	C++
 	blender.exe!WM_main(bContext * C) Line 616	C++
 	blender.exe!main(int argc, const char * * __formal) Line 597	C++
 	[External Code]	

This indicates an issue at the Python C API level, possibly linked with how the new API handles custom socket types when creating node groups.

@JacquesLucke, (as the maintainer of nodes in Blender) does this issue ring a bell to you?

Thank you for bringing this issue to our attention, @ianhsieh. I can confirm that Blender is indeed crashing when trying to create a node group from a custom node that uses custom sockets in the Shader Graph. The call stack indicates that there is a problem within the node interface when attempting to refine from a custom socket: ``` > blender.exe!rna_Node_refine(PointerRNA * ptr) Line 1333 C++ blender.exe!RNA_pointer_create(ID * id, StructRNA * type, void * data) Line 163 C++ blender.exe!pyrna_param_to_py(PointerRNA * ptr, PropertyRNA * prop, void * data) Line 6238 C++ blender.exe!bpy_class_call(bContext * C, PointerRNA * ptr, FunctionRNA * func, ParameterList * parms) Line 8652 C++ blender.exe!rna_NodeTreeInterfaceSocket_from_socket_custom(ID * id, bNodeTreeInterfaceSocket * interface_socket, const bNode * node, const bNodeSocket * socket) Line 245 C++ blender.exe!blender::bke::node_interface::add_interface_socket_from_node(bNodeTree & ntree, const bNode & from_node, const bNodeSocket & from_sock, const blender::StringRef socket_type, const blender::StringRef name) Line 1048 C++ blender.exe!blender::bke::node_interface::add_interface_socket_from_node(bNodeTree & ntree, const bNode & from_node, const bNodeSocket & from_sock) Line 287 C++ blender.exe!blender::ed::space_node::node_group_make_insert_selected(const bContext & C, bNodeTree & ntree, bNode * gnode, const blender::VectorSet<bNode *,blender::PythonProbingStrategy<1,0>,blender::DefaultHash<bNode *>,blender::DefaultEquality<bNode *>,blender::SimpleVectorSetSlot<bNode *>,blender::GuardedAllocator> & nodes_to_move) Line 1064 C++ blender.exe!blender::ed::space_node::node_group_make_from_nodes(const bContext & C, bNodeTree & ntree, const blender::VectorSet<bNode *,blender::PythonProbingStrategy<1,0>,blender::DefaultHash<bNode *>,blender::DefaultEquality<bNode *>,blender::SimpleVectorSetSlot<bNode *>,blender::GuardedAllocator> & nodes_to_group, const char * ntype, const char * ntreetype) Line 1229 C++ blender.exe!blender::ed::space_node::node_group_make_exec(bContext * C, wmOperator * op) Line 1248 C++ blender.exe!wm_operator_invoke(bContext * C, wmOperatorType * ot, const wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1562 C++ blender.exe!wm_operator_call_internal(bContext * C, wmOperatorType * ot, PointerRNA * properties, ReportList * reports, const wmOperatorCallContext context, const bool poll_only, const wmEvent * event) Line 1751 C++ blender.exe!WM_operator_name_call_ptr(bContext * C, wmOperatorType * ot, wmOperatorCallContext context, PointerRNA * properties, const wmEvent * event) Line 1800 C++ blender.exe!WM_operator_name_call_ptr_with_depends_on_cursor(bContext * C, wmOperatorType * ot, wmOperatorCallContext opcontext, PointerRNA * properties, const wmEvent * event, const char * drawstr) Line 1989 C++ blender.exe!ui_apply_but_funcs_after(bContext * C) Line 1047 C++ blender.exe!ui_popup_handler(bContext * C, const wmEvent * event, void * userdata) Line 11745 C++ blender.exe!wm_handler_ui_call(bContext * C, wmEventHandler_UI * handler, const wmEvent * event, const bool always_pass) Line 831 C++ blender.exe!wm_handlers_do_intern(bContext * C, wmWindow * win, wmEvent * event, ListBase * handlers) Line 3333 C++ blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 3450 C++ blender.exe!wm_event_do_handlers(bContext * C) Line 4077 C++ blender.exe!WM_main(bContext * C) Line 616 C++ blender.exe!main(int argc, const char * * __formal) Line 597 C++ [External Code] ``` This indicates an issue at the Python C API level, possibly linked with how the new API handles custom socket types when creating node groups. @JacquesLucke, (as the maintainer of nodes in Blender) does this issue ring a bell to you?
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-11-24 12:47:11 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115277
No description provided.