Fix #141610: Nodes: Active selection points to internal toggle socket after running "Remove Item"
Panel toggles are implemented by having a boolean socket with `is_panel_toggle` set to `True`, as the first item in that panel's children. These sockets are then hidden from the user, as the checkbox gets drawn in the panel's UI. In specific circumstances described in the bug report, the active selection can sometimes land on these sockets. Leading to the user being able to directly access these internal sockets. The changes in the patch make the "Remove Item" operator check if the resulting selection lands in a toggle socket, and move the selection to that toggle's parent panel if that is the case. Pull Request: https://projects.blender.org/blender/blender/pulls/141859
This commit is contained in:
committed by
Jacques Lucke
parent
75dd3bc1e0
commit
5bb21bfa07
@@ -488,6 +488,11 @@ class NODE_OT_interface_item_remove(NodeInterfaceOperator, Operator):
|
||||
interface.remove(item)
|
||||
interface.active_index = min(interface.active_index, len(interface.items_tree) - 1)
|
||||
|
||||
# If the active selection lands on internal toggle socket, move selection to parent instead.
|
||||
new_active = interface.active
|
||||
if isinstance(new_active, bpy.types.NodeTreeInterfaceSocket) and new_active.is_panel_toggle:
|
||||
interface.active_index = new_active.parent.index
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user