Fix: Nodes: bad ui for adding panel toggles
Adding panel toggles in nodegroups have somewhat of a UX antipattern. When running the operator, it checks for conditions that indicate it should not run, and if those are hit, it cancels execution and mentions the invalid condition in the footer bar. This is not ideal, the user should not have to call the operator to find out whether it can be called. Why it got implemented like this is likely a consequence of all interface items being the same "New Item" operator. Poll functions cannot use operator properties, so variants of the same operator cannot check for different conditions for execution. This is a problem for panel toggles, as they have more restrictions to when they can be added that don't apply to other interface items. This patch creates a separate operator for adding panel toggles. This allows the condition checks to be implemented in the poll function, which enables greying out the operator buttons and showing on tooltips what condition is invalid. Pull Request: https://projects.blender.org/blender/blender/pulls/146379
This commit is contained in:
committed by
Jacques Lucke
parent
a1fde8bed8
commit
ce88d773db
@@ -57,7 +57,7 @@ void node_tree_interface_draw(bContext &C, uiLayout &layout, bNodeTree &tree)
|
||||
|
||||
uiLayout &col = row.column(true);
|
||||
col.enabled_set(ID_IS_EDITABLE(&tree.id));
|
||||
col.op_menu_enum(&C, "node.interface_item_new", "item_type", "", ICON_ADD);
|
||||
col.menu("NODE_MT_node_tree_interface_new_item", "", ICON_ADD);
|
||||
col.op("node.interface_item_remove", "", ICON_REMOVE);
|
||||
col.separator();
|
||||
col.menu("NODE_MT_node_tree_interface_context_menu", "", ICON_DOWNARROW_HLT);
|
||||
|
||||
Reference in New Issue
Block a user