godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 93 forks source link

Allow to display custom controls on `GraphEdit`'s minimap #2510

Open Daylily-Zeleen opened 3 years ago

Daylily-Zeleen commented 3 years ago

Describe the project you are working on

Now I constructing a visualized finite state machine plugin ,and using the GraphEdit .

Describe the problem or limitation you are having in your project

I think the function of minimap is to help user to find the target position quickly when building a complex structure , but now it still not convenient enough : 1, It can only show nodes which type of GraphNode. 2, It can not show the node's rotation. 3, It can not emit signal "scroll_offset_changed" when drag event appear inside it.

For the first two limitations , If I use the GraphNode to make the Ttransition of my finite state machine , the transition will show in minimap without rotation ,really strange .....If I use other Control to make the Transition , it will not show in minimap ,and have to keep their offset by myself , and I use the GraphEdit's signal "scroll_offset_changed" to notify my Transition(s) ,then fix their offset ,it work perfectly when using mid-button to drag at GraphEdit ,but it not work when drag at minimap.

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

Here I recomment to fix the last two limitation , I consider that the first limitation is to help developer to decide which nodes should show in minimap(or add a boolean property "show in GrahpEdit'minimap" is a better choice?I'm not sure...).

If can show the node's rotation , I will using GraphNode to construct my Transition , I can cut some code, the part of manage graph offset ,and let it managed by GraphEdit , meanwhile,I will get rid of the problem that showing strange in minimap.

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

See section above.

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

I'm not sure .....at least I can't. I think that the properties which expose for minimap are not enough , and there are not signal and method for it , in document, or just not updated in time?

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

Obviously,for my project , it is enough that just fix the second problem,however,I think it is importance to improve the minimap’s practicability and the freedom of the custom GraphEdit.

YuriSizov commented 3 years ago

I have to say, it would be highly unlikely that we could support arbitrary controls for that, because the way GraphEdit works is by using GraphNode's special offset property (renamed to position_offset in master). Other Control nodes don't have it. They also don't support connections, so that makes them unusable in GraphEdit, at least without some scroll_offset_changed hacks like you've described.

I think a proper way forward would be not in allowing arbitrary controls to be displayed on the minimap, but in making a basic graph-item class that GraphNode and your custom nodes could extend. This way, they can share some basic features, and the minimap would just pick them up automatically.

Daylily-Zeleen commented 3 years ago

I have to say, it would be highly unlikely that we could support arbitrary controls for that, because the way GraphEdit works is by using GraphNode's special offset property (renamed to position_offset in master). Other Control nodes don't have it. They also don't support connections, so that makes them unusable in GraphEdit, at least without some scroll_offset_changed hacks like you've described.

I think a proper way forward would be not in allowing arbitrary controls to be displayed on the minimap, but in making a basic graph-item class that GraphNode and your custom nodes could extend. This way, they can share some basic features, and the minimap would just pick them up automatically.

Yes....I agree with you point , creat custom node base on GraphNode is my initial plan,but the minimap still not powerful enough , it show without rotation ,so I hope this problem can be solved.