Add helper function to node_utils to create links to virtual sockets #105975
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105975
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "pioverfour/blender:dp_node_utils_virtual_sockets"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Links created through the normal Python API are invalid since
7026096099
. Before then, one could create links to or from virtualsockets from Python (grayed out sockets in Group Input and Group
Output nodes), as is still possible in the GUI.
This is documented as an API change, and it broke at least Node
Wrangler, see blender/blender-addons#104470. Instead of just fixing that, let's introduce an
API to make this operation simpler.
This is what now happens with the normal API:
WIP: Add helper function to node_utils to create links to virtual socketsto Add helper function to node_utils to create links to virtual sockets@HooglyBoogly I’m assigning the review to you since it’s a followup to
7026096099
and we briefly discussed it in blender/blender-addons#104470, but feel free to assign to someone else.Come to think of it, maybe this can still go into 3.5 so that scripters could fix their scripts more easily in this version?
Why not just have a utility to connect any 2 sockets?
That’s exactly what this does! If both sockets are regular ones, it just connects them, but it creates actual sockets if one or more is virtual.
Then maybe just
connect_socket
?e349c77b50
to8c66579a8d
connect_sockets
sounds good. I improved the docstring to make it clearer why one may want to use this.Also added print messages in some unsupported cases.
8c66579a8d
to56036448bc
56036448bc
to996e415bbc
This looks reasonable, thanks for looking into it. Is it typical for functions like this to use
print(
for errors? That surprised me a bit.I don’t think it’s typical, but raising an error is too harsh, and failing silently, probably not enough. This is really for Python scripters and not for end-users.
In fact in a previous version there were exceptions, but I’d like this function to be a replacement for the native
links.new()
, which does handle some weird cases and fails silently in others.Both Bastien and Campbell have used a few prints to report errors in
bpy.utils
andbpy_extras
, that’s authority enough for me!Hi, do you think this can be merged?
Ah, indeed! Sorry I forgot about this one!
@ -8,0 +22,4 @@
if input.is_output and not output.is_output:
input, output = output, input
input_node = output.node
Probably it worth to mention that performance of the function is
O(len(node_group.nodes))
because you calloutput.node
. Also in some casesoutput.node
can return None.