mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Merge pull request #9936 from mhilbrunner/3-6-cherrypicks
3.6 cherrypicks
This commit is contained in:
@@ -337,7 +337,8 @@ article ol,
|
||||
}
|
||||
|
||||
body,
|
||||
.rst-content table.docutils thead {
|
||||
.rst-content table.docutils thead,
|
||||
.rst-content table.docutils caption {
|
||||
color: var(--body-color);
|
||||
}
|
||||
|
||||
@@ -644,7 +645,9 @@ footer {
|
||||
}
|
||||
|
||||
.wy-body-for-nav {
|
||||
position: relative;
|
||||
background-color: var(--content-wrap-background-color);
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 769px) {
|
||||
|
||||
@@ -204,7 +204,7 @@ Windows
|
||||
- Move the Godot executable to a stable location (i.e. outside of your Downloads folder),
|
||||
so you don't accidentally move it and break the shortcut in the future.
|
||||
- Right-click the Godot executable and choose **Create Shortcut**.
|
||||
- Move the created shortcut to ``%LOCALAPPDATA%\Microsoft\Windows\Start Menu\Programs``.
|
||||
- Move the created shortcut to ``%APPDATA%\Microsoft\Windows\Start Menu\Programs``.
|
||||
This is the user-wide location for shortcuts that will appear in the Start menu.
|
||||
You can also pin Godot in the task bar by right-clicking the executable and choosing
|
||||
**Pin to Task Bar**.
|
||||
@@ -436,9 +436,6 @@ When creating a non-game application, make sure to enable
|
||||
:ref:`low-processor mode <class_ProjectSettings_property_application/run/low_processor_mode>`
|
||||
in the Project Settings to decrease CPU and GPU usage.
|
||||
|
||||
That said, we wouldn't recommend using Godot to create a *mobile* application
|
||||
since low-processor mode isn't supported on mobile platforms yet.
|
||||
|
||||
Check out `Material Maker <https://github.com/RodZill4/material-maker>`__ and
|
||||
`Pixelorama <https://github.com/Orama-Interactive/Pixelorama>`__ for examples of
|
||||
open source applications made with Godot.
|
||||
|
||||
@@ -91,6 +91,29 @@ resolve this, open **Project > Project Settings** and enable **Display > Window
|
||||
> Dpi > Allow Hidpi**. On top of that, make sure your project is configured to
|
||||
support :ref:`multiple resolutions <doc_multiple_resolutions>`.
|
||||
|
||||
The editor or project appears to have washed out colors
|
||||
-------------------------------------------------------
|
||||
|
||||
On Windows, this is usually caused by incorrect OS or monitor settings, as Godot
|
||||
currently does not support :abbr:`HDR (High Dynamic Range)` *output*
|
||||
(even though it may internally render in HDR).
|
||||
|
||||
As `most displays are not designed to display SDR content in HDR mode <https://tftcentral.co.uk/articles/heres-why-you-should-only-enable-hdr-mode-on-your-pc-when-you-are-viewing-hdr-content>`__,
|
||||
it is recommended to disable HDR in the Windows settings when not running applications
|
||||
that use HDR output. On Windows 11, this can be done by pressing
|
||||
:kbd:`Windows + Alt + B` (this shortcut is part of the Xbox Game Bar app).
|
||||
To toggle HDR automatically based on applications currently running, you can use
|
||||
`AutoActions <https://github.com/Codectory/AutoActions>`__.
|
||||
|
||||
If you insist on leaving HDR enabled, it is possible to somewhat improve the
|
||||
result by ensuring the display is configured to use :abbr:`HGIG (HDR Gaming Interest Group)`
|
||||
tonemapping (as opposed to :abbr:`DTM (Dynamic Tone Mapping)`), then
|
||||
`using the Windows HDR calibration app <https://support.microsoft.com/en-us/windows/calibrate-your-hdr-display-using-the-windows-hdr-calibration-app-f30f4809-3369-43e4-9b02-9eabebd23f19>`__.
|
||||
It is also strongly recommended to use Windows 11 instead of Windows 10 when using HDR.
|
||||
The end result will still likely be inferior to disabling HDR on the display, though.
|
||||
|
||||
Support for HDR *output* is planned in a future release.
|
||||
|
||||
The editor/project freezes or displays glitched visuals after resuming the PC from suspend
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -160,35 +160,35 @@ Example:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
/*************************************************************************/
|
||||
/* my_new_file.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* my_new_file.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MY_NEW_FILE_H
|
||||
#define MY_NEW_FILE_H
|
||||
@@ -205,35 +205,35 @@ Example:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
/*************************************************************************/
|
||||
/* my_new_file.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* my_new_file.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "my_new_file.h"
|
||||
|
||||
|
||||
@@ -347,9 +347,16 @@ do:
|
||||
|
||||
$ git push origin better-project-manager
|
||||
|
||||
Git will ask you for your username and password, and the changes will be sent
|
||||
to your remote. If you check the fork's page on GitHub, you should see a new
|
||||
branch with your added commits.
|
||||
Git will ask you for your username and password. For your password, enter your
|
||||
GitHub Personal Access Token (PAT). If you do not have a GitHub Personal Access
|
||||
Token, or do not have one with the correct permissions for your newly forked
|
||||
repository, you will need to create one. Follow this link to create your Personal
|
||||
Access Token: `Creating a personal access token
|
||||
<https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token>`_.
|
||||
|
||||
After you have successfully verified your account using your PAT, the changes
|
||||
will be sent to your remote repository. If you check the fork's page on GitHub,
|
||||
you should see a new branch with your added commits.
|
||||
|
||||
Issuing a pull request
|
||||
----------------------
|
||||
@@ -511,7 +518,7 @@ will raise an error:
|
||||
hint: Updates were rejected because the tip of your current branch is behind
|
||||
hint: its remote counterpart.
|
||||
|
||||
This is a sane behavior, Git will not let you push changes that would
|
||||
This is reasonable behavior, Git will not let you push changes that would
|
||||
override remote content. But that's actually what we want to do here, so we
|
||||
will have to *force* it:
|
||||
|
||||
@@ -523,6 +530,31 @@ And tadaa! Git will happily *replace* your remote branch with what you had
|
||||
locally (so make sure that's what you wanted, using ``git log``). This will
|
||||
also update the PR accordingly.
|
||||
|
||||
Rebasing onto another branch
|
||||
----------------------------
|
||||
|
||||
If you have accidentally opened your PR on the wrong branch, or need to target another branch
|
||||
for some reason, you might need to filter out a lot of commits that differ between the old branch
|
||||
(for example ``4.2``) and the new branch (for example ``master``). This can make rebasing difficult
|
||||
and tedious. Fortunately ``git`` has a command just for this situation, ``git rebase --onto``.
|
||||
|
||||
If your PR was created from the ``4.2`` branch and you want to update it to instead start at ``master``
|
||||
the following steps *should* fix this in one step:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ git rebase -i --onto master 4.2
|
||||
|
||||
This will take all the commits on your branch *after* the ``4.2`` branch, and then splice them on top of ``master``,
|
||||
ignoring any commits from the ``4.2`` branch not on the ``master`` branch. You may still need to do some fixing, but
|
||||
this command should save you a lot of tedious work removing commits.
|
||||
|
||||
Just like above for the interactive rebase you need to force push your branch to handle the different changes:
|
||||
|
||||
::
|
||||
|
||||
$ git push --force origin better-project-manager
|
||||
|
||||
Deleting a Git branch
|
||||
---------------------
|
||||
|
||||
|
||||
11
conf.py
11
conf.py
@@ -24,6 +24,9 @@ extensions = [
|
||||
# we can ignore this so we still can treat other warnings as errors.
|
||||
sphinx_tabs_nowarn = True
|
||||
|
||||
# Disable collapsing tabs for codeblocks.
|
||||
sphinx_tabs_disable_tab_closing = True
|
||||
|
||||
# Custom 4O4 page HTML template.
|
||||
# https://github.com/readthedocs/sphinx-notfound-page
|
||||
notfound_context = {
|
||||
@@ -113,7 +116,14 @@ supported_languages = {
|
||||
"zh_TW": "Godot Engine %s 正體中文 (台灣) 文件",
|
||||
}
|
||||
|
||||
# RTD normalized their language codes to ll-cc (e.g. zh-cn),
|
||||
# but Sphinx did not and still uses ll_CC (e.g. zh_CN).
|
||||
# `language` is the Sphinx configuration so it needs to be converted back.
|
||||
language = os.getenv("READTHEDOCS_LANGUAGE", "en")
|
||||
if "-" in language:
|
||||
(lang_name, lang_country) = language.split("-")
|
||||
language = lang_name + "_" + lang_country.upper()
|
||||
|
||||
if not language in supported_languages.keys():
|
||||
print("Unknown language: " + language)
|
||||
print("Supported languages: " + ", ".join(supported_languages.keys()))
|
||||
@@ -123,6 +133,7 @@ if not language in supported_languages.keys():
|
||||
language = "en"
|
||||
|
||||
is_i18n = tags.has("i18n") # noqa: F821
|
||||
print("Build language: {}, i18n tag: {}".format(language, is_i18n))
|
||||
|
||||
exclude_patterns = ["_build"]
|
||||
|
||||
|
||||
@@ -140,6 +140,22 @@ template from the official Godot distribution::
|
||||
|
||||
zip -q -9 -r osx.zip osx_template.app
|
||||
|
||||
Using Pyston for faster development
|
||||
-----------------------------------
|
||||
|
||||
You can use `Pyston <https://www.pyston.org/>`__ to run SCons. Pyston is a
|
||||
JIT-enabled implementation of the Python language (which SCons is written in).
|
||||
Its "full" version is currently only compatible with Linux, but Pyston-lite is
|
||||
also compatible with macOS (both x86 and ARM). Pyston can speed up incremental
|
||||
builds significantly, often by a factor between 1.5× and 2×. Pyston can be
|
||||
combined with alternative likers such as LLD or Mold to get even faster builds.
|
||||
|
||||
To install Pyston-lite, run ``python -m pip install pyston_lite_autoload`` then
|
||||
run SCons as usual. This will automatically load a subset of Pyston's
|
||||
optimizations in any Python program you run. However, this won't bring as much
|
||||
of a performance improvement compared to installing "full" Pyston (which
|
||||
currently can't be done on macOS).
|
||||
|
||||
Cross-compiling for macOS from Linux
|
||||
------------------------------------
|
||||
|
||||
|
||||
@@ -256,3 +256,10 @@ to get even faster builds.
|
||||
|
||||
If you can't run ``pyston-scons`` after creating the symbolic link,
|
||||
make sure ``$HOME/.local/bin/`` is part of your user's ``PATH`` environment variable.
|
||||
|
||||
.. note::
|
||||
|
||||
Alternatively, you can run ``python -m pip install pyston_lite_autoload``
|
||||
then run SCons as usual. This will automatically load a subset of Pyston's
|
||||
optimizations in any Python program you run. However, this won't bring as
|
||||
much of a performance improvement compared to installing "full" Pyston.
|
||||
|
||||
@@ -489,7 +489,7 @@ Run command:
|
||||
|
||||
::
|
||||
|
||||
user@host:~/godot/bin$ ./bin/<godot_binary> --doctool .
|
||||
user@host:~/godot$ ./bin/<godot_binary> --doctool .
|
||||
|
||||
Now if you go to the ``godot/modules/summator/doc_classes`` folder, you will see
|
||||
that it contains a ``Summator.xml`` file, or any other classes, that you referenced
|
||||
|
||||
@@ -29,6 +29,8 @@ Create an ``editor.entitlements`` text file with the following contents:
|
||||
<true/>
|
||||
<key>com.apple.security.device.camera</key>
|
||||
<true/>
|
||||
<key>com.apple.security.get-task-allow</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ from ``servers/`` and ``core/``, it cannot depend on includes from ``editor/``.
|
||||
|
||||
Currently, there are some dependencies to ``editor/`` includes in ``scene/``
|
||||
files, but
|
||||
`they are in the process of being removed <https://github.com/godotengine/godot/issues/29730>`__.
|
||||
`they are in the process of being removed <https://github.com/godotengine/godot/issues/53295>`__.
|
||||
|
||||
Development tips
|
||||
----------------
|
||||
|
||||
@@ -19,7 +19,7 @@ The Project manager
|
||||
-------------------
|
||||
|
||||
When you launch Godot, the first window you see is the Project Manager. In the
|
||||
default tab, "Projects," you can manage existing projects, import or create new
|
||||
default tab **Local Projects**, you can manage existing projects, import or create new
|
||||
ones, and more.
|
||||
|
||||
.. image:: img/editor_intro_project_manager.png
|
||||
|
||||
@@ -29,7 +29,7 @@ programming skills or a developer to port the game for you.
|
||||
What can the engine do?
|
||||
-----------------------
|
||||
|
||||
Godot was initially developed in-house by an Argentinan game studio. Its
|
||||
Godot was initially developed in-house by an Argentinian game studio. Its
|
||||
development started in 2001, and the engine was rewritten and improved
|
||||
tremendously since its open-source release in 2014.
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 587 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -117,12 +117,12 @@ There is more to instances. With this feature, you can:
|
||||
Let's try this. Open ``Ball.tscn`` and select the Ball node. In the Inspector on
|
||||
the right, click on the PhysicsMaterial property to expand it.
|
||||
|
||||
.. image:: img/instancing_physics_material_expand.png
|
||||
.. image:: img/instancing_physics_material_expand.webp
|
||||
|
||||
Set its Bounce property to ``2`` by clicking on the number field, typing ``2``,
|
||||
Set its Bounce property to ``0.5`` by clicking on the number field, typing ``0.5``,
|
||||
and pressing :kbd:`Enter`.
|
||||
|
||||
.. image:: img/instancing_property_bounce_updated.png
|
||||
.. image:: img/instancing_property_bounce_updated.webp
|
||||
|
||||
Play the game by pressing :kbd:`F5` and notice how all balls now bounce a lot
|
||||
more. As the Ball scene is a template for all instances, modifying it and saving
|
||||
@@ -178,7 +178,7 @@ You can come up with a diagram like this for almost any type of game. Each
|
||||
rectangle represents an entity that's visible in the game from the player's
|
||||
perspective. The arrows tell you which scene owns which.
|
||||
|
||||
Once you have a diagram, we recommended creating a scene for each element listed
|
||||
Once you have a diagram, we recommend creating a scene for each element listed
|
||||
in it to develop your game. You'll use instancing, either by code or directly in
|
||||
the editor, to build your tree of scenes.
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ our node's ``texture``.
|
||||
capitalized words separated by a space. In GDScript code, these properties
|
||||
are in "snake_case", which is lowercase with words separated by an underscore.
|
||||
|
||||
You can hover any property's name in the Inspector to see a description and
|
||||
You can hover over any property's name in the Inspector to see a description and
|
||||
its identifier in code.
|
||||
|
||||
Hello, world!
|
||||
|
||||
@@ -401,7 +401,7 @@ where they were.
|
||||
|
||||
If you want to reset the tracks in the editor, select the AnimationPlayer node,
|
||||
open the **Animation** bottom panel then choose **Apply Reset** in the
|
||||
animation editor's **Animation** dropdown menu.
|
||||
animation editor's **Edit** dropdown menu.
|
||||
|
||||
When adding tracks on new animations, the editor will ask you to automatically
|
||||
create a RESET track when using the keyframe icon next to a property in the inspector.
|
||||
|
||||
@@ -504,7 +504,7 @@ accesses:
|
||||
Child.MyMethod();
|
||||
}
|
||||
|
||||
public void PrintMe() {
|
||||
public void PrintMe()
|
||||
{
|
||||
GD.Print(GetClass());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,22 @@ Logic preferences
|
||||
Ever wondered whether one should approach problem X with strategy Y or Z?
|
||||
This article covers a variety of topics related to these dilemmas.
|
||||
|
||||
Adding nodes and changing properties: which first?
|
||||
--------------------------------------------------
|
||||
|
||||
When initializing nodes from a script at runtime, you may need to change
|
||||
properties such as the node's name or position. A common dilemma is, when
|
||||
should you change those values?
|
||||
|
||||
It is the best practice to change values on a node before adding it to the
|
||||
scene tree. Some properties setters have code to update other
|
||||
corresponding values, and that code can be slow! For most cases, this code
|
||||
has no impact on your game's performance, but in heavy use cases such as
|
||||
procedural generation, it can bring your game to a crawl.
|
||||
|
||||
For these reasons, it is always a best practice to set the initial values
|
||||
of a node before adding it to the scene tree.
|
||||
|
||||
Loading vs. preloading
|
||||
----------------------
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ Some example Exec Flags for various editors include:
|
||||
+=====================+=====================================================+
|
||||
| Geany/Kate | ``{file} --line {line} --column {col}`` |
|
||||
+---------------------+-----------------------------------------------------+
|
||||
| Atom/Sublime Text | ``{file}:{line}`` |
|
||||
| Atom | ``{file}:{line}`` |
|
||||
+---------------------+-----------------------------------------------------+
|
||||
| JetBrains Rider | ``{project} --line {line} {file}`` |
|
||||
+---------------------+-----------------------------------------------------+
|
||||
@@ -45,6 +45,8 @@ Some example Exec Flags for various editors include:
|
||||
+---------------------+-----------------------------------------------------+
|
||||
| Emacs | ``emacs +{line}:{col} {file}`` |
|
||||
+---------------------+-----------------------------------------------------+
|
||||
| Sublime Text | ``{project} {file}:{line}:{column}`` |
|
||||
+---------------------+-----------------------------------------------------+
|
||||
|
||||
.. note:: For Visual Studio Code, you will have to point to the ``code.cmd``
|
||||
file. For Emacs, you can call ``emacsclient`` instead of ``emacs`` if
|
||||
|
||||
@@ -23,7 +23,7 @@ Download the Android SDK
|
||||
|
||||
Download and install the Android SDK.
|
||||
|
||||
- You can install it using `Android Studio version 4.1 or later <https://developer.android.com/studio/>`__.
|
||||
- You can install the Android SDK using `Android Studio version 4.1 or later <https://developer.android.com/studio/>`__.
|
||||
|
||||
- Run it once to complete the SDK setup using these `instructions <https://developer.android.com/studio/intro/update#sdk-manager>`__.
|
||||
- Ensure that the `required packages <https://developer.android.com/studio/intro/update#recommended>`__ are installed as well.
|
||||
@@ -35,7 +35,7 @@ Download and install the Android SDK.
|
||||
- CMake version 3.10.2.4988404
|
||||
- NDK version r23c (23.2.8568313)
|
||||
|
||||
- You can install it using the `command line tools <https://developer.android.com/studio/#command-tools>`__.
|
||||
- Alternatively, you can install the Android SDK using the `command line tools <https://developer.android.com/studio/#command-tools>`__.
|
||||
|
||||
- Once the command line tools are installed, run the `sdkmanager <https://developer.android.com/studio/command-line/sdkmanager>`__ command to complete the setup process:
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ to save them and then tell them all to save with this script:
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
var save_nodes = get_tree().get_nodes_in_group("Persist")
|
||||
for i in save_nodes:
|
||||
for node in save_nodes:
|
||||
# Now, we can call our save function on each node.
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
@@ -38,6 +38,7 @@ Below is all the code we need to make it work. The URL points to an online API m
|
||||
|
||||
func _ready():
|
||||
$HTTPRequest.connect("request_completed", self, "_on_request_completed")
|
||||
$Button.connect("pressed", self, "_on_Button_pressed")
|
||||
|
||||
func _on_Button_pressed():
|
||||
$HTTPRequest.request("http://www.mocky.io/v2/5185415ba171ea3a00704eed")
|
||||
|
||||
@@ -8,7 +8,7 @@ Measuring performance
|
||||
|
||||
We have to know where the "bottlenecks" are to know how to speed up our program.
|
||||
Bottlenecks are the slowest parts of the program that limit the rate that
|
||||
everything can progress. Focussing on bottlenecks allows us to concentrate our
|
||||
everything can progress. Focusing on bottlenecks allows us to concentrate our
|
||||
efforts on optimizing the areas which will give us the greatest speed
|
||||
improvement, instead of spending a lot of time optimizing functions that will
|
||||
lead to small performance improvements.
|
||||
|
||||
@@ -141,6 +141,7 @@ specifically add :ref:`class_EditorProperty`-based controls.
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public class MyInspectorPlugin : EditorInspectorPlugin
|
||||
{
|
||||
public override bool CanHandle(Object @object)
|
||||
@@ -247,6 +248,7 @@ followed by ``set_bottom_editor()`` to position it below the name.
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public class RandomIntEditor : EditorProperty
|
||||
{
|
||||
// The main control for editing the property.
|
||||
|
||||
@@ -95,9 +95,10 @@ editor, and it must inherit from :ref:`class_EditorPlugin`.
|
||||
|
||||
.. warning::
|
||||
|
||||
In addition to the EditorPlugin script, any other GDScript that your plugin uses
|
||||
must *also* be a tool. Any GDScript without ``tool`` imported into the editor
|
||||
will act like an empty file!
|
||||
In addition to the EditorPlugin script, any other script that your plugin uses
|
||||
must *also* be a tool.
|
||||
* Any GDScript without ``tool`` imported into the editor will act like an empty file!
|
||||
* Any C# class without ``[Tool]`` won't be reloaded when the project is built forcing you to re-enable the plugin!
|
||||
|
||||
It's important to deal with initialization and clean-up of resources.
|
||||
A good practice is to use the virtual function
|
||||
|
||||
@@ -330,6 +330,14 @@ to change the display orientation project setting.
|
||||
and makes better use of tall smartphone displays (such as 18:9 or 19:9 aspect ratios).
|
||||
- Configure Control nodes' anchors to snap to the correct corners using the **Layout** menu.
|
||||
|
||||
.. tip::
|
||||
|
||||
To better support tablets and foldable phones (which frequently feature
|
||||
displays with aspect ratios close to 4:3), consider using a base resolution
|
||||
that has a 4:3 aspect ratio while following the rest of the instructions
|
||||
here. For instance, you can set the base window width to ``1280`` and the
|
||||
base window height to ``960``.
|
||||
|
||||
Mobile game in portrait mode
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -349,6 +357,14 @@ Mobile game in portrait mode
|
||||
and makes better use of tall smartphone displays (such as 18:9 or 19:9 aspect ratios).
|
||||
- Configure Control nodes' anchors to snap to the correct corners using the **Layout** menu.
|
||||
|
||||
.. tip::
|
||||
|
||||
To better support tablets and foldable phones (which frequently feature
|
||||
displays with aspect ratios close to 4:3), consider using a base resolution
|
||||
that has a 3:4 aspect ratio while following the rest of the instructions
|
||||
here. For instance, you can set the base window width to ``960`` and the
|
||||
base window height to ``1280``.
|
||||
|
||||
Non-game application
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ with :ref:`new() <class_CSharpScript_method_new>`.
|
||||
``Invalid call. Nonexistent function `new` in base``.
|
||||
|
||||
For example, MyCoolNode.cs should contain a class named MyCoolNode.
|
||||
|
||||
The C# class needs to derive a Godot class, for example ``Godot.Object``.
|
||||
Otherwise, the same error will occur.
|
||||
|
||||
You also need to check your ``.cs`` file is referenced in the project's
|
||||
``.csproj`` file. Otherwise, the same error will occur.
|
||||
|
||||
@@ -174,6 +174,6 @@ function
|
||||
These are quick and useful ways to switch scenes but have the drawback
|
||||
that the game will stall until the new scene is loaded and running. At
|
||||
some point in the development of your game, it may be preferable to create proper loading
|
||||
screens with progress bar, animated indicators or thread (background)
|
||||
loading. This must be done manually using autoloads (see next chapter)
|
||||
screens with progress bar, animated indicators or threaded (background)
|
||||
loading. This must be done manually using :ref:`doc_singletons_autoload`
|
||||
and :ref:`doc_background_loading`.
|
||||
|
||||
@@ -22,9 +22,9 @@ fragment functions. This tutorial targets absolute beginners to shaders.
|
||||
Setup
|
||||
-----
|
||||
|
||||
:ref:`CanvasItem <doc_canvas_item_shader>` shaders are used to draw all 2D
|
||||
objects in Godot, while :ref:`Spatial <doc_spatial_shader>` shaders are
|
||||
used to draw all 3D objects.
|
||||
: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
|
||||
to draw all 3D objects.
|
||||
|
||||
In order to use a shader it must be attached inside a :ref:`Material
|
||||
<class_material>` which must be attached to an object. Materials are a type of
|
||||
|
||||
@@ -87,9 +87,9 @@ and thus allow us to add more detail.
|
||||
.. image:: img/plane-sub.png
|
||||
|
||||
:ref:`PrimitiveMeshes <class_primitivemesh>`, like PlaneMesh, only have one
|
||||
surface, so instead of an array of materials there is only one. Click
|
||||
beside "Material" where it says "[empty]" and select "New ShaderMaterial".
|
||||
Then click the sphere that appears.
|
||||
surface, so instead of an array of materials there is only one. Click
|
||||
beside "Material" where it says "[empty]" and select "New ShaderMaterial".
|
||||
Then click the sphere that appears.
|
||||
|
||||
Now click beside "Shader" where it says "[empty]" and select "New Shader".
|
||||
|
||||
@@ -181,8 +181,8 @@ Click beside it where it says "[empty]" and select "New NoiseTexture". Then in
|
||||
your NoiseTexture click beside where it says "Noise" and select "New
|
||||
OpenSimplexNoise".
|
||||
|
||||
:ref:`OpenSimplexNoise <class_opensimplexnoise>` is used by the NoiseTexture to
|
||||
generate a heightmap.
|
||||
.. note:: :ref:`OpenSimplexNoise <class_opensimplexnoise>` is used by the NoiseTexture to
|
||||
generate a heightmap.
|
||||
|
||||
Once you set it up and should look like this.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user