Skip to content

Commit

Permalink
Updated notes regarding code in editor (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
RefinedDev committed Jul 31, 2023
1 parent feda18d commit df43e74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
12 changes: 4 additions & 8 deletions src/gdext/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@ That said, there are some notable differences:

3. **Always-on**

There is no differentiation between "tool" and "normal" scripts anymore; Rust logic runs as soon as the Godot editor launches.
gdext will likely add an opt-out mechanism to limit execution to the launched game, as that's usually the intended behavior.
Currently, if you want logic to execute only when the game runs, write this code at the beginning of your process functions:
```rust
if Engine::singleton().is_editor_hint() {
return;
}
```
There is no differentiation between "tool" and "normal" scripts anymore, as it was the case in GDNative. Rust logic runs as soon as
the Godot editor launches, but gdext explicitly changes this behavior. By default, all virtual callbacks (`ready`, `process` etc.)
are not invoked **in editor mode**. This behavior can be configured when implementing the [`ExtensionLibrary`][extension-library-doc] trait.

4. **No recompilation while editor is open**

Expand All @@ -53,3 +48,4 @@ That said, there are some notable differences:

[features]: https://github.com/godot-rust/gdextension/issues/24
[issue #66231]: https://github.com/godotengine/godot/issues/66231
[extension-library-doc]: https://godot-rust.github.io/docs/gdext/master/godot/init/trait.ExtensionLibrary.html#method.editor_run_behavior
18 changes: 10 additions & 8 deletions src/gdext/intro/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,16 @@ This is a point where you can compile your code, launch Godot and see the result

![rotating sprite](https://docs.godotengine.org/en/stable/_images/scripting_first_script_godot_turning_in_place.gif)

> **Launching the Godot application**
>
> While it's possible to open the Godot editor and press the launch button every time you made a change in Rust, this is not the most
> efficient workflow. Unfortunately there is [a GDExtension limitation][no-reload] that prevents recompilation while the editor is open
> (at least on Windows systems -- it tends to work better on Linux and macOS).
>
> However, if you don't need to modify anything in the editor itself, you can launch Godot from the command line or even your IDE.
> Check out the [command-line tutorial][godot-command-line] for more information.
```admonish tip
**Launching the Godot application**
While it's possible to open the Godot editor and press the launch button every time you made a change in Rust, this is not the most
efficient workflow. Unfortunately there is [a GDExtension limitation][no-reload] that prevents recompilation while the editor is open
(at least on Windows systems -- it tends to work better on Linux and macOS).
However, if you don't need to modify anything in the editor itself, you can launch Godot from the command line or even your IDE.
Check out the [command-line tutorial][godot-command-line] for more information.
```

We now add a translation component to the sprite, following [the upstream tutorial][tutorial-full-script].

Expand Down

0 comments on commit df43e74

Please sign in to comment.