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
Describe the project you are working on:
Nothing particular
Describe the problem or limitation you are having in your project:
When tagging an script as tool, every single function inside of it will run in the editor, so if we want to have a single function to work in the Editor we need to put barriers on every other function at the start if get_tree().is_editor_hint(): return
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
The proposal is to allow to put the tool keyword in front of functions which you want to allow execution during the editor
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
tool func set_texture(p_texture):
# Only this function runs in editor
if has_node("icon"):
$icon.texture = p_texture
If this enhancement will not be used often, can it be worked around with a few lines of script?:
The workaround is make the entire script a tool script and add barriers in functions you don´t want to use, or implement only the editor functions in a separate script and then inherit that script with a no tool script. This is not possible if you already need to extend a different script (as multiple inheritance is forbidden (and for good reasons)
Is there a reason why this should be core and not an add-on in the asset library?:
It requiere changes on core (Script class) and GdScript module
The text was updated successfully, but these errors were encountered:
Describe the project you are working on:
Nothing particular
Describe the problem or limitation you are having in your project:
When tagging an script as tool, every single function inside of it will run in the editor, so if we want to have a single function to work in the Editor we need to put barriers on every other function at the start
if get_tree().is_editor_hint(): return
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
The proposal is to allow to put the
tool
keyword in front of functions which you want to allow execution during the editorDescribe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
If this enhancement will not be used often, can it be worked around with a few lines of script?:
The workaround is make the entire script a tool script and add barriers in functions you don´t want to use, or implement only the editor functions in a separate script and then inherit that script with a no tool script. This is not possible if you already need to extend a different script (as multiple inheritance is forbidden (and for good reasons)
Is there a reason why this should be core and not an add-on in the asset library?:
It requiere changes on core (Script class) and GdScript module
The text was updated successfully, but these errors were encountered: