You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The second part is outright wrong. You can access constants of non-tool scripts, so they are not completely "empty".
Extending a @tool script does not automatically make the extending script a @tool. Omitting @tool from the extending script will disable tool behavior from the super class.
That one is correct, but we have a new warning for that, so it might be worth mentioning.
Modifications in the editor are permanent.
You can utilize editor's undo/redo to make them non-permanent. Although here it could be only briefly mentioned, something like ", unless you use editor's undo/redo system.". It can be clarified more in the EditorScript section below.
You may need to restart the editor. This is a known bug found in all Godot 4 versions
Restarting the editor is (almost?) never needed. In most cases it's enough to reload the scene. While a tool scrip will work immediately (unless it's built-in), scene reload will re-initialize it's state properly if it was just changed to tool.
In case of _process() a scene reload is needed, because processing is enabled in node's NOTIFICATION_READY, which is normally received only once per node. If you make script into tool, or attach a script to existing node, you will need to reload scene to enable or disable processing.
Autoload nodes cannot be accessed in the editor at all.
Autoloads are normally accessible, otherwise the scripts wouldn't compile. But again, if the autoload is non-tool (which means it exists in the editor without script instance), you can only access constants.
changed.emit()
There is emit_changed() method for that (which does the same, but it's preferred over manually emitting).
EditorScripts have no undo/redo functionality, so make sure to save your scene before running one if the script is designed to modify any data.
There is EditorInterface.get_editor_undo_redo() now.
For potential additions:
The new @tool_button annotation could be mentioned.
A neat trick to avoid some editor_hint() checks is doing:
This is useful if your node does not need to be processed in the editor.
Any @tool script has access to editor classes, and especially EditorInterface, which allows things like aforementioned undo/redo. However directly referencing any editor class will make the script not work at runtime.
URL to the documentation page (if already existing):
Your Godot version:
4.5 dev1
Issue description:
I've read "Running code in the editor" and it contains some outdated/false information.
The first part is misinformed. See my explanation here: godotengine/godot#104398 (comment)
The second part is outright wrong. You can access constants of non-tool scripts, so they are not completely "empty".
That one is correct, but we have a new warning for that, so it might be worth mentioning.
You can utilize editor's undo/redo to make them non-permanent. Although here it could be only briefly mentioned, something like ", unless you use editor's undo/redo system.". It can be clarified more in the EditorScript section below.
Restarting the editor is (almost?) never needed. In most cases it's enough to reload the scene. While a tool scrip will work immediately (unless it's built-in), scene reload will re-initialize it's state properly if it was just changed to tool.
In case of
_process()
a scene reload is needed, because processing is enabled in node'sNOTIFICATION_READY
, which is normally received only once per node. If you make script into tool, or attach a script to existing node, you will need to reload scene to enable or disable processing.Autoloads are normally accessible, otherwise the scripts wouldn't compile. But again, if the autoload is non-tool (which means it exists in the editor without script instance), you can only access constants.
There is
emit_changed()
method for that (which does the same, but it's preferred over manually emitting).There is
EditorInterface.get_editor_undo_redo()
now.For potential additions:
@tool_button
annotation could be mentioned.editor_hint()
checks is doing:This is useful if your node does not need to be processed in the editor.
@tool
script has access to editor classes, and especially EditorInterface, which allows things like aforementioned undo/redo. However directly referencing any editor class will make the script not work at runtime.URL to the documentation page (if already existing):
https://docs.godotengine.org/en/latest/tutorials/plugins/running_code_in_the_editor.html
The text was updated successfully, but these errors were encountered: