godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.13k stars 75 forks source link

Displaying the names of code regions in the scene node tree #10822

Open MetalPony opened 5 days ago

MetalPony commented 5 days ago

Describe the project you are working on

I'm slowly making my strategy game. I don't like creating a lot of script files so I use code regions to organize code in files.

Describe the problem or limitation you are having in your project

When a script file accumulates a lot of code and functionality, it becomes difficult to navigate even using code regions.

You could probably use more nodes and split the code into different files, but I would argue that this is a bad solution. It is also impossible to endlessly split the code and functionality into different nodes. There will still be a situation when a node will have a lot of code and many regions.

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

I want the following functionality: When there is a node with an attached script file, if there are code regions in the script file - then a drop-down list appears in the scene node tree for the corresponding node (with the script file) that contains the names of the code regions. When you click on the name of a code region in the scene node tree, the script file opens and the cursor is moved to the corresponding code region.

I also want it to be possible to set a color for code regions and for this color to be transferred to the scene node tree. This way I can use color to mark which functionality has already been done and which needs to be done.

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

Example_Regions

This is what I want in the scene node tree. If there is an attached script file, a drop-down list for code regions appears. There may also be child nodes and they also need a drop-down list. I think you can place a new list button to the right of the node name. There can be nested regions of code, so regions need to be able to have lists of regions.

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

I didn't see any way to implement this using plugins.

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

If you can do this using an addon, then I'm all for it.

Zireael07 commented 5 days ago

IMHO unnecessary mixing of script stuff and scene tree stuff

salianifo commented 4 days ago

I don't think this would belong in the SceneTreeDock, but I could see utility for it in the script list. Maybe changing the method list into a tree with code regions being foldable? Seems like it would be a much better fit to me.

dalexeev commented 4 days ago

I think it makes more sense to display code regions in the method overview and on the minimap. The scene tree has no direct relation to the code, you can only attach/detach a script to a node here.

See also: