godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

GraphEdit & GraphNode Enhance Proposal #593

Open nonunknown opened 4 years ago

nonunknown commented 4 years ago

Describe the project you are working on: A Plugin to create state machine through GE(GraphEdit) and GN(GraphNode)

Describe the problem or limitation you are having in your project:

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

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

Connections Limit

Actually the user can have multiple connections between nodes: Screenshot from 2020-03-17 08-55-58 To overcome this, the GN should have a max_connections property: maxconn

Customize CL (Connection Line)

The Lines (Represented by connections between nodes) could be customized to enable the user to set "Icons" or draw something at the (Most-Left,Middle,Most-Right) part of the line, represented by 3 sprites:

Actually: Screenshot from 2020-03-17 09-04-04

Customizable CL Example : custom1

Place the connection line anywhere in GN

Nowadays cross-connections are not so beauty: Screenshot from 2020-03-17 09-12-32

Simple solution? Connection Types (the use can now choose between NodeBased or StateBased (not cool suggestive names LOL). NodeBased its like the image shown above, and StateBased would be like the image below:

CL

If this enhancement will not be used often, can it be worked around with a few lines of script?: No. Cuz requires some refactoring into core GN and GE Classes.

Is there a reason why this should be core and not an add-on in the asset library?: Maybe some topics could be done with plugins, but others are essential.

YuriSizov commented 4 years ago
  1. Connection limit can be implemented in a more flexible way already using the connection_request event.
  2. More styling options are always welcome.
  3. I don't think that dots should be moved. There is a particular flow to the GraphEdit, where every node is connected from the left and outputs on the right. It's clear and straightforward. I agree on the loops being ugly, though. That should be fixed in some way. There is also #506 proposal, touching on dots.
TheDuriel commented 4 years ago

Being able to move dots would be highly valuable for tool development. Not every system can be represented going exclusively left to right.

Jummit commented 4 years ago

… the user can have multiple connections between nodes. To overcome this, the GN should have a max_connections property.

Why though? Are multiple connections bad in any way? You can also do this in code:

func connection_request(from: String, from_slot: int, to: String, to_slot: int)
  var existing_connections = 1
  for connection in get_connection_list():
    if connection.from == from:
      existing_connections += 1
  if existing_connections + 1 > MAX_CONNECTIONS:
    return
  # normal connection code

I also don't really see the use for customizing the connections, apart from using them to highlight the current executing line while debugging.

TheDuriel commented 4 years ago

Why though? Are multiple connections bad in any way?

It becomes visually impossible to identify order of operation, which may or may not be important. And sometimes branching is flat out not desired.

That said, connection limits are easily implemented on the user side during a connection request.

nonunknown commented 4 years ago

… the user can have multiple connections between nodes. To overcome this, the GN should have a max_connections property.

Why though? Are multiple connections bad in any way? You can also do this in code:

func connection_request(from: String, from_slot: int, to: String, to_slot: int)
  var existing_connections = 1
  for connection in get_connection_list():
    if connection.from == from:
      existing_connections += 1
  if existing_connections + 1 > MAX_CONNECTIONS:
    return
  # normal connection code

~I also don't really see the use for customizing the connections, apart from using them to highlight the current executing line while debugging.~

Line styling would be very useful, I didnt tought for debugging but something like, in my case to show from->to state and current state :D