@tool
Annotation Should Work on Individual Functions
#7029
Replies: 4 comments 5 replies
-
Can you please link those other proposals so we can more easily take part of the arguments made there? Simply mentioning it but not the arguments made there feels kinda disingenuous (and they're not easy to find) |
Beta Was this translation helpful? Give feedback.
-
You start with 'Agreed' but there is nothing to agree/disagree with yet? |
Beta Was this translation helpful? Give feedback.
-
Now this would require rebuilding the entire way this works in GDScript, and would require a separate mechanism there, as I don't know if this is possible in C#, further it'd cause confusion among users, people already get confused over attempting to call functions on non-tool scripts as it is, I don't believe it's worth it for all those issues |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've often wanted to give my nodes configuration warnings via
_get_configuration_warning()
, but the way it works currently means I never do; I'm too scared I'll write a function and forget to add theis_editor_hint()
check and cause damage to my scenes when the function runs (say, if the function containsqueue_free()
or something).(note that it's sometimes useful to have a whole script work in the editor, and a
@tool
annotation used at the top of a script before theextends
keyword should retain its current functionality. I just think the all-or-nothing approach to@tool
scripts renders the_get_configuration_warning()
method more trouble than its worth.)I don't really see any benefit to being unable to easily grant
@tool
functionality to individual functions--particularly as a function like_get_configuration_warning()
is only applicable in the editor, and making an entire script run in the editor for just one function is so dangerous. As it is, it's just not worth the risk.I'm not sure how similar it is in implementation, but take the fact that the
@export
annotation causes immediate feedback in the editor (specifically by adding a field to the Inspector), and moreover that it doesn't cause every single variable in the script to become an@export
variable. This functionality would lead one to reasonably ask why@tool
doesn't work in an analogous manner.In my opinion, the
@tool
annotation as applied to functions should probably be at least somewhat similar to how we use annotations for variables:P.S.
I know there have been similar proposals in the past, but all of them appear to have been written back when
@tool
was a keyword (tool
) instead of an annotation.Alternatively, if giving
@tool
different functionality if used beforeextends
is a problem, then maybe a different annotation like@editor func
would work better.Beta Was this translation helpful? Give feedback.
All reactions