Fix: Nodes: "Make Panel Toggle" can turn Boolean output sockets into panel toggles

The "Make Panel Toggle" operator does not check if active item is an input socket,
leading to a situation where it can be called on Boolean output sockets.

Doing this creates weird behavior where the panel and associated
operators believe it has a toggle, but is not reflected in the UI drawing.

Other weird behaviors include being able to rearrange output sockets
and apply the operator again to another output socket.

This patch adds a check in the operator's poll function to prevent it
from being called on output sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/137526
This commit is contained in:
quackarooni
2025-04-15 15:26:44 +02:00
committed by Jacques Lucke
parent 411d4204f6
commit d3639828f8

View File

@@ -463,9 +463,11 @@ class NODE_OT_interface_item_make_panel_toggle(NodeInterfaceOperator, Operator):
active_item = interface.active
if not active_item:
return False
if type(active_item) is not bpy.types.NodeTreeInterfaceSocketBool:
cls.poll_message_set("Only boolean sockets are supported")
if type(active_item) is not bpy.types.NodeTreeInterfaceSocketBool or active_item.in_out != 'INPUT':
cls.poll_message_set("Only boolean input sockets are supported")
return False
parent_panel = active_item.parent
if parent_panel.parent is None:
cls.poll_message_set("Socket must be in a panel")