Replies: 5 comments 2 replies
-
How is your opaque macro better than is_editor_hint()? |
Beta Was this translation helpful? Give feedback.
-
OK, here is a variation of the idea: We could have |
Beta Was this translation helpful? Give feedback.
-
We had a good discussion about this in godotengine/godot#8735 with some really good proposals in there, especially: godotengine/godot#8735 (comment) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I personally think that @macro(process) # could be ready, init, notification, etc
func macro_process_example(delta):
... is a better option, since it allows for any function to be called inside the editor and also whenever you want (process would be in every frame, ready would be when the node is done, etc.) |
Beta Was this translation helpful? Give feedback.
-
How it works now
At this time to use utility features for visual debugging of different stuff right in GD editor we may use bundle of
@tool
annotation with statementEngine.is_editor_hint()
The problem
When we work with script implementing some game mechanics and at some moment find needy to visualize something in editor we need to use
@tool
annotation in that script. Now we got an issue that whole script starts "working" in editor, while we need to see in action only one or couple of special features. To make our main script not work in editor we need to wrap mostly whole script inif not Engine.is_editor_hint():
function. This is not what we want especially when we already have a lot of code because not only it'll make it cluttered with excessive indents. But we want only to test and debug something fast, not rewrite everything just for that.Solution
Adding special function like
_macro
, for example, for code that we want to run in editor.Something like that:
This way we can implement in editor features to work with current node.
I guess this also need to have annotation so editor should understand that there may be
_macro
functions inside this script, so we simply add@macro
at the beginning instead of@tool
.Of course this is just example, but I hope you understand the idea.
Beta Was this translation helpful? Give feedback.
All reactions