### Install Android SDK Components Source: https://github.com/redot-engine/redot-docs/blob/master/contributing/development/compiling/compiling_for_android.md Complete the Android SDK setup by installing the required components. Replace `` with the actual path to your Android SDK. ```shell cmdline-tools/latest/bin/sdkmanager --sdk_root= "platform-tools" "build-tools;34.0.0" "platforms;android-34" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;23.2.8568313" ``` -------------------------------- ### Full ArrayMesh Setup (C#) Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/3d/procedural_geometry/arraymesh.md Complete C# example for setting up an ArrayMesh, including initialization, data array declaration, and adding a surface. This serves as a template for generating custom meshes. ```csharp public partial class MyMeshInstance3D : MeshInstance3D { public override void _Ready() { Godot.Collections.Array surfaceArray = []; surfaceArray.Resize((int)Mesh.ArrayType.Max); // C# arrays cannot be resized or expanded, so use Lists to create geometry. List verts = []; List uvs = []; List normals = []; List indices = []; /*********************************** * Insert code here to generate mesh. * *********************************/ // Convert Lists to arrays and assign to surface array surfaceArray[(int)Mesh.ArrayType.Vertex] = verts.ToArray(); surfaceArray[(int)Mesh.ArrayType.TexUV] = uvs.ToArray(); surfaceArray[(int)Mesh.ArrayType.Normal] = normals.ToArray(); surfaceArray[(int)Mesh.ArrayType.Index] = indices.ToArray(); var arrMesh = Mesh as ArrayMesh; if (arrMesh != null) { // Create mesh surface from mesh array // No blendshapes, lods, or compression used. arrMesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, surfaceArray); } } } ``` -------------------------------- ### SkeletonIK3D Usage Examples Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_skeletonik3d.md Examples demonstrating how to start, stop, and control the influence of the SkeletonIK3D. ```APIDOC ## SkeletonIK3D Methods ### start Starts the IK effect. #### Method `start(one_time: bool = false)` #### Parameters - **one_time** (bool) - Optional - If true, the IK effect is applied only for the current frame. ### stop Stops the IK effect and resets bones_global_pose_override on the Skeleton. #### Method `stop()` ### set_influence Sets the influence of the IK effect. #### Method `set_influence(influence: float)` #### Parameters - **influence** (float) - The amount of IK effect to apply. A value at or below 0.01 also removes bones_global_pose_override on Skeleton. ### is_running Checks if the IK effect is currently running. #### Method `is_running() -> bool` ### get_parent_skeleton Returns the parent Skeleton3D node. #### Method `get_parent_skeleton() -> Skeleton3D` ### GDScript Examples ```gdscript # Apply IK effect automatically on every new frame (not the current) skeleton_ik_node.start() # Apply IK effect only on the current frame skeleton_ik_node.start(true) # Stop IK effect and reset bones_global_pose_override on Skeleton skeleton_ik_node.stop() # Apply full IK effect skeleton_ik_node.set_influence(1.0) # Apply half IK effect skeleton_ik_node.set_influence(0.5) # Apply zero IK effect (a value at or below 0.01 also removes bones_global_pose_override on Skeleton) skeleton_ik_node.set_influence(0.0) ``` ``` -------------------------------- ### start Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_mcpserver.md Starts the MCPServer. ```APIDOC ## start ### Description Starts the MCPServer. ### Method start() ### Response #### Success Response - The server starts successfully. ``` -------------------------------- ### Setup and Build Documentation Source: https://github.com/redot-engine/redot-docs/blob/master/README.md Initial setup for the documentation environment and a quick build command. ```bash conda create -n redot-docs python=3.11 -y conda activate redot-docs pip install -r requirements.txt FULL_RUN=1 ./build.sh ``` -------------------------------- ### setup Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_openxrinteractionprofileeditorbase.md Setup this editor for the provided `action_map` and `interaction_profile`. ```APIDOC ## setup(action_map: OpenXRActionMap, interaction_profile: OpenXRInteractionProfile) ### Description Setup this editor for the provided `action_map` and `interaction_profile`. ### Method Signature setup(action_map: [OpenXRActionMap](class_openxractionmap.md#class-openxractionmap), interaction_profile: [OpenXRInteractionProfile](class_openxrinteractionprofile.md#class-openxrinteractionprofile)) ``` -------------------------------- ### DTLS Server Setup and Connection Handling (C#) Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_dtlsserver.md This C# example shows how to set up a DTLS server, listen for UDP connections, and accept them as DTLS clients. It covers the handshake process and managing connected clients. ```csharp using Godot; public partial class ServerNode : Node { private DtlsServer _dtls = new DtlsServer(); private UdpServer _server = new UdpServer(); private Godot.Collections.Array _peers = []; public override void _Ready() { _server.Listen(4242); var key = GD.Load("key.key"); // Your private key. var cert = GD.Load("cert.crt"); // Your X509 certificate. _dtls.Setup(TlsOptions.Server(key, cert)); } public override void _Process(double delta) { while (_server.IsConnectionAvailable()) { PacketPeerUdp peer = _server.TakeConnection(); PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer); if (dtlsPeer.GetStatus() != PacketPeerDtls.Status.Handshaking) { continue; // It is normal that 50% of the connections fails due to cookie exchange. } GD.Print("Peer connected!"); _peers.Add(dtlsPeer); } foreach (var p in _peers) { p.Poll(); // Must poll to update the state. if (p.GetStatus() == PacketPeerDtls.Status.Connected) { while (p.GetAvailablePacketCount() > 0) { GD.Print($ ``` -------------------------------- ### Full ArrayMesh Setup (GDScript) Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/3d/procedural_geometry/arraymesh.md Complete GDScript example for setting up an ArrayMesh, including initialization, data array declaration, and adding a surface. This serves as a template for generating custom meshes. ```gdscript extends MeshInstance3D func _ready(): var surface_array = [] surface_array.resize(Mesh.ARRAY_MAX) # PackedVector**Arrays for mesh construction. var verts = PackedVector3Array() var uvs = PackedVector2Array() var normals = PackedVector3Array() var indices = PackedInt32Array() ####################################### ## Insert code here to generate mesh ## ####################################### # Assign arrays to surface array. surface_array[Mesh.ARRAY_VERTEX] = verts surface_array[Mesh.ARRAY_TEX_UV] = uvs surface_array[Mesh.ARRAY_NORMAL] = normals surface_array[Mesh.ARRAY_INDEX] = indices # Create mesh surface from mesh array. # No blendshapes, lods, or compression used. mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, surface_array) ``` -------------------------------- ### DTLS Server Setup and Connection Handling (GDScript) Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_dtlsserver.md This example demonstrates setting up a DTLS server, listening for UDP connections, and accepting them as DTLS clients. It includes handling the initial handshake and processing connected clients. ```gdscript var dtls = DTLSServer.new() var server = UDPServer.new() var peers = [] func _ready(): server.listen(4242) var key = load("key.key") # Your private key. var cert = load("cert.crt") # Your X509 certificate. dtls.setup(TlsOptions.server(key, cert)) func _process(delta): while server.is_connection_available(): var peer = server.take_connection() var dtls_peer = dtls.take_connection(peer) if dtls_peer.get_status() != PacketPeerDTLS.STATUS_HANDSHAKING: continue # It is normal that 50% of the connections fails due to cookie exchange. print("Peer connected!") peers.append(dtls_peer) for p in peers: p.poll() # Must poll to update the state. if p.get_status() == PacketPeerDTLS.STATUS_CONNECTED: while p.get_available_packet_count() > 0: print("Received message from client: %s" % p.get_packet().get_string_from_utf8()) p.put_packet("Hello DTLS client".to_utf8_buffer()) ``` -------------------------------- ### Get Section Start Time Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_animationplayer.md Returns the start time of the animation section. ```APIDOC ## get_section_start_time ### Description Returns the start time of the animation section. ### Method `get_section_start_time(name: StringName) -> float` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Return Value** (float) - The start time of the animation section. #### Response Example None ``` -------------------------------- ### Setup Plugin Entry Point (C#) Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/plugins/editor/inspector_plugins.md Implement _EnterTree and _ExitTree to add and remove inspector plugins. Instantiate the plugin class directly. ```csharp // Plugin.cs #if TOOLS using Godot; [Tool] public partial class Plugin : EditorPlugin { private MyInspectorPlugin _plugin; public override void _EnterTree() { _plugin = new MyInspectorPlugin(); AddInspectorPlugin(_plugin); } public override void _ExitTree() { RemoveInspectorPlugin(_plugin); } } #endif ``` -------------------------------- ### Get Selection Start Column Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_lineedit.md Returns the starting column index of the current text selection. ```gdscript get_selection_from_column() -> int ``` -------------------------------- ### Manual Documentation Build Steps Source: https://github.com/redot-engine/redot-docs/blob/master/README.md Detailed manual steps for setting up the environment, migrating content, and building documentation with Sphinx. ```bash # 1) Setup environment conda create -n redot-docs python=3.11 -y conda activate redot-docs pip install -r requirements.txt # 2) Migrate (use --exclude-classes for faster builds) python migrate.py --exclude-classes . _migrated # 3) Build with Sphinx (auto-detect CPU cores) sphinx-build -b html -j auto ./_migrated/ _build/html ``` -------------------------------- ### Get Global Start Position Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_navigationlink3d.md Retrieves the start position of the navigation link, converted to global coordinates. ```APIDOC ## get_global_start_position ### Description Returns the `start_position` that is relative to the link as a global position. ### Method `get_global_start_position()` ### Returns - [Vector3](class_vector3.md#class-vector3) - The global start position. ``` -------------------------------- ### get_selection_from_line Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_textedit.md Gets the starting line of the text selection. ```APIDOC ## get_selection_from_line ### Description Retrieves the starting line number of the current text selection. ### Method Signature `get_selection_from_line(caret_index: int = 0) -> int` ### Parameters * **caret_index** (int, optional) - The caret index. Defaults to 0. ``` -------------------------------- ### get_selection_from_column Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_lineedit.md Gets the starting column of the current text selection. ```APIDOC ## get_selection_from_column ### Description Returns the starting column index of the current text selection. ### Method LineEdit.get_selection_from_column() -> int ``` -------------------------------- ### Line Wrapping Example (Best) Source: https://github.com/redot-engine/redot-docs/blob/master/contributing/documentation/docs_writing_guidelines.md Demonstrates optimal line wrapping where lines are under 80 characters. ```none The best thing to do is to wrap lines to under 80 characters per line. Wrapping to around 80-90 characters per line is also fine. If your lines exceed 100 characters, you definitely need to add a newline! Don't forget to remove trailing whitespace when you do. ``` -------------------------------- ### get_begin Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_control.md Gets the starting point of the control's area. ```APIDOC ## get_begin ### Description Gets the starting point (top-left corner) of the control's bounding rectangle. ### Returns - (Vector2) - The starting point of the control. ``` -------------------------------- ### Get Collider Shape Example Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_raycast3d.md Retrieves the shape ID of the intersected object and demonstrates how to get the owner node of that shape for CollisionObject3D types. ```gdscript var target = get_collider() # A CollisionObject3D. var shape_id = get_collider_shape() # The shape index in the collider. var owner_id = target.shape_find_owner(shape_id) # The owner ID in the collider. var shape = target.shape_owner_get_owner(owner_id) ``` ```csharp var target = (CollisionObject3D)GetCollider(); // A CollisionObject3D. var shapeId = GetColliderShape(); // The shape index in the collider. var ownerId = target.ShapeFindOwner(shapeId); // The owner ID in the collider. var shape = target.ShapeOwnerGetOwner(ownerId); ``` -------------------------------- ### start Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_audiostreamplayback.md Starts audio playback. Optionally, playback can begin from a specified position. ```APIDOC ## start ### Description Starts audio playback. Optionally, playback can begin from a specified position. ### Method start ### Parameters #### Path Parameters - **from_pos** (float) - Optional - The position to start playback from. Defaults to 0.0. ``` -------------------------------- ### Example: Exporting a Game with --path Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/editor/command_line_tutorial.md Demonstrates a full command for exporting a release build of a game, including headless mode and specifying the project path. ```shell godot --headless --path path_to_your_project --export-release my_export_preset_name game.exe ``` -------------------------------- ### shaped_text_prev_grapheme_pos Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_textserver.md Gets the start position of the grapheme closest to the given position. ```APIDOC ## shaped_text_prev_grapheme_pos ### Description Returns grapheme start position closest to the `pos`. ### Method ```APIDOC int shaped_text_prev_grapheme_pos(RID shaped, int pos) ``` ### Parameters #### Path Parameters - **shaped** (RID) - Description of the shaped text RID. - **pos** (int) - The reference grapheme position. ``` -------------------------------- ### Minimal WebSocket Server Example Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/networking/websocket.md Sets up a WebSocket server to listen for incoming connections on a specified port. ```gdscript extends Node # The port we will listen to const PORT = 9080 ``` -------------------------------- ### Show Game Center Examples Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/platform/ios/plugins_for_ios.md Examples demonstrating how to display the Game Center overlay with specific views or leaderboards. ```gdscript var result = show_game_center({ "view": "leaderboards", "leaderboard_name": "best_time_leaderboard" }) var result = show_game_center({ "view": "achievements" }) ``` -------------------------------- ### get_section_start_time Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_animationplayer.md Gets the start time of the animation section that is currently playing. ```APIDOC ## get_section_start_time ### Description Returns the start time of the section currently being played. ### Method Signature [float](class_float.md#class-float) **get_section_start_time**() ``` -------------------------------- ### shaped_text_prev_character_pos Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_textserver.md Gets the start position of the composite character closest to the given position. ```APIDOC ## shaped_text_prev_character_pos ### Description Returns composite character start position closest to the `pos`. ### Method ```APIDOC int shaped_text_prev_character_pos(RID shaped, int pos) ``` ### Parameters #### Path Parameters - **shaped** (RID) - Description of the shaped text RID. - **pos** (int) - The reference character position. ``` -------------------------------- ### get_selectable_item Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_optionbutton.md Gets the index of the selectable item, optionally starting from the last item. ```APIDOC ## get_selectable_item ### Description Gets the index of the selectable item, optionally starting from the last item. ### Method get_selectable_item(from_last: bool = false) ### Parameters #### Path Parameters - **from_last** (bool) - Optional - If true, starts searching from the last item. Defaults to false. ``` -------------------------------- ### get_is_setup Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_skeletonmodification2d.md Checks if the modification has been successfully initialized and is ready for use. ```APIDOC ## get_is_setup() -> bool ### Description Returns whether this modification has been successfully setup or not. ### Method GET ``` -------------------------------- ### Initialize Build Options with a File Source: https://github.com/redot-engine/redot-docs/blob/master/contributing/development/compiling/introduction_to_the_buildsystem.md Configure build options by creating a 'custom.py' file in the project root. Options set here can be overridden by command-line arguments. ```python optimize = "size" module_mono_enabled = "yes" use_llvm = "yes" extra_suffix = "game_title" ``` -------------------------------- ### initial_clip Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_audiostreaminteractive.md Sets or gets the index of the first clip to be played when the stream starts. ```APIDOC ## Property: initial_clip ### Description Index of the initial clip, which will be played first when this stream is played. ### Type [int](class_int.md#class-int) ### Default Value `0` ### Methods - **set_initial_clip**(value: [int](class_int.md#class-int)) - [int](class_int.md#class-int) **get_initial_clip**() ``` -------------------------------- ### Open and Make Directory Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_diraccess.md Demonstrates opening a directory and creating a subdirectory using both standard and static methods. ```gdscript var dir = DirAccess.open("user://levels") dir.make_dir("world1") # Static DirAccess.make_dir_absolute("user://levels/world1") ``` -------------------------------- ### Get Line Syntax Highlighting Data Example Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_syntaxhighlighter.md This example demonstrates the possible return value for `get_line_syntax_highlighting`. It shows how to define color regions for different parts of a line. ```gdscript { 0: { "color": Color(1, 0, 0) }, 5: { "color": Color(0, 1, 0) } } ``` -------------------------------- ### Windows Build Example Source: https://github.com/redot-engine/redot-docs/blob/master/contributing/development/compiling/compiling_with_dotnet.md Commands to build the Godot editor and export templates for Windows, generate glue sources, and build .NET assemblies. ```shell # Build editor binary scons platform=windows target=editor module_mono_enabled=yes # Build export templates scons platform=windows target=template_debug module_mono_enabled=yes scons platform=windows target=template_release module_mono_enabled=yes # Generate glue sources bin/godot.windows.editor.x86_64.mono --headless --generate-mono-glue modules/mono/glue # Build .NET assemblies ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=windows ``` -------------------------------- ### Trim Video with FFmpeg Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/animation/creating_movies.md Trim a video by specifying the start time (`-ss`) and duration (`-t`). This example keeps 5.2 seconds of video starting from the 12.1-second mark. ```bash ffmpeg -i input.avi -ss 00:00:12.10 -t 00:00:05.20 -crf 15 output.mp4 ``` -------------------------------- ### Lobby Node Setup (C#) Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/networking/high_level_multiplayer.md Initializes the Lobby node, setting up static instance and connecting to multiplayer signals. ```csharp public override void _Ready() { Instance = this; Multiplayer.PeerConnected += OnPlayerConnected; Multiplayer.PeerDisconnected += OnPlayerDisconnected; Multiplayer.ConnectedToServer += OnConnectOk; Multiplayer.ConnectionFailed += OnConnectionFail; Multiplayer.ServerDisconnected += OnServerDisconnected; } ``` -------------------------------- ### Byte Offset Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_gltfaccessor.md Get or set the offset in bytes relative to the start of the buffer view. ```APIDOC ## int byte_offset ### Description The offset relative to the start of the buffer view in bytes. ### Methods - **set_byte_offset**(value: int) - int **get_byte_offset**() ``` -------------------------------- ### Complete GDScript Class Example Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/scripting/gdscript/gdscript_styleguide.md An example of a complete GDScript class adhering to the style guide, demonstrating class definition, signals, exports, properties with setters, and various engine callbacks. ```gdscript class_name StateMachine extends Node ## Hierarchical State machine for the player. ## ## Initializes states and delegates engine callbacks ([method Node._physics_process], ## [method Node._unhandled_input]) to the state. signal state_changed(previous, new) @export var initial_state: Node var is_active = true: set = set_is_active @onready var _state = initial_state: set = set_state @onready var _state_name = _state.name func _init(): add_to_group("state_machine") func _enter_tree(): print("this happens before the ready method!") func _ready(): state_changed.connect(_on_state_changed) _state.enter() func _unhandled_input(event): _state.unhandled_input(event) func _physics_process(delta): _state.physics_process(delta) func transition_to(target_state_path, msg={}): if not has_node(target_state_path): return var target_state = get_node(target_state_path) assert(target_state.is_composite == false) _state.exit() self._state = target_state _state.enter(msg) Events.player_state_changed.emit(_state.name) func set_is_active(value): is_active = value set_physics_process(value) set_process_unhandled_input(value) set_block_signals(not value) func set_state(value): _state = value _state_name = _state.name func _on_state_changed(previous, new): print("state changed") state_changed.emit() class State: var foo = 0 func _init(): print("Hello!") ``` -------------------------------- ### Engine.prototype.startGame Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/platform/web/html5_shell_classref.md Starts the game instance with an optional configuration override. Initializes and loads the engine if necessary, and preloads the main package. ```APIDOC ## Engine.prototype.startGame(override) ### Description Starts the game instance using the given configuration override (if any). This method initializes the instance if it is not initialized, loads the engine if it is not loaded, and preloads the main pck. It expects the initial config (or the override) to have both the `executable` and `mainPack` properties set. ### Arguments * **override** (`EngineConfig()`) -- An optional configuration override. ### Returns Promise that resolves once the game started. ### Return type Promise ``` -------------------------------- ### preprocess Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_gpuparticles3d.md Sets or gets the time to preprocess particles before animation starts, allowing delayed animation. ```APIDOC ## preprocess ### Description Amount of time to preprocess the particles before animation starts. Lets you start the animation some time after particles have started emitting. **Note:** This can be very expensive if set to a high number as it requires running the particle shader a number of times equal to the [fixed_fps](#class-gpuparticles3d-property-fixed-fps) (or 30, if [fixed_fps](#class-gpuparticles3d-property-fixed-fps) is 0) for every second. In extreme cases it can even lead to a GPU crash due to the volume of work done in a single frame. ### Method GET/SET ### Endpoint /GPUParticles3D/preprocess ``` -------------------------------- ### Setup Plugin Entry Point (GDScript) Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/plugins/editor/inspector_plugins.md Implement _enter_tree and _exit_tree to add and remove inspector plugins. Load the plugin script using preload and instantiate it with new(). ```gdscript # plugin.gd @tool extends EditorPlugin var plugin func _enter_tree(): plugin = preload("res://addons/my_inspector_plugin/my_inspector_plugin.gd").new() add_inspector_plugin(plugin) func _exit_tree(): remove_inspector_plugin(plugin) ``` -------------------------------- ### Get Effective Arguments Example Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_callable.md This example demonstrates how to calculate the effective arguments for a callable, considering unbound and bound arguments. Ensure the number of unbound arguments does not result in a negative slice size. ```gdscript func get_effective_arguments(callable, call_args): assert(call_args.size() - callable.get_unbound_arguments_count() >= 0) var result = call_args.slice(0, call_args.size() - callable.get_unbound_arguments_count()) result.append_array(callable.get_bound_arguments()) return result ``` -------------------------------- ### Get Non-Internal Groups (C#) Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_node.md Retrieves a list of group names for a node, excluding those that start with an underscore. ```csharp List nonInternalGroups = new List(); foreach (string group in GetGroups()) { if (!group.BeginsWith("_")) nonInternalGroups.Add(group); } ``` -------------------------------- ### Get Non-Internal Groups (GDScript) Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_node.md Retrieves a list of group names for a node, excluding those that start with an underscore. ```gdscript var non_internal_groups = [] for group in get_groups(): if not str(group).begins_with("_"): non_internal_groups.push_back(group) ``` -------------------------------- ### Brace Placement: Good Example (1TBS) Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/shaders/shaders_style_guide.md Follows the 1TBS style by placing the opening brace on the same line as the control statement. Always use braces for statements, even single-line ones. ```glsl void fragment() { if (true) { // ... } } ``` -------------------------------- ### Example File System Structure Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/scripting/filesystem.md Illustrates a typical file system layout for a Godot project, including the project file, scenes, scripts, and assets. ```none /project.godot /enemy/enemy.tscn /enemy/enemy.gd /enemy/enemysprite.png /player/player.gd ``` -------------------------------- ### Relative Node Paths Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_nodepath.md Examples of relative paths to nodes. These paths are resolved starting from the current node. ```gdscript ^"A" # Points to the direct child A. ``` ```gdscript ^"A/B" # Points to A's child B. ``` ```gdscript ^"." # Points to the current node. ``` ```gdscript ^".." # Points to the parent node. ``` ```gdscript ^"../C" # Points to the sibling node C. ``` ```gdscript ^"../.." # Points to the grandparent node. ``` -------------------------------- ### Absolute Node Paths Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_nodepath.md Examples of absolute paths to nodes. These paths start from the scene tree's root. ```gdscript ^"/root" # Points to the SceneTree's root Window. ``` ```gdscript ^"/root/Title" # May point to the main scene's root node named "Title". ``` ```gdscript ^"/root/Global" # May point to an autoloaded node or scene named "Global". ``` -------------------------------- ### pck_start Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_pckpacker.md Initializes and starts a new PCK file at the specified path. Allows setting alignment, an encryption key, and whether to encrypt the directory. ```APIDOC ## pck_start ### Description Creates a new PCK file at the file path `pck_path`. The `.pck` file extension isn't added automatically, so it should be part of `pck_path` (even though it's not required). ### Method Signature `pck_start(pck_path: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = false)` ### Parameters - **pck_path** (String) - The file path where the new PCK file will be created. The `.pck` extension should be included if desired. - **alignment** (int, optional) - The alignment value for the PCK file. Defaults to `32`. - **key** (String, optional) - The encryption key for the PCK file. Defaults to a string of 64 zeros. - **encrypt_directory** (bool, optional) - Whether to encrypt the directory structure of the PCK file. Defaults to `false`. ``` -------------------------------- ### start(mode, key, iv) Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_aescontext.md Initializes the AES context with a specified mode, key, and an optional initialization vector (IV). ```APIDOC [Error](class_@globalscope.md#enum-globalscope-error) **start**(mode: [Mode](#enum-aescontext-mode), key: [PackedByteArray](class_packedbytearray.md#class-packedbytearray), iv: [PackedByteArray](class_packedbytearray.md#class-packedbytearray) = PackedByteArray()) Start the AES context in the given `mode`. A `key` of either 16 or 32 bytes must always be provided, while an `iv` (initialization vector) of exactly 16 bytes, is only needed when `mode` is either [MODE_CBC_ENCRYPT](#class-aescontext-constant-mode-cbc-encrypt) or [MODE_CBC_DECRYPT](#class-aescontext-constant-mode-cbc-decrypt). ``` -------------------------------- ### Get Node Name by Index Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_nodepath.md Retrieves a specific node name from the path using its index. Indices start from 0. ```gdscript var sprite_path = NodePath("../RigidBody2D/Sprite2D") print(sprite_path.get_name(0)) # Prints ".." print(sprite_path.get_name(1)) # Prints "RigidBody2D" print(sprite_path.get_name(2)) # Prints "Sprite" ``` ```csharp var spritePath = new NodePath("../RigidBody2D/Sprite2D"); GD.Print(spritePath.GetName(0)); // Prints ".." GD.Print(spritePath.GetName(1)); // Prints "PathFollow2D" GD.Print(spritePath.GetName(2)); // Prints "Sprite" ``` -------------------------------- ### Get Property Name by Index Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_nodepath.md Retrieves a specific property name (subname) from the path using its index. Indices start from 0. ```gdscript var path_to_name = NodePath("Sprite2D:texture:resource_name") print(path_to_name.get_subname(0)) # Prints "texture" print(path_to_name.get_subname(1)) # Prints "resource_name" ``` ```csharp var pathToName = new NodePath("Sprite2D:texture:resource_name"); GD.Print(pathToName.GetSubname(0)); // Prints "texture" GD.Print(pathToName.GetSubname(1)); // Prints "resource_name" ``` -------------------------------- ### Linux/BSD Build Example Source: https://github.com/redot-engine/redot-docs/blob/master/contributing/development/compiling/compiling_with_dotnet.md Commands to build the Godot editor and export templates for Linux/BSD, generate glue sources, and build .NET assemblies. ```shell # Build editor binary scons platform=linuxbsd target=editor module_mono_enabled=yes # Build export templates scons platform=linuxbsd target=template_debug module_mono_enabled=yes scons platform=linuxbsd target=template_release module_mono_enabled=yes # Generate glue sources bin/godot.linuxbsd.editor.x86_64.mono --headless --generate-mono-glue modules/mono/glue # Generate binaries ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd ``` -------------------------------- ### setup Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_skeletonmodificationstack2d.md Initializes the modification stack, preparing it for execution. This is typically called internally by Skeleton2D. ```APIDOC ## setup ### Description Sets up the modification stack so it can execute. This function should be called by [Skeleton2D](class_skeleton2d.md#class-skeleton2d) and shouldn't be manually called unless you know what you are doing. ### Method Signature setup() ``` -------------------------------- ### emission_box_extents Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_particleprocessmaterial.md Sets or gets the extents of the emission box when the emission shape is set to EMISSION_SHAPE_BOX. The extents start from the center point and apply in both directions. ```APIDOC ## Property: emission_box_extents ### Description The box's extents if [emission_shape](#class-particleprocessmaterial-property-emission-shape) is set to [EMISSION_SHAPE_BOX](#class-particleprocessmaterial-constant-emission-shape-box). **Note:** [emission_box_extents](#class-particleprocessmaterial-property-emission-box-extents) starts from the center point and applies the X, Y, and Z values in both directions. The size is twice the area of the extents. ### Methods - `set_emission_box_extents(value: Vector3)` - `get_emission_box_extents() -> Vector3` ``` -------------------------------- ### Initialize and Populate MultiMesh (C#) Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/performance/using_multimesh.md This C# example shows how to create a MultiMesh, configure its transform format and instance count, and then assign transforms to visible instances. ```csharp using Godot; public partial class MyMultiMeshInstance3D : MultiMeshInstance3D { public override void _Ready() { // Create the multimesh. Multimesh = new Multimesh(); // Set the format first. Multimesh.TransformFormat = MultiMesh.TransformFormatEnum.Transform3D; // Then resize (otherwise, changing the format is not allowed) Multimesh.InstanceCount = 1000; // Maybe not all of them should be visible at first. Multimesh.VisibleInstanceCount = 1000; // Set the transform of the instances. for (int i = 0; i < Multimesh.VisibleInstanceCount; i++) { Multimesh.SetInstanceTransform(i, new Transform3D(Basis.Identity, new Vector3(i * 20, 0, 0))); } } } ``` -------------------------------- ### selectstart Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_webxrinterface.md Emitted when one of the input source has started its "primary action". Use get_input_source_tracker() and get_input_source_target_ray_mode() to get more information about the input source. ```APIDOC ## selectstart(input_source_id: int) ### Description Emitted when one of the input source has started its "primary action". Use [get_input_source_tracker()](#class-webxrinterface-method-get-input-source-tracker) and [get_input_source_target_ray_mode()](#class-webxrinterface-method-get-input-source-target-ray-mode) to get more information about the input source. ### Parameters #### Path Parameters - **input_source_id** (int) - Required - Identifier for the input source. ### Method Signal ``` -------------------------------- ### Line Wrapping Example (Good) Source: https://github.com/redot-engine/redot-docs/blob/master/contributing/documentation/docs_writing_guidelines.md Demonstrates acceptable line wrapping where lines are between 80-90 characters. ```none The best thing to do is to wrap lines to under 80 characters per line. Wrapping to around 80-90 characters per line is also fine. If your lines exceed 100 characters, you definitely need to add a newline! Don't forget to remove trailing whitespace when you do. ``` -------------------------------- ### Create HMAC with SHA256 in C# Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_hmaccontext.md Initializes an HMACContext, updates it with message parts, and finishes to get the HMAC. Ensure Start() is called before Update() and Finish(). ```csharp using Godot; using System.Diagnostics; public partial class MyNode : Node { private HmacContext _ctx = new HmacContext(); public override void _Ready() { byte[] key = "supersecret".ToUtf8Buffer(); Error err = _ctx.Start(HashingContext.HashType.Sha256, key); Debug.Assert(err == Error.Ok); byte[] msg1 = "this is ".ToUtf8Buffer(); byte[] msg2 = "super duper secret".ToUtf8Buffer(); err = _ctx.Update(msg1); Debug.Assert(err == Error.Ok); err = _ctx.Update(msg2); Debug.Assert(err == Error.Ok); byte[] hmac = _ctx.Finish(); GD.Print(hmac.HexEncode()); } ``` -------------------------------- ### Create HMAC with SHA256 in GDScript Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_hmaccontext.md Initializes an HMACContext, updates it with message parts, and finishes to get the HMAC. Ensure start() is called before update() and finish(). ```gdscript extends Node var ctx = HMACContext.new() func _ready(): var key = "supersecret".to_utf8_buffer() var err = ctx.start(HashingContext.HASH_SHA256, key) assert(err == OK) var msg1 = "this is ".to_utf8_buffer() var msg2 = "super duper secret".to_utf8_buffer() err = ctx.update(msg1) assert(err == OK) err = ctx.update(msg2) assert(err == OK) var hmac = ctx.finish() print(hmac.hex_encode()) ``` -------------------------------- ### Creating and Saving a ConfigFile Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_configfile.md Demonstrates how to create a new ConfigFile object, set key-value pairs within sections, and save the configuration to a file. ```APIDOC ## Creating and Saving a ConfigFile ### Description This example shows how to create a new ConfigFile, store various values under different sections, and then save the configuration to a file named "user://scores.cfg". ### Methods - `ConfigFile.new()`: Creates a new ConfigFile instance. - `config.set_value(section: String, key: String, value: Variant)`: Stores a value associated with a specific key within a given section. - `config.save(path: String)`: Saves the current configuration to the specified file path. ### Example (GDScript) ```gdscript # Create new ConfigFile object. var config = ConfigFile.new() # Store some values. config.set_value("Player1", "player_name", "Steve") config.set_value("Player1", "best_score", 10) config.set_value("Player2", "player_name", "V3geta") config.set_value("Player2", "best_score", 9001) # Save it to a file (overwrite if already exists). config.save("user://scores.cfg") ``` ### Example (C#) ```csharp // Create new ConfigFile object. var config = new ConfigFile(); // Store some values. config.SetValue("Player1", "player_name", "Steve"); config.SetValue("Player1", "best_score", 10); config.SetValue("Player2", "player_name", "V3geta"); config.config.SetValue("Player2", "best_score", 9001); // Save it to a file (overwrite if already exists). config.Save("user://scores.cfg"); ``` ``` -------------------------------- ### Display SubViewport Content with ViewportTexture Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/rendering/viewports.md To display the contents of a SubViewport, you need to draw its ViewportTexture somewhere. This example shows how to get the texture via code. ```gdscript var texture = get_viewport().get_texture() ``` -------------------------------- ### Navigate to the Repository Directory Source: https://github.com/redot-engine/redot-docs/blob/master/contributing/workflow/pr_workflow.md After cloning, move into the newly created 'godot' directory to begin working. ```shell cd godot ``` -------------------------------- ### Get Variable Type Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_@globalscope.md Returns the internal type of a variable using Variant.Type values. Example demonstrates checking if a parsed JSON result is an Array. ```gdscript var json = JSON.new() json.parse('["a", "b", "c"]') var result = json.get_data() if result is Array: print(result[0]) # Prints "a" else: print("Unexpected result!") ``` -------------------------------- ### _write_begin Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_moviewriter.md Called once before the engine starts writing video and audio data. Configures movie size, FPS, and base path. ```APIDOC ## _write_begin ### Description Called once before the engine starts writing video and audio data. `movie_size` is the width and height of the video to save. `fps` is the number of frames per second specified in the project settings or using the `--fixed-fps ` [command line argument](../tutorials/editor/command_line_tutorial.md). ### Method [_write_begin(movie_size: [Vector2i](class_vector2i.md#class-vector2i), fps: [int](class_int.md#class-int), base_path: [String](class_string.md#class-string))](#class-moviewriter-private-method-write-begin) -> [Error](class_@globalscope.md#enum-globalscope-error) ``` -------------------------------- ### squeezestart Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_webxrinterface.md Emitted when one of the input source has started its "primary squeeze action". Use get_input_source_tracker() and get_input_source_target_ray_mode() to get more information about the input source. ```APIDOC ## squeezestart(input_source_id: int) ### Description Emitted when one of the input source has started its "primary squeeze action". Use [get_input_source_tracker()](#class-webxrinterface-method-get-input-source-tracker) and [get_input_source_target_ray_mode()](#class-webxrinterface-method-get-input-source-target-ray-mode) to get more information about the input source. ### Parameters #### Path Parameters - **input_source_id** (int) - Required - Identifier for the input source. ### Method Signal ``` -------------------------------- ### WebRTCPeerConnection Configuration Options Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_webrtcpeerconnection.md Example of valid configuration options for initializing a WebRTCPeerConnection, including STUN and TURN servers. ```gdscript { "iceServers": [ { "urls": [ "stun:stun.example.com:3478" ], # One or more STUN servers. }, { "urls": [ "turn:turn.example.com:3478" ], # One or more TURN servers. "username": "a_username", # Optional username for the TURN server. "credential": "a_password", # Optional password for the TURN server. } ] } ``` -------------------------------- ### screen_get_position Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_displayserver.md Obtains the top-left pixel coordinates of a specified screen within the virtual desktop. It handles multi-monitor setups and provides a visual example of coordinate systems. ```APIDOC ## screen_get_position ### Description Returns the screen's top-left corner position in pixels. Returns [Vector2i.ZERO](class_vector2i.md#class-vector2i-constant-zero) if `screen` is invalid. On multi-monitor setups, the screen position is relative to the virtual desktop area. ### Parameters * **screen** (int) - Optional, defaults to -1. The screen to query. ### Returns * (Vector2i) - The screen's top-left corner position. ### Notes * One of the following constants can be used as `screen`: [SCREEN_OF_MAIN_WINDOW](#class-displayserver-constant-screen-of-main-window), [SCREEN_PRIMARY](#class-displayserver-constant-screen-primary), [SCREEN_WITH_MOUSE_FOCUS](#class-displayserver-constant-screen-with-mouse-focus), or [SCREEN_WITH_KEYBOARD_FOCUS](#class-displayserver-constant-screen-with-keyboard-focus). * On multi-monitor setups with different screen resolutions or orientations, the origin might be located outside any display. ``` -------------------------------- ### Set up a Timer in C# Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/best_practices/godot_notifications.md In C#, use `_Ready()` to create and configure a Timer node. Connect the `Timeout` signal to a lambda expression for recurring actions. ```csharp public override void _Ready() { var timer = new Timer(); timer.Autostart = true; timer.WaitTime = 0.5; AddChild(timer); timer.Timeout += () => GD.Print("This block runs every 0.5 seconds"); } ``` -------------------------------- ### Geometry2D.line_intersects_line Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_geometry2d.md Calculates the intersection point of two lines defined by a starting point and a direction vector. The examples show specific return values for given inputs. ```APIDOC ## Geometry2D.line_intersects_line ### Description Calculates the intersection point of two lines. ### Parameters - **from_a** (Vector2) - The starting point of the first line. - **dir_a** (Vector2) - The direction vector of the first line. - **from_b** (Vector2) - The starting point of the second line. - **dir_b** (Vector2) - The direction vector of the second line. ### Response - **Vector2** - The intersection point of the two lines. ### Examples ``` # Returns Vector2(1, 0) Geometry2D.line_intersects_line(from_a, dir_a, from_b, Vector2(1, -1)) # Returns Vector2(-1, 0) Geometry2D.line_intersects_line(from_a, dir_a, from_b, Vector2(-1, -1)) ``` ``` -------------------------------- ### Example Project Structure Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/best_practices/project_organization.md Illustrates a common and maintainable folder structure for Godot projects, grouping assets by type and function. ```none /project.godot /docs/.gdignore # See "Ignoring specific folders" below /docs/learning.html /models/town/house/house.dae /models/town/house/window.png /models/town/house/door.png /characters/player/cubio.dae /characters/player/cubio.png /characters/enemies/goblin/goblin.dae /characters/enemies/goblin/goblin.png /characters/npcs/suzanne/suzanne.dae /characters/npcs/suzanne/suzanne.png /levels/riverdale/riverdale.scn ``` -------------------------------- ### initialize Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_xrinterface.md Initializes the XR interface. ```APIDOC ## initialize ### Description Call this to initialize this interface. The first interface that is initialized is identified as the primary interface and it will be used for rendering output. After initializing the interface you want to use you then need to enable the AR/VR mode of a viewport and rendering should commence. **Note:** You must enable the XR mode on the main viewport for any device that uses the main output of Redot, such as for mobile VR. ### Returns - [bool](class_bool.md#class-bool) - True if the interface was initialized successfully, false otherwise. ``` -------------------------------- ### Get Type Name as String Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_@globalscope.md Returns the human-readable name of a given type using Variant.Type values. Example shows printing the type name for TYPE_INT. ```gdscript print(TYPE_INT) # Prints 2 print(type_string(TYPE_INT)) # Prints "int" print(type_string(TYPE_STRING)) # Prints "String" ``` -------------------------------- ### squeezestart Signal Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_webxrinterface.md Emitted when one of the input sources has started its "primary squeeze action". Use get_input_source_tracker() and get_input_source_target_ray_mode() to get more information about the input source. ```APIDOC ## Signal squeezestart ### Description Emitted when one of the input sources has started its "primary squeeze action". Use [get_input_source_tracker()](#class-webxrinterface-method-get-input-source-tracker) and [get_input_source_target_ray_mode()](#class-webxrinterface-method-get-input-source-target-ray-mode) to get more information about the input source. ### Parameters * **input_source_id** (int) - The ID of the input source. ``` -------------------------------- ### Update Subscription Example Source: https://github.com/redot-engine/redot-docs/blob/master/tutorials/platform/android/android_in_app_purchases.md Demonstrates how to initiate a subscription update using `updateSubscription()`. Ensure you have the active subscription's purchase token and the new SKU ID. ```gdscript payment.updateSubscription(_active_subscription_purchase.purchase_token, \ "new_sub_sku", SubscriptionProrationMode.IMMEDIATE_WITH_TIME_PRORATION) ``` -------------------------------- ### begin Source: https://github.com/redot-engine/redot-docs/blob/master/classes/class_surfacetool.md Begins creating a new surface with the specified primitive type. ```APIDOC ## begin ### Description Begins creating a new surface with the specified primitive type. ### Method begin ### Parameters #### Path Parameters - **primitive** (PrimitiveType) - Required - The primitive type for the new surface (e.g., Mesh.PRIMITIVE_TRIANGLES). ```