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

Make GraphNode/GraphEdit more flexible for drawing vertex containers and curves. #2840

Open
willnationsdev opened this issue Jun 7, 2021 · 0 comments

Comments

@willnationsdev
Copy link
Contributor

willnationsdev commented Jun 7, 2021

Describe the project you are working on

Simulation game with skill trees.

Describe the problem or limitation you are having in your project

I want to be able to use a texture to define the shape of a GUI Container, store other information inside of it (textures/text/etc.), and then state that it should be connected to other similar GUI elements. How the connection is drawn should be something I can configure from each side of the arc (draw to center or a specific "pin" position on the outer edge). See below image for an example of different container shapes each drawing an arc between the center positions of "nodes" (from Shadowgun Legends, link):

sfed2ky7h0c31

It would be especially useful if the drawing of arcs had an automated default, but could be selectively overridden with a curve gizmo to bend the angle and strength of each arc endpoint, to be saved by the arc-drawing system.

Also, giving users more control over how the connection textures themselves are actually drawn, e.g. with a shader to create dynamic light effects connecting them.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

As far as I know, GraphEdit and GraphNode already handle the vast majority of the features related to this: you can manage the drawing of arcs between pinned positions of Containers.

Missing elements are simply...

  1. Customization of GraphNode Container's actual shape.
  2. Customization of pin placement strategy. Currently hardcoded to specific pinned locations on the left/right side. Could have EditorPlugin to add/delete/drag-and-drop pin positions along the outer edge of Container's shape or use script code to assign a calculated position based on radial coordinates.
  3. Allow toggling whether the pin is actually drawn or not (maybe use pins to determine where arcs connect but don't show the pin on the texture).
  4. Customization of GraphEdit's arc endpoint drawing strategy with gizmo for easier handling (thinking like Inkscape's curve controls and the like).
  5. Customization of GraphEdit texture used to draw arcs.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

  1. Update GraphNode to allow custom drawing of wrapper texture rather than just using a box all the time.
  2. Update GraphNode to allow more flexible drawing of pin positions and their show/hide status.
  3. Update GraphEdit to take into account the new flexibility of GraphNode pin positions when drawing arcs.
  4. Update GraphEdit to allow fine-tuned control of how curves are drawn on an endpoint-by-endpoint basis.
  5. Update GraphEdit to allow customization of arc draw texture with shader support.
  6. Provide an EditorPlugin with a curve editing gizmo for GraphEdit's inter-GraphNode connection arcs.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I think a great many games and tools expect to be able to create "graphs" in the user interface and they are non-trivial to implement. UML diagrams, skill trees, overview maps that show links between points, abstract games that are all about forming connections between points (e.g. train station sim), etc.

Is there a reason why this should be core and not an add-on in the asset library?

Technically, this could absolutely be done with a third-party addon, so it isn't necessarily something that needs to go in core. However, given that Godot already provides a GUI toolkit that very closely approximates these features, it seems strange to me that we wouldn't add a slight bit of customization and flexibility to it to expand the possibilities for what addons can do without forcing them all to start from scratch.

Godot itself doesn't need to provide the fancy graphs people can see in games, but it should provide the basic building blocks that allow them to construct such a thing more quickly. And it is there already, but it is strictly geared towards creating visual scripting graphs. A little tweaking could greatly expand its usefulness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants