mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
Remove trailing space characters (#5251)
This commit is contained in:
@@ -12,7 +12,7 @@ the top-level `index.html` in a web browser.
|
||||
|
||||
## Theming
|
||||
|
||||
The Godot documentation uses the default ``sphinx_rtd_theme`` with many
|
||||
The Godot documentation uses the default `sphinx_rtd_theme` with many
|
||||
[customizations](_static/) applied on top. It will automatically switch between
|
||||
the light and dark theme depending on your browser/OS' theming preference.
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ Link to the license
|
||||
|
||||
The Godot Engine developers consider that a link to godotengine.org/license
|
||||
in your game documentation or credits would be an acceptable way to satisfy
|
||||
the license terms.
|
||||
the license terms.
|
||||
|
||||
Third-party licenses
|
||||
--------------------
|
||||
@@ -105,7 +105,7 @@ requires attribution, so the following text must be included together with the
|
||||
Godot license:
|
||||
|
||||
Portions of this software are copyright © <year> The FreeType Project (www.freetype.org). All rights reserved.
|
||||
|
||||
|
||||
Note that <year> should correspond to the value from the FreeType version
|
||||
used in your build.
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ relatively intuitive:
|
||||
- The :ref:`sec-community` section gives the information related to contributing to
|
||||
the engine development and the life of its community, e.g. how to report bugs,
|
||||
help with the documentation, etc. It also points to various community channels
|
||||
like Godot Contributors Chat and Discord and contains a list of recommended
|
||||
like Godot Contributors Chat and Discord and contains a list of recommended
|
||||
third-party tutorials outside of this documentation.
|
||||
- Finally, the :ref:`sec-class-ref` is the documentation of the Godot API,
|
||||
which is also available directly within the engine's script editor. It is
|
||||
|
||||
@@ -21,7 +21,7 @@ install all these tools. It comes pre-installed with `Python
|
||||
<https://www.python.org/>`__. Ensure that you install and use Python 3. Here are
|
||||
the commands to clone the repository and then install all requirements.
|
||||
|
||||
.. note:: You may need to write ``python3 -m pip`` (Unix) or ``py -m pip`` (Windows) instead of ``pip3``.
|
||||
.. note:: You may need to write ``python3 -m pip`` (Unix) or ``py -m pip`` (Windows) instead of ``pip3``.
|
||||
If both approaches fail, `check that you have pip3 installed <https://pip.pypa.io/en/stable/installation/>`__.
|
||||
|
||||
.. code:: sh
|
||||
|
||||
@@ -365,7 +365,7 @@ On that line, there is a "Pull request" link. Clicking it will open a form
|
||||
that will let you issue a pull request on the ``godotengine/godot`` upstream
|
||||
repository. It should show you your two commits, and state "Able to merge".
|
||||
If not (e.g. it has way more commits, or says there are merge conflicts),
|
||||
don't create the PR yet, something went wrong. Go to our `Contributors Chat
|
||||
don't create the PR yet, something went wrong. Go to our `Contributors Chat
|
||||
<https://chat.godotengine.org/>`_ and ask for support :)
|
||||
|
||||
Use an explicit title for the PR and put the necessary details in the comment
|
||||
|
||||
@@ -21,13 +21,13 @@ taking care of a given class.
|
||||
.. seealso::
|
||||
|
||||
You can find the writing guidelines for the class reference :ref:`here <doc_class_reference_writing_guidelines>`.
|
||||
|
||||
|
||||
For details on Git usage and the pull request workflow, please
|
||||
refer to the :ref:`doc_pr_workflow` page.
|
||||
|
||||
If you want to translate the class reference from English to another
|
||||
language, see :ref:`doc_editor_and_docs_localization`.
|
||||
|
||||
|
||||
This guide is also available as a `video tutorial on YouTube
|
||||
<https://www.youtube.com/watch?v=5jeHXxeX-JY>`_.
|
||||
|
||||
|
||||
3
conf.py
3
conf.py
@@ -2,6 +2,7 @@
|
||||
#
|
||||
# Godot Engine documentation build configuration file
|
||||
|
||||
import sphinx
|
||||
import sphinx_rtd_theme
|
||||
import sys
|
||||
import os
|
||||
@@ -249,11 +250,11 @@ gettext_compact = False
|
||||
# https://github.com/sphinx-doc/sphinx/issues/7768 to see what would be relevant for us.
|
||||
figure_language_filename = "{root}.{language}{ext}"
|
||||
|
||||
import sphinx
|
||||
cwd = os.getcwd()
|
||||
|
||||
sphinx_original_get_image_filename_for_language = sphinx.util.i18n.get_image_filename_for_language
|
||||
|
||||
|
||||
def godot_get_image_filename_for_language(filename, env):
|
||||
"""
|
||||
Hack the absolute path returned by Sphinx based on `figure_language_filename`
|
||||
|
||||
@@ -44,13 +44,13 @@ For compiling under Windows, Linux or macOS, the following is required:
|
||||
Setting up the buildsystem
|
||||
--------------------------
|
||||
|
||||
- Set the environment variable ``ANDROID_SDK_ROOT`` to point to the Android
|
||||
- Set the environment variable ``ANDROID_SDK_ROOT`` to point to the Android
|
||||
SDK. If you downloaded the Android command-line tools, this would be
|
||||
the folder where you extracted the contents of the ZIP archive.
|
||||
|
||||
- Install the necessary SDK components in this folder:
|
||||
|
||||
- Accept the SDK component licenses by running the following command
|
||||
- Accept the SDK component licenses by running the following command
|
||||
where ``android_sdk_path`` is the path to the Android SDK, then answering all the prompts with ``y``:
|
||||
|
||||
::
|
||||
@@ -63,7 +63,7 @@ Setting up the buildsystem
|
||||
|
||||
tools/bin/sdkmanager --sdk_root=<android_sdk_path> "platform-tools" "build-tools;30.0.3" "platforms;android-29" "cmdline-tools;latest" "cmake;3.10.2.4988404"
|
||||
|
||||
.. seealso:: To set the environment variable on Windows, press :kbd:`Windows + R`, type
|
||||
.. seealso:: To set the environment variable on Windows, press :kbd:`Windows + R`, type
|
||||
"control system", then click on **Advanced system settings** in the left
|
||||
pane, then click on **Environment variables** on the window that appears.
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Importing the project
|
||||
.. figure:: img/android_studio_setup_project_1.png
|
||||
:figclass: figure-w480
|
||||
:align: center
|
||||
|
||||
|
||||
Android Studio's welcome window.
|
||||
|
||||
- Navigate to ``<Godot root directory>/platform/android/java`` and select the ``settings.gradle`` file.
|
||||
|
||||
@@ -23,7 +23,7 @@ Importing the project
|
||||
:figclass: figure-w480
|
||||
:align: center
|
||||
|
||||
- After the project has been imported, open the project configuration by right-clicking
|
||||
- After the project has been imported, open the project configuration by right-clicking
|
||||
on it in the **Projects** panel and selecting **Open Configuration..** option.
|
||||
|
||||
.. figure:: img/kdevelop_openconfig.png
|
||||
@@ -39,7 +39,7 @@ Importing the project
|
||||
core/os/
|
||||
core/math/
|
||||
drivers/
|
||||
platform/<your_platform>/ // Replace <your_platform> with a folder
|
||||
platform/<your_platform>/ // Replace <your_platform> with a folder
|
||||
corresponding to your current platform
|
||||
|
||||
.. figure:: img/kdevelop_addincludes.png
|
||||
@@ -75,7 +75,7 @@ Debugging the project
|
||||
:align: center
|
||||
|
||||
- Click **Add** to create a new launch configuration.
|
||||
- Select **Executable** option and specify the path to your executable located in
|
||||
- Select **Executable** option and specify the path to your executable located in
|
||||
the ``<Godot root directory>/bin`` folder. The name depends on your build configuration,
|
||||
e.g. ``godot.linuxbsd.tools.64`` for 64-bit LinuxBSD platform with ``tools`` enabled.
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Importing the project
|
||||
:figclass: figure-w480
|
||||
:align: center
|
||||
|
||||
- Click **Add Build Step > Custom Process Step** to add a new build step
|
||||
- Click **Add Build Step > Custom Process Step** to add a new build step
|
||||
with the following settings:
|
||||
|
||||
+-----------+------------------------------------------------------------------------------+
|
||||
@@ -65,7 +65,7 @@ Importing the project
|
||||
:figclass: figure-w480
|
||||
:align: center
|
||||
|
||||
.. note:: If the build fails with ``Could not start process "scons"``, it can mean that ``scons``
|
||||
.. note:: If the build fails with ``Could not start process "scons"``, it can mean that ``scons``
|
||||
is not in your ``PATH`` environment variable. In this case, you'll have to specify the
|
||||
full path to the SCons binary.
|
||||
|
||||
@@ -73,7 +73,7 @@ Debugging the project
|
||||
---------------------
|
||||
|
||||
- From the left-side menu select **Projects** and open the **Run** tab.
|
||||
- Under **Executable** specify the path to your executable located in
|
||||
- Under **Executable** specify the path to your executable located in
|
||||
the ``<Godot root directory>/bin`` folder. The name depends on your build configuration,
|
||||
e.g. ``godot.linuxbsd.tools.64`` for 64-bit LinuxBSD platform with ``tools`` enabled.
|
||||
You can use ``%{buildDir}`` to reference the project root, e.g: ``%{buildDir}/bin/godot.linuxbsd.opt.tools.64``.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Visual Studio
|
||||
=============
|
||||
|
||||
`Visual Studio Community <https://visualstudio.microsoft.com>`__ is a Windows-only IDE
|
||||
`Visual Studio Community <https://visualstudio.microsoft.com>`__ is a Windows-only IDE
|
||||
by `Microsoft <https://microsoft.com>`_ that's free for non-commercial use.
|
||||
It has many useful features, such as memory view, performance view, source
|
||||
control and more.
|
||||
@@ -35,7 +35,7 @@ and make live changes to the codebase.
|
||||
|
||||
You can launch the project with the debugger attached using the **Debug > Start Debugging**
|
||||
option from the top menu. However, unless you want to debug the project manager specifically,
|
||||
you'd need to configure debugging options first. This is due to the fact that when the Godot
|
||||
you'd need to configure debugging options first. This is due to the fact that when the Godot
|
||||
project manager opens a project, the initial process is terminated and the debugger gets detached.
|
||||
|
||||
- To configure the launch options to use with the debugger use **Project > Properties**
|
||||
@@ -44,9 +44,9 @@ project manager opens a project, the initial process is terminated and the debug
|
||||
.. figure:: img/vs_2_project_properties.png
|
||||
:align: center
|
||||
|
||||
- Open the **Debugging** section and under **Command Arguments** add two new arguments:
|
||||
- Open the **Debugging** section and under **Command Arguments** add two new arguments:
|
||||
the ``-e`` flag opens the editor instead of the project manager, and the ``--path`` argument
|
||||
tells the executable to open the specified project (must be provided as an *absolute* path
|
||||
tells the executable to open the specified project (must be provided as an *absolute* path
|
||||
to the project root, not the ``project.godot`` file).
|
||||
|
||||
.. figure:: img/vs_3_debug_command_line.png
|
||||
|
||||
@@ -109,7 +109,7 @@ To run and debug the project you need to create a new configuration in the ``lau
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
// Change to godot.linuxbsd.tools.64.llvm for llvm-based builds.
|
||||
"program": "${workspaceFolder}/bin/godot.linuxbsd.tools.64",
|
||||
"program": "${workspaceFolder}/bin/godot.linuxbsd.tools.64",
|
||||
// Change the arguments below for the project you want to test with.
|
||||
// To run the project instead of editing it, remove the "--editor" argument.
|
||||
"args": [ "--editor", "--path", "path-to-your-godot-project-folder" ],
|
||||
@@ -117,7 +117,7 @@ To run and debug the project you need to create a new configuration in the ``lau
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"setupCommands":
|
||||
"setupCommands":
|
||||
[
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Xcode
|
||||
=====
|
||||
|
||||
`Xcode <https://developer.apple.com/xcode>`_ is a free macOS-only IDE. You can
|
||||
`Xcode <https://developer.apple.com/xcode>`_ is a free macOS-only IDE. You can
|
||||
download it from the Mac App Store.
|
||||
|
||||
Importing the project
|
||||
@@ -47,7 +47,7 @@ Importing the project
|
||||
|
||||
- For this target open the **Build Settings** tab and look for **Header Search Paths**.
|
||||
- Set **Header Search Paths** to the absolute path to the Godot root folder. You need to
|
||||
include subdirectories as well. To achieve that, add two two asterisks (``**``) to the
|
||||
include subdirectories as well. To achieve that, add two two asterisks (``**``) to the
|
||||
end of the path, e.g. ``/Users/me/repos/godot-source/**``.
|
||||
|
||||
- Add the Godot source to the project by dragging and dropping it into the project file browser.
|
||||
@@ -57,7 +57,7 @@ Importing the project
|
||||
:figclass: figure-w480
|
||||
:align: center
|
||||
|
||||
- Next select **Create groups** for the **Added folders** option and check *only*
|
||||
- Next select **Create groups** for the **Added folders** option and check *only*
|
||||
your command line indexing target in the **Add to targets** section.
|
||||
|
||||
.. figure:: img/xcode_6_after_add_godot_source_to_project_2.png
|
||||
@@ -76,7 +76,7 @@ To enable debugging support you need to edit the external build target's build a
|
||||
- Open the scheme editor of the external build target.
|
||||
- Locate the **Build > Post Actions** section.
|
||||
- Add a new script run action
|
||||
- Under **Provide build settings from** select your project. This allows to reference
|
||||
- Under **Provide build settings from** select your project. This allows to reference
|
||||
the project directory within the script.
|
||||
- Create a script that will give the binary a name that Xcode can recognize, e.g.:
|
||||
|
||||
@@ -100,7 +100,7 @@ To enable debugging support you need to edit the external build target's build a
|
||||
- Check **Debug executable**.
|
||||
- You can add two arguments on the **Arguments** tab:
|
||||
the ``-e`` flag opens the editor instead of the project manager, and the ``--path`` argument
|
||||
tells the executable to open the specified project (must be provided as an *absolute* path
|
||||
tells the executable to open the specified project (must be provided as an *absolute* path
|
||||
to the project root, not the ``project.godot`` file).
|
||||
|
||||
To check that everything is working, put a breakpoint in ``platform/osx/godot_main_osx.mm`` and
|
||||
|
||||
@@ -310,7 +310,7 @@ Therefore, the process of writing integration tests for GDScript is the followin
|
||||
The test should not have any dependency unless it's part of the test too.
|
||||
Global classes (using ``class_name``) are registered before the runner
|
||||
starts, so those should work if needed.
|
||||
|
||||
|
||||
Here's an example test script:
|
||||
|
||||
::
|
||||
@@ -331,7 +331,7 @@ Therefore, the process of writing integration tests for GDScript is the followin
|
||||
|
||||
./bin/<godot_binary> --test --test-suite="*GDScript*"
|
||||
|
||||
If no errors are printed and everything goes well, you're done!
|
||||
If no errors are printed and everything goes well, you're done!
|
||||
|
||||
.. warning::
|
||||
|
||||
@@ -341,7 +341,7 @@ If no errors are printed and everything goes well, you're done!
|
||||
only commit ``*.out`` files for new tests.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
The GDScript test runner is meant for testing the GDScript implementation,
|
||||
not for testing user scripts nor testing the engine using scripts. We
|
||||
recommend writing new tests for already resolved
|
||||
|
||||
@@ -108,7 +108,7 @@ for reference purposes.
|
||||
| "return" [ expression ] stmtEnd
|
||||
;
|
||||
|
||||
assignmentStmt = subscription ( "=" | "+=" | "-=" | "*=" | "/="
|
||||
assignmentStmt = subscription ( "=" | "+=" | "-=" | "*=" | "/="
|
||||
| "%=" | "&=" | "|=" | "^=" ) expression stmtEnd;
|
||||
varDeclStmt = "var" IDENTIFIER [ "=" expression ] stmtEnd;
|
||||
|
||||
@@ -137,9 +137,9 @@ for reference purposes.
|
||||
sign = ( "-" | "+" ) sign | bitNot ;
|
||||
bitNot = "~" bitNot | is ;
|
||||
is = call [ "is" ( IDENTIFIER | BUILTINTYPE ) ] ;
|
||||
call
|
||||
= (attribute [ "(" [ argList ] ")" ])
|
||||
| "." IDENTIFIER "(" [ argList ] ")"
|
||||
call
|
||||
= (attribute [ "(" [ argList ] ")" ])
|
||||
| "." IDENTIFIER "(" [ argList ] ")"
|
||||
| "$" ( STRING | IDENTIFIER { '/' IDENTIFIER } );
|
||||
attribute = subscription { "." IDENTIFIER } ;
|
||||
subscription = primary [ "[" expression "]" ] ;
|
||||
|
||||
@@ -40,10 +40,10 @@ character.
|
||||
// The downward acceleration when in the air, in meters per second squared.
|
||||
[Export]
|
||||
public int FallAcceleration = 75;
|
||||
|
||||
|
||||
private Vector3 _velocity = Vector3.Zero;
|
||||
}
|
||||
|
||||
|
||||
|
||||
These are common properties for a moving body. The ``velocity`` is a 3D vector
|
||||
combining a speed with a direction. Here, we define it as a property because
|
||||
@@ -317,7 +317,6 @@ Here is the complete ``Player.gd`` code for reference.
|
||||
_velocity = MoveAndSlide(_velocity, Vector3.Up);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Testing our player's movement
|
||||
-----------------------------
|
||||
|
||||
@@ -118,7 +118,7 @@ the ``velocity``.
|
||||
public class Mob : KinematicBody
|
||||
{
|
||||
// Don't forget to rebuild the project so the editor knows about the new export variable.
|
||||
|
||||
|
||||
// Minimum speed of the mob in meters per second
|
||||
[Export]
|
||||
public int MinSpeed = 10;
|
||||
@@ -183,7 +183,7 @@ We start by creating a 3D vector pointing forward, multiply it by our
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
|
||||
func initialize(start_position, player_position):
|
||||
# ...
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ always spawn following the same sequence.
|
||||
public class Main : Node
|
||||
{
|
||||
// Don't forget to rebuild the project so the editor knows about the new export variable.
|
||||
|
||||
|
||||
#pragma warning disable 649
|
||||
// We assign this in the editor, so we don't need the warning about not being assigned.
|
||||
[Export]
|
||||
|
||||
@@ -86,7 +86,7 @@ a ``die()`` function that helps us put a descriptive label on the code.
|
||||
public delegate void Hit();
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
private void Die()
|
||||
{
|
||||
EmitSignal(nameof(Hit));
|
||||
@@ -190,35 +190,34 @@ Starting with ``Main.gd``.
|
||||
[Export]
|
||||
public PackedScene MobScene;
|
||||
#pragma warning restore 649
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GD.Randomize();
|
||||
}
|
||||
|
||||
|
||||
public void OnMobTimerTimeout()
|
||||
{
|
||||
// Create a mob instance and add it to the scene.
|
||||
var mob = (Mob)MobScene.Instance();
|
||||
|
||||
|
||||
// Choose a random location on Path2D.
|
||||
// We stire the reference to the SpawnLocation node.
|
||||
var mobSpawnLocation = GetNode<PathFollow>("SpawnPath/SpawnLocation");
|
||||
// And give it a random offset.
|
||||
mobSpawnLocation.UnitOffset = GD.Randf();
|
||||
|
||||
|
||||
Vector3 playerPosition = GetNode<Player>("Player").Transform.origin;
|
||||
|
||||
|
||||
AddChild(mob);
|
||||
mob.Initialize(mobSpawnLocation.Translation, playerPosition);
|
||||
}
|
||||
|
||||
|
||||
public void OnPlayerHit()
|
||||
{
|
||||
GetNode<Timer>("MobTimer").Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Next is ``Mob.gd``.
|
||||
|
||||
@@ -304,8 +303,7 @@ Next is ``Mob.gd``.
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Finally, the longest script, ``Player.gd``.
|
||||
|
||||
.. tabs::
|
||||
@@ -423,13 +421,13 @@ Finally, the longest script, ``Player.gd``.
|
||||
|
||||
_velocity.x = direction.x * Speed;
|
||||
_velocity.z = direction.z * Speed;
|
||||
|
||||
|
||||
// Jumping.
|
||||
if (IsOnFloor() && Input.IsActionJustPressed("jump"))
|
||||
{
|
||||
_velocity.y += JumpImpulse;
|
||||
}
|
||||
|
||||
|
||||
_velocity.y -= FallAcceleration * delta;
|
||||
_velocity = MoveAndSlide(_velocity, Vector3.Up);
|
||||
|
||||
@@ -459,7 +457,6 @@ Finally, the longest script, ``Player.gd``.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
See you in the next lesson to add the score and the retry option.
|
||||
|
||||
.. |image0| image:: img/07.killing_player/01.adding_area_node.png
|
||||
|
||||
@@ -447,7 +447,7 @@ Here is the complete ``Main.gd`` script for reference.
|
||||
GetNode<Control>("UserInterface/Retry").Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.. |image0| image:: img/08.score_and_replay/01.label_node.png
|
||||
.. |image1| image:: img/08.score_and_replay/02.score_placeholder.png
|
||||
|
||||
@@ -499,46 +499,46 @@ And the *Mob*'s script.
|
||||
// Emitted when the played jumped on the mob.
|
||||
[Signal]
|
||||
public delegate void Squashed();
|
||||
|
||||
|
||||
// Minimum speed of the mob in meters per second
|
||||
[Export]
|
||||
public int MinSpeed = 10;
|
||||
// Maximum speed of the mob in meters per second
|
||||
[Export]
|
||||
public int MaxSpeed = 18;
|
||||
|
||||
|
||||
private Vector3 _velocity = Vector3.Zero;
|
||||
|
||||
|
||||
public override void _PhysicsProcess(float delta)
|
||||
{
|
||||
MoveAndSlide(_velocity);
|
||||
}
|
||||
|
||||
|
||||
public void Initialize(Vector3 startPosition, Vector3 playerPosition)
|
||||
{
|
||||
Translation = startPosition;
|
||||
LookAt(playerPosition, Vector3.Up);
|
||||
RotateY((float)GD.RandRange(-Mathf.Pi / 4.0, Mathf.Pi / 4.0));
|
||||
|
||||
|
||||
float randomSpeed = (float)GD.RandRange(MinSpeed, MaxSpeed);
|
||||
_velocity = Vector3.Forward * randomSpeed;
|
||||
_velocity = _velocity.Rotated(Vector3.Up, Rotation.y);
|
||||
|
||||
|
||||
GetNode<AnimationPlayer>("AnimationPlayer").PlaybackSpeed = randomSpeed / MinSpeed;
|
||||
}
|
||||
|
||||
|
||||
public void Squash()
|
||||
{
|
||||
EmitSignal(nameof(Squashed));
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
|
||||
public void OnVisibilityNotifierScreenExited()
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.. |image0| image:: img/squash-the-creeps-final.gif
|
||||
.. |image1| image:: img/09.adding_animations/01.animation_player_dock.png
|
||||
.. |image2| image:: img/09.adding_animations/02.new_animation.png
|
||||
|
||||
@@ -236,14 +236,14 @@ position of hands, feet and other extremities of rigs like the one we've made.
|
||||
Imagine you want to pose a character's foot in a specific position on the ground.
|
||||
Without IK chains, each motion of the foot would require rotating and positioning
|
||||
several other bones (the shin and the thigh at least). This would be quite
|
||||
complex and lead to imprecise results. IK allows us to move the foot directly
|
||||
complex and lead to imprecise results. IK allows us to move the foot directly
|
||||
while the shin and thigh self-adjust.
|
||||
|
||||
.. note::
|
||||
|
||||
**IK chains in Godot currently work in the editor only**, not
|
||||
at runtime. They are intended to ease the process of setting keyframes, and are
|
||||
not currently useful for techniques like procedural animation.
|
||||
not currently useful for techniques like procedural animation.
|
||||
|
||||
To create an IK chain, select a chain of bones from endpoint to
|
||||
the base for the chain. For example, to create an IK chain for the right
|
||||
|
||||
@@ -96,7 +96,7 @@ Adding the return value from this function to *get_playback_position()* increase
|
||||
var time = $Player.get_playback_position() + AudioServer.get_time_since_last_mix()
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
|
||||
double time = GetNode<AudioStreamPlayer>("Player").GetPlaybackPosition() + AudioServer.GetTimeSinceLastMix();
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ doing so will not send the quit *notification*. This means the function
|
||||
described above won't be called. Quitting by calling
|
||||
:ref:`SceneTree.quit <class_SceneTree_method_quit>` will not allow custom actions
|
||||
to complete (such as saving, confirming the quit, or debugging), even if you try
|
||||
to delay the line that forces the quit.
|
||||
to delay the line that forces the quit.
|
||||
|
||||
Instead, you should send a quit request:
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ If no flags are set (flags == 0), the integer is sent as a 32 bit integer:
|
||||
| 4 | 4 | Integer | 32-bit signed integer |
|
||||
+----------+-------+-----------+--------------------------+
|
||||
|
||||
If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the integer is sent as
|
||||
If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the integer is sent as
|
||||
a 64-bit integer:
|
||||
|
||||
+----------+-------+-----------+--------------------------+
|
||||
@@ -149,7 +149,7 @@ If no flags are set (flags == 0), the float is sent as a 32 bit single precision
|
||||
| 4 | 4 | Float | IEEE 754 single-precision float |
|
||||
+----------+-------+---------+-----------------------------------+
|
||||
|
||||
If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the float is sent as
|
||||
If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the float is sent as
|
||||
a 64-bit double precision number:
|
||||
|
||||
+----------+-------+---------+-----------------------------------+
|
||||
@@ -454,7 +454,7 @@ For each property:
|
||||
calling ``Object._get_property_list`` See
|
||||
:ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` for the
|
||||
possible usage flags.
|
||||
|
||||
|
||||
18: :ref:`Dictionary<class_dictionary>`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ efficient for millions of objects, but for a few thousands, GDScript should be f
|
||||
multimesh.set_instance_transform(i, Transform(Basis(), Vector3(i * 20, 0, 0)))
|
||||
|
||||
.. code-tab:: csharp C#
|
||||
|
||||
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ singleton and start the connection:
|
||||
func _ready():
|
||||
if Engine.has_singleton("GodotGooglePlayBilling"):
|
||||
payment = Engine.get_singleton("GodotGooglePlayBilling")
|
||||
|
||||
|
||||
# These are all signals supported by the API
|
||||
# You can drop some of these based on your needs
|
||||
payment.connect("connected", self, "_on_connected") # No params
|
||||
@@ -67,7 +67,7 @@ singleton and start the connection:
|
||||
payment.connect("purchase_acknowledgement_error", self, "_on_purchase_acknowledgement_error") # Response ID (int), Debug message (string), Purchase token (string)
|
||||
payment.connect("purchase_consumed", self, "_on_purchase_consumed") # Purchase token (string)
|
||||
payment.connect("purchase_consumption_error", self, "_on_purchase_consumption_error") # Response ID (int), Debug message (string), Purchase token (string)
|
||||
|
||||
|
||||
payment.startConnection()
|
||||
else:
|
||||
print("Android IAP support is not enabled. Make sure you have enabled 'Custom Build' and the GodotGooglePlayBilling plugin in your Android export settings! IAP will not work.")
|
||||
@@ -111,7 +111,7 @@ Then, wait for the ``_on_purchases_updated`` callback and handle the purchase re
|
||||
for purchase in purchases:
|
||||
if purchase.purchase_state == 1: # 1 means "purchased", see https://developer.android.com/reference/com/android/billingclient/api/Purchase.PurchaseState#constants_1
|
||||
# enable_premium(purchase.sku) # unlock paid content, add coins, save token on server, etc. (you have to implement enable_premium yourself)
|
||||
if not purchase.is_acknowledged:
|
||||
if not purchase.is_acknowledged:
|
||||
payment.acknowledgePurchase(purchase.purchase_token) # call if non-consumable product
|
||||
if purchase.sku in list_of_consumable_products:
|
||||
payment.consumePurchase(purchase.purchase_token) # call if consumable product
|
||||
|
||||
@@ -349,4 +349,3 @@ Properties
|
||||
|
||||
:param * var_args:
|
||||
A variadic number of arguments to be printed as errors.
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ To build an iOS plugin:
|
||||
|
||||
- You should use the same header files for iOS plugins and for the iOS export template.
|
||||
|
||||
3. In the ``Build Settings`` tab, specify the compilation flags for your static library in ``OTHER_CFLAGS``. The most important ones are ``-fcxx-modules``, ``-fmodules``, and ``-DDEBUG`` if you need debug support. Other flags should be the same you use to compile Godot. For instance:
|
||||
3. In the ``Build Settings`` tab, specify the compilation flags for your static library in ``OTHER_CFLAGS``. The most important ones are ``-fcxx-modules``, ``-fmodules``, and ``-DDEBUG`` if you need debug support. Other flags should be the same you use to compile Godot. For instance:
|
||||
|
||||
::
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ you should remove the instance you have added by calling
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
|
||||
# plugin.gd
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
@@ -18,7 +18,7 @@ Exporting is done by using the ``[Export]`` attribute.
|
||||
[Export]
|
||||
private int Number = 5;
|
||||
}
|
||||
|
||||
|
||||
In that example the value ``5`` will be saved, and after building the current project
|
||||
it will be visible in the property editor. This way, artists and game designers
|
||||
can modify values that later influence how the program runs. For this, a
|
||||
@@ -59,7 +59,7 @@ the following to list them:
|
||||
[Export]
|
||||
private Resource Resource;
|
||||
|
||||
..
|
||||
..
|
||||
Commenting out enum examples becuase I have been told they
|
||||
require extra steps to actually work properly. The examples bellow
|
||||
will show up in the inspector but apparently do not function properly
|
||||
@@ -185,7 +185,7 @@ the slider.
|
||||
Allow values 'y = exp(x)' where 'y' varies between 100 and 1000
|
||||
while snapping to steps of 20. The editor will present a
|
||||
slider for easily editing the value. This only works with floats.
|
||||
|
||||
|
||||
.. code-block:: csharp
|
||||
|
||||
[Export(PropertyHint.ExpRange, "100,1000,20")]
|
||||
@@ -196,7 +196,7 @@ Floats with easing hint
|
||||
|
||||
Display a visual representation of the 'ease()' function
|
||||
when editing.
|
||||
|
||||
|
||||
.. code-block:: csharp
|
||||
|
||||
[Export(PropertyHint.ExpEasing)]
|
||||
@@ -232,7 +232,7 @@ a node path, then use that node path with ``GetNode()``.
|
||||
private Label MyNode;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
{
|
||||
MyNode = GetNode<Label>(MyNodePath);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ if env['p'] != '':
|
||||
|
||||
if env['platform'] == '':
|
||||
print("No valid target platform selected.")
|
||||
quit();
|
||||
quit()
|
||||
|
||||
# For the reference:
|
||||
# - CCFLAGS are compilation flags shared between C and C++
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
GDScript documentation comments
|
||||
===============================
|
||||
|
||||
In GDScript, comments can be used to document your code and add description to the
|
||||
In GDScript, comments can be used to document your code and add description to the
|
||||
members of a script. There are two differences between a normal comment and a documentation
|
||||
comment. Firstly, a documentation comment should start with double hash symbols
|
||||
``##``. Secondly, it must immediately precede a script member, or for script descriptions,
|
||||
``##``. Secondly, it must immediately precede a script member, or for script descriptions,
|
||||
be placed at the top of the script. If an exported variable is documented,
|
||||
its description is used as a tooltip in the editor. This documentation can be
|
||||
generated as XML files by the editor.
|
||||
@@ -14,7 +14,7 @@ generated as XML files by the editor.
|
||||
Documenting a script
|
||||
--------------------
|
||||
|
||||
Comments documenting a script must come before any member documentation. A
|
||||
Comments documenting a script must come before any member documentation. A
|
||||
suggested format for script documentation can be divided into three parts.
|
||||
|
||||
- A brief description of the script.
|
||||
@@ -44,23 +44,23 @@ Tags
|
||||
::
|
||||
|
||||
extends Node2D
|
||||
|
||||
##
|
||||
|
||||
##
|
||||
## A brief description of your script.
|
||||
##
|
||||
## @desc:
|
||||
## A more detailed description of the script.
|
||||
##
|
||||
##
|
||||
## @tutorial: http://the/tutorial1/url.com
|
||||
## @tutorial(Tutorial2): http://the/tutorial2/url.com
|
||||
##
|
||||
|
||||
.. warning:: If there is any space in between the tag name and colon, for example
|
||||
.. warning:: If there is any space in between the tag name and colon, for example
|
||||
``@desc :``, it won't treated as a valid tag and will be ignored.
|
||||
|
||||
|
||||
.. note:: When the description spans multiple lines, the preceding and trailing white
|
||||
spaces will be stripped and joined with a single space. To preserve the line
|
||||
spaces will be stripped and joined with a single space. To preserve the line
|
||||
break (or any other alignment), use
|
||||
:ref:`BBCode <doc_bbcode_in_richtextlabel>`.
|
||||
|
||||
@@ -69,7 +69,7 @@ Documenting script members
|
||||
|
||||
Documentation of a script member must immediately precede the member or its
|
||||
annotations if it has any. The exception to this is enum values whose description should
|
||||
be on the same line as the enum for readability.
|
||||
be on the same line as the enum for readability.
|
||||
The description can have more than one line but every line must start
|
||||
with the double hash symbol ``##`` to be considered as part of the documentation.
|
||||
The script documentation will update in the editor help window every time the
|
||||
@@ -93,37 +93,37 @@ Examples
|
||||
::
|
||||
|
||||
extends Node2D
|
||||
|
||||
##
|
||||
|
||||
##
|
||||
## A brief description of your script.
|
||||
##
|
||||
## @desc:
|
||||
## The description of the script, what it
|
||||
## can do, and any further detail.
|
||||
##
|
||||
##
|
||||
## @tutorial: http://the/tutorial1/url.com
|
||||
## @tutorial(Tutorial2): http://the/tutorial2/url.com
|
||||
##
|
||||
|
||||
|
||||
## The description of the variable v1.
|
||||
var v1
|
||||
|
||||
|
||||
## This is a multi line description of the variable v2. The type
|
||||
## information below will be extracted for the documentation.
|
||||
var v2: int
|
||||
|
||||
|
||||
## If the member has any annotation, the annotation should
|
||||
## immediately precede it.
|
||||
@export
|
||||
@onready
|
||||
var v3 := some_func()
|
||||
|
||||
|
||||
## The description of a constant.
|
||||
const GRAVITY = 9.8
|
||||
|
||||
|
||||
## The description of a signal.
|
||||
signal my_signal
|
||||
|
||||
|
||||
## This is a description of the below enums. Note below that
|
||||
## the enum values are documented on the same line as the enum.
|
||||
enum Direction {
|
||||
@@ -132,28 +132,28 @@ Examples
|
||||
LEFT = 2, ## Direction left.
|
||||
RIGHT = 3, ## Direction right.
|
||||
}
|
||||
|
||||
|
||||
## As the following function is documented, even though its name starts with
|
||||
## an underscore, it will appear in the help window.
|
||||
func _fn(p1: int, p2: String) -> int:
|
||||
return 0
|
||||
|
||||
# The below function isn't documented and its name starts with an underscore
|
||||
|
||||
# The below function isn't documented and its name starts with an underscore
|
||||
# so it will treated as private and will not be shown in the help window.
|
||||
func _internal() -> void:
|
||||
pass
|
||||
|
||||
|
||||
## Documenting an inner class.
|
||||
##
|
||||
##
|
||||
## @desc: The same rules apply apply here. The documentation must
|
||||
## immediately precede the class definition.
|
||||
##
|
||||
##
|
||||
## @tutorial: http://the/tutorial/url.com
|
||||
class Inner:
|
||||
|
||||
|
||||
## Inner class variable v4.
|
||||
var v4
|
||||
|
||||
|
||||
## Inner class function fn.
|
||||
func fn(): pass
|
||||
|
||||
@@ -202,7 +202,7 @@ be used in the documentation. Here's the list of available tags:
|
||||
|
||||
::
|
||||
|
||||
## The do_something method for this plugin. before using the
|
||||
## The do_something method for this plugin. before using the
|
||||
## method you first have to initialize [MyPlugin].
|
||||
## see : [method initialize]
|
||||
## [color=yellow]Warning:[/color] always [method clean] after use.
|
||||
|
||||
@@ -14,7 +14,7 @@ Exporting is done by using the ``@export`` annotation::
|
||||
extends Button
|
||||
|
||||
@export var number = 5
|
||||
|
||||
|
||||
In that example the value `5` will be saved and visible in the property editor.
|
||||
|
||||
An exported variable must be initialized to a constant expression or have a type specifier
|
||||
@@ -154,7 +154,7 @@ The limits can be only for the slider if you add the hints "or_greater" and/or "
|
||||
::
|
||||
|
||||
@export_range(0, 100, 1, "or_greater", "or_lesser")
|
||||
|
||||
|
||||
Allow values 'y = exp(x)' where 'y' varies between 100 and 1000
|
||||
while snapping to steps of 20. The editor will present a
|
||||
slider for easily editing the value.
|
||||
|
||||
@@ -6,7 +6,7 @@ How to read the Godot API
|
||||
On this page, you'll learn how to read the class reference for the Godot API.
|
||||
|
||||
The API, or Application Programming Interface, is an index of what Godot offers
|
||||
users. It provides a brief summary of which classes exist, how they are
|
||||
users. It provides a brief summary of which classes exist, how they are
|
||||
related to each other, what features they have, and how to use them.
|
||||
|
||||
Inheritance
|
||||
|
||||
@@ -206,7 +206,7 @@ Let's see some examples.
|
||||
export(Resource) var sub_resource
|
||||
export(Array, String) var strings
|
||||
|
||||
# Make sure that every parameter has a default value.
|
||||
# Make sure that every parameter has a default value.
|
||||
# Otherwise, there will be problems with creating and editing
|
||||
# your resource via the inspector.
|
||||
func _init(p_health = 0, p_sub_resource = null, p_strings = []):
|
||||
@@ -241,7 +241,7 @@ Let's see some examples.
|
||||
[Export]
|
||||
public String[] Strings { get; set; }
|
||||
|
||||
// Make sure that every parameter has a default value.
|
||||
// Make sure that every parameter has a default value.
|
||||
// Otherwise, there will be problems with creating and editing
|
||||
// your resource via the inspector.
|
||||
public BotStats(int health = 0, Resource subResource = null, String[] strings = null)
|
||||
|
||||
@@ -620,7 +620,7 @@ Varying can also be an array:
|
||||
ALBEDO = vec3(var_arr[0], var_arr[1], var_arr[2]); // red color
|
||||
}
|
||||
|
||||
It's also possible to send data from *fragment* to *light* processors using *varying* keyword. To do so you can assign it in the *fragment* and later use it in the *light* function.
|
||||
It's also possible to send data from *fragment* to *light* processors using *varying* keyword. To do so you can assign it in the *fragment* and later use it in the *light* function.
|
||||
|
||||
.. code-block:: glsl
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Setup
|
||||
-----
|
||||
|
||||
:ref:`CanvasItem shaders <doc_canvas_item_shader>` are used to draw all 2D
|
||||
objects in Godot, while :ref:`Spatial <doc_spatial_shader>` shaders are used
|
||||
objects in Godot, while :ref:`Spatial <doc_spatial_shader>` shaders are used
|
||||
to draw all 3D objects.
|
||||
|
||||
In order to use a shader it must be attached inside a :ref:`Material
|
||||
|
||||
@@ -242,7 +242,7 @@ You can extend the :ref:`class_RichTextEffect` resource type to create your own
|
||||
BBCode tags. You begin by extending the :ref:`class_RichTextEffect` resource type. Add
|
||||
the ``tool`` prefix to your GDScript file if you wish to have these custom effects run
|
||||
within the editor itself. The RichTextLabel does not need to have a script attached,
|
||||
nor does it need to be running in ``tool`` mode. The new effect will be activable in
|
||||
nor does it need to be running in ``tool`` mode. The new effect will be activable in
|
||||
the Inspector through the **Custom Effects** property.
|
||||
|
||||
There is only one function that you need to extend: ``_process_custom_fx(char_fx)``.
|
||||
|
||||
@@ -144,7 +144,7 @@ In addition to the plugins, there are several official demos.
|
||||
* `Godot OpenVR FPS <https://github.com/GodotVR/godot_openvr_fps>`_ (the tutorial for this project
|
||||
is :ref:`doc_vr_starter_tutorial_part_one`).
|
||||
* `Godot XR tools <https://github.com/GodotVR/godot-xr-tools>`_, which shows implementations for VR
|
||||
features such as movement and picking up objects.
|
||||
features such as movement and picking up objects.
|
||||
|
||||
Other things to consider
|
||||
------------------------
|
||||
|
||||
Reference in New Issue
Block a user