From ad9a1902879eab65fe55032b23afd2af9a657b6b Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 12 Jan 2023 19:30:47 +0100 Subject: [PATCH] Remvoed class rst references. --- about/complying_with_licenses.rst | 2 +- about/faq.rst | 2 +- about/list_of_features.rst | 10 +- .../class_reference_writing_guidelines.rst | 12 +- development/cpp/object_class.rst | 10 +- .../first_2d_game/02.player_scene.rst | 2 +- .../first_2d_game/04.creating_the_enemy.rst | 14 +- .../first_2d_game/05.the_main_game_scene.rst | 14 +- .../first_2d_game/06.heads_up_display.rst | 18 +-- .../first_2d_game/07.finishing-up.rst | 4 +- getting_started/step_by_step/instancing.rst | 4 +- .../step_by_step/scripting_first_script.rst | 4 +- getting_started/step_by_step/signals.rst | 8 +- tutorials/2d/2d_lights_and_shadows.rst | 88 ++++++------- tutorials/2d/2d_movement.rst | 4 +- tutorials/2d/2d_sprite_animation.rst | 20 +-- tutorials/2d/2d_transforms.rst | 14 +- tutorials/2d/canvas_layers.rst | 18 +-- tutorials/2d/custom_drawing_in_2d.rst | 12 +- tutorials/2d/using_tilemaps.rst | 12 +- tutorials/3d/3d_rendering_limitations.rst | 2 +- tutorials/3d/csg_tools.rst | 22 ++-- tutorials/3d/high_dynamic_range.rst | 6 +- tutorials/3d/introduction_to_3d.rst | 26 ++-- tutorials/3d/lights_and_shadows.rst | 2 +- .../3d/procedural_geometry/arraymesh.rst | 28 ++-- .../procedural_geometry/immediategeometry.rst | 4 +- tutorials/3d/procedural_geometry/index.rst | 12 +- .../3d/procedural_geometry/meshdatatool.rst | 4 +- .../3d/procedural_geometry/surfacetool.rst | 8 +- tutorials/3d/using_gridmaps.rst | 2 +- tutorials/3d/using_multi_mesh_instance.rst | 6 +- tutorials/animation/animation_tree.rst | 10 +- tutorials/animation/cutout_animation.rst | 8 +- tutorials/animation/playing_videos.rst | 2 +- tutorials/assets_pipeline/import_process.rst | 4 +- tutorials/audio/audio_buses.rst | 2 +- tutorials/audio/recording_with_microphone.rst | 6 +- .../autoloads_versus_internal_nodes.rst | 4 +- tutorials/best_practices/data_preferences.rst | 28 ++-- tutorials/best_practices/godot_interfaces.rst | 22 ++-- .../best_practices/godot_notifications.rst | 20 +-- .../best_practices/logic_preferences.rst | 8 +- .../best_practices/node_alternatives.rst | 18 +-- .../best_practices/scene_organization.rst | 22 ++-- .../best_practices/scenes_versus_scripts.rst | 2 +- .../best_practices/what_are_godot_classes.rst | 8 +- tutorials/editor/command_line_tutorial.rst | 2 +- tutorials/export/exporting_pcks.rst | 4 +- tutorials/export/feature_tags.rst | 2 +- tutorials/i18n/internationalizing_games.rst | 10 +- tutorials/i18n/localization_using_gettext.rst | 2 +- .../inputs/controllers_gamepads_joysticks.rst | 4 +- tutorials/inputs/custom_mouse_cursor.rst | 4 +- tutorials/inputs/handling_quit_requests.rst | 6 +- tutorials/inputs/input_examples.rst | 36 ++--- tutorials/inputs/inputevent.rst | 70 +++++----- tutorials/io/data_paths.rst | 16 +-- tutorials/math/beziers_and_curves.rst | 6 +- tutorials/math/interpolation.rst | 8 +- tutorials/math/random_number_generation.rst | 10 +- tutorials/math/vector_math.rst | 8 +- tutorials/math/vectors_advanced.rst | 4 +- .../navigation/real_time_navigation_3d.rst | 4 +- .../networking/high_level_multiplayer.rst | 28 ++-- tutorials/networking/http_client_class.rst | 6 +- tutorials/networking/http_request_class.rst | 8 +- tutorials/networking/ssl_certificates.rst | 4 +- tutorials/networking/webrtc.rst | 4 +- tutorials/networking/websocket.rst | 2 +- tutorials/performance/batching.rst | 30 ++--- tutorials/performance/cpu_optimization.rst | 6 +- .../performance/optimizing_3d_performance.rst | 4 +- tutorials/performance/using_multimesh.rst | 4 +- tutorials/performance/using_servers.rst | 40 +++--- .../animating_thousands_of_fish.rst | 18 +-- .../controlling_thousands_of_fish.rst | 14 +- tutorials/physics/collision_shapes_3d.rst | 6 +- tutorials/physics/kinematic_character_2d.rst | 4 +- tutorials/physics/physics_introduction.rst | 52 ++++---- tutorials/physics/ragdoll_system.rst | 2 +- tutorials/physics/ray-casting.rst | 24 ++-- tutorials/physics/rigid_body.rst | 6 +- tutorials/physics/soft_body.rst | 4 +- tutorials/physics/using_area_2d.rst | 6 +- tutorials/physics/using_kinematic_body_2d.rst | 14 +- .../android/android_in_app_purchases.rst | 2 +- .../platform/customizing_html5_shell.rst | 2 +- .../platform/mobile_rendering_limitations.rst | 2 +- tutorials/plugins/editor/import_plugins.rst | 24 ++-- tutorials/plugins/editor/making_plugins.rst | 12 +- tutorials/plugins/editor/spatial_gizmos.rst | 6 +- .../plugins/running_code_in_the_editor.rst | 4 +- tutorials/rendering/multiple_resolutions.rst | 8 +- tutorials/rendering/viewports.rst | 124 +++++++++--------- .../scripting/change_scenes_manually.rst | 18 +-- .../scripting/creating_script_templates.rst | 6 +- .../scripting/cross_language_scripting.rst | 10 +- .../scripting/evaluating_expressions.rst | 4 +- .../scripting/gdscript/gdscript_basics.rst | 62 ++++----- .../scripting/gdscript/gdscript_exports.rst | 14 +- tutorials/scripting/groups.rst | 6 +- .../scripting/idle_and_physics_processing.rst | 4 +- .../scripting/nodes_and_scene_instances.rst | 2 +- tutorials/scripting/overridable_functions.rst | 6 +- tutorials/scripting/pausing_games.rst | 4 +- tutorials/scripting/resources.rst | 30 ++--- tutorials/scripting/scene_tree.rst | 26 ++-- tutorials/scripting/singletons_autoload.rst | 4 +- tutorials/shaders/advanced_postprocessing.rst | 10 +- tutorials/shaders/custom_postprocessing.rst | 12 +- tutorials/shaders/screen-reading_shaders.rst | 6 +- tutorials/shaders/shader_materials.rst | 4 +- .../shader_reference/canvas_item_shader.rst | 2 +- .../shaders/using_viewport_as_texture.rst | 52 ++++---- .../your_first_2d_shader.rst | 6 +- .../your_first_3d_shader.rst | 24 ++-- tutorials/ui/bbcode_in_richtextlabel.rst | 4 +- tutorials/ui/custom_gui_controls.rst | 14 +- tutorials/ui/gui_containers.rst | 22 ++-- tutorials/ui/gui_navigation.rst | 6 +- tutorials/ui/gui_skinning.rst | 28 ++-- tutorials/ui/gui_theme_type_variations.rst | 6 +- tutorials/ui/gui_using_theme_editor.rst | 4 +- 124 files changed, 810 insertions(+), 810 deletions(-) diff --git a/about/complying_with_licenses.rst b/about/complying_with_licenses.rst index f75df0e..833dbea 100644 --- a/about/complying_with_licenses.rst +++ b/about/complying_with_licenses.rst @@ -71,7 +71,7 @@ Some games have a special menu (often in the settings) to display licenses. Output log ^^^^^^^^^^ -Just printing the licensing text using the `print() ` +Just printing the licensing text using the `print()` function may be enough on platforms where a global output log is readable. This is the case on desktop platforms, Android and HTML5 (but not iOS and UWP). diff --git a/about/faq.rst b/about/faq.rst index e5c13a9..523873a 100644 --- a/about/faq.rst +++ b/about/faq.rst @@ -433,7 +433,7 @@ Yes! Godot features an extensive built-in UI system, and its small distribution size can make it a suitable alternative to frameworks like Electron or Qt. When creating a non-game application, make sure to enable -`low-processor mode ` +`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 diff --git a/about/list_of_features.rst b/about/list_of_features.rst index 20984a5..719301b 100644 --- a/about/list_of_features.rst +++ b/about/list_of_features.rst @@ -563,11 +563,11 @@ The editor UI can easily be extended in many ways using add-ons. - Anchors to keep GUI elements in a specific corner, edge or centered. - Containers to place GUI elements automatically following certain rules. - - `Stack ` layouts. - - `Grid ` layouts. - - `Margin ` and `centered ` + - `Stack` layouts. + - `Grid` layouts. + - `Margin` layouts. - - `Draggable splitter ` layouts. + - `Draggable splitter` layouts. - Scale to multiple resolutions using the ``2d`` or ``viewport`` stretch modes. - Support any aspect ratio using anchors and the ``expand`` stretch aspect. @@ -591,7 +591,7 @@ Animation ^^^^^^^^^ - Direct kinematics and inverse kinematics. -- `Tween ` node to easily perform procedural animations by code. +- `Tween` node to easily perform procedural animations by code. - Support for animating any property with customizable interpolation. - Support for calling methods in animation tracks. - Support for playing sounds in animation tracks. diff --git a/community/contributing/class_reference_writing_guidelines.rst b/community/contributing/class_reference_writing_guidelines.rst index 590d080..6ea8653 100644 --- a/community/contributing/class_reference_writing_guidelines.rst +++ b/community/contributing/class_reference_writing_guidelines.rst @@ -127,17 +127,17 @@ the text. Here's the list of available tags: +============================+======================================+===================================+===================================================+ | [Class] | Link a class | Move the [Sprite]. | Move the `class_Sprite`. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ -| [method methodname] | Link to a method in this class | Call [method hide]. | Call `hide `. | +| [method methodname] | Link to a method in this class | Call [method hide]. | Call `hide`. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ -| [method Class.methodname] | Link to another class's method | Call [method Spatial.hide]. | Call `hide `. | +| [method Class.methodname] | Link to another class's method | Call [method Spatial.hide]. | Call `hide`. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ -| [member membername] | Link to a member in this class | Get [member scale]. | Get `scale `. | +| [member membername] | Link to a member in this class | Get [member scale]. | Get `scale`. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ -| [member Class.membername] | Link to another class's member | Get [member Node2D.scale]. | Get `scale `. | +| [member Class.membername] | Link to another class's member | Get [member Node2D.scale]. | Get `scale`. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ -| [signal signalname] | Link to a signal in this class | Emit [signal renamed]. | Emit `renamed `. | +| [signal signalname] | Link to a signal in this class | Emit [signal renamed]. | Emit `renamed`. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ -| [signal Class.signalname] | Link to another class's signal | Emit [signal Node.renamed]. | Emit `renamed `. | +| [signal Class.signalname] | Link to another class's signal | Emit [signal Node.renamed]. | Emit `renamed`. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ | [b] [/b] | Bold | Some [b]bold[/b] text. | Some **bold** text. | +----------------------------+--------------------------------------+-----------------------------------+---------------------------------------------------+ diff --git a/development/cpp/object_class.rst b/development/cpp/object_class.rst index ffd26de..2a12441 100644 --- a/development/cpp/object_class.rst +++ b/development/cpp/object_class.rst @@ -6,12 +6,12 @@ Object class .. seealso:: This page describes the C++ implementation of objects in Godot. - Looking for the Object class reference? `Have a look here. ` + Looking for the Object class reference? `Have a look here.` General definition ------------------ -`Object ` is the base class for almost everything. Most classes in Godot +`Object` is the base class for almost everything. Most classes in Godot inherit directly or indirectly from it. Objects provide reflection and editable properties, and declaring them is a matter of using a single macro like this. @@ -240,14 +240,14 @@ Adding signals to a class is done in ``_bind_methods``, using the Notifications ------------- -All objects in Godot have a `_notification ` +All objects in Godot have a `_notification` method that allows it to respond to engine level callbacks that may relate to it. More information can be found on the `doc_godot_notifications` page. References ---------- -`Reference ` inherits from Object and holds a +`Reference` inherits from Object and holds a reference count. It is the base for reference counted object types. Declaring them must be done using Ref<> template. For example: @@ -270,7 +270,7 @@ References: Resources: ---------- -`Resource ` inherits from Reference, so all resources +`Resource` inherits from Reference, so all resources are reference counted. Resources can optionally contain a path, which reference a file on disk. This can be set with ``resource.set_path(path)``. This is normally done by the resource loader though. No two different diff --git a/getting_started/first_2d_game/02.player_scene.rst b/getting_started/first_2d_game/02.player_scene.rst index 6404c19..c010025 100644 --- a/getting_started/first_2d_game/02.player_scene.rst +++ b/getting_started/first_2d_game/02.player_scene.rst @@ -80,7 +80,7 @@ heading. .. image:: img/player_scale.png -Finally, add a `CollisionShape2D ` as a child of +Finally, add a `CollisionShape2D` as a child of ``Player``. This will determine the player's "hitbox", or the bounds of its collision area. For this character, a ``CapsuleShape2D`` node gives the best fit, so next to "Shape" in the Inspector, click "[empty]"" -> "New diff --git a/getting_started/first_2d_game/04.creating_the_enemy.rst b/getting_started/first_2d_game/04.creating_the_enemy.rst index 7af1838..9f2b826 100644 --- a/getting_started/first_2d_game/04.creating_the_enemy.rst +++ b/getting_started/first_2d_game/04.creating_the_enemy.rst @@ -15,23 +15,23 @@ Node setup Click Scene -> New Scene and add the following nodes: -- `RigidBody2D ` (named ``Mob``) +- `RigidBody2D` (named ``Mob``) - - `AnimatedSprite ` - - `CollisionShape2D ` - - `VisibilityNotifier2D ` + - `AnimatedSprite` + - `CollisionShape2D` + - `VisibilityNotifier2D` Don't forget to set the children so they can't be selected, like you did with the Player scene. -In the `RigidBody2D ` properties, set ``Gravity Scale`` +In the `RigidBody2D` properties, set ``Gravity Scale`` to ``0``, so the mob will not fall downward. In addition, under the -`CollisionObject2D ` section, click the ``Mask`` property and uncheck the first +`CollisionObject2D` section, click the ``Mask`` property and uncheck the first box. This will ensure the mobs do not collide with each other. .. image:: img/set_collision_mask.png -Set up the `AnimatedSprite ` like you did for the +Set up the `AnimatedSprite` like you did for the player. This time, we have 3 animations: ``fly``, ``swim``, and ``walk``. There are two images for each animation in the art folder. diff --git a/getting_started/first_2d_game/05.the_main_game_scene.rst b/getting_started/first_2d_game/05.the_main_game_scene.rst index 1680a87..3b3c471 100644 --- a/getting_started/first_2d_game/05.the_main_game_scene.rst +++ b/getting_started/first_2d_game/05.the_main_game_scene.rst @@ -5,7 +5,7 @@ The main game scene Now it's time to bring everything we did together into a playable game scene. -Create a new scene and add a `Node ` named ``Main``. +Create a new scene and add a `Node` named ``Main``. (The reason we are using Node instead of Node2D is because this node will be a container for handling game logic. It does not require 2D functionality itself.) @@ -17,13 +17,13 @@ Click the **Instance** button (represented by a chain link icon) and select your Now, add the following nodes as children of ``Main``, and name them as shown (values are in seconds): -- `Timer ` (named ``MobTimer``) - to control how often mobs +- `Timer` (named ``MobTimer``) - to control how often mobs spawn -- `Timer ` (named ``ScoreTimer``) - to increment the score +- `Timer` (named ``ScoreTimer``) - to increment the score every second -- `Timer ` (named ``StartTimer``) - to give a delay before +- `Timer` (named ``StartTimer``) - to give a delay before starting -- `Position2D ` (named ``StartPosition``) - to indicate +- `Position2D` (named ``StartPosition``) - to indicate the player's start position Set the ``Wait Time`` property of each of the ``Timer`` nodes as follows: @@ -39,7 +39,7 @@ Spawning mobs ~~~~~~~~~~~~~ The Main node will be spawning new mobs, and we want them to appear at a random -location on the edge of the screen. Add a `Path2D ` node +location on the edge of the screen. Add a `Path2D` node named ``MobPath`` as a child of ``Main``. When you select ``Path2D``, you will see some new buttons at the top of the editor: @@ -61,7 +61,7 @@ intersecting lines, respectively. After placing point ``4`` in the image, click the "Close Curve" button and your curve will be complete. -Now that the path is defined, add a `PathFollow2D ` +Now that the path is defined, add a `PathFollow2D` node as a child of ``MobPath`` and name it ``MobSpawnLocation``. This node will automatically rotate and follow the path as it moves, so we can use it to select a random position and direction along the path. diff --git a/getting_started/first_2d_game/06.heads_up_display.rst b/getting_started/first_2d_game/06.heads_up_display.rst index 32dd2ab..12d4c5e 100644 --- a/getting_started/first_2d_game/06.heads_up_display.rst +++ b/getting_started/first_2d_game/06.heads_up_display.rst @@ -6,11 +6,11 @@ Heads up display The final piece our game needs is a User Interface (UI) to display things like score, a "game over" message, and a restart button. -Create a new scene, and add a `CanvasLayer ` node named +Create a new scene, and add a `CanvasLayer` node named ``HUD``. "HUD" stands for "heads-up display", an informational display that appears as an overlay on top of the game view. -The `CanvasLayer ` node lets us draw our UI elements on +The `CanvasLayer` node lets us draw our UI elements on a layer above the rest of the game, so that the information it displays isn't covered up by any game elements like the player or mobs. @@ -20,16 +20,16 @@ The HUD needs to display the following information: - A message, such as "Game Over" or "Get Ready!" - A "Start" button to begin the game. -The basic node for UI elements is `Control `. To create our -UI, we'll use two types of `Control ` nodes: `Label -` and `Button `. +The basic node for UI elements is `Control`. To create our +UI, we'll use two types of `Control` nodes: `Label +` and `Button`. Create the following as children of the ``HUD`` node: -- `Label ` named ``ScoreLabel``. -- `Label ` named ``Message``. -- `Button ` named ``StartButton``. -- `Timer ` named ``MessageTimer``. +- `Label` named ``ScoreLabel``. +- `Label` named ``Message``. +- `Button` named ``StartButton``. +- `Timer` named ``MessageTimer``. Click on the ``ScoreLabel`` and type a number into the ``Text`` field in the Inspector. The default font for ``Control`` nodes is small and doesn't scale diff --git a/getting_started/first_2d_game/07.finishing-up.rst b/getting_started/first_2d_game/07.finishing-up.rst index 9a035cd..fd76154 100644 --- a/getting_started/first_2d_game/07.finishing-up.rst +++ b/getting_started/first_2d_game/07.finishing-up.rst @@ -12,7 +12,7 @@ Background ~~~~~~~~~~ The default gray background is not very appealing, so let's change its color. -One way to do this is to use a `ColorRect ` node. Make it +One way to do this is to use a `ColorRect` node. Make it the first node under ``Main`` so that it will be drawn behind the other nodes. ``ColorRect`` only has one property: ``Color``. Choose a color you like and select "Layout" -> "Full Rect" so that it covers the screen. @@ -28,7 +28,7 @@ experience. In your game assets folder, you have two sound files: "House In a Forest Loop.ogg" for background music, and "gameover.wav" for when the player loses. -Add two `AudioStreamPlayer ` nodes as children of +Add two `AudioStreamPlayer` nodes as children of ``Main``. Name one of them ``Music`` and the other ``DeathSound``. On each one, click on the ``Stream`` property, select "Load", and choose the corresponding audio file. diff --git a/getting_started/step_by_step/instancing.rst b/getting_started/step_by_step/instancing.rst index 237eca7..adf544f 100644 --- a/getting_started/step_by_step/instancing.rst +++ b/getting_started/step_by_step/instancing.rst @@ -15,8 +15,8 @@ pack information about your scene's content. Here's an example of a ball. It's composed of a `RigidBody2D ` node as its root named Ball, which allows the ball to fall -and bounce on walls, a `Sprite ` node, and a -`CollisionShape2D `. +and bounce on walls, a `Sprite` node, and a +`CollisionShape2D`. .. image:: img/instancing_ball_scene.png diff --git a/getting_started/step_by_step/scripting_first_script.rst b/getting_started/step_by_step/scripting_first_script.rst index bf4baa3..9696ddb 100644 --- a/getting_started/step_by_step/scripting_first_script.rst +++ b/getting_started/step_by_step/scripting_first_script.rst @@ -102,7 +102,7 @@ node, including classes it extends, like ``Node2D``, ``CanvasItem``, and ``Node``. .. note:: In GDScript, if you omit the line with the ``extends`` keyword, your - class will implicitly extend `Reference `, which + class will implicitly extend `Reference`, which Godot uses to manage your application's memory. Inherited properties include the ones you can see in the Inspector dock, like @@ -253,7 +253,7 @@ is a vector pointing forward relative to our icon. Multiplied by our ``speed`` property, it gives us a velocity we can use to move the node forward. We add ``velocity * delta`` to the node's ``position`` to move it. The position -itself is of type `Vector2 `, a built-in type in Godot +itself is of type `Vector2`, a built-in type in Godot representing a 2D vector. Run the scene to see the Godot head run in circles. diff --git a/getting_started/step_by_step/signals.rst b/getting_started/step_by_step/signals.rst index 54f59c2..6befed0 100644 --- a/getting_started/step_by_step/signals.rst +++ b/getting_started/step_by_step/signals.rst @@ -198,7 +198,7 @@ Connecting a signal via code You can connect signals via code instead of using the editor. This is necessary when you create nodes or instantiate scenes inside of a script. -Let's use a different node here. Godot has a `Timer ` node +Let's use a different node here. Godot has a `Timer` node that's useful to implement skill cooldown times, weapon reloading, and more. Head back to the 2D workspace. You can either click the "2D" text at the top of @@ -229,11 +229,11 @@ We need to do two operations to connect the nodes via code: listen to the Timer's "timeout" signal. We want to connect the signal when the scene is instantiated, and we can do that -using the `Node._ready() ` built-in function, +using the `Node._ready()` built-in function, which is called automatically by the engine when a node is fully instantiated. To get a reference to a node relative to the current one, we use the method -`Node.get_node() `. We can store the reference +`Node.get_node()`. We can store the reference in a variable. gdscript GDScript @@ -393,7 +393,7 @@ Signals have many uses. With them, you can react to a node entering or exiting the game world, to a collision, to a character entering or leaving an area, to an element of the interface changing size, and much more. -For example, an `Area2D ` representing a coin emits a +For example, an `Area2D` representing a coin emits a ``body_entered`` signal whenever the player's physics body enters its collision shape, allowing you to know when the player collected it. diff --git a/tutorials/2d/2d_lights_and_shadows.rst b/tutorials/2d/2d_lights_and_shadows.rst index 21dabcb..aea4be1 100644 --- a/tutorials/2d/2d_lights_and_shadows.rst +++ b/tutorials/2d/2d_lights_and_shadows.rst @@ -46,33 +46,33 @@ Nodes ----- The demo uses four different nodes: - * `CanvasModulate ` - * `Sprite ` - * `Light2D ` - * `LightOccluder2D ` + * `CanvasModulate` + * `Sprite` + * `Light2D` + * `LightOccluder2D` `CanvasModulate` is used to darken the scene. -`Sprites ` are used to display the textures for the light blobs, the +`Sprites` are used to display the textures for the light blobs, the background, and for the shadow casters. -`Light2Ds ` are used to light the scene. The way a light typically works +`Light2Ds` are used to light the scene. The way a light typically works is by adding a selected texture over the rest of the scene to simulate lighting. But it can be used in other ways, for example masking out parts of the scene. -`LightOccluder2Ds ` are used to tell the shader which parts of -the scene cast shadows. The shadows appear only on areas covered by the `Light2D ` and -their direction is based on the center of the `Light `. +`LightOccluder2Ds` are used to tell the shader which parts of +the scene cast shadows. The shadows appear only on areas covered by the `Light2D` and +their direction is based on the center of the `Light`. Lights ------ -`Lights ` cover the entire extent of their respective Texture. They use additive +`Lights` cover the entire extent of their respective Texture. They use additive blending to add the color of their texture to the scene. .. image:: img/light_shadow_light.png -`Lights ` have four ``Modes``: ``Add``, ``Sub``, ``Mix``, and ``Mask``. +`Lights` have four ``Modes``: ``Add``, ``Sub``, ``Mix``, and ``Mask``. ``Add`` adds the color of the light texture to the scene. It brightens the area under the light. @@ -84,24 +84,24 @@ halfway between the color of the light and the color underneath. ``Mask`` is used to mask out areas that are covered by the light. Masked out areas are hidden or revealed based on the color of the light. -For the demo the lights have two components, the `Light ` itself (which -is the effect of the light), and a `Sprite ` blob which is an image showing the -location of the light source. A child `Sprite ` is not necessary to make a -`Light ` work. +For the demo the lights have two components, the `Light` itself (which +is the effect of the light), and a `Sprite` blob which is an image showing the +location of the light source. A child `Sprite` is not necessary to make a +`Light` work. .. image:: img/light_shadow_light_blob.png Shadows ------- -Shadows are made by intersecting a `Light ` with a `LightOccluder2D `. +Shadows are made by intersecting a `Light`. -By default shadows are turned off. To turn them on click on the `Light ` +By default shadows are turned off. To turn them on click on the `Light` and under the Shadows section check ``Enabled``. -In the demo we are using a `Sprite ` with a Texture on it to make the "Shadow Casters", -but in reality all you need is a couple of `LightOccluder2Ds `. By itself -the `LightOccluder2D ` looks like a dark spot and in this demo the `Sprite ` is +In the demo we are using a `Sprite` with a Texture on it to make the "Shadow Casters", +but in reality all you need is a couple of `LightOccluder2Ds`. By itself +the `LightOccluder2D` is just a black square. Step by step @@ -110,23 +110,23 @@ Step by step Now that we have covered the basics of the nodes being used, we can now walk step by step through the process of making a scene like the one found in the demo. -First add a `Sprite ` and set its texture to the `background image `_. For your game this can be any +First add a `Sprite`_. For your game this can be any background you choose. For this style of shadow it is most likely to be a floor texture. .. image:: img/light_shadow_background.png -Next create three `Light2D's ` and set their textures to the `light image `_. You can alter their +Next create three `Light2D's`_. You can alter their color in the top section. By default shadows are turned off and the ``mode`` is set to ``add``. This means that each light adds its own color to whatever is underneath. .. image:: img/light_shadow_all_lights_no_blob.png -Next add a child `Sprite ` to each of the `Light ` nodes, and set -the `Sprite's ` texture to the `blob image `_. Each of these -should stay centered on the `Light ` node. The blob is the image of the light -itself while the `Light ` shows the effect that the light has on the scene. The -`LightOccluder2D's ` will treat the position of the light as the center of the `Light ` -node, which is why we want the blob to be centered on its parent `Light `. +Next add a child `Sprite` nodes, and set +the `Sprite's`_. Each of these +should stay centered on the `Light` node. The blob is the image of the light +itself while the `Light` shows the effect that the light has on the scene. The +`LightOccluder2D's` +node, which is why we want the blob to be centered on its parent `Light`. .. image:: img/light_shadow_all_lights.png @@ -134,30 +134,30 @@ node, which is why we want the blob to be centered on its parent `Light ` in the scene. The -`CanvasModulate ` multiples the entire viewport by a specific color. +This is why the demo uses a `CanvasModulate` in the scene. The +`CanvasModulate` multiples the entire viewport by a specific color. -Add a `CanvasModulate ` to the scene and set its color to ``rgb(70, 70, 70)``. +Add a `CanvasModulate` to the scene and set its color to ``rgb(70, 70, 70)``. This will make the scene sufficiently dark to see the effects of the lights distinctly. .. image:: img/light_shadow_ambient.png Now we add the shadow casters. -The demo uses a `Node ` named "casters" to organize the shadow casters. Add a -`Node2D ` to the scene. It will be used to group all the shadow casters together. +The demo uses a `Node` named "casters" to organize the shadow casters. Add a +`Node2D` to the scene. It will be used to group all the shadow casters together. This way we can show and hide them all at the same time. -Each shadow caster is made of a `Sprite `, with a `LightOccluder2D ` -child. For the demo the `Sprite ` has a texture -set to the `caster image `_ and nothing else. The child `LightOccluder2D ` is where all the magic happens. In a -game the `Sprite ` could be more than a black box; it could be an image of whatever object is casting +Each shadow caster is made of a `Sprite` +child. For the demo the `Sprite` has a texture +set to the `caster image `_ and nothing else. The child `LightOccluder2D` is where all the magic happens. In a +game the `Sprite` could be more than a black box; it could be an image of whatever object is casting the shadow: a wall, a magical chest, or anything else. .. image:: img/light_shadow_sprites.png -`LightOccluder2Ds ` tell the game what shape the occluder has. They hold -an `OccluderPolygon2D `, which is a container +`LightOccluder2Ds` tell the game what shape the occluder has. They hold +an `OccluderPolygon2D`, which is a container for a polygon and some other information. For this demo, since our wall is a square, we set ``Polygon`` to a square. The other default settings are fine. @@ -169,8 +169,8 @@ will cast a shadow no matter which side the light is on. The other two settings ``Counter-Clockwise`` refer to the winding order of the vertices of the polygon. The winding order is used to determine which side of the line is inside the polygon. Only outward facing lines cast shadows. -To illustrate the difference, here is an image of a `LightOccluder2D ` with ``Closed`` -set to ``off`` in the corresponding `OccluderPolygon2D `, so that the +To illustrate the difference, here is an image of a `LightOccluder2D` with ``Closed`` +set to ``off`` in the corresponding `OccluderPolygon2D`, so that the lines of the polygon can be seen: .. image:: img/light_shadow_cull_disabled.png @@ -187,8 +187,8 @@ lines of the polygon can be seen: If ``Closed`` was set to ``on`` there would be an additional vertical line on the left which would cast a shadow as well. -When you have added the `LightOccluder2Ds ` the shadows still won't -appear. You need to go back into the `Light2Ds ` and under the Shadow +When you have added the `LightOccluder2Ds` the shadows still won't +appear. You need to go back into the `Light2Ds` and under the Shadow section set ``Enable`` to ``on``. This turns on shadows with hard edges like in the image below. .. image:: img/light_shadow_filter0_pcf0.png @@ -219,7 +219,7 @@ forming between the samples. .. note:: ``filter smooth`` is set to ``30``. -The different `Light ` nodes in the demo use different values for filter smooth. +The different `Light` nodes in the demo use different values for filter smooth. Play around with it and see what you like. .. image:: img/light_shadow_filter0.png diff --git a/tutorials/2d/2d_movement.rst b/tutorials/2d/2d_movement.rst index fd2640c..9577907 100644 --- a/tutorials/2d/2d_movement.rst +++ b/tutorials/2d/2d_movement.rst @@ -10,7 +10,7 @@ Every beginner has been there: "How do I move my character?" Depending on the style of game you're making, you may have special requirements, but in general the movement in most 2D games is based on a small number of designs. -We'll use `KinematicBody2D ` for these examples, +We'll use `KinematicBody2D` for these examples, but the principles will apply to other node types (Area2D, RigidBody2D) as well. .. _doc_2d_movement_setup: @@ -159,7 +159,7 @@ gdscript GDScript velocity = move_and_slide(velocity) ``` -Here we're using the `Node2D ` ``look_at()`` method to +Here we're using the `Node2D` ``look_at()`` method to point the player towards a given position. Without this function, you could get the same effect by setting the angle like this: diff --git a/tutorials/2d/2d_sprite_animation.rst b/tutorials/2d/2d_sprite_animation.rst index e6047d4..f22031f 100644 --- a/tutorials/2d/2d_sprite_animation.rst +++ b/tutorials/2d/2d_sprite_animation.rst @@ -11,10 +11,10 @@ characters with the AnimatedSprite class and the AnimationPlayer. Typically, whe will come in one of two ways: as individual images or as a single sprite sheet containing all the animation's frames. Both can be animated in Godot with the AnimatedSprite class. -First, we'll use `AnimatedSprite ` to +First, we'll use `AnimatedSprite` to animate a collection of individual images. Then we will animate a sprite sheet using this class. Finally, we will learn another way to animate a sprite sheet -with `AnimationPlayer ` and the *Animation* -property of `Sprite `. +with `AnimationPlayer` and the *Animation* +property of `Sprite`. .. note:: Art for the following examples by https://opengameart.org/users/ansimuz and by https://opengameart.org/users/tgfcoder @@ -36,8 +36,8 @@ with the following nodes: .. image:: img/2d_animation_tree1.png -.. note:: The root node could also be `Area2D ` or - `RigidBody2D `. The animation will still be +.. note:: The root node could also be `Area2D` or + `RigidBody2D`. The animation will still be made in the same way. Once the animation is completed, you can assign a shape to the CollisionShape2D. See `Physics Introduction ` for more @@ -128,8 +128,8 @@ Sprite sheet with AnimationPlayer --------------------------------- Another way that you can animate when using a sprite sheet is to use a standard -`Sprite ` node to display the texture, and then animating the -change from texture to texture with `AnimationPlayer `. +`Sprite` node to display the texture, and then animating the +change from texture to texture with `AnimationPlayer`. Consider this sprite sheet, which contains 6 frames of animation: @@ -143,8 +143,8 @@ setting up your scene tree: .. image:: img/2d_animation_tree2.png -.. note:: The root node could also be `Area2D ` or - `RigidBody2D `. The animation will still be +.. note:: The root node could also be `Area2D` or + `RigidBody2D`. The animation will still be made in the same way. Once the animation is completed, you can assign a shape to the CollisionShape2D. See `Physics Introduction ` for more @@ -208,7 +208,7 @@ gdscript GDScript (for example, a platformer may update the sprite's ``h_flip``/``v_flip`` properties when a character turns while starting a 'turning' animation), it's important to keep in mind that ``play()`` isn't applied instantly. - Instead, it's applied the next time the `AnimationPlayer ` is processed. + Instead, it's applied the next time the `AnimationPlayer` is processed. This may end up being on the next frame, causing a 'glitch' frame, where the property change was applied but the animation was not. If this turns out to be a problem, after calling ``play()``, you can call ``advance(0)`` diff --git a/tutorials/2d/2d_transforms.rst b/tutorials/2d/2d_transforms.rst index d199b0e..6ef6429 100644 --- a/tutorials/2d/2d_transforms.rst +++ b/tutorials/2d/2d_transforms.rst @@ -17,7 +17,7 @@ As mentioned in the previous tutorial, `doc_canvas_layers`, every CanvasItem node (remember that Node2D and Control based nodes use CanvasItem as their common root) will reside in a *Canvas Layer*. Every canvas layer has a transform (translation, rotation, scale, etc.) that -can be accessed as a `Transform2D `. +can be accessed as a `Transform2D`. Also covered in the previous tutorial, nodes are drawn by default in Layer 0, in the built-in canvas. To put nodes in a different layer, a `CanvasLayer @@ -27,7 +27,7 @@ Global canvas transform ----------------------- Viewports also have a Global Canvas transform (also a -`Transform2D `). This is the master transform and +`Transform2D`). This is the master transform and affects all individual *Canvas Layer* transforms. Generally, this transform is not of much use, but is used in the CanvasItem Editor in Godot's editor. @@ -40,10 +40,10 @@ resizing or stretching the screen. This transform is used internally (as described in `doc_multiple_resolutions`), but can also be manually set on each viewport. -Input events received in the `MainLoop._input_event() ` +Input events received in the `MainLoop._input_event()` callback are multiplied by this transform but lack the ones above. To convert InputEvent coordinates to local CanvasItem coordinates, the -`CanvasItem.make_input_local() ` +`CanvasItem.make_input_local()` function was added for convenience. Transform order @@ -62,11 +62,11 @@ Obtaining each transform can be achieved with the following functions: +----------------------------------+---------------------------------------------------------------------------------------------+ | Type | Transform | +==================================+=============================================================================================+ -| CanvasItem | `CanvasItem.get_global_transform() ` | +| CanvasItem | `CanvasItem.get_global_transform()` | +----------------------------------+---------------------------------------------------------------------------------------------+ -| CanvasLayer | `CanvasItem.get_canvas_transform() ` | +| CanvasLayer | `CanvasItem.get_canvas_transform()` | +----------------------------------+---------------------------------------------------------------------------------------------+ -| CanvasLayer+GlobalCanvas+Stretch | `CanvasItem.get_viewport_transform() ` | +| CanvasLayer+GlobalCanvas+Stretch | `CanvasItem.get_viewport_transform()` | +----------------------------------+---------------------------------------------------------------------------------------------+ Finally, then, to convert a CanvasItem local coordinates to screen diff --git a/tutorials/2d/canvas_layers.rst b/tutorials/2d/canvas_layers.rst index 9c4f245..daacef7 100644 --- a/tutorials/2d/canvas_layers.rst +++ b/tutorials/2d/canvas_layers.rst @@ -6,20 +6,20 @@ Canvas layers Viewport and Canvas items ------------------------- -`CanvasItem ` is the base for all 2D nodes, be it regular -2D nodes, such as `Node2D `, or `Control `. -Both inherit from `CanvasItem `. +`CanvasItem` is the base for all 2D nodes, be it regular +2D nodes, such as `Node2D`. +Both inherit from `CanvasItem`. You can arrange canvas items in trees. Each item will inherit its parent's transform: when the parent moves, its children move too. CanvasItem nodes, and nodes inheriting from them, are direct or indirect children of a -`Viewport `, that display them. +`Viewport`, that display them. A Viewport has the property -`Viewport.canvas_transform `, -allows to apply a custom `Transform2D ` +`Viewport.canvas_transform`, +allows to apply a custom `Transform2D` transform to the CanvasItem hierarchy it contains. Nodes such as -`Camera2D ` work by changing that transform. +`Camera2D` work by changing that transform. To achieve effects like scrolling, manipulating the canvas transform property is more efficient than moving the root canvas item and the entire scene with it. @@ -37,7 +37,7 @@ How can these problems be solved in a single scene tree? CanvasLayers ------------ -The answer is `CanvasLayer `, +The answer is `CanvasLayer`, which is a node that adds a separate 2D rendering layer for all its children and grand-children. Viewport children will draw by default at layer "0", while a CanvasLayer will draw at any numeric layer. Layers @@ -61,4 +61,4 @@ their layer number, so they can be instantiated when needed. The standard way to ensuring that a node is correctly drawn 'in front' or 'behind' others is to manipulate the order of the nodes in the scene panel. Perhaps counterintuitively, the topmost nodes in the scene panel are drawn on *behind* lower ones in the viewport. 2d nodes also have a property for controlling their drawing order - (see `Node2D.z_index `). + (see `Node2D.z_index`). diff --git a/tutorials/2d/custom_drawing_in_2d.rst b/tutorials/2d/custom_drawing_in_2d.rst index 087c608..2f298ad 100644 --- a/tutorials/2d/custom_drawing_in_2d.rst +++ b/tutorials/2d/custom_drawing_in_2d.rst @@ -10,7 +10,7 @@ Godot has nodes to draw sprites, polygons, particles, and all sorts of stuff. For most cases, this is enough; but not always. Before crying in fear, angst, and rage because a node to draw that specific *something* does not exist... it would be good to know that it is possible to easily make any 2D node (be it -`Control ` or `Node2D ` +`Control` based) draw custom commands. It is *really* easy to do it, too. Custom drawing in a 2D node is *really* useful. Here are some use cases: @@ -30,9 +30,9 @@ Custom drawing in a 2D node is *really* useful. Here are some use cases: Drawing ------- -Add a script to any `CanvasItem ` -derived node, like `Control ` or -`Node2D `. Then override the ``_draw()`` function. +Add a script to any `CanvasItem` +derived node, like `Control` or +`Node2D`. Then override the ``_draw()`` function. gdscript GDScript @@ -44,7 +44,7 @@ gdscript GDScript pass ``` -Draw commands are described in the `CanvasItem ` +Draw commands are described in the `CanvasItem` class reference. There are plenty of them. Updating @@ -54,7 +54,7 @@ The ``_draw()`` function is only called once, and then the draw commands are cached and remembered, so further calls are unnecessary. If re-drawing is required because a state or something else changed, -call `CanvasItem.update() ` +call `CanvasItem.update()` in that same node and a new ``_draw()`` call will happen. Here is a little more complex example, a texture variable that will be diff --git a/tutorials/2d/using_tilemaps.rst b/tutorials/2d/using_tilemaps.rst index 898482c..84de034 100644 --- a/tutorials/2d/using_tilemaps.rst +++ b/tutorials/2d/using_tilemaps.rst @@ -7,9 +7,9 @@ Introduction ------------ A tilemap is a grid of tiles used to create a game's layout. There are several -benefits to using `TileMap ` nodes to design your levels. +benefits to using `TileMap` nodes to design your levels. First, they make it possible to draw the layout by "painting" the tiles onto a -grid, which is much faster than placing individual `Sprite ` +grid, which is much faster than placing individual `Sprite` nodes one by one. Second, they allow for much larger levels because they are optimized for drawing large numbers of tiles. Finally, you can add collision, occlusion, and navigation shapes to tiles, adding additional functionality to @@ -36,7 +36,7 @@ off ``Filter`` and click "Reimport". See `doc_import_images` for details. TileMap node ------------ -Add a new `TileMap ` node to the scene. By default, a TileMap +Add a new `TileMap` node to the scene. By default, a TileMap uses a square grid of tiles. You can also use a perspective-based "Isometric" mode or define your own custom tile shape. @@ -71,8 +71,8 @@ Creating a TileSet ------------------ Once you've configured your tilemap, it's time to add a -`TileSet `. A TileSet is a -`Resource ` that contains the data about your +`TileSet`. A TileSet is a +`Resource` that contains the data about your tiles - their textures, collision shapes, and other properties. When the game runs, the TileMap combines the individual tiles into a single object. @@ -340,7 +340,7 @@ to take effect. Tips and tricks --------------- -- If you're using a `Camera2D ` to scroll your level, you +- If you're using a `Camera2D` to scroll your level, you may notice lines appearing between your tiles. To fix this, open Project Settings and enable **Use Gpu Pixel Snap** in the **Rendering > 2d > Snapping** section. diff --git a/tutorials/3d/3d_rendering_limitations.rst b/tutorials/3d/3d_rendering_limitations.rst index 06bfe9b..3ab8073 100644 --- a/tutorials/3d/3d_rendering_limitations.rst +++ b/tutorials/3d/3d_rendering_limitations.rst @@ -91,7 +91,7 @@ In Godot, transparent materials are drawn after opaque materials. Transparent objects are sorted back to front before being drawn based on the Spatial's position, not the vertex position in world space. Due to this, overlapping objects may often be sorted out of order. To fix improperly sorted objects, tweak -the material's `Render Priority ` +the material's `Render Priority` property. This will force specific materials to appear in front or behind of other transparent materials. Even then, this may not always be sufficient. diff --git a/tutorials/3d/csg_tools.rst b/tutorials/3d/csg_tools.rst index d978415..2509f89 100644 --- a/tutorials/3d/csg_tools.rst +++ b/tutorials/3d/csg_tools.rst @@ -29,13 +29,13 @@ Introduction to CSG nodes Like other features of Godot, CSG is supported in the form of nodes. These are the CSG nodes: -- `CSGBox ` -- `CSGCylinder ` (also supports cone) -- `CSGSphere ` -- `CSGTorus ` -- `CSGPolygon ` -- `CSGMesh ` -- `CSGCombiner ` +- `CSGBox` +- `CSGCylinder` (also supports cone) +- `CSGSphere` +- `CSGTorus` +- `CSGPolygon` +- `CSGMesh` +- `CSGCombiner` .. image:: img/csg_nodes.png @@ -59,7 +59,7 @@ Every CSG node supports 3 kinds of boolean operations: CSGPolygon ~~~~~~~~~~ -The `CSGPolygon ` node extrude along a Polygon drawn in +The `CSGPolygon` node extrude along a Polygon drawn in 2D (in X, Y coordinates) in the following ways: - **Depth:** Extruded back a given amount. @@ -71,7 +71,7 @@ The `CSGPolygon ` node extrude along a Polygon drawn in .. image:: img/csg_poly.png -.. note:: The **Path** mode must be provided with a `Path ` +.. note:: The **Path** mode must be provided with a `Path` node to work. In the Path node, draw the path and the polygon in CSGPolygon will extrude along the given path. @@ -79,7 +79,7 @@ The `CSGPolygon ` node extrude along a Polygon drawn in Custom meshes ~~~~~~~~~~~~~ -Any mesh can be used for `CSGMesh `; the mesh can be +Any mesh can be used for `CSGMesh`; the mesh can be modelled in other software and imported into Godot. Multiple materials are supported. There are some restrictions for geometry: @@ -93,7 +93,7 @@ supported. There are some restrictions for geometry: CSGCombiner ~~~~~~~~~~~ -The `CSGCombiner ` node is an empty shape used for +The `CSGCombiner` node is an empty shape used for organization. It will only combine children nodes. Processing order diff --git a/tutorials/3d/high_dynamic_range.rst b/tutorials/3d/high_dynamic_range.rst index fd6947d..7c3ca9b 100644 --- a/tutorials/3d/high_dynamic_range.rst +++ b/tutorials/3d/high_dynamic_range.rst @@ -101,7 +101,7 @@ Scene linear to display-referred nonlinear After all the rendering is done, the scene linear render requires transforming to a suitable output such as an sRGB display. To do this, enable sRGB conversion -in the current `Environment ` (more on that below). +in the current `Environment` (more on that below). Keep in mind that the **sRGB -> Display Linear** and **Display Linear -> sRGB** conversions must always be **both** enabled. Failing to enable one of them will @@ -111,8 +111,8 @@ indie games. Parameters of HDR ----------------- -HDR settings can be found in the `Environment ` +HDR settings can be found in the `Environment` resource. Most of the time, these are found inside a -`WorldEnvironment ` +`WorldEnvironment` node or set in a Camera node. For more information, see `doc_environment_and_post_processing`. diff --git a/tutorials/3d/introduction_to_3d.rst b/tutorials/3d/introduction_to_3d.rst index c7d55dc..5dc4cb0 100644 --- a/tutorials/3d/introduction_to_3d.rst +++ b/tutorials/3d/introduction_to_3d.rst @@ -19,9 +19,9 @@ to develop 3D games efficiently. Spatial node ~~~~~~~~~~~~ -`Node2D ` is the base node for 2D. -`Control ` is the base node for everything GUI. -Following this reasoning, the 3D engine uses the `Spatial ` +`Node2D` is the base node for 2D. +`Control` is the base node for everything GUI. +Following this reasoning, the 3D engine uses the `Spatial` node for everything 3D. .. image:: img/tuto_3d1.png @@ -29,7 +29,7 @@ node for everything 3D. Spatial nodes have a local transform, which is relative to the parent node (as long as the parent node is also of **or inherits from** the type Spatial). This transform can be accessed as a 4×3 -`Transform `, or as 3 `Vector3 ` +`Transform` members representing location, Euler rotation (X, Y and Z angles) and scale. @@ -56,16 +56,16 @@ entire scenes (just as they look in the DCC), including animation, skeletal rigs, blend shapes, etc. The second pipeline is by importing simple .OBJ files as mesh resources, -which can be then put inside a `MeshInstance ` +which can be then put inside a `MeshInstance` node for display. Generated geometry ------------------ It is possible to create custom geometry by using the -`ArrayMesh ` resource directly. Simply create your arrays -and use the `ArrayMesh.add_surface_from_arrays() ` -function. A helper class is also available, `SurfaceTool `, +`ArrayMesh` resource directly. Simply create your arrays +and use the `ArrayMesh.add_surface_from_arrays()` +function. A helper class is also available, `SurfaceTool`, which provides a more straightforward API and helpers for indexing, generating normals, tangents, etc. @@ -78,7 +78,7 @@ Immediate geometry If, instead, there is a requirement to generate simple geometry that will be updated often, Godot provides a special node, -`ImmediateGeometry `, +`ImmediateGeometry`, which provides an OpenGL 1.x style immediate-mode API to create points, lines, triangles, etc. @@ -88,8 +88,8 @@ lines, triangles, etc. While Godot packs a powerful 2D engine, many types of games use 2D in a 3D environment. By using a fixed camera (either orthogonal or perspective) that does not rotate, nodes such as -`Sprite3D ` and -`AnimatedSprite3D ` +`Sprite3D` and +`AnimatedSprite3D` can be used to create 2D games that take advantage of mixing with 3D backgrounds, more realistic parallax, lighting/shadow effects, etc. @@ -101,7 +101,7 @@ Environment ~~~~~~~~~~~ Besides editing a scene, it is often common to edit the environment. -Godot provides a `WorldEnvironment ` +Godot provides a `WorldEnvironment` node that allows changing the background color, mode (as in, put a skybox), and applying several types of built-in post-processing effects. Environments can also be overridden in the Camera. @@ -193,7 +193,7 @@ Cameras ------- No matter how many objects are placed in the 3D space, nothing will be -displayed unless a `Camera ` is +displayed unless a `Camera` is also added to the scene. Cameras can work in either orthogonal or perspective projections: diff --git a/tutorials/3d/lights_and_shadows.rst b/tutorials/3d/lights_and_shadows.rst index 18b2e82..fd317ec 100644 --- a/tutorials/3d/lights_and_shadows.rst +++ b/tutorials/3d/lights_and_shadows.rst @@ -13,7 +13,7 @@ result. Light can come from several types of sources in a scene: it does not affect nearby objects unless baked). - Light Nodes: Directional, Omni and Spot. - Ambient Light in the - `Environment `. + `Environment`. - Baked Light (read `doc_baked_lightmaps`). The emission color is a material property. You can read more about it diff --git a/tutorials/3d/procedural_geometry/arraymesh.rst b/tutorials/3d/procedural_geometry/arraymesh.rst index 6a27052..d704352 100644 --- a/tutorials/3d/procedural_geometry/arraymesh.rst +++ b/tutorials/3d/procedural_geometry/arraymesh.rst @@ -3,9 +3,9 @@ Using the ArrayMesh =================== -This tutorial will present the basics of using an `ArrayMesh `. +This tutorial will present the basics of using an `ArrayMesh`. -To do so, we will use the function `add_surface_from_arrays() `, +To do so, we will use the function `add_surface_from_arrays()`, which takes up to four parameters. The first two are required, while the second two are optional. The first parameter is the ``PrimitiveType``, an OpenGL concept that instructs the GPU @@ -32,40 +32,40 @@ See also `Mesh.ArrayType `. * - 0 - ``ARRAY_VERTEX`` - - `PoolVector3Array ` or `PoolVector2Array ` + - `PoolVector3Array` * - 1 - ``ARRAY_NORMAL`` - - `PoolVector3Array ` + - `PoolVector3Array` * - 2 - ``ARRAY_TANGENT`` - - `PoolRealArray ` of groups of 4 floats. First 3 floats determine the tangent, and + - `PoolRealArray` of groups of 4 floats. First 3 floats determine the tangent, and the last the binormal direction as -1 or 1. * - 3 - ``ARRAY_COLOR`` - - `PoolColorArray ` + - `PoolColorArray` * - 4 - ``ARRAY_TEX_UV`` - - `PoolVector2Array ` or `PoolVector3Array ` + - `PoolVector2Array` * - 5 - ``ARRAY_TEX_UV2`` - - `PoolVector2Array ` or `PoolVector3Array ` + - `PoolVector2Array` * - 6 - ``ARRAY_BONES`` - - `PoolRealArray ` of groups of 4 floats or `PoolIntArray ` of groups of 4 ints. Each group lists indexes of 4 bones that affects a given vertex. + - `PoolRealArray` of groups of 4 ints. Each group lists indexes of 4 bones that affects a given vertex. * - 7 - ``ARRAY_WEIGHTS`` - - `PoolRealArray ` of groups of 4 floats. Each float lists the amount of weight an determined bone on ``ARRAY_BONES`` has on a given vertex. + - `PoolRealArray` of groups of 4 floats. Each float lists the amount of weight an determined bone on ``ARRAY_BONES`` has on a given vertex. * - 8 - ``ARRAY_INDEX`` - - `PoolIntArray ` + - `PoolIntArray` The array of vertices (at index 0) is always required. The index array is optional and will only be used if included. We won't use it in this tutorial. @@ -73,12 +73,12 @@ All the other arrays carry information about the vertices. They are also optiona use one entry per vertex to provide extra information about vertices. They must have the same size as the vertex array. Other arrays (e.g. ``ARRAY_TANGENT``) use four entries to describe a single vertex. These must be exactly four times larger than the vertex array. -For normal usage, the last two parameters in `add_surface_from_arrays() ` are typically left empty. +For normal usage, the last two parameters in `add_surface_from_arrays()` are typically left empty. ArrayMesh --------- -In the editor, create a `MeshInstance ` and add an `ArrayMesh ` to it in the Inspector. +In the editor, create a `MeshInstance` to it in the Inspector. Normally, adding an ArrayMesh in the editor is not useful, but in this case it allows us to access the ArrayMesh from code without creating one. @@ -239,7 +239,7 @@ gdscript GDScript Saving ------ -Finally, we can use the `ResourceSaver ` class to save the ArrayMesh. +Finally, we can use the `ResourceSaver` class to save the ArrayMesh. This is useful when you want to generate a mesh and then use it later without having to re-generate it. gdscript GDScript diff --git a/tutorials/3d/procedural_geometry/immediategeometry.rst b/tutorials/3d/procedural_geometry/immediategeometry.rst index 9019eca..264d3eb 100644 --- a/tutorials/3d/procedural_geometry/immediategeometry.rst +++ b/tutorials/3d/procedural_geometry/immediategeometry.rst @@ -3,7 +3,7 @@ Using ImmediateGeometry ======================= -Unlike the SurfaceTool or ArrayMesh, `ImmediateGeometry ` is an actual +Unlike the SurfaceTool or ArrayMesh, `ImmediateGeometry` is an actual node. Being a node makes it quick to add to a scene and get visual output. It uses an OpenGL 1.x-style API like SurfaceTool, but it's actually designed to create meshes on the fly. @@ -17,7 +17,7 @@ not call ``clear()``. To begin generating geometry you must call ``begin()``. ``begin()`` takes a ``PrimitiveType`` as an argument. ``PrimitiveType`` is an OpenGL concept that instructs the GPU how to arrange the primitive based on the vertices given whether it is triangles, lines, points, etc. A complete list can be found under -the `Mesh ` class reference page. +the `Mesh` class reference page. Once you have called ``begin()`` you are ready to start adding vertices. You add vertices one at a time. First you add vertex specific attributes such as normals or UVs using ``set_****()`` (e.g. ``set_normal()``). diff --git a/tutorials/3d/procedural_geometry/index.rst b/tutorials/3d/procedural_geometry/index.rst index bdc6150..2888a7f 100644 --- a/tutorials/3d/procedural_geometry/index.rst +++ b/tutorials/3d/procedural_geometry/index.rst @@ -25,9 +25,9 @@ by an array of positions called "vertices". In Godot, geometry is represented by What is a Mesh? --------------- -Many things in Godot have mesh in their name: the `Mesh `, the `ArrayMesh `, -the `MeshInstance `, the `MultiMesh `, and -the `MultiMeshInstance `. While they are all related, they have slightly different uses. +Many things in Godot have mesh in their name: the `Mesh`, +the `MeshInstance`, and +the `MultiMeshInstance`. While they are all related, they have slightly different uses. Meshes and ArrayMeshes are resources that are drawn using a MeshInstance node. Resources like Meshes and ArrayMeshes cannot be added to the scene directly. A MeshInstance represents one @@ -47,21 +47,21 @@ What a Mesh is A Mesh is composed of one or more surfaces. A surface is an array composed of multiple sub-arrays containing vertices, normals, UVs, etc. Normally the process of constructing surfaces and meshes is -hidden from the user in the `VisualServer `, but with ArrayMeshes, the user can construct a Mesh +hidden from the user in the `VisualServer`, but with ArrayMeshes, the user can construct a Mesh manually by passing in an array containing the surface information. Surfaces ^^^^^^^^ Each surface has its own material. Alternatively, you can override the material for all surfaces -in the Mesh when you use a MeshInstance using the `material_override ` property. +in the Mesh when you use a MeshInstance using the `material_override` property. Surface array ^^^^^^^^^^^^^ The surface array is an array of length ``ArrayMesh.ARRAY_MAX``. Each position in the array is filled with a sub-array containing per-vertex information. For example, the array located at -``ArrayMesh.ARRAY_NORMAL`` is a `PoolVector3Array ` of vertex normals. +``ArrayMesh.ARRAY_NORMAL`` is a `PoolVector3Array` of vertex normals. See `Mesh.ArrayType ` for more information. The surface array can be indexed or non-indexed. Creating a non-indexed array is as easy as not assigning diff --git a/tutorials/3d/procedural_geometry/meshdatatool.rst b/tutorials/3d/procedural_geometry/meshdatatool.rst index df18570..9dec4a0 100644 --- a/tutorials/3d/procedural_geometry/meshdatatool.rst +++ b/tutorials/3d/procedural_geometry/meshdatatool.rst @@ -3,7 +3,7 @@ Using the MeshDataTool ====================== -The `MeshDataTool ` is not used to generate geometry. But it is helpful for dynamically altering geometry, for example +The `MeshDataTool` is not used to generate geometry. But it is helpful for dynamically altering geometry, for example if you want to write a script to tessellate, simplify, or deform meshes. The MeshDataTool is not as fast as altering arrays directly using ArrayMesh. However, it provides more information @@ -61,7 +61,7 @@ gdscript GDScript ``` These modifications are not done in place on the ArrayMesh. If you are dynamically updating an existing ArrayMesh, -first delete the existing surface before adding a new one using `commit_to_surface() `: +first delete the existing surface before adding a new one using `commit_to_surface()`: gdscript GDScript diff --git a/tutorials/3d/procedural_geometry/surfacetool.rst b/tutorials/3d/procedural_geometry/surfacetool.rst index 7e6b2d4..62a144d 100644 --- a/tutorials/3d/procedural_geometry/surfacetool.rst +++ b/tutorials/3d/procedural_geometry/surfacetool.rst @@ -3,8 +3,8 @@ Using the SurfaceTool ===================== -The `SurfaceTool ` provides a useful interface for constructing geometry. -The interface is similar to the `ImmediateGeometry ` node. You +The `SurfaceTool` provides a useful interface for constructing geometry. +The interface is similar to the `ImmediateGeometry` node. You set each per-vertex attribute (e.g. normal, uv, color) and then when you add a vertex it captures the attributes. @@ -22,8 +22,8 @@ gdscript GDScript st.add_normal() # Normal never added to a vertex. ``` -When finished generating your geometry with the `SurfaceTool ` -call ``commit()`` to finish generating the mesh. If an `ArrayMesh ` is passed +When finished generating your geometry with the `SurfaceTool` +call ``commit()`` to finish generating the mesh. If an `ArrayMesh` is passed to ``commit()`` then it appends a new surface to the end of the ArrayMesh. While if nothing is passed in, ``commit()`` returns an ArrayMesh. diff --git a/tutorials/3d/using_gridmaps.rst b/tutorials/3d/using_gridmaps.rst index 0b3c1b4..63a3473 100644 --- a/tutorials/3d/using_gridmaps.rst +++ b/tutorials/3d/using_gridmaps.rst @@ -6,7 +6,7 @@ Using GridMaps Introduction ------------ -`Gridmaps ` are a tool for creating 3D +`Gridmaps` are a tool for creating 3D game levels, similar to the way `TileMap ` works in 2D. You start with a predefined collection of 3D meshes (a `class_MeshLibrary`) that can be placed on a grid, diff --git a/tutorials/3d/using_multi_mesh_instance.rst b/tutorials/3d/using_multi_mesh_instance.rst index e005546..b967e1b 100644 --- a/tutorials/3d/using_multi_mesh_instance.rst +++ b/tutorials/3d/using_multi_mesh_instance.rst @@ -6,13 +6,13 @@ Using MultiMeshInstance Introduction ~~~~~~~~~~~~ -In a normal scenario, you would use a `MeshInstance ` +In a normal scenario, you would use a `MeshInstance` node to display a 3D mesh like a human model for the main character, but in some cases, you would like to create multiple instances of the same mesh in a scene. You *could* duplicate the same node multiple times and adjust the transforms manually. This may be a tedious process and the result may look mechanical. Also, this method is not conducive to rapid iterations. -`MultiMeshInstance ` is one of the possible +`MultiMeshInstance` is one of the possible solutions to this problem. MultiMeshInstance, as the name suggests, creates multiple copies of a @@ -31,7 +31,7 @@ on. In the tree example, this would be the landscape. The other node is used as the source, the mesh that you want to have duplicated. In the tree case, this would be the tree itself. -In our example, we would use a `Spatial ` node as the root node of +In our example, we would use a `Spatial` node as the root node of the scene. Your scene tree would look like this: .. image:: img/multimesh_scene_tree.png diff --git a/tutorials/animation/animation_tree.rst b/tutorials/animation/animation_tree.rst index 53da67d..8b5d5f7 100644 --- a/tutorials/animation/animation_tree.rst +++ b/tutorials/animation/animation_tree.rst @@ -6,13 +6,13 @@ Using AnimationTree Introduction ------------ -With `AnimationPlayer `, Godot has one of the most flexible animation systems that you can find in any game engine. +With `AnimationPlayer`, Godot has one of the most flexible animation systems that you can find in any game engine. The ability to animate almost any property in any node or resource, as well as having dedicated transform, bezier, function calling, audio and sub-animation tracks, is pretty much unique. However, the support for blending those animations via ``AnimationPlayer`` is relatively limited, as only a fixed cross-fade transition time can be set. -`AnimationTree ` is a new node introduced in Godot 3.1 to deal with advanced transitions. +`AnimationTree` is a new node introduced in Godot 3.1 to deal with advanced transitions. It supersedes the ancient ``AnimationTreePlayer``, while adding a huge amount of features and flexibility. Creating an AnimationTree @@ -193,7 +193,7 @@ transformation visually (the animation will stay in place). .. image:: img/animtree14.png -Afterwards, the actual motion can be retrieved via the `AnimationTree ` API as a transform: +Afterwards, the actual motion can be retrieved via the `AnimationTree` API as a transform: gdscript GDScript @@ -201,7 +201,7 @@ gdscript GDScript anim_tree.get_root_motion_transform() ``` -This can be fed to functions such as `KinematicBody.move_and_slide ` to control the character movement. +This can be fed to functions such as `KinematicBody.move_and_slide` to control the character movement. There is also a tool node, ``RootMotionView``, that can be placed in a scene and will act as a custom floor for your character and animations (this node is disabled by default during the game). @@ -250,7 +250,7 @@ current state to another one, while visiting all the intermediate ones. This is In the absence of any viable set of transitions starting at the current state and finishing at the destination state, the graph teleports to the destination state. -To use the travel ability, you should first retrieve the `AnimationNodeStateMachinePlayback ` +To use the travel ability, you should first retrieve the `AnimationNodeStateMachinePlayback` object from the ``AnimationTree`` node (it is exported as a property). diff --git a/tutorials/animation/cutout_animation.rst b/tutorials/animation/cutout_animation.rst index ed7a18f..d3a285d 100644 --- a/tutorials/animation/cutout_animation.rst +++ b/tutorials/animation/cutout_animation.rst @@ -39,7 +39,7 @@ Godot provides tools for working with cutout rigs, and is ideal for the workflow selectively for complex parts such as hands, feet, changing facial expressions, etc. - **Custom Shaped Elements**: Custom shapes can be created with - `Polygon2D ` + `Polygon2D` allowing UV animation, deformations, etc. - **Particle Systems**: A cutout animation rig can be combined with particle systems. This can be useful for magic effects, jetpacks, etc. @@ -87,7 +87,7 @@ and dragging with the left mouse button. To exit rotate mode hit :kbd:`ESC`. The rotation pivot is wrong and needs to be adjusted. -This small cross in the middle of the `Sprite ` is +This small cross in the middle of the `Sprite` is the rotation pivot: .. image:: img/tuto_cutout4.png @@ -130,7 +130,7 @@ of the torso. We'll fix this problem with ``RemoteTransform2D`` nodes. RemoteTransform2D node ~~~~~~~~~~~~~~~~~~~~~~ -The `RemoteTransform2D ` node transforms nodes +The `RemoteTransform2D` node transforms nodes somewhere else in the hierarchy. This node applies its own transform (including any transformation it inherits from its parents) to the remote node it targets. @@ -193,7 +193,7 @@ node with its parent. And there's currently no child of the hand node. With this knowledge let's try again. The first step is creating an endpoint node. Any kind of node will do, -but `Position2D ` is preferred because it's +but `Position2D` is preferred because it's visible in the editor. The endpoint node will ensure that the last bone has orientation. diff --git a/tutorials/animation/playing_videos.rst b/tutorials/animation/playing_videos.rst index f05a27a..44b94f7 100644 --- a/tutorials/animation/playing_videos.rst +++ b/tutorials/animation/playing_videos.rst @@ -144,7 +144,7 @@ There are several limitations with the current implementation of video playback - Changing playback speed is not supported. VideoPlayer also won't follow `Engine.time_scale`. - Looping is not supported, but you can connect a VideoPlayer's - `finished ` signal to a function + `finished` signal to a function that plays the video again. However, this will cause a black frame to be visible when the video restarts. This can be worked around by adding a fade to black in the video file before the video ends, or by hiding the video for one diff --git a/tutorials/assets_pipeline/import_process.rst b/tutorials/assets_pipeline/import_process.rst index e0c49ad..d7dd2ca 100644 --- a/tutorials/assets_pipeline/import_process.rst +++ b/tutorials/assets_pipeline/import_process.rst @@ -20,11 +20,11 @@ and keep the imported resources hidden in a ``res://.import`` folder. This means that when trying to access imported assets through code you need to use the `Resource Loader` as it will automatically take into account where the internal files are saved. If you -try and access an imported asset using the `File ` class +try and access an imported asset using the `File` class it will work in the editor, but break in the exported project. However, the `Resource Loader` cannot access -non imported files, only the `File ` class can. +non imported files, only the `File` class can. Changing import parameters -------------------------- diff --git a/tutorials/audio/audio_buses.rst b/tutorials/audio/audio_buses.rst index 878770c..51a3d18 100644 --- a/tutorials/audio/audio_buses.rst +++ b/tutorials/audio/audio_buses.rst @@ -258,7 +258,7 @@ Reverb Reverb simulates rooms of different sizes. It has adjustable parameters that can be tweaked to obtain the sound of a specific room. Reverb is commonly outputted -from `Areas ` +from `Areas` (see `Reverb buses `), or to apply a "chamber" feel to all sounds. diff --git a/tutorials/audio/recording_with_microphone.rst b/tutorials/audio/recording_with_microphone.rst index e567ac8..1ab3891 100644 --- a/tutorials/audio/recording_with_microphone.rst +++ b/tutorials/audio/recording_with_microphone.rst @@ -43,9 +43,9 @@ gdscript GDScript The audio recording is handled by the `class_AudioEffectRecord` resource which has three methods: -`get_recording() `, -`is_recording_active() `, -and `set_recording_active() `. +`get_recording()`, +`is_recording_active()`, +and `set_recording_active()`. gdscript GDScript diff --git a/tutorials/best_practices/autoloads_versus_internal_nodes.rst b/tutorials/best_practices/autoloads_versus_internal_nodes.rst index 828e48e..e8d23b9 100644 --- a/tutorials/best_practices/autoloads_versus_internal_nodes.rst +++ b/tutorials/best_practices/autoloads_versus_internal_nodes.rst @@ -6,7 +6,7 @@ Autoloads versus regular nodes Godot offers a feature to automatically load nodes at the root of your project, allowing you to access them globally, that can fulfill the role of a Singleton: `doc_singletons_autoload`. These auto-loaded nodes are not freed when you -change the scene from code with `SceneTree.change_scene `. +change the scene from code with `SceneTree.change_scene`. In this guide, you will learn when to use the Autoload feature, and techniques you can use to avoid it. @@ -72,7 +72,7 @@ that feature for an individual scene using the `class_name When it comes to data, you can either: -1. Create a new type of `Resource ` to share the data. +1. Create a new type of `Resource` to share the data. 2. Store the data in an object to which each node has access, for example using the ``owner`` property to access the scene's root node. diff --git a/tutorials/best_practices/data_preferences.rst b/tutorials/best_practices/data_preferences.rst index 6ad1c9b..2a18138 100644 --- a/tutorials/best_practices/data_preferences.rst +++ b/tutorials/best_practices/data_preferences.rst @@ -42,8 +42,8 @@ Array vs. Dictionary vs. Object Godot stores all variables in the scripting API in the `Variant `_ class. Variants can store Variant-compatible data structures such as -`Array ` and `Dictionary ` as well as -`Object ` s. +`Array` as well as +`Object` s. Godot implements Array as a ``Vector``. The engine stores the Array contents in a contiguous section of memory, i.e. they are in a row adjacent @@ -54,7 +54,7 @@ to each other. array object in traditional C++ libraries. It is a "templated" type, meaning that its records can only contain a particular type (denoted by angled brackets). So, for example, a - `PoolStringArray ` would be something like + `PoolStringArray` would be something like a ``Vector``. Contiguous memory stores imply the following operation performance: @@ -167,7 +167,7 @@ do not. An overview of their operational details is as follows: Godot implements Objects as stupid, but dynamic containers of data content. Objects query data sources when posed questions. For example, to answer the question, "do you have a property called, 'position'?", it might ask -its `script ` or the `ClassDB `. +its `script`. One can find more information about what objects are and how they work in the `doc_what_are_godot_classes` article. @@ -283,7 +283,7 @@ AnimatedTexture vs. AnimatedSprite vs. AnimationPlayer vs. AnimationTree Under what circumstances should one use each of Godot's animation classes? The answer may not be immediately clear to new Godot users. -`AnimatedTexture ` is a texture that +`AnimatedTexture` is a texture that the engine draws as an animated loop rather than a static image. Users can manipulate... @@ -291,21 +291,21 @@ Users can manipulate... 2. the number of regions contained within the texture (frames). -Godot's `VisualServer ` then draws +Godot's `VisualServer` then draws the regions in sequence at the prescribed rate. The good news is that this involves no extra logic on the part of the engine. The bad news is that users have very little control. -Also note that AnimatedTexture is a `Resource ` unlike -the other `Node ` objects discussed here. One might create -a `Sprite ` node that uses AnimatedTexture as its texture. +Also note that AnimatedTexture is a `Resource` unlike +the other `Node` objects discussed here. One might create +a `Sprite` node that uses AnimatedTexture as its texture. Or (something the others can't do) one could add AnimatedTextures as tiles -in a `TileSet ` and integrate it with a -`TileMap ` for many auto-animating backgrounds that +in a `TileSet` and integrate it with a +`TileMap` for many auto-animating backgrounds that all render in a single batched draw call. The AnimatedSprite node, in combination with the -`SpriteFrames ` resource, allows one to create a +`SpriteFrames` resource, allows one to create a variety of animation sequences through spritesheets, flip between animations, and control their speed, regional offset, and orientation. This makes them well-suited to controlling 2D frame-based animations. @@ -313,7 +313,7 @@ well-suited to controlling 2D frame-based animations. If one needs trigger other effects in relation to animation changes (for example, create particle effects, call functions, or manipulate other peripheral elements besides the frame-based animation), then will need to use -an `AnimationPlayer ` node in conjunction with +an `AnimationPlayer` node in conjunction with the AnimatedSprite. AnimationPlayers are also the tool one will need to use if they wish to design @@ -332,6 +332,6 @@ While one needs an AnimationPlayer to design each of the individual animation sequences for a game, it can also be useful to combine animations for blending, i.e. enabling smooth transitions between these animations. There may also be a hierarchical structure between animations that one plans out for -their object. These are the cases where the `AnimationTree ` +their object. These are the cases where the `AnimationTree` shines. One can find an in-depth guide on using the AnimationTree `here `. diff --git a/tutorials/best_practices/godot_interfaces.rst b/tutorials/best_practices/godot_interfaces.rst index 693e70a..12231ea 100644 --- a/tutorials/best_practices/godot_interfaces.rst +++ b/tutorials/best_practices/godot_interfaces.rst @@ -15,7 +15,7 @@ The rest of this tutorial outlines the various ways of doing all this. Acquiring object references --------------------------- -For all `Object `\s, the most basic way of referencing them +For all `Object`\s, the most basic way of referencing them is to get a reference to an existing object from another acquired instance. gdscript GDScript @@ -25,9 +25,9 @@ gdscript GDScript var obj = node.get_object() # Method access. ``` -The same principle applies for `Reference ` objects. -While users often access `Node ` and -`Resource ` this way, alternative measures are available. +The same principle applies for `Reference` objects. +While users often access `Node` and +`Resource` this way, alternative measures are available. Instead of property or method access, one can get Resources by load access. @@ -72,7 +72,7 @@ Note the following: 3. Keep in mind that loading a resource fetches the cached resource instance maintained by the engine. To get a new object, one must - `duplicate ` an existing reference + `duplicate` an existing reference or instantiate one from scratch with ``new()``. Nodes likewise have an alternative access point: the SceneTree. @@ -140,10 +140,10 @@ Godot's scripting API is duck-typed. This means that if a script executes an operation, Godot doesn't validate that it supports the operation by **type**. It instead checks that the object **implements** the individual method. -For example, the `CanvasItem ` class has a ``visible`` +For example, the `CanvasItem` class has a ``visible`` property. All properties exposed to the scripting API are in fact a setter and getter pair bound to a name. If one tried to access -`CanvasItem.visible `, then Godot would do the +`CanvasItem.visible`, then Godot would do the following checks, in order: - If the object has a script attached, it will attempt to set the property @@ -166,9 +166,9 @@ following checks, in order: is also the case with the ``_get_property_list`` method. - Note that this happens even for non-legal symbol names such as in the - case of `TileSet `'s "1/tile_name" property. This + case of `TileSet`'s "1/tile_name" property. This refers to the name of the tile with ID 1, i.e. - `TileSet.tile_get_name(1) `. + `TileSet.tile_get_name(1)`. As a result, this duck-typed system can locate a property either in the script, the object's class, or any class that object inherits, but only for things @@ -199,7 +199,7 @@ gdscript GDScript ``` - A method check. In the case of - `CanvasItem.visible `, one can + `CanvasItem.visible`, one can access the methods, ``set_visible`` and ``is_visible`` like any other method. gdscript GDScript @@ -262,7 +262,7 @@ gdscript GDScript # group can fill in for it. ``` -- Outsource the access to a `FuncRef `. These may be useful +- Outsource the access to a `FuncRef`. These may be useful in cases where one needs the max level of freedom from dependencies. In this case, one relies on an external context to setup the method. diff --git a/tutorials/best_practices/godot_notifications.rst b/tutorials/best_practices/godot_notifications.rst index 10a7115..4f04df1 100644 --- a/tutorials/best_practices/godot_notifications.rst +++ b/tutorials/best_practices/godot_notifications.rst @@ -4,10 +4,10 @@ Godot notifications =================== Every Object in Godot implements a -`_notification ` method. Its purpose is to +`_notification` method. Its purpose is to allow the Object to respond to a variety of engine-level callbacks that may relate to it. For example, if the engine tells a -`CanvasItem ` to "draw", it will call +`CanvasItem` to "draw", it will call ``_notification(NOTIFICATION_DRAW)``. Some of these notifications, like draw, are useful to override in scripts. So @@ -28,28 +28,28 @@ much so that Godot exposes many of them with dedicated functions: What users might *not* realize is that notifications exist for types other than Node alone: -- `Object::NOTIFICATION_POSTINITIALIZE `: +- `Object::NOTIFICATION_POSTINITIALIZE`: a callback that triggers during object initialization. Not accessible to scripts. -- `Object::NOTIFICATION_PREDELETE `: +- `Object::NOTIFICATION_PREDELETE`: a callback that triggers before the engine deletes an Object, i.e. a 'destructor'. -- `MainLoop::NOTIFICATION_WM_MOUSE_ENTER `: +- `MainLoop::NOTIFICATION_WM_MOUSE_ENTER`: a callback that triggers when the mouse enters the window in the operating system that displays the game content. And many of the callbacks that *do* exist in Nodes don't have any dedicated methods, but are still quite useful. -- `Node::NOTIFICATION_PARENTED `: +- `Node::NOTIFICATION_PARENTED`: a callback that triggers anytime one adds a child node to another node. -- `Node::NOTIFICATION_UNPARENTED `: +- `Node::NOTIFICATION_UNPARENTED`: a callback that triggers anytime one removes a child node from another node. -- `Popup::NOTIFICATION_POST_POPUP `: +- `Popup::NOTIFICATION_POST_POPUP`: a callback that triggers after a Popup node completes any ``popup*`` method. Note the difference from its ``about_to_show`` signal which triggers *before* its appearance. @@ -62,7 +62,7 @@ One can access all these custom notifications from the universal overridden by scripts. A classic example is the - `_init ` method in Object. While it has no + `_init` method in Object. While it has no ``NOTIFICATION_*`` equivalent, the engine still calls the method. Most languages (except C#) rely on it as a constructor. @@ -186,7 +186,7 @@ to the SceneTree, the ``_enter_tree`` and ``_ready`` calls occur. If one needs to trigger behavior that occurs as nodes parent to another, regardless of whether it occurs as part of the main/active scene or not, one -can use the `PARENTED ` notification. +can use the `PARENTED` notification. For example, here is a snippet that connects a node's method to a custom signal on the parent node without failing. Useful on data-centric nodes that one might create at runtime. diff --git a/tutorials/best_practices/logic_preferences.rst b/tutorials/best_practices/logic_preferences.rst index b63ce0c..e0b17b7 100644 --- a/tutorials/best_practices/logic_preferences.rst +++ b/tutorials/best_practices/logic_preferences.rst @@ -10,15 +10,15 @@ Loading vs. preloading ---------------------- In GDScript, there exists the global -`preload ` method. It loads resources as +`preload` method. It loads resources as early as possible to front-load the "loading" operations and avoid loading resources while in the middle of performance-sensitive code. -Its counterpart, the `load ` method, loads a +Its counterpart, the `load` method, loads a resource only when it reaches the load statement. That is, it will load a resource in-place which can cause slowdowns when it occurs in the middle of sensitive processes. The ``load`` function is also an alias for -`ResourceLoader.load(path) ` which is +`ResourceLoader.load(path)` which is accessible to *all* scripting languages. So, when exactly does preloading occur versus loading, and when should one use @@ -95,7 +95,7 @@ consider: would be to unload the entire script. If they are instead loaded properties, then one can set them to ``null`` and remove all references to the resource entirely (which, as a - `Reference `-extending type, will cause the + `Reference`-extending type, will cause the resources to delete themselves from memory). Large levels: static vs. dynamic diff --git a/tutorials/best_practices/node_alternatives.rst b/tutorials/best_practices/node_alternatives.rst index 6c0553a..574935b 100644 --- a/tutorials/best_practices/node_alternatives.rst +++ b/tutorials/best_practices/node_alternatives.rst @@ -13,15 +13,15 @@ Godot provides more lightweight objects for creating APIs which nodes use. Be sure to keep these in mind as options when designing how you wish to build your project's features. -1. `Object `: The ultimate lightweight object, the original +1. `Object`: The ultimate lightweight object, the original Object must use manual memory management. With that said, it isn't too difficult to create one's own custom data structures, even node structures, - that are also lighter than the `Node ` class. + that are also lighter than the `Node` class. - - **Example:** See the `Tree ` node. It supports a high level + - **Example:** See the `Tree` node. It supports a high level of customization for a table of content with an arbitrary number of rows and columns. The data that it uses to generate its visualization - though is actually a tree of `TreeItem ` Objects. + though is actually a tree of `TreeItem` Objects. - **Advantages:** Simplifying one's API to smaller scoped objects helps improve its accessibility and improve iteration time. Rather than working with the @@ -33,27 +33,27 @@ your project's features. For example, if the object's creator decides to delete it out of nowhere, this would trigger an error state when one next accesses it. -2. `Reference `: Only a little more complex than Object. +2. `Reference`: Only a little more complex than Object. They track references to themselves, only deleting loaded memory when no further references to themselves exist. These are useful in the majority of cases where one needs data in a custom class. - - **Example:** See the `File ` object. It functions + - **Example:** See the `File` object. It functions just like a regular Object except that one need not delete it themselves. - **Advantages:** same as the Object. -3. `Resource `: Only slightly more complex than Reference. +3. `Resource`: Only slightly more complex than Reference. They have the innate ability to serialize/deserialize (i.e. save and load) their object properties to/from Godot resource files. - **Example:** Scripts, PackedScene (for scene files), and other types like - each of the `AudioEffect ` classes. Each of these + each of the `AudioEffect` classes. Each of these can be save and loaded, therefore they extend from Resource. - **Advantages:** Much has `already been said ` - on `Resource `'s advantages over traditional data + on `Resource`'s advantages over traditional data storage methods. In the context of using Resources over Nodes though, their main advantage is in Inspector-compatibility. While nearly as lightweight as Object/Reference, they can still display and export diff --git a/tutorials/best_practices/scene_organization.rst b/tutorials/best_practices/scene_organization.rst index 1f6cfc3..8cf2740 100644 --- a/tutorials/best_practices/scene_organization.rst +++ b/tutorials/best_practices/scene_organization.rst @@ -75,7 +75,7 @@ gdscript GDScript call(method_name) # Call parent-defined method (which child must own). ``` -3. Initialize a `FuncRef ` property. Safer than a method +3. Initialize a `FuncRef` property. Safer than a method as ownership of the method is unnecessary. Used to start behavior. gdscript GDScript @@ -157,12 +157,12 @@ gdscript GDScript To avoid creating and maintaining such documentation, one converts the dependent node ("child" above) into a tool script that implements - `_get_configuration_warning() `. + `_get_configuration_warning()`. Returning a non-empty string from it will make the Scene dock generate a warning icon with the string as a tooltip by the node. This is the same icon that appears for nodes such as the - `Area2D ` node when it has no child - `CollisionShape2D ` nodes defined. The editor + `Area2D` node when it has no child + `CollisionShape2D` nodes defined. The editor then self-documents the scene through the script code. No content duplication via documentation is necessary. @@ -234,7 +234,7 @@ If one has a system that... For smaller games, a simpler alternative with less control would be to have a "Game" singleton that simply calls the - `SceneTree.change_scene() ` method + `SceneTree.change_scene()` method to swap out the main scene's content. This structure more or less keeps the "World" as the main game node. @@ -259,11 +259,11 @@ own place in the hierarchy as a sibling or some other relation. In some cases, one needs these separated nodes to *also* position themselves relative to each other. One can use the - `RemoteTransform ` / - `RemoteTransform2D ` nodes for this purpose. + `RemoteTransform` / + `RemoteTransform2D` nodes for this purpose. They will allow a target node to conditionally inherit selected transform elements from the Remote\* node. To assign the ``target`` - `NodePath `, use one of the following: + `NodePath`, use one of the following: 1. A reliable third party, likely a parent node, to mediate the assignment. 2. A group, to easily pull a reference to the desired node (assuming there @@ -307,12 +307,12 @@ own place in the hierarchy as a sibling or some other relation. In contrast, if one ever needs to have a child node that does *not* inherit the transform of their parent, one has the following options: - 1. The **declarative** solution: place a `Node ` in between + 1. The **declarative** solution: place a `Node` in between them. As nodes with no transform, Nodes will not pass along such information to their children. 2. The **imperative** solution: Use the ``set_as_toplevel`` setter for the - `CanvasItem ` or - `Spatial ` node. This will make + `CanvasItem` or + `Spatial` node. This will make the node ignore its inherited transform. .. note:: diff --git a/tutorials/best_practices/scenes_versus_scripts.rst b/tutorials/best_practices/scenes_versus_scripts.rst index 66827c7..383ae02 100644 --- a/tutorials/best_practices/scenes_versus_scripts.rst +++ b/tutorials/best_practices/scenes_versus_scripts.rst @@ -88,7 +88,7 @@ There are two systems for registering types... - Works for all scripting languages because it deals with Script resources in abstract. - - Set up using `EditorPlugin.add_custom_type `. + - Set up using `EditorPlugin.add_custom_type`. - `Script Classes ` diff --git a/tutorials/best_practices/what_are_godot_classes.rst b/tutorials/best_practices/what_are_godot_classes.rst index cc92309..06d40ce 100644 --- a/tutorials/best_practices/what_are_godot_classes.rst +++ b/tutorials/best_practices/what_are_godot_classes.rst @@ -16,7 +16,7 @@ how they work under the hood. How scripts work in the engine ------------------------------ -The engine provides built-in classes like `Node `. You can extend those to create +The engine provides built-in classes like `Node`. You can extend those to create derived types using a script. These scripts are not technically classes. Instead, they are resources that tell the engine a @@ -35,15 +35,15 @@ This ``ClassDB`` is what objects check against when performing an operation like property or calling a method. It checks the database's records and the object's base types' records to see if the object supports the operation. -Attaching a `Script ` to your object extends the methods, properties, and signals +Attaching a `Script` to your object extends the methods, properties, and signals available from the ``ClassDB``. .. note:: Even scripts that don't use the ``extends`` keyword implicitly inherit from the engine's base - `Reference ` class. As a result, you can instantiate scripts without the + `Reference` class. As a result, you can instantiate scripts without the ``extends`` keyword from code. Since they extend ``Reference`` though, you cannot attach them to - a `Node `. + a `Node`. Scenes ------ diff --git a/tutorials/editor/command_line_tutorial.rst b/tutorials/editor/command_line_tutorial.rst index e2c39d2..4a768b3 100644 --- a/tutorials/editor/command_line_tutorial.rst +++ b/tutorials/editor/command_line_tutorial.rst @@ -60,7 +60,7 @@ Command line reference +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--main-pack `` | Path to a pack (.pck) file to load. | +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| ``--render-thread `` | Render thread mode ('unsafe', 'safe', 'separate'). See `Thread Model ` for more details. | +| ``--render-thread `` | Render thread mode ('unsafe', 'safe', 'separate'). See `Thread Model` for more details. | +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--remote-fs
`` | Remote filesystem (``[:]`` address). | +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/tutorials/export/exporting_pcks.rst b/tutorials/export/exporting_pcks.rst index f3fee0f..0b99d23 100644 --- a/tutorials/export/exporting_pcks.rst +++ b/tutorials/export/exporting_pcks.rst @@ -82,7 +82,7 @@ process will build that type of file for the chosen platform. build of the engine or have access to one (distributed alongside or perhaps in the original game's files). The tool can then use the Godot executable to export a PCK file from the command line with - `OS.execute() `. The game itself shouldn't + `OS.execute()`. The game itself shouldn't use a tool-build of the engine (for security), so it's best to keep the modding tool and game separate. @@ -114,7 +114,7 @@ gdscript GDScript PCK file of this kind can fix the content of a previously loaded PCK. To opt out of this behavior, pass ``false`` as the second argument to - `ProjectSettings.load_resource_pack() `. + `ProjectSettings.load_resource_pack()`. .. note:: For a C# project, you need to build the DLL and place it in the project directory first. diff --git a/tutorials/export/feature_tags.rst b/tutorials/export/feature_tags.rst index 448ec4d..339b5c0 100644 --- a/tutorials/export/feature_tags.rst +++ b/tutorials/export/feature_tags.rst @@ -130,7 +130,7 @@ After overriding, a new field is added for this specific configuration: .. note:: When using the - `project settings "override.cfg" functionality ` + `project settings "override.cfg" functionality` (which is unrelated to feature tags), remember that feature tags still apply. Therefore, make sure to *also* override the setting with the desired feature tag(s) if you want them to override base project settings on all platforms diff --git a/tutorials/i18n/internationalizing_games.rst b/tutorials/i18n/internationalizing_games.rst index 467aa91..1fa472a 100644 --- a/tutorials/i18n/internationalizing_games.rst +++ b/tutorials/i18n/internationalizing_games.rst @@ -51,7 +51,7 @@ locale. Converting keys to text ----------------------- -Some controls, such as `Button ` and `Label `, +Some controls, such as `Button`, will automatically fetch a translation if their text matches a translation key. For example, if a label's text is "MAIN_SCREEN_GREETING1" and that key exists in the current translation, then the text will automatically be translated. @@ -80,7 +80,7 @@ For more complex UI nodes such as OptionButtons, you may have to use this instea option_button.get_popup().set_message_translation(false) option_button.get_popup().notification(NOTIFICATION_TRANSLATION_CHANGED) -In code, the `Object.tr() ` +In code, the `Object.tr()` function can be used. This will just look up the text in the translations and convert it if found: @@ -95,14 +95,14 @@ Making controls resizable The same text in different languages can vary greatly in length. For this, make sure to read the tutorial on `doc_size_and_anchors`, as dynamically adjusting control sizes may help. -`Container ` can be useful, as well as the text wrapping -options available in `Label `. +`Container` can be useful, as well as the text wrapping +options available in `Label`. TranslationServer ----------------- Godot has a server handling low-level translation management -called the `TranslationServer `. +called the `TranslationServer`. Translations can be added or removed during run-time; the current language can also be changed at run-time. diff --git a/tutorials/i18n/localization_using_gettext.rst b/tutorials/i18n/localization_using_gettext.rst index 5b778dc..b6dd0a0 100644 --- a/tutorials/i18n/localization_using_gettext.rst +++ b/tutorials/i18n/localization_using_gettext.rst @@ -117,7 +117,7 @@ You can then run pybabel like so: pybabel extract -F babelrc -k text -k LineEdit/placeholder_text -k tr -o godot-l10n.pot . Use the ``-k`` option to specify what needs to be extracted. In this case, -arguments to `tr() ` will be translated, as well +arguments to `tr()` will be translated, as well as properties named "text" (commonly used by Control nodes) and LineEdit's "placeholder_text" property. diff --git a/tutorials/inputs/controllers_gamepads_joysticks.rst b/tutorials/inputs/controllers_gamepads_joysticks.rst index 0def147..0a9aff7 100644 --- a/tutorials/inputs/controllers_gamepads_joysticks.rst +++ b/tutorials/inputs/controllers_gamepads_joysticks.rst @@ -144,7 +144,7 @@ events for controller input in the first place. If you want controller buttons to send echo events, you will have to generate `class_InputEvent` objects by code and parse them using -`Input.parse_input_event() ` +`Input.parse_input_event()` at regular intervals. This can be accomplished with the help of a `class_Timer` node. @@ -200,7 +200,7 @@ powershell Windows (powershell) To test mappings on non-desktop platforms or to distribute your project with additional controller mappings, you can add them by calling -`Input.add_joy_mapping() ` +`Input.add_joy_mapping()` as early as possible in a script's ``_ready()`` function. My controller works on a given platform, but not on another platform. diff --git a/tutorials/inputs/custom_mouse_cursor.rst b/tutorials/inputs/custom_mouse_cursor.rst index 248223a..7714523 100644 --- a/tutorials/inputs/custom_mouse_cursor.rst +++ b/tutorials/inputs/custom_mouse_cursor.rst @@ -59,7 +59,7 @@ gdscript GDScript ``` .. note:: - Check `Input.set_custom_mouse_cursor() `. + Check `Input.set_custom_mouse_cursor()`. Demo project @@ -71,4 +71,4 @@ https://github.com/guilhermefelipecgs/custom_hardware_cursor Cursor list ----------- -As documented in the `Input ` class (see the **CursorShape** enum), there are multiple mouse cursors you can define. Which ones you want to use depends on your use case. +As documented in the `Input` class (see the **CursorShape** enum), there are multiple mouse cursors you can define. Which ones you want to use depends on your use case. diff --git a/tutorials/inputs/handling_quit_requests.rst b/tutorials/inputs/handling_quit_requests.rst index 00902f0..9100997 100644 --- a/tutorials/inputs/handling_quit_requests.rst +++ b/tutorials/inputs/handling_quit_requests.rst @@ -14,7 +14,7 @@ to go back otherwise). Handling the notification ------------------------- -On desktop platforms, the `MainLoop ` +On desktop platforms, the `MainLoop` has a special ``MainLoop.NOTIFICATION_WM_QUIT_REQUEST`` notification that is sent to all nodes when quitting is requested. @@ -53,10 +53,10 @@ gdscript GDScript Sending your own quit notification ---------------------------------- -While forcing the application to close can be done by calling `SceneTree.quit `, +While forcing the application to close can be done by calling `SceneTree.quit`, doing so will not send the quit *notification*. This means the function described above won't be called. Quitting by calling -`SceneTree.quit ` will not allow custom actions +`SceneTree.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. diff --git a/tutorials/inputs/input_examples.rst b/tutorials/inputs/input_examples.rst index 7a77733..588c0f8 100644 --- a/tutorials/inputs/input_examples.rst +++ b/tutorials/inputs/input_examples.rst @@ -6,7 +6,7 @@ Input examples Introduction ------------ -In this tutorial, you'll learn how to use Godot's `InputEvent ` +In this tutorial, you'll learn how to use Godot's `InputEvent` system to capture player input. There are many different types of input your game may use - keyboard, gamepad, mouse, etc. - and many different ways to turn those inputs into actions in your game. This document will show you some @@ -23,7 +23,7 @@ Sometimes you want your game to respond to a certain input event - pressing the "jump" button, for example. For other situations, you might want something to happen as long as a key is pressed, such as movement. In the first case, you can use the ``_input()`` function, which will be called whenever an input -event occurs. In the second case, Godot provides the `Input ` +event occurs. In the second case, Godot provides the `Input` singleton, which you can use to query the state of an input. Examples: @@ -51,7 +51,7 @@ events in ``_input()``. Input events ------------ -Input events are objects that inherit from `InputEvent `. +Input events are objects that inherit from `InputEvent`. Depending on the event type, the object will contain specific properties related to that event. To see what events actually look like, add a Node and attach the following script: @@ -82,13 +82,13 @@ event scroll by in the output window. Here's an example of the output: As you can see, the results are very different for the different types of input. Key events are even printed as their key symbols. For example, let's -consider `InputEventMouseButton `. +consider `InputEventMouseButton`. It inherits from the following classes: -- `InputEvent ` - the base class for all input events -- `InputEventWithModifiers ` - adds the ability to check if modifiers are pressed, such as :kbd:`Shift` or :kbd:`Alt`. -- `InputEventMouse ` - adds mouse event properties, such as ``position`` -- `InputEventMouseButton ` - contains the index of the button that was pressed, whether it was a double-click, etc. +- `InputEvent` - the base class for all input events +- `InputEventWithModifiers` - adds the ability to check if modifiers are pressed, such as :kbd:`Shift` or :kbd:`Alt`. +- `InputEventMouse` - adds mouse event properties, such as ``position`` +- `InputEventMouseButton` - contains the index of the button that was pressed, whether it was a double-click, etc. .. tip:: It's a good idea to keep the class reference open while you're working with events so you can check the event type's available properties and @@ -109,7 +109,7 @@ gdscript GDScript InputMap -------- -The `InputMap ` is the most flexible way to handle a +The `InputMap` is the most flexible way to handle a variety of inputs. You use this by creating named input *actions*, to which you can assign any number of input events, such as keypresses or mouse clicks. A new Godot project includes a number of default actions already defined. To @@ -136,7 +136,7 @@ gdscript GDScript Keyboard events --------------- -Keyboard events are captured in `InputEventKey `. +Keyboard events are captured in `InputEventKey`. While it's recommended to use input actions instead, there may be cases where you want to specifically look at key events. For this example, let's check for the :kbd:`T`: @@ -170,7 +170,7 @@ Keyboard modifiers ~~~~~~~~~~~~~~~~~~ Modifier properties are inherited from -`InputEventWithModifiers `. This allows +`InputEventWithModifiers`. This allows you to check for modifier combinations using boolean properties. Let's imagine you want one thing to happen when the :kbd:`T` is pressed, but something different when it's :kbd:`Shift + T`: @@ -193,9 +193,9 @@ gdscript GDScript Mouse events ------------ -Mouse events stem from the `InputEventMouse ` class, and -are separated into two types: `InputEventMouseButton ` -and `InputEventMouseMotion `. Note that this +Mouse events stem from the `InputEventMouse` class, and +are separated into two types: `InputEventMouseButton` +and `InputEventMouseMotion`. Note that this means that all mouse events will contain a ``position`` property. Mouse buttons @@ -221,11 +221,11 @@ gdscript GDScript Mouse motion ~~~~~~~~~~~~ -`InputEventMouseMotion ` events occur whenever +`InputEventMouseMotion` events occur whenever the mouse moves. You can find the move's distance with the ``relative`` property. -Here's an example using mouse events to drag-and-drop a `Sprite ` +Here's an example using mouse events to drag-and-drop a `Sprite` node: gdscript GDScript @@ -257,8 +257,8 @@ Touch events ------------ If you are using a touchscreen device, you can generate touch events. -`InputEventScreenTouch ` is equivalent to -a mouse click event, and `InputEventScreenDrag ` +`InputEventScreenTouch` is equivalent to +a mouse click event, and `InputEventScreenDrag` works much the same as mouse motion. .. tip:: To test your touch events on a non-touchscreen device, open Project diff --git a/tutorials/inputs/inputevent.rst b/tutorials/inputs/inputevent.rst index 39a2971..f733d0a 100644 --- a/tutorials/inputs/inputevent.rst +++ b/tutorials/inputs/inputevent.rst @@ -7,7 +7,7 @@ What is it? ----------- Managing input is usually complex, no matter the OS or platform. To ease -this a little, a special built-in type is provided, `InputEvent `. +this a little, a special built-in type is provided, `InputEvent`. This datatype can be configured to contain several types of input events. Input events travel through the engine and can be received in multiple locations, depending on the purpose. @@ -23,7 +23,7 @@ gdscript GDScript get_tree().quit() ``` -However, it is cleaner and more flexible to use the provided `InputMap ` feature, +However, it is cleaner and more flexible to use the provided `InputMap` feature, which allows you to define input actions and assign them different keys. This way, you can define multiple keys for the same action (e.g. the keyboard escape key and the start button on a gamepad). You can then more easily change this mapping in the project settings without updating your code, @@ -45,44 +45,44 @@ How does it work? Every input event is originated from the user/player (though it's possible to generate an InputEvent and feed them back to the engine, which is useful for gestures). The OS object for each platform will read -events from the device, then feed them to MainLoop. As `SceneTree ` +events from the device, then feed them to MainLoop. As `SceneTree` is the default MainLoop implementation, events are fed to it. Godot provides a function to get the current SceneTree object : **get_tree()**. But SceneTree does not know what to do with the event, so it will give -it to the viewports, starting by the "root" `Viewport ` (the first +it to the viewports, starting by the "root" `Viewport` (the first node of the scene tree). Viewport does quite a lot of stuff with the received input, in order: .. image:: img/input_event_flow.png -1. First of all, the standard `Node._input() ` function - will be called in any node that overrides it (and hasn't disabled input processing with `Node.set_process_input() `). - If any function consumes the event, it can call `SceneTree.set_input_as_handled() `, and the event will +1. First of all, the standard `Node._input()` function + will be called in any node that overrides it (and hasn't disabled input processing with `Node.set_process_input()`). + If any function consumes the event, it can call `SceneTree.set_input_as_handled()`, and the event will not spread any more. This ensures that you can filter all events of interest, even before the GUI. - For gameplay input, `Node._unhandled_input() ` is generally a better fit, because it allows the GUI to intercept the events. + For gameplay input, `Node._unhandled_input()` is generally a better fit, because it allows the GUI to intercept the events. 2. Second, it will try to feed the input to the GUI, and see if any - control can receive it. If so, the `Control ` will be called via the - virtual function `Control._gui_input() ` and the signal + control can receive it. If so, the `Control` will be called via the + virtual function `Control._gui_input()` and the signal "gui_input" will be emitted (this function is re-implementable by script by inheriting from it). If the control wants to "consume" the - event, it will call `Control.accept_event() ` and the event will - not spread any more. Use the `Control.mouse_filter ` - property to control whether a `Control ` is notified - of mouse events via `Control._gui_input() ` + event, it will call `Control.accept_event()` and the event will + not spread any more. Use the `Control.mouse_filter` + property to control whether a `Control` is notified + of mouse events via `Control._gui_input()` callback, and whether these events are propagated further. 3. If so far no one consumed the event, the unhandled input callback will be called if overridden (and not disabled with - `Node.set_process_unhandled_input() `). - If any function consumes the event, it can call `SceneTree.set_input_as_handled() `, and the + `Node.set_process_unhandled_input()`). + If any function consumes the event, it can call `SceneTree.set_input_as_handled()`, and the event will not spread any more. The unhandled input callback is ideal for full-screen gameplay events, so they are not received when a GUI is active. -4. If no one wanted the event so far, and a `Camera ` is assigned - to the Viewport with `Object Picking ` turned on, a ray to the physics world (in the ray direction from - the click) will be cast. (For the root viewport, this can also be enabled in `Project Settings `) If this ray hits an object, it will call the - `CollisionObject._input_event() ` function in the relevant +4. If no one wanted the event so far, and a `Camera` is assigned + to the Viewport with `Object Picking` turned on, a ray to the physics world (in the ray direction from + the click) will be cast. (For the root viewport, this can also be enabled in `Project Settings`) If this ray hits an object, it will call the + `CollisionObject._input_event()` function in the relevant physics object (bodies receive this callback by default, but areas do - not. This can be configured through `Area ` properties). + not. This can be configured through `Area` properties). 5. Finally, if the event was unhandled, it will be passed to the next Viewport in the tree, otherwise it will be ignored. @@ -103,7 +103,7 @@ generalized behavior if needed. Anatomy of an InputEvent ------------------------ -`InputEvent ` is just a base built-in type, it does not represent +`InputEvent` is just a base built-in type, it does not represent anything and only contains some basic information, such as event ID (which is increased for each event), device index, etc. @@ -112,31 +112,31 @@ There are several specialized types of InputEvent, described in the table below: +-------------------------------------------------------------------+--------------------+-----------------------------------------+ | Event | Type Index | Description | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEvent ` | NONE | Empty Input Event. | +| `InputEvent` | NONE | Empty Input Event. | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventKey ` | KEY | Contains a scancode and Unicode value, | +| `InputEventKey` | KEY | Contains a scancode and Unicode value, | | | | as well as modifiers. | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventMouseButton ` | MOUSE_BUTTON | Contains click information, such as | +| `InputEventMouseButton` | MOUSE_BUTTON | Contains click information, such as | | | | button, modifiers, etc. | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventMouseMotion ` | MOUSE_MOTION | Contains motion information, such as | +| `InputEventMouseMotion` | MOUSE_MOTION | Contains motion information, such as | | | | relative, absolute positions and speed. | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventJoypadMotion ` | JOYSTICK_MOTION | Contains Joystick/Joypad analog axis | +| `InputEventJoypadMotion` | JOYSTICK_MOTION | Contains Joystick/Joypad analog axis | | | | information. | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventJoypadButton ` | JOYSTICK_BUTTON | Contains Joystick/Joypad button | +| `InputEventJoypadButton` | JOYSTICK_BUTTON | Contains Joystick/Joypad button | | | | information. | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventScreenTouch ` | SCREEN_TOUCH | Contains multi-touch press/release | +| `InputEventScreenTouch` | SCREEN_TOUCH | Contains multi-touch press/release | | | | information. (only available on mobile | | | | devices) | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventScreenDrag ` | SCREEN_DRAG | Contains multi-touch drag information. | +| `InputEventScreenDrag` | SCREEN_DRAG | Contains multi-touch drag information. | | | | (only available on mobile devices) | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ -| `InputEventAction ` | SCREEN_ACTION | Contains a generic action. These events | +| `InputEventAction` | SCREEN_ACTION | Contains a generic action. These events | | | | are often generated by the programmer | | | | as feedback. (more on this below) | +-------------------------------------------------------------------+--------------------+-----------------------------------------+ @@ -155,13 +155,13 @@ logic. This allows for: Actions can be created from the Project Settings menu in the Actions tab. -Any event has the methods `InputEvent.is_action() `, -`InputEvent.is_pressed() ` and `InputEvent `. +Any event has the methods `InputEvent.is_action()`, +`InputEvent.is_pressed()`. Alternatively, it may be desired to supply the game back with an action from the game code (a good example of this is detecting gestures). The Input singleton has a method for this: -`Input.parse_input_event() `. You would normally use it like this: +`Input.parse_input_event()`. You would normally use it like this: gdscript GDScript @@ -178,7 +178,7 @@ InputMap -------- Customizing and re-mapping input from code is often desired. If your -whole workflow depends on actions, the `InputMap ` singleton is +whole workflow depends on actions, the `InputMap` singleton is ideal for reassigning or creating different actions at run-time. This singleton is not saved (must be modified manually) and its state is run from the project settings (project.godot). So any dynamic system of this diff --git a/tutorials/io/data_paths.rst b/tutorials/io/data_paths.rst index 29481cf..fdb1561 100644 --- a/tutorials/io/data_paths.rst +++ b/tutorials/io/data_paths.rst @@ -55,14 +55,14 @@ Project Settings: `editor data path ` in the ``app_userdata/[project_name]`` folder. This is the default so that prototypes and test projects stay self-contained within Godot's data folder. -- If `application/config/use_custom_user_dir ` +- If `application/config/use_custom_user_dir` is enabled in the Project Settings, the ``user://`` folder is created **next to** Godot's editor data path, i.e. in the standard location for applications data. * By default, the folder name will be inferred from the project name, but it can be further customized with - `application/config/custom_user_dir_name `. + `application/config/custom_user_dir_name`. This path can contain path separators, so you can use it e.g. to group projects of a given studio with a ``Studio Name/Game Name`` structure. @@ -92,20 +92,20 @@ by other applications for security reasons. On HTML5 exports, ``user://`` will refer to a virtual filesystem stored on the device via IndexedDB. (Interaction with the main filesystem can still be performed -through the `JavaScript ` singleton.) +through the `JavaScript` singleton.) Converting paths to absolute paths or "local" paths --------------------------------------------------- -You can use `ProjectSettings.globalize_path() ` +You can use `ProjectSettings.globalize_path()` to convert a "local" path like ``res://path/to/file.txt`` to an absolute OS path. -For example, `ProjectSettings.globalize_path() ` +For example, `ProjectSettings.globalize_path()` can be used to open "local" paths in the OS file manager -using `OS.shell_open() ` since it only accepts +using `OS.shell_open()` since it only accepts native OS paths. To convert an absolute OS path to a "local" path starting with ``res://`` -or ``user://``, use `ProjectSettings.localize_path() `. +or ``user://``, use `ProjectSettings.localize_path()`. This only works for absolute paths that point to files or folders in your project's root or ``user://`` folders. @@ -169,7 +169,7 @@ self-contained mode by default. Self-contained mode is not supported in exported projects yet. To read and write files relative to the executable path, use - `OS.get_executable_path() `. + `OS.get_executable_path()`. Note that writing files in the executable path only works if the executable is placed in a writable location (i.e. **not** Program Files or another directory that is read-only for regular users). diff --git a/tutorials/math/beziers_and_curves.rst b/tutorials/math/beziers_and_curves.rst index 2cbef9c..da66c22 100644 --- a/tutorials/math/beziers_and_curves.rst +++ b/tutorials/math/beziers_and_curves.rst @@ -147,9 +147,9 @@ work and look in Godot. Curve2D, Curve3D, Path and Path2D --------------------------------- -There are two objects that contain curves: `Curve3D ` and `Curve2D ` (for 3D and 2D respectively). +There are two objects that contain curves: `Curve3D` (for 3D and 2D respectively). -They can contain several points, allowing for longer paths. It is also possible to set them to nodes: `Path ` and `Path2D ` (also for 3D and 2D respectively): +They can contain several points, allowing for longer paths. It is also possible to set them to nodes: `Path` (also for 3D and 2D respectively): .. image:: img/bezier_path_2d.png @@ -190,7 +190,7 @@ Additionally, if both control points were ``0, 0`` (remember they are relative v Before drawing Bezier curves, *tessellation* is required. This is often done with a recursive or divide and conquer function that splits the curve until the curvature amount becomes less than a certain threshold. The *Curve* classes provide this via the -`Curve2D.tessellate() ` function (which receives optional ``stages`` of recursion and angle ``tolerance`` arguments). This way, drawing something based on a curve is easier. +`Curve2D.tessellate()` function (which receives optional ``stages`` of recursion and angle ``tolerance`` arguments). This way, drawing something based on a curve is easier. Traversal --------- diff --git a/tutorials/math/interpolation.rst b/tutorials/math/interpolation.rst index 3b5c670..239f40e 100644 --- a/tutorials/math/interpolation.rst +++ b/tutorials/math/interpolation.rst @@ -28,10 +28,10 @@ There are other types of interpolations, which will not be covered here. A recom Vector interpolation -------------------- -Vector types (`Vector2 ` and `Vector3 `) can also be interpolated, they come with handy functions to do it -`Vector2.linear_interpolate() ` and `Vector3.linear_interpolate() `. +Vector types (`Vector2`) can also be interpolated, they come with handy functions to do it +`Vector2.linear_interpolate()`. -For cubic interpolation, there are also `Vector2.cubic_interpolate() ` and `Vector3.cubic_interpolate() `, which do a `Bezier ` style interpolation. +For cubic interpolation, there are also `Vector2.cubic_interpolate()` style interpolation. Here is simple pseudo-code for going from point A to B using interpolation: @@ -54,7 +54,7 @@ Transform interpolation ----------------------- It is also possible to interpolate whole transforms (make sure they have either uniform scale or, at least, the same non-uniform scale). -For this, the function `Transform.interpolate_with() ` can be used. +For this, the function `Transform.interpolate_with()` can be used. Here is an example of transforming a monkey from Position1 to Position2: diff --git a/tutorials/math/random_number_generation.rst b/tutorials/math/random_number_generation.rst index 918e12e..560ede2 100644 --- a/tutorials/math/random_number_generation.rst +++ b/tutorials/math/random_number_generation.rst @@ -81,7 +81,7 @@ Getting a random number Let's look at some of the most commonly used functions and methods to generate random numbers in Godot. -The function `randi() ` returns a random +The function `randi()` returns a random number between 0 and 2^32-1. Since the maximum value is huge, you most likely want to use the modulo operator (``%``) to bound the result between 0 and the denominator: @@ -97,12 +97,12 @@ gdscript GDScript ``` -`randf() ` returns a random floating-point +`randf()` returns a random floating-point number between 0 and 1. This is useful to implement a `doc_random_number_generation_weighted_random_probability` system, among other things. -`randfn() ` returns a random +`randfn()` returns a random floating-point number following a `normal distribution `__. This means the returned value is more likely to be around the mean (0.0 by default), @@ -117,7 +117,7 @@ gdscript GDScript print(random.randfn()) ``` -`rand_range() ` takes two arguments +`rand_range()` takes two arguments ``from`` and ``to``, and returns a random floating-point number between ``from`` and ``to``: @@ -239,7 +239,7 @@ gdscript GDScript Weighted random probability --------------------------- -The `randf() ` method returns a +The `randf()` method returns a floating-point number between 0.0 and 1.0. We can use this to create a "weighted" probability where different outcomes have different likelihoods: diff --git a/tutorials/math/vector_math.rst b/tutorials/math/vector_math.rst index 15ebcd8..620a9f0 100644 --- a/tutorials/math/vector_math.rst +++ b/tutorials/math/vector_math.rst @@ -69,8 +69,8 @@ gdscript GDScript $Node2D.position = Vector2(400, 300) ``` -Godot supports both `Vector2 ` and -`Vector3 ` for 2D and 3D usage, respectively. The same +Godot supports both `Vector2` and +`Vector3` for 2D and 3D usage, respectively. The same mathematical rules discussed in this article apply to both types. Member access @@ -199,9 +199,9 @@ wall or other object: The surface normal has a value of ``(0, -1)`` because this is a horizontal surface. When the ball collides, we take its remaining motion (the amount left over when it hits the surface) and reflect it using the normal. In -Godot, the `Vector2 ` class has a ``bounce()`` method +Godot, the `Vector2` class has a ``bounce()`` method to handle this. Here is a GDScript example of the diagram above using a -`KinematicBody2D `: +`KinematicBody2D`: gdscript GDScript diff --git a/tutorials/math/vectors_advanced.rst b/tutorials/math/vectors_advanced.rst index 8b69505..16bac12 100644 --- a/tutorials/math/vectors_advanced.rst +++ b/tutorials/math/vectors_advanced.rst @@ -67,7 +67,7 @@ by N and D. For example: .. image:: img/tutovec12.png -For 3D math, Godot provides a `Plane ` +For 3D math, Godot provides a `Plane` built-in type that handles this. Basically, N and D can represent any plane in space, be it for 2D or 3D @@ -114,7 +114,7 @@ gdscript GDScript D = -D ``` -Of course, Godot also implements this operator in `Plane `, +Of course, Godot also implements this operator in `Plane`, so doing: gdscript GDScript diff --git a/tutorials/navigation/real_time_navigation_3d.rst b/tutorials/navigation/real_time_navigation_3d.rst index 018069e..c12e8a1 100644 --- a/tutorials/navigation/real_time_navigation_3d.rst +++ b/tutorials/navigation/real_time_navigation_3d.rst @@ -106,6 +106,6 @@ starting location, the next is a Vector3 of the end location. And the last argument is a boolean for whether or not agent properties of a navmesh are considered when generating a path. -The method will return a `PoolVector3Array ` consisting of +The method will return a `PoolVector3Array` consisting of points that make a path. If there is no way to navigate to the end -location the method will return a blank `PoolVector3Array `. +location the method will return a blank `PoolVector3Array`. diff --git a/tutorials/networking/high_level_multiplayer.rst b/tutorials/networking/high_level_multiplayer.rst index 4b2a8ef..0c7c519 100644 --- a/tutorials/networking/high_level_multiplayer.rst +++ b/tutorials/networking/high_level_multiplayer.rst @@ -23,7 +23,7 @@ This is due to the inherent limitations of the low-level protocols: In general, TCP can be thought of as reliable, ordered, and slow; UDP as unreliable, unordered and fast. Because of the large difference in performance, it often makes sense to re-build the parts of TCP wanted for games (optional reliability and packet order), while avoiding the unwanted parts (congestion/traffic control features, Nagle's algorithm, etc). Due to this, most game engines come with such an implementation, and Godot is no exception. -In summary, you can use the low-level networking API for maximum control and implement everything on top of bare network protocols or use the high-level API based on `SceneTree ` that does most of the heavy lifting behind the scenes in a generally optimized way. +In summary, you can use the low-level networking API for maximum control and implement everything on top of bare network protocols or use the high-level API based on `SceneTree` that does most of the heavy lifting behind the scenes in a generally optimized way. .. note:: Most of Godot's supported platforms offer all or most of the mentioned high- and low-level networking features. As networking is always largely hardware and operating system dependent, however, @@ -56,15 +56,15 @@ Mid level abstraction Before going into how we would like to synchronize a game across the network, it can be helpful to understand how the base network API for synchronization works. -Godot uses a mid-level object `NetworkedMultiplayerPeer `. +Godot uses a mid-level object `NetworkedMultiplayerPeer`. This object is not meant to be created directly, but is designed so that several C++ implementations can provide it. -This object extends from `PacketPeer `, so it inherits all the useful methods for serializing, sending and receiving data. On top of that, it adds methods to set a peer, transfer mode, etc. It also includes signals that will let you know when peers connect or disconnect. +This object extends from `PacketPeer`, so it inherits all the useful methods for serializing, sending and receiving data. On top of that, it adds methods to set a peer, transfer mode, etc. It also includes signals that will let you know when peers connect or disconnect. This class interface can abstract most types of network layers, topologies and libraries. By default, Godot -provides an implementation based on ENet (`NetworkedMultiplayerEnet `), -one based on WebRTC (`WebRTCMultiplayer `), and one based on WebSocket -(`WebSocketMultiplayerPeer `), but this could be used to implement +provides an implementation based on ENet (`NetworkedMultiplayerEnet`), +one based on WebRTC (`WebRTCMultiplayer`), and one based on WebSocket +(`WebSocketMultiplayerPeer`), but this could be used to implement mobile APIs (for ad hoc WiFi, Bluetooth) or custom device/console-specific networking APIs. For most common cases, using this object directly is discouraged, as Godot provides even higher level networking facilities. @@ -73,7 +73,7 @@ Yet it is made available in case a game has specific needs for a lower level API Initializing the network ------------------------ -The object that controls networking in Godot is the same one that controls everything tree-related: `SceneTree `. +The object that controls networking in Godot is the same one that controls everything tree-related: `SceneTree`. To initialize high-level networking, the SceneTree must be provided a NetworkedMultiplayerPeer object. @@ -126,7 +126,7 @@ Managing connections -------------------- Some games accept connections at any time, others during the lobby phase. Godot can be requested to no longer accept -connections at any point (see ``set_refuse_new_network_connections(bool)`` and related methods on `SceneTree `). To manage who connects, Godot provides the following signals in SceneTree: +connections at any point (see ``set_refuse_new_network_connections(bool)`` and related methods on `SceneTree`). To manage who connects, Godot provides the following signals in SceneTree: Server and Clients: @@ -136,7 +136,7 @@ Server and Clients: The above signals are called on every peer connected to the server (including on the server) when a new peer connects or disconnects. Clients will connect with a unique ID greater than 1, while network peer ID 1 is always the server. Anything below 1 should be handled as invalid. -You can retrieve the ID for the local system via `SceneTree.get_network_unique_id() `. +You can retrieve the ID for the local system via `SceneTree.get_network_unique_id()`. These IDs will be useful mostly for lobby management and should generally be stored, as they identify connected peers and thus players. You can also use IDs to send messages only to certain peers. Clients: @@ -156,7 +156,7 @@ RPC --- To communicate between peers, the easiest way is to use RPCs (remote procedure calls). This is implemented as a set of functions -in `Node `: +in `Node`: - ``rpc("function_name", )`` - ``rpc_id(,"function_name", )`` @@ -178,7 +178,7 @@ Functions can be called in two fashions: In most cases, reliable is desired. Unreliable is mostly useful when synchronizing object positions (sync must happen constantly, and if a packet is lost, it's not that bad because a new one will eventually arrive and it would likely be outdated because the object moved further in the meantime, even if it was resent reliably). -There is also `SceneTree.get_rpc_sender_id() `, which can be used to check which peer (or peer ID) sent an RPC. +There is also `SceneTree.get_rpc_sender_id()`, which can be used to check which peer (or peer ID) sent an RPC. Back to lobby ------------- @@ -260,7 +260,7 @@ If ``sync`` is included, the call can also be made locally. For example, to allo puppetsync func update_position(new_position): position = new_position -.. tip:: You can also use `SceneTree.get_rpc_sender_id() ` to have more advanced rules on how an rpc can be called. +.. tip:: You can also use `SceneTree.get_rpc_sender_id()` to have more advanced rules on how an rpc can be called. These keywords are further explained in `Synchronizing the game `. @@ -367,9 +367,9 @@ The network master of a node is the peer that has the ultimate authority over it When not explicitly set, the network master is inherited from the parent node, which if not changed, is always going to be the server (ID 1). Thus the server has authority over all nodes by default. The network master can be set -with the function `Node.set_network_master(id, recursive) ` (recursive is ``true`` by default and means the network master is recursively set on all child nodes of the node as well). +with the function `Node.set_network_master(id, recursive)` (recursive is ``true`` by default and means the network master is recursively set on all child nodes of the node as well). -Checking that a specific node instance on a peer is the network master for this node for all connected peers is done by calling `Node.is_network_master() `. This will return ``true`` when executed on the server and ``false`` on all client peers. +Checking that a specific node instance on a peer is the network master for this node for all connected peers is done by calling `Node.is_network_master()`. This will return ``true`` when executed on the server and ``false`` on all client peers. If you have paid attention to the previous example, it's possible you noticed that each peer was set to have network master authority for their own player (Node) instead of the server: diff --git a/tutorials/networking/http_client_class.rst b/tutorials/networking/http_client_class.rst index f2e7587..9608403 100644 --- a/tutorials/networking/http_client_class.rst +++ b/tutorials/networking/http_client_class.rst @@ -3,8 +3,8 @@ HTTP client class ================= -`HTTPClient ` provides low-level access to HTTP communication. -For a higher-level interface, you may want to take a look at `HTTPRequest ` first, +`HTTPClient` provides low-level access to HTTP communication. +For a higher-level interface, you may want to take a look at `HTTPRequest` first, which has a tutorial available `here `. .. warning:: @@ -14,7 +14,7 @@ which has a tutorial available `here `. using one-click deploy. Otherwise, network communication of any kind will be blocked by Android. -Here's an example of using the `HTTPClient ` +Here's an example of using the `HTTPClient` class. It's just a script, so it can be run by executing: console GDScript diff --git a/tutorials/networking/http_request_class.rst b/tutorials/networking/http_request_class.rst index ea1c48c..03ef60a 100644 --- a/tutorials/networking/http_request_class.rst +++ b/tutorials/networking/http_request_class.rst @@ -3,8 +3,8 @@ Making HTTP requests ==================== -The `HTTPRequest ` node is the easiest way to make HTTP requests in Godot. -It is backed by the more low-level `HTTPClient `, for which a tutorial is available `here `. +The `HTTPRequest` node is the easiest way to make HTTP requests in Godot. +It is backed by the more low-level `HTTPClient`. For the sake of this example, we will create a simple UI with a button, that when pressed will start the HTTP request to the specified URL. @@ -48,9 +48,9 @@ gdscript GDScript With this, you should see ``(hello:world)`` printed on the console; hello being a key, and world being a value, both of them strings. -For more information on parsing JSON, see the class references for `JSON ` and `JSONParseResult `. +For more information on parsing JSON, see the class references for `JSON`. -Note that you may want to check whether the ``result`` equals ``RESULT_SUCCESS`` and whether a JSON parsing error occurred, see the JSON class reference and `HTTPRequest ` for more. +Note that you may want to check whether the ``result`` equals ``RESULT_SUCCESS`` and whether a JSON parsing error occurred, see the JSON class reference and `HTTPRequest` for more. Of course, you can also set custom HTTP headers. These are given as a string array, with each string containing a header in the format ``"header: value"``. For example, to set a custom user agent (the HTTP ``user-agent`` header) you could use the following: diff --git a/tutorials/networking/ssl_certificates.rst b/tutorials/networking/ssl_certificates.rst index 574bb33..14693a8 100644 --- a/tutorials/networking/ssl_certificates.rst +++ b/tutorials/networking/ssl_certificates.rst @@ -8,9 +8,9 @@ Introduction It is often desired to use SSL connections for communications to avoid "man in the middle" attacks. Godot has a connection wrapper, -`StreamPeerSSL `, +`StreamPeerSSL`, which can take a regular connection and add security around it. The -`HTTPClient ` +`HTTPClient` class also supports HTTPS by using this same wrapper. Godot includes SSL certificates from Mozilla, but you can provide your own diff --git a/tutorials/networking/webrtc.rst b/tutorials/networking/webrtc.rst index c08d925..8bd63e3 100644 --- a/tutorials/networking/webrtc.rst +++ b/tutorials/networking/webrtc.rst @@ -33,7 +33,7 @@ Peers connect to a signaling server (for example a WebSocket server) and send th Using WebRTC in Godot --------------------- -WebRTC is implemented in Godot via two main classes `WebRTCPeerConnection ` and `WebRTCDataChannel `, plus the multiplayer API implementation `WebRTCMultiplayer `. See section on `high-level multiplayer ` for more details. +WebRTC is implemented in Godot via two main classes `WebRTCPeerConnection` for more details. .. note:: These classes are available automatically in HTML5, but **require an external GDNative plugin on native (non-HTML5) platforms**. Check out the `webrtc-native plugin repository `__ for instructions and to get the latest `release `__. @@ -212,4 +212,4 @@ This will print something similar to this: Remote signaling with WebSocket ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -A more advanced demo using WebSocket for signaling peers and `WebRTCMultiplayer ` is available in the `godot demo projects `_ under `networking/webrtc_signaling`. +A more advanced demo using WebSocket for signaling peers and `WebRTCMultiplayer`_ under `networking/webrtc_signaling`. diff --git a/tutorials/networking/websocket.rst b/tutorials/networking/websocket.rst index e9fc3e0..57b9b70 100644 --- a/tutorials/networking/websocket.rst +++ b/tutorials/networking/websocket.rst @@ -18,7 +18,7 @@ Godot supports WebSocket in both native and HTML5 exports. Using WebSocket in Godot ------------------------ -WebSocket is implemented in Godot via three main classes `WebSocketClient `, `WebSocketServer `, and `WebSocketPeer `. The WebSocket implementation is compatible with the High Level Multiplayer. See section on `high-level multiplayer ` for more details. +WebSocket is implemented in Godot via three main classes `WebSocketClient` for more details. .. warning:: diff --git a/tutorials/performance/batching.rst b/tutorials/performance/batching.rst index b1d3c45..9d988fe 100644 --- a/tutorials/performance/batching.rst +++ b/tutorials/performance/batching.rst @@ -308,23 +308,23 @@ rendering/batching/options ^^^^^^^^^^^^^^^^^^^^^^^^^^ - `use_batching - ` - + ` - Turns batching on or off. - `use_batching_in_editor - ` + ` Turns batching on or off in the Godot editor. This setting doesn't affect the running project in any way. - `single_rect_fallback - ` - + ` - This is a faster way of drawing unbatchable rectangles. However, it may lead to flicker on some hardware so it's not recommended. rendering/batching/parameters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- `max_join_item_commands ` - +- `max_join_item_commands` - One of the most important ways of achieving batching is to join suitable adjacent items (nodes) together, however they can only be joined if the commands they contain are compatible. The system must therefore do a lookahead @@ -333,7 +333,7 @@ rendering/batching/parameters not worth joining, so the best value may be project dependent. - `colored_vertex_format_threshold - ` - + ` - Baking colors into vertices results in a larger vertex format. This is not necessarily worth doing unless there are a lot of color changes going on within a joined item. This parameter represents the proportion of commands @@ -341,12 +341,12 @@ rendering/batching/parameters baked colors. - `batch_buffer_size - ` - + ` - This determines the maximum size of a batch, it doesn't have a huge effect on performance but can be worth decreasing for mobile if RAM is at a premium. - `item_reordering_lookahead - ` - + ` - Item reordering can help especially with interleaved sprites using different textures. The lookahead for the overlap test has a small cost, so the best value may change per project. @@ -355,11 +355,11 @@ rendering/batching/lights ^^^^^^^^^^^^^^^^^^^^^^^^^ - `scissor_area_threshold - ` - + ` - See light scissoring. - `max_join_items - ` - + ` - Joining items before lighting can significantly increase performance. This requires an overlap test, which has a small cost, so the costs and benefits may be project dependent, and hence the best value to use @@ -369,14 +369,14 @@ rendering/batching/debug ^^^^^^^^^^^^^^^^^^^^^^^^ - `flash_batching - ` - + ` - This is purely a debugging feature to identify regressions between the batching and legacy renderer. When it is switched on, the batching and legacy renderer are used alternately on each frame. This will decrease performance, and should not be used for your final export, only for testing. - `diagnose_frame - ` - + ` - This will periodically print a diagnostic batching log to the Godot IDE / console. @@ -384,7 +384,7 @@ rendering/batching/precision ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - `uv_contract - ` - + ` - On some hardware (notably some Android devices) there have been reports of tilemap tiles drawing slightly outside their UV range, leading to edge artifacts such as lines around tiles. If you see this problem, try enabling uv @@ -392,7 +392,7 @@ rendering/batching/precision for precision errors on devices. - `uv_contract_amount - ` - + ` - Hopefully, the default amount should cure artifacts on most devices, but this value remains adjustable just in case. @@ -486,7 +486,7 @@ I get a decrease in performance with batching. - Try the steps described above to increase the number of batching opportunities. - Try enabling `single_rect_fallback - `. + `. - The single rect fallback method is the default used without batching, and it is approximately twice as fast. However, it can result in flickering on some hardware, so its use is discouraged. @@ -502,7 +502,7 @@ I am seeing line artifacts appear on certain hardware. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - See the `uv_contract - ` + ` project setting which can be used to solve this problem. I use a large number of textures, so few items are being batched. diff --git a/tutorials/performance/cpu_optimization.rst b/tutorials/performance/cpu_optimization.rst index 0542ff9..3dfa1ea 100644 --- a/tutorials/performance/cpu_optimization.rst +++ b/tutorials/performance/cpu_optimization.rst @@ -231,12 +231,12 @@ performance when you have very large numbers of nodes (usually in the thousands) Each node is handled individually in the Godot renderer. Therefore, a smaller number of nodes with more in each can lead to better performance. -One quirk of the `SceneTree ` is that you can sometimes +One quirk of the `SceneTree` is that you can sometimes get much better performance by removing nodes from the SceneTree, rather than by pausing or hiding them. You don't have to delete a detached node. You can for example, keep a reference to a node, detach it from the scene tree using -`Node.remove_child(node) `, then reattach -it later using `Node.add_child(node) `. +`Node.remove_child(node)`, then reattach +it later using `Node.add_child(node)`. This can be very useful for adding and removing areas from a game, for example. You can avoid the SceneTree altogether by using Server APIs. For more diff --git a/tutorials/performance/optimizing_3d_performance.rst b/tutorials/performance/optimizing_3d_performance.rst index 9a722d4..842d186 100644 --- a/tutorials/performance/optimizing_3d_performance.rst +++ b/tutorials/performance/optimizing_3d_performance.rst @@ -71,7 +71,7 @@ through add-ons or may be available in core Godot in the future. Transparent objects ~~~~~~~~~~~~~~~~~~~ -Godot sorts objects by `Material ` and `Shader +Godot sorts objects by `Material` and `Shader ` to improve performance. This, however, can not be done with transparent objects. Transparent objects are rendered from back to front to make blending with what is behind work. As a result, @@ -116,7 +116,7 @@ Use instancing (MultiMesh) ~~~~~~~~~~~~~~~~~~~~~~~~~~ If several identical objects have to be drawn in the same place or nearby, try -using `MultiMesh ` instead. MultiMesh allows the drawing +using `MultiMesh` instead. MultiMesh allows the drawing of many thousands of objects at very little performance cost, making it ideal for flocks, grass, particles, and anything else where you have thousands of identical objects. diff --git a/tutorials/performance/using_multimesh.rst b/tutorials/performance/using_multimesh.rst index 3d27fa8..5f276e2 100644 --- a/tutorials/performance/using_multimesh.rst +++ b/tutorials/performance/using_multimesh.rst @@ -35,12 +35,12 @@ which are ideal for this). Another alternative is to use GDNative and C++, which should be extremely efficient (it's possible to set the entire state for all objects using linear memory via the -`VisualServer.multimesh_set_as_bulk_array() ` +`VisualServer.multimesh_set_as_bulk_array()` function). This way, the array can be created with multiple threads, then set in one call, providing high cache efficiency. Finally, it's not required to have all MultiMesh instances visible. The amount of visible ones can be -controlled with the `MultiMesh.visible_instance_count ` +controlled with the `MultiMesh.visible_instance_count` property. The typical workflow is to allocate the maximum amount of instances that will be used, then change the amount visible depending on how many are currently needed. diff --git a/tutorials/performance/using_servers.rst b/tutorials/performance/using_servers.rst index 0b6c36a..b959dca 100644 --- a/tutorials/performance/using_servers.rst +++ b/tutorials/performance/using_servers.rst @@ -33,10 +33,10 @@ At the core, Godot uses the concept of Servers. They are very low-level APIs to rendering, physics, sound, etc. The scene system is built on top of them and uses them directly. The most common servers are: -* `VisualServer `: handles everything related to graphics. -* `PhysicsServer `: handles everything related to 3D physics. -* `Physics2DServer `: handles everything related to 2D physics. -* `AudioServer `: handles everything related to audio. +* `VisualServer`: handles everything related to graphics. +* `PhysicsServer`: handles everything related to 3D physics. +* `Physics2DServer`: handles everything related to 2D physics. +* `AudioServer`: handles everything related to audio. Explore their APIs and you will realize that all the functions provided are low-level implementations of everything Godot allows you to do. @@ -44,38 +44,38 @@ implementations of everything Godot allows you to do. RIDs ---- -The key to using servers is understanding Resource ID (`RID `) objects. These are opaque +The key to using servers is understanding Resource ID (`RID`) objects. These are opaque handles to the server implementation. They are allocated and freed manually. Almost every function in the servers requires RIDs to access the actual resource. Most Godot nodes and resources contain these RIDs from the servers internally, and they can -be obtained with different functions. In fact, anything that inherits `Resource ` +be obtained with different functions. In fact, anything that inherits `Resource` can be directly casted to an RID. Not all resources contain an RID, though: in such cases, the RID will be empty. The resource can then be passed to server APIs as an RID. -.. Warning:: Resources are reference-counted (see `Reference `), and +.. Warning:: Resources are reference-counted (see `Reference`), and references to a resource's RID are *not* counted when determining whether the resource is still in use. Make sure to keep a reference to the resource outside the server, or else both it and its RID will be erased. For nodes, there are many functions available: -* For CanvasItem, the `CanvasItem.get_canvas_item() ` +* For CanvasItem, the `CanvasItem.get_canvas_item()` method will return the canvas item RID in the server. -* For CanvasLayer, the `CanvasLayer.get_canvas() ` +* For CanvasLayer, the `CanvasLayer.get_canvas()` method will return the canvas RID in the server. -* For Viewport, the `Viewport.get_viewport_rid() ` +* For Viewport, the `Viewport.get_viewport_rid()` method will return the viewport RID in the server. -* For 3D, the `World ` resource (obtainable in the `Viewport ` - and `Spatial ` nodes) +* For 3D, the `World` + and `Spatial` nodes) contains functions to get the *VisualServer Scenario*, and the *PhysicsServer Space*. This allows creating 3D objects directly with the server API and using them. -* For 2D, the `World2D ` resource (obtainable in the `Viewport ` - and `CanvasItem ` nodes) +* For 2D, the `World2D` + and `CanvasItem` nodes) contains functions to get the *VisualServer Canvas*, and the *Physics2DServer Space*. This allows creating 2D objects directly with the server API and using them. * The `VisualInstance` class, allows getting the scenario *instance* and - *instance base* via the `VisualInstance.get_instance() ` - and `VisualInstance.get_base() ` respectively. + *instance base* via the `VisualInstance.get_instance()` + and `VisualInstance.get_base()` respectively. Try exploring the nodes and resources you are familiar with and find the functions to obtain the server *RIDs*. @@ -86,7 +86,7 @@ Creating a sprite ----------------- This is a simple example of how to create a sprite from code and move it using the low-level -`CanvasItem ` API. +`CanvasItem` API. gdscript GDScript @@ -160,8 +160,8 @@ gdscript GDScript Creating a 2D RigidBody and moving a sprite with it --------------------------------------------------- -This creates a `RigidBody2D ` using the `Physics2DServer ` API, -and moves a `CanvasItem ` when the body moves. +This creates a `RigidBody2D` API, +and moves a `CanvasItem` when the body moves. gdscript GDScript @@ -197,7 +197,7 @@ gdscript GDScript ``` The 3D version should be very similar, as 2D and 3D physics servers are identical (using -`RigidBody ` and `PhysicsServer ` respectively). +`RigidBody` respectively). Getting data from the servers ----------------------------- diff --git a/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst b/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst index 88886f0..4c331a8 100644 --- a/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst +++ b/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst @@ -7,8 +7,8 @@ This tutorial explores a technique used in the game `ABZU ` and -a `MultiMeshInstance `. Using the following technique you +In Godot, this can be accomplished with a custom `Shader` and +a `MultiMeshInstance`. Using the following technique you can render thousands of animated objects, even on low end hardware. We will start by animating one fish. Then, we will see how to extend that animation to @@ -17,8 +17,8 @@ thousands of fish. Animating one Fish ------------------ -We will start with a single fish. Load your fish model into a `MeshInstance ` -and add a new `ShaderMaterial `. +We will start with a single fish. Load your fish model into a `MeshInstance` +and add a new `ShaderMaterial`. Here is the fish we will be using for the example images, you can use any fish model you like. @@ -28,7 +28,7 @@ Here is the fish we will be using for the example images, you can use any fish m shared with a creative commons license. CC0 1.0 Universal (CC0 1.0) Public Domain Dedication https://creativecommons.org/publicdomain/zero/1.0/ -Typically, you would use bones and a `Skeleton ` to animate objects. However, +Typically, you would use bones and a `Skeleton` to animate objects. However, bones are animated on the CPU and so you end having to calculate thousands of operations every frame and it becomes impossible to have thousands of objects. Using vertex animation in a vertex shader, you avoid using bones and can instead calculate the full animation in a few lines of code @@ -187,12 +187,12 @@ A MultiMeshInstance node is created and used the same way you would make a MeshI For this tutorial, we will name the MultiMeshInstance node ``School``, because it will contain a school of fish. -Once you have a MultiMeshInstance add a `MultiMesh `, and to that -MultiMesh add your `Mesh ` with the shader from above. +Once you have a MultiMeshInstance add a `MultiMesh`, and to that +MultiMesh add your `Mesh` with the shader from above. MultiMeshes draw your Mesh with three additional per-instance properties: Transform (rotation, translation, scale), Color, and Custom. Custom is used to pass in 4 multi-use variables using -a `Color `. +a `Color`. ``instance_count`` specifies how many instances of the mesh you want to draw. For now, leave ``instance_count`` at ``0`` because you cannot change any of the other parameters while @@ -271,5 +271,5 @@ moving. You can move them by updating the per-instance transform for each fish e doing so will be faster than moving thousands of MeshInstances per frame, it'll still likely be slow. -In the next tutorial we will cover how to use `Particles ` to take advantage +In the next tutorial we will cover how to use `Particles` to take advantage of the GPU and move each fish around individually while still receiving the benefits of instancing. diff --git a/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst b/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst index f532046..952ec36 100644 --- a/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst +++ b/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst @@ -3,20 +3,20 @@ Controlling thousands of fish with Particles ============================================ -The problem with `MeshInstances ` is that it is expensive to +The problem with `MeshInstances` is that it is expensive to update their transform array. It is great for placing many static objects around the scene. But it is still difficult to move the objects around the scene. To make each instance move in an interesting way, we will use a -`Particles ` node. Particles take advantage of GPU acceleration -by computing and setting the per-instance information in a `Shader `. +`Particles` node. Particles take advantage of GPU acceleration +by computing and setting the per-instance information in a `Shader`. -.. note:: Particles are not available in GLES2, instead use `CPUParticles `, +.. note:: Particles are not available in GLES2, instead use `CPUParticles`, which do the same thing as Particles, but do not benefit from GPU acceleration. First create a Particles node. Then, under "Draw Passes" set the Particle's "Draw Pass 1" to your -`Mesh `. Then under "Process Material" create a new -`ShaderMaterial `. +`Mesh`. Then under "Process Material" create a new +`ShaderMaterial`. Set the ``shader_type`` to ``particles``. @@ -48,7 +48,7 @@ Then add the following two functions: return x; } -These functions come from the default `ParticlesMaterial `. +These functions come from the default `ParticlesMaterial`. They are used to generate a random number from each particle's ``RANDOM_SEED``. A unique thing about particle shaders is that some built-in variables are saved across frames. diff --git a/tutorials/physics/collision_shapes_3d.rst b/tutorials/physics/collision_shapes_3d.rst index c505e69..f279a27 100644 --- a/tutorials/physics/collision_shapes_3d.rst +++ b/tutorials/physics/collision_shapes_3d.rst @@ -13,7 +13,7 @@ Godot provides many kinds of collision shapes, with different performance and accuracy tradeoffs. You can define the shape of a `class_PhysicsBody` by adding one or more -`CollisionShapes ` as child nodes. Note that you must +`CollisionShapes` as child nodes. Note that you must add a `class_Shape` *resource* to collision shape nodes in the Inspector dock. @@ -43,7 +43,7 @@ better performance as well. Convex collision shapes ----------------------- -`Convex collision shapes ` are a compromise +`Convex collision shapes` are a compromise between primitive collision shapes and concave collision shapes. They can represent shapes of any complexity, but with an important caveat. As their name implies, an individual shape can only represent a *convex* shape. For instance, @@ -75,7 +75,7 @@ viewport. The editor exposes two generation modes: Concave or trimesh collision shapes ----------------------------------- -`Concave collision shapes `, also called trimesh +`Concave collision shapes`, also called trimesh collision shapes, can take any form, from a few triangles to thousands of triangles. Concave shapes are the slowest option but are also the most accurate in Godot. **You can only use concave shapes within StaticBodies.** They will not diff --git a/tutorials/physics/kinematic_character_2d.rst b/tutorials/physics/kinematic_character_2d.rst index a6a3354..270f95e 100644 --- a/tutorials/physics/kinematic_character_2d.rst +++ b/tutorials/physics/kinematic_character_2d.rst @@ -101,8 +101,8 @@ Moving the kinematic character Go back to the character scene, and open the script, the magic begins now! Kinematic body will do nothing by default, but it has a useful function called -`KinematicBody2D.move_and_collide() `. -This function takes a `Vector2 ` as +`KinematicBody2D.move_and_collide()`. +This function takes a `Vector2` as an argument, and tries to apply that motion to the kinematic body. If a collision happens, it stops right at the moment of the collision. diff --git a/tutorials/physics/physics_introduction.rst b/tutorials/physics/physics_introduction.rst index 14303e0..4a9e442 100644 --- a/tutorials/physics/physics_introduction.rst +++ b/tutorials/physics/physics_introduction.rst @@ -26,28 +26,28 @@ In this guide, you will learn: Collision objects ----------------- -Godot offers four kinds of physics bodies, extending `CollisionObject2D `: +Godot offers four kinds of physics bodies, extending `CollisionObject2D`: -- `Area2D ` +- `Area2D` ``Area2D`` nodes provide **detection** and **influence**. They can detect when objects overlap and can emit signals when bodies enter or exit. An ``Area2D`` can also be used to override physics properties, such as gravity or damping, in a defined area. -The other three bodies extend `PhysicsBody2D `: +The other three bodies extend `PhysicsBody2D`: -- `StaticBody2D ` +- `StaticBody2D` A static body is one that is not moved by the physics engine. It participates in collision detection, but does not move in response to the collision. They are most often used for objects that are part of the environment or that do not need to have any dynamic behavior. -- `RigidBody2D ` +- `RigidBody2D` This is the node that implements simulated 2D physics. You do not control a ``RigidBody2D`` directly, but instead you apply forces to it (gravity, impulses, etc.) and the physics engine calculates the resulting movement. `Read more about using rigid bodies. ` -- `KinematicBody2D ` +- `KinematicBody2D` A body that provides collision detection, but no physics. All movement and collision response must be implemented in code. @@ -61,15 +61,15 @@ and set if it's absorbent and/or rough. Collision shapes ~~~~~~~~~~~~~~~~ -A physics body can hold any number of `Shape2D ` objects +A physics body can hold any number of `Shape2D` objects as children. These shapes are used to define the object's collision bounds and to detect contact with other objects. .. note:: In order to detect collisions, at least one ``Shape2D`` must be assigned to the object. -The most common way to assign a shape is by adding a `CollisionShape2D ` -or `CollisionPolygon2D ` as a child of the object. +The most common way to assign a shape is by adding a `CollisionShape2D` +or `CollisionPolygon2D` as a child of the object. These nodes allow you to draw the shape directly in the editor workspace. .. important:: Be careful to never scale your collision shapes in the editor. @@ -89,7 +89,7 @@ of a body's state variables such as ``position`` or ``linear velocity`` may not be accurate for the current frame. In order to avoid this inaccuracy, any code that needs to access a body's properties should -be run in the `Node._physics_process() ` +be run in the `Node._physics_process()` callback, which is called before each physics step at a constant frame rate (60 times per second by default). This method will be passed a ``delta`` parameter, which is a floating-point number equal to the time passed in @@ -185,7 +185,7 @@ objects overlap and emit signals when bodies enter or exit. Areas can also be used to override physics properties, such as gravity or damping, in a defined area. -There are three main uses for `Area2D `: +There are three main uses for `Area2D`: - Overriding physics parameters (such as gravity) in a given region. @@ -216,7 +216,7 @@ RigidBody2D ----------- This is the node that implements simulated 2D physics. You do not control a -`RigidBody2D ` directly. Instead, you apply forces +`RigidBody2D` directly. Instead, you apply forces to it and the physics engine calculates the resulting movement, including collisions with other bodies, and collision responses, such as bouncing, rotating, etc. @@ -225,7 +225,7 @@ You can modify a rigid body's behavior via properties such as "Mass", "Friction", or "Bounce", which can be set in the Inspector. The body's behavior is also affected by the world's properties, as set in -`Project Settings -> Physics`, or by entering an `Area2D ` +`Project Settings -> Physics`, or by entering an `Area2D` that is overriding the global physics properties. When a rigid body is at rest and hasn't moved for a while, it goes to sleep. @@ -239,9 +239,9 @@ Rigid body modes A rigid body can be set to one of four modes: - **Rigid** - The body behaves as a physical object. It collides with other bodies and responds to forces applied to it. This is the default mode. -- **Static** - The body behaves like a `StaticBody2D ` and does not move. +- **Static** - The body behaves like a `StaticBody2D` and does not move. - **Character** - Similar to "Rigid" mode, but the body cannot rotate. -- **Kinematic** - The body behaves like a `KinematicBody2D ` and must be moved by code. +- **Kinematic** - The body behaves like a `KinematicBody2D` and must be moved by code. Using RigidBody2D ~~~~~~~~~~~~~~~~~ @@ -255,9 +255,9 @@ automatically be calculated by the physics engine. However, if you do wish to have some control over the body, you should take care - altering the ``position``, ``linear_velocity``, or other physics properties of a rigid body can result in unexpected behavior. If you need to alter any -of the physics-related properties, you should use the `_integrate_forces() ` +of the physics-related properties, you should use the `_integrate_forces()` callback instead of ``_physics_process()``. In this callback, you have access -to the body's `Physics2DDirectBodyState `, +to the body's `Physics2DDirectBodyState`, which allows for safely changing properties and synchronizing them with the physics engine. @@ -291,7 +291,7 @@ the body and letting the physics engine calculate the resulting movement. .. note:: When a rigid body goes to sleep, the ``_integrate_forces()`` function will not be called. To override this behavior, you will need to keep the body awake by creating a collision, applying a - force to it, or by disabling the `can_sleep ` + force to it, or by disabling the `can_sleep` property. Be aware that this can have a negative effect on performance. Contact reporting @@ -299,19 +299,19 @@ Contact reporting By default, rigid bodies do not keep track of contacts, because this can require a huge amount of memory if many bodies are in the scene. To enable -contact reporting, set the `contacts_reported ` +contact reporting, set the `contacts_reported` property to a non-zero value. The contacts can then be obtained via -`Physics2DDirectBodyState.get_contact_count() ` +`Physics2DDirectBodyState.get_contact_count()` and related functions. -Contact monitoring via signals can be enabled via the `contact_monitor ` -property. See `RigidBody2D ` for the list of available +Contact monitoring via signals can be enabled via the `contact_monitor` +property. See `RigidBody2D` for the list of available signals. KinematicBody2D --------------- -`KinematicBody2D ` bodies detect collisions with +`KinematicBody2D` bodies detect collisions with other bodies, but are not affected by physics properties like gravity or friction. Instead, they must be controlled by the user via code. The physics engine will not move a kinematic body. @@ -329,11 +329,11 @@ After a collision, you may want the body to bounce, to slide along a wall, or to alter the properties of the object it hit. The way you handle collision response depends on which method you used to move the KinematicBody2D. -`move_and_collide ` +`move_and_collide` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ When using ``move_and_collide()``, the function returns a -`KinematicCollision2D ` object, which contains +`KinematicCollision2D` object, which contains information about the collision and the colliding body. You can use this information to determine the response. @@ -368,7 +368,7 @@ gdscript GDScript velocity = velocity.bounce(collision_info.normal) ``` -`move_and_slide ` +`move_and_slide` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sliding is a common collision response; imagine a player moving along walls diff --git a/tutorials/physics/ragdoll_system.rst b/tutorials/physics/ragdoll_system.rst index 2e36e4f..d6941e1 100644 --- a/tutorials/physics/ragdoll_system.rst +++ b/tutorials/physics/ragdoll_system.rst @@ -18,7 +18,7 @@ Setting up the ragdoll Creating physical bones ~~~~~~~~~~~~~~~~~~~~~~~ -Like many other features in the engine, there is a node to set up a ragdoll: the `PhysicalBone ` node. To simplify the setup, you can generate ``PhysicalBone`` nodes with the "Create physical skeleton" feature in the skeleton node. +Like many other features in the engine, there is a node to set up a ragdoll: the `PhysicalBone` node. To simplify the setup, you can generate ``PhysicalBone`` nodes with the "Create physical skeleton" feature in the skeleton node. Open the platformer demo in Godot, and then the Robi scene. Select the ``Skeleton`` node. A skeleton button appears on the top bar menu: diff --git a/tutorials/physics/ray-casting.rst b/tutorials/physics/ray-casting.rst index 39b2c75..9c9da0f 100644 --- a/tutorials/physics/ray-casting.rst +++ b/tutorials/physics/ray-casting.rst @@ -14,7 +14,7 @@ do this in 2D and 3D. Godot stores all the low level game information in servers, while the scene is just a frontend. As such, ray casting is generally a lower-level task. For simple raycasts, node such as -`RayCast ` and `RayCast2D ` +`RayCast` will work, as they will return every frame what the result of a raycast is. @@ -27,12 +27,12 @@ Space In the physics world, Godot stores all the low level collision and physics information in a *space*. The current 2d space (for 2D Physics) can be obtained by accessing -`CanvasItem.get_world_2d().space `. -For 3D, it's `Spatial.get_world().space `. +`CanvasItem.get_world_2d().space`. +For 3D, it's `Spatial.get_world().space`. -The resulting space `RID ` can be used in -`PhysicsServer ` and -`Physics2DServer ` respectively for 3D and 2D. +The resulting space `RID` can be used in +`PhysicsServer` and +`Physics2DServer` respectively for 3D and 2D. Accessing space --------------- @@ -40,13 +40,13 @@ Accessing space Godot physics runs by default in the same thread as game logic, but may be set to run on a separate thread to work more efficiently. Due to this, the only time accessing space is safe is during the -`Node._physics_process() ` +`Node._physics_process()` callback. Accessing it from outside this function may result in an error due to space being *locked*. To perform queries into physics space, the -`Physics2DDirectSpaceState ` -and `PhysicsDirectSpaceState ` +`Physics2DDirectSpaceState` +and `PhysicsDirectSpaceState` must be used. Use the following code in 2D: @@ -81,7 +81,7 @@ Raycast query ------------- For performing a 2D raycast query, the method -`Physics2DDirectSpaceState.intersect_ray() ` +`Physics2DDirectSpaceState.intersect_ray()` may be used. For example: gdscript GDScript @@ -176,11 +176,11 @@ See `doc_physics_introduction_collision_layer_code_example` for details on how t Casting a ray from screen to 3D physics space is useful for object picking. There is not much need to do this because -`CollisionObject ` +`CollisionObject` has an "input_event" signal that will let you know when it was clicked, but in case there is any desire to do it manually, here's how. -To cast a ray from the screen, you need a `Camera ` +To cast a ray from the screen, you need a `Camera` node. A ``Camera`` can be in two projection modes: perspective and orthogonal. Because of this, both the ray origin and direction must be obtained. This is because ``origin`` changes in orthogonal mode, while diff --git a/tutorials/physics/rigid_body.rst b/tutorials/physics/rigid_body.rst index 368a7ed..fa7f630 100644 --- a/tutorials/physics/rigid_body.rst +++ b/tutorials/physics/rigid_body.rst @@ -7,7 +7,7 @@ What is a rigid body? --------------------- A rigid body is one that is directly controlled by the physics engine in order to simulate the behavior of physical objects. -In order to define the shape of the body, it must have one or more `Shape ` objects assigned. Note that setting the position of these shapes will affect the body's center of mass. +In order to define the shape of the body, it must have one or more `Shape` objects assigned. Note that setting the position of these shapes will affect the body's center of mass. How to control a rigid body --------------------------- @@ -15,12 +15,12 @@ How to control a rigid body A rigid body's behavior can be altered by setting its properties, such as mass and weight. A physics material needs to be added to the rigid body to adjust its friction and bounce, and set if it's absorbent and/or rough. These properties can be set in the Inspector or via code. -See `RigidBody ` and `PhysicsMaterial ` for +See `RigidBody` for the full list of properties and their effects. There are several ways to control a rigid body's movement, depending on your desired application. -If you only need to place a rigid body once, for example to set its initial location, you can use the methods provided by the `Spatial ` node, such as ``set_global_transform()`` or ``look_at()``. However, these methods cannot be called every frame or the physics engine will not be able to correctly simulate the body's state. +If you only need to place a rigid body once, for example to set its initial location, you can use the methods provided by the `Spatial` node, such as ``set_global_transform()`` or ``look_at()``. However, these methods cannot be called every frame or the physics engine will not be able to correctly simulate the body's state. As an example, consider a rigid body that you want to rotate so that it points towards another object. A common mistake when implementing this kind of behavior is to use ``look_at()`` every frame, which breaks the physics simulation. Below, we'll demonstrate how to implement this correctly. The fact that you can't use ``set_global_transform()`` or ``look_at()`` methods doesn't mean that you can't have full control of a rigid body. Instead, you can control it by using the ``_integrate_forces()`` callback. In this method, you can add *forces*, apply *impulses*, or set the *velocity* in order to achieve any movement you desire. diff --git a/tutorials/physics/soft_body.rst b/tutorials/physics/soft_body.rst index b7823ad..a790b0f 100644 --- a/tutorials/physics/soft_body.rst +++ b/tutorials/physics/soft_body.rst @@ -9,7 +9,7 @@ This can for example be used to simulate cloth or to create more realistic chara Basic set-up ~~~~~~~~~~~~ -A `SoftBody ` node is used for soft body simulations. +A `SoftBody` node is used for soft body simulations. We will create a bouncy cube to demonstrate the setup of a soft body. @@ -42,7 +42,7 @@ Open the ``PlaneMesh`` properties and set the size(x: 0.5 y: 1) then set ``Subdi .. tip:: Subdivision generates a more tessellated mesh for better simulations. -Add a `BoneAttachment ` node under the skeleton node and select the Neck bone to attach the cloak to the character skeleton. +Add a `BoneAttachment` node under the skeleton node and select the Neck bone to attach the cloak to the character skeleton. .. note:: ``BoneAttachment`` node is to attach objects to a bone of a armature. The attached object will follow the bone's movement, weapon of a character can be attached this way. diff --git a/tutorials/physics/using_area_2d.rst b/tutorials/physics/using_area_2d.rst index 9273578..6d4ff38 100644 --- a/tutorials/physics/using_area_2d.rst +++ b/tutorials/physics/using_area_2d.rst @@ -10,7 +10,7 @@ Godot offers a number of collision objects to provide both collision detection and response. Trying to decide which one to use for your project can be confusing. You can avoid problems and simplify development if you understand how each of them works and what their pros and cons are. In this tutorial, we'll look at the -`Area2D ` node and show some examples of how it can be used. +`Area2D` node and show some examples of how it can be used. .. note:: This document assumes you're familiar with Godot's various physics bodies. Please read `doc_physics_introduction` first. @@ -19,7 +19,7 @@ What is an area? ---------------- An Area2D defines a region of 2D space. In this space you can detect other -`CollisionObject2D ` nodes overlapping, entering, +`CollisionObject2D` nodes overlapping, entering, and exiting. Areas also allow for overriding local physics properties. We'll explore each of these functions below. @@ -41,7 +41,7 @@ and mask(s). The "Audio Bus" section allows you to override audio in the area, for example to apply an audio effect when the player moves through. -Note that Area2D extends `CollisionObject2D `, so it +Note that Area2D extends `CollisionObject2D`, so it also provides properties inherited from that class, such as ``input_pickable``. Overlap detection diff --git a/tutorials/physics/using_kinematic_body_2d.rst b/tutorials/physics/using_kinematic_body_2d.rst index 5aa8a56..2b27091 100644 --- a/tutorials/physics/using_kinematic_body_2d.rst +++ b/tutorials/physics/using_kinematic_body_2d.rst @@ -10,7 +10,7 @@ Godot offers several collision objects to provide both collision detection and response. Trying to decide which one to use for your project can be confusing. You can avoid problems and simplify development if you understand how each of them works and what their pros and cons are. In this tutorial, we'll look at the -`KinematicBody2D ` node and show some examples +`KinematicBody2D` node and show some examples of how to use it. .. note:: This document assumes you're familiar with Godot's various physics @@ -46,11 +46,11 @@ see examples of how they work. ``move_and_collide`` ~~~~~~~~~~~~~~~~~~~~ -This method takes one parameter: a `Vector2 ` indicating the body's +This method takes one parameter: a `Vector2` indicating the body's relative movement. Typically, this is your velocity vector multiplied by the frame timestep (``delta``). If the engine detects a collision anywhere along this vector, the body will immediately stop moving. If this happens, the -method will return a `KinematicCollision2D ` object. +method will return a `KinematicCollision2D` object. ``KinematicCollision2D`` is an object containing data about the collision and the colliding object. Using this data, you can calculate your collision @@ -92,7 +92,7 @@ other parameters allowing you to customize the slide behavior: - ``infinite_inertia`` - *default value:* ``true`` -When this parameter is ``true``, the body can push `RigidBody2D ` +When this parameter is ``true``, the body can push `RigidBody2D` nodes, ignoring their mass, but won't detect collisions with them. If it's ``false`` the body will collide with rigid bodies and stop. @@ -133,7 +133,7 @@ gdscript GDScript .. note:: `get_slide_count()` only counts times the body has collided and changed direction. -See `KinematicCollision2D ` for details on what +See `KinematicCollision2D` for details on what collision data is returned. Which movement method to use? @@ -229,7 +229,7 @@ gdscript GDScript Run this scene and you'll see that ``move_and_collide()`` works as expected, moving the body along the velocity vector. Now let's see what happens when you add -some obstacles. Add a `StaticBody2D ` with a +some obstacles. Add a `StaticBody2D` with a rectangular collision shape. For visibility, you can use a sprite, a Polygon2D, or turn on "Visible Collision Shapes" from the "Debug" menu. @@ -344,7 +344,7 @@ If you've downloaded the sample project, you can find this in "Platformer.tscn". For this example, we'll assume you have a level made of ``StaticBody2D`` objects. They can be any shape and size. In the sample project, we're using -`Polygon2D ` to create the platform shapes. +`Polygon2D` to create the platform shapes. Here's the code for the player body: diff --git a/tutorials/platform/android/android_in_app_purchases.rst b/tutorials/platform/android/android_in_app_purchases.rst index 733fbb1..8b27e03 100644 --- a/tutorials/platform/android/android_in_app_purchases.rst +++ b/tutorials/platform/android/android_in_app_purchases.rst @@ -121,7 +121,7 @@ Check if the user purchased an item *********************************** To get all purchases, call ``queryPurchases``. Unlike most of the other functions, ``queryPurchases`` is -a synchronous operation and returns a `Dictionary ` with a status code +a synchronous operation and returns a `Dictionary` with a status code and either an array of purchases or an error message. Only active subscriptions and non-consumed one-time purchases are returned. Full example: diff --git a/tutorials/platform/customizing_html5_shell.rst b/tutorials/platform/customizing_html5_shell.rst index c37f79f..b15f3b9 100644 --- a/tutorials/platform/customizing_html5_shell.rst +++ b/tutorials/platform/customizing_html5_shell.rst @@ -148,7 +148,7 @@ allows to test for a specific major version of WebGL. As the real executable file does not exist in the Web environment, the engine only stores a virtual filename formed from the base name of loaded engine files. This value affects the output of the -`OS.get_executable_path() ` method and defines the name of +`OS.get_executable_path()` method and defines the name of the automatically started main pack. The :js:attr:`executable` override option can be used to override this value. diff --git a/tutorials/platform/mobile_rendering_limitations.rst b/tutorials/platform/mobile_rendering_limitations.rst index 0b9f7a9..bf65fb0 100644 --- a/tutorials/platform/mobile_rendering_limitations.rst +++ b/tutorials/platform/mobile_rendering_limitations.rst @@ -55,7 +55,7 @@ The following project settings have mobile-specific overrides: | *GLES3 only:* ``rendering/quality/reflections/texture_array_reflections`` | ``true`` | ``false`` | +---------------------------------------------------------------------------+-----------------+--------------------+ -See the `ProjectSettings class documentation ` +See the `ProjectSettings class documentation` for more information on those setting overrides. If you're only targeting mobile platforms in your project, consider changing the diff --git a/tutorials/plugins/editor/import_plugins.rst b/tutorials/plugins/editor/import_plugins.rst index ef2cc88..241f2e1 100644 --- a/tutorials/plugins/editor/import_plugins.rst +++ b/tutorials/plugins/editor/import_plugins.rst @@ -66,10 +66,10 @@ when needed: When this plugin is activated, it will create a new instance of the import plugin (which we'll soon make) and add it to the editor using the -`add_import_plugin() ` method. We store +`add_import_plugin()` method. We store a reference to it in a class member ``import_plugin`` so we can refer to it later when removing it. The -`remove_import_plugin() ` method is +`remove_import_plugin()` method is called when the plugin is deactivated to clean up the memory and let the editor know the import plugin isn't available anymore. @@ -81,7 +81,7 @@ The EditorImportPlugin class ---------------------------- The main character of the show is the -`EditorImportPlugin class `. It is responsible for +`EditorImportPlugin class`. It is responsible for implementing the methods that are called by Godot when it needs to know how to deal with files. @@ -196,7 +196,7 @@ plugin: func get_preset_count(): return Presets.size() -The `get_preset_count() ` method +The `get_preset_count()` method returns the amount of presets that this plugins defines. We only have one preset now, but we can make this method future-proof by returning the size of our ``Presets`` enumeration. @@ -212,7 +212,7 @@ now, but we can make this method future-proof by returning the size of our Here we have the -`get_preset_name() ` method, which +`get_preset_name()` method, which gives names to the presets as they will be presented to the user, so be sure to use short and clear names. @@ -237,7 +237,7 @@ you do this you have to be careful when you add more presets. return [] This is the method which defines the available options. -`get_import_options() ` returns +`get_import_options()` returns an array of dictionaries, and each dictionary contains a few keys that are checked to customize the option as its shown to the user. The following table shows the possible keys: @@ -275,7 +275,7 @@ of options first and then change it based on the preset. return true For the -`get_option_visibility() ` +`get_option_visibility()` method, we simply return ``true`` because all of our options (i.e. the single one we defined) are visible all the time. @@ -286,7 +286,7 @@ The ``import`` method --------------------- The heavy part of the process, responsible for converting the files into -resources, is covered by the `import() ` +resources, is covered by the `import()` method. Our sample code is a bit long, so let's split in a few parts: :: @@ -302,7 +302,7 @@ method. Our sample code is a bit long, so let's split in a few parts: file.close() The first part of our import method opens and reads the source file. We use the -`File ` class to do that, passing the ``source_file`` +`File` class to do that, passing the ``source_file`` parameter which is provided by the editor. If there's an error when opening the file, we return it to let the editor know @@ -324,7 +324,7 @@ This code takes the line of the file it read before and splits it in pieces that are separated by a comma. If there are more or less than the three values, it considers the file invalid and reports an error. -Then it creates a new `Color ` variable and sets its values +Then it creates a new `Color` variable and sets its values according to the input file. If the ``use_red_anyway`` option is enabled, then it sets the color as a pure red instead. @@ -333,7 +333,7 @@ it sets the color as a pure red instead. var material = SpatialMaterial.new() material.albedo_color = color -This part makes a new `SpatialMaterial ` that is the +This part makes a new `SpatialMaterial` that is the imported resource. We create a new instance of it and then set its albedo color as the value we got before. @@ -349,7 +349,7 @@ this we call the ``get_save_extension`` method that we defined earlier, so we can be sure that they won't get out of sync. We also return the result from the -`ResourceSaver.save() ` method, so if there's an +`ResourceSaver.save()` method, so if there's an error in this step, the editor will know about it. Platform variants and generated files diff --git a/tutorials/plugins/editor/making_plugins.rst b/tutorials/plugins/editor/making_plugins.rst index 27790d3..e57c69a 100644 --- a/tutorials/plugins/editor/making_plugins.rst +++ b/tutorials/plugins/editor/making_plugins.rst @@ -91,8 +91,8 @@ editor, and it must inherit from `class_EditorPlugin`. It's important to deal with initialization and clean-up of resources. A good practice is to use the virtual function -`_enter_tree() ` to initialize your plugin and -`_exit_tree() ` to clean it up. Thankfully, +`_enter_tree()` to initialize your plugin and +`_exit_tree()` to clean it up. Thankfully, the dialog generates these callbacks for you. Your script should look something like this: @@ -134,7 +134,7 @@ custom behavior. are writing GDScript or NativeScript, we recommend using Script Classes instead. To create a new node type, you can use the function -`add_custom_type() ` from the +`add_custom_type()` from the `class_EditorPlugin` class. This function can add new types to the editor (nodes or resources). However, before you can create the type, you need a script that will act as the logic for the type. While that script doesn't have to use @@ -234,7 +234,7 @@ Since we're trying to add a new custom dock, we need to create the contents of the dock. This is nothing more than a standard Godot scene: just create a new scene in the editor then edit it. -For an editor dock, the root node **must** be a `Control ` +For an editor dock, the root node **must** be a `Control` or one of its child classes. For this tutorial, you can create a single button. The name of the root node will also be the name that appears on the dock tab, so be sure to give it a short and descriptive name. @@ -244,8 +244,8 @@ Also, don't forget to add some text to your button. Save this scene as ``my_dock.tscn``. Now, we need to grab the scene we created then add it as a dock in the editor. For this, you can rely on the function -`add_control_to_dock() ` from the -`EditorPlugin ` class. +`add_control_to_dock()` from the +`EditorPlugin` class. You need to select a dock position and define the control to add (which is the scene you just created). Don't forget to diff --git a/tutorials/plugins/editor/spatial_gizmos.rst b/tutorials/plugins/editor/spatial_gizmos.rst index 983f5ff..51df01b 100644 --- a/tutorials/plugins/editor/spatial_gizmos.rst +++ b/tutorials/plugins/editor/spatial_gizmos.rst @@ -20,7 +20,7 @@ The EditorSpatialGizmoPlugin ---------------------------- Regardless of the approach we choose, we will need to create a new -`EditorSpatialGizmoPlugin `. This will allow +`EditorSpatialGizmoPlugin`. This will allow us to set a name for the new gizmo type and define other behaviors such as whether the gizmo can be hidden or not. @@ -56,7 +56,7 @@ This would be a basic setup: remove_spatial_gizmo_plugin(gizmo_plugin) -For simple gizmos, just inheriting `EditorSpatialGizmoPlugin ` +For simple gizmos, just inheriting `EditorSpatialGizmoPlugin` is enough. If you want to store some per-gizmo data or you are porting a Godot 3.0 gizmo to 3.1+, you should go with the second approach. @@ -159,7 +159,7 @@ So the final plugin would look somewhat like this: # (get_handle_name(), get_handle_value(), commit_handle()...). Note that we just added some handles in the redraw method, but we still need to implement -the rest of handle-related callbacks in `EditorSpatialGizmoPlugin ` +the rest of handle-related callbacks in `EditorSpatialGizmoPlugin` to get properly working handles. Alternative approach diff --git a/tutorials/plugins/running_code_in_the_editor.rst b/tutorials/plugins/running_code_in_the_editor.rst index 727c030..c6779ef 100644 --- a/tutorials/plugins/running_code_in_the_editor.rst +++ b/tutorials/plugins/running_code_in_the_editor.rst @@ -136,10 +136,10 @@ Instancing scenes You can instantiate packed scenes normally and add them to the scene currently opened in the editor. By default, nodes or scenes added with -`Node.add_child(node) ` are **not** visible +`Node.add_child(node)` are **not** visible in the Scene tree dock and are **not** persisted to disk. If you wish the node or scene to be visible in the scene tree dock and persisted to disk when saving -the scene, you need to set the child node's `owner ` +the scene, you need to set the child node's `owner` property to the currently edited scene root. If you are using ``tool``: diff --git a/tutorials/rendering/multiple_resolutions.rst b/tutorials/rendering/multiple_resolutions.rst index 5f68702..8e5c006 100644 --- a/tutorials/rendering/multiple_resolutions.rst +++ b/tutorials/rendering/multiple_resolutions.rst @@ -90,7 +90,7 @@ Resizing There are several types of devices, with several types of screens, which in turn have different pixel density and resolutions. Handling all of them can be a lot of work, so Godot tries to make the developer's life a -little easier. The `Viewport ` +little easier. The `Viewport` node has several functions to handle resizing, and the root node of the scene tree is always a viewport (scenes loaded are instanced as a child of it, and it can always be accessed by calling @@ -119,7 +119,7 @@ the resolution of the window or screen. The animations below use a "base size" of just 16×9 pixels to demonstrate the effect of different stretch modes. A single sprite, also 16×9 pixels in size, covers the entire viewport, and a diagonal -`Line2D ` is added on top of it: +`Line2D` is added on top of it: .. image:: img/stretch_demo_scene.png @@ -143,7 +143,7 @@ demonstrate the effect of different stretch modes. A single sprite, also .. image:: img/stretch_2d_expand.gif - **Stretch Mode = Viewport**: Viewport scaling means that the size of - the root `Viewport ` is set precisely to the + the root `Viewport` is set precisely to the base size specified in the Project Settings' **Display** section. The scene is rendered to this viewport first. Finally, this viewport is scaled to fit the screen (taking the **Stretch Aspect** setting into @@ -250,7 +250,7 @@ From scripts To configure stretching at runtime from a script, use the ``get_tree().set_screen_stretch()`` method (see -`SceneTree.set_screen_stretch() `). +`SceneTree.set_screen_stretch()`). Common use case scenarios ------------------------- diff --git a/tutorials/rendering/viewports.rst b/tutorials/rendering/viewports.rst index 9e67e6a..a7ef8e5 100644 --- a/tutorials/rendering/viewports.rst +++ b/tutorials/rendering/viewports.rst @@ -6,23 +6,23 @@ Using Viewports Introduction ------------ -Think of a `Viewport ` as a screen onto which the game is projected. In order +Think of a `Viewport` as a screen onto which the game is projected. In order to see the game, we need to have a surface on which to draw it; that surface is -the Root `Viewport `. +the Root `Viewport`. .. image:: img/viewportnode.png -`Viewports ` can also be added to the scene so that there -are multiple surfaces to draw on. When we are drawing to a `Viewport ` +`Viewports` can also be added to the scene so that there +are multiple surfaces to draw on. When we are drawing to a `Viewport` that is not the Root, we call it a render target. We can access the contents -of a render target by accessing its corresponding `texture `. -By using a `Viewport ` as a render target, +of a render target by accessing its corresponding `texture`. +By using a `Viewport` as a render target, we can either render multiple scenes simultaneously or we can render to -a `texture ` which is applied to an object in the scene, for example a dynamic +a `texture` which is applied to an object in the scene, for example a dynamic skybox. -`Viewports ` have a variety of use cases, including: +`Viewports` have a variety of use cases, including: - Rendering 3D objects within a 2D game - Rendering 2D elements in a 3D game @@ -37,10 +37,10 @@ what to do with the resulting texture. Input ----- -`Viewports ` are also responsible for delivering properly adjusted and +`Viewports` are also responsible for delivering properly adjusted and scaled input events to all their children nodes. Typically, input is received by the -nearest `Viewport ` in the tree, but you can set `Viewports ` not to receive input by checking -'Disable Input' to 'on'; this will allow the next nearest `Viewport ` in the tree to capture +nearest `Viewport` not to receive input by checking +'Disable Input' to 'on'; this will allow the next nearest `Viewport` in the tree to capture the input. .. image:: img/input.png @@ -52,27 +52,27 @@ Listener Godot supports 3D sound (in both 2D and 3D nodes); more on this can be found in the `Audio Streams Tutorial`. For this type of sound to be -audible, the `Viewport ` needs to be enabled as a listener (for 2D or 3D). -If you are using a custom `Viewport ` to display your `World `, don't forget +audible, the `Viewport` needs to be enabled as a listener (for 2D or 3D). +If you are using a custom `Viewport`, don't forget to enable this! Cameras (2D & 3D) ----------------- -When using a `Camera ` / -`Camera2D `, cameras will always display on the -closest parent `Viewport ` (going towards the root). For example, in the +When using a `Camera` / +`Camera2D`, cameras will always display on the +closest parent `Viewport` (going towards the root). For example, in the following hierarchy: .. image:: img/cameras.png -CameraA will display on the Root `Viewport ` and it will draw MeshA. CameraB -will be captured by the `Viewport ` Node along with MeshB. Even though MeshB is in the scene -hierarchy, it will still not be drawn to the Root `Viewport `. Similarly MeshA will not -be visible from the `Viewport ` node because `Viewport ` nodes only +CameraA will display on the Root `Viewport` and it will draw MeshA. CameraB +will be captured by the `Viewport` Node along with MeshB. Even though MeshB is in the scene +hierarchy, it will still not be drawn to the Root `Viewport`. Similarly MeshA will not +be visible from the `Viewport` nodes only capture nodes below them in the hierarchy. -There can only be one active camera per `Viewport `, so if there is more +There can only be one active camera per `Viewport`, so if there is more than one, make sure that the desired one has the "current" property set, or make it the current camera by calling: @@ -81,18 +81,18 @@ or make it the current camera by calling: camera.make_current() By default, cameras will render all objects in their world. In 3D, cameras can use their -`cull_mask ` property combined with the -`VisualInstance's ` `layer ` +`cull_mask` property combined with the +`VisualInstance's` property to restrict which objects are rendered. Scale & stretching ------------------ -`Viewports ` have a "size" property, which represents the size of the `Viewport ` -in pixels. For `Viewports ` which are children of `ViewportContainers `, +`Viewports` +in pixels. For `Viewports`, these values are overridden, but for all others, this sets their resolution. -It is also possible to scale the 2D content and make the `Viewport ` resolution +It is also possible to scale the 2D content and make the `Viewport` resolution different from the one specified in size, by calling: :: @@ -100,40 +100,40 @@ different from the one specified in size, by calling: viewport.set_size_override(true, Vector2(width, height)) # Custom size for 2D. viewport.set_size_override_stretch(true) # Enable stretch for custom size. -The root `Viewport ` uses this for the stretch options in the project +The root `Viewport` uses this for the stretch options in the project settings. For more information on scaling and stretching visit the `Multiple Resolutions Tutorial ` Worlds ------ -For 3D, a `Viewport ` will contain a `World `. This +For 3D, a `Viewport`. This is basically the universe that links physics and rendering together. -Spatial-based nodes will register using the `World ` of the closest -`Viewport `. By default, newly created `Viewports ` do not contain a `World ` but -use the same as their parent `Viewport ` (the root `Viewport ` always contains a -`World `, which is the one objects are rendered to by default). A `World ` can -be set in a `Viewport ` using the "world" property, and that will separate -all children nodes of that `Viewport ` from interacting with the parent -`Viewport's ` `World `. This is especially useful in scenarios where, for +Spatial-based nodes will register using the `World` of the closest +`Viewport` but +use the same as their parent `Viewport` always contains a +`World` can +be set in a `Viewport` using the "world" property, and that will separate +all children nodes of that `Viewport` from interacting with the parent +`Viewport's`. This is especially useful in scenarios where, for example, you might want to show a separate character in 3D imposed over the game (like in StarCraft). -As a helper for situations where you want to create `Viewports ` that -display single objects and don't want to create a `World `, `Viewport ` has -the option to use its own `World `. This is useful when you want to -instance 3D characters or objects in a 2D `World `. +As a helper for situations where you want to create `Viewports` that +display single objects and don't want to create a `World` has +the option to use its own `World`. This is useful when you want to +instance 3D characters or objects in a 2D `World`. -For 2D, each `Viewport ` always contains its own `World2D `. +For 2D, each `Viewport`. This suffices in most cases, but in case sharing them may be desired, it -is possible to do so by setting the `Viewport's ` `World2D ` manually. +is possible to do so by setting the `Viewport's` manually. For an example of how this works, see the demo projects `3D in 2D `_ and `2D in 3D `_ respectively. Capture ------- -It is possible to query a capture of the `Viewport ` contents. For the root -`Viewport `, this is effectively a screen capture. This is done with the +It is possible to query a capture of the `Viewport` contents. For the root +`Viewport`, this is effectively a screen capture. This is done with the following code: :: @@ -149,7 +149,7 @@ following code: # Set Sprite Texture. $sprite.texture = tex -But if you use this in ``_ready()`` or from the first frame of the `Viewport's ` initialization, +But if you use this in ``_ready()`` or from the first frame of the `Viewport's` initialization, you will get an empty texture because there is nothing to get as texture. You can deal with it using (for example): @@ -162,33 +162,33 @@ it using (for example): Viewport Container ------------------ -If the `Viewport ` is a child of a `ViewportContainer `, it will become active and display anything it has inside. The layout looks like this: +If the `Viewport`, it will become active and display anything it has inside. The layout looks like this: .. image:: img/container.png -The `Viewport ` will cover the area of its parent `ViewportContainer ` completely -if `Stretch` is set to ``true`` in `ViewportContainer `. -Note: The size of the `ViewportContainer ` cannot be smaller than the size of the `Viewport `. +The `Viewport` completely +if `Stretch` is set to ``true`` in `ViewportContainer`. +Note: The size of the `ViewportContainer`. Rendering --------- -Due to the fact that the `Viewport ` is an entryway into another rendering surface, it exposes a few +Due to the fact that the `Viewport` is an entryway into another rendering surface, it exposes a few rendering properties that can be different from the project settings. The first is MSAA; you can -choose to use a different level of MSAA for each `Viewport `; the default behavior is DISABLED. -You can also set the `Viewport ` to use HDR, HDR is very useful for when you want to store values in the texture that are outside the range 0.0 - 1.0. +choose to use a different level of MSAA for each `Viewport`; the default behavior is DISABLED. +You can also set the `Viewport` to use HDR, HDR is very useful for when you want to store values in the texture that are outside the range 0.0 - 1.0. -If you know how the `Viewport ` is going to be used, you can set its Usage to either 3D or 2D. Godot will then -restrict how the `Viewport ` is drawn to in accordance with your choice; default is 3D. -The 2D usage mode is slightly faster and uses less memory compared to the 3D one. It's a good idea to set the `Viewport `'s Usage property to 2D if your viewport doesn't render anything in 3D. +If you know how the `Viewport` is going to be used, you can set its Usage to either 3D or 2D. Godot will then +restrict how the `Viewport` is drawn to in accordance with your choice; default is 3D. +The 2D usage mode is slightly faster and uses less memory compared to the 3D one. It's a good idea to set the `Viewport`'s Usage property to 2D if your viewport doesn't render anything in 3D. .. note:: If you need to render 3D shadows in the viewport, make sure to set the viewport's *Shadow Atlas Size* property to a value higher than 0. Otherwise, shadows won't be rendered. For reference, the Project Settings define it to 4096 by default. -Godot also provides a way of customizing how everything is drawn inside `Viewports ` using “Debug Draw”. -Debug Draw allows you to specify one of four options for how the `Viewport ` will display things drawn +Godot also provides a way of customizing how everything is drawn inside `Viewports` using “Debug Draw”. +Debug Draw allows you to specify one of four options for how the `Viewport` will display things drawn inside it. Debug Draw is disabled by default. .. image:: img/default_scene.png @@ -218,8 +218,8 @@ Lastly, Wireframe draws the scene using only the edges of triangles in the meshe Render target ------------- -When rendering to a `Viewport `, whatever is inside will not be -visible in the scene editor. To display the contents, you have to draw the `Viewport's ` `ViewportTexture ` somewhere. +When rendering to a `Viewport`, whatever is inside will not be +visible in the scene editor. To display the contents, you have to draw the `Viewport's` somewhere. This can be requested via code using (for example): :: @@ -232,17 +232,17 @@ Or it can be assigned in the editor by selecting "New ViewportTexture" .. image:: img/texturemenu.png -and then selecting the `Viewport ` you want to use. +and then selecting the `Viewport` you want to use. .. image:: img/texturepath.png -Every frame, the `Viewport `'s texture is cleared away with the default clear color (or a transparent +Every frame, the `Viewport`'s texture is cleared away with the default clear color (or a transparent color if `Transparent Bg` is set to ``true``). This can be changed by setting `Clear Mode` to Never or Next Frame. As the name implies, Never means the texture will never be cleared, while next frame will clear the texture on the next frame and then set itself to Never. -By default, re-rendering of the `Viewport ` happens when the -`Viewport `'s `ViewportTexture ` has been drawn in a frame. If visible, it will be +By default, re-rendering of the `Viewport` happens when the +`Viewport` has been drawn in a frame. If visible, it will be rendered; otherwise, it will not. This behavior can be changed to manual rendering (once), or always render, no matter if visible or not. This flexibility allows users to render an image once and then use the texture without diff --git a/tutorials/scripting/change_scenes_manually.rst b/tutorials/scripting/change_scenes_manually.rst index 6aa56f8..3471ebf 100644 --- a/tutorials/scripting/change_scenes_manually.rst +++ b/tutorials/scripting/change_scenes_manually.rst @@ -4,7 +4,7 @@ Change scenes manually ====================== Sometimes it helps to have more control over how one swaps scenes around. -As mentioned above, a `Viewport `'s child nodes +As mentioned above, a `Viewport`'s child nodes will render to the image it generates. This holds true even for nodes outside of the "current" scene. Autoloads fall into this category, but so do scenes which one instances and adds to the tree at runtime: @@ -22,13 +22,13 @@ gdscript GDScript To complete the cycle and swap out the new scene with the old one, developers have a choice to make. Many strategies exist for removing a scene -from view of the `Viewport `. The tradeoffs involve +from view of the `Viewport`. The tradeoffs involve balancing operation speed and memory consumption as well as balancing data access and integrity. 1. **We can delete the existing scene.** - `SceneTree.change_scene() ` and - `SceneTree.change_scene_to() ` + `SceneTree.change_scene()` and + `SceneTree.change_scene_to()` will delete the current scene immediately. Developers can also delete the main scene though. Assuming the root node's name is "Main", one could do ``get_node("/root/Main").free()`` to delete the whole scene. @@ -46,7 +46,7 @@ access and integrity. - Note: It can be useful to preserve the data in a soon-to-be-deleted scene by re-attaching one or more of its nodes to a different scene, - or even directly to the `SceneTree `. + or even directly to the `SceneTree`. - Processing stops. @@ -76,7 +76,7 @@ access and integrity. data. - Pro: Nodes are still members of groups (since groups belong to the - `SceneTree `). + `SceneTree`). - Con: The CPU's attention is now divided between both scenes. Too much load could result in low frame rates. One should be sure to test @@ -85,7 +85,7 @@ access and integrity. 3. **We can remove the existing scene from the tree.** Assign a variable to the existing scene's root node. Then use - `Node.remove_child(Node) ` to detach the entire + `Node.remove_child(Node)` to detach the entire scene from the tree. - Memory still exists (similar pros/cons as with hiding it from view). @@ -99,7 +99,7 @@ access and integrity. - Con: Unlike with hiding it from view only, the data contained within the scene will become stale if it relies on delta time, input, groups, - or other data that is derived from `SceneTree ` + or other data that is derived from `SceneTree` access. There are also cases where one may wish to have many scenes present at the same @@ -113,7 +113,7 @@ gdscript GDScript ``` Perhaps instead they wish to display multiple scenes at the same time using -`ViewportContainers `. This is optimal in +`ViewportContainers`. This is optimal in cases where the intent is to render different content in different parts of the screen. Minimaps and split-screen multiplayer are good examples. diff --git a/tutorials/scripting/creating_script_templates.rst b/tutorials/scripting/creating_script_templates.rst index 11a6e29..271bf00 100644 --- a/tutorials/scripting/creating_script_templates.rst +++ b/tutorials/scripting/creating_script_templates.rst @@ -36,7 +36,7 @@ Project-defined templates The default path to search for templates is the ``res://script_templates/`` directory. The path can be changed by configuring the ``editor/script_templates_search_path`` setting in the -`ProjectSettings `, both via code and the editor. +`ProjectSettings`, both via code and the editor. If no ``script_templates`` directory is found within a project, it is simply ignored. @@ -107,7 +107,7 @@ Base placeholders | ``%TS%`` | Indentation placeholder. The exact type and number of | | | whitespace characters used for indentation is determined by | | | the ``text_editor/indent/type`` and ``text_editor/indent/size``| -| | settings in the `EditorSettings ` | +| | settings in the `EditorSettings` | | | respectively. | +-------------+----------------------------------------------------------------+ @@ -117,7 +117,7 @@ Type placeholders These are only relevant for GDScript with static typing. Whether these placeholders are actually replaced is determined by the ``text_editor/completion/add_type_hints`` setting in the -`EditorSettings `. +`EditorSettings`. +-------------------+--------------+ | Placeholder | Value | diff --git a/tutorials/scripting/cross_language_scripting.rst b/tutorials/scripting/cross_language_scripting.rst index dca903d..2e5f3dd 100644 --- a/tutorials/scripting/cross_language_scripting.rst +++ b/tutorials/scripting/cross_language_scripting.rst @@ -44,7 +44,7 @@ Instantiating C# nodes from GDScript Using C# from GDScript doesn't need much work. Once loaded (see `doc_gdscript_classes_as_resources`), the script can be instantiated -with `new() `. +with `new()`. :: @@ -68,7 +68,7 @@ Instantiating GDScript nodes from C# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From the C# side, everything work the same way. Once loaded, the GDScript can -be instantiated with `GDScript.New() `. +be instantiated with `GDScript.New()`. .. code-block:: csharp @@ -104,8 +104,8 @@ Accessing GDScript fields from C# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ As C# is statically typed, accessing GDScript from C# is a bit more -convoluted, you will have to use `Object.Get() ` -and `Object.Set() `. The first argument is the name of the field you want to access. +convoluted, you will have to use `Object.Get()` +and `Object.Set()`. The first argument is the name of the field you want to access. .. code-block:: csharp @@ -145,7 +145,7 @@ Calling GDScript methods from C# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To call GDScript methods from C# you'll need to use -`Object.Call() `. The first argument is the +`Object.Call()`. The first argument is the name of the method you want to call. The following arguments will be passed to said method. diff --git a/tutorials/scripting/evaluating_expressions.rst b/tutorials/scripting/evaluating_expressions.rst index 4a75a1d..cec6f3d 100644 --- a/tutorials/scripting/evaluating_expressions.rst +++ b/tutorials/scripting/evaluating_expressions.rst @@ -11,7 +11,7 @@ An expression can be: - A built-in method call like ``deg2rad(90)``. - A method call on an user-provided script like ``update_health()``, if ``base_instance`` is set to a value other than ``null`` when calling - `Expression.execute() `. + `Expression.execute()`. .. note:: @@ -95,7 +95,7 @@ Setting a base instance for the expression By default, an expression has a base instance of ``null``. This means the expression has no base instance associated to it. -When calling `Expression.execute() `, +When calling `Expression.execute()`, you can set the value of the ``base_instance`` parameter to a specific object instance such as ``self``, another script instance or even a singleton:: diff --git a/tutorials/scripting/gdscript/gdscript_basics.rst b/tutorials/scripting/gdscript/gdscript_basics.rst index 0e823c9..328bced 100644 --- a/tutorials/scripting/gdscript/gdscript_basics.rst +++ b/tutorials/scripting/gdscript/gdscript_basics.rst @@ -348,18 +348,18 @@ null ``null`` is an empty data type that contains no information and can not be assigned any other value. -`bool ` +`bool` ^^^^^^^^^^^^^^^^^^^^^^^^ Short for "boolean", it can only contain ``true`` or ``false``. -`int ` +`int` ^^^^^^^^^^^^^^^^^^^^^^ Short for "integer", it stores whole numbers (positive and negative). It is stored as a 64-bit value, equivalent to "int64_t" in C++. -`float ` +`float` ^^^^^^^^^^^^^^^^^^^^^^^^^^ Stores real numbers, including decimals, using floating-point values. @@ -367,7 +367,7 @@ It is stored as a 64-bit value, equivalent to "double" in C++. Note: Currently, data structures such as Vector2, Vector3, and PoolRealArray store 32-bit single-precision "float" values. -`String ` +`String` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A sequence of characters in `Unicode format `_. @@ -405,56 +405,56 @@ GDScript also supports `doc_gdscript_printf`. Vector built-in types ~~~~~~~~~~~~~~~~~~~~~ -`Vector2 ` +`Vector2` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2D vector type containing ``x`` and ``y`` fields. Can also be accessed as an array. -`Rect2 ` +`Rect2` ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2D Rectangle type containing two vectors fields: ``position`` and ``size``. Also contains an ``end`` field which is ``position + size``. -`Vector3 ` +`Vector3` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3D vector type containing ``x``, ``y`` and ``z`` fields. This can also be accessed as an array. -`Transform2D ` +`Transform2D` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3×2 matrix used for 2D transforms. -`Plane ` +`Plane` ^^^^^^^^^^^^^^^^^^^^^^^^^^ 3D Plane type in normalized form that contains a ``normal`` vector field and a ``d`` scalar distance. -`Quat ` +`Quat` ^^^^^^^^^^^^^^^^^^^^^^^^ Quaternion is a datatype used for representing a 3D rotation. It's useful for interpolating rotations. -`AABB ` +`AABB` ^^^^^^^^^^^^^^^^^^^^^^^^ Axis-aligned bounding box (or 3D box) contains 2 vectors fields: ``position`` and ``size``. Also contains an ``end`` field which is ``position + size``. -`Basis ` +`Basis` ^^^^^^^^^^^^^^^^^^^^^^^^^^ 3x3 matrix used for 3D rotation and scale. It contains 3 vector fields (``x``, ``y`` and ``z``) and can also be accessed as an array of 3D vectors. -`Transform ` +`Transform` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3D Transform contains a Basis field ``basis`` and a Vector3 field @@ -463,24 +463,24 @@ vectors. Engine built-in types ~~~~~~~~~~~~~~~~~~~~~ -`Color ` +`Color` ^^^^^^^^^^^^^^^^^^^^^^^^^^ Color data type contains ``r``, ``g``, ``b``, and ``a`` fields. It can also be accessed as ``h``, ``s``, and ``v`` for hue/saturation/value. -`NodePath ` +`NodePath` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Compiled path to a node used mainly in the scene system. It can be easily assigned to, and from, a String. -`RID ` +`RID` ^^^^^^^^^^^^^^^^^^^^^^ Resource ID (RID). Servers use generic RIDs to reference opaque data. -`Object ` +`Object` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Base class for anything that is not a built-in type. @@ -488,7 +488,7 @@ Base class for anything that is not a built-in type. Container built-in types ~~~~~~~~~~~~~~~~~~~~~~~~ -`Array ` +`Array` ^^^^^^^^^^^^^^^^^^^^^^^^^^ Generic sequence of arbitrary object types, including other arrays or dictionaries (see below). @@ -512,15 +512,15 @@ arrays are available. These only accept a single data type. They avoid memory fragmentation and use less memory, but are atomic and tend to run slower than generic arrays. They are therefore only recommended to use for large data sets: -- `PoolByteArray `: An array of bytes (integers from 0 to 255). -- `PoolIntArray `: An array of integers. -- `PoolRealArray `: An array of floats. -- `PoolStringArray `: An array of strings. -- `PoolVector2Array `: An array of `Vector2 ` objects. -- `PoolVector3Array `: An array of `Vector3 ` objects. -- `PoolColorArray `: An array of `Color ` objects. +- `PoolByteArray`: An array of bytes (integers from 0 to 255). +- `PoolIntArray`: An array of integers. +- `PoolRealArray`: An array of floats. +- `PoolStringArray`: An array of strings. +- `PoolVector2Array` objects. +- `PoolVector3Array` objects. +- `PoolColorArray` objects. -`Dictionary ` +`Dictionary` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Associative container which contains values referenced by unique keys. @@ -569,8 +569,8 @@ assign to it:: The bracket syntax can be used to access properties of any `class_Object`, not just Dictionaries. Keep in mind it will cause a script error when attempting to index a non-existing property. To avoid - this, use the `Object.get() ` and - `Object.set() ` methods instead. + this, use the `Object.get()` and + `Object.set()` methods instead. Data ---- @@ -1270,7 +1270,7 @@ function. Classes as resources ^^^^^^^^^^^^^^^^^^^^ -Classes stored as files are treated as `resources `. They +Classes stored as files are treated as `resources`. They must be loaded from disk to access them in other classes. This is done using either the ``load`` or ``preload`` functions (see below). Instancing of a loaded class resource is done by calling the ``new`` function on the class object:: @@ -1452,9 +1452,9 @@ to react to health changes with an animation, but we want to keep the user interface separate from the player in our scene tree. In our ``Character.gd`` script, we define a ``health_changed`` signal and emit -it with `Object.emit_signal() `, and from +it with `Object.emit_signal()`, and from a ``Game`` node higher up our scene tree, we connect it to the ``Lifebar`` using -the `Object.connect() ` method:: +the `Object.connect()` method:: # Character.gd diff --git a/tutorials/scripting/gdscript/gdscript_exports.rst b/tutorials/scripting/gdscript/gdscript_exports.rst index 4bbf7f9..85fb111 100644 --- a/tutorials/scripting/gdscript/gdscript_exports.rst +++ b/tutorials/scripting/gdscript/gdscript_exports.rst @@ -7,7 +7,7 @@ Introduction to exports ----------------------- In Godot, class members can be exported. This means their value gets saved along -with the resource (such as the `scene `) they're +with the resource (such as the `scene`) they're attached to. They will also be available for editing in the property editor. Exporting is done by using the ``export`` keyword:: @@ -213,7 +213,7 @@ Setting exported variables from a tool script When changing an exported variable's value from a script in `doc_gdscript_tool_mode`, the value in the inspector won't be updated automatically. To update it, call -`property_list_changed_notify() ` +`property_list_changed_notify()` after setting the exported variable's value. Advanced exports @@ -225,9 +225,9 @@ common exporting features which can be implemented with a low-level API. Before reading further, you should get familiar with the way properties are handled and how they can be customized with -`_set() `, -`_get() `, and -`_get_property_list() ` methods as +`_set()`, +`_get()`, and +`_get_property_list()` methods as described in `doc_accessing_data_or_logic_from_object`. .. seealso:: For binding properties using the above methods in C++, see @@ -269,8 +269,8 @@ Attaching variables to properties To attach variables to properties (allowing the value of the property to be used in scripts), you need to create a variable with the exact same name as the property or else you may need to override the -`_set() ` and -`_get() ` methods. Attaching +`_set()` and +`_get()` methods. Attaching a variable to to a property also gives you the ability to give it a default state. :: diff --git a/tutorials/scripting/groups.rst b/tutorials/scripting/groups.rst index dcb0a3d..e727732 100644 --- a/tutorials/scripting/groups.rst +++ b/tutorials/scripting/groups.rst @@ -22,8 +22,8 @@ removed by removing all nodes from a given group. There are two ways to add/remove nodes to groups: - During design, by using the Node dock in the editor. -- During execution, by calling `Node.add_to_group() ` - or `Node.remove_from_group() `. +- During execution, by calling `Node.add_to_group()` + or `Node.remove_from_group()`. Using the Node dock @@ -107,7 +107,7 @@ gdscript GDScript var guards = get_tree().get_nodes_in_group("guards") ``` -The `SceneTree ` class provides many more useful methods +The `SceneTree` class provides many more useful methods to interact with scenes, their node hierarchy, and groups. It allows you to switch scenes easily or reload them, quit the game or pause and unpause it. It also provides useful signals. diff --git a/tutorials/scripting/idle_and_physics_processing.rst b/tutorials/scripting/idle_and_physics_processing.rst index 23f2c5c..0fc04a2 100644 --- a/tutorials/scripting/idle_and_physics_processing.rst +++ b/tutorials/scripting/idle_and_physics_processing.rst @@ -5,8 +5,8 @@ Idle and Physics Processing Games run in a loop. Each frame, you need to update the state of your game world before drawing it on screen. Godot provides two virtual methods in the Node -class to do so: `Node._process() ` and -`Node._physics_process() `. If you +class to do so: `Node._process()` and +`Node._physics_process()`. If you define either or both in a script, the engine will call them automatically. There are two types of processing available to you: diff --git a/tutorials/scripting/nodes_and_scene_instances.rst b/tutorials/scripting/nodes_and_scene_instances.rst index cbb6f29..9352046 100644 --- a/tutorials/scripting/nodes_and_scene_instances.rst +++ b/tutorials/scripting/nodes_and_scene_instances.rst @@ -146,7 +146,7 @@ like. This operation is called instancing, and doing it from code happens in two steps: 1. Loading the scene from the hard drive. -2. Creating an instance of the loaded `PackedScene ` +2. Creating an instance of the loaded `PackedScene` resource. gdscript GDScript diff --git a/tutorials/scripting/overridable_functions.rst b/tutorials/scripting/overridable_functions.rst index af4f3f7..59f7873 100644 --- a/tutorials/scripting/overridable_functions.rst +++ b/tutorials/scripting/overridable_functions.rst @@ -66,8 +66,8 @@ gdscript GDScript ``` Two more essential built-in node callback functions are -`Node._unhandled_input() ` and -`Node._input() `, which you use to both receive +`Node._unhandled_input()` and +`Node._input()`, which you use to both receive and process individual input events. The ``_unhandled_input()`` method receives every key press, mouse click, etc. that have not been handled already in an ``_input()`` callback or in a user interface component. You want to use it for @@ -92,6 +92,6 @@ gdscript GDScript There are some more overridable functions like `Node._get_configuration_warning() `. Specialized node types provide -more callbacks like `CanvasItem._draw() ` to +more callbacks like `CanvasItem._draw()` to draw programmatically or `Control._gui_input() ` to handle clicks and input on UI elements. diff --git a/tutorials/scripting/pausing_games.rst b/tutorials/scripting/pausing_games.rst index 0297190..cc66a34 100644 --- a/tutorials/scripting/pausing_games.rst +++ b/tutorials/scripting/pausing_games.rst @@ -16,7 +16,7 @@ How pausing works ----------------- To pause the game the pause state must be set. This is done by assigning -``true`` to the `SceneTree.paused ` property: +``true`` to the `SceneTree.paused` property: gdscript GDScript @@ -35,7 +35,7 @@ Process Modes ------------- Each node in Godot has a "Pause Mode" that defines when it processes. It can -be found and changed under a node's `Node ` properties in the inspector. +be found and changed under a node's `Node` properties in the inspector. .. image:: img/pausemode.png diff --git a/tutorials/scripting/resources.rst b/tutorials/scripting/resources.rst index d4fd4e5..477ded4 100644 --- a/tutorials/scripting/resources.rst +++ b/tutorials/scripting/resources.rst @@ -6,11 +6,11 @@ Resources Nodes and resources ------------------- -Up to this tutorial, we focused on the `Node ` +Up to this tutorial, we focused on the `Node` class in Godot as that's the one you use to code behavior and most of the engine's features rely on it. There is another datatype that is just as important: -`Resource `. +`Resource`. *Nodes* give you functionality: they draw sprites, 3D models, simulate physics, arrange user interfaces, etc. **Resources** are **data containers**. They don't @@ -18,9 +18,9 @@ do anything on their own: instead, nodes use the data contained in resources. Anything Godot saves or loads from disk is a resource. Be it a scene (a ``.tscn`` or an ``.scn`` file), an image, a script... Here are some ``Resource`` examples: -`Texture `, `Script `, `Mesh -`, `Animation `, `AudioStream -`, `Font `, `Translation +`Texture`, `Mesh +`, `Animation`, `AudioStream +`, `Font`, `Translation `. When the engine loads a resource from disk, **it only loads it once**. If a copy @@ -43,8 +43,8 @@ There are two ways to save resources. They can be: 1. **External** to a scene, saved on the disk as individual files. 2. **Built-in**, saved inside the ``.tscn`` or the ``.scn`` file they're attached to. -To be more specific, here's a `Texture ` -in a `Sprite ` node: +To be more specific, here's a `Texture` +in a `Sprite` node: .. image:: img/spriteprop.png @@ -95,11 +95,11 @@ Loading scenes -------------- Scenes are also resources, but there is a catch. Scenes saved to disk are -resources of type `PackedScene `. The +resources of type `PackedScene`. The scene is packed inside a resource. To get an instance of the scene, you have to use the -`PackedScene.instance() ` method. +`PackedScene.instance()` method. gdscript GDScript @@ -136,10 +136,10 @@ memory management from the Reference type. This comes with many distinct advantages over alternative data structures, such as JSON, CSV, or custom TXT files. Users can only import these -assets as a `Dictionary ` (JSON) or as a -`File ` to parse. What sets Resources apart is their -inheritance of `Object `, `Reference `, -and `Resource ` features: +assets as a `Dictionary` (JSON) or as a +`File` to parse. What sets Resources apart is their +inheritance of `Object`, +and `Resource` features: - They can define constants, so constants from other data fields or objects are not needed. @@ -209,7 +209,7 @@ gdscript GDScript Resource scripts are similar to Unity's ScriptableObjects. The Inspector provides built-in support for custom resources. If desired though, users can even design their own Control-based tool scripts and combine them - with an `EditorPlugin ` to create custom + with an `EditorPlugin` to create custom visualizations and editors for their data. Unreal Engine 4's DataTables and CurveTables are also easy to recreate with @@ -257,7 +257,7 @@ gdscript GDScript to the Inspector when you open these types of Resources. CurveTables are the same thing, except mapped to an Array of float values - or a `Curve `/`Curve2D ` resource object. + or a `Curve` resource object. .. warning:: diff --git a/tutorials/scripting/scene_tree.rst b/tutorials/scripting/scene_tree.rst index 4dd950e..8d78119 100644 --- a/tutorials/scripting/scene_tree.rst +++ b/tutorials/scripting/scene_tree.rst @@ -14,12 +14,12 @@ MainLoop -------- The way Godot works internally is as follows. There is the -`OS ` class, +`OS` class, which is the only instance that runs at the beginning. Afterwards, all drivers, servers, scripting languages, scene system, etc are loaded. -When initialization is complete, `OS ` needs to be -supplied a `MainLoop ` +When initialization is complete, `OS` needs to be +supplied a `MainLoop` to run. Up to this point, all this is internals working (you can check main/main.cpp file in the source code if you are ever interested to see how this works internally). @@ -35,18 +35,18 @@ SceneTree One of the ways to explain how Godot works is that it's a high level game engine over a low level middleware. -The scene system is the game engine, while the `OS ` +The scene system is the game engine, while the `OS` and servers are the low level API. The scene system provides its own main loop to OS, -`SceneTree `. +`SceneTree`. This is automatically instanced and set when running a scene, no need to do any extra work. It's important to know that this class exists because it has a few important uses: -- It contains the root `Viewport `, to which a +- It contains the root `Viewport`, to which a scene is added as a child when it's first opened to become part of the *Scene Tree* (more on that next). - It contains information about the groups and has the means to call all @@ -55,14 +55,14 @@ important uses: mode or quitting the process. When a node is part of the Scene Tree, the -`SceneTree ` +`SceneTree` singleton can be obtained by calling -`Node.get_tree() `. +`Node.get_tree()`. Root viewport ------------- -The root `Viewport ` +The root `Viewport` is always at the top of the scene. From a node, it can be obtained in two different ways: @@ -74,7 +74,7 @@ gdscript GDScript ``` This node contains the main viewport. Anything that is a child of a -`Viewport ` +`Viewport` is drawn inside of it by default, so it makes sense that the top of all nodes is always a node of this type otherwise nothing would be seen. @@ -130,7 +130,7 @@ Changing current scene After a scene is loaded, it is often desired to change this scene for another one. The simple way to do this is to use the -`SceneTree.change_scene() ` +`SceneTree.change_scene()` function: gdscript GDScript @@ -141,9 +141,9 @@ gdscript GDScript ``` Rather than using file paths, one can also use ready-made -`PackedScene ` resources using the equivalent +`PackedScene` resources using the equivalent function -`SceneTree.change_scene_to(PackedScene scene) `: +`SceneTree.change_scene_to(PackedScene scene)`: gdscript GDScript diff --git a/tutorials/scripting/singletons_autoload.rst b/tutorials/scripting/singletons_autoload.rst index f802644..12daff6 100644 --- a/tutorials/scripting/singletons_autoload.rst +++ b/tutorials/scripting/singletons_autoload.rst @@ -107,7 +107,7 @@ Custom scene switcher This tutorial will demonstrate building a scene switcher using autoloads. For basic scene switching, you can use the -`SceneTree.change_scene() ` +`SceneTree.change_scene()` method (see `doc_scene_tree` for details). However, if you need more complex behavior when changing scenes, this method provides more functionality. @@ -189,7 +189,7 @@ gdscript GDScript get_tree().current_scene = current_scene ``` -Using `Object.call_deferred() `, +Using `Object.call_deferred()`, the second function will only run once all code from the current scene has completed. Thus, the current scene will not be removed while it is still being used (i.e. its code is still running). diff --git a/tutorials/shaders/advanced_postprocessing.rst b/tutorials/shaders/advanced_postprocessing.rst index ecaa494..c6ca2cc 100644 --- a/tutorials/shaders/advanced_postprocessing.rst +++ b/tutorials/shaders/advanced_postprocessing.rst @@ -11,8 +11,8 @@ In particular, it will explain how to write a post-processing shader that uses the depth buffer. You should already be familiar with post-processing generally and, in particular, with the methods outlined in the `custom post-processing tutorial `. -In the previous post-processing tutorial, we rendered the scene to a `Viewport ` -and then rendered the Viewport in a `ViewportContainer ` +In the previous post-processing tutorial, we rendered the scene to a `Viewport` +and then rendered the Viewport in a `ViewportContainer` to the main scene. One limitation of this method is that we could not access the depth buffer because the depth buffer is only available in spatial shaders and Viewports do not maintain depth information. @@ -27,8 +27,8 @@ two main drawbacks of using a Viewport: 1. The depth buffer cannot be accessed 2. The effect of the post-processing shader is not visible in the editor -To get around the limitation on using the depth buffer, use a `MeshInstance ` -with a `QuadMesh ` primitive. This allows us to use a spatial +To get around the limitation on using the depth buffer, use a `MeshInstance` +with a `QuadMesh` primitive. This allows us to use a spatial shader and to access the depth texture of the scene. Next, use a vertex shader to make the quad cover the screen at all times so that the post-processing effect will be applied at all times, including in the editor. @@ -150,7 +150,7 @@ screen quad. The reason for this is explained `here `. An +Set the Mesh in the MeshInstance to an `ArrayMesh`. An ArrayMesh is a tool that allows you to easily construct a Mesh from Arrays for vertices, normals, colors, etc. diff --git a/tutorials/shaders/custom_postprocessing.rst b/tutorials/shaders/custom_postprocessing.rst index 4c30467..93d8197 100644 --- a/tutorials/shaders/custom_postprocessing.rst +++ b/tutorials/shaders/custom_postprocessing.rst @@ -10,8 +10,8 @@ Godot provides many post-processing effects out of the box, including Bloom, DOF want to write your own custom effect. Here's how you can do so. Post-processing effects are shaders applied to a frame after Godot rendered it. You first want to render -your scene into a `Viewport `, then render the ``Viewport`` -inside a `ViewportTexture ` and show it on the screen. +your scene into a `Viewport`, then render the ``Viewport`` +inside a `ViewportTexture` and show it on the screen. The easiest way to implement a custom post-processing shader is to use Godot's built-in ability to read from the screen texture. If you're not familiar with this, you should read the `Screen Reading Shaders @@ -29,7 +29,7 @@ Single pass post-processing You will need a ``Viewport`` to render your scene to, and a scene to render your ``Viewport`` on the screen. You can use a `ViewportContainer ` to display your ``Viewport`` on the entire screen or inside -another `Control ` node. +another `Control` node. .. note:: @@ -37,7 +37,7 @@ another `Control ` node. how the scene render, including the framerate, and you can use the ``ViewportContainer`` to render 3D objects in a 2D scene. -For this demo, we will use a `Node2D ` with a ``ViewportContainer`` and finally a +For this demo, we will use a `Node2D` with a ``ViewportContainer`` and finally a ``Viewport``. Your **Scene** tab should look like this: .. image:: img/post_hierarchy1.png @@ -47,7 +47,7 @@ your main scene. For this tutorial, we will use a field of random boxes: .. image:: img/post_boxes.png -Add a new `ShaderMaterial ` to the ``ViewportContainer``, and assign a new +Add a new `ShaderMaterial` to the ``ViewportContainer``, and assign a new shader resource to it. You can access your rendered ``Viewport`` with the built-in ``TEXTURE`` uniform. .. note:: @@ -126,7 +126,7 @@ the tree. Apart from the node structure, the steps are the same as with the single-pass post-processing shader. As an example, you could write a full screen Gaussian blur effect by attaching the following pieces of code -to each of the `ViewportContainers `. The order in which you apply the shaders +to each of the `ViewportContainers`. The order in which you apply the shaders does not matter: .. code-block:: glsl diff --git a/tutorials/shaders/screen-reading_shaders.rst b/tutorials/shaders/screen-reading_shaders.rst index 0ee65f4..bcf8f5c 100644 --- a/tutorials/shaders/screen-reading_shaders.rst +++ b/tutorials/shaders/screen-reading_shaders.rst @@ -91,7 +91,7 @@ In the above image, the second sphere (top right) is using the same source for ``SCREEN_TEXTURE`` as the first one below, so the first one "disappears", or is not visible. -In 2D, this can be corrected via the `BackBufferCopy ` +In 2D, this can be corrected via the `BackBufferCopy` node, which can be instantiated between both spheres. BackBufferCopy can work by either specifying a screen region or the whole screen: @@ -113,9 +113,9 @@ In 3D, there is less flexibility to solve this particular issue because the ``SCREEN_TEXTURE`` in 3D as it won't capture transparent objects and may capture some opaque objects that are in front of the object. -You can reproduce the back-buffer logic in 3D by creating a `Viewport ` +You can reproduce the back-buffer logic in 3D by creating a `Viewport` with a camera in the same position as your object, and then use the -`Viewport's ` texture instead of ``SCREEN_TEXTURE``. +`Viewport's` texture instead of ``SCREEN_TEXTURE``. Back-buffer logic ~~~~~~~~~~~~~~~~~ diff --git a/tutorials/shaders/shader_materials.rst b/tutorials/shaders/shader_materials.rst index cd5498a..1aeab2e 100644 --- a/tutorials/shaders/shader_materials.rst +++ b/tutorials/shaders/shader_materials.rst @@ -7,8 +7,8 @@ Introduction ------------ For the most common cases, Godot provides ready to use materials for -most types of shaders, such as `SpatialMaterial `, -`CanvasItemMaterial ` and `ParticlesMaterial `. +most types of shaders, such as `SpatialMaterial`, +`CanvasItemMaterial`. They are flexible implementations that cover most use cases. Shader materials allow writing a custom shader directly, for maximum flexibility. diff --git a/tutorials/shaders/shader_reference/canvas_item_shader.rst b/tutorials/shaders/shader_reference/canvas_item_shader.rst index 2f5afe9..6857ebb 100644 --- a/tutorials/shaders/shader_reference/canvas_item_shader.rst +++ b/tutorials/shaders/shader_reference/canvas_item_shader.rst @@ -143,7 +143,7 @@ is usually: Fragment built-ins ^^^^^^^^^^^^^^^^^^ -Certain Nodes (for example, `Sprites `) display a texture by default. However, +Certain Nodes (for example, `Sprites`) display a texture by default. However, when a custom fragment function is attached to these nodes, the texture lookup needs to be done manually. Godot does not provide the texture color in the ``COLOR`` built-in variable; to read the texture color for such nodes, use: diff --git a/tutorials/shaders/using_viewport_as_texture.rst b/tutorials/shaders/using_viewport_as_texture.rst index 85c04e5..b2a4f07 100644 --- a/tutorials/shaders/using_viewport_as_texture.rst +++ b/tutorials/shaders/using_viewport_as_texture.rst @@ -6,7 +6,7 @@ Using a Viewport as a texture Introduction ------------ -This tutorial will introduce you to using the `Viewport ` as a +This tutorial will introduce you to using the `Viewport` as a texture that can be applied to 3D objects. In order to do so, it will walk you through the process of making a procedural planet like the one below: @@ -15,42 +15,42 @@ of making a procedural planet like the one below: .. note:: This tutorial does not cover how to code a dynamic atmosphere like the one this planet has. This tutorial assumes you are familiar with how to set up a basic scene including: -a `Camera `, a `light source `, a -`Mesh Instance ` with a `Primitive Mesh `, -and applying a `SpatialMaterial ` to the mesh. The focus will be on using -the `Viewport ` to dynamically create textures that can be applied to the mesh. +a `Camera`, a +`Mesh Instance`, +and applying a `SpatialMaterial` to the mesh. The focus will be on using +the `Viewport` to dynamically create textures that can be applied to the mesh. In this tutorial, we'll cover the following topics: -- How to use a `Viewport ` as a render texture +- How to use a `Viewport` as a render texture - Mapping a texture to a sphere with equirectangular mapping - Fragment shader techniques for procedural planets -- Setting a Roughness map from a `Viewport Texture ` +- Setting a Roughness map from a `Viewport Texture` Setting up the Viewport ----------------------- -First, add a `Viewport ` to the scene. +First, add a `Viewport` to the scene. -Next, set the size of the `Viewport ` to ``(1024, 512)``. The -`Viewport ` can actually be any size so long as the width is double the height. +Next, set the size of the `Viewport` to ``(1024, 512)``. The +`Viewport` can actually be any size so long as the width is double the height. The width needs to be double the height so that the image will accurately map onto the sphere, as we will be using equirectangular projection, but more on that later. .. image:: img/planet_new_viewport.png Next, disable HDR and disable 3D. We don't need HDR because our planet's surface will not be especially -bright, so values between ``0`` and ``1`` will be fine. And we will be using a `ColorRect ` +bright, so values between ``0`` and ``1`` will be fine. And we will be using a `ColorRect` to render the surface, so we don't need 3D either. -Select the Viewport and add a `ColorRect ` as a child. +Select the Viewport and add a `ColorRect` as a child. Set the anchors "Right" and "Bottom" to ``1``, then make sure all the margins are set to ``0``. This -will ensure that the `ColorRect ` takes up the entire `Viewport `. +will ensure that the `ColorRect`. .. image:: img/planet_new_colorrect.png -Next, we add a `Shader Material ` to the `ColorRect ` (ColorRect > CanvasItem > Material > Material > ``New ShaderMaterial``). +Next, we add a `Shader Material ``New ShaderMaterial``). .. note:: Basic familiarity with shading is recommended for this tutorial. However, even if you are new to shaders, all the code will be provided, so you should have no problem following along. @@ -69,7 +69,7 @@ The above code renders a gradient like the one below. .. image:: img/planet_gradient.png -Now we have the basics of a `Viewport ` that we render to and we have a unique image that we can +Now we have the basics of a `Viewport` that we render to and we have a unique image that we can apply to the sphere. Applying the texture @@ -77,13 +77,13 @@ Applying the texture MeshInstance > GeometryInstance > Geometry > Material Override > ``New SpatialMaterial``: -Now we go into the `Mesh Instance ` and add a `SpatialMaterial ` -to it. No need for a special `Shader Material ` (although that would be a good idea +Now we go into the `Mesh Instance` +to it. No need for a special `Shader Material` (although that would be a good idea for more advanced effects, like the atmosphere in the example above). MeshInstance > GeometryInstance > Geometry > Material Override > ``click`` / ``Edit``: -Open the newly created `SpatialMaterial ` and scroll down to the "Albedo" section +Open the newly created `SpatialMaterial` and scroll down to the "Albedo" section and click beside the "Texture" property to add an Albedo Texture. Here we will apply the texture we made. Choose "New ViewportTexture" @@ -106,7 +106,7 @@ problem that we will illustrate in the next section. Making the planet texture ------------------------- -So now, when we render to our `Viewport `, it appears magically on the sphere. But there is an ugly +So now, when we render to our `Viewport`, it appears magically on the sphere. But there is an ugly seam created by our texture coordinates. So how do we get a range of coordinates that wrap around the sphere in a nice way? One solution is to use a function that repeats on the domain of our texture. ``sin`` and ``cos`` are two such functions. Let's apply them to the texture and see what happens. @@ -119,7 +119,7 @@ the sphere in a nice way? One solution is to use a function that repeats on the Not too bad. If you look around, you can see that the seam has now disappeared, but in its place, we have pinching at the poles. This pinching is due to the way Godot maps textures to spheres in its -`SpatialMaterial `. It uses a projection technique called equirectangular +`SpatialMaterial`. It uses a projection technique called equirectangular projection, which translates a spherical map onto a 2D plane. .. note:: If you are interested in a little extra information on the technique, we will be converting from @@ -273,7 +273,7 @@ And then, in the material, under the "Metallic" section, make sure ``Metallic`` isn't metallic. These values are not physically accurate, but they are good enough for this demo. Next, under the "Roughness" section, set ``Roughness`` to ``1`` and set the roughness texture to a -`Viewport Texture ` pointing to our planet texture `Viewport `. +`Viewport Texture`. Finally, set the ``Texture Channel`` to ``Alpha``. This instructs the renderer to use the ``alpha`` channel of our output ``COLOR`` as the ``Roughness`` value. @@ -282,10 +282,10 @@ channel of our output ``COLOR`` as the ``Roughness`` value. You'll notice that very little changes except that the planet is no longer reflecting the sky. This is happening because, by default, when something is rendered with an alpha value, it gets drawn as a transparent object over the background. And since the default background -of the `Viewport ` is opaque, the ``alpha`` channel of the -`Viewport Texture ` is ``1``, resulting in the planet texture being +of the `Viewport` is opaque, the ``alpha`` channel of the +`Viewport Texture` is ``1``, resulting in the planet texture being drawn with slightly fainter colors and a ``Roughness`` value of ``1`` everywhere. To correct this, we -go into the `Viewport ` and enable the "Transparent Bg" property. Since we are now +go into the `Viewport` and enable the "Transparent Bg" property. Since we are now rendering one transparent object on top of another, we want to enable ``blend_premul_alpha``: .. code-block:: glsl @@ -297,9 +297,9 @@ when blending one transparent color on top of another, even if the background ha does in this case), you end up with weird color bleed issues. Setting ``blend_premul_alpha`` fixes that. Now the planet should look like it is reflecting light on the ocean but not the land. If you haven't done -so already, add an `OmniLight ` to the scene so you can move it around and see the +so already, add an `OmniLight` to the scene so you can move it around and see the effect of the reflections on the ocean. .. image:: img/planet_ocean_reflect.png -And there you have it. A procedural planet generated using a `Viewport `. +And there you have it. A procedural planet generated using a `Viewport`. diff --git a/tutorials/shaders/your_first_shader/your_first_2d_shader.rst b/tutorials/shaders/your_first_shader/your_first_2d_shader.rst index e2285be..c6ef360 100644 --- a/tutorials/shaders/your_first_shader/your_first_2d_shader.rst +++ b/tutorials/shaders/your_first_shader/your_first_2d_shader.rst @@ -31,9 +31,9 @@ In order to use a shader it must be attached inside a `Material `Resource `. To draw multiple objects with the same material, the material must be attached to each object. -All objects derived from a `CanvasItem ` have a material -property. This includes all `GUI elements `, `Sprites -`, `TileMaps `, `MeshInstance2Ds +All objects derived from a `CanvasItem` have a material +property. This includes all `GUI elements`, `Sprites +`, `TileMaps`, `MeshInstance2Ds ` etc. They also have an option to inherit their parent's material. This can be useful if you have a large number of nodes that you want to use the same material. diff --git a/tutorials/shaders/your_first_shader/your_first_3d_shader.rst b/tutorials/shaders/your_first_shader/your_first_3d_shader.rst index 1c22f24..fc61ee7 100644 --- a/tutorials/shaders/your_first_shader/your_first_3d_shader.rst +++ b/tutorials/shaders/your_first_shader/your_first_3d_shader.rst @@ -5,7 +5,7 @@ Your first 3D shader You have decided to start writing your own custom Spatial shader. Maybe you saw a cool trick online that was done with shaders, or you have found that the -`SpatialMaterial ` isn't quite meeting your +`SpatialMaterial` isn't quite meeting your needs. Either way, you have decided to write your own and now you need to figure out where to start. @@ -33,7 +33,7 @@ custom materials in a fragment shader by writing an ocean water shader. Where to assign my material --------------------------- -In 3D, objects are drawn using `Meshes `. Meshes are a resource +In 3D, objects are drawn using `Meshes`. Meshes are a resource type that store geometry (the shape of your object) and materials (the color and how the object reacts to light) in units called "surfaces". A Mesh can have multiple surfaces, or just one. Typically, you would import a mesh from another @@ -42,9 +42,9 @@ program (e.g. Blender). But Godot also has a few `PrimitiveMeshes importing Meshes. There are multiple node types that you can use to draw a mesh. The main one is -`MeshInstance `, but you can also use `Particles -`, `MultiMeshes ` (with a -`MultiMeshInstance `), or others. +`MeshInstance`, but you can also use `Particles +`, `MultiMeshes` (with a +`MultiMeshInstance`), or others. Typically, a material is associated with a given surface in a mesh, but some nodes, like MeshInstance, allow you to override the material for a specific @@ -61,12 +61,12 @@ advantage of the MeshInstance's ability to override materials. Setting up ---------- -Add a new `MeshInstance ` node to your scene. +Add a new `MeshInstance` node to your scene. In the inspector tab beside "Mesh" click "[empty]" and select "New PlaneMesh". Then click on the image of a plane that appears. -This adds a `PlaneMesh ` to our scene. +This adds a `PlaneMesh` to our scene. Then, in the viewport, click in the upper left corner on the button that says "Perspective". A menu will appear. In the middle of the menu are options for how @@ -86,7 +86,7 @@ and thus allow us to add more detail. .. image:: img/plane-sub.png -`PrimitiveMeshes `, like PlaneMesh, only have one +`PrimitiveMeshes`, 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. @@ -163,7 +163,7 @@ Noise is a very popular tool for faking the look of terrain. Think of it as similar to the cosine function where you have repeating hills except, with noise, each hill has a different height. -Godot provides the `NoiseTexture ` resource for +Godot provides the `NoiseTexture` resource for generating a noise texture that can be accessed from a shader. To access a texture in a shader add the following code near the top of your @@ -181,7 +181,7 @@ 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". -`OpenSimplexNoise ` is used by the NoiseTexture to +`OpenSimplexNoise` is used by the NoiseTexture to generate a heightmap. Once you set it up and should look like this. @@ -264,7 +264,7 @@ Now it looks much better. .. image:: img/noise-low.png Using uniforms, we can even change the value every frame to animate the height -of the terrain. Combined with `Tweens `, this can be +of the terrain. Combined with `Tweens`, this can be especially useful for simple animations. Interacting with light @@ -284,7 +284,7 @@ First, we will add an `OmniLight` to the scene. You can see the light affecting the terrain, but it looks odd. The problem is the light is affecting the terrain as if it were a flat plane. This is because -the light shader uses the normals from the `Mesh ` to calculate +the light shader uses the normals from the `Mesh` to calculate light. The normals are stored in the Mesh, but we are changing the shape of the Mesh in diff --git a/tutorials/ui/bbcode_in_richtextlabel.rst b/tutorials/ui/bbcode_in_richtextlabel.rst index e133550..2ecd3cb 100644 --- a/tutorials/ui/bbcode_in_richtextlabel.rst +++ b/tutorials/ui/bbcode_in_richtextlabel.rst @@ -133,7 +133,7 @@ By default, ``[url]`` tags do nothing when clicked. This is to allow flexible us of ``[url]`` tags rather than limiting them to opening URLs in a web browser. To handle clicked ``[url]`` tags, connect the RichTextLabel node's -`meta_clicked ` signal to a script function. +`meta_clicked` signal to a script function. For example, the following method can be connected to ``meta_clicked`` to open clicked URLs using the user's default web browser:: @@ -253,7 +253,7 @@ object, which holds a few variables to control how the associated character is r normal circumstances. - ``color`` is the color of a given character. - Finally, ``env`` is a `class_Dictionary` of parameters assigned to a given custom - effect. You can use `get() ` with an optional default value + effect. You can use `get()` with an optional default value to retrieve each parameter, if specified by the user. For example ``[custom_fx spread=0.5 color=#FFFF00]test[/custom_fx]`` would have a float ``spread`` and Color ``color`` parameters in its ` `env`` Dictionary. See below for more usage examples. diff --git a/tutorials/ui/custom_gui_controls.rst b/tutorials/ui/custom_gui_controls.rst index d05c5ae..a936f55 100644 --- a/tutorials/ui/custom_gui_controls.rst +++ b/tutorials/ui/custom_gui_controls.rst @@ -25,7 +25,7 @@ Checking control size Unlike 2D nodes, "size" is important with controls, as it helps to organize them in proper layouts. For this, the -`Control.rect_size ` +`Control.rect_size` property is provided. Checking it during ``_draw()`` is vital to ensure everything is kept in-bounds. @@ -35,11 +35,11 @@ Checking focus Some controls (such as buttons or text editors) might provide input focus for keyboard or joypad input. Examples of this are entering text or pressing a button. This is controlled with the -`Control.focus_mode ` +`Control.focus_mode` property. When drawing, and if the control supports input focus, it is always desired to show some sort of indicator (highlight, box, etc.) to indicate that this is the currently focused control. To check for this -status, the `Control.has_focus() ` method +status, the `Control.has_focus()` method exists. Example gdscript GDScript @@ -59,12 +59,12 @@ As mentioned before, size is important to controls. This allows them to lay out properly, when set into grids, containers, or anchored. Controls, most of the time, provide a *minimum size* to help properly lay them out. For example, if controls are placed vertically on top of -each other using a `VBoxContainer `, +each other using a `VBoxContainer`, the minimum size will make sure your custom control is not squished by the other controls in the container. To provide this callback, just override -`Control.get_minimum_size() `, +`Control.get_minimum_size()`, for example: gdscript GDScript @@ -100,10 +100,10 @@ when: - The button was pressed over this control (control always captures input until button is released) - Control provides keyboard/joypad focus via - `Control.focus_mode `. + `Control.focus_mode`. This function is -`Control._gui_input() `. +`Control._gui_input()`. Simply override it in your control. No processing needs to be set. gdscript GDScript diff --git a/tutorials/ui/gui_containers.rst b/tutorials/ui/gui_containers.rst index d837012..bcb67c9 100644 --- a/tutorials/ui/gui_containers.rst +++ b/tutorials/ui/gui_containers.rst @@ -12,7 +12,7 @@ This is often the case of games, such as RPGs, online chats, tycoons or simulati common case where more advanced layout features may be required is in-game tools (or simply just tools). All these situations require a more capable OS-like user interface, with advanced layout and formatting. -For that, `Containers ` are more useful. +For that, `Containers` are more useful. Container layout ---------------- @@ -21,7 +21,7 @@ Containers provide a huge amount of layout power (as an example, the Godot edito .. image:: img/godot_containers.png -When a `Container `-derived node is used, all children `Control ` nodes give up their +When a `Container` nodes give up their own positioning ability. This means the *Container* will control their positioning and any attempt to manually alter these nodes will be either ignored or invalidated the next time their parent is resized. @@ -64,8 +64,8 @@ Godot provides several container types out of the box as they serve different pu Box Containers ^^^^^^^^^^^^^^ -Arranges child controls vertically or horizontally (via `HBoxContainer ` and -`VBoxContainer `). In the opposite of the designated direction +Arranges child controls vertically or horizontally (via `HBoxContainer` and +`VBoxContainer`). In the opposite of the designated direction (as in, vertical for an horizontal container), it just expands the children. .. image:: img/containers_box.png @@ -75,7 +75,7 @@ These containers make use of the *Ratio* property for children with the *Expand* Grid Container ^^^^^^^^^^^^^^ -Arranges child controls in a grid layout (via `GridContainer `, amount +Arranges child controls in a grid layout (via `GridContainer`, amount of columns must be specified). Uses both the vertical and horizontal expand flags. .. image:: img/containers_grid.png @@ -84,7 +84,7 @@ Margin Container ^^^^^^^^^^^^^^^^ Child controls are expanded towards the bounds of this control (via -`MarginContainer `). Padding will be added on the margins +`MarginContainer`). Padding will be added on the margins depending on the theme configuration. .. image:: img/containers_margin.png @@ -98,7 +98,7 @@ Tab Container ^^^^^^^^^^^^^ Allows you to place several child controls stacked on top of each other (via -`TabContainer `), with only the *current* one visible. +`TabContainer`), with only the *current* one visible. .. image:: img/containers_tab.png @@ -114,7 +114,7 @@ Split Container ^^^^^^^^^^^^^^^ Accepts only one or two children controls, then places them side to side with a divisor -(via `HSplitContainer ` and `VSplitContainer `). +(via `HSplitContainer`). Respects both horizontal and vertical flags, as well as *Ratio*. .. image:: img/containers_split.png @@ -128,7 +128,7 @@ PanelContainer ^^^^^^^^^^^^^^ Simple container that draws a *StyleBox*, then expands children to cover its whole area -(via `PanelContainer `, respecting the *StyleBox* margins). +(via `PanelContainer`, respecting the *StyleBox* margins). It respects both the horizontal and vertical size flags. .. image:: img/containers_panel.png @@ -139,7 +139,7 @@ ScrollContainer ^^^^^^^^^^^^^^^ Accepts a single child node. If this node is bigger than the container, scrollbars will be added -to allow panning the node around (via `ScrollContainer `). Both +to allow panning the node around (via `ScrollContainer`). Both vertical and horizontal size flags are respected, and the behavior can be turned on or off per axis in the properties. @@ -156,7 +156,7 @@ ViewportContainer ^^^^^^^^^^^^^^^^^ This is a special control that will only accept a single *Viewport* node as child, and it will display -it as if it was an image (via `ViewportContainer `). +it as if it was an image (via `ViewportContainer`). Creating custom Containers -------------------------- diff --git a/tutorials/ui/gui_navigation.rst b/tutorials/ui/gui_navigation.rst index affa24b..b78c1c6 100644 --- a/tutorials/ui/gui_navigation.rst +++ b/tutorials/ui/gui_navigation.rst @@ -12,7 +12,7 @@ to game with a controller on PC). Navigating between UI elements with keyboard or controller is done by changing which node is actively selected. This is also called changing UI focus. -Every `Control ` node in Godot is capable of having focus. +Every `Control` node in Godot is capable of having focus. By default, some control nodes have the ability to automatically grab focus reacting to built-in UI actions such as ``ui_up``, ``ui_down``, ``ui_focus_next``, etc. These actions can be seen in the project settings in the input map and can be modified. @@ -47,8 +47,8 @@ be focused by clicking on it with the mouse, or selecting it with a keyboard or controller. **Click** means it can only be focused on by clicking on it. Finally, **None** means it can't be focused at all. Different control nodes have different default settings for this based on how they are typically used, for -example, `Label ` nodes are set to "None" by default, -while `buttons ` are set to "All". +example, `Label` nodes are set to "None" by default, +while `buttons` are set to "All". Make sure to properly configure your scenes for focus and navigation. If a node has no focus neighbor configured, the engine will try to guess the next control automatically. diff --git a/tutorials/ui/gui_skinning.rst b/tutorials/ui/gui_skinning.rst index 01fc794..2c5559c 100644 --- a/tutorials/ui/gui_skinning.rst +++ b/tutorials/ui/gui_skinning.rst @@ -4,7 +4,7 @@ Introduction to GUI skinning ============================ It is essential for a game to provide clear, informative, and yet visually -pleasing user interface to its players. While `Control ` +pleasing user interface to its players. While `Control` nodes come with a decently functional look out of the box, there is always room for uniqueness and case-specific tuning. For this purpose Godot engine includes a system for GUI skinning (or theming), which allows you to customize @@ -30,7 +30,7 @@ flavors to the sides in your team-based project. Basics of themes ---------------- -The skinning system is driven by the `Theme ` resource. Every +The skinning system is driven by the `Theme` resource. Every Godot project has an inherent default theme that contains the settings used by the built-in control nodes. This is what gives the controls their distinct look out of the box. A theme only describes the configuration, however, and it is still @@ -52,33 +52,33 @@ a unique name and must be one of the following data types: - **Color** - A `color ` value, which is often used for fonts + A `color` value, which is often used for fonts and backgrounds. Colors can also be used for modulation of controls and icons. - **Constant** An integer value, which can be used either for numeric properties of - controls (such as the item separation in a `BoxContainer `), - or for boolean flags (such as the drawing of relationship lines in a `Tree `). + controls (such as the item separation in a `BoxContainer`), + or for boolean flags (such as the drawing of relationship lines in a `Tree`). - **Font** - A `font ` resource, which is used by controls that + A `font` resource, which is used by controls that display text. Fonts contain most text rendering settings, except for its size and color. On top of that, alignment and text direction are controlled by individual controls. - **Icon** - A `texture ` resource, which is normally used - to display an icon (on a `Button `, for example). + A `texture` resource, which is normally used + to display an icon (on a `Button`, for example). - **StyleBox** - A `StyleBox ` resource, a collection of configuration + A `StyleBox` resource, a collection of configuration options which define the way a UI panel should be displayed. This is - not limited to the `Panel ` control, as styleboxes + not limited to the `Panel` control, as styleboxes are used by many controls for their backgrounds and overlays. Theme types @@ -156,9 +156,9 @@ including this control's children. Local overrides are less useful for the visual flair of your user interface, especially if you aim for consistency. However, for layout nodes these are -essential. Nodes such as `BoxContainer ` and -`GridContainer ` use theme constants for defining -separation between their children, and `MarginContainer ` +essential. Nodes such as `BoxContainer` and +`GridContainer` use theme constants for defining +separation between their children, and `MarginContainer` stores its customizable margins in its theme items. Whenever a control has a local theme item override, this is the value that @@ -183,7 +183,7 @@ the item the default theme is checked. This allows you to configure the default look of every Godot control with a single theme resource, but you can go more granular than that. Every control node also has -a `theme ` property, which allows you to set a +a `theme` property, which allows you to set a custom theme for the branch of nodes starting with that control. This means that the control and all of its children, and their children in turn, would first check that custom theme resource before falling back on the project and the default themes. diff --git a/tutorials/ui/gui_theme_type_variations.rst b/tutorials/ui/gui_theme_type_variations.rst index 2a45df1..d7a2e10 100644 --- a/tutorials/ui/gui_theme_type_variations.rst +++ b/tutorials/ui/gui_theme_type_variations.rst @@ -3,8 +3,8 @@ Theme type variations ===================== -When designing a user interface there may be times when a `Control ` node -needs to have a different look than what is normally defined by a `Theme `. +When designing a user interface there may be times when a `Control` node +needs to have a different look than what is normally defined by a `Theme`. Every control node has theme property overrides, which allow you to redefine the styling for each individual UI element. @@ -12,7 +12,7 @@ each individual UI element. :align: center This approach quickly becomes hard to manage, if you need to share the same custom look -between several controls. Imagine that you use gray, blue, and red variants of `Button ` +between several controls. Imagine that you use gray, blue, and red variants of `Button` throughout your project. Setting it up every time you add a new button element to your interface is a tedious task. diff --git a/tutorials/ui/gui_using_theme_editor.rst b/tutorials/ui/gui_using_theme_editor.rst index 9427ef1..afff001 100644 --- a/tutorials/ui/gui_using_theme_editor.rst +++ b/tutorials/ui/gui_using_theme_editor.rst @@ -8,7 +8,7 @@ editor and its theme editor tool. We recommend getting familiar with the basics behind GUI skinning/theming by reading `doc_gui_skinning` before starting. The theme editor is a bottom panel tool that activates automatically, when -a `Theme ` resource is selected for editing. It contains +a `Theme` resource is selected for editing. It contains the necessary UI for adding, removing, and adjusting theme types and theme items. It features a preview section for testing your changes live, as well as a window dialog for doing bulk operations of the theme items. @@ -34,7 +34,7 @@ menu to save the new theme to a file instead. While the theme editor provides the tools to manage theme types and items, themes also include the default, fallback font that you can edit only using the Inspector dock. -Same applies to the contents of complex resource types, such as `StyleBoxes ` +Same applies to the contents of complex resource types, such as `StyleBoxes` and icons — they open for editing in the Inspector. .. figure:: img/default_font.png