Godot Version
4.6.1
Question
I’m writing a plugin where I’d like to perform an action on a script file whenever a new one is created. What is the best trigger for my functionality?
I found that the ScriptCreateDialog class has a script_created signal which looks exactly like what I need. The EditorPlugin class provides access to this class using get_script_create_dialog() which works, but only when the script dialog is instantiated via the scene tree. Looking at the engine source code, this implementation of the method hooks into SceneTreeDock::get_script_create_dialog().
The problem is that the dialog can also be created from the FileSystemDockwhich has its own unique ScriptCreateDialog object. The gdscript bindings do not provide access to the dock’s dialog object, so I can’t hook up the signal.
Relatedly, a script can also be created under “File > New Script” in the main editor (or with Ctrl+n). I’m unsure what component instantiates this dialog box. All I can tell is that it’s not the same dialog that can be retrieved from EditorPlugin.