Skip to content

Add more flexibility around a Node's Socket layout #32

@mitchmindtree

Description

@mitchmindtree

Currently we can pick the Direction in which sockets flow which is useful, however the user has no real control over how the sockets are laid out along the edge. The current behaviour is to just evenly space the sockets where each socket is:

  • Sized via ui.spacing().interact_size.x.min(ui.spacing().interact_size.y)
  • Spaced via ui.spacing().item_spacing.x.min(ui.spacing().item_spacing.y)

Ideally, the user can totally customize how they want their sockets laid out, how they're rendered, etc.

Layout

Ideally, they can build up this layout as they layout the custom user content. This would make it easier to say "there's an Input socket aligned with the widget with this id", or "there's both an input and output socket aligned here", etc.

We should also provide higher-level common layouts (like tabular node layout) where input and output socket positioning can be inferred more easily and the user doesn't have to manually specify all the alignment. I'll open up a follow-up issue for this.

We should return the socket Responses so that users can optionally use the on_hover_ui convenience method for drawing custom hints when the socket is hovered by the pointer (or it its within socket_radius).

Rendering

We should provide some function that provides a painter and allows the user to render the socket however they like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions