diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 034f914db37..0e5cf7756a0 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -491,7 +491,7 @@ Error HTTPClient::poll() { continue; } if (s.begins_with("content-length:")) { - body_size = s.substr(s.find(":") + 1, s.length()).strip_edges().to_int(); + body_size = s.substr(s.find(":") + 1, s.length()).strip_edges().to_int64(); body_left = body_size; } else if (s.begins_with("transfer-encoding:")) { diff --git a/core/io/http_client.h b/core/io/http_client.h index 47ad576f5d7..dae5673f41b 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -174,8 +174,8 @@ private: Vector chunk; int chunk_left; bool chunk_trailer_part; - int body_size; - int body_left; + int64_t body_size; + int64_t body_left; bool read_until_eof; Ref tcp_connection; diff --git a/doc/classes/CameraFeed.xml b/doc/classes/CameraFeed.xml index a43a6e244ca..3bebc48cd38 100644 --- a/doc/classes/CameraFeed.xml +++ b/doc/classes/CameraFeed.xml @@ -4,7 +4,7 @@ A camera feed gives you access to a single physical camera attached to your device. - A camera feed gives you access to a single physical camera attached to your device. When enabled, Godot will start capturing frames from the camera which can then be used. + A camera feed gives you access to a single physical camera attached to your device. When enabled, Godot will start capturing frames from the camera which can then be used. See also [CameraServer]. [b]Note:[/b] Many cameras will return YCbCr images which are split into two textures and need to be combined in a shader. Godot does this automatically for you if you set the environment to show the camera image in the background. diff --git a/doc/classes/CameraServer.xml b/doc/classes/CameraServer.xml index 08cfffdb228..46d6d73203f 100644 --- a/doc/classes/CameraServer.xml +++ b/doc/classes/CameraServer.xml @@ -6,6 +6,7 @@ The [CameraServer] keeps track of different cameras accessible in Godot. These are external cameras such as webcams or the cameras on your phone. It is notably used to provide AR modules with a video feed from the camera. + [b]Note:[/b] This class is currently only implemented on macOS and iOS. On other platforms, no [CameraFeed]s will be available. @@ -14,7 +15,7 @@ - Adds a camera feed to the camera server. + Adds the camera [code]feed[/code] to the camera server. @@ -27,7 +28,7 @@ - Returns the [CameraFeed] with this id. + Returns the [CameraFeed] corresponding to the camera with the given [code]index[/code]. @@ -40,7 +41,7 @@ - Removes a [CameraFeed]. + Removes the specified camera [code]feed[/code]. @@ -48,13 +49,13 @@ - Emitted when a [CameraFeed] is added (e.g. webcam is plugged in). + Emitted when a [CameraFeed] is added (e.g. a webcam is plugged in). - Emitted when a [CameraFeed] is removed (e.g. webcam is unplugged). + Emitted when a [CameraFeed] is removed (e.g. a webcam is unplugged). @@ -63,7 +64,7 @@ The RGBA camera image. - The YCbCr camera image. + The [url=https://en.wikipedia.org/wiki/YCbCr]YCbCr[/url] camera image. The Y component camera image. diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 5c40e1c2a8c..5f1560ca1fb 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -34,7 +34,7 @@ - Draws an arc between the given angles. The larger the value of [code]point_count[/code], the smoother the curve. + Draws a unfilled arc between the given angles. The larger the value of [code]point_count[/code], the smoother the curve. See also [method draw_circle]. @@ -54,7 +54,7 @@ - Draws a colored circle. + Draws a colored, unfilled circle. See also [method draw_arc], [method draw_polyline] and [method draw_polygon]. @@ -66,7 +66,7 @@ - Draws a colored polygon of any amount of points, convex or concave. + Draws a colored polygon of any amount of points, convex or concave. Unlike [method draw_polygon], a single color must be specified for the whole polygon. @@ -77,7 +77,7 @@ - Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased. + Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased. See also [method draw_multiline] and [method draw_polyline]. @@ -98,7 +98,7 @@ - Draws multiple, parallel lines with a uniform [code]color[/code]. + Draws multiple disconnected lines with a uniform [code]color[/code]. When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw interconnected lines, use [method draw_polyline] instead. [b]Note:[/b] [code]width[/code] and [code]antialiased[/code] are currently not implemented and have no effect. @@ -109,7 +109,7 @@ - Draws multiple, parallel lines with a uniform [code]width[/code] and segment-by-segment coloring. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code]. + Draws multiple disconnected lines with a uniform [code]width[/code] and segment-by-segment coloring. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code]. When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw interconnected lines, use [method draw_polyline_colors] instead. [b]Note:[/b] [code]width[/code] and [code]antialiased[/code] are currently not implemented and have no effect. @@ -131,7 +131,7 @@ - Draws a polygon of any amount of points, convex or concave. + Draws a solid polygon of any amount of points, convex or concave. Unlike [method draw_colored_polygon], each point's color can be changed individually. See also [method draw_polyline] and [method draw_polyline_colors]. @@ -141,7 +141,7 @@ - Draws interconnected line segments with a uniform [code]color[/code] and [code]width[/code] and optional antialiasing. + Draws interconnected line segments with a uniform [code]color[/code] and [code]width[/code] and optional antialiasing. When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw disconnected lines, use [method draw_multiline] instead. See also [method draw_polygon]. @@ -151,7 +151,7 @@ - Draws interconnected line segments with a uniform [code]width[/code], segment-by-segment coloring, and optional antialiasing. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code]. + Draws interconnected line segments with a uniform [code]width[/code] and segment-by-segment coloring, and optional antialiasing. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code]. When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw disconnected lines, use [method draw_multiline_colors] instead. See also [method draw_polygon]. @@ -163,7 +163,7 @@ - Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad. + Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle, and 4 points for a quad. If 0 points or more than 4 points are specified, nothing will be drawn and an error message will be printed. See also [method draw_line], [method draw_polyline], [method draw_polygon], and [method draw_rect]. @@ -332,7 +332,7 @@ - Hide the [CanvasItem] if it's currently visible. + Hide the [CanvasItem] if it's currently visible. This is equivalent to setting [member visible] to [code]false[/code]. @@ -397,7 +397,7 @@ - Show the [CanvasItem] if it's currently hidden. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead. + Show the [CanvasItem] if it's currently hidden. This is equivalent to setting [member visible] to [code]true[/code]. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead. diff --git a/doc/classes/CharFXTransform.xml b/doc/classes/CharFXTransform.xml index 537a0d67a12..b6362092377 100644 --- a/doc/classes/CharFXTransform.xml +++ b/doc/classes/CharFXTransform.xml @@ -14,7 +14,7 @@ - The index of the current character (starting from 0). Setting this property won't affect drawing. + The index of the current character (starting from 0) for the [RichTextLabel]'s BBCode text. Setting this property won't affect drawing. The Unicode codepoint the character will use. This only affects non-whitespace characters. [method @GDScript.ord] can be useful here. For example, the following will replace all characters with asterisks: @@ -42,7 +42,7 @@ The position offset the character will be drawn with (in pixels). - The index of the current character (starting from 0). Setting this property won't affect drawing. + The index of the current character (starting from 0) for this [RichTextEffect] custom block. Setting this property won't affect drawing. If [code]true[/code], the character will be drawn. If [code]false[/code], the character will be hidden. Characters around hidden characters will reflow to take the space of hidden characters. If this is not desired, set their [member color] to [code]Color(1, 1, 1, 0)[/code] instead. diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index ef0af006e93..12b46625a84 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -4,7 +4,7 @@ Color in RGBA format using floats on the range of 0 to 1. - A color represented by red, green, blue, and alpha (RGBA) components. The alpha component is often used for transparency. Values are in floating-point and usually range from 0 to 1. Some properties (such as CanvasItem.modulate) may accept values greater than 1 (overbright or HDR colors). + A color represented by red, green, blue, and alpha (RGBA) components. The alpha component is often used for opacity. Values are in floating-point and usually range from 0 to 1. Some properties (such as CanvasItem.modulate) may accept values greater than 1 (overbright or HDR colors). You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. [b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code]. @@ -239,7 +239,7 @@ - The color's alpha (transparency) component, typically on the range of 0 to 1. + The color's alpha component, typically on the range of 0 to 1. A value of 0 means that the color is fully transparent. A value of 1 means that the color is fully opaque. Wrapper for [member a] that uses the range 0 to 255 instead of 0 to 1. diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml index b31e10d9879..db80face2f6 100644 --- a/doc/classes/ColorPicker.xml +++ b/doc/classes/ColorPicker.xml @@ -41,7 +41,7 @@ If [code]true[/code], the color will apply only after the user releases the mouse button, otherwise it will apply immediately even in mouse motion event (which can cause performance issues). - If [code]true[/code], shows an alpha channel slider (transparency). + If [code]true[/code], shows an alpha channel slider (opacity). If [code]true[/code], allows editing the color with Hue/Saturation/Value sliders. diff --git a/doc/classes/ConvexPolygonShape2D.xml b/doc/classes/ConvexPolygonShape2D.xml index 0c6abd3295e..c5be33bf3ee 100644 --- a/doc/classes/ConvexPolygonShape2D.xml +++ b/doc/classes/ConvexPolygonShape2D.xml @@ -20,7 +20,7 @@ - The polygon's list of vertices. Can be in either clockwise or counterclockwise order. + The polygon's list of vertices. Can be in either clockwise or counterclockwise order. Only set this property with convex hull points, use [method set_point_cloud] to generate a convex hull shape from concave shape points. diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml index 46131d1091a..e029d126b8d 100644 --- a/doc/classes/EditorExportPlugin.xml +++ b/doc/classes/EditorExportPlugin.xml @@ -4,7 +4,8 @@ A script that is executed when exporting the project. - Editor export plugins are automatically activated whenever the user exports the project. Their most common use is to determine what files are being included in the exported project. For each plugin, [method _export_begin] is called at the beginning of the export process and then [method _export_file] is called for each exported file. + [EditorExportPlugin]s are automatically invoked whenever the user exports the project. Their most common use is to determine what files are being included in the exported project. For each plugin, [method _export_begin] is called at the beginning of the export process and then [method _export_file] is called for each exported file. + To use [EditorExportPlugin], register it using the [method EditorPlugin.add_export_plugin] method first. diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index d7e9dd78e99..625d64d9370 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -4,7 +4,7 @@ Registers a custom resource importer in the editor. Use the class to parse any file and import it as a new resource type. - EditorImportPlugins provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers. Register your [EditorPlugin] with [method EditorPlugin.add_import_plugin]. + [EditorImportPlugin]s provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers. EditorImportPlugins work by associating with specific file extensions and a resource type. See [method get_recognized_extensions] and [method get_resource_type]. They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the [code].import[/code] directory (see [member ProjectSettings.application/config/use_hidden_project_data_directory]). Below is an example EditorImportPlugin that imports a [Mesh] from a file with the extension ".special" or ".spec": [codeblock] @@ -46,6 +46,7 @@ var filename = save_path + "." + get_save_extension() return ResourceSaver.save(filename, mesh) [/codeblock] + To use [EditorImportPlugin], register it using the [method EditorPlugin.add_import_plugin] method first. https://docs.godotengine.org/en/3.4/tutorials/plugins/editor/import_plugins.html diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml index 04f427148f1..74f927eb13b 100644 --- a/doc/classes/EditorInspectorPlugin.xml +++ b/doc/classes/EditorInspectorPlugin.xml @@ -4,13 +4,13 @@ Plugin for adding custom property editors on inspector. - These plugins allow adding custom property editors to [EditorInspector]. - Plugins are registered via [method EditorPlugin.add_inspector_plugin]. + [EditorInspectorPlugin] allows adding custom property editors to [EditorInspector]. When an object is edited, the [method can_handle] function is called and must return [code]true[/code] if the object type is supported. If supported, the function [method parse_begin] will be called, allowing to place custom controls at the beginning of the class. Subsequently, the [method parse_category] and [method parse_property] are called for every category and property. They offer the ability to add custom controls to the inspector too. Finally, [method parse_end] will be called. On each of these calls, the "add" functions can be called. + To use [EditorInspectorPlugin], register it using the [method EditorPlugin.add_inspector_plugin] method first. https://docs.godotengine.org/en/3.4/tutorials/plugins/editor/inspector_plugins.html diff --git a/doc/classes/EditorSceneImporter.xml b/doc/classes/EditorSceneImporter.xml index be7fb344371..465aac0c3d9 100644 --- a/doc/classes/EditorSceneImporter.xml +++ b/doc/classes/EditorSceneImporter.xml @@ -4,6 +4,8 @@ Imports scenes from third-parties' 3D files. + [EditorSceneImporter] allows to define an importer script for a third-party 3D format. + To use [EditorSceneImporter], register it using the [method EditorPlugin.add_scene_import_plugin] method first. diff --git a/doc/classes/EditorSpatialGizmoPlugin.xml b/doc/classes/EditorSpatialGizmoPlugin.xml index db00d904873..b6928a2783c 100644 --- a/doc/classes/EditorSpatialGizmoPlugin.xml +++ b/doc/classes/EditorSpatialGizmoPlugin.xml @@ -4,7 +4,8 @@ Used by the editor to define Spatial gizmo types. - EditorSpatialGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorSpatialGizmoPlugin] for the simpler gizmos, or creating a new [EditorSpatialGizmo] type. See the tutorial in the documentation for more info. + [EditorSpatialGizmoPlugin] allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorSpatialGizmoPlugin] for the simpler gizmos, or creating a new [EditorSpatialGizmo] type. See the tutorial in the documentation for more info. + To use [EditorSpatialGizmoPlugin], register it using the [method EditorPlugin.add_spatial_gizmo_plugin] method first. https://docs.godotengine.org/en/3.4/tutorials/plugins/editor/spatial_gizmos.html diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index 50b24403b70..0934e123394 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -159,7 +159,7 @@ If [code]false[/code], stops printing error and warning messages to the console and editor Output log. This can be used to hide error and warning messages during unit test suite runs. This property is equivalent to the [member ProjectSettings.application/run/disable_stderr] project setting. - [b]Warning:[/b] If you set this to [code]false[/code] anywhere in the project, important error messages may be hidden even if they are emitted from other scripts. If this is set to [code]false[/code] in a [code]@tool[/code] script, this will also impact the editor itself. Do [i]not[/i] report bugs before ensuring error messages are enabled (as they are by default). + [b]Warning:[/b] If you set this to [code]false[/code] anywhere in the project, important error messages may be hidden even if they are emitted from other scripts. If this is set to [code]false[/code] in a [code]tool[/code] script, this will also impact the editor itself. Do [i]not[/i] report bugs before ensuring error messages are enabled (as they are by default). [b]Note:[/b] This property does not impact the editor's Errors tab when running a project from the editor. diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 64ff22bdde5..459b1883057 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -215,6 +215,7 @@ Returns [code]true[/code] when the user starts pressing the action event, meaning it's [code]true[/code] only on the frame that the user pressed down the button. This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed. If [code]exact[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + [b]Note:[/b] Due to keyboard ghosting, [method is_action_just_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. @@ -233,6 +234,7 @@ Returns [code]true[/code] if you are pressing the action event. Note that if an action has multiple buttons assigned and more than one of them is pressed, releasing one button will release the action, even if some other button assigned to this action is still pressed. If [code]exact[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + [b]Note:[/b] Due to keyboard ghosting, [method is_action_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. @@ -254,7 +256,9 @@ - Returns [code]true[/code] if you are pressing the key. You can pass a [enum KeyList] constant. + Returns [code]true[/code] if you are pressing the key in the current keyboard layout. You can pass a [enum KeyList] constant. + [method is_key_pressed] is only recommended over [method is_physical_key_pressed] in non-game applications. This ensures that shortcut keys behave as expected depending on the user's keyboard layout, as keyboard shortcuts are generally dependent on the keyboard layout in non-game applications. If in doubt, use [method is_physical_key_pressed]. + [b]Note:[/b] Due to keyboard ghosting, [method is_key_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. @@ -269,6 +273,8 @@ Returns [code]true[/code] if you are pressing the key in the physical location on the 101/102-key US QWERTY keyboard. You can pass a [enum KeyList] constant. + [method is_physical_key_pressed] is recommended over [method is_key_pressed] for in-game actions, as it will make W/A/S/D layouts work regardless of the user's keyboard layout. [method is_physical_key_pressed] will also ensure that the top row number keys work on any keyboard layout. If in doubt, use [method is_physical_key_pressed]. + [b]Note:[/b] Due to keyboard ghosting, [method is_physical_key_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. diff --git a/doc/classes/InputEvent.xml b/doc/classes/InputEvent.xml index 4ac2cf1cc47..242bbaa1818 100644 --- a/doc/classes/InputEvent.xml +++ b/doc/classes/InputEvent.xml @@ -53,6 +53,7 @@ Returns [code]true[/code] if the given action is being pressed (and is not an echo event for [InputEventKey] events, unless [code]allow_echo[/code] is [code]true[/code]). Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag]. If [code]exact_match[/code] is [code]false[/code], it ignores the input modifiers for [InputEventKey] and [InputEventMouseButton] events, and the direction for [InputEventJoypadMotion] events. + [b]Note:[/b] Due to keyboard ghosting, [method is_action_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. @@ -80,6 +81,7 @@ Returns [code]true[/code] if this input event is pressed. Not relevant for events of type [InputEventMouseMotion] or [InputEventScreenDrag]. + [b]Note:[/b] Due to keyboard ghosting, [method is_action_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information. diff --git a/doc/classes/InputEventMouse.xml b/doc/classes/InputEventMouse.xml index 0c70fa2971a..d7e0ccaf79c 100644 --- a/doc/classes/InputEventMouse.xml +++ b/doc/classes/InputEventMouse.xml @@ -16,10 +16,10 @@ The mouse button mask identifier, one of or a bitwise combination of the [enum ButtonList] button masks. - The global mouse position relative to the current [Viewport] when used in [method Control._gui_input], otherwise is at 0,0. + The global mouse position relative to the current [Viewport]. If used in [method Control._gui_input] and if the current [Control] is not under the mouse, moving it will not update this value. - The local mouse position relative to the [Viewport]. If used in [method Control._gui_input], the position is relative to the current [Control] which is under the mouse. + The local mouse position relative to the [Viewport]. If used in [method Control._gui_input], the position is relative to the current [Control] which is under the mouse. If the current [Control] is not under the mouse, moving it will not update this value. diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index 729ff3186e4..c65b2de3dde 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -121,7 +121,7 @@ - Returns the [Object] ID associated with the list. + Returns the vertical scrollbar. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property. diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 9f385a0f474..9d7175def0e 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -410,7 +410,7 @@ - Returns the amount of static memory being used by the program in bytes. + Returns the amount of static memory being used by the program in bytes (only works in debug). diff --git a/doc/classes/RootMotionView.xml b/doc/classes/RootMotionView.xml index 8042df97a9c..fcbcf88e512 100644 --- a/doc/classes/RootMotionView.xml +++ b/doc/classes/RootMotionView.xml @@ -5,7 +5,7 @@ [i]Root motion[/i] refers to an animation technique where a mesh's skeleton is used to give impulse to a character. When working with 3D animations, a popular technique is for animators to use the root skeleton bone to give motion to the rest of the skeleton. This allows animating characters in a way where steps actually match the floor below. It also allows precise interaction with objects during cinematics. See also [AnimationTree]. - [b]Note:[/b] [RootMotionView] is only visible in the editor. It will be hidden automatically in the running project, and will also be converted to a plain [Node] in the running project. This means a script attached to a [RootMotionView] node [i]must[/i] have [code]extends Node[/code] instead of [code]extends RootMotionView[/code]. Additionally, it must not be a [code]@tool[/code] script. + [b]Note:[/b] [RootMotionView] is only visible in the editor. It will be hidden automatically in the running project, and will also be converted to a plain [Node] in the running project. This means a script attached to a [RootMotionView] node [i]must[/i] have [code]extends Node[/code] instead of [code]extends RootMotionView[/code]. Additionally, it must not be a [code]tool[/code] script. https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#root-motion diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml index 206c6bfa60a..6e60b324f5a 100644 --- a/doc/classes/SpatialMaterial.xml +++ b/doc/classes/SpatialMaterial.xml @@ -64,13 +64,16 @@ Texture to multiply by [member albedo_color]. Used for basic texturing of objects. - The strength of the anisotropy effect. + The strength of the anisotropy effect. This is multiplied by [member anisotropy_flowmap]'s alpha channel if a texture is defined there and the texture contains an alpha channel. - If [code]true[/code], anisotropy is enabled. Changes the shape of the specular blob and aligns it to tangent space. Mesh tangents are needed for this to work. If the mesh does not contain tangents the anisotropy effect will appear broken. + If [code]true[/code], anisotropy is enabled. Anisotropy changes the shape of the specular blob and aligns it to tangent space. This is useful for brushed aluminium and hair reflections. + [b]Note:[/b] Mesh tangents are needed for anisotropy to work. If the mesh does not contain tangents, the anisotropy effect will appear broken. + [b]Note:[/b] Material anisotropy should not to be confused with anisotropic texture filtering. Anisotropic texture filtering can be enabled by selecting a texture in the FileSystem dock, going to the Import dock, checking the [b]Anisotropic[/b] checkbox then clicking [b]Reimport[/b]. - Texture that offsets the tangent map for anisotropy calculations. + Texture that offsets the tangent map for anisotropy calculations and optionally controls the anisotropy effect (if an alpha channel is present). The flowmap texture is expected to be a derivative map, with the red channel representing distortion on the X axis and green channel representing distortion on the Y axis. Values below 0.5 will result in negative distortion, whereas values above 0.5 will result in positive distortion. + If present, the texture's alpha channel will be used to multiply the strength of the [member anisotropy] effect. Fully opaque pixels will keep the anisotropy effect's original strength while fully transparent pixels will disable the anisotropy effect entirely. The flowmap texture's blue channel is ignored. If [code]true[/code], ambient occlusion is enabled. Ambient occlusion darkens areas based on the [member ao_texture]. diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index dedeb9f9cc6..758d6349225 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -133,7 +133,7 @@ - Sets the tile index for the cell given by a Vector2. + Sets the tile index for the given cell. An index of [code]-1[/code] clears the cell. Optionally, the tile can also be flipped, transposed, or given autotile coordinates. The autotile coordinate refers to the column and row of the subtile. [b]Note:[/b] Data such as navigation polygons and collision shapes are not immediately updated for performance reasons. @@ -155,7 +155,7 @@ - Sets the tile index for the given cell. + Sets the tile index for the cell given by a Vector2. An index of [code]-1[/code] clears the cell. Optionally, the tile can also be flipped or transposed. [b]Note:[/b] Data such as navigation polygons and collision shapes are not immediately updated for performance reasons. diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index fd9125dd82a..52b2f2c3673 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -209,7 +209,7 @@ - Returns the vector reflected from a plane defined by the given normal. + Returns the vector reflected (i.e. mirrored, or symmetric) over a line defined by the given direction vector [code]n[/code]. diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 1a6efc83e20..87a681ed86a 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -5264,6 +5264,7 @@ void RasterizerStorageGLES2::_render_target_clear(RenderTarget *rt) { // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0; @@ -5428,6 +5429,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 6bbf181355d..75124c18540 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1268,6 +1268,8 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo if (s->blend_shapes.size() && e->instance->blend_values.size()) { //blend shapes, use transform feedback storage->mesh_render_blend_shapes(s, e->instance->blend_values.read().ptr()); + //disable octahedral compression as the result of blend shapes is always uncompressed cartesian coordinates + state.scene_shader.set_conditional(SceneShaderGLES3::ENABLE_OCTAHEDRAL_COMPRESSION, false); //rebind shader state.scene_shader.bind(); #ifdef DEBUG_ENABLED diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index fd7d14a6c1d..db5b8c6b0d5 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4273,6 +4273,7 @@ void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, const float *p shaders.blend_shapes.set_conditional(BlendShapeShaderGLES3::ENABLE_BLEND, false); //first pass does not blend shaders.blend_shapes.set_conditional(BlendShapeShaderGLES3::USE_2D_VERTEX, s->format & VS::ARRAY_FLAG_USE_2D_VERTICES); //use 2D vertices if needed + shaders.blend_shapes.set_conditional(BlendShapeShaderGLES3::ENABLE_OCTAHEDRAL_COMPRESSION, s->format & VS::ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION); //use octahedral normal compression shaders.blend_shapes.bind(); @@ -6441,6 +6442,7 @@ void RasterizerStorageGLES3::_particles_process(Particles *p_particles, float p_ glBindVertexArray(p_particles->particle_vaos[0]); + glBindBuffer(GL_ARRAY_BUFFER, 0); // ensure this is unbound per WebGL2 spec glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, p_particles->particle_buffers[1]); // GLint size = 0; @@ -6823,6 +6825,7 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0; @@ -7332,6 +7335,7 @@ void RasterizerStorageGLES3::render_target_set_external_texture(RID p_render_tar // clean up our texture Texture *t = texture_owner.get(rt->external.texture); + t->tex_id = 0; t->alloc_height = 0; t->alloc_width = 0; t->width = 0; diff --git a/drivers/gles3/shaders/blend_shape.glsl b/drivers/gles3/shaders/blend_shape.glsl index da6dec16768..2a0aa6a06d2 100644 --- a/drivers/gles3/shaders/blend_shape.glsl +++ b/drivers/gles3/shaders/blend_shape.glsl @@ -25,11 +25,19 @@ ARRAY_INDEX=8, layout(location = 0) in highp VFORMAT vertex_attrib; /* clang-format on */ +#ifdef ENABLE_OCTAHEDRAL_COMPRESSION +layout(location = 2) in vec4 normal_tangent_attrib; +#else layout(location = 1) in vec3 normal_attrib; +#endif #ifdef ENABLE_TANGENT +#ifdef ENABLE_OCTAHEDRAL_COMPRESSION +// packed into normal_attrib zw component +#else layout(location = 2) in vec4 tangent_attrib; #endif +#endif #ifdef ENABLE_COLOR layout(location = 3) in vec4 color_attrib; @@ -109,20 +117,37 @@ out vec4 weight_out; //tfb:ENABLE_SKELETON uniform float blend_amount; +#ifdef ENABLE_OCTAHEDRAL_COMPRESSION +vec3 oct_to_vec3(vec2 e) { + vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y)); + float t = max(-v.z, 0.0); + v.xy += t * -sign(v.xy); + return normalize(v); +} +#endif + void main() { #ifdef ENABLE_BLEND vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount; #ifdef ENABLE_NORMAL +#ifdef ENABLE_OCTAHEDRAL_COMPRESSION + normal_out = normal_attrib_blend + oct_to_vec3(normal_tangent_attrib.xy) * blend_amount; +#else normal_out = normal_attrib_blend + normal_attrib * blend_amount; #endif +#endif #ifdef ENABLE_TANGENT - +#ifdef ENABLE_OCTAHEDRAL_COMPRESSION + tangent_out.xyz = tangent_attrib_blend.xyz + oct_to_vec3(vec2(normal_tangent_attrib.z, abs(normal_tangent_attrib.w) * 2.0 - 1.0)) * blend_amount; + tangent_out.w = sign(tangent_attrib_blend.w); +#else tangent_out.xyz = tangent_attrib_blend.xyz + tangent_attrib.xyz * blend_amount; tangent_out.w = tangent_attrib_blend.w; //just copy, no point in blending his #endif +#endif #ifdef ENABLE_COLOR @@ -150,14 +175,22 @@ void main() { vertex_out = vertex_attrib * blend_amount; #ifdef ENABLE_NORMAL +#ifdef ENABLE_OCTAHEDRAL_COMPRESSION + normal_out = oct_to_vec3(normal_tangent_attrib.xy) * blend_amount; +#else normal_out = normal_attrib * blend_amount; #endif +#endif #ifdef ENABLE_TANGENT - +#ifdef ENABLE_OCTAHEDRAL_COMPRESSION + tangent_out.xyz = oct_to_vec3(vec2(normal_tangent_attrib.z, abs(normal_tangent_attrib.w) * 2.0 - 1.0)) * blend_amount; + tangent_out.w = sign(normal_tangent_attrib.w); +#else tangent_out.xyz = tangent_attrib.xyz * blend_amount; tangent_out.w = tangent_attrib.w; //just copy, no point in blending his #endif +#endif #ifdef ENABLE_COLOR diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index 91853632f92..cab8ea7250b 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -124,7 +124,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { char fname[16384]; unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - String name = fname; + String name = String::utf8(fname); files_sorted.insert(name); ret = unzGoToNextFile(pkg); @@ -304,7 +304,7 @@ void EditorAssetInstaller::ok_pressed() { char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - String name = fname; + String name = String::utf8(fname); if (status_map.has(name) && status_map[name]->is_checked(0)) { String path = status_map[name]->get_metadata(0); diff --git a/editor/editor_atlas_packer.cpp b/editor/editor_atlas_packer.cpp index 300d7ed2b1f..8ba5dc60886 100644 --- a/editor/editor_atlas_packer.cpp +++ b/editor/editor_atlas_packer.cpp @@ -232,12 +232,12 @@ void EditorAtlasPacker::chart_pack(Vector &charts, int &r_width, int &r_h const int *top_heights = bitmaps[i].top_heights.ptr(); const int *bottom_heights = bitmaps[i].bottom_heights.ptr(); - for (int j = 0; j < atlas_w - w; j++) { + for (int j = 0; j <= atlas_w - w; j++) { int height = 0; for (int k = 0; k < w; k++) { int pixmap_h = bottom_heights[k]; - if (pixmap_h == -1) { + if (pixmap_h == 0x7FFFFFFF) { continue; //no pixel here, anything is fine } diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 42dc2b3fbdc..2c90639c8fe 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -399,7 +399,7 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_ char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - String file = fname; + String file = String::utf8(fname); if (file.ends_with("version.txt")) { Vector data; data.resize(info.uncompressed_size); @@ -460,7 +460,7 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_ char fname[16384]; unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - String file_path(String(fname).simplify_path()); + String file_path(String::utf8(fname).simplify_path()); String file = file_path.get_file(); @@ -706,7 +706,7 @@ Error ExportTemplateManager::install_android_template_from_file(const String &p_ char fpath[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, nullptr, 0, nullptr, 0); - String path = fpath; + String path = String::utf8(fpath); String base_dir = path.get_base_dir(); if (!path.ends_with("/")) { diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index efc179d60ca..6b450a80a0f 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -3639,6 +3639,35 @@ AABB SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, b return bounds; } +Node *SpatialEditorViewport::_sanitize_preview_node(Node *p_node) const { + Spatial *spatial = Object::cast_to(p_node); + if (spatial == nullptr) { + Spatial *replacement_node = memnew(Spatial); + replacement_node->set_name(p_node->get_name()); + p_node->replace_by(replacement_node); + memdelete(p_node); + p_node = replacement_node; + } else { + VisualInstance *visual_instance = Object::cast_to(spatial); + if (visual_instance == nullptr) { + Spatial *replacement_node = memnew(Spatial); + replacement_node->set_name(spatial->get_name()); + replacement_node->set_visible(spatial->is_visible()); + replacement_node->set_transform(spatial->get_transform()); + replacement_node->set_as_toplevel(spatial->is_set_as_toplevel()); + p_node->replace_by(replacement_node); + memdelete(p_node); + p_node = replacement_node; + } + } + + for (int i = 0; i < p_node->get_child_count(); i++) { + _sanitize_preview_node(p_node->get_child(i)); + } + + return p_node; +} + void SpatialEditorViewport::_create_preview(const Vector &files) const { for (int i = 0; i < files.size(); i++) { String path = files[i]; @@ -3655,6 +3684,7 @@ void SpatialEditorViewport::_create_preview(const Vector &files) const { if (scene.is_valid()) { Node *instance = scene->instance(); if (instance) { + instance = _sanitize_preview_node(instance); preview_node->add_child(instance); } } diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index 493dc857a42..8c09613890c 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -443,6 +443,9 @@ private: Vector3 _get_instance_position(const Point2 &p_pos) const; static AABB _calculate_spatial_bounds(const Spatial *p_parent, bool p_exclude_toplevel_transform = true); + + Node *_sanitize_preview_node(Node *p_node) const; + void _create_preview(const Vector &files) const; void _remove_preview(); bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node); diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 912d0f3a764..a3a989c1c4e 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -36,6 +36,8 @@ #include "editor/editor_scale.h" +constexpr double REFRESH_TIMER = 1.5; + void ThemeEditorPreview::set_preview_theme(const Ref &p_theme) { preview_content->set_theme(p_theme); } @@ -66,7 +68,7 @@ void ThemeEditorPreview::_refresh_interval() { } void ThemeEditorPreview::_preview_visibility_changed() { - set_process(is_visible()); + set_process(is_visible_in_tree()); } void ThemeEditorPreview::_picker_button_cbk() { @@ -192,7 +194,7 @@ void ThemeEditorPreview::_notification(int p_what) { case NOTIFICATION_PROCESS: { time_left -= get_process_delta_time(); if (time_left < 0) { - time_left = 1.5; + time_left = REFRESH_TIMER; _refresh_interval(); } } break; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 763a9be538e..7287975fa40 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -203,7 +203,7 @@ private: char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - if (String(fname).ends_with("project.godot")) { + if (String::utf8(fname).ends_with("project.godot")) { break; } @@ -513,7 +513,7 @@ private: char fname[16384]; unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - String name = fname; + String name = String::utf8(fname); if (name.ends_with("project.godot")) { zip_root = name.substr(0, name.rfind("project.godot")); break; @@ -533,7 +533,7 @@ private: char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - String path = fname; + String path = String::utf8(fname); if (path == String() || path == zip_root || !zip_root.is_subsequence_of(path)) { // diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html index d3bf072ea58..9319091355c 100644 --- a/misc/dist/html/editor.html +++ b/misc/dist/html/editor.html @@ -295,7 +295,7 @@

- Web editor documentation + Web editor documentation