Is there a way to filter scripts by the scene they are attached to? E.g. if I click on Scene1, I should only see scripts (and globals.gd) that fall under Scene1. Of course scripts could be named logically but then it gets messy.
Editor script filtering
I do not think there is any functionality in the editor that shows only scripts in the open/active scene. That would be useful to have, but I imagine it would be hard to program.
However, if you have the scene open, you can click the little script icon (looks a bit like a open scroll) and that will open the script editor showing the script attached to that node.
Other than that though, I do not think there is any scene based script filtering available in Godot.
@TwistedTwigleg said: Other than that though, I do not think there is any scene based script filtering available in Godot.
At the moment. This definitely seems to me like a valid feature request for the issue tracker on godot github repository.
@Megalomaniak said: At the moment. This definitely seems to me like a valid feature request for the issue tracker on godot github repository.
I agree!
The only thing I wonder is how hard it would be to implement. Not to say that it should not be a feature request, I think it would be awesome if it was added, I just am thinking about potential complexities.
I suppose in theory it would just be a matter of going through the scene tree and getting all of the scripts and putting them into a list, though this might not work due to instanced scenes. If there is a way to tell whether a node/scene is instanced or not then it may just be a matter of checking and ignoring instanced nodes (or putting them in a separate list). If instanced scenes and their children nodes are kept separate, then in theory they could just be processed like other nodes.
Another interesting thing to consider is how this would work with scripts being added and removed... All interesting stuff to think about! :smile:
Perhaps one day I'll try adding scene based script filtering into Godot. Though with as much other stuff I have planned, I do not see myself having much free time in the foreseeable future :lol:
Regardless I think scene based script filtering would be a great feature request on the Github repository.
Not to trivialize it, but IMHO it would be a matter of looking at currently open scene files ( .tscn ) and displaying what is there (and include the globals.gd from autoload) Here is an example what is stored there now.
[ext_resource path="res://menus/Menu1.gd" type="Script" id=1] [ext_resource path="res://menus/Button.gd" type="Script" id=2] [ext_resource path="res://menus/Button2.gd" type="Script" id=3] [ext_resource path="res://new_script.gd" type="Script" id=4]
@wyattbiker said: Not to trivialize it, but IMHO it would be a matter of looking at currently open scene files ( .tscn ) and displaying what is there (and include the globals.gd from autoload) Here is an example what is stored there now.
[ext_resource path="res://menus/Menu1.gd" type="Script" id=1] [ext_resource path="res://menus/Button.gd" type="Script" id=2] [ext_resource path="res://menus/Button2.gd" type="Script" id=3] [ext_resource path="res://new_script.gd" type="Script" id=4]
Oh! In that case, it should be much easier to implement then! I didn’t realize the scene files store the scripts like that. Now knowing they are stored like that, then it should be fairly easy to loop and filter the scripts based on whether or not they are in the open scene.