Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved support for conditional enabling of nodes #6064

Merged
merged 5 commits into from
Oct 3, 2024

Commits on Oct 3, 2024

  1. Configuration menu
    Copy the full SHA
    cb5edc7 View commit details
    Browse the repository at this point in the history
  2. StandardNodeGadget : Add colour coding for strike-throughs

    Black for nodes that are always disabled. Yellow for nodes that are disabled but in a potentiall context-sensitive way.
    johnhaddon committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    0035f65 View commit details
    Browse the repository at this point in the history
  3. GraphGadget : Move <kbd>D</kbd> shortcut handler to GraphEditor

    This consolidates it into the same file that creates the equivalent popup menu item, and will allow us to modify the behaviour for both shortcut and menu in a future commit. It also fixes a couple of small bugs as documented in Changes.md.
    johnhaddon committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    7bbc641 View commit details
    Browse the repository at this point in the history
  4. StandardNodeGadget/GraphEditor : Support PatternMatch enablers

    I'm not a huge fan of this, which is why I've split it into a separate commit from the rest. It's needed to integrate a custom "ContextEnabledEditScope" concept with Gaffer's new ContextTracker workflow. I'm not a huge fan of the concept, because it encourages serial chains of nodes, where often only one is enabled in a given context. This could often be more efficiently - and readably - represented by multiple input branches to a NameSwitch. And there are many different potential "procedural node enablers" and we might want to apply them to any node type. So just combining a PatternMatch (say) with an EditScope on an ad-hoc basis is more flexible than a fixed ContextEnabledEditScope. Nevertheless, the idea has caught on in certain circles, and we need to do our best to support it.
    
    The existing custom "ContextEnabledEditScope" operates with an additional internal switch which bypasses the processing for the node when the context doesn't match. But Gaffer can't reason about this bypass at all because it doesn't use the standard `Node.enabled` plug. So such nodes do not display a strike-through in the GraphEditor, and don't show as disabled in the EditScope menu either. So, the plan is to replace the internal switch with an internal PatternMatch node, driving the `enabled` plug directly. With this, Gaffer already correctly displays the strike-through when the node is disabled due to context. But we need some additional special cases to improve the useability, and that is what this commit does :
    
    - StandardNodeGadget : Add additional support for recognising when a node is disabled statically rather than dynamically. This consists of recognising the case where the `enabled` plug is driven by a node such a PatternMatch, and representing the node as statically disabled when the PatternMatch itself is disabled.
    - GraphEditor : Add support for enabling/disabling the driving node when the `enabled` plug has an input connection.
    
    With this, the custom ContextEnabledEditScope has the following behaviour :
    
    - When it is disabled due to the context not matching, it is drawn with a yellow "context sensitive" strike-through.
    - In that state, the user may press "D", which will disable the connected PatternMatch node, turning the strike-through black - denoting "always disabled". Pressing "D" again will return to the yellow strike-through by enabling the PatternMatch node again.
    - When the node is enabled due to the context matching is displays as usual. And "D" will again give it a black strike-through by disabling the PatternMatch node.
    johnhaddon committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    65ed498 View commit details
    Browse the repository at this point in the history
  5. PatternMatchUI : Tweak graph editor UI

    Bringing it into line with other AuxiliaryNodeGadget setups.
    johnhaddon committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    91f02c8 View commit details
    Browse the repository at this point in the history