classes/class_gpuparticlescollisionheightfield3d ----------------------------------------------------------- GPUParticlesCollisionHeightField3D Inherits: GPUParticlesCollision3D < VisualInstance3D < Node3D < Node < Object A real-time heightmap-shaped 3D particle collision shape affecting GPUParticles3D nodes. Description A real-time heightmap-shaped 3D particle collision shape affecting GPUParticles3D nodes. Heightmap shapes allow for efficiently representing collisions for convex and concave objects with a single "floor" (such as terrain). This is less flexible than GPUParticlesCollisionSDF3D, but it doesn't require a baking step. GPUParticlesCollisionHeightField3D can also be regenerated in real-time when it is moved, when the camera moves, or even continuously. This makes GPUParticlesCollisionHeightField3D a good choice for weather effects such as rain and snow and games with highly dynamic geometry. However, this class is limited since heightmaps cannot represent overhangs (e.g. indoors or caves). Note: ParticleProcessMaterial.collision_mode must be true on the GPUParticles3D's process material for collision to work. Note: Particle collision only affects GPUParticles3D, not CPUParticles3D. Properties bool follow_camera_enabled false Resolution resolution 2 Vector3 size Vector3(2, 2, 2) UpdateMode update_mode 0 Enumerations enum Resolution: Resolution RESOLUTION_256 = 0 Generate a 256×256 heightmap. Intended for small-scale scenes, or larger scenes with no distant particles. Resolution RESOLUTION_512 = 1 Generate a 512×512 heightmap. Intended for medium-scale scenes, or larger scenes with no distant particles. Resolution RESOLUTION_1024 = 2 Generate a 1024×1024 heightmap. Intended for large scenes with distant particles. Resolution RESOLUTION_2048 = 3 Generate a 2048×2048 heightmap. Intended for very large scenes with distant particles. Resolution RESOLUTION_4096 = 4 Generate a 4096×4096 heightmap. Intended for huge scenes with distant particles. Resolution RESOLUTION_8192 = 5 Generate a 8192×8192 heightmap. Intended for gigantic scenes with distant particles. Resolution RESOLUTION_MAX = 6 Represents the size of the Resolution enum. enum UpdateMode: UpdateMode UPDATE_MODE_WHEN_MOVED = 0 Only update the heightmap when the GPUParticlesCollisionHeightField3D node is moved, or when the camera moves if follow_camera_enabled is true. An update can be forced by slightly moving the GPUParticlesCollisionHeightField3D in any direction, or by calling RenderingServer.particles_collision_height_field_update. UpdateMode UPDATE_MODE_ALWAYS = 1 Update the heightmap every frame. This has a significant performance cost. This update should only be used when geometry that particles can collide with changes significantly during gameplay. Property Descriptions bool follow_camera_enabled = false void set_follow_camera_enabled ( bool value ) bool is_follow_camera_enabled ( ) If true, the GPUParticlesCollisionHeightField3D will follow the current camera in global space. The GPUParticlesCollisionHeightField3D does not need to be a child of the Camera3D node for this to work. Following the camera has a performance cost, as it will force the heightmap to update whenever the camera moves. Consider lowering resolution to improve performance if follow_camera_enabled is true. Resolution resolution = 2 void set_resolution ( Resolution value ) Resolution get_resolution ( ) Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If update_mode is UPDATE_MODE_ALWAYS, consider using the lowest resolution possible. Vector3 size = Vector3(2, 2, 2) void set_size ( Vector3 value ) Vector3 get_size ( ) The collision heightmap's size in 3D units. To improve heightmap quality, size should be set as small as possible while covering the parts of the scene you need. UpdateMode update_mode = 0 void set_update_mode ( UpdateMode value ) UpdateMode get_update_mode ( ) The update policy to use for the generated heightmap. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_gpuparticlescollisionheightfield3d.html classes/class_canvasitem ----------------------------------------------------------- CanvasItem Inherits: Node < Object Inherited By: Control, Node2D Abstract base class for everything in 2D space. Description Abstract base class for everything in 2D space. Canvas items are laid out in a tree; children inherit and extend their parent's transform. CanvasItem is extended by Control for GUI-related nodes, and by Node2D for 2D game objects. Any CanvasItem can draw. For this, queue_redraw is called by the engine, then NOTIFICATION_DRAW will be received on idle time to request a redraw. Because of this, canvas items don't need to be redrawn on every frame, improving the performance significantly. Several functions for drawing on the CanvasItem are provided (see draw_* functions). However, they can only be used inside _draw, its corresponding Object._notification or methods connected to the draw signal. Canvas items are drawn in tree order on their canvas layer. By default, children are on top of their parents, so a root CanvasItem will be drawn behind everything. This behavior can be changed on a per-item basis. A CanvasItem can be hidden, which will also hide its children. By adjusting various other properties of a CanvasItem, you can also modulate its color (via modulate or self_modulate), change its Z-index, blend mode, and more. Tutorials Viewport and canvas transforms Custom drawing in 2D Audio Spectrum Demo Properties ClipChildrenMode clip_children 0 int light_mask 1 Material material Color modulate Color(1, 1, 1, 1) Color self_modulate Color(1, 1, 1, 1) bool show_behind_parent false TextureFilter texture_filter 0 TextureRepeat texture_repeat 0 bool top_level false bool use_parent_material false int visibility_layer 1 bool visible true bool y_sort_enabled false bool z_as_relative true int z_index 0 Methods void _draw ( ) virtual void draw_animation_slice ( float animation_length, float slice_begin, float slice_end, float offset=0.0 ) void draw_arc ( Vector2 center, float radius, float start_angle, float end_angle, int point_count, Color color, float width=-1.0, bool antialiased=false ) void draw_char ( Font font, Vector2 pos, String char, int font_size=16, Color modulate=Color(1, 1, 1, 1) ) const void draw_char_outline ( Font font, Vector2 pos, String char, int font_size=16, int size=-1, Color modulate=Color(1, 1, 1, 1) ) const void draw_circle ( Vector2 position, float radius, Color color ) void draw_colored_polygon ( PackedVector2Array points, Color color, PackedVector2Array uvs=PackedVector2Array(), Texture2D texture=null ) void draw_dashed_line ( Vector2 from, Vector2 to, Color color, float width=-1.0, float dash=2.0, bool aligned=true ) void draw_end_animation ( ) void draw_lcd_texture_rect_region ( Texture2D texture, Rect2 rect, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1) ) void draw_line ( Vector2 from, Vector2 to, Color color, float width=-1.0, bool antialiased=false ) void draw_mesh ( Mesh mesh, Texture2D texture, Transform2D transform=Transform2D(1, 0, 0, 1, 0, 0), Color modulate=Color(1, 1, 1, 1) ) void draw_msdf_texture_rect_region ( Texture2D texture, Rect2 rect, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1), float outline=0.0, float pixel_range=4.0, float scale=1.0 ) void draw_multiline ( PackedVector2Array points, Color color, float width=-1.0 ) void draw_multiline_colors ( PackedVector2Array points, PackedColorArray colors, float width=-1.0 ) void draw_multiline_string ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int max_lines=-1, Color modulate=Color(1, 1, 1, 1), BitField brk_flags=3, BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const void draw_multiline_string_outline ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int max_lines=-1, int size=1, Color modulate=Color(1, 1, 1, 1), BitField brk_flags=3, BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const void draw_multimesh ( MultiMesh multimesh, Texture2D texture ) void draw_polygon ( PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs=PackedVector2Array(), Texture2D texture=null ) void draw_polyline ( PackedVector2Array points, Color color, float width=-1.0, bool antialiased=false ) void draw_polyline_colors ( PackedVector2Array points, PackedColorArray colors, float width=-1.0, bool antialiased=false ) void draw_primitive ( PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs, Texture2D texture=null ) void draw_rect ( Rect2 rect, Color color, bool filled=true, float width=-1.0 ) void draw_set_transform ( Vector2 position, float rotation=0.0, Vector2 scale=Vector2(1, 1) ) void draw_set_transform_matrix ( Transform2D xform ) void draw_string ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, Color modulate=Color(1, 1, 1, 1), BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const void draw_string_outline ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int size=1, Color modulate=Color(1, 1, 1, 1), BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const void draw_style_box ( StyleBox style_box, Rect2 rect ) void draw_texture ( Texture2D texture, Vector2 position, Color modulate=Color(1, 1, 1, 1) ) void draw_texture_rect ( Texture2D texture, Rect2 rect, bool tile, Color modulate=Color(1, 1, 1, 1), bool transpose=false ) void draw_texture_rect_region ( Texture2D texture, Rect2 rect, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1), bool transpose=false, bool clip_uv=true ) void force_update_transform ( ) RID get_canvas ( ) const RID get_canvas_item ( ) const Transform2D get_canvas_transform ( ) const Vector2 get_global_mouse_position ( ) const Transform2D get_global_transform ( ) const Transform2D get_global_transform_with_canvas ( ) const Vector2 get_local_mouse_position ( ) const Transform2D get_screen_transform ( ) const Transform2D get_transform ( ) const Rect2 get_viewport_rect ( ) const Transform2D get_viewport_transform ( ) const bool get_visibility_layer_bit ( int layer ) const World2D get_world_2d ( ) const void hide ( ) bool is_local_transform_notification_enabled ( ) const bool is_transform_notification_enabled ( ) const bool is_visible_in_tree ( ) const Vector2 make_canvas_position_local ( Vector2 screen_point ) const InputEvent make_input_local ( InputEvent event ) const void move_to_front ( ) void queue_redraw ( ) void set_notify_local_transform ( bool enable ) void set_notify_transform ( bool enable ) void set_visibility_layer_bit ( int layer, bool enabled ) void show ( ) Signals draw ( ) Emitted when the CanvasItem must redraw, after the related NOTIFICATION_DRAW notification, and before _draw is called. Note: Deferred connections do not allow drawing through the draw_* methods. hidden ( ) Emitted when becoming hidden. item_rect_changed ( ) Emitted when the item's Rect2 boundaries (position or size) have changed, or when an action is taking place that may have impacted these boundaries (e.g. changing Sprite2D.texture). visibility_changed ( ) Emitted when the visibility (hidden/visible) changes. Enumerations enum TextureFilter: TextureFilter TEXTURE_FILTER_PARENT_NODE = 0 The CanvasItem will inherit the filter from its parent. TextureFilter TEXTURE_FILTER_NEAREST = 1 The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled). TextureFilter TEXTURE_FILTER_LINEAR = 2 The texture filter blends between the nearest 4 pixels. This makes the texture look smooth from up close, and grainy from a distance (due to mipmaps not being sampled). TextureFilter TEXTURE_FILTER_NEAREST_WITH_MIPMAPS = 3 The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true). This makes the texture look pixelated from up close, and smooth from a distance. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to Camera2D zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels. TextureFilter TEXTURE_FILTER_LINEAR_WITH_MIPMAPS = 4 The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true). This makes the texture look smooth from up close, and smooth from a distance. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to Camera2D zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels. TextureFilter TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC = 5 The texture filter reads from the nearest pixel and blends between 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true) based on the angle between the surface and the camera view. This makes the texture look pixelated from up close, and smooth from a distance. Anisotropic filtering improves texture quality on surfaces that are almost in line with the camera, but is slightly slower. The anisotropic filtering level can be changed by adjusting ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level. Note: This texture filter is rarely useful in 2D projects. TEXTURE_FILTER_NEAREST_WITH_MIPMAPS is usually more appropriate in this case. TextureFilter TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC = 6 The texture filter blends between the nearest 4 pixels and blends between 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true) based on the angle between the surface and the camera view. This makes the texture look smooth from up close, and smooth from a distance. Anisotropic filtering improves texture quality on surfaces that are almost in line with the camera, but is slightly slower. The anisotropic filtering level can be changed by adjusting ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level. Note: This texture filter is rarely useful in 2D projects. TEXTURE_FILTER_LINEAR_WITH_MIPMAPS is usually more appropriate in this case. TextureFilter TEXTURE_FILTER_MAX = 7 Represents the size of the TextureFilter enum. enum TextureRepeat: TextureRepeat TEXTURE_REPEAT_PARENT_NODE = 0 The CanvasItem will inherit the filter from its parent. TextureRepeat TEXTURE_REPEAT_DISABLED = 1 Texture will not repeat. TextureRepeat TEXTURE_REPEAT_ENABLED = 2 Texture will repeat normally. TextureRepeat TEXTURE_REPEAT_MIRROR = 3 Texture will repeat in a 2x2 tiled mode, where elements at even positions are mirrored. TextureRepeat TEXTURE_REPEAT_MAX = 4 Represents the size of the TextureRepeat enum. enum ClipChildrenMode: ClipChildrenMode CLIP_CHILDREN_DISABLED = 0 Child draws over parent and is not clipped. ClipChildrenMode CLIP_CHILDREN_ONLY = 1 Parent is used for the purposes of clipping only. Child is clipped to the parent's visible area, parent is not drawn. ClipChildrenMode CLIP_CHILDREN_AND_DRAW = 2 Parent is used for clipping child, but parent is also drawn underneath child as normal before clipping child to its visible area. ClipChildrenMode CLIP_CHILDREN_MAX = 3 Represents the size of the ClipChildrenMode enum. Constants NOTIFICATION_TRANSFORM_CHANGED = 2000 The CanvasItem's global transform has changed. This notification is only received if enabled by set_notify_transform. NOTIFICATION_LOCAL_TRANSFORM_CHANGED = 35 The CanvasItem's local transform has changed. This notification is only received if enabled by set_notify_local_transform. NOTIFICATION_DRAW = 30 The CanvasItem is requested to draw (see _draw). NOTIFICATION_VISIBILITY_CHANGED = 31 The CanvasItem's visibility has changed. NOTIFICATION_ENTER_CANVAS = 32 The CanvasItem has entered the canvas. NOTIFICATION_EXIT_CANVAS = 33 The CanvasItem has exited the canvas. NOTIFICATION_WORLD_2D_CHANGED = 36 The CanvasItem's active World2D changed. Property Descriptions ClipChildrenMode clip_children = 0 void set_clip_children_mode ( ClipChildrenMode value ) ClipChildrenMode get_clip_children_mode ( ) Allows the current node to clip child nodes, essentially acting as a mask. int light_mask = 1 void set_light_mask ( int value ) int get_light_mask ( ) The rendering layers in which this CanvasItem responds to Light2D nodes. Material material void set_material ( Material value ) Material get_material ( ) The material applied to this CanvasItem. Color modulate = Color(1, 1, 1, 1) void set_modulate ( Color value ) Color get_modulate ( ) The color applied to this CanvasItem. This property does affect child CanvasItems, unlike self_modulate which only affects the node itself. Color self_modulate = Color(1, 1, 1, 1) void set_self_modulate ( Color value ) Color get_self_modulate ( ) The color applied to this CanvasItem. This property does not affect child CanvasItems, unlike modulate which affects both the node itself and its children. Note: Internal children (e.g. sliders in ColorPicker or tab bar in TabContainer) are also not affected by this property (see include_internal parameter of Node.get_child and other similar methods). bool show_behind_parent = false void set_draw_behind_parent ( bool value ) bool is_draw_behind_parent_enabled ( ) If true, the object draws behind its parent. TextureFilter texture_filter = 0 void set_texture_filter ( TextureFilter value ) TextureFilter get_texture_filter ( ) The texture filtering mode to use on this CanvasItem. TextureRepeat texture_repeat = 0 void set_texture_repeat ( TextureRepeat value ) TextureRepeat get_texture_repeat ( ) The texture repeating mode to use on this CanvasItem. bool top_level = false void set_as_top_level ( bool value ) bool is_set_as_top_level ( ) If true, this CanvasItem will not inherit its transform from parent CanvasItems. Its draw order will also be changed to make it draw on top of other CanvasItems that do not have top_level set to true. The CanvasItem will effectively act as if it was placed as a child of a bare Node. bool use_parent_material = false void set_use_parent_material ( bool value ) bool get_use_parent_material ( ) If true, the parent CanvasItem's material property is used as this one's material. int visibility_layer = 1 void set_visibility_layer ( int value ) int get_visibility_layer ( ) The rendering layer in which this CanvasItem is rendered by Viewport nodes. A Viewport will render a CanvasItem if it and all its parents share a layer with the Viewport's canvas cull mask. bool visible = true void set_visible ( bool value ) bool is_visible ( ) If true, this CanvasItem is drawn. The node is only visible if all of its ancestors are visible as well (in other words, is_visible_in_tree must return true). Note: For controls that inherit Popup, the correct way to make them visible is to call one of the multiple popup*() functions instead. bool y_sort_enabled = false void set_y_sort_enabled ( bool value ) bool is_y_sort_enabled ( ) If true, child nodes with the lowest Y position are drawn before those with a higher Y position. If false, Y-sorting is disabled. Y-sorting only affects children that inherit from CanvasItem. You can nest nodes with Y-sorting. Child Y-sorted nodes are sorted in the same space as the parent Y-sort. This feature allows you to organize a scene better or divide it into multiple ones without changing your scene tree. bool z_as_relative = true void set_z_as_relative ( bool value ) bool is_z_relative ( ) If true, the node's Z index is relative to its parent's Z index. If this node's Z index is 2 and its parent's effective Z index is 3, then this node's effective Z index will be 2 + 3 = 5. int z_index = 0 void set_z_index ( int value ) int get_z_index ( ) Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between RenderingServer.CANVAS_ITEM_Z_MIN and RenderingServer.CANVAS_ITEM_Z_MAX (inclusive). Note: Changing the Z index of a Control only affects the drawing order, not the order in which input events are handled. This can be useful to implement certain UI animations, e.g. a menu where hovered items are scaled and should overlap others. Method Descriptions void _draw ( ) virtual Called when CanvasItem has been requested to redraw (after queue_redraw is called, either manually or by the engine). Corresponds to the NOTIFICATION_DRAW notification in Object._notification. void draw_animation_slice ( float animation_length, float slice_begin, float slice_end, float offset=0.0 ) Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly. void draw_arc ( Vector2 center, float radius, float start_angle, float end_angle, int point_count, Color color, float width=-1.0, bool antialiased=false ) Draws an unfilled arc between the given angles with a uniform color and width and optional antialiasing (supported only for positive width). The larger the value of point_count, the smoother the curve. See also draw_circle. If width is negative, it will be ignored and the arc will be drawn using RenderingServer.PRIMITIVE_LINE_STRIP. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive width like 1.0. The arc is drawn from start_angle towards the value of end_angle so in clockwise direction if start_angle < end_angle and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of start_angle and end_angle is greater than @GDScript.TAU radians, then a full circle arc is drawn (i.e. arc will not overlap itself). void draw_char ( Font font, Vector2 pos, String char, int font_size=16, Color modulate=Color(1, 1, 1, 1) ) const Draws a string first character using a custom font. void draw_char_outline ( Font font, Vector2 pos, String char, int font_size=16, int size=-1, Color modulate=Color(1, 1, 1, 1) ) const Draws a string first character outline using a custom font. void draw_circle ( Vector2 position, float radius, Color color ) Draws a colored, filled circle. See also draw_arc, draw_polyline and draw_polygon. void draw_colored_polygon ( PackedVector2Array points, Color color, PackedVector2Array uvs=PackedVector2Array(), Texture2D texture=null ) Draws a colored polygon of any number of points, convex or concave. Unlike draw_polygon, a single color must be specified for the whole polygon. void draw_dashed_line ( Vector2 from, Vector2 to, Color color, float width=-1.0, float dash=2.0, bool aligned=true ) Draws a dashed line from a 2D point to another, with a given color and width. See also draw_multiline and draw_polyline. If width is negative, then a two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the line parts will remain thin. If this behavior is not desired, then pass a positive width like 1.0. void draw_end_animation ( ) After submitting all animations slices via draw_animation_slice, this function can be used to revert drawing to its default state (all subsequent drawing commands will be visible). If you don't care about this particular use case, usage of this function after submitting the slices is not required. void draw_lcd_texture_rect_region ( Texture2D texture, Rect2 rect, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1) ) Draws a textured rectangle region of the font texture with LCD subpixel anti-aliasing at a given position, optionally modulated by a color. Texture is drawn using the following blend operation, blend mode of the CanvasItemMaterial is ignored: dst.r = texture.r * modulate.r * modulate.a + dst.r * (1.0 - texture.r * modulate.a); dst.g = texture.g * modulate.g * modulate.a + dst.g * (1.0 - texture.g * modulate.a); dst.b = texture.b * modulate.b * modulate.a + dst.b * (1.0 - texture.b * modulate.a); dst.a = modulate.a + dst.a * (1.0 - modulate.a); void draw_line ( Vector2 from, Vector2 to, Color color, float width=-1.0, bool antialiased=false ) Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased. See also draw_multiline and draw_polyline. If width is negative, then a two-point primitive will be drawn instead of a four-point one. This means that when the CanvasItem is scaled, the line will remain thin. If this behavior is not desired, then pass a positive width like 1.0. void draw_mesh ( Mesh mesh, Texture2D texture, Transform2D transform=Transform2D(1, 0, 0, 1, 0, 0), Color modulate=Color(1, 1, 1, 1) ) Draws a Mesh in 2D, using the provided texture. See MeshInstance2D for related documentation. void draw_msdf_texture_rect_region ( Texture2D texture, Rect2 rect, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1), float outline=0.0, float pixel_range=4.0, float scale=1.0 ) Draws a textured rectangle region of the multi-channel signed distance field texture at a given position, optionally modulated by a color. See FontFile.multichannel_signed_distance_field for more information and caveats about MSDF font rendering. If outline is positive, each alpha channel value of pixel in region is set to maximum value of true distance in the outline radius. Value of the pixel_range should the same that was used during distance field texture generation. void draw_multiline ( PackedVector2Array points, Color color, float width=-1.0 ) Draws multiple disconnected lines with a uniform width and color. Each line is defined by two consecutive points from points array, i.e. i-th segment consists of points[2 * i], points[2 * i + 1] endpoints. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw interconnected lines, use draw_polyline instead. If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0. void draw_multiline_colors ( PackedVector2Array points, PackedColorArray colors, float width=-1.0 ) Draws multiple disconnected lines with a uniform width and segment-by-segment coloring. Each segment is defined by two consecutive points from points array and a corresponding color from colors array, i.e. i-th segment consists of points[2 * i], points[2 * i + 1] endpoints and has colors[i] color. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw interconnected lines, use draw_polyline_colors instead. If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0. void draw_multiline_string ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int max_lines=-1, Color modulate=Color(1, 1, 1, 1), BitField brk_flags=3, BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const Breaks text into lines and draws it using the specified font at the pos (top-left corner). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. void draw_multiline_string_outline ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int max_lines=-1, int size=1, Color modulate=Color(1, 1, 1, 1), BitField brk_flags=3, BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const Breaks text to the lines and draws text outline using the specified font at the pos (top-left corner). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. void draw_multimesh ( MultiMesh multimesh, Texture2D texture ) Draws a MultiMesh in 2D with the provided texture. See MultiMeshInstance2D for related documentation. void draw_polygon ( PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs=PackedVector2Array(), Texture2D texture=null ) Draws a solid polygon of any number of points, convex or concave. Unlike draw_colored_polygon, each point's color can be changed individually. See also draw_polyline and draw_polyline_colors. If you need more flexibility (such as being able to use bones), use RenderingServer.canvas_item_add_triangle_array instead. void draw_polyline ( PackedVector2Array points, Color color, float width=-1.0, bool antialiased=false ) Draws interconnected line segments with a uniform color and width and optional antialiasing (supported only for positive width). When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw disconnected lines, use draw_multiline instead. See also draw_polygon. If width is negative, it will be ignored and the polyline will be drawn using RenderingServer.PRIMITIVE_LINE_STRIP. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive width like 1.0. void draw_polyline_colors ( PackedVector2Array points, PackedColorArray colors, float width=-1.0, bool antialiased=false ) Draws interconnected line segments with a uniform width, point-by-point coloring, and optional antialiasing (supported only for positive width). Colors assigned to line points match by index between points and colors, i.e. each line segment is filled with a gradient between the colors of the endpoints. When drawing large amounts of lines, this is faster than using individual draw_line calls. To draw disconnected lines, use draw_multiline_colors instead. See also draw_polygon. If width is negative, it will be ignored and the polyline will be drawn using RenderingServer.PRIMITIVE_LINE_STRIP. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive width like 1.0. void draw_primitive ( PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs, Texture2D texture=null ) 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 draw_line, draw_polyline, draw_polygon, and draw_rect. void draw_rect ( Rect2 rect, Color color, bool filled=true, float width=-1.0 ) Draws a rectangle. If filled is true, the rectangle will be filled with the color specified. If filled is false, the rectangle will be drawn as a stroke with the color and width specified. See also draw_texture_rect. If width is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive width like 1.0. Note: width is only effective if filled is false. Note: Unfilled rectangles drawn with a negative width may not display perfectly. For example, corners may be missing or brighter due to overlapping lines (for a translucent color). void draw_set_transform ( Vector2 position, float rotation=0.0, Vector2 scale=Vector2(1, 1) ) Sets a custom transform for drawing via components. Anything drawn afterwards will be transformed by this. Note: FontFile.oversampling does not take scale into account. This means that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by enabling ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field (applies to the default project font only), or enabling Multichannel Signed Distance Field in the import options of a DynamicFont for custom fonts. On system fonts, SystemFont.multichannel_signed_distance_field can be enabled in the inspector. void draw_set_transform_matrix ( Transform2D xform ) Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this. void draw_string ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, Color modulate=Color(1, 1, 1, 1), BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const Draws text using the specified font at the pos (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. Example using the default project font: GDScript# If using this method in a script that redraws constantly, move the # `default_font` declaration to a member variable assigned in `_ready()` # so the Control is only created once. var default_font = ThemeDB.fallback_font var default_font_size = ThemeDB.fallback_font_size draw_string(default_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, default_font_size) C#// If using this method in a script that redraws constantly, move the // `default_font` declaration to a member variable assigned in `_Ready()` // so the Control is only created once. Font defaultFont = ThemeDB.FallbackFont; int defaultFontSize = ThemeDB.FallbackFontSize; DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, defaultFontSize); See also Font.draw_string. void draw_string_outline ( Font font, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int size=1, Color modulate=Color(1, 1, 1, 1), BitField justification_flags=3, Direction direction=0, Orientation orientation=0 ) const Draws text outline using the specified font at the pos (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If width is greater than or equal to 0, the text will be clipped if it exceeds the specified width. void draw_style_box ( StyleBox style_box, Rect2 rect ) Draws a styled rectangle. void draw_texture ( Texture2D texture, Vector2 position, Color modulate=Color(1, 1, 1, 1) ) Draws a texture at a given position. void draw_texture_rect ( Texture2D texture, Rect2 rect, bool tile, Color modulate=Color(1, 1, 1, 1), bool transpose=false ) Draws a textured rectangle at a given position, optionally modulated by a color. If transpose is true, the texture will have its X and Y coordinates swapped. See also draw_rect and draw_texture_rect_region. void draw_texture_rect_region ( Texture2D texture, Rect2 rect, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1), bool transpose=false, bool clip_uv=true ) Draws a textured rectangle from a texture's region (specified by src_rect) at a given position, optionally modulated by a color. If transpose is true, the texture will have its X and Y coordinates swapped. See also draw_texture_rect. void force_update_transform ( ) Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations. RID get_canvas ( ) const Returns the RID of the World2D canvas where this item is in. RID get_canvas_item ( ) const Returns the canvas item RID used by RenderingServer for this item. Transform2D get_canvas_transform ( ) const Returns the transform from the coordinate system of the canvas, this item is in, to the Viewports coordinate system. Vector2 get_global_mouse_position ( ) const Returns the mouse's position in the CanvasLayer that this CanvasItem is in using the coordinate system of the CanvasLayer. Note: For screen-space coordinates (e.g. when using a non-embedded Popup), you can use DisplayServer.mouse_get_position. Transform2D get_global_transform ( ) const Returns the global transform matrix of this item, i.e. the combined transform up to the topmost CanvasItem node. The topmost item is a CanvasItem that either has no parent, has non-CanvasItem parent or it has top_level enabled. Transform2D get_global_transform_with_canvas ( ) const Returns the transform from the local coordinate system of this CanvasItem to the Viewports coordinate system. Vector2 get_local_mouse_position ( ) const Returns the mouse's position in this CanvasItem using the local coordinate system of this CanvasItem. Transform2D get_screen_transform ( ) const Returns the transform of this CanvasItem in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins. Equals to get_global_transform if the window is embedded (see Viewport.gui_embed_subwindows). Transform2D get_transform ( ) const Returns the transform matrix of this item. Rect2 get_viewport_rect ( ) const Returns the viewport's boundaries as a Rect2. Transform2D get_viewport_transform ( ) const Returns the transform from the coordinate system of the canvas, this item is in, to the Viewports embedders coordinate system. bool get_visibility_layer_bit ( int layer ) const Returns an individual bit on the rendering visibility layer. World2D get_world_2d ( ) const Returns the World2D where this item is in. void hide ( ) Hide the CanvasItem if it's currently visible. This is equivalent to setting visible to false. bool is_local_transform_notification_enabled ( ) const Returns true if local transform notifications are communicated to children. bool is_transform_notification_enabled ( ) const Returns true if global transform notifications are communicated to children. bool is_visible_in_tree ( ) const Returns true if the node is present in the SceneTree, its visible property is true and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree, and is therefore not drawn (see _draw). Vector2 make_canvas_position_local ( Vector2 screen_point ) const Assigns screen_point as this node's new local transform. InputEvent make_input_local ( InputEvent event ) const Transformations issued by event's inputs are applied in local space instead of global space. void move_to_front ( ) Moves this node to display on top of its siblings. Internally, the node is moved to the bottom of parent's child list. The method has no effect on nodes without a parent. void queue_redraw ( ) Queues the CanvasItem to redraw. During idle time, if CanvasItem is visible, NOTIFICATION_DRAW is sent and _draw is called. This only occurs once per frame, even if this method has been called multiple times. void set_notify_local_transform ( bool enable ) If enable is true, this node will receive NOTIFICATION_LOCAL_TRANSFORM_CHANGED when its local transform changes. void set_notify_transform ( bool enable ) If enable is true, this node will receive NOTIFICATION_TRANSFORM_CHANGED when its global transform changes. void set_visibility_layer_bit ( int layer, bool enabled ) Set/clear individual bits on the rendering visibility layer. This simplifies editing this CanvasItem's visibility layer. void show ( ) Show the CanvasItem if it's currently hidden. This is equivalent to setting visible to true. For controls that inherit Popup, the correct way to make them visible is to call one of the multiple popup*() functions instead. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_canvasitem.html classes/class_camera3d ----------------------------------------------------------- Camera3D Inherits: Node3D < Node < Object Inherited By: XRCamera3D Camera node, displays from a point of view. Description Camera3D is a special node that displays what is visible from its current location. Cameras register themselves in the nearest Viewport node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a Viewport, and, without one, a scene registered in that Viewport (or higher viewports) can't be displayed. Tutorials Third Person Shooter Demo Properties CameraAttributes attributes int cull_mask 1048575 bool current false DopplerTracking doppler_tracking 0 Environment environment float far 4000.0 float fov 75.0 Vector2 frustum_offset Vector2(0, 0) float h_offset 0.0 KeepAspect keep_aspect 1 float near 0.05 ProjectionType projection 0 float size 1.0 float v_offset 0.0 Methods void clear_current ( bool enable_next=true ) Projection get_camera_projection ( ) const RID get_camera_rid ( ) const Transform3D get_camera_transform ( ) const bool get_cull_mask_value ( int layer_number ) const Plane[] get_frustum ( ) const RID get_pyramid_shape_rid ( ) bool is_position_behind ( Vector3 world_point ) const bool is_position_in_frustum ( Vector3 world_point ) const void make_current ( ) Vector3 project_local_ray_normal ( Vector2 screen_point ) const Vector3 project_position ( Vector2 screen_point, float z_depth ) const Vector3 project_ray_normal ( Vector2 screen_point ) const Vector3 project_ray_origin ( Vector2 screen_point ) const void set_cull_mask_value ( int layer_number, bool value ) void set_frustum ( float size, Vector2 offset, float z_near, float z_far ) void set_orthogonal ( float size, float z_near, float z_far ) void set_perspective ( float fov, float z_near, float z_far ) Vector2 unproject_position ( Vector3 world_point ) const Enumerations enum ProjectionType: ProjectionType PROJECTION_PERSPECTIVE = 0 Perspective projection. Objects on the screen becomes smaller when they are far away. ProjectionType PROJECTION_ORTHOGONAL = 1 Orthogonal projection, also known as orthographic projection. Objects remain the same size on the screen no matter how far away they are. ProjectionType PROJECTION_FRUSTUM = 2 Frustum projection. This mode allows adjusting frustum_offset to create "tilted frustum" effects. enum KeepAspect: KeepAspect KEEP_WIDTH = 0 Preserves the horizontal aspect ratio; also known as Vert- scaling. This is usually the best option for projects running in portrait mode, as taller aspect ratios will benefit from a wider vertical FOV. KeepAspect KEEP_HEIGHT = 1 Preserves the vertical aspect ratio; also known as Hor+ scaling. This is usually the best option for projects running in landscape mode, as wider aspect ratios will automatically benefit from a wider horizontal FOV. enum DopplerTracking: DopplerTracking DOPPLER_TRACKING_DISABLED = 0 Disables Doppler effect simulation (default). DopplerTracking DOPPLER_TRACKING_IDLE_STEP = 1 Simulate Doppler effect by tracking positions of objects that are changed in _process. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's AudioStreamPlayer3D.pitch_scale). DopplerTracking DOPPLER_TRACKING_PHYSICS_STEP = 2 Simulate Doppler effect by tracking positions of objects that are changed in _physics_process. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's AudioStreamPlayer3D.pitch_scale). Property Descriptions CameraAttributes attributes void set_attributes ( CameraAttributes value ) CameraAttributes get_attributes ( ) The CameraAttributes to use for this camera. int cull_mask = 1048575 void set_cull_mask ( int value ) int get_cull_mask ( ) The culling mask that describes which VisualInstance3D.layers are rendered by this camera. By default, all 20 user-visible layers are rendered. Note: Since the cull_mask allows for 32 layers to be stored in total, there are an additional 12 layers that are only used internally by the engine and aren't exposed in the editor. Setting cull_mask using a script allows you to toggle those reserved layers, which can be useful for editor plugins. To adjust cull_mask more easily using a script, use get_cull_mask_value and set_cull_mask_value. Note: VoxelGI, SDFGI and LightmapGI will always take all layers into account to determine what contributes to global illumination. If this is an issue, set GeometryInstance3D.gi_mode to GeometryInstance3D.GI_MODE_DISABLED for meshes and Light3D.light_bake_mode to Light3D.BAKE_DISABLED for lights to exclude them from global illumination. bool current = false void set_current ( bool value ) bool is_current ( ) If true, the ancestor Viewport is currently using this camera. If multiple cameras are in the scene, one will always be made current. For example, if two Camera3D nodes are present in the scene and only one is current, setting one camera's current to false will cause the other camera to be made current. DopplerTracking doppler_tracking = 0 void set_doppler_tracking ( DopplerTracking value ) DopplerTracking get_doppler_tracking ( ) If not DOPPLER_TRACKING_DISABLED, this camera will simulate the Doppler effect for objects changed in particular _process methods. See DopplerTracking for possible values. Environment environment void set_environment ( Environment value ) Environment get_environment ( ) The Environment to use for this camera. float far = 4000.0 void set_far ( float value ) float get_far ( ) The distance to the far culling boundary for this camera relative to its local Z axis. Higher values allow the camera to see further away, while decreasing far can improve performance if it results in objects being partially or fully culled. float fov = 75.0 void set_fov ( float value ) float get_fov ( ) The camera's field of view angle (in degrees). Only applicable in perspective mode. Since keep_aspect locks one axis, fov sets the other axis' field of view angle. For reference, the default vertical field of view value (75.0) is equivalent to a horizontal FOV of: ~91.31 degrees in a 4:3 viewport ~101.67 degrees in a 16:10 viewport ~107.51 degrees in a 16:9 viewport ~121.63 degrees in a 21:9 viewport Vector2 frustum_offset = Vector2(0, 0) void set_frustum_offset ( Vector2 value ) Vector2 get_frustum_offset ( ) The camera's frustum offset. This can be changed from the default to create "tilted frustum" effects such as Y-shearing. Note: Only effective if projection is PROJECTION_FRUSTUM. float h_offset = 0.0 void set_h_offset ( float value ) float get_h_offset ( ) The horizontal (X) offset of the camera viewport. KeepAspect keep_aspect = 1 void set_keep_aspect_mode ( KeepAspect value ) KeepAspect get_keep_aspect_mode ( ) The axis to lock during fov/size adjustments. Can be either KEEP_WIDTH or KEEP_HEIGHT. float near = 0.05 void set_near ( float value ) float get_near ( ) The distance to the near culling boundary for this camera relative to its local Z axis. Lower values allow the camera to see objects more up close to its origin, at the cost of lower precision across the entire range. Values lower than the default can lead to increased Z-fighting. ProjectionType projection = 0 void set_projection ( ProjectionType value ) ProjectionType get_projection ( ) The camera's projection mode. In PROJECTION_PERSPECTIVE mode, objects' Z distance from the camera's local space scales their perceived size. float size = 1.0 void set_size ( float value ) float get_size ( ) The camera's size in meters measured as the diameter of the width or height, depending on keep_aspect. Only applicable in orthogonal and frustum modes. float v_offset = 0.0 void set_v_offset ( float value ) float get_v_offset ( ) The vertical (Y) offset of the camera viewport. Method Descriptions void clear_current ( bool enable_next=true ) If this is the current camera, remove it from being current. If enable_next is true, request to make the next camera current, if any. Projection get_camera_projection ( ) const Returns the projection matrix that this camera uses to render to its associated viewport. The camera must be part of the scene tree to function. RID get_camera_rid ( ) const Returns the camera's RID from the RenderingServer. Transform3D get_camera_transform ( ) const Returns the transform of the camera plus the vertical (v_offset) and horizontal (h_offset) offsets; and any other adjustments made to the position and orientation of the camera by subclassed cameras such as XRCamera3D. bool get_cull_mask_value ( int layer_number ) const Returns whether or not the specified layer of the cull_mask is enabled, given a layer_number between 1 and 20. Plane[] get_frustum ( ) const Returns the camera's frustum planes in world space units as an array of Planes in the following order: near, far, left, top, right, bottom. Not to be confused with frustum_offset. RID get_pyramid_shape_rid ( ) Returns the RID of a pyramid shape encompassing the camera's view frustum, ignoring the camera's near plane. The tip of the pyramid represents the position of the camera. bool is_position_behind ( Vector3 world_point ) const Returns true if the given position is behind the camera (the blue part of the linked diagram). See this diagram for an overview of position query methods. Note: A position which returns false may still be outside the camera's field of view. bool is_position_in_frustum ( Vector3 world_point ) const Returns true if the given position is inside the camera's frustum (the green part of the linked diagram). See this diagram for an overview of position query methods. void make_current ( ) Makes this camera the current camera for the Viewport (see class description). If the camera node is outside the scene tree, it will attempt to become current once it's added. Vector3 project_local_ray_normal ( Vector2 screen_point ) const Returns a normal vector from the screen point location directed along the camera. Orthogonal cameras are normalized. Perspective cameras account for perspective, screen width/height, etc. Vector3 project_position ( Vector2 screen_point, float z_depth ) const Returns the 3D point in world space that maps to the given 2D coordinate in the Viewport rectangle on a plane that is the given z_depth distance into the scene away from the camera. Vector3 project_ray_normal ( Vector2 screen_point ) const Returns a normal vector in world space, that is the result of projecting a point on the Viewport rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking. Vector3 project_ray_origin ( Vector2 screen_point ) const Returns a 3D position in world space, that is the result of projecting a point on the Viewport rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking. void set_cull_mask_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the cull_mask, given a layer_number between 1 and 20. void set_frustum ( float size, Vector2 offset, float z_near, float z_far ) Sets the camera projection to frustum mode (see PROJECTION_FRUSTUM), by specifying a size, an offset, and the z_near and z_far clip planes in world space units. See also frustum_offset. void set_orthogonal ( float size, float z_near, float z_far ) Sets the camera projection to orthogonal mode (see PROJECTION_ORTHOGONAL), by specifying a size, and the z_near and z_far clip planes in world space units. (As a hint, 2D games often use this projection, with values specified in pixels.) void set_perspective ( float fov, float z_near, float z_far ) Sets the camera projection to perspective mode (see PROJECTION_PERSPECTIVE), by specifying a fov (field of view) angle in degrees, and the z_near and z_far clip planes in world space units. Vector2 unproject_position ( Vector3 world_point ) const Returns the 2D coordinate in the Viewport rectangle that maps to the given 3D point in world space. Note: When using this to position GUI elements over a 3D viewport, use is_position_behind to prevent them from appearing if the 3D point is behind the camera: # This code block is part of a script that inherits from Node3D. # `control` is a reference to a node inheriting from Control. control.visible = not get_viewport().get_camera_3d().is_position_behind(global_transform.origin) control.position = get_viewport().get_camera_3d().unproject_position(global_transform.origin) © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_camera3d.html classes/class_animationnodestatemachinetransition ----------------------------------------------------------- AnimationNodeStateMachineTransition Inherits: Resource < RefCounted < Object A transition within an AnimationNodeStateMachine connecting two AnimationRootNodes. Description The path generated when using AnimationNodeStateMachinePlayback.travel is limited to the nodes connected by AnimationNodeStateMachineTransition. You can set the timing and conditions of the transition in detail. Tutorials Using AnimationTree Properties StringName advance_condition &"" String advance_expression "" AdvanceMode advance_mode 1 int priority 1 bool reset true SwitchMode switch_mode 0 Curve xfade_curve float xfade_time 0.0 Signals advance_condition_changed ( ) Emitted when advance_condition is changed. Enumerations enum SwitchMode: SwitchMode SWITCH_MODE_IMMEDIATE = 0 Switch to the next state immediately. The current state will end and blend into the beginning of the new one. SwitchMode SWITCH_MODE_SYNC = 1 Switch to the next state immediately, but will seek the new state to the playback position of the old state. SwitchMode SWITCH_MODE_AT_END = 2 Wait for the current state playback to end, then switch to the beginning of the next state animation. enum AdvanceMode: AdvanceMode ADVANCE_MODE_DISABLED = 0 Don't use this transition. AdvanceMode ADVANCE_MODE_ENABLED = 1 Only use this transition during AnimationNodeStateMachinePlayback.travel. AdvanceMode ADVANCE_MODE_AUTO = 2 Automatically use this transition if the advance_condition and advance_expression checks are true (if assigned). Property Descriptions StringName advance_condition = &"" void set_advance_condition ( StringName value ) StringName get_advance_condition ( ) Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the AnimationTree that can be controlled from code (see Using AnimationTree). For example, if AnimationTree.tree_root is an AnimationNodeStateMachine and advance_condition is set to "idle": GDScript$animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0)) C#GetNode("animation_tree").Set("parameters/conditions/idle", IsOnFloor && (LinearVelocity.X == 0)); String advance_expression = "" void set_advance_expression ( String value ) String get_advance_expression ( ) Use an expression as a condition for state machine transitions. It is possible to create complex animation advance conditions for switching between states and gives much greater flexibility for creating complex state machines by directly interfacing with the script code. AdvanceMode advance_mode = 1 void set_advance_mode ( AdvanceMode value ) AdvanceMode get_advance_mode ( ) Determines whether the transition should disabled, enabled when using AnimationNodeStateMachinePlayback.travel, or traversed automatically if the advance_condition and advance_expression checks are true (if assigned). int priority = 1 void set_priority ( int value ) int get_priority ( ) Lower priority transitions are preferred when travelling through the tree via AnimationNodeStateMachinePlayback.travel or advance_mode is set to ADVANCE_MODE_AUTO. bool reset = true void set_reset ( bool value ) bool is_reset ( ) If true, the destination animation is played back from the beginning when switched. SwitchMode switch_mode = 0 void set_switch_mode ( SwitchMode value ) SwitchMode get_switch_mode ( ) The transition type. Curve xfade_curve void set_xfade_curve ( Curve value ) Curve get_xfade_curve ( ) Ease curve for better control over cross-fade between this state and the next. float xfade_time = 0.0 void set_xfade_time ( float value ) float get_xfade_time ( ) The time to cross-fade between this state and the next. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_animationnodestatemachinetransition.html classes/class_script ----------------------------------------------------------- Script Inherits: Resource < RefCounted < Object Inherited By: CSharpScript, GDScript, ScriptExtension A class stored as a resource. Description A class stored as a resource. A script extends the functionality of all objects that instantiate it. This is the base class for all scripts and should not be used directly. Trying to create a new script with this class will result in an error. The new method of a script subclass creates a new instance. Object.set_script extends an existing object, if that object's class matches one of the script's base classes. Tutorials Scripting documentation index Properties String source_code Methods bool can_instantiate ( ) const Script get_base_script ( ) const StringName get_instance_base_type ( ) const Variant get_property_default_value ( StringName property ) Dictionary get_script_constant_map ( ) Dictionary[] get_script_method_list ( ) Dictionary[] get_script_property_list ( ) Dictionary[] get_script_signal_list ( ) bool has_script_signal ( StringName signal_name ) const bool has_source_code ( ) const bool instance_has ( Object base_object ) const bool is_abstract ( ) const bool is_tool ( ) const Error reload ( bool keep_state=false ) Property Descriptions String source_code void set_source_code ( String value ) String get_source_code ( ) The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically. Method Descriptions bool can_instantiate ( ) const Returns true if the script can be instantiated. Script get_base_script ( ) const Returns the script directly inherited by this script. StringName get_instance_base_type ( ) const Returns the script's base type. Variant get_property_default_value ( StringName property ) Returns the default value of the specified property. Dictionary get_script_constant_map ( ) Returns a dictionary containing constant names and their values. Dictionary[] get_script_method_list ( ) Returns the list of methods in this Script. Dictionary[] get_script_property_list ( ) Returns the list of properties in this Script. Dictionary[] get_script_signal_list ( ) Returns the list of user signals defined in this Script. bool has_script_signal ( StringName signal_name ) const Returns true if the script, or a base class, defines a signal with the given name. bool has_source_code ( ) const Returns true if the script contains non-empty source code. bool instance_has ( Object base_object ) const Returns true if base_object is an instance of this script. bool is_abstract ( ) const Returns true if the script is an abstract script. An abstract script does not have a constructor and cannot be instantiated. bool is_tool ( ) const Returns true if the script is a tool script. A tool script can run in the editor. Error reload ( bool keep_state=false ) Reloads the script's class implementation. Returns an error code. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_script.html classes/class_window ----------------------------------------------------------- Window Inherits: Viewport < Node < Object Inherited By: AcceptDialog, Popup Base class for all windows, dialogs, and popups. Description A node that creates a window. The window can either be a native system window or embedded inside another Window (see Viewport.gui_embed_subwindows). At runtime, Windows will not close automatically when requested. You need to handle it manually using the close_requested signal (this applies both to pressing the close button and clicking outside of a popup). Properties bool always_on_top false bool auto_translate true bool borderless false ContentScaleAspect content_scale_aspect 0 float content_scale_factor 1.0 ContentScaleMode content_scale_mode 0 Vector2i content_scale_size Vector2i(0, 0) ContentScaleStretch content_scale_stretch 0 int current_screen bool exclusive false bool extend_to_title false WindowInitialPosition initial_position 0 bool keep_title_visible false Vector2i max_size Vector2i(0, 0) Vector2i min_size Vector2i(0, 0) Mode mode 0 bool mouse_passthrough false PackedVector2Array mouse_passthrough_polygon PackedVector2Array() bool popup_window false Vector2i position Vector2i(0, 0) Vector2i size Vector2i(100, 100) Theme theme StringName theme_type_variation &"" String title "" bool transient false bool transparent false bool unfocusable false bool unresizable false bool visible true bool wrap_controls false Methods Vector2 _get_contents_minimum_size ( ) virtual const void add_theme_color_override ( StringName name, Color color ) void add_theme_constant_override ( StringName name, int constant ) void add_theme_font_override ( StringName name, Font font ) void add_theme_font_size_override ( StringName name, int font_size ) void add_theme_icon_override ( StringName name, Texture2D texture ) void add_theme_stylebox_override ( StringName name, StyleBox stylebox ) void begin_bulk_theme_override ( ) bool can_draw ( ) const void child_controls_changed ( ) void end_bulk_theme_override ( ) Vector2 get_contents_minimum_size ( ) const bool get_flag ( Flags flag ) const LayoutDirection get_layout_direction ( ) const Vector2i get_position_with_decorations ( ) const Vector2i get_size_with_decorations ( ) const Color get_theme_color ( StringName name, StringName theme_type="" ) const int get_theme_constant ( StringName name, StringName theme_type="" ) const float get_theme_default_base_scale ( ) const Font get_theme_default_font ( ) const int get_theme_default_font_size ( ) const Font get_theme_font ( StringName name, StringName theme_type="" ) const int get_theme_font_size ( StringName name, StringName theme_type="" ) const Texture2D get_theme_icon ( StringName name, StringName theme_type="" ) const StyleBox get_theme_stylebox ( StringName name, StringName theme_type="" ) const int get_window_id ( ) const void grab_focus ( ) bool has_focus ( ) const bool has_theme_color ( StringName name, StringName theme_type="" ) const bool has_theme_color_override ( StringName name ) const bool has_theme_constant ( StringName name, StringName theme_type="" ) const bool has_theme_constant_override ( StringName name ) const bool has_theme_font ( StringName name, StringName theme_type="" ) const bool has_theme_font_override ( StringName name ) const bool has_theme_font_size ( StringName name, StringName theme_type="" ) const bool has_theme_font_size_override ( StringName name ) const bool has_theme_icon ( StringName name, StringName theme_type="" ) const bool has_theme_icon_override ( StringName name ) const bool has_theme_stylebox ( StringName name, StringName theme_type="" ) const bool has_theme_stylebox_override ( StringName name ) const void hide ( ) bool is_embedded ( ) const bool is_layout_rtl ( ) const bool is_maximize_allowed ( ) const bool is_using_font_oversampling ( ) const void move_to_center ( ) void move_to_foreground ( ) void popup ( Rect2i rect=Rect2i(0, 0, 0, 0) ) void popup_centered ( Vector2i minsize=Vector2i(0, 0) ) void popup_centered_clamped ( Vector2i minsize=Vector2i(0, 0), float fallback_ratio=0.75 ) void popup_centered_ratio ( float ratio=0.8 ) void popup_exclusive ( Node from_node, Rect2i rect=Rect2i(0, 0, 0, 0) ) void popup_exclusive_centered ( Node from_node, Vector2i minsize=Vector2i(0, 0) ) void popup_exclusive_centered_clamped ( Node from_node, Vector2i minsize=Vector2i(0, 0), float fallback_ratio=0.75 ) void popup_exclusive_centered_ratio ( Node from_node, float ratio=0.8 ) void popup_exclusive_on_parent ( Node from_node, Rect2i parent_rect ) void popup_on_parent ( Rect2i parent_rect ) void remove_theme_color_override ( StringName name ) void remove_theme_constant_override ( StringName name ) void remove_theme_font_override ( StringName name ) void remove_theme_font_size_override ( StringName name ) void remove_theme_icon_override ( StringName name ) void remove_theme_stylebox_override ( StringName name ) void request_attention ( ) void reset_size ( ) void set_flag ( Flags flag, bool enabled ) void set_ime_active ( bool active ) void set_ime_position ( Vector2i position ) void set_layout_direction ( LayoutDirection direction ) void set_unparent_when_invisible ( bool unparent ) void set_use_font_oversampling ( bool enable ) void show ( ) Theme Properties Color title_color Color(0.875, 0.875, 0.875, 1) Color title_outline_modulate Color(1, 1, 1, 1) int close_h_offset 18 int close_v_offset 24 int resize_margin 4 int title_height 36 int title_outline_size 0 Font title_font int title_font_size Texture2D close Texture2D close_pressed StyleBox embedded_border StyleBox embedded_unfocused_border Signals about_to_popup ( ) Emitted right after popup call, before the Window appears or does anything. close_requested ( ) Emitted when the Window's close button is pressed or when popup_window is enabled and user clicks outside the window. This signal can be used to handle window closing, e.g. by connecting it to hide. dpi_changed ( ) Emitted when the Window's DPI changes as a result of OS-level changes (e.g. moving the window from a Retina display to a lower resolution one). Note: Only implemented on macOS. files_dropped ( PackedStringArray files ) Emitted when files are dragged from the OS file manager and dropped in the game window. The argument is a list of file paths. Note that this method only works with native windows, i.e. the main window and Window-derived nodes when Viewport.gui_embed_subwindows is disabled in the main viewport. Example usage: func _ready(): get_viewport().files_dropped.connect(on_files_dropped) func on_files_dropped(files): print(files) focus_entered ( ) Emitted when the Window gains focus. focus_exited ( ) Emitted when the Window loses its focus. go_back_requested ( ) Emitted when a go back request is sent (e.g. pressing the "Back" button on Android), right after Node.NOTIFICATION_WM_GO_BACK_REQUEST. mouse_entered ( ) Emitted when the mouse cursor enters the Window's visible area, that is not occluded behind other Controls or windows, provided its Viewport.gui_disable_input is false and regardless if it's currently focused or not. mouse_exited ( ) Emitted when the mouse cursor leaves the Window's visible area, that is not occluded behind other Controls or windows, provided its Viewport.gui_disable_input is false and regardless if it's currently focused or not. theme_changed ( ) Emitted when the NOTIFICATION_THEME_CHANGED notification is sent. titlebar_changed ( ) Emitted when window title bar decorations are changed, e.g. macOS window enter/exit full screen mode, or extend-to-title flag is changed. visibility_changed ( ) Emitted when Window is made visible or disappears. window_input ( InputEvent event ) Emitted when the Window is currently focused and receives any input, passing the received event as an argument. The event's position, if present, is in the embedder's coordinate system. Enumerations enum Mode: Mode MODE_WINDOWED = 0 Windowed mode, i.e. Window doesn't occupy the whole screen (unless set to the size of the screen). Mode MODE_MINIMIZED = 1 Minimized window mode, i.e. Window is not visible and available on window manager's window list. Normally happens when the minimize button is pressed. Mode MODE_MAXIMIZED = 2 Maximized window mode, i.e. Window will occupy whole screen area except task bar and still display its borders. Normally happens when the maximize button is pressed. Mode MODE_FULLSCREEN = 3 Full screen mode with full multi-window support. Full screen window covers the entire display area of a screen and has no decorations. The display's video mode is not changed. On Windows: Multi-window full-screen mode has a 1px border of the ProjectSettings.rendering/environment/defaults/default_clear_color color. On macOS: A new desktop is used to display the running project. Note: Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports multiple resolutions when enabling full screen mode. Mode MODE_EXCLUSIVE_FULLSCREEN = 4 A single window full screen mode. This mode has less overhead, but only one window can be open on a given screen at a time (opening a child window or application switching will trigger a full screen transition). Full screen window covers the entire display area of a screen and has no border or decorations. The display's video mode is not changed. On Windows: Depending on video driver, full screen transition might cause screens to go black for a moment. On macOS: A new desktop is used to display the running project. Exclusive full screen mode prevents Dock and Menu from showing up when the mouse pointer is hovering the edge of the screen. On Linux (X11): Exclusive full screen mode bypasses compositor. Note: Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports multiple resolutions when enabling full screen mode. enum Flags: Flags FLAG_RESIZE_DISABLED = 0 The window can't be resized by dragging its resize grip. It's still possible to resize the window using size. This flag is ignored for full screen windows. Set with unresizable. Flags FLAG_BORDERLESS = 1 The window do not have native title bar and other decorations. This flag is ignored for full-screen windows. Set with borderless. Flags FLAG_ALWAYS_ON_TOP = 2 The window is floating on top of all other windows. This flag is ignored for full-screen windows. Set with always_on_top. Flags FLAG_TRANSPARENT = 3 The window background can be transparent. Set with transparent. Note: This flag has no effect if either ProjectSettings.display/window/per_pixel_transparency/allowed, or the window's Viewport.transparent_bg is set to false. Flags FLAG_NO_FOCUS = 4 The window can't be focused. No-focus window will ignore all input, except mouse clicks. Set with unfocusable. Flags FLAG_POPUP = 5 Window is part of menu or OptionButton dropdown. This flag can't be changed when the window is visible. An active popup window will exclusively receive all input, without stealing focus from its parent. Popup windows are automatically closed when uses click outside it, or when an application is switched. Popup window must have transient parent set (see transient). Note: This flag has no effect in embedded windows (unless said window is a Popup). Flags FLAG_EXTEND_TO_TITLE = 6 Window content is expanded to the full size of the window. Unlike borderless window, the frame is left intact and can be used to resize the window, title bar is transparent, but have minimize/maximize/close buttons. Set with extend_to_title. Note: This flag is implemented only on macOS. Note: This flag has no effect in embedded windows. Flags FLAG_MOUSE_PASSTHROUGH = 7 All mouse events are passed to the underlying window of the same application. Note: This flag has no effect in embedded windows. Flags FLAG_MAX = 8 Max value of the Flags. enum ContentScaleMode: ContentScaleMode CONTENT_SCALE_MODE_DISABLED = 0 The content will not be scaled to match the Window's size. ContentScaleMode CONTENT_SCALE_MODE_CANVAS_ITEMS = 1 The content will be rendered at the target size. This is more performance-expensive than CONTENT_SCALE_MODE_VIEWPORT, but provides better results. ContentScaleMode CONTENT_SCALE_MODE_VIEWPORT = 2 The content will be rendered at the base size and then scaled to the target size. More performant than CONTENT_SCALE_MODE_CANVAS_ITEMS, but results in pixelated image. enum ContentScaleAspect: ContentScaleAspect CONTENT_SCALE_ASPECT_IGNORE = 0 The aspect will be ignored. Scaling will simply stretch the content to fit the target size. ContentScaleAspect CONTENT_SCALE_ASPECT_KEEP = 1 The content's aspect will be preserved. If the target size has different aspect from the base one, the image will be centered and black bars will appear on left and right sides. ContentScaleAspect CONTENT_SCALE_ASPECT_KEEP_WIDTH = 2 The content can be expanded vertically. Scaling horizontally will result in keeping the width ratio and then black bars on left and right sides. ContentScaleAspect CONTENT_SCALE_ASPECT_KEEP_HEIGHT = 3 The content can be expanded horizontally. Scaling vertically will result in keeping the height ratio and then black bars on top and bottom sides. ContentScaleAspect CONTENT_SCALE_ASPECT_EXPAND = 4 The content's aspect will be preserved. If the target size has different aspect from the base one, the content will stay in the top-left corner and add an extra visible area in the stretched space. enum ContentScaleStretch: ContentScaleStretch CONTENT_SCALE_STRETCH_FRACTIONAL = 0 The content will be stretched according to a fractional factor. This fills all the space available in the window, but allows "pixel wobble" to occur due to uneven pixel scaling. ContentScaleStretch CONTENT_SCALE_STRETCH_INTEGER = 1 The content will be stretched only according to an integer factor, preserving sharp pixels. This may leave a black background visible on the window's edges depending on the window size. enum LayoutDirection: LayoutDirection LAYOUT_DIRECTION_INHERITED = 0 Automatic layout direction, determined from the parent window layout direction. LayoutDirection LAYOUT_DIRECTION_LOCALE = 1 Automatic layout direction, determined from the current locale. LayoutDirection LAYOUT_DIRECTION_LTR = 2 Left-to-right layout direction. LayoutDirection LAYOUT_DIRECTION_RTL = 3 Right-to-left layout direction. enum WindowInitialPosition: WindowInitialPosition WINDOW_INITIAL_POSITION_ABSOLUTE = 0 Initial window position is determined by position. WindowInitialPosition WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN = 1 Initial window position is the center of the primary screen. WindowInitialPosition WINDOW_INITIAL_POSITION_CENTER_MAIN_WINDOW_SCREEN = 2 Initial window position is the center of the main window screen. WindowInitialPosition WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN = 3 Initial window position is the center of current_screen screen. WindowInitialPosition WINDOW_INITIAL_POSITION_CENTER_SCREEN_WITH_MOUSE_FOCUS = 4 Initial window position is the center of the screen containing the mouse pointer. WindowInitialPosition WINDOW_INITIAL_POSITION_CENTER_SCREEN_WITH_KEYBOARD_FOCUS = 5 Initial window position is the center of the screen containing the window with the keyboard focus. Constants NOTIFICATION_VISIBILITY_CHANGED = 30 Emitted when Window's visibility changes, right before visibility_changed. NOTIFICATION_THEME_CHANGED = 32 Sent when the node needs to refresh its theme items. This happens in one of the following cases: The theme property is changed on this node or any of its ancestors. The theme_type_variation property is changed on this node. The node enters the scene tree. Note: As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree. Property Descriptions bool always_on_top = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, the window will be on top of all other windows. Does not work if transient is enabled. bool auto_translate = true void set_auto_translate ( bool value ) bool is_auto_translating ( ) Toggles if any text should automatically change to its translated version depending on the current locale. bool borderless = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, the window will have no borders. ContentScaleAspect content_scale_aspect = 0 void set_content_scale_aspect ( ContentScaleAspect value ) ContentScaleAspect get_content_scale_aspect ( ) Specifies how the content's aspect behaves when the Window is resized. The base aspect is determined by content_scale_size. float content_scale_factor = 1.0 void set_content_scale_factor ( float value ) float get_content_scale_factor ( ) Specifies the base scale of Window's content when its size is equal to content_scale_size. ContentScaleMode content_scale_mode = 0 void set_content_scale_mode ( ContentScaleMode value ) ContentScaleMode get_content_scale_mode ( ) Specifies how the content is scaled when the Window is resized. Vector2i content_scale_size = Vector2i(0, 0) void set_content_scale_size ( Vector2i value ) Vector2i get_content_scale_size ( ) Base size of the content (i.e. nodes that are drawn inside the window). If non-zero, Window's content will be scaled when the window is resized to a different size. ContentScaleStretch content_scale_stretch = 0 void set_content_scale_stretch ( ContentScaleStretch value ) ContentScaleStretch get_content_scale_stretch ( ) The policy to use to determine the final scale factor for 2D elements. This affects how content_scale_factor is applied, in addition to the automatic scale factor determined by content_scale_size. int current_screen void set_current_screen ( int value ) int get_current_screen ( ) The screen the window is currently on. bool exclusive = false void set_exclusive ( bool value ) bool is_exclusive ( ) If true, the Window will be in exclusive mode. Exclusive windows are always on top of their parent and will block all input going to the parent Window. Needs transient enabled to work. bool extend_to_title = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, the Window contents is expanded to the full size of the window, window title bar is transparent. Note: This property is implemented only on macOS. Note: This property only works with native windows. WindowInitialPosition initial_position = 0 void set_initial_position ( WindowInitialPosition value ) WindowInitialPosition get_initial_position ( ) Specifies the initial type of position for the Window. See WindowInitialPosition constants. bool keep_title_visible = false void set_keep_title_visible ( bool value ) bool get_keep_title_visible ( ) If true, the Window width is expanded to keep the title bar text fully visible. Vector2i max_size = Vector2i(0, 0) void set_max_size ( Vector2i value ) Vector2i get_max_size ( ) If non-zero, the Window can't be resized to be bigger than this size. Note: This property will be ignored if the value is lower than min_size. Vector2i min_size = Vector2i(0, 0) void set_min_size ( Vector2i value ) Vector2i get_min_size ( ) If non-zero, the Window can't be resized to be smaller than this size. Note: This property will be ignored in favor of get_contents_minimum_size if wrap_controls is enabled and if its size is bigger. Mode mode = 0 void set_mode ( Mode value ) Mode get_mode ( ) Set's the window's current mode. Note: Fullscreen mode is not exclusive full screen on Windows and Linux. Note: This method only works with native windows, i.e. the main window and Window-derived nodes when Viewport.gui_embed_subwindows is disabled in the main viewport. bool mouse_passthrough = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, all mouse events will be passed to the underlying window of the same application. See also mouse_passthrough_polygon. Note: This property is implemented on Linux (X11), macOS and Windows. Note: This property only works with native windows. PackedVector2Array mouse_passthrough_polygon = PackedVector2Array() void set_mouse_passthrough_polygon ( PackedVector2Array value ) PackedVector2Array get_mouse_passthrough_polygon ( ) Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through. Passing an empty array will disable passthrough support (all mouse events will be intercepted by the window, which is the default behavior). GDScript# Set region, using Path2D node. $Window.mouse_passthrough_polygon = $Path2D.curve.get_baked_points() # Set region, using Polygon2D node. $Window.mouse_passthrough_polygon = $Polygon2D.polygon # Reset region to default. $Window.mouse_passthrough_polygon = [] C#// Set region, using Path2D node. GetNode("Window").MousePassthrough = GetNode("Path2D").Curve.GetBakedPoints(); // Set region, using Polygon2D node. GetNode("Window").MousePassthrough = GetNode("Polygon2D").Polygon; // Reset region to default. GetNode("Window").MousePassthrough = new Vector2[] {}; Note: This property is ignored if mouse_passthrough is set to true. Note: On Windows, the portion of a window that lies outside the region is not drawn, while on Linux (X11) and macOS it is. Note: This property is implemented on Linux (X11), macOS and Windows. bool popup_window = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, the Window will be considered a popup. Popups are sub-windows that don't show as separate windows in system's window manager's window list and will send close request when anything is clicked outside of them (unless exclusive is enabled). Vector2i position = Vector2i(0, 0) void set_position ( Vector2i value ) Vector2i get_position ( ) The window's position in pixels. If ProjectSettings.display/window/subwindows/embed_subwindows is false, the position is in absolute screen coordinates. This typically applies to editor plugins. If the setting is true, the window's position is in the coordinates of its parent Viewport. Note: This property only works if initial_position is set to WINDOW_INITIAL_POSITION_ABSOLUTE. Vector2i size = Vector2i(100, 100) void set_size ( Vector2i value ) Vector2i get_size ( ) The window's size in pixels. Theme theme void set_theme ( Theme value ) Theme get_theme ( ) The Theme resource this node and all its Control and Window children use. If a child node has its own Theme resource set, theme items are merged with child's definitions having higher priority. Note: Window styles will have no effect unless the window is embedded. StringName theme_type_variation = &"" void set_theme_type_variation ( StringName value ) StringName get_theme_type_variation ( ) The name of a theme type variation used by this Window to look up its own theme items. See Control.theme_type_variation for more details. String title = "" void set_title ( String value ) String get_title ( ) The window's title. If the Window is native, title styles set in Theme will have no effect. bool transient = false void set_transient ( bool value ) bool is_transient ( ) If true, the Window is transient, i.e. it's considered a child of another Window. The transient window will be destroyed with its transient parent and will return focus to their parent when closed. The transient window is displayed on top of a non-exclusive full-screen parent window. Transient windows can't enter full-screen mode. Note that behavior might be different depending on the platform. bool transparent = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, the Window's background can be transparent. This is best used with embedded windows. Note: Transparency support is implemented on Linux, macOS and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities. Note: This property has no effect if either ProjectSettings.display/window/per_pixel_transparency/allowed, or the window's Viewport.transparent_bg is set to false. bool unfocusable = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, the Window can't be focused nor interacted with. It can still be visible. bool unresizable = false void set_flag ( Flags flag, bool enabled ) bool get_flag ( Flags flag ) const If true, the window can't be resized. Minimize and maximize buttons are disabled. bool visible = true void set_visible ( bool value ) bool is_visible ( ) If true, the window is visible. bool wrap_controls = false void set_wrap_controls ( bool value ) bool is_wrapping_controls ( ) If true, the window's size will automatically update when a child node is added or removed, ignoring min_size if the new size is bigger. If false, you need to call child_controls_changed manually. Method Descriptions Vector2 _get_contents_minimum_size ( ) virtual const Virtual method to be implemented by the user. Overrides the value returned by get_contents_minimum_size. void add_theme_color_override ( StringName name, Color color ) Creates a local override for a theme Color with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_color_override. See also get_theme_color and Control.add_theme_color_override for more details. void add_theme_constant_override ( StringName name, int constant ) Creates a local override for a theme constant with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_constant_override. See also get_theme_constant. void add_theme_font_override ( StringName name, Font font ) Creates a local override for a theme Font with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_font_override. See also get_theme_font. void add_theme_font_size_override ( StringName name, int font_size ) Creates a local override for a theme font size with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_font_size_override. See also get_theme_font_size. void add_theme_icon_override ( StringName name, Texture2D texture ) Creates a local override for a theme icon with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_icon_override. See also get_theme_icon. void add_theme_stylebox_override ( StringName name, StyleBox stylebox ) Creates a local override for a theme StyleBox with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with remove_theme_stylebox_override. See also get_theme_stylebox and Control.add_theme_stylebox_override for more details. void begin_bulk_theme_override ( ) Prevents *_theme_*_override methods from emitting NOTIFICATION_THEME_CHANGED until end_bulk_theme_override is called. bool can_draw ( ) const Returns whether the window is being drawn to the screen. void child_controls_changed ( ) Requests an update of the Window size to fit underlying Control nodes. void end_bulk_theme_override ( ) Ends a bulk theme override update. See begin_bulk_theme_override. Vector2 get_contents_minimum_size ( ) const Returns the combined minimum size from the child Control nodes of the window. Use child_controls_changed to update it when child nodes have changed. The value returned by this method can be overridden with _get_contents_minimum_size. bool get_flag ( Flags flag ) const Returns true if the flag is set. LayoutDirection get_layout_direction ( ) const Returns layout direction and text writing direction. Vector2i get_position_with_decorations ( ) const Returns the window's position including its border. Vector2i get_size_with_decorations ( ) const Returns the window's size including its border. Color get_theme_color ( StringName name, StringName theme_type="" ) const Returns a Color from the first matching Theme in the tree if that Theme has a color item with the specified name and theme_type. See Control.get_theme_color for more details. int get_theme_constant ( StringName name, StringName theme_type="" ) const Returns a constant from the first matching Theme in the tree if that Theme has a constant item with the specified name and theme_type. See Control.get_theme_color for more details. float get_theme_default_base_scale ( ) const Returns the default base scale value from the first matching Theme in the tree if that Theme has a valid Theme.default_base_scale value. See Control.get_theme_color for details. Font get_theme_default_font ( ) const Returns the default font from the first matching Theme in the tree if that Theme has a valid Theme.default_font value. See Control.get_theme_color for details. int get_theme_default_font_size ( ) const Returns the default font size value from the first matching Theme in the tree if that Theme has a valid Theme.default_font_size value. See Control.get_theme_color for details. Font get_theme_font ( StringName name, StringName theme_type="" ) const Returns a Font from the first matching Theme in the tree if that Theme has a font item with the specified name and theme_type. See Control.get_theme_color for details. int get_theme_font_size ( StringName name, StringName theme_type="" ) const Returns a font size from the first matching Theme in the tree if that Theme has a font size item with the specified name and theme_type. See Control.get_theme_color for details. Texture2D get_theme_icon ( StringName name, StringName theme_type="" ) const Returns an icon from the first matching Theme in the tree if that Theme has an icon item with the specified name and theme_type. See Control.get_theme_color for details. StyleBox get_theme_stylebox ( StringName name, StringName theme_type="" ) const Returns a StyleBox from the first matching Theme in the tree if that Theme has a stylebox item with the specified name and theme_type. See Control.get_theme_color for details. int get_window_id ( ) const Returns the ID of the window. void grab_focus ( ) Causes the window to grab focus, allowing it to receive user input. bool has_focus ( ) const Returns true if the window is focused. bool has_theme_color ( StringName name, StringName theme_type="" ) const Returns true if there is a matching Theme in the tree that has a color item with the specified name and theme_type. See Control.get_theme_color for details. bool has_theme_color_override ( StringName name ) const Returns true if there is a local override for a theme Color with the specified name in this Control node. See add_theme_color_override. bool has_theme_constant ( StringName name, StringName theme_type="" ) const Returns true if there is a matching Theme in the tree that has a constant item with the specified name and theme_type. See Control.get_theme_color for details. bool has_theme_constant_override ( StringName name ) const Returns true if there is a local override for a theme constant with the specified name in this Control node. See add_theme_constant_override. bool has_theme_font ( StringName name, StringName theme_type="" ) const Returns true if there is a matching Theme in the tree that has a font item with the specified name and theme_type. See Control.get_theme_color for details. bool has_theme_font_override ( StringName name ) const Returns true if there is a local override for a theme Font with the specified name in this Control node. See add_theme_font_override. bool has_theme_font_size ( StringName name, StringName theme_type="" ) const Returns true if there is a matching Theme in the tree that has a font size item with the specified name and theme_type. See Control.get_theme_color for details. bool has_theme_font_size_override ( StringName name ) const Returns true if there is a local override for a theme font size with the specified name in this Control node. See add_theme_font_size_override. bool has_theme_icon ( StringName name, StringName theme_type="" ) const Returns true if there is a matching Theme in the tree that has an icon item with the specified name and theme_type. See Control.get_theme_color for details. bool has_theme_icon_override ( StringName name ) const Returns true if there is a local override for a theme icon with the specified name in this Control node. See add_theme_icon_override. bool has_theme_stylebox ( StringName name, StringName theme_type="" ) const Returns true if there is a matching Theme in the tree that has a stylebox item with the specified name and theme_type. See Control.get_theme_color for details. bool has_theme_stylebox_override ( StringName name ) const Returns true if there is a local override for a theme StyleBox with the specified name in this Control node. See add_theme_stylebox_override. void hide ( ) Hides the window. This is not the same as minimized state. Hidden window can't be interacted with and needs to be made visible with show. bool is_embedded ( ) const Returns true if the window is currently embedded in another window. bool is_layout_rtl ( ) const Returns true if layout is right-to-left. bool is_maximize_allowed ( ) const Returns true if the window can be maximized (the maximize button is enabled). bool is_using_font_oversampling ( ) const Returns true if font oversampling is enabled. See set_use_font_oversampling. void move_to_center ( ) Centers a native window on the current screen and an embedded window on its embedder Viewport. void move_to_foreground ( ) Moves the Window on top of other windows and focuses it. void popup ( Rect2i rect=Rect2i(0, 0, 0, 0) ) Shows the Window and makes it transient (see transient). If rect is provided, it will be set as the Window's size. Fails if called on the main window. void popup_centered ( Vector2i minsize=Vector2i(0, 0) ) Popups the Window at the center of the current screen, with optionally given minimum size. If the Window is embedded, it will be centered in the parent Viewport instead. Note: Calling it with the default value of minsize is equivalent to calling it with size. void popup_centered_clamped ( Vector2i minsize=Vector2i(0, 0), float fallback_ratio=0.75 ) Popups the Window centered inside its parent Window. fallback_ratio determines the maximum size of the Window, in relation to its parent. Note: Calling it with the default value of minsize is equivalent to calling it with size. void popup_centered_ratio ( float ratio=0.8 ) If Window is embedded, popups the Window centered inside its embedder and sets its size as a ratio of embedder's size. If Window is a native window, popups the Window centered inside the screen of its parent Window and sets its size as a ratio of the screen size. void popup_exclusive ( Node from_node, Rect2i rect=Rect2i(0, 0, 0, 0) ) Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls popup on it. The dialog must have no current parent, otherwise the method fails. See also set_unparent_when_invisible and Node.get_last_exclusive_window. void popup_exclusive_centered ( Node from_node, Vector2i minsize=Vector2i(0, 0) ) Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls popup_centered on it. The dialog must have no current parent, otherwise the method fails. See also set_unparent_when_invisible and Node.get_last_exclusive_window. void popup_exclusive_centered_clamped ( Node from_node, Vector2i minsize=Vector2i(0, 0), float fallback_ratio=0.75 ) Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls popup_centered_clamped on it. The dialog must have no current parent, otherwise the method fails. See also set_unparent_when_invisible and Node.get_last_exclusive_window. void popup_exclusive_centered_ratio ( Node from_node, float ratio=0.8 ) Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls popup_centered_ratio on it. The dialog must have no current parent, otherwise the method fails. See also set_unparent_when_invisible and Node.get_last_exclusive_window. void popup_exclusive_on_parent ( Node from_node, Rect2i parent_rect ) Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls popup_on_parent on it. The dialog must have no current parent, otherwise the method fails. See also set_unparent_when_invisible and Node.get_last_exclusive_window. void popup_on_parent ( Rect2i parent_rect ) Popups the Window with a position shifted by parent Window's position. If the Window is embedded, has the same effect as popup. void remove_theme_color_override ( StringName name ) Removes a local override for a theme Color with the specified name previously added by add_theme_color_override or via the Inspector dock. void remove_theme_constant_override ( StringName name ) Removes a local override for a theme constant with the specified name previously added by add_theme_constant_override or via the Inspector dock. void remove_theme_font_override ( StringName name ) Removes a local override for a theme Font with the specified name previously added by add_theme_font_override or via the Inspector dock. void remove_theme_font_size_override ( StringName name ) Removes a local override for a theme font size with the specified name previously added by add_theme_font_size_override or via the Inspector dock. void remove_theme_icon_override ( StringName name ) Removes a local override for a theme icon with the specified name previously added by add_theme_icon_override or via the Inspector dock. void remove_theme_stylebox_override ( StringName name ) Removes a local override for a theme StyleBox with the specified name previously added by add_theme_stylebox_override or via the Inspector dock. void request_attention ( ) Tells the OS that the Window needs an attention. This makes the window stand out in some way depending on the system, e.g. it might blink on the task bar. void reset_size ( ) Resets the size to the minimum size, which is the max of min_size and (if wrap_controls is enabled) get_contents_minimum_size. This is equivalent to calling set_size(Vector2i()) (or any size below the minimum). void set_flag ( Flags flag, bool enabled ) Sets a specified window flag. void set_ime_active ( bool active ) If active is true, enables system's native IME (Input Method Editor). void set_ime_position ( Vector2i position ) Moves IME to the given position. void set_layout_direction ( LayoutDirection direction ) Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). void set_unparent_when_invisible ( bool unparent ) If unparent is true, the window is automatically unparented when going invisible. Note: Make sure to keep a reference to the node, otherwise it will be orphaned. You also need to manually call Node.queue_free to free the window if it's not parented. void set_use_font_oversampling ( bool enable ) Enables font oversampling. This makes fonts look better when they are scaled up. void show ( ) Makes the Window appear. This enables interactions with the Window and doesn't change any of its property other than visibility (unlike e.g. popup). Theme Property Descriptions Color title_color = Color(0.875, 0.875, 0.875, 1) The color of the title's text. Color title_outline_modulate = Color(1, 1, 1, 1) The color of the title's text outline. int close_h_offset = 18 Horizontal position offset of the close button. int close_v_offset = 24 Vertical position offset of the close button. int resize_margin = 4 Defines the outside margin at which the window border can be grabbed with mouse and resized. int title_height = 36 Height of the title bar. int title_outline_size = 0 The size of the title outline. Font title_font The font used to draw the title. int title_font_size The size of the title font. Texture2D close The icon for the close button. Texture2D close_pressed The icon for the close button when it's being pressed. StyleBox embedded_border The background style used when the Window is embedded. Note that this is drawn only under the window's content, excluding the title. For proper borders and title bar style, you can use expand_margin_* properties of StyleBoxFlat. Note: The content background will not be visible unless transparent is enabled. StyleBox embedded_unfocused_border The background style used when the Window is embedded and unfocused. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_window.html classes/class_reflectionprobe ----------------------------------------------------------- ReflectionProbe Inherits: VisualInstance3D < Node3D < Node < Object Captures its surroundings to create fast, accurate reflections from a given point. Description Captures its surroundings as a cubemap, and stores versions of it with increasing levels of blur to simulate different material roughnesses. The ReflectionProbe is used to create high-quality reflections at a low performance cost (when update_mode is UPDATE_ONCE). ReflectionProbes can be blended together and with the rest of the scene smoothly. ReflectionProbes can also be combined with VoxelGI, SDFGI (Environment.sdfgi_enabled) and screen-space reflections (Environment.ssr_enabled) to get more accurate reflections in specific areas. ReflectionProbes render all objects within their cull_mask, so updating them can be quite expensive. It is best to update them once with the important static objects and then leave them as-is. Note: Unlike VoxelGI and SDFGI, ReflectionProbes only source their environment from a WorldEnvironment node. If you specify an Environment resource within a Camera3D node, it will be ignored by the ReflectionProbe. This can lead to incorrect lighting within the ReflectionProbe. Note: Reflection probes are only supported in the Forward+ and Mobile rendering methods, not Compatibility. When using the Mobile rendering method, only 8 reflection probes can be displayed on each mesh resource. Attempting to display more than 8 reflection probes on a single mesh resource will result in reflection probes flickering in and out as the camera moves. Note: When using the Mobile rendering method, reflection probes will only correctly affect meshes whose visibility AABB intersects with the reflection probe's AABB. If using a shader to deform the mesh in a way that makes it go outside its AABB, GeometryInstance3D.extra_cull_margin must be increased on the mesh. Otherwise, the reflection probe may not be visible on the mesh. Tutorials Reflection probes Properties Color ambient_color Color(0, 0, 0, 1) float ambient_color_energy 1.0 AmbientMode ambient_mode 1 bool box_projection false int cull_mask 1048575 bool enable_shadows false float intensity 1.0 bool interior false float max_distance 0.0 float mesh_lod_threshold 1.0 Vector3 origin_offset Vector3(0, 0, 0) Vector3 size Vector3(20, 20, 20) UpdateMode update_mode 0 Enumerations enum UpdateMode: UpdateMode UPDATE_ONCE = 0 Update the probe once on the next frame (recommended for most objects). The corresponding radiance map will be generated over the following six frames. This takes more time to update than UPDATE_ALWAYS, but it has a lower performance cost and can result in higher-quality reflections. The ReflectionProbe is updated when its transform changes, but not when nearby geometry changes. You can force a ReflectionProbe update by moving the ReflectionProbe slightly in any direction. UpdateMode UPDATE_ALWAYS = 1 Update the probe every frame. This provides better results for fast-moving dynamic objects (such as cars). However, it has a significant performance cost. Due to the cost, it's recommended to only use one ReflectionProbe with UPDATE_ALWAYS at most per scene. For all other use cases, use UPDATE_ONCE. enum AmbientMode: AmbientMode AMBIENT_DISABLED = 0 Do not apply any ambient lighting inside the ReflectionProbe's box defined by its size. AmbientMode AMBIENT_ENVIRONMENT = 1 Apply automatically-sourced environment lighting inside the ReflectionProbe's box defined by its size. AmbientMode AMBIENT_COLOR = 2 Apply custom ambient lighting inside the ReflectionProbe's box defined by its size. See ambient_color and ambient_color_energy. Property Descriptions Color ambient_color = Color(0, 0, 0, 1) void set_ambient_color ( Color value ) Color get_ambient_color ( ) The custom ambient color to use within the ReflectionProbe's box defined by its size. Only effective if ambient_mode is AMBIENT_COLOR. float ambient_color_energy = 1.0 void set_ambient_color_energy ( float value ) float get_ambient_color_energy ( ) The custom ambient color energy to use within the ReflectionProbe's box defined by its size. Only effective if ambient_mode is AMBIENT_COLOR. AmbientMode ambient_mode = 1 void set_ambient_mode ( AmbientMode value ) AmbientMode get_ambient_mode ( ) The ambient color to use within the ReflectionProbe's box defined by its size. The ambient color will smoothly blend with other ReflectionProbes and the rest of the scene (outside the ReflectionProbe's box defined by its size). bool box_projection = false void set_enable_box_projection ( bool value ) bool is_box_projection_enabled ( ) If true, enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location. Note: To better fit rectangle-shaped rooms that are not aligned to the grid, you can rotate the ReflectionProbe node. int cull_mask = 1048575 void set_cull_mask ( int value ) int get_cull_mask ( ) Sets the cull mask which determines what objects are drawn by this probe. Every VisualInstance3D with a layer included in this cull mask will be rendered by the probe. To improve performance, it is best to only include large objects which are likely to take up a lot of space in the reflection. bool enable_shadows = false void set_enable_shadows ( bool value ) bool are_shadows_enabled ( ) If true, computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the UPDATE_ALWAYS update_mode. float intensity = 1.0 void set_intensity ( float value ) float get_intensity ( ) Defines the reflection intensity. Intensity modulates the strength of the reflection. bool interior = false void set_as_interior ( bool value ) bool is_set_as_interior ( ) If true, reflections will ignore sky contribution. float max_distance = 0.0 void set_max_distance ( float value ) float get_max_distance ( ) The maximum distance away from the ReflectionProbe an object can be before it is culled. Decrease this to improve performance, especially when using the UPDATE_ALWAYS update_mode. Note: The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing max_distance will not always cull objects from reflections, especially if the reflection probe's box defined by its size is already large. float mesh_lod_threshold = 1.0 void set_mesh_lod_threshold ( float value ) float get_mesh_lod_threshold ( ) The automatic LOD bias to use for meshes rendered within the ReflectionProbe (this is analog to Viewport.mesh_lod_threshold). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to 0.0, automatic LOD is disabled. Increase mesh_lod_threshold to improve performance at the cost of geometry detail, especially when using the UPDATE_ALWAYS update_mode. Note: mesh_lod_threshold does not affect GeometryInstance3D visibility ranges (also known as "manual" LOD or hierarchical LOD). Vector3 origin_offset = Vector3(0, 0, 0) void set_origin_offset ( Vector3 value ) Vector3 get_origin_offset ( ) Sets the origin offset to be used when this ReflectionProbe is in box_projection mode. This can be set to a non-zero value to ensure a reflection fits a rectangle-shaped room, while reducing the number of objects that "get in the way" of the reflection. Vector3 size = Vector3(20, 20, 20) void set_size ( Vector3 value ) Vector3 get_size ( ) The size of the reflection probe. The larger the size, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the size only as large as you need it. Note: To better fit areas that are not aligned to the grid, you can rotate the ReflectionProbe node. UpdateMode update_mode = 0 void set_update_mode ( UpdateMode value ) UpdateMode get_update_mode ( ) Sets how frequently the ReflectionProbe is updated. Can be UPDATE_ONCE or UPDATE_ALWAYS. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_reflectionprobe.html classes/class_json ----------------------------------------------------------- JSON Inherits: Resource < RefCounted < Object Helper class for creating and parsing JSON data. Description The JSON enables all data types to be converted to and from a JSON string. This useful for serializing data to save to a file or send over the network. stringify is used to convert any data type into a JSON string. parse is used to convert any existing JSON data into a Variant that can be used within Godot. If successfully parsed, use data to retrieve the Variant, and use typeof to check if the Variant's type is what you expect. JSON Objects are converted into a Dictionary, but JSON data can be used to store Arrays, numbers, Strings and even just a boolean. Example var data_to_send = ["a", "b", "c"] var json_string = JSON.stringify(data_to_send) # Save data # ... # Retrieve data var json = JSON.new() var error = json.parse(json_string) if error == OK: var data_received = json.data if typeof(data_received) == TYPE_ARRAY: print(data_received) # Prints array else: print("Unexpected data") else: print("JSON Parse Error: ", json.get_error_message(), " in ", json_string, " at line ", json.get_error_line()) Alternatively, you can parse string using the static parse_string method, but it doesn't allow to handle errors. var data = JSON.parse_string(json_string) # Returns null if parsing failed. Note: Both parse methods do not fully comply with the JSON specification: Trailing commas in arrays or objects are ignored, instead of causing a parser error. New line and tab characters are accepted in string literals, and are treated like their corresponding escape sequences and \t. Numbers are parsed using String.to_float which is generally more lax than the JSON specification. Certain errors, such as invalid Unicode sequences, do not cause a parser error. Instead, the string is cleansed and an error is logged to the console. Properties Variant data null Methods int get_error_line ( ) const String get_error_message ( ) const String get_parsed_text ( ) const Error parse ( String json_text, bool keep_text=false ) Variant parse_string ( String json_string ) static String stringify ( Variant data, String indent="", bool sort_keys=true, bool full_precision=false ) static Property Descriptions Variant data = null void set_data ( Variant value ) Variant get_data ( ) Contains the parsed JSON data in Variant form. Method Descriptions int get_error_line ( ) const Returns 0 if the last call to parse was successful, or the line number where the parse failed. String get_error_message ( ) const Returns an empty string if the last call to parse was successful, or the error message if it failed. String get_parsed_text ( ) const Return the text parsed by parse as long as the function is instructed to keep it. Error parse ( String json_text, bool keep_text=false ) Attempts to parse the json_text provided. Returns an Error. If the parse was successful, it returns @GlobalScope.OK and the result can be retrieved using data. If unsuccessful, use get_error_line and get_error_message for identifying the source of the failure. Non-static variant of parse_string, if you want custom error handling. The optional keep_text argument instructs the parser to keep a copy of the original text. This text can be obtained later by using the get_parsed_text function and is used when saving the resource (instead of generating new text from data). Variant parse_string ( String json_string ) static Attempts to parse the json_string provided and returns the parsed data. Returns null if parse failed. String stringify ( Variant data, String indent="", bool sort_keys=true, bool full_precision=false ) static Converts a Variant var to JSON text and returns the result. Useful for serializing data to store or send over the network. Note: The JSON specification does not define integer or float types, but only a number type. Therefore, converting a Variant to JSON text will convert all numerical values to float types. Note: If full_precision is true, when stringifying floats, the unreliable digits are stringified in addition to the reliable digits to guarantee exact decoding. The indent parameter controls if and how something is indented, the string used for this parameter will be used where there should be an indent in the output, even spaces like "  " will work. \t and can also be used for a tab indent, or to make a newline for each indent respectively. Example output: ## JSON.stringify(my_dictionary) {"name":"my_dictionary","version":"1.0.0","entities":[{"name":"entity_0","value":"value_0"},{"name":"entity_1","value":"value_1"}]} ## JSON.stringify(my_dictionary, "\t") { "name": "my_dictionary", "version": "1.0.0", "entities": [ { "name": "entity_0", "value": "value_0" }, { "name": "entity_1", "value": "value_1" } ] } ## JSON.stringify(my_dictionary, "...") { ..."name": "my_dictionary", ..."version": "1.0.0", ..."entities": [ ......{ ........."name": "entity_0", ........."value": "value_0" ......}, ......{ ........."name": "entity_1", ........."value": "value_1" ......} ...] } © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_json.html classes/class_gpuparticles3d ----------------------------------------------------------- GPUParticles3D Inherits: GeometryInstance3D < VisualInstance3D < Node3D < Node < Object A 3D particle emitter. Description 3D particle node used to create a variety of particle systems and effects. GPUParticles3D features an emitter that generates some number of particles at a given rate. Use process_material to add a ParticleProcessMaterial to configure particle appearance and behavior. Alternatively, you can add a ShaderMaterial which will be applied to all particles. Tutorials Particle systems (3D) Controlling thousands of fish with Particles Third Person Shooter Demo Properties int amount 8 float amount_ratio 1.0 float collision_base_size 0.01 DrawOrder draw_order 0 Mesh draw_pass_1 Mesh draw_pass_2 Mesh draw_pass_3 Mesh draw_pass_4 int draw_passes 1 Skin draw_skin bool emitting true float explosiveness 0.0 int fixed_fps 30 bool fract_delta true float interp_to_end 0.0 bool interpolate true float lifetime 1.0 bool local_coords false bool one_shot false float preprocess 0.0 Material process_material float randomness 0.0 float speed_scale 1.0 NodePath sub_emitter NodePath("") bool trail_enabled false float trail_lifetime 0.3 TransformAlign transform_align 0 AABB visibility_aabb AABB(-4, -4, -4, 8, 8, 8) Methods AABB capture_aabb ( ) const void convert_from_particles ( Node particles ) void emit_particle ( Transform3D xform, Vector3 velocity, Color color, Color custom, int flags ) Mesh get_draw_pass_mesh ( int pass ) const void restart ( ) void set_draw_pass_mesh ( int pass, Mesh mesh ) Signals finished ( ) Emitted when all active particles have finished processing. When one_shot is disabled, particles will process continuously, so this is never emitted. Note: Due to the particles being computed on the GPU there might be a delay before the signal gets emitted. Enumerations enum DrawOrder: DrawOrder DRAW_ORDER_INDEX = 0 Particles are drawn in the order emitted. DrawOrder DRAW_ORDER_LIFETIME = 1 Particles are drawn in order of remaining lifetime. In other words, the particle with the highest lifetime is drawn at the front. DrawOrder DRAW_ORDER_REVERSE_LIFETIME = 2 Particles are drawn in reverse order of remaining lifetime. In other words, the particle with the lowest lifetime is drawn at the front. DrawOrder DRAW_ORDER_VIEW_DEPTH = 3 Particles are drawn in order of depth. enum EmitFlags: EmitFlags EMIT_FLAG_POSITION = 1 Particle starts at the specified position. EmitFlags EMIT_FLAG_ROTATION_SCALE = 2 Particle starts with specified rotation and scale. EmitFlags EMIT_FLAG_VELOCITY = 4 Particle starts with the specified velocity vector, which defines the emission direction and speed. EmitFlags EMIT_FLAG_COLOR = 8 Particle starts with specified color. EmitFlags EMIT_FLAG_CUSTOM = 16 Particle starts with specified CUSTOM data. enum TransformAlign: TransformAlign TRANSFORM_ALIGN_DISABLED = 0 TransformAlign TRANSFORM_ALIGN_Z_BILLBOARD = 1 TransformAlign TRANSFORM_ALIGN_Y_TO_VELOCITY = 2 TransformAlign TRANSFORM_ALIGN_Z_BILLBOARD_Y_TO_VELOCITY = 3 Constants MAX_DRAW_PASSES = 4 Maximum number of draw passes supported. Property Descriptions int amount = 8 void set_amount ( int value ) int get_amount ( ) The number of particles to emit in one emission cycle. The effective emission rate is (amount * amount_ratio) / lifetime particles per second. Higher values will increase GPU requirements, even if not all particles are visible at a given time or if amount_ratio is decreased. Note: Changing this value will cause the particle system to restart. To avoid this, change amount_ratio instead. float amount_ratio = 1.0 void set_amount_ratio ( float value ) float get_amount_ratio ( ) The ratio of particles that should actually be emitted. If set to a value lower than 1.0, this will set the amount of emitted particles throughout the lifetime to amount * amount_ratio. Unlike changing amount, changing amount_ratio while emitting does not affect already-emitted particles and doesn't cause the particle system to restart. amount_ratio can be used to create effects that make the number of emitted particles vary over time. Note: Reducing the amount_ratio has no performance benefit, since resources need to be allocated and processed for the total amount of particles regardless of the amount_ratio. If you don't intend to change the number of particles emitted while the particles are emitting, make sure amount_ratio is set to 1 and change amount to your liking instead. float collision_base_size = 0.01 void set_collision_base_size ( float value ) float get_collision_base_size ( ) The base diameter for particle collision in meters. If particles appear to sink into the ground when colliding, increase this value. If particles appear to float when colliding, decrease this value. Only effective if ParticleProcessMaterial.collision_mode is ParticleProcessMaterial.COLLISION_RIGID or ParticleProcessMaterial.COLLISION_HIDE_ON_CONTACT. Note: Particles always have a spherical collision shape. DrawOrder draw_order = 0 void set_draw_order ( DrawOrder value ) DrawOrder get_draw_order ( ) Particle draw order. Uses DrawOrder values. Note: DRAW_ORDER_INDEX is the only option that supports motion vectors for effects like TAA. It is suggested to use this draw order if the particles are opaque to fix ghosting artifacts. Mesh draw_pass_1 void set_draw_pass_mesh ( int pass, Mesh mesh ) Mesh get_draw_pass_mesh ( int pass ) const Mesh that is drawn for the first draw pass. Mesh draw_pass_2 void set_draw_pass_mesh ( int pass, Mesh mesh ) Mesh get_draw_pass_mesh ( int pass ) const Mesh that is drawn for the second draw pass. Mesh draw_pass_3 void set_draw_pass_mesh ( int pass, Mesh mesh ) Mesh get_draw_pass_mesh ( int pass ) const Mesh that is drawn for the third draw pass. Mesh draw_pass_4 void set_draw_pass_mesh ( int pass, Mesh mesh ) Mesh get_draw_pass_mesh ( int pass ) const Mesh that is drawn for the fourth draw pass. int draw_passes = 1 void set_draw_passes ( int value ) int get_draw_passes ( ) The number of draw passes when rendering particles. Skin draw_skin void set_skin ( Skin value ) Skin get_skin ( ) There is currently no description for this property. Please help us by contributing one! bool emitting = true void set_emitting ( bool value ) bool is_emitting ( ) If true, particles are being emitted. emitting can be used to start and stop particles from emitting. However, if one_shot is true setting emitting to true will not restart the emission cycle until after all active particles finish processing. You can use the finished signal to be notified once all active particles finish processing. float explosiveness = 0.0 void set_explosiveness_ratio ( float value ) float get_explosiveness_ratio ( ) Time ratio between each emission. If 0, particles are emitted continuously. If 1, all particles are emitted simultaneously. int fixed_fps = 30 void set_fixed_fps ( int value ) int get_fixed_fps ( ) The particle system's frame rate is fixed to a value. For example, changing the value to 2 will make the particles render at 2 frames per second. Note this does not slow down the simulation of the particle system itself. bool fract_delta = true void set_fractional_delta ( bool value ) bool get_fractional_delta ( ) If true, results in fractional delta calculation which has a smoother particles display effect. float interp_to_end = 0.0 void set_interp_to_end ( float value ) float get_interp_to_end ( ) Causes all the particles in this node to interpolate towards the end of their lifetime. Note: This only works when used with a ParticleProcessMaterial. It needs to be manually implemented for custom process shaders. bool interpolate = true void set_interpolate ( bool value ) bool get_interpolate ( ) Enables particle interpolation, which makes the particle movement smoother when their fixed_fps is lower than the screen refresh rate. float lifetime = 1.0 void set_lifetime ( float value ) float get_lifetime ( ) The amount of time each particle will exist (in seconds). The effective emission rate is (amount * amount_ratio) / lifetime particles per second. bool local_coords = false void set_use_local_coordinates ( bool value ) bool get_use_local_coordinates ( ) If true, particles use the parent node's coordinate space (known as local coordinates). This will cause particles to move and rotate along the GPUParticles3D node (and its parents) when it is moved or rotated. If false, particles use global coordinates; they will not move or rotate along the GPUParticles3D node (and its parents) when it is moved or rotated. bool one_shot = false void set_one_shot ( bool value ) bool get_one_shot ( ) If true, only the number of particles equal to amount will be emitted. float preprocess = 0.0 void set_pre_process_time ( float value ) float get_pre_process_time ( ) Amount of time to preprocess the particles before animation starts. Lets you start the animation some time after particles have started emitting. Material process_material void set_process_material ( Material value ) Material get_process_material ( ) Material for processing particles. Can be a ParticleProcessMaterial or a ShaderMaterial. float randomness = 0.0 void set_randomness_ratio ( float value ) float get_randomness_ratio ( ) Emission randomness ratio. float speed_scale = 1.0 void set_speed_scale ( float value ) float get_speed_scale ( ) Speed scaling ratio. A value of 0 can be used to pause the particles. NodePath sub_emitter = NodePath("") void set_sub_emitter ( NodePath value ) NodePath get_sub_emitter ( ) Path to another GPUParticles3D node that will be used as a subemitter (see ParticleProcessMaterial.sub_emitter_mode). Subemitters can be used to achieve effects such as fireworks, sparks on collision, bubbles popping into water drops, and more. Note: When sub_emitter is set, the target GPUParticles3D node will no longer emit particles on its own. bool trail_enabled = false void set_trail_enabled ( bool value ) bool is_trail_enabled ( ) If true, enables particle trails using a mesh skinning system. Designed to work with RibbonTrailMesh and TubeTrailMesh. Note: BaseMaterial3D.use_particle_trails must also be enabled on the particle mesh's material. Otherwise, setting trail_enabled to true will have no effect. Note: Unlike GPUParticles2D, the number of trail sections and subdivisions is set in the RibbonTrailMesh or the TubeTrailMesh's properties. float trail_lifetime = 0.3 void set_trail_lifetime ( float value ) float get_trail_lifetime ( ) The amount of time the particle's trail should represent (in seconds). Only effective if trail_enabled is true. TransformAlign transform_align = 0 void set_transform_align ( TransformAlign value ) TransformAlign get_transform_align ( ) There is currently no description for this property. Please help us by contributing one! AABB visibility_aabb = AABB(-4, -4, -4, 8, 8, 8) void set_visibility_aabb ( AABB value ) AABB get_visibility_aabb ( ) The AABB that determines the node's region which needs to be visible on screen for the particle system to be active. GeometryInstance3D.extra_cull_margin is added on each of the AABB's axes. Particle collisions and attraction will only occur within this area. Grow the box if particles suddenly appear/disappear when the node enters/exits the screen. The AABB can be grown via code or with the Particles → Generate AABB editor tool. Note: visibility_aabb is overridden by GeometryInstance3D.custom_aabb if that property is set to a non-default value. Method Descriptions AABB capture_aabb ( ) const Returns the axis-aligned bounding box that contains all the particles that are active in the current frame. void convert_from_particles ( Node particles ) Sets this node's properties to match a given CPUParticles3D node. void emit_particle ( Transform3D xform, Vector3 velocity, Color color, Color custom, int flags ) Emits a single particle. Whether xform, velocity, color and custom are applied depends on the value of flags. See EmitFlags. Mesh get_draw_pass_mesh ( int pass ) const Returns the Mesh that is drawn at index pass. void restart ( ) Restarts the particle emission, clearing existing particles. void set_draw_pass_mesh ( int pass, Mesh mesh ) Sets the Mesh that is drawn at index pass. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_gpuparticles3d.html classes/class_navigationregion3d ----------------------------------------------------------- NavigationRegion3D Inherits: Node3D < Node < Object A traversable 3D region that NavigationAgent3Ds can use for pathfinding. Description A traversable 3D region based on a NavigationMesh that NavigationAgent3Ds can use for pathfinding. Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using NavigationServer3D.map_set_edge_connection_margin. Note: Overlapping two regions' navigation meshes is not enough for connecting two regions. They must share a similar edge. The cost of entering this region from another region can be controlled with the enter_cost value. Note: This value is not added to the path cost when the start position is already inside this region. The cost of traveling distances inside this region can be controlled with the travel_cost multiplier. Note: This node caches changes to its properties, so if you make changes to the underlying region RID in NavigationServer3D, they will not be reflected in this node's properties. Tutorials Using NavigationRegions Properties bool enabled true float enter_cost 0.0 int navigation_layers 1 NavigationMesh navigation_mesh float travel_cost 1.0 bool use_edge_connections true Methods void bake_navigation_mesh ( bool on_thread=true ) bool get_navigation_layer_value ( int layer_number ) const RID get_navigation_map ( ) const RID get_region_rid ( ) const RID get_rid ( ) const void set_navigation_layer_value ( int layer_number, bool value ) void set_navigation_map ( RID navigation_map ) Signals bake_finished ( ) Notifies when the navigation mesh bake operation is completed. navigation_mesh_changed ( ) Notifies when the NavigationMesh has changed. Property Descriptions bool enabled = true void set_enabled ( bool value ) bool is_enabled ( ) Determines if the NavigationRegion3D is enabled or disabled. float enter_cost = 0.0 void set_enter_cost ( float value ) float get_enter_cost ( ) When pathfinding enters this region's navigation mesh from another regions navigation mesh the enter_cost value is added to the path distance for determining the shortest path. int navigation_layers = 1 void set_navigation_layers ( int value ) int get_navigation_layers ( ) A bitfield determining all navigation layers the region belongs to. These navigation layers can be checked upon when requesting a path with NavigationServer3D.map_get_path. NavigationMesh navigation_mesh void set_navigation_mesh ( NavigationMesh value ) NavigationMesh get_navigation_mesh ( ) The NavigationMesh resource to use. float travel_cost = 1.0 void set_travel_cost ( float value ) float get_travel_cost ( ) When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with travel_cost for determining the shortest path. bool use_edge_connections = true void set_use_edge_connections ( bool value ) bool get_use_edge_connections ( ) If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin. Method Descriptions void bake_navigation_mesh ( bool on_thread=true ) Bakes the NavigationMesh. If on_thread is set to true (default), the baking is done on a separate thread. Baking on separate thread is useful because navigation baking is not a cheap operation. When it is completed, it automatically sets the new NavigationMesh. Please note that baking on separate thread may be very slow if geometry is parsed from meshes as async access to each mesh involves heavy synchronization. Also, please note that baking on a separate thread is automatically disabled on operating systems that cannot use threads (such as Web with threads disabled). bool get_navigation_layer_value ( int layer_number ) const Returns whether or not the specified layer of the navigation_layers bitmask is enabled, given a layer_number between 1 and 32. RID get_navigation_map ( ) const Returns the current navigation map RID used by this region. RID get_region_rid ( ) const Returns the RID of this region on the NavigationServer3D. Deprecated. Use get_rid instead. RID get_rid ( ) const Returns the RID of this region on the NavigationServer3D. Combined with NavigationServer3D.map_get_closest_point_owner can be used to identify the NavigationRegion3D closest to a point on the merged navigation map. void set_navigation_layer_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the navigation_layers bitmask, given a layer_number between 1 and 32. void set_navigation_map ( RID navigation_map ) Sets the RID of the navigation map this region should use. By default the region will automatically join the World3D default navigation map so this function is only required to override the default map. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_navigationregion3d.html classes/class_mesh ----------------------------------------------------------- Mesh Inherits: Resource < RefCounted < Object Inherited By: ArrayMesh, ImmediateMesh, PlaceholderMesh, PrimitiveMesh A Resource that contains vertex array-based geometry. Description Mesh is a type of Resource that contains vertex array-based geometry, divided in surfaces. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials. Tutorials 3D Material Testers Demo 3D Kinematic Character Demo 3D Platformer Demo Third Person Shooter Demo Properties Vector2i lightmap_size_hint Vector2i(0, 0) Methods AABB _get_aabb ( ) virtual const int _get_blend_shape_count ( ) virtual const StringName _get_blend_shape_name ( int index ) virtual const int _get_surface_count ( ) virtual const void _set_blend_shape_name ( int index, StringName name ) virtual int _surface_get_array_index_len ( int index ) virtual const int _surface_get_array_len ( int index ) virtual const Array _surface_get_arrays ( int index ) virtual const Array[] _surface_get_blend_shape_arrays ( int index ) virtual const int _surface_get_format ( int index ) virtual const Dictionary _surface_get_lods ( int index ) virtual const Material _surface_get_material ( int index ) virtual const int _surface_get_primitive_type ( int index ) virtual const void _surface_set_material ( int index, Material material ) virtual ConvexPolygonShape3D create_convex_shape ( bool clean=true, bool simplify=false ) const Mesh create_outline ( float margin ) const Resource create_placeholder ( ) const ConcavePolygonShape3D create_trimesh_shape ( ) const TriangleMesh generate_triangle_mesh ( ) const AABB get_aabb ( ) const PackedVector3Array get_faces ( ) const int get_surface_count ( ) const Array surface_get_arrays ( int surf_idx ) const Array[] surface_get_blend_shape_arrays ( int surf_idx ) const Material surface_get_material ( int surf_idx ) const void surface_set_material ( int surf_idx, Material material ) Enumerations enum PrimitiveType: PrimitiveType PRIMITIVE_POINTS = 0 Render array as points (one vertex equals one point). PrimitiveType PRIMITIVE_LINES = 1 Render array as lines (every two vertices a line is created). PrimitiveType PRIMITIVE_LINE_STRIP = 2 Render array as line strip. PrimitiveType PRIMITIVE_TRIANGLES = 3 Render array as triangles (every three vertices a triangle is created). PrimitiveType PRIMITIVE_TRIANGLE_STRIP = 4 Render array as triangle strips. enum ArrayType: ArrayType ARRAY_VERTEX = 0 PackedVector3Array, PackedVector2Array, or Array of vertex positions. ArrayType ARRAY_NORMAL = 1 PackedVector3Array of vertex normals. ArrayType ARRAY_TANGENT = 2 PackedFloat32Array of vertex tangents. Each element in groups of 4 floats, first 3 floats determine the tangent, and the last the binormal direction as -1 or 1. ArrayType ARRAY_COLOR = 3 PackedColorArray of vertex colors. ArrayType ARRAY_TEX_UV = 4 PackedVector2Array for UV coordinates. ArrayType ARRAY_TEX_UV2 = 5 PackedVector2Array for second UV coordinates. ArrayType ARRAY_CUSTOM0 = 6 Contains custom color channel 0. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM0_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_SNORM, ARRAY_CUSTOM_RG_HALF, or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise. ArrayType ARRAY_CUSTOM1 = 7 Contains custom color channel 1. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM1_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_SNORM, ARRAY_CUSTOM_RG_HALF, or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise. ArrayType ARRAY_CUSTOM2 = 8 Contains custom color channel 2. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM2_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_SNORM, ARRAY_CUSTOM_RG_HALF, or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise. ArrayType ARRAY_CUSTOM3 = 9 Contains custom color channel 3. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM3_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_SNORM, ARRAY_CUSTOM_RG_HALF, or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise. ArrayType ARRAY_BONES = 10 PackedFloat32Array or PackedInt32Array of bone indices. Contains either 4 or 8 numbers per vertex depending on the presence of the ARRAY_FLAG_USE_8_BONE_WEIGHTS flag. ArrayType ARRAY_WEIGHTS = 11 PackedFloat32Array or PackedFloat64Array of bone weights in the range 0.0 to 1.0 (inclusive). Contains either 4 or 8 numbers per vertex depending on the presence of the ARRAY_FLAG_USE_8_BONE_WEIGHTS flag. ArrayType ARRAY_INDEX = 12 PackedInt32Array of integers used as indices referencing vertices, colors, normals, tangents, and textures. All of those arrays must have the same number of elements as the vertex array. No index can be beyond the vertex array size. When this index array is present, it puts the function into "index mode," where the index selects the i'th vertex, normal, tangent, color, UV, etc. This means if you want to have different normals or colors along an edge, you have to duplicate the vertices. For triangles, the index array is interpreted as triples, referring to the vertices of each triangle. For lines, the index array is in pairs indicating the start and end of each line. ArrayType ARRAY_MAX = 13 Represents the size of the ArrayType enum. enum ArrayCustomFormat: ArrayCustomFormat ARRAY_CUSTOM_RGBA8_UNORM = 0 Indicates this custom channel contains unsigned normalized byte colors from 0 to 1, encoded as PackedByteArray. ArrayCustomFormat ARRAY_CUSTOM_RGBA8_SNORM = 1 Indicates this custom channel contains signed normalized byte colors from -1 to 1, encoded as PackedByteArray. ArrayCustomFormat ARRAY_CUSTOM_RG_HALF = 2 Indicates this custom channel contains half precision float colors, encoded as PackedByteArray. Only red and green channels are used. ArrayCustomFormat ARRAY_CUSTOM_RGBA_HALF = 3 Indicates this custom channel contains half precision float colors, encoded as PackedByteArray. ArrayCustomFormat ARRAY_CUSTOM_R_FLOAT = 4 Indicates this custom channel contains full float colors, in a PackedFloat32Array. Only the red channel is used. ArrayCustomFormat ARRAY_CUSTOM_RG_FLOAT = 5 Indicates this custom channel contains full float colors, in a PackedFloat32Array. Only red and green channels are used. ArrayCustomFormat ARRAY_CUSTOM_RGB_FLOAT = 6 Indicates this custom channel contains full float colors, in a PackedFloat32Array. Only red, green and blue channels are used. ArrayCustomFormat ARRAY_CUSTOM_RGBA_FLOAT = 7 Indicates this custom channel contains full float colors, in a PackedFloat32Array. ArrayCustomFormat ARRAY_CUSTOM_MAX = 8 Represents the size of the ArrayCustomFormat enum. flags ArrayFormat: ArrayFormat ARRAY_FORMAT_VERTEX = 1 Mesh array contains vertices. All meshes require a vertex array so this should always be present. ArrayFormat ARRAY_FORMAT_NORMAL = 2 Mesh array contains normals. ArrayFormat ARRAY_FORMAT_TANGENT = 4 Mesh array contains tangents. ArrayFormat ARRAY_FORMAT_COLOR = 8 Mesh array contains colors. ArrayFormat ARRAY_FORMAT_TEX_UV = 16 Mesh array contains UVs. ArrayFormat ARRAY_FORMAT_TEX_UV2 = 32 Mesh array contains second UV. ArrayFormat ARRAY_FORMAT_CUSTOM0 = 64 Mesh array contains custom channel index 0. ArrayFormat ARRAY_FORMAT_CUSTOM1 = 128 Mesh array contains custom channel index 1. ArrayFormat ARRAY_FORMAT_CUSTOM2 = 256 Mesh array contains custom channel index 2. ArrayFormat ARRAY_FORMAT_CUSTOM3 = 512 Mesh array contains custom channel index 3. ArrayFormat ARRAY_FORMAT_BONES = 1024 Mesh array contains bones. ArrayFormat ARRAY_FORMAT_WEIGHTS = 2048 Mesh array contains bone weights. ArrayFormat ARRAY_FORMAT_INDEX = 4096 Mesh array uses indices. ArrayFormat ARRAY_FORMAT_BLEND_SHAPE_MASK = 7 Mask of mesh channels permitted in blend shapes. ArrayFormat ARRAY_FORMAT_CUSTOM_BASE = 13 Shift of first custom channel. ArrayFormat ARRAY_FORMAT_CUSTOM_BITS = 3 Number of format bits per custom channel. See ArrayCustomFormat. ArrayFormat ARRAY_FORMAT_CUSTOM0_SHIFT = 13 Amount to shift ArrayCustomFormat for custom channel index 0. ArrayFormat ARRAY_FORMAT_CUSTOM1_SHIFT = 16 Amount to shift ArrayCustomFormat for custom channel index 1. ArrayFormat ARRAY_FORMAT_CUSTOM2_SHIFT = 19 Amount to shift ArrayCustomFormat for custom channel index 2. ArrayFormat ARRAY_FORMAT_CUSTOM3_SHIFT = 22 Amount to shift ArrayCustomFormat for custom channel index 3. ArrayFormat ARRAY_FORMAT_CUSTOM_MASK = 7 Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See ArrayCustomFormat. ArrayFormat ARRAY_COMPRESS_FLAGS_BASE = 25 Shift of first compress flag. Compress flags should be passed to ArrayMesh.add_surface_from_arrays and SurfaceTool.commit. ArrayFormat ARRAY_FLAG_USE_2D_VERTICES = 33554432 Flag used to mark that the array contains 2D vertices. ArrayFormat ARRAY_FLAG_USE_DYNAMIC_UPDATE = 67108864 Flag indices that the mesh data will use GL_DYNAMIC_DRAW on GLES. Unused on Vulkan. ArrayFormat ARRAY_FLAG_USE_8_BONE_WEIGHTS = 134217728 Flag used to mark that the mesh contains up to 8 bone influences per vertex. This flag indicates that ARRAY_BONES and ARRAY_WEIGHTS elements will have double length. ArrayFormat ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY = 268435456 Flag used to mark that the mesh intentionally contains no vertex array. ArrayFormat ARRAY_FLAG_COMPRESS_ATTRIBUTES = 536870912 Flag used to mark that a mesh is using compressed attributes (vertices, normals, tangents, UVs). When this form of compression is enabled, vertex positions will be packed into an RGBA16UNORM attribute and scaled in the vertex shader. The normal and tangent will be packed into an RG16UNORM representing an axis, and a 16-bit float stored in the A-channel of the vertex. UVs will use 16-bit normalized floats instead of full 32-bit signed floats. When using this compression mode you must use either vertices, normals, and tangents or only vertices. You cannot use normals without tangents. Importers will automatically enable this compression if they can. enum BlendShapeMode: BlendShapeMode BLEND_SHAPE_MODE_NORMALIZED = 0 Blend shapes are normalized. BlendShapeMode BLEND_SHAPE_MODE_RELATIVE = 1 Blend shapes are relative to base weight. Property Descriptions Vector2i lightmap_size_hint = Vector2i(0, 0) void set_lightmap_size_hint ( Vector2i value ) Vector2i get_lightmap_size_hint ( ) Sets a hint to be used for lightmap resolution. Method Descriptions AABB _get_aabb ( ) virtual const Virtual method to override the AABB for a custom class extending Mesh. int _get_blend_shape_count ( ) virtual const Virtual method to override the number of blend shapes for a custom class extending Mesh. StringName _get_blend_shape_name ( int index ) virtual const Virtual method to override the retrieval of blend shape names for a custom class extending Mesh. int _get_surface_count ( ) virtual const Virtual method to override the surface count for a custom class extending Mesh. void _set_blend_shape_name ( int index, StringName name ) virtual Virtual method to override the names of blend shapes for a custom class extending Mesh. int _surface_get_array_index_len ( int index ) virtual const Virtual method to override the surface array index length for a custom class extending Mesh. int _surface_get_array_len ( int index ) virtual const Virtual method to override the surface array length for a custom class extending Mesh. Array _surface_get_arrays ( int index ) virtual const Virtual method to override the surface arrays for a custom class extending Mesh. Array[] _surface_get_blend_shape_arrays ( int index ) virtual const Virtual method to override the blend shape arrays for a custom class extending Mesh. int _surface_get_format ( int index ) virtual const Virtual method to override the surface format for a custom class extending Mesh. Dictionary _surface_get_lods ( int index ) virtual const Virtual method to override the surface LODs for a custom class extending Mesh. Material _surface_get_material ( int index ) virtual const Virtual method to override the surface material for a custom class extending Mesh. int _surface_get_primitive_type ( int index ) virtual const Virtual method to override the surface primitive type for a custom class extending Mesh. void _surface_set_material ( int index, Material material ) virtual Virtual method to override the setting of a material at the given index for a custom class extending Mesh. ConvexPolygonShape3D create_convex_shape ( bool clean=true, bool simplify=false ) const Calculate a ConvexPolygonShape3D from the mesh. If clean is true (default), duplicate and interior vertices are removed automatically. You can set it to false to make the process faster if not needed. If simplify is true, the geometry can be further simplified to reduce the number of vertices. Disabled by default. Mesh create_outline ( float margin ) const Calculate an outline mesh at a defined offset (margin) from the original mesh. Note: This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise). Resource create_placeholder ( ) const Creates a placeholder version of this resource (PlaceholderMesh). ConcavePolygonShape3D create_trimesh_shape ( ) const Calculate a ConcavePolygonShape3D from the mesh. TriangleMesh generate_triangle_mesh ( ) const Generate a TriangleMesh from the mesh. Considers only surfaces using one of these primitive types: PRIMITIVE_TRIANGLES, PRIMITIVE_TRIANGLE_STRIP. AABB get_aabb ( ) const Returns the smallest AABB enclosing this mesh in local space. Not affected by custom_aabb. Note: This is only implemented for ArrayMesh and PrimitiveMesh. PackedVector3Array get_faces ( ) const Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle. int get_surface_count ( ) const Returns the number of surfaces that the Mesh holds. This is equivalent to MeshInstance3D.get_surface_override_material_count. Array surface_get_arrays ( int surf_idx ) const Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface (see ArrayMesh.add_surface_from_arrays). Array[] surface_get_blend_shape_arrays ( int surf_idx ) const Returns the blend shape arrays for the requested surface. Material surface_get_material ( int surf_idx ) const Returns a Material in a given surface. Surface is rendered using this material. Note: This returns the material within the Mesh resource, not the Material associated to the MeshInstance3D's Surface Material Override properties. To get the Material associated to the MeshInstance3D's Surface Material Override properties, use MeshInstance3D.get_surface_override_material instead. void surface_set_material ( int surf_idx, Material material ) Sets a Material for a given surface. Surface will be rendered using this material. Note: This assigns the material within the Mesh resource, not the Material associated to the MeshInstance3D's Surface Material Override properties. To set the Material associated to the MeshInstance3D's Surface Material Override properties, use MeshInstance3D.set_surface_override_material instead. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_mesh.html classes/class_raycast2d ----------------------------------------------------------- RayCast2D Inherits: Node2D < CanvasItem < Node < Object A ray in 2D space, used to find the first CollisionObject2D it intersects. Description A raycast represents a ray from its origin to its target_position that finds the closest CollisionObject2D along its path, if it intersects any. This is useful for a lot of things, such as RayCast2D can ignore some objects by adding them to an exception list, by making its detection reporting ignore Area2Ds (collide_with_areas) or PhysicsBody2Ds (collide_with_bodies), or by configuring physics layers. RayCast2D calculates intersection every physics frame, and it holds the result until the next physics frame. For an immediate raycast, or if you want to configure a RayCast2D multiple times within the same physics frame, use force_raycast_update. To sweep over a region of 2D space, you can approximate the region with multiple RayCast2Ds or use ShapeCast2D. Tutorials Ray-casting Properties bool collide_with_areas false bool collide_with_bodies true int collision_mask 1 bool enabled true bool exclude_parent true bool hit_from_inside false Vector2 target_position Vector2(0, 50) Methods void add_exception ( CollisionObject2D node ) void add_exception_rid ( RID rid ) void clear_exceptions ( ) void force_raycast_update ( ) Object get_collider ( ) const RID get_collider_rid ( ) const int get_collider_shape ( ) const bool get_collision_mask_value ( int layer_number ) const Vector2 get_collision_normal ( ) const Vector2 get_collision_point ( ) const bool is_colliding ( ) const void remove_exception ( CollisionObject2D node ) void remove_exception_rid ( RID rid ) void set_collision_mask_value ( int layer_number, bool value ) Property Descriptions bool collide_with_areas = false void set_collide_with_areas ( bool value ) bool is_collide_with_areas_enabled ( ) If true, collisions with Area2Ds will be reported. bool collide_with_bodies = true void set_collide_with_bodies ( bool value ) bool is_collide_with_bodies_enabled ( ) If true, collisions with PhysicsBody2Ds will be reported. int collision_mask = 1 void set_collision_mask ( int value ) int get_collision_mask ( ) The ray's collision mask. Only objects in at least one collision layer enabled in the mask will be detected. See Collision layers and masks in the documentation for more information. bool enabled = true void set_enabled ( bool value ) bool is_enabled ( ) If true, collisions will be reported. bool exclude_parent = true void set_exclude_parent_body ( bool value ) bool get_exclude_parent_body ( ) If true, the parent node will be excluded from collision detection. bool hit_from_inside = false void set_hit_from_inside ( bool value ) bool is_hit_from_inside_enabled ( ) If true, the ray will detect a hit when starting inside shapes. In this case the collision normal will be Vector2(0, 0). Does not affect concave polygon shapes. Vector2 target_position = Vector2(0, 50) void set_target_position ( Vector2 value ) Vector2 get_target_position ( ) The ray's destination point, relative to the RayCast's position. Method Descriptions void add_exception ( CollisionObject2D node ) Adds a collision exception so the ray does not report collisions with the specified CollisionObject2D node. void add_exception_rid ( RID rid ) Adds a collision exception so the ray does not report collisions with the specified RID. void clear_exceptions ( ) Removes all collision exceptions for this ray. void force_raycast_update ( ) Updates the collision information for the ray immediately, without waiting for the next _physics_process call. Use this method, for example, when the ray or its parent has changed state. Note: enabled does not need to be true for this to work. Object get_collider ( ) const Returns the first object that the ray intersects, or null if no object is intersecting the ray (i.e. is_colliding returns false). RID get_collider_rid ( ) const Returns the RID of the first object that the ray intersects, or an empty RID if no object is intersecting the ray (i.e. is_colliding returns false). int get_collider_shape ( ) const Returns the shape ID of the first object that the ray intersects, or 0 if no object is intersecting the ray (i.e. is_colliding returns false). To get the intersected shape node, for a CollisionObject2D target, use: GDScriptvar target = get_collider() # A CollisionObject2D. 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) C#var target = (CollisionObject2D)GetCollider(); // A CollisionObject2D. 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); bool get_collision_mask_value ( int layer_number ) const Returns whether or not the specified layer of the collision_mask is enabled, given a layer_number between 1 and 32. Vector2 get_collision_normal ( ) const Returns the normal of the intersecting object's shape at the collision point, or Vector2(0, 0) if the ray starts inside the shape and hit_from_inside is true. Vector2 get_collision_point ( ) const Returns the collision point at which the ray intersects the closest object. If hit_from_inside is true and the ray starts inside of a collision shape, this function will return the origin point of the ray. Note: This point is in the global coordinate system. bool is_colliding ( ) const Returns whether any object is intersecting with the ray's vector (considering the vector length). void remove_exception ( CollisionObject2D node ) Removes a collision exception so the ray does report collisions with the specified CollisionObject2D node. void remove_exception_rid ( RID rid ) Removes a collision exception so the ray does report collisions with the specified RID. void set_collision_mask_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the collision_mask, given a layer_number between 1 and 32. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_raycast2d.html classes/class_fastnoiselite ----------------------------------------------------------- FastNoiseLite Inherits: Noise < Resource < RefCounted < Object Generates noise using the FastNoiseLite library. Description This class generates noise using the FastNoiseLite library, which is a collection of several noise algorithms including Cellular, Perlin, Value, and more. Most generated noise values are in the range of [-1, 1], but not always. Some of the cellular noise algorithms return results above 1. Properties CellularDistanceFunction cellular_distance_function 0 float cellular_jitter 1.0 CellularReturnType cellular_return_type 1 float domain_warp_amplitude 30.0 bool domain_warp_enabled false float domain_warp_fractal_gain 0.5 float domain_warp_fractal_lacunarity 6.0 int domain_warp_fractal_octaves 5 DomainWarpFractalType domain_warp_fractal_type 1 float domain_warp_frequency 0.05 DomainWarpType domain_warp_type 0 float fractal_gain 0.5 float fractal_lacunarity 2.0 int fractal_octaves 5 float fractal_ping_pong_strength 2.0 FractalType fractal_type 1 float fractal_weighted_strength 0.0 float frequency 0.01 NoiseType noise_type 1 Vector3 offset Vector3(0, 0, 0) int seed 0 Enumerations enum NoiseType: NoiseType TYPE_VALUE = 5 A lattice of points are assigned random values then interpolated based on neighboring values. NoiseType TYPE_VALUE_CUBIC = 4 Similar to Value noise, but slower. Has more variance in peaks and valleys. Cubic noise can be used to avoid certain artifacts when using value noise to create a bumpmap. In general, you should always use this mode if the value noise is being used for a heightmap or bumpmap. NoiseType TYPE_PERLIN = 3 A lattice of random gradients. Their dot products are interpolated to obtain values in between the lattices. NoiseType TYPE_CELLULAR = 2 Cellular includes both Worley noise and Voronoi diagrams which creates various regions of the same value. NoiseType TYPE_SIMPLEX = 0 As opposed to TYPE_PERLIN, gradients exist in a simplex lattice rather than a grid lattice, avoiding directional artifacts. NoiseType TYPE_SIMPLEX_SMOOTH = 1 Modified, higher quality version of TYPE_SIMPLEX, but slower. enum FractalType: FractalType FRACTAL_NONE = 0 No fractal noise. FractalType FRACTAL_FBM = 1 Method using Fractional Brownian Motion to combine octaves into a fractal. FractalType FRACTAL_RIDGED = 2 Method of combining octaves into a fractal resulting in a "ridged" look. FractalType FRACTAL_PING_PONG = 3 Method of combining octaves into a fractal with a ping pong effect. enum CellularDistanceFunction: CellularDistanceFunction DISTANCE_EUCLIDEAN = 0 Euclidean distance to the nearest point. CellularDistanceFunction DISTANCE_EUCLIDEAN_SQUARED = 1 Squared Euclidean distance to the nearest point. CellularDistanceFunction DISTANCE_MANHATTAN = 2 Manhattan distance (taxicab metric) to the nearest point. CellularDistanceFunction DISTANCE_HYBRID = 3 Blend of DISTANCE_EUCLIDEAN and DISTANCE_MANHATTAN to give curved cell boundaries enum CellularReturnType: CellularReturnType RETURN_CELL_VALUE = 0 The cellular distance function will return the same value for all points within a cell. CellularReturnType RETURN_DISTANCE = 1 The cellular distance function will return a value determined by the distance to the nearest point. CellularReturnType RETURN_DISTANCE2 = 2 The cellular distance function returns the distance to the second-nearest point. CellularReturnType RETURN_DISTANCE2_ADD = 3 The distance to the nearest point is added to the distance to the second-nearest point. CellularReturnType RETURN_DISTANCE2_SUB = 4 The distance to the nearest point is subtracted from the distance to the second-nearest point. CellularReturnType RETURN_DISTANCE2_MUL = 5 The distance to the nearest point is multiplied with the distance to the second-nearest point. CellularReturnType RETURN_DISTANCE2_DIV = 6 The distance to the nearest point is divided by the distance to the second-nearest point. enum DomainWarpType: DomainWarpType DOMAIN_WARP_SIMPLEX = 0 The domain is warped using the simplex noise algorithm. DomainWarpType DOMAIN_WARP_SIMPLEX_REDUCED = 1 The domain is warped using a simplified version of the simplex noise algorithm. DomainWarpType DOMAIN_WARP_BASIC_GRID = 2 The domain is warped using a simple noise grid (not as smooth as the other methods, but more performant). enum DomainWarpFractalType: DomainWarpFractalType DOMAIN_WARP_FRACTAL_NONE = 0 No fractal noise for warping the space. DomainWarpFractalType DOMAIN_WARP_FRACTAL_PROGRESSIVE = 1 Warping the space progressively, octave for octave, resulting in a more "liquified" distortion. DomainWarpFractalType DOMAIN_WARP_FRACTAL_INDEPENDENT = 2 Warping the space independently for each octave, resulting in a more chaotic distortion. Property Descriptions CellularDistanceFunction cellular_distance_function = 0 void set_cellular_distance_function ( CellularDistanceFunction value ) CellularDistanceFunction get_cellular_distance_function ( ) Determines how the distance to the nearest/second-nearest point is computed. See CellularDistanceFunction for options. float cellular_jitter = 1.0 void set_cellular_jitter ( float value ) float get_cellular_jitter ( ) Maximum distance a point can move off of its grid position. Set to 0 for an even grid. CellularReturnType cellular_return_type = 1 void set_cellular_return_type ( CellularReturnType value ) CellularReturnType get_cellular_return_type ( ) Return type from cellular noise calculations. See CellularReturnType. float domain_warp_amplitude = 30.0 void set_domain_warp_amplitude ( float value ) float get_domain_warp_amplitude ( ) Sets the maximum warp distance from the origin. bool domain_warp_enabled = false void set_domain_warp_enabled ( bool value ) bool is_domain_warp_enabled ( ) If enabled, another FastNoiseLite instance is used to warp the space, resulting in a distortion of the noise. float domain_warp_fractal_gain = 0.5 void set_domain_warp_fractal_gain ( float value ) float get_domain_warp_fractal_gain ( ) Determines the strength of each subsequent layer of the noise which is used to warp the space. A low value places more emphasis on the lower frequency base layers, while a high value puts more emphasis on the higher frequency layers. float domain_warp_fractal_lacunarity = 6.0 void set_domain_warp_fractal_lacunarity ( float value ) float get_domain_warp_fractal_lacunarity ( ) Octave lacunarity of the fractal noise which warps the space. Increasing this value results in higher octaves producing noise with finer details and a rougher appearance. int domain_warp_fractal_octaves = 5 void set_domain_warp_fractal_octaves ( int value ) int get_domain_warp_fractal_octaves ( ) The number of noise layers that are sampled to get the final value for the fractal noise which warps the space. DomainWarpFractalType domain_warp_fractal_type = 1 void set_domain_warp_fractal_type ( DomainWarpFractalType value ) DomainWarpFractalType get_domain_warp_fractal_type ( ) The method for combining octaves into a fractal which is used to warp the space. See DomainWarpFractalType. float domain_warp_frequency = 0.05 void set_domain_warp_frequency ( float value ) float get_domain_warp_frequency ( ) Frequency of the noise which warps the space. Low frequency results in smooth noise while high frequency results in rougher, more granular noise. DomainWarpType domain_warp_type = 0 void set_domain_warp_type ( DomainWarpType value ) DomainWarpType get_domain_warp_type ( ) Sets the warp algorithm. See DomainWarpType. float fractal_gain = 0.5 void set_fractal_gain ( float value ) float get_fractal_gain ( ) Determines the strength of each subsequent layer of noise in fractal noise. A low value places more emphasis on the lower frequency base layers, while a high value puts more emphasis on the higher frequency layers. float fractal_lacunarity = 2.0 void set_fractal_lacunarity ( float value ) float get_fractal_lacunarity ( ) Frequency multiplier between subsequent octaves. Increasing this value results in higher octaves producing noise with finer details and a rougher appearance. int fractal_octaves = 5 void set_fractal_octaves ( int value ) int get_fractal_octaves ( ) The number of noise layers that are sampled to get the final value for fractal noise types. float fractal_ping_pong_strength = 2.0 void set_fractal_ping_pong_strength ( float value ) float get_fractal_ping_pong_strength ( ) Sets the strength of the fractal ping pong type. FractalType fractal_type = 1 void set_fractal_type ( FractalType value ) FractalType get_fractal_type ( ) The method for combining octaves into a fractal. See FractalType. float fractal_weighted_strength = 0.0 void set_fractal_weighted_strength ( float value ) float get_fractal_weighted_strength ( ) Higher weighting means higher octaves have less impact if lower octaves have a large impact. float frequency = 0.01 void set_frequency ( float value ) float get_frequency ( ) The frequency for all noise types. Low frequency results in smooth noise while high frequency results in rougher, more granular noise. NoiseType noise_type = 1 void set_noise_type ( NoiseType value ) NoiseType get_noise_type ( ) The noise algorithm used. See NoiseType. Vector3 offset = Vector3(0, 0, 0) void set_offset ( Vector3 value ) Vector3 get_offset ( ) Translate the noise input coordinates by the given Vector3. int seed = 0 void set_seed ( int value ) int get_seed ( ) The random number seed for all noise types. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_fastnoiselite.html classes/class_navigationmesh ----------------------------------------------------------- NavigationMesh Inherits: Resource < RefCounted < Object A navigation mesh that defines traversable areas and obstacles. Description A navigation mesh is a collection of polygons that define which areas of an environment are traversable to aid agents in pathfinding through complicated spaces. Tutorials Using NavigationMeshes 3D Navmesh Demo Properties float agent_height 1.5 float agent_max_climb 0.25 float agent_max_slope 45.0 float agent_radius 0.5 float cell_height 0.25 float cell_size 0.25 float detail_sample_distance 6.0 float detail_sample_max_error 1.0 float edge_max_error 1.3 float edge_max_length 0.0 AABB filter_baking_aabb AABB(0, 0, 0, 0, 0, 0) Vector3 filter_baking_aabb_offset Vector3(0, 0, 0) bool filter_ledge_spans false bool filter_low_hanging_obstacles false bool filter_walkable_low_height_spans false int geometry_collision_mask 4294967295 ParsedGeometryType geometry_parsed_geometry_type 0 SourceGeometryMode geometry_source_geometry_mode 0 StringName geometry_source_group_name &"navigation_mesh_source_group" float region_merge_size 20.0 float region_min_size 2.0 SamplePartitionType sample_partition_type 0 float vertices_per_polygon 6.0 Methods void add_polygon ( PackedInt32Array polygon ) void clear ( ) void clear_polygons ( ) void create_from_mesh ( Mesh mesh ) bool get_collision_mask_value ( int layer_number ) const PackedInt32Array get_polygon ( int idx ) int get_polygon_count ( ) const PackedVector3Array get_vertices ( ) const void set_collision_mask_value ( int layer_number, bool value ) void set_vertices ( PackedVector3Array vertices ) Enumerations enum SamplePartitionType: SamplePartitionType SAMPLE_PARTITION_WATERSHED = 0 Watershed partitioning. Generally the best choice if you precompute the navigation mesh, use this if you have large open areas. SamplePartitionType SAMPLE_PARTITION_MONOTONE = 1 Monotone partitioning. Use this if you want fast navigation mesh generation. SamplePartitionType SAMPLE_PARTITION_LAYERS = 2 Layer partitioning. Good choice to use for tiled navigation mesh with medium and small sized tiles. SamplePartitionType SAMPLE_PARTITION_MAX = 3 Represents the size of the SamplePartitionType enum. enum ParsedGeometryType: ParsedGeometryType PARSED_GEOMETRY_MESH_INSTANCES = 0 Parses mesh instances as geometry. This includes MeshInstance3D, CSGShape3D, and GridMap nodes. ParsedGeometryType PARSED_GEOMETRY_STATIC_COLLIDERS = 1 Parses StaticBody3D colliders as geometry. The collider should be in any of the layers specified by geometry_collision_mask. ParsedGeometryType PARSED_GEOMETRY_BOTH = 2 Both PARSED_GEOMETRY_MESH_INSTANCES and PARSED_GEOMETRY_STATIC_COLLIDERS. ParsedGeometryType PARSED_GEOMETRY_MAX = 3 Represents the size of the ParsedGeometryType enum. enum SourceGeometryMode: SourceGeometryMode SOURCE_GEOMETRY_ROOT_NODE_CHILDREN = 0 Scans the child nodes of the root node recursively for geometry. SourceGeometryMode SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN = 1 Scans nodes in a group and their child nodes recursively for geometry. The group is specified by geometry_source_group_name. SourceGeometryMode SOURCE_GEOMETRY_GROUPS_EXPLICIT = 2 Uses nodes in a group for geometry. The group is specified by geometry_source_group_name. SourceGeometryMode SOURCE_GEOMETRY_MAX = 3 Represents the size of the SourceGeometryMode enum. Property Descriptions float agent_height = 1.5 void set_agent_height ( float value ) float get_agent_height ( ) The minimum floor to ceiling height that will still allow the floor area to be considered walkable. Note: While baking, this value will be rounded up to the nearest multiple of cell_height. float agent_max_climb = 0.25 void set_agent_max_climb ( float value ) float get_agent_max_climb ( ) The minimum ledge height that is considered to still be traversable. Note: While baking, this value will be rounded down to the nearest multiple of cell_height. float agent_max_slope = 45.0 void set_agent_max_slope ( float value ) float get_agent_max_slope ( ) The maximum slope that is considered walkable, in degrees. float agent_radius = 0.5 void set_agent_radius ( float value ) float get_agent_radius ( ) The distance to erode/shrink the walkable area of the heightfield away from obstructions. Note: While baking, this value will be rounded up to the nearest multiple of cell_size. float cell_height = 0.25 void set_cell_height ( float value ) float get_cell_height ( ) The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map. float cell_size = 0.25 void set_cell_size ( float value ) float get_cell_size ( ) The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map. float detail_sample_distance = 6.0 void set_detail_sample_distance ( float value ) float get_detail_sample_distance ( ) The sampling distance to use when generating the detail mesh, in cell unit. float detail_sample_max_error = 1.0 void set_detail_sample_max_error ( float value ) float get_detail_sample_max_error ( ) The maximum distance the detail mesh surface should deviate from heightfield, in cell unit. float edge_max_error = 1.3 void set_edge_max_error ( float value ) float get_edge_max_error ( ) The maximum distance a simplified contour's border edges should deviate the original raw contour. float edge_max_length = 0.0 void set_edge_max_length ( float value ) float get_edge_max_length ( ) The maximum allowed length for contour edges along the border of the mesh. A value of 0.0 disables this feature. Note: While baking, this value will be rounded up to the nearest multiple of cell_size. AABB filter_baking_aabb = AABB(0, 0, 0, 0, 0, 0) void set_filter_baking_aabb ( AABB value ) AABB get_filter_baking_aabb ( ) If the baking AABB has a volume the navigation mesh baking will be restricted to its enclosing area. Vector3 filter_baking_aabb_offset = Vector3(0, 0, 0) void set_filter_baking_aabb_offset ( Vector3 value ) Vector3 get_filter_baking_aabb_offset ( ) The position offset applied to the filter_baking_aabb AABB. bool filter_ledge_spans = false void set_filter_ledge_spans ( bool value ) bool get_filter_ledge_spans ( ) If true, marks spans that are ledges as non-walkable. bool filter_low_hanging_obstacles = false void set_filter_low_hanging_obstacles ( bool value ) bool get_filter_low_hanging_obstacles ( ) If true, marks non-walkable spans as walkable if their maximum is within agent_max_climb of a walkable neighbor. bool filter_walkable_low_height_spans = false void set_filter_walkable_low_height_spans ( bool value ) bool get_filter_walkable_low_height_spans ( ) If true, marks walkable spans as not walkable if the clearance above the span is less than agent_height. int geometry_collision_mask = 4294967295 void set_collision_mask ( int value ) int get_collision_mask ( ) The physics layers to scan for static colliders. Only used when geometry_parsed_geometry_type is PARSED_GEOMETRY_STATIC_COLLIDERS or PARSED_GEOMETRY_BOTH. ParsedGeometryType geometry_parsed_geometry_type = 0 void set_parsed_geometry_type ( ParsedGeometryType value ) ParsedGeometryType get_parsed_geometry_type ( ) Determines which type of nodes will be parsed as geometry. See ParsedGeometryType for possible values. SourceGeometryMode geometry_source_geometry_mode = 0 void set_source_geometry_mode ( SourceGeometryMode value ) SourceGeometryMode get_source_geometry_mode ( ) The source of the geometry used when baking. See SourceGeometryMode for possible values. StringName geometry_source_group_name = &"navigation_mesh_source_group" void set_source_group_name ( StringName value ) StringName get_source_group_name ( ) The name of the group to scan for geometry. Only used when geometry_source_geometry_mode is SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN or SOURCE_GEOMETRY_GROUPS_EXPLICIT. float region_merge_size = 20.0 void set_region_merge_size ( float value ) float get_region_merge_size ( ) Any regions with a size smaller than this will be merged with larger regions if possible. Note: This value will be squared to calculate the number of cells. For example, a value of 20 will set the number of cells to 400. float region_min_size = 2.0 void set_region_min_size ( float value ) float get_region_min_size ( ) The minimum size of a region for it to be created. Note: This value will be squared to calculate the minimum number of cells allowed to form isolated island areas. For example, a value of 8 will set the number of cells to 64. SamplePartitionType sample_partition_type = 0 void set_sample_partition_type ( SamplePartitionType value ) SamplePartitionType get_sample_partition_type ( ) Partitioning algorithm for creating the navigation mesh polys. See SamplePartitionType for possible values. float vertices_per_polygon = 6.0 void set_vertices_per_polygon ( float value ) float get_vertices_per_polygon ( ) The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process. Method Descriptions void add_polygon ( PackedInt32Array polygon ) Adds a polygon using the indices of the vertices you get when calling get_vertices. void clear ( ) Clears the internal arrays for vertices and polygon indices. void clear_polygons ( ) Clears the array of polygons, but it doesn't clear the array of vertices. void create_from_mesh ( Mesh mesh ) Initializes the navigation mesh by setting the vertices and indices according to a Mesh. Note: The given mesh must be of type Mesh.PRIMITIVE_TRIANGLES and have an index array. bool get_collision_mask_value ( int layer_number ) const Returns whether or not the specified layer of the geometry_collision_mask is enabled, given a layer_number between 1 and 32. PackedInt32Array get_polygon ( int idx ) Returns a PackedInt32Array containing the indices of the vertices of a created polygon. int get_polygon_count ( ) const Returns the number of polygons in the navigation mesh. PackedVector3Array get_vertices ( ) const Returns a PackedVector3Array containing all the vertices being used to create the polygons. void set_collision_mask_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the geometry_collision_mask, given a layer_number between 1 and 32. void set_vertices ( PackedVector3Array vertices ) Sets the vertices that can be then indexed to create polygons with the add_polygon method. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_navigationmesh.html classes/class_textmesh ----------------------------------------------------------- TextMesh Inherits: PrimitiveMesh < Mesh < Resource < RefCounted < Object Generate an PrimitiveMesh from the text. Description Generate an PrimitiveMesh from the text. TextMesh can be generated only when using dynamic fonts with vector glyph contours. Bitmap fonts (including bitmap data in the TrueType/OpenType containers, like color emoji fonts) are not supported. The UV layout is arranged in 4 horizontal strips, top to bottom: 40% of the height for the front face, 40% for the back face, 10% for the outer edges and 10% for the inner edges. Tutorials 3D text Properties AutowrapMode autowrap_mode 0 float curve_step 0.5 float depth 0.05 Font font int font_size 16 HorizontalAlignment horizontal_alignment 1 BitField justification_flags 163 String language "" float line_spacing 0.0 Vector2 offset Vector2(0, 0) float pixel_size 0.01 StructuredTextParser structured_text_bidi_override 0 Array structured_text_bidi_override_options [] String text "" Direction text_direction 0 bool uppercase false VerticalAlignment vertical_alignment 1 float width 500.0 Property Descriptions AutowrapMode autowrap_mode = 0 void set_autowrap_mode ( AutowrapMode value ) AutowrapMode get_autowrap_mode ( ) If set to something other than TextServer.AUTOWRAP_OFF, the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see AutowrapMode. float curve_step = 0.5 void set_curve_step ( float value ) float get_curve_step ( ) Step (in pixels) used to approximate Bézier curves. float depth = 0.05 void set_depth ( float value ) float get_depth ( ) Depths of the mesh, if set to 0.0 only front surface, is generated, and UV layout is changed to use full texture for the front face only. Font font void set_font ( Font value ) Font get_font ( ) Font configuration used to display text. int font_size = 16 void set_font_size ( int value ) int get_font_size ( ) Font size of the TextMesh's text. HorizontalAlignment horizontal_alignment = 1 void set_horizontal_alignment ( HorizontalAlignment value ) HorizontalAlignment get_horizontal_alignment ( ) Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the HorizontalAlignment constants. BitField justification_flags = 163 void set_justification_flags ( BitField value ) BitField get_justification_flags ( ) Line fill alignment rules. For more info see JustificationFlag. String language = "" void set_language ( String value ) String get_language ( ) Language code used for text shaping algorithms, if left empty current locale is used instead. float line_spacing = 0.0 void set_line_spacing ( float value ) float get_line_spacing ( ) Vertical space between lines in multiline TextMesh. Vector2 offset = Vector2(0, 0) void set_offset ( Vector2 value ) Vector2 get_offset ( ) The text drawing offset (in pixels). float pixel_size = 0.01 void set_pixel_size ( float value ) float get_pixel_size ( ) The size of one pixel's width on the text to scale it in 3D. StructuredTextParser structured_text_bidi_override = 0 void set_structured_text_bidi_override ( StructuredTextParser value ) StructuredTextParser get_structured_text_bidi_override ( ) Set BiDi algorithm override for the structured text. Array structured_text_bidi_override_options = [] void set_structured_text_bidi_override_options ( Array value ) Array get_structured_text_bidi_override_options ( ) Set additional options for BiDi override. String text = "" void set_text ( String value ) String get_text ( ) The text to generate mesh from. Direction text_direction = 0 void set_text_direction ( Direction value ) Direction get_text_direction ( ) Base text writing direction. bool uppercase = false void set_uppercase ( bool value ) bool is_uppercase ( ) If true, all the text displays as UPPERCASE. VerticalAlignment vertical_alignment = 1 void set_vertical_alignment ( VerticalAlignment value ) VerticalAlignment get_vertical_alignment ( ) Controls the text's vertical alignment. Supports top, center, bottom. Set it to one of the VerticalAlignment constants. float width = 500.0 void set_width ( float value ) float get_width ( ) Text width (in pixels), used for fill alignment. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_textmesh.html classes/class_audiostreamplayer2d ----------------------------------------------------------- AudioStreamPlayer2D Inherits: Node2D < CanvasItem < Node < Object Plays positional sound in 2D space. Description Plays audio that is attenuated with distance to the listener. By default, audio is heard from the screen center. This can be changed by adding an AudioListener2D node to the scene and enabling it by calling AudioListener2D.make_current on it. See also AudioStreamPlayer to play a sound non-positionally. Note: Hiding an AudioStreamPlayer2D node does not disable its audio output. To temporarily disable an AudioStreamPlayer2D's audio output, set volume_db to a very low value like -100 (which isn't audible to human hearing). Tutorials Audio streams Properties int area_mask 1 float attenuation 1.0 bool autoplay false StringName bus &"Master" float max_distance 2000.0 int max_polyphony 1 float panning_strength 1.0 float pitch_scale 1.0 bool playing false AudioStream stream bool stream_paused false float volume_db 0.0 Methods float get_playback_position ( ) AudioStreamPlayback get_stream_playback ( ) bool has_stream_playback ( ) void play ( float from_position=0.0 ) void seek ( float to_position ) void stop ( ) Signals finished ( ) Emitted when the audio stops playing. Property Descriptions int area_mask = 1 void set_area_mask ( int value ) int get_area_mask ( ) Determines which Area2D layers affect the sound for reverb and audio bus effects. Areas can be used to redirect AudioStreams so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater. float attenuation = 1.0 void set_attenuation ( float value ) float get_attenuation ( ) The volume is attenuated over distance with this as an exponent. bool autoplay = false void set_autoplay ( bool value ) bool is_autoplay_enabled ( ) If true, audio plays when added to scene tree. StringName bus = &"Master" void set_bus ( StringName value ) StringName get_bus ( ) Bus on which this audio is playing. Note: When setting this property, keep in mind that no validation is performed to see if the given name matches an existing bus. This is because audio bus layouts might be loaded after this property is set. If this given name can't be resolved at runtime, it will fall back to "Master". float max_distance = 2000.0 void set_max_distance ( float value ) float get_max_distance ( ) Maximum distance from which audio is still hearable. int max_polyphony = 1 void set_max_polyphony ( int value ) int get_max_polyphony ( ) The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds. float panning_strength = 1.0 void set_panning_strength ( float value ) float get_panning_strength ( ) Scales the panning strength for this node by multiplying the base ProjectSettings.audio/general/2d_panning_strength with this factor. Higher values will pan audio from left to right more dramatically than lower values. float pitch_scale = 1.0 void set_pitch_scale ( float value ) float get_pitch_scale ( ) The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate. bool playing = false bool is_playing ( ) If true, audio is playing or is queued to be played (see play). AudioStream stream void set_stream ( AudioStream value ) AudioStream get_stream ( ) The AudioStream object to be played. bool stream_paused = false void set_stream_paused ( bool value ) bool get_stream_paused ( ) If true, the playback is paused. You can resume it by setting stream_paused to false. float volume_db = 0.0 void set_volume_db ( float value ) float get_volume_db ( ) Base volume before attenuation. Method Descriptions float get_playback_position ( ) Returns the position in the AudioStream. AudioStreamPlayback get_stream_playback ( ) Returns the AudioStreamPlayback object associated with this AudioStreamPlayer2D. bool has_stream_playback ( ) Returns whether the AudioStreamPlayer can return the AudioStreamPlayback object or not. void play ( float from_position=0.0 ) Queues the audio to play on the next physics frame, from the given position from_position, in seconds. void seek ( float to_position ) Sets the position from which audio will be played, in seconds. void stop ( ) Stops the audio. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_audiostreamplayer2d.html classes/class_lineedit ----------------------------------------------------------- LineEdit Inherits: Control < CanvasItem < Node < Object An input field for single-line text. Description LineEdit provides an input field for editing a single line of text. It features many built-in shortcuts that are always available (Ctrl here maps to Cmd on macOS): Ctrl + C: Copy Ctrl + X: Cut Ctrl + V or Ctrl + Y: Paste/"yank" Ctrl + Z: Undo Ctrl + ~: Swap input direction. Ctrl + Shift + Z: Redo Ctrl + U: Delete text from the caret position to the beginning of the line Ctrl + K: Delete text from the caret position to the end of the line Ctrl + A: Select all text Up Arrow/Down Arrow: Move the caret to the beginning/end of the line On macOS, some extra keyboard shortcuts are available: Cmd + F: Same as Right Arrow, move the caret one character right Cmd + B: Same as Left Arrow, move the caret one character left Cmd + P: Same as Up Arrow, move the caret to the previous line Cmd + N: Same as Down Arrow, move the caret to the next line Cmd + D: Same as Delete, delete the character on the right side of caret Cmd + H: Same as Backspace, delete the character on the left side of the caret Cmd + A: Same as Home, move the caret to the beginning of the line Cmd + E: Same as End, move the caret to the end of the line Cmd + Left Arrow: Same as Home, move the caret to the beginning of the line Cmd + Right Arrow: Same as End, move the caret to the end of the line Properties HorizontalAlignment alignment 0 bool caret_blink false float caret_blink_interval 0.65 int caret_column 0 bool caret_force_displayed false bool caret_mid_grapheme false bool clear_button_enabled false bool context_menu_enabled true bool deselect_on_focus_loss_enabled true bool drag_and_drop_selection_enabled true bool draw_control_chars false bool editable true bool expand_to_text_length false bool flat false FocusMode focus_mode 2 (overrides Control) String language "" int max_length 0 bool middle_mouse_paste_enabled true CursorShape mouse_default_cursor_shape 1 (overrides Control) String placeholder_text "" Texture2D right_icon bool secret false String secret_character "•" bool select_all_on_focus false bool selecting_enabled true bool shortcut_keys_enabled true StructuredTextParser structured_text_bidi_override 0 Array structured_text_bidi_override_options [] String text "" TextDirection text_direction 0 bool virtual_keyboard_enabled true VirtualKeyboardType virtual_keyboard_type 0 Methods void clear ( ) void delete_char_at_caret ( ) void delete_text ( int from_column, int to_column ) void deselect ( ) PopupMenu get_menu ( ) const float get_scroll_offset ( ) const String get_selected_text ( ) int get_selection_from_column ( ) const int get_selection_to_column ( ) const bool has_selection ( ) const void insert_text_at_caret ( String text ) bool is_menu_visible ( ) const void menu_option ( int option ) void select ( int from=0, int to=-1 ) void select_all ( ) Theme Properties Color caret_color Color(0.95, 0.95, 0.95, 1) Color clear_button_color Color(0.875, 0.875, 0.875, 1) Color clear_button_color_pressed Color(1, 1, 1, 1) Color font_color Color(0.875, 0.875, 0.875, 1) Color font_outline_color Color(1, 1, 1, 1) Color font_placeholder_color Color(0.875, 0.875, 0.875, 0.6) Color font_selected_color Color(1, 1, 1, 1) Color font_uneditable_color Color(0.875, 0.875, 0.875, 0.5) Color selection_color Color(0.5, 0.5, 0.5, 1) int caret_width 1 int minimum_character_width 4 int outline_size 0 Font font int font_size Texture2D clear StyleBox focus StyleBox normal StyleBox read_only Signals text_change_rejected ( String rejected_substring ) Emitted when appending text that overflows the max_length. The appended text is truncated to fit max_length, and the part that couldn't fit is passed as the rejected_substring argument. text_changed ( String new_text ) Emitted when the text changes. text_submitted ( String new_text ) Emitted when the user presses @GlobalScope.KEY_ENTER on the LineEdit. Enumerations enum MenuItems: MenuItems MENU_CUT = 0 Cuts (copies and clears) the selected text. MenuItems MENU_COPY = 1 Copies the selected text. MenuItems MENU_PASTE = 2 Pastes the clipboard text over the selected text (or at the caret's position). Non-printable escape characters are automatically stripped from the OS clipboard via String.strip_escapes. MenuItems MENU_CLEAR = 3 Erases the whole LineEdit text. MenuItems MENU_SELECT_ALL = 4 Selects the whole LineEdit text. MenuItems MENU_UNDO = 5 Undoes the previous action. MenuItems MENU_REDO = 6 Reverse the last undo action. MenuItems MENU_SUBMENU_TEXT_DIR = 7 ID of "Text Writing Direction" submenu. MenuItems MENU_DIR_INHERITED = 8 Sets text direction to inherited. MenuItems MENU_DIR_AUTO = 9 Sets text direction to automatic. MenuItems MENU_DIR_LTR = 10 Sets text direction to left-to-right. MenuItems MENU_DIR_RTL = 11 Sets text direction to right-to-left. MenuItems MENU_DISPLAY_UCC = 12 Toggles control character display. MenuItems MENU_SUBMENU_INSERT_UCC = 13 ID of "Insert Control Character" submenu. MenuItems MENU_INSERT_LRM = 14 Inserts left-to-right mark (LRM) character. MenuItems MENU_INSERT_RLM = 15 Inserts right-to-left mark (RLM) character. MenuItems MENU_INSERT_LRE = 16 Inserts start of left-to-right embedding (LRE) character. MenuItems MENU_INSERT_RLE = 17 Inserts start of right-to-left embedding (RLE) character. MenuItems MENU_INSERT_LRO = 18 Inserts start of left-to-right override (LRO) character. MenuItems MENU_INSERT_RLO = 19 Inserts start of right-to-left override (RLO) character. MenuItems MENU_INSERT_PDF = 20 Inserts pop direction formatting (PDF) character. MenuItems MENU_INSERT_ALM = 21 Inserts Arabic letter mark (ALM) character. MenuItems MENU_INSERT_LRI = 22 Inserts left-to-right isolate (LRI) character. MenuItems MENU_INSERT_RLI = 23 Inserts right-to-left isolate (RLI) character. MenuItems MENU_INSERT_FSI = 24 Inserts first strong isolate (FSI) character. MenuItems MENU_INSERT_PDI = 25 Inserts pop direction isolate (PDI) character. MenuItems MENU_INSERT_ZWJ = 26 Inserts zero width joiner (ZWJ) character. MenuItems MENU_INSERT_ZWNJ = 27 Inserts zero width non-joiner (ZWNJ) character. MenuItems MENU_INSERT_WJ = 28 Inserts word joiner (WJ) character. MenuItems MENU_INSERT_SHY = 29 Inserts soft hyphen (SHY) character. MenuItems MENU_MAX = 30 Represents the size of the MenuItems enum. enum VirtualKeyboardType: VirtualKeyboardType KEYBOARD_TYPE_DEFAULT = 0 Default text virtual keyboard. VirtualKeyboardType KEYBOARD_TYPE_MULTILINE = 1 Multiline virtual keyboard. VirtualKeyboardType KEYBOARD_TYPE_NUMBER = 2 Virtual number keypad, useful for PIN entry. VirtualKeyboardType KEYBOARD_TYPE_NUMBER_DECIMAL = 3 Virtual number keypad, useful for entering fractional numbers. VirtualKeyboardType KEYBOARD_TYPE_PHONE = 4 Virtual phone number keypad. VirtualKeyboardType KEYBOARD_TYPE_EMAIL_ADDRESS = 5 Virtual keyboard with additional keys to assist with typing email addresses. VirtualKeyboardType KEYBOARD_TYPE_PASSWORD = 6 Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization. Note: This is not supported on Web. Instead, this behaves identically to KEYBOARD_TYPE_DEFAULT. VirtualKeyboardType KEYBOARD_TYPE_URL = 7 Virtual keyboard with additional keys to assist with typing URLs. Property Descriptions HorizontalAlignment alignment = 0 void set_horizontal_alignment ( HorizontalAlignment value ) HorizontalAlignment get_horizontal_alignment ( ) Text alignment as defined in the HorizontalAlignment enum. bool caret_blink = false void set_caret_blink_enabled ( bool value ) bool is_caret_blink_enabled ( ) If true, makes the caret blink. float caret_blink_interval = 0.65 void set_caret_blink_interval ( float value ) float get_caret_blink_interval ( ) The interval at which the caret blinks (in seconds). int caret_column = 0 void set_caret_column ( int value ) int get_caret_column ( ) The caret's column position inside the LineEdit. When set, the text may scroll to accommodate it. bool caret_force_displayed = false void set_caret_force_displayed ( bool value ) bool is_caret_force_displayed ( ) If true, the LineEdit will always show the caret, even if focus is lost. bool caret_mid_grapheme = false void set_caret_mid_grapheme_enabled ( bool value ) bool is_caret_mid_grapheme_enabled ( ) Allow moving caret, selecting and removing the individual composite character components. Note: Backspace is always removing individual composite character components. bool clear_button_enabled = false void set_clear_button_enabled ( bool value ) bool is_clear_button_enabled ( ) If true, the LineEdit will show a clear button if text is not empty, which can be used to clear the text quickly. bool context_menu_enabled = true void set_context_menu_enabled ( bool value ) bool is_context_menu_enabled ( ) If true, the context menu will appear when right-clicked. bool deselect_on_focus_loss_enabled = true void set_deselect_on_focus_loss_enabled ( bool value ) bool is_deselect_on_focus_loss_enabled ( ) If true, the selected text will be deselected when focus is lost. bool drag_and_drop_selection_enabled = true void set_drag_and_drop_selection_enabled ( bool value ) bool is_drag_and_drop_selection_enabled ( ) If true, allow drag and drop of selected text. bool draw_control_chars = false void set_draw_control_chars ( bool value ) bool get_draw_control_chars ( ) If true, control characters are displayed. bool editable = true void set_editable ( bool value ) bool is_editable ( ) If false, existing text cannot be modified and new text cannot be added. bool expand_to_text_length = false void set_expand_to_text_length_enabled ( bool value ) bool is_expand_to_text_length_enabled ( ) If true, the LineEdit width will increase to stay longer than the text. It will not compress if the text is shortened. bool flat = false void set_flat ( bool value ) bool is_flat ( ) If true, the LineEdit doesn't display decoration. String language = "" void set_language ( String value ) String get_language ( ) Language code used for line-breaking and text shaping algorithms. If left empty, current locale is used instead. int max_length = 0 void set_max_length ( int value ) int get_max_length ( ) Maximum number of characters that can be entered inside the LineEdit. If 0, there is no limit. When a limit is defined, characters that would exceed max_length are truncated. This happens both for existing text contents when setting the max length, or for new text inserted in the LineEdit, including pasting. If any input text is truncated, the text_change_rejected signal is emitted with the truncated substring as parameter. Example: GDScripttext = "Hello world" max_length = 5 # `text` becomes "Hello". max_length = 10 text += " goodbye" # `text` becomes "Hello good". # `text_change_rejected` is emitted with "bye" as parameter. C#Text = "Hello world"; MaxLength = 5; // `Text` becomes "Hello". MaxLength = 10; Text += " goodbye"; // `Text` becomes "Hello good". // `text_change_rejected` is emitted with "bye" as parameter. bool middle_mouse_paste_enabled = true void set_middle_mouse_paste_enabled ( bool value ) bool is_middle_mouse_paste_enabled ( ) If false, using middle mouse button to paste clipboard will be disabled. Note: This method is only implemented on Linux. String placeholder_text = "" void set_placeholder ( String value ) String get_placeholder ( ) Text shown when the LineEdit is empty. It is not the LineEdit's default value (see text). Texture2D right_icon void set_right_icon ( Texture2D value ) Texture2D get_right_icon ( ) Sets the icon that will appear in the right end of the LineEdit if there's no text, or always, if clear_button_enabled is set to false. bool secret = false void set_secret ( bool value ) bool is_secret ( ) If true, every character is replaced with the secret character (see secret_character). String secret_character = "•" void set_secret_character ( String value ) String get_secret_character ( ) The character to use to mask secret input. Only a single character can be used as the secret character. If it is longer than one character, only the first one will be used. If it is empty, a space will be used instead. bool select_all_on_focus = false void set_select_all_on_focus ( bool value ) bool is_select_all_on_focus ( ) If true, the LineEdit will select the whole text when it gains focus. bool selecting_enabled = true void set_selecting_enabled ( bool value ) bool is_selecting_enabled ( ) If false, it's impossible to select the text using mouse nor keyboard. bool shortcut_keys_enabled = true void set_shortcut_keys_enabled ( bool value ) bool is_shortcut_keys_enabled ( ) If false, using shortcuts will be disabled. StructuredTextParser structured_text_bidi_override = 0 void set_structured_text_bidi_override ( StructuredTextParser value ) StructuredTextParser get_structured_text_bidi_override ( ) Set BiDi algorithm override for the structured text. Array structured_text_bidi_override_options = [] void set_structured_text_bidi_override_options ( Array value ) Array get_structured_text_bidi_override_options ( ) Set additional options for BiDi override. String text = "" void set_text ( String value ) String get_text ( ) String value of the LineEdit. Note: Changing text using this property won't emit the text_changed signal. TextDirection text_direction = 0 void set_text_direction ( TextDirection value ) TextDirection get_text_direction ( ) Base text writing direction. bool virtual_keyboard_enabled = true void set_virtual_keyboard_enabled ( bool value ) bool is_virtual_keyboard_enabled ( ) If true, the native virtual keyboard is shown when focused on platforms that support it. VirtualKeyboardType virtual_keyboard_type = 0 void set_virtual_keyboard_type ( VirtualKeyboardType value ) VirtualKeyboardType get_virtual_keyboard_type ( ) Specifies the type of virtual keyboard to show. Method Descriptions void clear ( ) Erases the LineEdit's text. void delete_char_at_caret ( ) Deletes one character at the caret's current position (equivalent to pressing Delete). void delete_text ( int from_column, int to_column ) Deletes a section of the text going from position from_column to to_column. Both parameters should be within the text's length. void deselect ( ) Clears the current selection. PopupMenu get_menu ( ) const Returns the PopupMenu of this LineEdit. By default, this menu is displayed when right-clicking on the LineEdit. You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see MenuItems). For example: GDScriptfunc _ready(): var menu = get_menu() # Remove all items after "Redo". menu.item_count = menu.get_item_index(MENU_REDO) + 1 # Add custom items. menu.add_separator() menu.add_item("Insert Date", MENU_MAX + 1) # Connect callback. menu.id_pressed.connect(_on_item_pressed) func _on_item_pressed(id): if id == MENU_MAX + 1: insert_text_at_caret(Time.get_date_string_from_system()) C#public override void _Ready() { var menu = GetMenu(); // Remove all items after "Redo". menu.ItemCount = menu.GetItemIndex(LineEdit.MenuItems.Redo) + 1; // Add custom items. menu.AddSeparator(); menu.AddItem("Insert Date", LineEdit.MenuItems.Max + 1); // Add event handler. menu.IdPressed += OnItemPressed; } public void OnItemPressed(int id) { if (id == LineEdit.MenuItems.Max + 1) { InsertTextAtCaret(Time.GetDateStringFromSystem()); } } Warning: 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 Window.visible property. float get_scroll_offset ( ) const Returns the scroll offset due to caret_column, as a number of characters. String get_selected_text ( ) Returns the text inside the selection. int get_selection_from_column ( ) const Returns the selection begin column. int get_selection_to_column ( ) const Returns the selection end column. bool has_selection ( ) const Returns true if the user has selected text. void insert_text_at_caret ( String text ) Inserts text at the caret. If the resulting value is longer than max_length, nothing happens. bool is_menu_visible ( ) const Returns whether the menu is visible. Use this instead of get_menu().visible to improve performance (so the creation of the menu is avoided). void menu_option ( int option ) Executes a given action as defined in the MenuItems enum. void select ( int from=0, int to=-1 ) Selects characters inside LineEdit between from and to. By default, from is at the beginning and to at the end. GDScripttext = "Welcome" select() # Will select "Welcome". select(4) # Will select "ome". select(2, 5) # Will select "lco". C#Text = "Welcome"; Select(); // Will select "Welcome". Select(4); // Will select "ome". Select(2, 5); // Will select "lco". void select_all ( ) Selects the whole String. Theme Property Descriptions Color caret_color = Color(0.95, 0.95, 0.95, 1) Color of the LineEdit's caret (text cursor). This can be set to a fully transparent color to hide the caret entirely. Color clear_button_color = Color(0.875, 0.875, 0.875, 1) Color used as default tint for the clear button. Color clear_button_color_pressed = Color(1, 1, 1, 1) Color used for the clear button when it's pressed. Color font_color = Color(0.875, 0.875, 0.875, 1) Default font color. Color font_outline_color = Color(1, 1, 1, 1) The tint of text outline of the LineEdit. Color font_placeholder_color = Color(0.875, 0.875, 0.875, 0.6) Font color for placeholder_text. Color font_selected_color = Color(1, 1, 1, 1) Font color for selected text (inside the selection rectangle). Color font_uneditable_color = Color(0.875, 0.875, 0.875, 0.5) Font color when editing is disabled. Color selection_color = Color(0.5, 0.5, 0.5, 1) Color of the selection rectangle. int caret_width = 1 The caret's width in pixels. Greater values can be used to improve accessibility by ensuring the caret is easily visible, or to ensure consistency with a large font size. int minimum_character_width = 4 Minimum horizontal space for the text (not counting the clear button and content margins). This value is measured in count of 'M' characters (i.e. this number of 'M' characters can be displayed without scrolling). int outline_size = 0 The size of the text outline. Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended. Font font Font used for the text. int font_size Font size of the LineEdit's text. Texture2D clear Texture for the clear button. See clear_button_enabled. StyleBox focus Background used when LineEdit has GUI focus. The focus StyleBox is displayed over the base StyleBox, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons. StyleBox normal Default background for the LineEdit. StyleBox read_only Background used when LineEdit is in read-only mode (editable is set to false). © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_lineedit.html classes/class_occluderinstance3d ----------------------------------------------------------- OccluderInstance3D Inherits: Node3D < Node < Object Provides occlusion culling for 3D nodes, which improves performance in closed areas. Description Occlusion culling can improve rendering performance in closed/semi-open areas by hiding geometry that is occluded by other objects. The occlusion culling system is mostly static. OccluderInstance3Ds can be moved or hidden at run-time, but doing so will trigger a background recomputation that can take several frames. It is recommended to only move OccluderInstance3Ds sporadically (e.g. for procedural generation purposes), rather than doing so every frame. The occlusion culling system works by rendering the occluders on the CPU in parallel using Embree, drawing the result to a low-resolution buffer then using this to cull 3D nodes individually. In the 3D editor, you can preview the occlusion culling buffer by choosing Perspective > Debug Advanced... > Occlusion Culling Buffer in the top-left corner of the 3D viewport. The occlusion culling buffer quality can be adjusted in the Project Settings. Baking: Select an OccluderInstance3D node, then use the Bake Occluders button at the top of the 3D editor. Only opaque materials will be taken into account; transparent materials (alpha-blended or alpha-tested) will be ignored by the occluder generation. Note: Occlusion culling is only effective if ProjectSettings.rendering/occlusion_culling/use_occlusion_culling is true. Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it. Large open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges (GeometryInstance3D.visibility_range_begin and GeometryInstance3D.visibility_range_end) compared to occlusion culling. Note: Due to memory constraints, occlusion culling is not supported by default in Web export templates. It can be enabled by compiling custom Web export templates with module_raycast_enabled=yes. Tutorials Occlusion culling Properties int bake_mask 4294967295 float bake_simplification_distance 0.1 Occluder3D occluder Methods bool get_bake_mask_value ( int layer_number ) const void set_bake_mask_value ( int layer_number, bool value ) Property Descriptions int bake_mask = 4294967295 void set_bake_mask ( int value ) int get_bake_mask ( ) The visual layers to account for when baking for occluders. Only MeshInstance3Ds whose VisualInstance3D.layers match with this bake_mask will be included in the generated occluder mesh. By default, all objects with opaque materials are taken into account for the occluder baking. To improve performance and avoid artifacts, it is recommended to exclude dynamic objects, small objects and fixtures from the baking process by moving them to a separate visual layer and excluding this layer in bake_mask. float bake_simplification_distance = 0.1 void set_bake_simplification_distance ( float value ) float get_bake_simplification_distance ( ) The simplification distance to use for simplifying the generated occluder polygon (in 3D units). Higher values result in a less detailed occluder mesh, which improves performance but reduces culling accuracy. The occluder geometry is rendered on the CPU, so it is important to keep its geometry as simple as possible. Since the buffer is rendered at a low resolution, less detailed occluder meshes generally still work well. The default value is fairly aggressive, so you may have to decrease it if you run into false negatives (objects being occluded even though they are visible by the camera). A value of 0.01 will act conservatively, and will keep geometry perceptually unaffected in the occlusion culling buffer. Depending on the scene, a value of 0.01 may still simplify the mesh noticeably compared to disabling simplification entirely. Setting this to 0.0 disables simplification entirely, but vertices in the exact same position will still be merged. The mesh will also be re-indexed to reduce both the number of vertices and indices. Note: This uses the meshoptimizer library under the hood, similar to LOD generation. Occluder3D occluder void set_occluder ( Occluder3D value ) Occluder3D get_occluder ( ) The occluder resource for this OccluderInstance3D. You can generate an occluder resource by selecting an OccluderInstance3D node then using the Bake Occluders button at the top of the editor. You can also draw your own 2D occluder polygon by adding a new PolygonOccluder3D resource to the occluder property in the Inspector. Alternatively, you can select a primitive occluder to use: QuadOccluder3D, BoxOccluder3D or SphereOccluder3D. Method Descriptions bool get_bake_mask_value ( int layer_number ) const Returns whether or not the specified layer of the bake_mask is enabled, given a layer_number between 1 and 32. void set_bake_mask_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the bake_mask, given a layer_number between 1 and 32. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_occluderinstance3d.html classes/class_area2d ----------------------------------------------------------- Area2D Inherits: CollisionObject2D < Node2D < CanvasItem < Node < Object A region of 2D space that detects other CollisionObject2Ds entering or exiting it. Description Area2D is a region of 2D space defined by one or multiple CollisionShape2D or CollisionPolygon2D child nodes. It detects when other CollisionObject2Ds enter or exit it, and it also keeps track of which collision objects haven't exited it yet (i.e. which one are overlapping it). This node can also locally alter or override physics parameters (gravity, damping) and route audio to custom audio buses. Tutorials Using Area2D 2D Dodge The Creeps Demo 2D Pong Demo 2D Platformer Demo Properties float angular_damp 1.0 SpaceOverride angular_damp_space_override 0 StringName audio_bus_name &"Master" bool audio_bus_override false float gravity 980.0 Vector2 gravity_direction Vector2(0, 1) bool gravity_point false Vector2 gravity_point_center Vector2(0, 1) float gravity_point_unit_distance 0.0 SpaceOverride gravity_space_override 0 float linear_damp 0.1 SpaceOverride linear_damp_space_override 0 bool monitorable true bool monitoring true int priority 0 Methods Area2D[] get_overlapping_areas ( ) const Node2D[] get_overlapping_bodies ( ) const bool has_overlapping_areas ( ) const bool has_overlapping_bodies ( ) const bool overlaps_area ( Node area ) const bool overlaps_body ( Node body ) const Signals area_entered ( Area2D area ) Emitted when the received area enters this area. Requires monitoring to be set to true. area_exited ( Area2D area ) Emitted when the received area exits this area. Requires monitoring to be set to true. area_shape_entered ( RID area_rid, Area2D area, int area_shape_index, int local_shape_index ) Emitted when a Shape2D of the received area enters a shape of this area. Requires monitoring to be set to true. local_shape_index and area_shape_index contain indices of the interacting shapes from this area and the other area, respectively. area_rid contains the RID of the other area. These values can be used with the PhysicsServer2D. Example of getting the CollisionShape2D node from the shape index: GDScriptvar other_shape_owner = area.shape_find_owner(area_shape_index) var other_shape_node = area.shape_owner_get_owner(other_shape_owner) var local_shape_owner = shape_find_owner(local_shape_index) var local_shape_node = shape_owner_get_owner(local_shape_owner) area_shape_exited ( RID area_rid, Area2D area, int area_shape_index, int local_shape_index ) Emitted when a Shape2D of the received area exits a shape of this area. Requires monitoring to be set to true. See also area_shape_entered. body_entered ( Node2D body ) Emitted when the received body enters this area. body can be a PhysicsBody2D or a TileMap. TileMaps are detected if their TileSet has collision shapes configured. Requires monitoring to be set to true. body_exited ( Node2D body ) Emitted when the received body exits this area. body can be a PhysicsBody2D or a TileMap. TileMaps are detected if their TileSet has collision shapes configured. Requires monitoring to be set to true. body_shape_entered ( RID body_rid, Node2D body, int body_shape_index, int local_shape_index ) Emitted when a Shape2D of the received body enters a shape of this area. body can be a PhysicsBody2D or a TileMap. TileMaps are detected if their TileSet has collision shapes configured. Requires monitoring to be set to true. local_shape_index and body_shape_index contain indices of the interacting shapes from this area and the interacting body, respectively. body_rid contains the RID of the body. These values can be used with the PhysicsServer2D. Example of getting the CollisionShape2D node from the shape index: GDScriptvar body_shape_owner = body.shape_find_owner(body_shape_index) var body_shape_node = body.shape_owner_get_owner(body_shape_owner) var local_shape_owner = shape_find_owner(local_shape_index) var local_shape_node = shape_owner_get_owner(local_shape_owner) body_shape_exited ( RID body_rid, Node2D body, int body_shape_index, int local_shape_index ) Emitted when a Shape2D of the received body exits a shape of this area. body can be a PhysicsBody2D or a TileMap. TileMaps are detected if their TileSet has collision shapes configured. Requires monitoring to be set to true. See also body_shape_entered. Enumerations enum SpaceOverride: SpaceOverride SPACE_OVERRIDE_DISABLED = 0 This area does not affect gravity/damping. SpaceOverride SPACE_OVERRIDE_COMBINE = 1 This area adds its gravity/damping values to whatever has been calculated so far (in priority order). SpaceOverride SPACE_OVERRIDE_COMBINE_REPLACE = 2 This area adds its gravity/damping values to whatever has been calculated so far (in priority order), ignoring any lower priority areas. SpaceOverride SPACE_OVERRIDE_REPLACE = 3 This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas. SpaceOverride SPACE_OVERRIDE_REPLACE_COMBINE = 4 This area replaces any gravity/damping calculated so far (in priority order), but keeps calculating the rest of the areas. Property Descriptions float angular_damp = 1.0 void set_angular_damp ( float value ) float get_angular_damp ( ) The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. See ProjectSettings.physics/2d/default_angular_damp for more details about damping. SpaceOverride angular_damp_space_override = 0 void set_angular_damp_space_override_mode ( SpaceOverride value ) SpaceOverride get_angular_damp_space_override_mode ( ) Override mode for angular damping calculations within this area. See SpaceOverride for possible values. StringName audio_bus_name = &"Master" void set_audio_bus_name ( StringName value ) StringName get_audio_bus_name ( ) The name of the area's audio bus. bool audio_bus_override = false void set_audio_bus_override ( bool value ) bool is_overriding_audio_bus ( ) If true, the area's audio bus overrides the default audio bus. float gravity = 980.0 void set_gravity ( float value ) float get_gravity ( ) The area's gravity intensity (in pixels per second squared). This value multiplies the gravity direction. This is useful to alter the force of gravity without altering its direction. Vector2 gravity_direction = Vector2(0, 1) void set_gravity_direction ( Vector2 value ) Vector2 get_gravity_direction ( ) The area's gravity vector (not normalized). bool gravity_point = false void set_gravity_is_point ( bool value ) bool is_gravity_a_point ( ) If true, gravity is calculated from a point (set via gravity_point_center). See also gravity_space_override. Vector2 gravity_point_center = Vector2(0, 1) void set_gravity_point_center ( Vector2 value ) Vector2 get_gravity_point_center ( ) If gravity is a point (see gravity_point), this will be the point of attraction. float gravity_point_unit_distance = 0.0 void set_gravity_point_unit_distance ( float value ) float get_gravity_point_unit_distance ( ) The distance at which the gravity strength is equal to gravity. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on. The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance. SpaceOverride gravity_space_override = 0 void set_gravity_space_override_mode ( SpaceOverride value ) SpaceOverride get_gravity_space_override_mode ( ) Override mode for gravity calculations within this area. See SpaceOverride for possible values. float linear_damp = 0.1 void set_linear_damp ( float value ) float get_linear_damp ( ) The rate at which objects stop moving in this area. Represents the linear velocity lost per second. See ProjectSettings.physics/2d/default_linear_damp for more details about damping. SpaceOverride linear_damp_space_override = 0 void set_linear_damp_space_override_mode ( SpaceOverride value ) SpaceOverride get_linear_damp_space_override_mode ( ) Override mode for linear damping calculations within this area. See SpaceOverride for possible values. bool monitorable = true void set_monitorable ( bool value ) bool is_monitorable ( ) If true, other monitoring areas can detect this area. bool monitoring = true void set_monitoring ( bool value ) bool is_monitoring ( ) If true, the area detects bodies or areas entering and exiting it. int priority = 0 void set_priority ( int value ) int get_priority ( ) The area's priority. Higher priority areas are processed first. The World2D's physics is always processed last, after all areas. Method Descriptions Area2D[] get_overlapping_areas ( ) const Returns a list of intersecting Area2Ds. The overlapping area's CollisionObject2D.collision_layer must be part of this area's CollisionObject2D.collision_mask in order to be detected. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. Node2D[] get_overlapping_bodies ( ) const Returns a list of intersecting PhysicsBody2Ds and TileMaps. The overlapping body's CollisionObject2D.collision_layer must be part of this area's CollisionObject2D.collision_mask in order to be detected. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. bool has_overlapping_areas ( ) const Returns true if intersecting any Area2Ds, otherwise returns false. The overlapping area's CollisionObject2D.collision_layer must be part of this area's CollisionObject2D.collision_mask in order to be detected. For performance reasons (collisions are all processed at the same time) the list of overlapping areas is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. bool has_overlapping_bodies ( ) const Returns true if intersecting any PhysicsBody2Ds or TileMaps, otherwise returns false. The overlapping body's CollisionObject2D.collision_layer must be part of this area's CollisionObject2D.collision_mask in order to be detected. For performance reasons (collisions are all processed at the same time) the list of overlapping bodies is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. bool overlaps_area ( Node area ) const Returns true if the given Area2D intersects or overlaps this Area2D, false otherwise. Note: The result of this test is not immediate after moving objects. For performance, the list of overlaps is updated once per frame and before the physics step. Consider using signals instead. bool overlaps_body ( Node body ) const Returns true if the given physics body intersects or overlaps this Area2D, false otherwise. Note: The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead. The body argument can either be a PhysicsBody2D or a TileMap instance. While TileMaps are not physics bodies themselves, they register their tiles with collision shapes as a virtual physics body. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_area2d.html classes/class_csgpolygon3d ----------------------------------------------------------- CSGPolygon3D Inherits: CSGPrimitive3D < CSGShape3D < GeometryInstance3D < VisualInstance3D < Node3D < Node < Object Extrudes a 2D polygon shape to create a 3D mesh. Description An array of 2D points is extruded to quickly and easily create a variety of 3D meshes. See also CSGMesh3D for using 3D meshes as CSG nodes. Note: CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a significant CPU cost compared to creating a MeshInstance3D with a PrimitiveMesh. Moving a CSG node within another CSG node also has a significant CPU cost, so it should be avoided during gameplay. Tutorials Prototyping levels with CSG Properties float depth 1.0 Material material Mode mode 0 bool path_continuous_u float path_interval PathIntervalType path_interval_type bool path_joined bool path_local NodePath path_node PathRotation path_rotation float path_simplify_angle float path_u_distance PackedVector2Array polygon PackedVector2Array(0, 0, 0, 1, 1, 1, 1, 0) bool smooth_faces false float spin_degrees int spin_sides Enumerations enum Mode: Mode MODE_DEPTH = 0 The polygon shape is extruded along the negative Z axis. Mode MODE_SPIN = 1 The polygon shape is extruded by rotating it around the Y axis. Mode MODE_PATH = 2 The polygon shape is extruded along the Path3D specified in path_node. enum PathRotation: PathRotation PATH_ROTATION_POLYGON = 0 The polygon shape is not rotated. Note: Requires the path Z coordinates to continually decrease to ensure viable shapes. PathRotation PATH_ROTATION_PATH = 1 The polygon shape is rotated along the path, but it is not rotated around the path axis. Note: Requires the path Z coordinates to continually decrease to ensure viable shapes. PathRotation PATH_ROTATION_PATH_FOLLOW = 2 The polygon shape follows the path and its rotations around the path axis. enum PathIntervalType: PathIntervalType PATH_INTERVAL_DISTANCE = 0 When mode is set to MODE_PATH, path_interval will determine the distance, in meters, each interval of the path will extrude. PathIntervalType PATH_INTERVAL_SUBDIVIDE = 1 When mode is set to MODE_PATH, path_interval will subdivide the polygons along the path. Property Descriptions float depth = 1.0 void set_depth ( float value ) float get_depth ( ) When mode is MODE_DEPTH, the depth of the extrusion. Material material void set_material ( Material value ) Material get_material ( ) Material to use for the resulting mesh. The UV maps the top half of the material to the extruded shape (U along the length of the extrusions and V around the outline of the polygon), the bottom-left quarter to the front end face, and the bottom-right quarter to the back end face. Mode mode = 0 void set_mode ( Mode value ) Mode get_mode ( ) The mode used to extrude the polygon. bool path_continuous_u void set_path_continuous_u ( bool value ) bool is_path_continuous_u ( ) When mode is MODE_PATH, by default, the top half of the material is stretched along the entire length of the extruded shape. If false the top half of the material is repeated every step of the extrusion. float path_interval void set_path_interval ( float value ) float get_path_interval ( ) When mode is MODE_PATH, the path interval or ratio of path points to extrusions. PathIntervalType path_interval_type void set_path_interval_type ( PathIntervalType value ) PathIntervalType get_path_interval_type ( ) When mode is MODE_PATH, this will determine if the interval should be by distance (PATH_INTERVAL_DISTANCE) or subdivision fractions (PATH_INTERVAL_SUBDIVIDE). bool path_joined void set_path_joined ( bool value ) bool is_path_joined ( ) When mode is MODE_PATH, if true the ends of the path are joined, by adding an extrusion between the last and first points of the path. bool path_local void set_path_local ( bool value ) bool is_path_local ( ) When mode is MODE_PATH, if true the Transform3D of the CSGPolygon3D is used as the starting point for the extrusions, not the Transform3D of the path_node. NodePath path_node void set_path_node ( NodePath value ) NodePath get_path_node ( ) When mode is MODE_PATH, the location of the Path3D object used to extrude the polygon. PathRotation path_rotation void set_path_rotation ( PathRotation value ) PathRotation get_path_rotation ( ) When mode is MODE_PATH, the PathRotation method used to rotate the polygon as it is extruded. float path_simplify_angle void set_path_simplify_angle ( float value ) float get_path_simplify_angle ( ) When mode is MODE_PATH, extrusions that are less than this angle, will be merged together to reduce polygon count. float path_u_distance void set_path_u_distance ( float value ) float get_path_u_distance ( ) When mode is MODE_PATH, this is the distance along the path, in meters, the texture coordinates will tile. When set to 0, texture coordinates will match geometry exactly with no tiling. PackedVector2Array polygon = PackedVector2Array(0, 0, 0, 1, 1, 1, 1, 0) void set_polygon ( PackedVector2Array value ) PackedVector2Array get_polygon ( ) The point array that defines the 2D polygon that is extruded. This can be a convex or concave polygon with 3 or more points. The polygon must not have any intersecting edges. Otherwise, triangulation will fail and no mesh will be generated. Note: If only 1 or 2 points are defined in polygon, no mesh will be generated. bool smooth_faces = false void set_smooth_faces ( bool value ) bool get_smooth_faces ( ) If true, applies smooth shading to the extrusions. float spin_degrees void set_spin_degrees ( float value ) float get_spin_degrees ( ) When mode is MODE_SPIN, the total number of degrees the polygon is rotated when extruding. int spin_sides void set_spin_sides ( int value ) int get_spin_sides ( ) When mode is MODE_SPIN, the number of extrusions made. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_csgpolygon3d.html classes/class_voxelgi ----------------------------------------------------------- VoxelGI Inherits: VisualInstance3D < Node3D < Node < Object Real-time global illumination (GI) probe. Description VoxelGIs are used to provide high-quality real-time indirect light and reflections to scenes. They precompute the effect of objects that emit light and the effect of static geometry to simulate the behavior of complex light in real-time. VoxelGIs need to be baked before having a visible effect. However, once baked, dynamic objects will receive light from them. Furthermore, lights can be fully dynamic or baked. Note: VoxelGI is only supported in the Forward+ rendering method, not Mobile or Compatibility. Procedural generation: VoxelGI can be baked in an exported project, which makes it suitable for procedurally generated or user-built levels as long as all the geometry is generated in advance. For games where geometry is generated at any time during gameplay, SDFGI is more suitable (see Environment.sdfgi_enabled). Performance: VoxelGI is relatively demanding on the GPU and is not suited to low-end hardware such as integrated graphics (consider LightmapGI instead). To improve performance, adjust ProjectSettings.rendering/global_illumination/voxel_gi/quality and enable ProjectSettings.rendering/global_illumination/gi/use_half_resolution in the Project Settings. To provide a fallback for low-end hardware, consider adding an option to disable VoxelGI in your project's options menus. A VoxelGI node can be disabled by hiding it. Note: Meshes should have sufficiently thick walls to avoid light leaks (avoid one-sided walls). For interior levels, enclose your level geometry in a sufficiently large box and bridge the loops to close the mesh. To further prevent light leaks, you can also strategically place temporary MeshInstance3D nodes with their GeometryInstance3D.gi_mode set to GeometryInstance3D.GI_MODE_STATIC. These temporary nodes can then be hidden after baking the VoxelGI node. Tutorials Using Voxel global illumination Third Person Shooter Demo Properties CameraAttributes camera_attributes VoxelGIData data Vector3 size Vector3(20, 20, 20) Subdiv subdiv 1 Methods void bake ( Node from_node=null, bool create_visual_debug=false ) void debug_bake ( ) Enumerations enum Subdiv: Subdiv SUBDIV_64 = 0 Use 64 subdivisions. This is the lowest quality setting, but the fastest. Use it if you can, but especially use it on lower-end hardware. Subdiv SUBDIV_128 = 1 Use 128 subdivisions. This is the default quality setting. Subdiv SUBDIV_256 = 2 Use 256 subdivisions. Subdiv SUBDIV_512 = 3 Use 512 subdivisions. This is the highest quality setting, but the slowest. On lower-end hardware, this could cause the GPU to stall. Subdiv SUBDIV_MAX = 4 Represents the size of the Subdiv enum. Property Descriptions CameraAttributes camera_attributes void set_camera_attributes ( CameraAttributes value ) CameraAttributes get_camera_attributes ( ) The CameraAttributes resource that specifies exposure levels to bake at. Auto-exposure and non exposure properties will be ignored. Exposure settings should be used to reduce the dynamic range present when baking. If exposure is too high, the VoxelGI will have banding artifacts or may have over-exposure artifacts. VoxelGIData data void set_probe_data ( VoxelGIData value ) VoxelGIData get_probe_data ( ) The VoxelGIData resource that holds the data for this VoxelGI. Vector3 size = Vector3(20, 20, 20) void set_size ( Vector3 value ) Vector3 get_size ( ) The size of the area covered by the VoxelGI. If you make the size larger without increasing the subdivisions with subdiv, the size of each cell will increase and result in lower detailed lighting. Note: Size is clamped to 1.0 unit or more on each axis. Subdiv subdiv = 1 void set_subdiv ( Subdiv value ) Subdiv get_subdiv ( ) Number of times to subdivide the grid that the VoxelGI operates on. A higher number results in finer detail and thus higher visual quality, while lower numbers result in better performance. Method Descriptions void bake ( Node from_node=null, bool create_visual_debug=false ) Bakes the effect from all GeometryInstance3Ds marked with GeometryInstance3D.GI_MODE_STATIC and Light3Ds marked with either Light3D.BAKE_STATIC or Light3D.BAKE_DYNAMIC. If create_visual_debug is true, after baking the light, this will generate a MultiMesh that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the VoxelGI's data and debug any issues that may be occurring. Note: bake works from the editor and in exported projects. This makes it suitable for procedurally generated or user-built levels. Baking a VoxelGI node generally takes from 5 to 20 seconds in most scenes. Reducing subdiv can speed up baking. Note: GeometryInstance3Ds and Light3Ds must be fully ready before bake is called. If you are procedurally creating those and some meshes or lights are missing from your baked VoxelGI, use call_deferred("bake") instead of calling bake directly. void debug_bake ( ) Calls bake with create_visual_debug enabled. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_voxelgi.html classes/class_label3d ----------------------------------------------------------- Label3D Inherits: GeometryInstance3D < VisualInstance3D < Node3D < Node < Object A node for displaying plain text in 3D space. Description A node for displaying plain text in 3D space. By adjusting various properties of this node, you can configure things such as the text's appearance and whether it always faces the camera. Tutorials 3D text Properties float alpha_antialiasing_edge 0.0 AlphaAntiAliasing alpha_antialiasing_mode 0 AlphaCutMode alpha_cut 0 float alpha_hash_scale 1.0 float alpha_scissor_threshold 0.5 AutowrapMode autowrap_mode 0 BillboardMode billboard 0 ShadowCastingSetting cast_shadow 0 (overrides GeometryInstance3D) bool double_sided true bool fixed_size false Font font int font_size 32 GIMode gi_mode 0 (overrides GeometryInstance3D) HorizontalAlignment horizontal_alignment 1 BitField justification_flags 163 String language "" float line_spacing 0.0 Color modulate Color(1, 1, 1, 1) bool no_depth_test false Vector2 offset Vector2(0, 0) Color outline_modulate Color(0, 0, 0, 1) int outline_render_priority -1 int outline_size 12 float pixel_size 0.005 int render_priority 0 bool shaded false StructuredTextParser structured_text_bidi_override 0 Array structured_text_bidi_override_options [] String text "" Direction text_direction 0 TextureFilter texture_filter 3 bool uppercase false VerticalAlignment vertical_alignment 1 float width 500.0 Methods TriangleMesh generate_triangle_mesh ( ) const bool get_draw_flag ( DrawFlags flag ) const void set_draw_flag ( DrawFlags flag, bool enabled ) Enumerations enum DrawFlags: DrawFlags FLAG_SHADED = 0 If set, lights in the environment affect the label. DrawFlags FLAG_DOUBLE_SIDED = 1 If set, text can be seen from the back as well. If not, the text is invisible when looking at it from behind. DrawFlags FLAG_DISABLE_DEPTH_TEST = 2 Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it. DrawFlags FLAG_FIXED_SIZE = 3 Label is scaled by depth so that it always appears the same size on screen. DrawFlags FLAG_MAX = 4 Represents the size of the DrawFlags enum. enum AlphaCutMode: AlphaCutMode ALPHA_CUT_DISABLED = 0 This mode performs standard alpha blending. It can display translucent areas, but transparency sorting issues may be visible when multiple transparent materials are overlapping. GeometryInstance3D.cast_shadow has no effect when this transparency mode is used; the Label3D will never cast shadows. AlphaCutMode ALPHA_CUT_DISCARD = 1 This mode only allows fully transparent or fully opaque pixels. Harsh edges will be visible unless some form of screen-space antialiasing is enabled (see ProjectSettings.rendering/anti_aliasing/quality/screen_space_aa). This mode is also known as alpha testing or 1-bit transparency. Note: This mode might have issues with anti-aliased fonts and outlines, try adjusting alpha_scissor_threshold or using MSDF font. Note: When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline. AlphaCutMode ALPHA_CUT_OPAQUE_PREPASS = 2 This mode draws fully opaque pixels in the depth prepass. This is slower than ALPHA_CUT_DISABLED or ALPHA_CUT_DISCARD, but it allows displaying translucent areas and smooth edges while using proper sorting. Note: When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline. AlphaCutMode ALPHA_CUT_HASH = 3 This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque. Property Descriptions float alpha_antialiasing_edge = 0.0 void set_alpha_antialiasing_edge ( float value ) float get_alpha_antialiasing_edge ( ) Threshold at which antialiasing will be applied on the alpha channel. AlphaAntiAliasing alpha_antialiasing_mode = 0 void set_alpha_antialiasing ( AlphaAntiAliasing value ) AlphaAntiAliasing get_alpha_antialiasing ( ) The type of alpha antialiasing to apply. See AlphaAntiAliasing. AlphaCutMode alpha_cut = 0 void set_alpha_cut_mode ( AlphaCutMode value ) AlphaCutMode get_alpha_cut_mode ( ) The alpha cutting mode to use for the sprite. See AlphaCutMode for possible values. float alpha_hash_scale = 1.0 void set_alpha_hash_scale ( float value ) float get_alpha_hash_scale ( ) The hashing scale for Alpha Hash. Recommended values between 0 and 2. float alpha_scissor_threshold = 0.5 void set_alpha_scissor_threshold ( float value ) float get_alpha_scissor_threshold ( ) Threshold at which the alpha scissor will discard values. AutowrapMode autowrap_mode = 0 void set_autowrap_mode ( AutowrapMode value ) AutowrapMode get_autowrap_mode ( ) If set to something other than TextServer.AUTOWRAP_OFF, the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see AutowrapMode. BillboardMode billboard = 0 void set_billboard_mode ( BillboardMode value ) BillboardMode get_billboard_mode ( ) The billboard mode to use for the label. See BillboardMode for possible values. bool double_sided = true void set_draw_flag ( DrawFlags flag, bool enabled ) bool get_draw_flag ( DrawFlags flag ) const If true, text can be seen from the back as well, if false, it is invisible when looking at it from behind. bool fixed_size = false void set_draw_flag ( DrawFlags flag, bool enabled ) bool get_draw_flag ( DrawFlags flag ) const If true, the label is rendered at the same size regardless of distance. Font font void set_font ( Font value ) Font get_font ( ) Font configuration used to display text. int font_size = 32 void set_font_size ( int value ) int get_font_size ( ) Font size of the Label3D's text. To make the font look more detailed when up close, increase font_size while decreasing pixel_size at the same time. Higher font sizes require more time to render new characters, which can cause stuttering during gameplay. HorizontalAlignment horizontal_alignment = 1 void set_horizontal_alignment ( HorizontalAlignment value ) HorizontalAlignment get_horizontal_alignment ( ) Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the HorizontalAlignment constants. BitField justification_flags = 163 void set_justification_flags ( BitField value ) BitField get_justification_flags ( ) Line fill alignment rules. For more info see JustificationFlag. String language = "" void set_language ( String value ) String get_language ( ) Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. float line_spacing = 0.0 void set_line_spacing ( float value ) float get_line_spacing ( ) Vertical space between lines in multiline Label3D. Color modulate = Color(1, 1, 1, 1) void set_modulate ( Color value ) Color get_modulate ( ) Text Color of the Label3D. bool no_depth_test = false void set_draw_flag ( DrawFlags flag, bool enabled ) bool get_draw_flag ( DrawFlags flag ) const If true, depth testing is disabled and the object will be drawn in render order. Vector2 offset = Vector2(0, 0) void set_offset ( Vector2 value ) Vector2 get_offset ( ) The text drawing offset (in pixels). Color outline_modulate = Color(0, 0, 0, 1) void set_outline_modulate ( Color value ) Color get_outline_modulate ( ) The tint of text outline. int outline_render_priority = -1 void set_outline_render_priority ( int value ) int get_outline_render_priority ( ) Sets the render priority for the text outline. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies if alpha_cut is set to ALPHA_CUT_DISABLED (default value). Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority). int outline_size = 12 void set_outline_size ( int value ) int get_outline_size ( ) Text outline size. float pixel_size = 0.005 void set_pixel_size ( float value ) float get_pixel_size ( ) The size of one pixel's width on the label to scale it in 3D. To make the font look more detailed when up close, increase font_size while decreasing pixel_size at the same time. int render_priority = 0 void set_render_priority ( int value ) int get_render_priority ( ) Sets the render priority for the text. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies if alpha_cut is set to ALPHA_CUT_DISABLED (default value). Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority). bool shaded = false void set_draw_flag ( DrawFlags flag, bool enabled ) bool get_draw_flag ( DrawFlags flag ) const If true, the Light3D in the Environment has effects on the label. StructuredTextParser structured_text_bidi_override = 0 void set_structured_text_bidi_override ( StructuredTextParser value ) StructuredTextParser get_structured_text_bidi_override ( ) Set BiDi algorithm override for the structured text. Array structured_text_bidi_override_options = [] void set_structured_text_bidi_override_options ( Array value ) Array get_structured_text_bidi_override_options ( ) Set additional options for BiDi override. String text = "" void set_text ( String value ) String get_text ( ) The text to display on screen. Direction text_direction = 0 void set_text_direction ( Direction value ) Direction get_text_direction ( ) Base text writing direction. TextureFilter texture_filter = 3 void set_texture_filter ( TextureFilter value ) TextureFilter get_texture_filter ( ) Filter flags for the texture. See TextureFilter for options. bool uppercase = false void set_uppercase ( bool value ) bool is_uppercase ( ) If true, all the text displays as UPPERCASE. VerticalAlignment vertical_alignment = 1 void set_vertical_alignment ( VerticalAlignment value ) VerticalAlignment get_vertical_alignment ( ) Controls the text's vertical alignment. Supports top, center, bottom. Set it to one of the VerticalAlignment constants. float width = 500.0 void set_width ( float value ) float get_width ( ) Text width (in pixels), used for autowrap and fill alignment. Method Descriptions TriangleMesh generate_triangle_mesh ( ) const Returns a TriangleMesh with the label's vertices following its current configuration (such as its pixel_size). bool get_draw_flag ( DrawFlags flag ) const Returns the value of the specified flag. void set_draw_flag ( DrawFlags flag, bool enabled ) If true, the specified flag will be enabled. See DrawFlags for a list of flags. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_label3d.html classes/class_audiostreamgenerator ----------------------------------------------------------- AudioStreamGenerator Inherits: AudioStream < Resource < RefCounted < Object An audio stream with utilities for procedural sound generation. Description AudioStreamGenerator is a type of audio stream that does not play back sounds on its own; instead, it expects a script to generate audio data for it. See also AudioStreamGeneratorPlayback. Here's a sample on how to use it to generate a sine wave: GDScriptvar playback # Will hold the AudioStreamGeneratorPlayback. @onready var sample_hz = $AudioStreamPlayer.stream.mix_rate var pulse_hz = 440.0 # The frequency of the sound wave. func _ready(): $AudioStreamPlayer.play() playback = $AudioStreamPlayer.get_stream_playback() fill_buffer() func fill_buffer(): var phase = 0.0 var increment = pulse_hz / sample_hz var frames_available = playback.get_frames_available() for i in range(frames_available): playback.push_frame(Vector2.ONE * sin(phase * TAU)) phase = fmod(phase + increment, 1.0) C#[Export] public AudioStreamPlayer Player { get; set; } private AudioStreamGeneratorPlayback _playback; // Will hold the AudioStreamGeneratorPlayback. private float _sampleHz; private float _pulseHz = 440.0f; // The frequency of the sound wave. public override void _Ready() { if (Player.Stream is AudioStreamGenerator generator) // Type as a generator to access MixRate. { _sampleHz = generator.MixRate; Player.Play(); _playback = (AudioStreamGeneratorPlayback)Player.GetStreamPlayback(); FillBuffer(); } } public void FillBuffer() { double phase = 0.0; float increment = _pulseHz / _sampleHz; int framesAvailable = _playback.GetFramesAvailable(); for (int i = 0; i < framesAvailable; i++) { _playback.PushFrame(Vector2.One * (float)Mathf.Sin(phase * Mathf.Tau)); phase = Mathf.PosMod(phase + increment, 1.0); } } In the example above, the "AudioStreamPlayer" node must use an AudioStreamGenerator as its stream. The fill_buffer function provides audio data for approximating a sine wave. See also AudioEffectSpectrumAnalyzer for performing real-time audio spectrum analysis. Note: Due to performance constraints, this class is best used from C# or from a compiled language via GDExtension. If you still want to use this class from GDScript, consider using a lower mix_rate such as 11,025 Hz or 22,050 Hz. Tutorials Audio Generator Demo Properties float buffer_length 0.5 float mix_rate 44100.0 Property Descriptions float buffer_length = 0.5 void set_buffer_length ( float value ) float get_buffer_length ( ) The length of the buffer to generate (in seconds). Lower values result in less latency, but require the script to generate audio data faster, resulting in increased CPU usage and more risk for audio cracking if the CPU can't keep up. float mix_rate = 44100.0 void set_mix_rate ( float value ) float get_mix_rate ( ) The sample rate to use (in Hz). Higher values are more demanding for the CPU to generate, but result in better quality. In games, common sample rates in use are 11025, 16000, 22050, 32000, 44100, and 48000. According to the Nyquist-Shannon sampling theorem, there is no quality difference to human hearing when going past 40,000 Hz (since most humans can only hear up to ~20,000 Hz, often less). If you are generating lower-pitched sounds such as voices, lower sample rates such as 32000 or 22050 may be usable with no loss in quality. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_audiostreamgenerator.html classes/class_label ----------------------------------------------------------- Label Inherits: Control < CanvasItem < Node < Object A control for displaying plain text. Description A control for displaying plain text. It gives you control over the horizontal and vertical alignment and can wrap the text inside the node's bounding rectangle. It doesn't support bold, italics, or other rich text formatting. For that, use RichTextLabel instead. Tutorials 2D Dodge The Creeps Demo Properties AutowrapMode autowrap_mode 0 bool clip_text false HorizontalAlignment horizontal_alignment 0 BitField justification_flags 163 LabelSettings label_settings String language "" int lines_skipped 0 int max_lines_visible -1 MouseFilter mouse_filter 2 (overrides Control) BitField size_flags_vertical 4 (overrides Control) StructuredTextParser structured_text_bidi_override 0 Array structured_text_bidi_override_options [] PackedFloat32Array tab_stops PackedFloat32Array() String text "" TextDirection text_direction 0 OverrunBehavior text_overrun_behavior 0 bool uppercase false VerticalAlignment vertical_alignment 0 int visible_characters -1 VisibleCharactersBehavior visible_characters_behavior 0 float visible_ratio 1.0 Methods int get_line_count ( ) const int get_line_height ( int line=-1 ) const int get_total_character_count ( ) const int get_visible_line_count ( ) const Theme Properties Color font_color Color(1, 1, 1, 1) Color font_outline_color Color(1, 1, 1, 1) Color font_shadow_color Color(0, 0, 0, 0) int line_spacing 3 int outline_size 0 int shadow_offset_x 1 int shadow_offset_y 1 int shadow_outline_size 1 Font font int font_size StyleBox normal Property Descriptions AutowrapMode autowrap_mode = 0 void set_autowrap_mode ( AutowrapMode value ) AutowrapMode get_autowrap_mode ( ) If set to something other than TextServer.AUTOWRAP_OFF, the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see AutowrapMode. bool clip_text = false void set_clip_text ( bool value ) bool is_clipping_text ( ) If true, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally. HorizontalAlignment horizontal_alignment = 0 void set_horizontal_alignment ( HorizontalAlignment value ) HorizontalAlignment get_horizontal_alignment ( ) Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the HorizontalAlignment constants. BitField justification_flags = 163 void set_justification_flags ( BitField value ) BitField get_justification_flags ( ) Line fill alignment rules. For more info see JustificationFlag. LabelSettings label_settings void set_label_settings ( LabelSettings value ) LabelSettings get_label_settings ( ) A LabelSettings resource that can be shared between multiple Label nodes. Takes priority over theme properties. String language = "" void set_language ( String value ) String get_language ( ) Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. int lines_skipped = 0 void set_lines_skipped ( int value ) int get_lines_skipped ( ) The number of the lines ignored and not displayed from the start of the text value. int max_lines_visible = -1 void set_max_lines_visible ( int value ) int get_max_lines_visible ( ) Limits the lines of text the node shows on screen. StructuredTextParser structured_text_bidi_override = 0 void set_structured_text_bidi_override ( StructuredTextParser value ) StructuredTextParser get_structured_text_bidi_override ( ) Set BiDi algorithm override for the structured text. Array structured_text_bidi_override_options = [] void set_structured_text_bidi_override_options ( Array value ) Array get_structured_text_bidi_override_options ( ) Set additional options for BiDi override. PackedFloat32Array tab_stops = PackedFloat32Array() void set_tab_stops ( PackedFloat32Array value ) PackedFloat32Array get_tab_stops ( ) Aligns text to the given tab-stops. String text = "" void set_text ( String value ) String get_text ( ) The text to display on screen. TextDirection text_direction = 0 void set_text_direction ( TextDirection value ) TextDirection get_text_direction ( ) Base text writing direction. OverrunBehavior text_overrun_behavior = 0 void set_text_overrun_behavior ( OverrunBehavior value ) OverrunBehavior get_text_overrun_behavior ( ) Sets the clipping behavior when the text exceeds the node's bounding rectangle. See OverrunBehavior for a description of all modes. bool uppercase = false void set_uppercase ( bool value ) bool is_uppercase ( ) If true, all the text displays as UPPERCASE. VerticalAlignment vertical_alignment = 0 void set_vertical_alignment ( VerticalAlignment value ) VerticalAlignment get_vertical_alignment ( ) Controls the text's vertical alignment. Supports top, center, bottom, and fill. Set it to one of the VerticalAlignment constants. int visible_characters = -1 void set_visible_characters ( int value ) int get_visible_characters ( ) The number of characters to display. If set to -1, all characters are displayed. This can be useful when animating the text appearing in a dialog box. Note: Setting this property updates visible_ratio accordingly. VisibleCharactersBehavior visible_characters_behavior = 0 void set_visible_characters_behavior ( VisibleCharactersBehavior value ) VisibleCharactersBehavior get_visible_characters_behavior ( ) Sets the clipping behavior when visible_characters or visible_ratio is set. See VisibleCharactersBehavior for more info. float visible_ratio = 1.0 void set_visible_ratio ( float value ) float get_visible_ratio ( ) The fraction of characters to display, relative to the total number of characters (see get_total_character_count). If set to 1.0, all characters are displayed. If set to 0.5, only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box. Note: Setting this property updates visible_characters accordingly. Method Descriptions int get_line_count ( ) const Returns the number of lines of text the Label has. int get_line_height ( int line=-1 ) const Returns the height of the line line. If line is set to -1, returns the biggest line height. If there are no lines, returns font size in pixels. int get_total_character_count ( ) const Returns the total number of printable characters in the text (excluding spaces and newlines). int get_visible_line_count ( ) const Returns the number of lines shown. Useful if the Label's height cannot currently display all lines. Theme Property Descriptions Color font_color = Color(1, 1, 1, 1) Default text Color of the Label. Color font_outline_color = Color(1, 1, 1, 1) The color of text outline. Color font_shadow_color = Color(0, 0, 0, 0) Color of the text's shadow effect. int line_spacing = 3 Vertical space between lines in multiline Label. int outline_size = 0 Text outline size. Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended. Note: Using a value that is larger than half the font size is not recommended, as the font outline may fail to be fully closed in this case. int shadow_offset_x = 1 The horizontal offset of the text's shadow. int shadow_offset_y = 1 The vertical offset of the text's shadow. int shadow_outline_size = 1 The size of the shadow outline. Font font Font used for the Label's text. int font_size Font size of the Label's text. StyleBox normal Background StyleBox for the Label. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_label.html classes/class_editornode3dgizmoplugin ----------------------------------------------------------- EditorNode3DGizmoPlugin Inherits: Resource < RefCounted < Object A class used by the editor to define Node3D gizmo types. Description EditorNode3DGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending EditorNode3DGizmoPlugin for the simpler gizmos, or creating a new EditorNode3DGizmo type. See the tutorial in the documentation for more info. To use EditorNode3DGizmoPlugin, register it using the EditorPlugin.add_node_3d_gizmo_plugin method first. Tutorials Node3D gizmo plugins Methods void _begin_handle_action ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual bool _can_be_hidden ( ) virtual const void _commit_handle ( EditorNode3DGizmo gizmo, int handle_id, bool secondary, Variant restore, bool cancel ) virtual void _commit_subgizmos ( EditorNode3DGizmo gizmo, PackedInt32Array ids, Transform3D[] restores, bool cancel ) virtual EditorNode3DGizmo _create_gizmo ( Node3D for_node_3d ) virtual const String _get_gizmo_name ( ) virtual const String _get_handle_name ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const Variant _get_handle_value ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const int _get_priority ( ) virtual const Transform3D _get_subgizmo_transform ( EditorNode3DGizmo gizmo, int subgizmo_id ) virtual const bool _has_gizmo ( Node3D for_node_3d ) virtual const bool _is_handle_highlighted ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const bool _is_selectable_when_hidden ( ) virtual const void _redraw ( EditorNode3DGizmo gizmo ) virtual void _set_handle ( EditorNode3DGizmo gizmo, int handle_id, bool secondary, Camera3D camera, Vector2 screen_pos ) virtual void _set_subgizmo_transform ( EditorNode3DGizmo gizmo, int subgizmo_id, Transform3D transform ) virtual PackedInt32Array _subgizmos_intersect_frustum ( EditorNode3DGizmo gizmo, Camera3D camera, Plane[] frustum_planes ) virtual const int _subgizmos_intersect_ray ( EditorNode3DGizmo gizmo, Camera3D camera, Vector2 screen_pos ) virtual const void add_material ( String name, StandardMaterial3D material ) void create_handle_material ( String name, bool billboard=false, Texture2D texture=null ) void create_icon_material ( String name, Texture2D texture, bool on_top=false, Color color=Color(1, 1, 1, 1) ) void create_material ( String name, Color color, bool billboard=false, bool on_top=false, bool use_vertex_color=false ) StandardMaterial3D get_material ( String name, EditorNode3DGizmo gizmo=null ) Method Descriptions void _begin_handle_action ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual There is currently no description for this method. Please help us by contributing one! bool _can_be_hidden ( ) virtual const Override this method to define whether the gizmos handled by this plugin can be hidden or not. Returns true if not overridden. void _commit_handle ( EditorNode3DGizmo gizmo, int handle_id, bool secondary, Variant restore, bool cancel ) virtual Override this method to commit a handle being edited (handles must have been previously added by EditorNode3DGizmo.add_handles during _redraw). This usually means creating an UndoRedo action for the change, using the current handle value as "do" and the restore argument as "undo". If the cancel argument is true, the restore value should be directly set, without any UndoRedo action. The secondary argument is true when the committed handle is secondary (see EditorNode3DGizmo.add_handles for more information). Called for this plugin's active gizmos. void _commit_subgizmos ( EditorNode3DGizmo gizmo, PackedInt32Array ids, Transform3D[] restores, bool cancel ) virtual Override this method to commit a group of subgizmos being edited (see _subgizmos_intersect_ray and _subgizmos_intersect_frustum). This usually means creating an UndoRedo action for the change, using the current transforms as "do" and the restores transforms as "undo". If the cancel argument is true, the restores transforms should be directly set, without any UndoRedo action. As with all subgizmo methods, transforms are given in local space respect to the gizmo's Node3D. Called for this plugin's active gizmos. EditorNode3DGizmo _create_gizmo ( Node3D for_node_3d ) virtual const Override this method to return a custom EditorNode3DGizmo for the spatial nodes of your choice, return null for the rest of nodes. See also _has_gizmo. String _get_gizmo_name ( ) virtual const Override this method to provide the name that will appear in the gizmo visibility menu. String _get_handle_name ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const Override this method to provide gizmo's handle names. The secondary argument is true when the requested handle is secondary (see EditorNode3DGizmo.add_handles for more information). Called for this plugin's active gizmos. Variant _get_handle_value ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const Override this method to return the current value of a handle. This value will be requested at the start of an edit and used as the restore argument in _commit_handle. The secondary argument is true when the requested handle is secondary (see EditorNode3DGizmo.add_handles for more information). Called for this plugin's active gizmos. int _get_priority ( ) virtual const Override this method to set the gizmo's priority. Gizmos with higher priority will have precedence when processing inputs like handles or subgizmos selection. All built-in editor gizmos return a priority of -1. If not overridden, this method will return 0, which means custom gizmos will automatically get higher priority than built-in gizmos. Transform3D _get_subgizmo_transform ( EditorNode3DGizmo gizmo, int subgizmo_id ) virtual const Override this method to return the current transform of a subgizmo. As with all subgizmo methods, the transform should be in local space respect to the gizmo's Node3D. This transform will be requested at the start of an edit and used in the restore argument in _commit_subgizmos. Called for this plugin's active gizmos. bool _has_gizmo ( Node3D for_node_3d ) virtual const Override this method to define which Node3D nodes have a gizmo from this plugin. Whenever a Node3D node is added to a scene this method is called, if it returns true the node gets a generic EditorNode3DGizmo assigned and is added to this plugin's list of active gizmos. bool _is_handle_highlighted ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const Override this method to return true whenever to given handle should be highlighted in the editor. The secondary argument is true when the requested handle is secondary (see EditorNode3DGizmo.add_handles for more information). Called for this plugin's active gizmos. bool _is_selectable_when_hidden ( ) virtual const Override this method to define whether Node3D with this gizmo should be selectable even when the gizmo is hidden. void _redraw ( EditorNode3DGizmo gizmo ) virtual Override this method to add all the gizmo elements whenever a gizmo update is requested. It's common to call EditorNode3DGizmo.clear at the beginning of this method and then add visual elements depending on the node's properties. void _set_handle ( EditorNode3DGizmo gizmo, int handle_id, bool secondary, Camera3D camera, Vector2 screen_pos ) virtual Override this method to update the node's properties when the user drags a gizmo handle (previously added with EditorNode3DGizmo.add_handles). The provided screen_pos is the mouse position in screen coordinates and the camera can be used to convert it to raycasts. The secondary argument is true when the edited handle is secondary (see EditorNode3DGizmo.add_handles for more information). Called for this plugin's active gizmos. void _set_subgizmo_transform ( EditorNode3DGizmo gizmo, int subgizmo_id, Transform3D transform ) virtual Override this method to update the node properties during subgizmo editing (see _subgizmos_intersect_ray and _subgizmos_intersect_frustum). The transform is given in the Node3D's local coordinate system. Called for this plugin's active gizmos. PackedInt32Array _subgizmos_intersect_frustum ( EditorNode3DGizmo gizmo, Camera3D camera, Plane[] frustum_planes ) virtual const Override this method to allow selecting subgizmos using mouse drag box selection. Given a camera and frustum_planes, this method should return which subgizmos are contained within the frustums. The frustum_planes argument consists of an array with all the Planes that make up the selection frustum. The returned value should contain a list of unique subgizmo identifiers, these identifiers can have any non-negative value and will be used in other virtual methods like _get_subgizmo_transform or _commit_subgizmos. Called for this plugin's active gizmos. int _subgizmos_intersect_ray ( EditorNode3DGizmo gizmo, Camera3D camera, Vector2 screen_pos ) virtual const Override this method to allow selecting subgizmos using mouse clicks. Given a camera and a screen_pos in screen coordinates, this method should return which subgizmo should be selected. The returned value should be a unique subgizmo identifier, which can have any non-negative value and will be used in other virtual methods like _get_subgizmo_transform or _commit_subgizmos. Called for this plugin's active gizmos. void add_material ( String name, StandardMaterial3D material ) Adds a new material to the internal material list for the plugin. It can then be accessed with get_material. Should not be overridden. void create_handle_material ( String name, bool billboard=false, Texture2D texture=null ) Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with get_material and used in EditorNode3DGizmo.add_handles. Should not be overridden. You can optionally provide a texture to use instead of the default icon. void create_icon_material ( String name, Texture2D texture, bool on_top=false, Color color=Color(1, 1, 1, 1) ) Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with get_material and used in EditorNode3DGizmo.add_unscaled_billboard. Should not be overridden. void create_material ( String name, Color color, bool billboard=false, bool on_top=false, bool use_vertex_color=false ) Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with get_material and used in EditorNode3DGizmo.add_mesh and EditorNode3DGizmo.add_lines. Should not be overridden. StandardMaterial3D get_material ( String name, EditorNode3DGizmo gizmo=null ) Gets material from the internal list of materials. If an EditorNode3DGizmo is provided, it will try to get the corresponding variant (selected and/or editable). © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_editornode3dgizmoplugin.html classes/class_animatedtexture ----------------------------------------------------------- AnimatedTexture Inherits: Texture2D < Texture < Resource < RefCounted < Object Proxy texture for simple frame-based animations. Description AnimatedTexture is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike AnimationPlayer or AnimatedSprite2D, it isn't a Node, but has the advantage of being usable anywhere a Texture2D resource can be used, e.g. in a TileSet. The playback of the animation is controlled by the speed_scale property, as well as each frame's duration (see set_frame_duration). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame. AnimatedTexture currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one. Note: AnimatedTexture doesn't support using AtlasTextures. Each frame needs to be a separate Texture2D. Warning: The current implementation is not efficient for the modern renderers. Deprecated. This class is deprecated, and might be removed in a future release. Properties int current_frame int frames 1 bool one_shot false bool pause false bool resource_local_to_scene false (overrides Resource) float speed_scale 1.0 Methods float get_frame_duration ( int frame ) const Texture2D get_frame_texture ( int frame ) const void set_frame_duration ( int frame, float duration ) void set_frame_texture ( int frame, Texture2D texture ) Constants MAX_FRAMES = 256 The maximum number of frames supported by AnimatedTexture. If you need more frames in your animation, use AnimationPlayer or AnimatedSprite2D. Property Descriptions int current_frame void set_current_frame ( int value ) int get_current_frame ( ) Sets the currently visible frame of the texture. Setting this frame while playing resets the current frame time, so the newly selected frame plays for its whole configured frame duration. int frames = 1 void set_frames ( int value ) int get_frames ( ) Number of frames to use in the animation. While you can create the frames independently with set_frame_texture, you need to set this value for the animation to take new frames into account. The maximum number of frames is MAX_FRAMES. bool one_shot = false void set_one_shot ( bool value ) bool get_one_shot ( ) If true, the animation will only play once and will not loop back to the first frame after reaching the end. Note that reaching the end will not set pause to true. bool pause = false void set_pause ( bool value ) bool get_pause ( ) If true, the animation will pause where it currently is (i.e. at current_frame). The animation will continue from where it was paused when changing this property to false. float speed_scale = 1.0 void set_speed_scale ( float value ) float get_speed_scale ( ) The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. Method Descriptions float get_frame_duration ( int frame ) const Returns the given frame's duration, in seconds. Texture2D get_frame_texture ( int frame ) const Returns the given frame's Texture2D. void set_frame_duration ( int frame, float duration ) Sets the duration of any given frame. The final duration is affected by the speed_scale. If set to 0, the frame is skipped during playback. void set_frame_texture ( int frame, Texture2D texture ) Assigns a Texture2D to the given frame. Frame IDs start at 0, so the first frame has ID 0, and the last frame of the animation has ID frames - 1. You can define any number of textures up to MAX_FRAMES, but keep in mind that only frames from 0 to frames - 1 will be part of the animation. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_animatedtexture.html classes/class_colorpicker ----------------------------------------------------------- ColorPicker Inherits: VBoxContainer < BoxContainer < Container < Control < CanvasItem < Node < Object A widget that provides an interface for selecting or modifying a color. Description A widget that provides an interface for selecting or modifying a color. It can optionally provide functionalities like a color sampler (eyedropper), color modes, and presets. Note: This control is the color picker widget itself. You can use a ColorPickerButton instead if you need a button that brings up a ColorPicker in a popup. Tutorials Tween Demo Properties bool can_add_swatches true Color color Color(1, 1, 1, 1) ColorModeType color_mode 0 bool color_modes_visible true bool deferred_mode false bool edit_alpha true bool hex_visible true PickerShapeType picker_shape 0 bool presets_visible true bool sampler_visible true bool sliders_visible true Methods void add_preset ( Color color ) void add_recent_preset ( Color color ) void erase_preset ( Color color ) void erase_recent_preset ( Color color ) PackedColorArray get_presets ( ) const PackedColorArray get_recent_presets ( ) const Theme Properties int center_slider_grabbers 1 int h_width 30 int label_width 10 int margin 4 int sv_height 256 int sv_width 256 Texture2D add_preset Texture2D bar_arrow Texture2D color_hue Texture2D color_okhsl_hue Texture2D expanded_arrow Texture2D folded_arrow Texture2D overbright_indicator Texture2D picker_cursor Texture2D sample_bg Texture2D screen_picker Texture2D shape_circle Texture2D shape_rect Texture2D shape_rect_wheel Signals color_changed ( Color color ) Emitted when the color is changed. preset_added ( Color color ) Emitted when a preset is added. preset_removed ( Color color ) Emitted when a preset is removed. Enumerations enum ColorModeType: ColorModeType MODE_RGB = 0 Allows editing the color with Red/Green/Blue sliders. ColorModeType MODE_HSV = 1 Allows editing the color with Hue/Saturation/Value sliders. ColorModeType MODE_RAW = 2 Allows the color R, G, B component values to go beyond 1.0, which can be used for certain special operations that require it (like tinting without darkening or rendering sprites in HDR). ColorModeType MODE_OKHSL = 3 Allows editing the color with Hue/Saturation/Lightness sliders. OKHSL is a new color space similar to HSL but that better match perception by leveraging the Oklab color space which is designed to be simple to use, while doing a good job at predicting perceived lightness, chroma and hue. Okhsv and Okhsl color spaces enum PickerShapeType: PickerShapeType SHAPE_HSV_RECTANGLE = 0 HSV Color Model rectangle color space. PickerShapeType SHAPE_HSV_WHEEL = 1 HSV Color Model rectangle color space with a wheel. PickerShapeType SHAPE_VHS_CIRCLE = 2 HSV Color Model circle color space. Use Saturation as a radius. PickerShapeType SHAPE_OKHSL_CIRCLE = 3 HSL OK Color Model circle color space. PickerShapeType SHAPE_NONE = 4 The color space shape and the shape select button are hidden. Can't be selected from the shapes popup. Property Descriptions bool can_add_swatches = true void set_can_add_swatches ( bool value ) bool are_swatches_enabled ( ) If true, it's possible to add presets under Swatches. If false, the button to add presets is disabled. Color color = Color(1, 1, 1, 1) void set_pick_color ( Color value ) Color get_pick_color ( ) The currently selected color. ColorModeType color_mode = 0 void set_color_mode ( ColorModeType value ) ColorModeType get_color_mode ( ) The currently selected color mode. See ColorModeType. bool color_modes_visible = true void set_modes_visible ( bool value ) bool are_modes_visible ( ) If true, the color mode buttons are visible. bool deferred_mode = false void set_deferred_mode ( bool value ) bool is_deferred_mode ( ) If true, 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). bool edit_alpha = true void set_edit_alpha ( bool value ) bool is_editing_alpha ( ) If true, shows an alpha channel slider (opacity). bool hex_visible = true void set_hex_visible ( bool value ) bool is_hex_visible ( ) If true, the hex color code input field is visible. PickerShapeType picker_shape = 0 void set_picker_shape ( PickerShapeType value ) PickerShapeType get_picker_shape ( ) The shape of the color space view. See PickerShapeType. bool presets_visible = true void set_presets_visible ( bool value ) bool are_presets_visible ( ) If true, the Swatches and Recent Colors presets are visible. bool sampler_visible = true void set_sampler_visible ( bool value ) bool is_sampler_visible ( ) If true, the color sampler and color preview are visible. bool sliders_visible = true void set_sliders_visible ( bool value ) bool are_sliders_visible ( ) If true, the color sliders are visible. Method Descriptions void add_preset ( Color color ) Adds the given color to a list of color presets. The presets are displayed in the color picker and the user will be able to select them. Note: The presets list is only for this color picker. void add_recent_preset ( Color color ) Adds the given color to a list of color recent presets so that it can be picked later. Recent presets are the colors that were picked recently, a new preset is automatically created and added to recent presets when you pick a new color. Note: The recent presets list is only for this color picker. void erase_preset ( Color color ) Removes the given color from the list of color presets of this color picker. void erase_recent_preset ( Color color ) Removes the given color from the list of color recent presets of this color picker. PackedColorArray get_presets ( ) const Returns the list of colors in the presets of the color picker. PackedColorArray get_recent_presets ( ) const Returns the list of colors in the recent presets of the color picker. Theme Property Descriptions int center_slider_grabbers = 1 Overrides the Slider.center_grabber theme property of the sliders. int h_width = 30 The width of the hue selection slider. int label_width = 10 The minimum width of the color labels next to sliders. int margin = 4 The margin around the ColorPicker. int sv_height = 256 The height of the saturation-value selection box. int sv_width = 256 The width of the saturation-value selection box. Texture2D add_preset The icon for the "Add Preset" button. Texture2D bar_arrow The texture for the arrow grabber. Texture2D color_hue Custom texture for the hue selection slider on the right. Texture2D color_okhsl_hue Custom texture for the H slider in the OKHSL color mode. Texture2D expanded_arrow The icon for color preset drop down menu when expanded. Texture2D folded_arrow The icon for color preset drop down menu when folded. Texture2D overbright_indicator The indicator used to signalize that the color value is outside the 0-1 range. Texture2D picker_cursor The image displayed over the color box/circle (depending on the picker_shape), marking the currently selected color. Texture2D sample_bg Background panel for the color preview box (visible when the color is translucent). Texture2D screen_picker The icon for the screen color picker button. Texture2D shape_circle The icon for circular picker shapes. Texture2D shape_rect The icon for rectangular picker shapes. Texture2D shape_rect_wheel The icon for rectangular wheel picker shapes. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_colorpicker.html classes/class_physicalskymaterial ----------------------------------------------------------- PhysicalSkyMaterial Inherits: Material < Resource < RefCounted < Object A material that defines a sky for a Sky resource by a set of physical properties. Description The PhysicalSkyMaterial uses the Preetham analytic daylight model to draw a sky based on physical properties. This results in a substantially more realistic sky than the ProceduralSkyMaterial, but it is slightly slower and less flexible. The PhysicalSkyMaterial only supports one sun. The color, energy, and direction of the sun are taken from the first DirectionalLight3D in the scene tree. As it is based on a daylight model, the sky fades to black as the sunset ends. If you want a full day/night cycle, you will have to add a night sky by converting this to a ShaderMaterial and adding a night sky directly into the resulting shader. Properties float energy_multiplier 1.0 Color ground_color Color(0.1, 0.07, 0.034, 1) float mie_coefficient 0.005 Color mie_color Color(0.69, 0.729, 0.812, 1) float mie_eccentricity 0.8 Texture2D night_sky float rayleigh_coefficient 2.0 Color rayleigh_color Color(0.3, 0.405, 0.6, 1) float sun_disk_scale 1.0 float turbidity 10.0 bool use_debanding true Property Descriptions float energy_multiplier = 1.0 void set_energy_multiplier ( float value ) float get_energy_multiplier ( ) The sky's overall brightness multiplier. Higher values result in a brighter sky. Color ground_color = Color(0.1, 0.07, 0.034, 1) void set_ground_color ( Color value ) Color get_ground_color ( ) Modulates the Color on the bottom half of the sky to represent the ground. float mie_coefficient = 0.005 void set_mie_coefficient ( float value ) float get_mie_coefficient ( ) Controls the strength of Mie scattering for the sky. Mie scattering results from light colliding with larger particles (like water). On earth, Mie scattering results in a whitish color around the sun and horizon. Color mie_color = Color(0.69, 0.729, 0.812, 1) void set_mie_color ( Color value ) Color get_mie_color ( ) Controls the Color of the Mie scattering effect. While not physically accurate, this allows for the creation of alien-looking planets. float mie_eccentricity = 0.8 void set_mie_eccentricity ( float value ) float get_mie_eccentricity ( ) Controls the direction of the Mie scattering. A value of 1 means that when light hits a particle it's passing through straight forward. A value of -1 means that all light is scatter backwards. Texture2D night_sky void set_night_sky ( Texture2D value ) Texture2D get_night_sky ( ) Texture2D for the night sky. This is added to the sky, so if it is bright enough, it may be visible during the day. float rayleigh_coefficient = 2.0 void set_rayleigh_coefficient ( float value ) float get_rayleigh_coefficient ( ) Controls the strength of the Rayleigh scattering. Rayleigh scattering results from light colliding with small particles. It is responsible for the blue color of the sky. Color rayleigh_color = Color(0.3, 0.405, 0.6, 1) void set_rayleigh_color ( Color value ) Color get_rayleigh_color ( ) Controls the Color of the Rayleigh scattering. While not physically accurate, this allows for the creation of alien-looking planets. For example, setting this to a red Color results in a Mars-looking atmosphere with a corresponding blue sunset. float sun_disk_scale = 1.0 void set_sun_disk_scale ( float value ) float get_sun_disk_scale ( ) Sets the size of the sun disk. Default value is based on Sol's perceived size from Earth. float turbidity = 10.0 void set_turbidity ( float value ) float get_turbidity ( ) Sets the thickness of the atmosphere. High turbidity creates a foggy-looking atmosphere, while a low turbidity results in a clearer atmosphere. bool use_debanding = true void set_use_debanding ( bool value ) bool get_use_debanding ( ) If true, enables debanding. Debanding adds a small amount of noise which helps reduce banding that appears from the smooth changes in color in the sky. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_physicalskymaterial.html classes/class_arraymesh ----------------------------------------------------------- ArrayMesh Inherits: Mesh < Resource < RefCounted < Object Mesh type that provides utility for constructing a surface from arrays. Description The ArrayMesh is used to construct a Mesh by specifying the attributes as arrays. The most basic example is the creation of a single triangle: GDScriptvar vertices = PackedVector3Array() vertices.push_back(Vector3(0, 1, 0)) vertices.push_back(Vector3(1, 0, 0)) vertices.push_back(Vector3(0, 0, 1)) # Initialize the ArrayMesh. var arr_mesh = ArrayMesh.new() var arrays = [] arrays.resize(Mesh.ARRAY_MAX) arrays[Mesh.ARRAY_VERTEX] = vertices # Create the Mesh. arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) var m = MeshInstance3D.new() m.mesh = arr_mesh C#var vertices = new Vector3[] { new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1), }; // Initialize the ArrayMesh. var arrMesh = new ArrayMesh(); var arrays = new Godot.Collections.Array(); arrays.Resize((int)Mesh.ArrayType.Max); arrays[(int)Mesh.ArrayType.Vertex] = vertices; // Create the Mesh. arrMesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, arrays); var m = new MeshInstance3D(); m.Mesh = arrMesh; The MeshInstance3D is ready to be added to the SceneTree to be shown. See also ImmediateMesh, MeshDataTool and SurfaceTool for procedural geometry generation. Note: Godot uses clockwise winding order for front faces of triangle primitive modes. Tutorials Procedural geometry using the ArrayMesh Properties BlendShapeMode blend_shape_mode 1 AABB custom_aabb AABB(0, 0, 0, 0, 0, 0) ArrayMesh shadow_mesh Methods void add_blend_shape ( StringName name ) void add_surface_from_arrays ( PrimitiveType primitive, Array arrays, Array[] blend_shapes=[], Dictionary lods={}, BitField flags=0 ) void clear_blend_shapes ( ) void clear_surfaces ( ) int get_blend_shape_count ( ) const StringName get_blend_shape_name ( int index ) const Error lightmap_unwrap ( Transform3D transform, float texel_size ) void regen_normal_maps ( ) void set_blend_shape_name ( int index, StringName name ) int surface_find_by_name ( String name ) const int surface_get_array_index_len ( int surf_idx ) const int surface_get_array_len ( int surf_idx ) const BitField surface_get_format ( int surf_idx ) const String surface_get_name ( int surf_idx ) const PrimitiveType surface_get_primitive_type ( int surf_idx ) const void surface_set_name ( int surf_idx, String name ) void surface_update_attribute_region ( int surf_idx, int offset, PackedByteArray data ) void surface_update_skin_region ( int surf_idx, int offset, PackedByteArray data ) void surface_update_vertex_region ( int surf_idx, int offset, PackedByteArray data ) Property Descriptions BlendShapeMode blend_shape_mode = 1 void set_blend_shape_mode ( BlendShapeMode value ) BlendShapeMode get_blend_shape_mode ( ) Sets the blend shape mode to one of BlendShapeMode. AABB custom_aabb = AABB(0, 0, 0, 0, 0, 0) void set_custom_aabb ( AABB value ) AABB get_custom_aabb ( ) Overrides the AABB with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices. ArrayMesh shadow_mesh void set_shadow_mesh ( ArrayMesh value ) ArrayMesh get_shadow_mesh ( ) An optional mesh which is used for rendering shadows and can be used for the depth prepass. Can be used to increase performance of shadow rendering by using a mesh that only contains vertex position data (without normals, UVs, colors, etc.). Method Descriptions void add_blend_shape ( StringName name ) Adds name for a blend shape that will be added with add_surface_from_arrays. Must be called before surface is added. void add_surface_from_arrays ( PrimitiveType primitive, Array arrays, Array[] blend_shapes=[], Dictionary lods={}, BitField flags=0 ) Creates a new surface. Mesh.get_surface_count will become the surf_idx for this new surface. Surfaces are created to be rendered using a primitive, which may be any of the values defined in PrimitiveType. The arrays argument is an array of arrays. Each of the Mesh.ARRAY_MAX elements contains an array with some of the mesh data for this surface as described by the corresponding member of ArrayType or null if it is not used by the surface. For example, arrays[0] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this surface into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for Mesh.ARRAY_INDEX if it is used. The blend_shapes argument is an array of vertex data for each blend shape. Each element is an array of the same structure as arrays, but Mesh.ARRAY_VERTEX, Mesh.ARRAY_NORMAL, and Mesh.ARRAY_TANGENT are set if and only if they are set in arrays and all other entries are null. The lods argument is a dictionary with float keys and PackedInt32Array values. Each entry in the dictionary represents a LOD level of the surface, where the value is the Mesh.ARRAY_INDEX array to use for the LOD level and the key is roughly proportional to the distance at which the LOD stats being used. I.e., increasing the key of a LOD also increases the distance that the objects has to be from the camera before the LOD is used. The flags argument is the bitwise or of, as required: One value of ArrayCustomFormat left shifted by ARRAY_FORMAT_CUSTOMn_SHIFT for each custom channel in use, Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE, Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS, or Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY. Note: When using indices, it is recommended to only use points, lines, or triangles. void clear_blend_shapes ( ) Removes all blend shapes from this ArrayMesh. void clear_surfaces ( ) Removes all surfaces from this ArrayMesh. int get_blend_shape_count ( ) const Returns the number of blend shapes that the ArrayMesh holds. StringName get_blend_shape_name ( int index ) const Returns the name of the blend shape at this index. Error lightmap_unwrap ( Transform3D transform, float texel_size ) Performs a UV unwrap on the ArrayMesh to prepare the mesh for lightmapping. void regen_normal_maps ( ) Regenerates tangents for each of the ArrayMesh's surfaces. void set_blend_shape_name ( int index, StringName name ) Sets the name of the blend shape at this index. int surface_find_by_name ( String name ) const Returns the index of the first surface with this name held within this ArrayMesh. If none are found, -1 is returned. int surface_get_array_index_len ( int surf_idx ) const Returns the length in indices of the index array in the requested surface (see add_surface_from_arrays). int surface_get_array_len ( int surf_idx ) const Returns the length in vertices of the vertex array in the requested surface (see add_surface_from_arrays). BitField surface_get_format ( int surf_idx ) const Returns the format mask of the requested surface (see add_surface_from_arrays). String surface_get_name ( int surf_idx ) const Gets the name assigned to this surface. PrimitiveType surface_get_primitive_type ( int surf_idx ) const Returns the primitive type of the requested surface (see add_surface_from_arrays). void surface_set_name ( int surf_idx, String name ) Sets a name for a given surface. void surface_update_attribute_region ( int surf_idx, int offset, PackedByteArray data ) There is currently no description for this method. Please help us by contributing one! void surface_update_skin_region ( int surf_idx, int offset, PackedByteArray data ) There is currently no description for this method. Please help us by contributing one! void surface_update_vertex_region ( int surf_idx, int offset, PackedByteArray data ) There is currently no description for this method. Please help us by contributing one! © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_arraymesh.html classes/class_textureprogressbar ----------------------------------------------------------- TextureProgressBar Inherits: Range < Control < CanvasItem < Node < Object Texture-based progress bar. Useful for loading screens and life or stamina bars. Description TextureProgressBar works like ProgressBar, but uses up to 3 textures instead of Godot's Theme resource. It can be used to create horizontal, vertical and radial progress bars. Properties int fill_mode 0 MouseFilter mouse_filter 1 (overrides Control) bool nine_patch_stretch false Vector2 radial_center_offset Vector2(0, 0) float radial_fill_degrees 360.0 float radial_initial_angle 0.0 BitField size_flags_vertical 1 (overrides Control) float step 1.0 (overrides Range) int stretch_margin_bottom 0 int stretch_margin_left 0 int stretch_margin_right 0 int stretch_margin_top 0 Texture2D texture_over Texture2D texture_progress Vector2 texture_progress_offset Vector2(0, 0) Texture2D texture_under Color tint_over Color(1, 1, 1, 1) Color tint_progress Color(1, 1, 1, 1) Color tint_under Color(1, 1, 1, 1) Methods int get_stretch_margin ( Side margin ) const void set_stretch_margin ( Side margin, int value ) Enumerations enum FillMode: FillMode FILL_LEFT_TO_RIGHT = 0 The texture_progress fills from left to right. FillMode FILL_RIGHT_TO_LEFT = 1 The texture_progress fills from right to left. FillMode FILL_TOP_TO_BOTTOM = 2 The texture_progress fills from top to bottom. FillMode FILL_BOTTOM_TO_TOP = 3 The texture_progress fills from bottom to top. FillMode FILL_CLOCKWISE = 4 Turns the node into a radial bar. The texture_progress fills clockwise. See radial_center_offset, radial_initial_angle and radial_fill_degrees to control the way the bar fills up. FillMode FILL_COUNTER_CLOCKWISE = 5 Turns the node into a radial bar. The texture_progress fills counterclockwise. See radial_center_offset, radial_initial_angle and radial_fill_degrees to control the way the bar fills up. FillMode FILL_BILINEAR_LEFT_AND_RIGHT = 6 The texture_progress fills from the center, expanding both towards the left and the right. FillMode FILL_BILINEAR_TOP_AND_BOTTOM = 7 The texture_progress fills from the center, expanding both towards the top and the bottom. FillMode FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE = 8 Turns the node into a radial bar. The texture_progress fills radially from the center, expanding both clockwise and counterclockwise. See radial_center_offset, radial_initial_angle and radial_fill_degrees to control the way the bar fills up. Property Descriptions int fill_mode = 0 void set_fill_mode ( int value ) int get_fill_mode ( ) The fill direction. See FillMode for possible values. bool nine_patch_stretch = false void set_nine_patch_stretch ( bool value ) bool get_nine_patch_stretch ( ) If true, Godot treats the bar's textures like in NinePatchRect. Use the stretch_margin_* properties like stretch_margin_bottom to set up the nine patch's 3×3 grid. When using a radial fill_mode, this setting will enable stretching. Vector2 radial_center_offset = Vector2(0, 0) void set_radial_center_offset ( Vector2 value ) Vector2 get_radial_center_offset ( ) Offsets texture_progress if fill_mode is FILL_CLOCKWISE or FILL_COUNTER_CLOCKWISE. float radial_fill_degrees = 360.0 void set_fill_degrees ( float value ) float get_fill_degrees ( ) Upper limit for the fill of texture_progress if fill_mode is FILL_CLOCKWISE or FILL_COUNTER_CLOCKWISE. When the node's value is equal to its max_value, the texture fills up to this angle. See Range.value, Range.max_value. float radial_initial_angle = 0.0 void set_radial_initial_angle ( float value ) float get_radial_initial_angle ( ) Starting angle for the fill of texture_progress if fill_mode is FILL_CLOCKWISE or FILL_COUNTER_CLOCKWISE. When the node's value is equal to its min_value, the texture doesn't show up at all. When the value increases, the texture fills and tends towards radial_fill_degrees. int stretch_margin_bottom = 0 void set_stretch_margin ( Side margin, int value ) int get_stretch_margin ( Side margin ) const The height of the 9-patch's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. int stretch_margin_left = 0 void set_stretch_margin ( Side margin, int value ) int get_stretch_margin ( Side margin ) const The width of the 9-patch's left column. int stretch_margin_right = 0 void set_stretch_margin ( Side margin, int value ) int get_stretch_margin ( Side margin ) const The width of the 9-patch's right column. int stretch_margin_top = 0 void set_stretch_margin ( Side margin, int value ) int get_stretch_margin ( Side margin ) const The height of the 9-patch's top row. Texture2D texture_over void set_over_texture ( Texture2D value ) Texture2D get_over_texture ( ) Texture2D that draws over the progress bar. Use it to add highlights or an upper-frame that hides part of texture_progress. Texture2D texture_progress void set_progress_texture ( Texture2D value ) Texture2D get_progress_texture ( ) Texture2D that clips based on the node's value and fill_mode. As value increased, the texture fills up. It shows entirely when value reaches max_value. It doesn't show at all if value is equal to min_value. The value property comes from Range. See Range.value, Range.min_value, Range.max_value. Vector2 texture_progress_offset = Vector2(0, 0) void set_texture_progress_offset ( Vector2 value ) Vector2 get_texture_progress_offset ( ) The offset of texture_progress. Useful for texture_over and texture_under with fancy borders, to avoid transparent margins in your progress texture. Texture2D texture_under void set_under_texture ( Texture2D value ) Texture2D get_under_texture ( ) Texture2D that draws under the progress bar. The bar's background. Color tint_over = Color(1, 1, 1, 1) void set_tint_over ( Color value ) Color get_tint_over ( ) Multiplies the color of the bar's texture_over texture. The effect is similar to CanvasItem.modulate, except it only affects this specific texture instead of the entire node. Color tint_progress = Color(1, 1, 1, 1) void set_tint_progress ( Color value ) Color get_tint_progress ( ) Multiplies the color of the bar's texture_progress texture. Color tint_under = Color(1, 1, 1, 1) void set_tint_under ( Color value ) Color get_tint_under ( ) Multiplies the color of the bar's texture_under texture. Method Descriptions int get_stretch_margin ( Side margin ) const Returns the stretch margin with the specified index. See stretch_margin_bottom and related properties. void set_stretch_margin ( Side margin, int value ) Sets the stretch margin with the specified index. See stretch_margin_bottom and related properties. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_textureprogressbar.html classes/class_textedit ----------------------------------------------------------- TextEdit Inherits: Control < CanvasItem < Node < Object Inherited By: CodeEdit A multiline text editor. Description A multiline text editor. It also has limited facilities for editing code, such as syntax highlighting support. For more advanced facilities for editing code, see CodeEdit. Note: Most viewport, caret and edit methods contain a caret_index argument for caret_multiple support. The argument should be one of the following: -1 for all carets, 0 for the main caret, or greater than 0 for secondary carets. Note: When holding down Alt, the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor. Properties AutowrapMode autowrap_mode 3 bool caret_blink false float caret_blink_interval 0.65 bool caret_draw_when_editable_disabled false bool caret_mid_grapheme false bool caret_move_on_right_click true bool caret_multiple true CaretType caret_type 0 bool context_menu_enabled true bool deselect_on_focus_loss_enabled true bool drag_and_drop_selection_enabled true bool draw_control_chars false bool draw_spaces false bool draw_tabs false bool editable true FocusMode focus_mode 2 (overrides Control) bool highlight_all_occurrences false bool highlight_current_line false String language "" bool middle_mouse_paste_enabled true bool minimap_draw false int minimap_width 80 CursorShape mouse_default_cursor_shape 1 (overrides Control) String placeholder_text "" bool scroll_fit_content_height false int scroll_horizontal 0 bool scroll_past_end_of_file false bool scroll_smooth false float scroll_v_scroll_speed 80.0 float scroll_vertical 0.0 bool selecting_enabled true bool shortcut_keys_enabled true StructuredTextParser structured_text_bidi_override 0 Array structured_text_bidi_override_options [] SyntaxHighlighter syntax_highlighter String text "" TextDirection text_direction 0 bool virtual_keyboard_enabled true LineWrappingMode wrap_mode 0 Methods void _backspace ( int caret_index ) virtual void _copy ( int caret_index ) virtual void _cut ( int caret_index ) virtual void _handle_unicode_input ( int unicode_char, int caret_index ) virtual void _paste ( int caret_index ) virtual void _paste_primary_clipboard ( int caret_index ) virtual int add_caret ( int line, int col ) void add_caret_at_carets ( bool below ) void add_gutter ( int at=-1 ) void add_selection_for_next_occurrence ( ) void adjust_carets_after_edit ( int caret, int from_line, int from_col, int to_line, int to_col ) void adjust_viewport_to_caret ( int caret_index=0 ) void backspace ( int caret_index=-1 ) void begin_complex_operation ( ) void center_viewport_to_caret ( int caret_index=0 ) void clear ( ) void clear_undo_history ( ) void copy ( int caret_index=-1 ) void cut ( int caret_index=-1 ) void delete_selection ( int caret_index=-1 ) void deselect ( int caret_index=-1 ) void end_action ( ) void end_complex_operation ( ) int get_caret_column ( int caret_index=0 ) const int get_caret_count ( ) const Vector2 get_caret_draw_pos ( int caret_index=0 ) const PackedInt32Array get_caret_index_edit_order ( ) int get_caret_line ( int caret_index=0 ) const int get_caret_wrap_index ( int caret_index=0 ) const int get_first_non_whitespace_column ( int line ) const int get_first_visible_line ( ) const int get_gutter_count ( ) const String get_gutter_name ( int gutter ) const GutterType get_gutter_type ( int gutter ) const int get_gutter_width ( int gutter ) const HScrollBar get_h_scroll_bar ( ) const int get_indent_level ( int line ) const int get_last_full_visible_line ( ) const int get_last_full_visible_line_wrap_index ( ) const int get_last_unhidden_line ( ) const String get_line ( int line ) const Color get_line_background_color ( int line ) const Vector2i get_line_column_at_pos ( Vector2i position, bool allow_out_of_bounds=true ) const int get_line_count ( ) const Texture2D get_line_gutter_icon ( int line, int gutter ) const Color get_line_gutter_item_color ( int line, int gutter ) const Variant get_line_gutter_metadata ( int line, int gutter ) const String get_line_gutter_text ( int line, int gutter ) const int get_line_height ( ) const int get_line_width ( int line, int wrap_index=-1 ) const int get_line_wrap_count ( int line ) const int get_line_wrap_index_at_column ( int line, int column ) const PackedStringArray get_line_wrapped_text ( int line ) const Vector2 get_local_mouse_pos ( ) const PopupMenu get_menu ( ) const int get_minimap_line_at_pos ( Vector2i position ) const int get_minimap_visible_lines ( ) const Vector2i get_next_visible_line_index_offset_from ( int line, int wrap_index, int visible_amount ) const int get_next_visible_line_offset_from ( int line, int visible_amount ) const Vector2i get_pos_at_line_column ( int line, int column ) const Rect2i get_rect_at_line_column ( int line, int column ) const int get_saved_version ( ) const float get_scroll_pos_for_line ( int line, int wrap_index=0 ) const String get_selected_text ( int caret_index=-1 ) int get_selection_column ( int caret_index=0 ) const int get_selection_from_column ( int caret_index=0 ) const int get_selection_from_line ( int caret_index=0 ) const int get_selection_line ( int caret_index=0 ) const SelectionMode get_selection_mode ( ) const int get_selection_to_column ( int caret_index=0 ) const int get_selection_to_line ( int caret_index=0 ) const int get_tab_size ( ) const int get_total_gutter_width ( ) const int get_total_visible_line_count ( ) const VScrollBar get_v_scroll_bar ( ) const int get_version ( ) const int get_visible_line_count ( ) const int get_visible_line_count_in_range ( int from_line, int to_line ) const String get_word_at_pos ( Vector2 position ) const String get_word_under_caret ( int caret_index=-1 ) const bool has_ime_text ( ) const bool has_redo ( ) const bool has_selection ( int caret_index=-1 ) const bool has_undo ( ) const void insert_line_at ( int line, String text ) void insert_text_at_caret ( String text, int caret_index=-1 ) bool is_caret_visible ( int caret_index=0 ) const bool is_dragging_cursor ( ) const bool is_gutter_clickable ( int gutter ) const bool is_gutter_drawn ( int gutter ) const bool is_gutter_overwritable ( int gutter ) const bool is_line_gutter_clickable ( int line, int gutter ) const bool is_line_wrapped ( int line ) const bool is_menu_visible ( ) const bool is_mouse_over_selection ( bool edges, int caret_index=-1 ) const bool is_overtype_mode_enabled ( ) const void menu_option ( int option ) void merge_gutters ( int from_line, int to_line ) void merge_overlapping_carets ( ) void paste ( int caret_index=-1 ) void paste_primary_clipboard ( int caret_index=-1 ) void redo ( ) void remove_caret ( int caret ) void remove_gutter ( int gutter ) void remove_secondary_carets ( ) void remove_text ( int from_line, int from_column, int to_line, int to_column ) Vector2i search ( String text, int flags, int from_line, int from_colum ) const void select ( int from_line, int from_column, int to_line, int to_column, int caret_index=0 ) void select_all ( ) void select_word_under_caret ( int caret_index=-1 ) void set_caret_column ( int column, bool adjust_viewport=true, int caret_index=0 ) void set_caret_line ( int line, bool adjust_viewport=true, bool can_be_hidden=true, int wrap_index=0, int caret_index=0 ) void set_gutter_clickable ( int gutter, bool clickable ) void set_gutter_custom_draw ( int column, Callable draw_callback ) void set_gutter_draw ( int gutter, bool draw ) void set_gutter_name ( int gutter, String name ) void set_gutter_overwritable ( int gutter, bool overwritable ) void set_gutter_type ( int gutter, GutterType type ) void set_gutter_width ( int gutter, int width ) void set_line ( int line, String new_text ) void set_line_as_center_visible ( int line, int wrap_index=0 ) void set_line_as_first_visible ( int line, int wrap_index=0 ) void set_line_as_last_visible ( int line, int wrap_index=0 ) void set_line_background_color ( int line, Color color ) void set_line_gutter_clickable ( int line, int gutter, bool clickable ) void set_line_gutter_icon ( int line, int gutter, Texture2D icon ) void set_line_gutter_item_color ( int line, int gutter, Color color ) void set_line_gutter_metadata ( int line, int gutter, Variant metadata ) void set_line_gutter_text ( int line, int gutter, String text ) void set_overtype_mode_enabled ( bool enabled ) void set_search_flags ( int flags ) void set_search_text ( String search_text ) void set_selection_mode ( SelectionMode mode, int line=-1, int column=-1, int caret_index=0 ) void set_tab_size ( int size ) void set_tooltip_request_func ( Callable callback ) void start_action ( EditAction action ) void swap_lines ( int from_line, int to_line ) void tag_saved_version ( ) void undo ( ) Theme Properties Color background_color Color(0, 0, 0, 0) Color caret_background_color Color(0, 0, 0, 1) Color caret_color Color(0.875, 0.875, 0.875, 1) Color current_line_color Color(0.25, 0.25, 0.26, 0.8) Color font_color Color(0.875, 0.875, 0.875, 1) Color font_outline_color Color(1, 1, 1, 1) Color font_placeholder_color Color(0.875, 0.875, 0.875, 0.6) Color font_readonly_color Color(0.875, 0.875, 0.875, 0.5) Color font_selected_color Color(0, 0, 0, 0) Color search_result_border_color Color(0.3, 0.3, 0.3, 0.4) Color search_result_color Color(0.3, 0.3, 0.3, 1) Color selection_color Color(0.5, 0.5, 0.5, 1) Color word_highlighted_color Color(0.5, 0.5, 0.5, 0.25) int caret_width 1 int line_spacing 4 int outline_size 0 Font font int font_size Texture2D space Texture2D tab StyleBox focus StyleBox normal StyleBox read_only Signals caret_changed ( ) Emitted when the caret changes position. gutter_added ( ) Emitted when a gutter is added. gutter_clicked ( int line, int gutter ) Emitted when a gutter is clicked. gutter_removed ( ) Emitted when a gutter is removed. lines_edited_from ( int from_line, int to_line ) Emitted immediately when the text changes. When text is added from_line will be less than to_line. On a remove to_line will be less than from_line. text_changed ( ) Emitted when the text changes. text_set ( ) Emitted when clear is called or text is set. Enumerations enum MenuItems: MenuItems MENU_CUT = 0 Cuts (copies and clears) the selected text. MenuItems MENU_COPY = 1 Copies the selected text. MenuItems MENU_PASTE = 2 Pastes the clipboard text over the selected text (or at the cursor's position). MenuItems MENU_CLEAR = 3 Erases the whole TextEdit text. MenuItems MENU_SELECT_ALL = 4 Selects the whole TextEdit text. MenuItems MENU_UNDO = 5 Undoes the previous action. MenuItems MENU_REDO = 6 Redoes the previous action. MenuItems MENU_SUBMENU_TEXT_DIR = 7 ID of "Text Writing Direction" submenu. MenuItems MENU_DIR_INHERITED = 8 Sets text direction to inherited. MenuItems MENU_DIR_AUTO = 9 Sets text direction to automatic. MenuItems MENU_DIR_LTR = 10 Sets text direction to left-to-right. MenuItems MENU_DIR_RTL = 11 Sets text direction to right-to-left. MenuItems MENU_DISPLAY_UCC = 12 Toggles control character display. MenuItems MENU_SUBMENU_INSERT_UCC = 13 ID of "Insert Control Character" submenu. MenuItems MENU_INSERT_LRM = 14 Inserts left-to-right mark (LRM) character. MenuItems MENU_INSERT_RLM = 15 Inserts right-to-left mark (RLM) character. MenuItems MENU_INSERT_LRE = 16 Inserts start of left-to-right embedding (LRE) character. MenuItems MENU_INSERT_RLE = 17 Inserts start of right-to-left embedding (RLE) character. MenuItems MENU_INSERT_LRO = 18 Inserts start of left-to-right override (LRO) character. MenuItems MENU_INSERT_RLO = 19 Inserts start of right-to-left override (RLO) character. MenuItems MENU_INSERT_PDF = 20 Inserts pop direction formatting (PDF) character. MenuItems MENU_INSERT_ALM = 21 Inserts Arabic letter mark (ALM) character. MenuItems MENU_INSERT_LRI = 22 Inserts left-to-right isolate (LRI) character. MenuItems MENU_INSERT_RLI = 23 Inserts right-to-left isolate (RLI) character. MenuItems MENU_INSERT_FSI = 24 Inserts first strong isolate (FSI) character. MenuItems MENU_INSERT_PDI = 25 Inserts pop direction isolate (PDI) character. MenuItems MENU_INSERT_ZWJ = 26 Inserts zero width joiner (ZWJ) character. MenuItems MENU_INSERT_ZWNJ = 27 Inserts zero width non-joiner (ZWNJ) character. MenuItems MENU_INSERT_WJ = 28 Inserts word joiner (WJ) character. MenuItems MENU_INSERT_SHY = 29 Inserts soft hyphen (SHY) character. MenuItems MENU_MAX = 30 Represents the size of the MenuItems enum. enum EditAction: EditAction ACTION_NONE = 0 No current action. EditAction ACTION_TYPING = 1 A typing action. EditAction ACTION_BACKSPACE = 2 A backwards delete action. EditAction ACTION_DELETE = 3 A forward delete action. enum SearchFlags: SearchFlags SEARCH_MATCH_CASE = 1 Match case when searching. SearchFlags SEARCH_WHOLE_WORDS = 2 Match whole words when searching. SearchFlags SEARCH_BACKWARDS = 4 Search from end to beginning. enum CaretType: CaretType CARET_TYPE_LINE = 0 Vertical line caret. CaretType CARET_TYPE_BLOCK = 1 Block caret. enum SelectionMode: SelectionMode SELECTION_MODE_NONE = 0 Not selecting. SelectionMode SELECTION_MODE_SHIFT = 1 Select as if shift is pressed. SelectionMode SELECTION_MODE_POINTER = 2 Select single characters as if the user single clicked. SelectionMode SELECTION_MODE_WORD = 3 Select whole words as if the user double clicked. SelectionMode SELECTION_MODE_LINE = 4 Select whole lines as if the user triple clicked. enum LineWrappingMode: LineWrappingMode LINE_WRAPPING_NONE = 0 Line wrapping is disabled. LineWrappingMode LINE_WRAPPING_BOUNDARY = 1 Line wrapping occurs at the control boundary, beyond what would normally be visible. enum GutterType: GutterType GUTTER_TYPE_STRING = 0 Draw a string. GutterType GUTTER_TYPE_ICON = 1 Draw an icon. GutterType GUTTER_TYPE_CUSTOM = 2 Custom draw. Property Descriptions AutowrapMode autowrap_mode = 3 void set_autowrap_mode ( AutowrapMode value ) AutowrapMode get_autowrap_mode ( ) If wrap_mode is set to LINE_WRAPPING_BOUNDARY, sets text wrapping mode. To see how each mode behaves, see AutowrapMode. bool caret_blink = false void set_caret_blink_enabled ( bool value ) bool is_caret_blink_enabled ( ) If true, makes the caret blink. float caret_blink_interval = 0.65 void set_caret_blink_interval ( float value ) float get_caret_blink_interval ( ) The interval at which the caret blinks (in seconds). bool caret_draw_when_editable_disabled = false void set_draw_caret_when_editable_disabled ( bool value ) bool is_drawing_caret_when_editable_disabled ( ) If true, caret will be visible when editable is disabled. bool caret_mid_grapheme = false void set_caret_mid_grapheme_enabled ( bool value ) bool is_caret_mid_grapheme_enabled ( ) Allow moving caret, selecting and removing the individual composite character components. Note: Backspace is always removing individual composite character components. bool caret_move_on_right_click = true void set_move_caret_on_right_click_enabled ( bool value ) bool is_move_caret_on_right_click_enabled ( ) If true, a right-click moves the caret at the mouse position before displaying the context menu. If false, the context menu ignores mouse location. bool caret_multiple = true void set_multiple_carets_enabled ( bool value ) bool is_multiple_carets_enabled ( ) Sets if multiple carets are allowed. CaretType caret_type = 0 void set_caret_type ( CaretType value ) CaretType get_caret_type ( ) Set the type of caret to draw. bool context_menu_enabled = true void set_context_menu_enabled ( bool value ) bool is_context_menu_enabled ( ) If true, a right-click displays the context menu. bool deselect_on_focus_loss_enabled = true void set_deselect_on_focus_loss_enabled ( bool value ) bool is_deselect_on_focus_loss_enabled ( ) If true, the selected text will be deselected when focus is lost. bool drag_and_drop_selection_enabled = true void set_drag_and_drop_selection_enabled ( bool value ) bool is_drag_and_drop_selection_enabled ( ) If true, allow drag and drop of selected text. bool draw_control_chars = false void set_draw_control_chars ( bool value ) bool get_draw_control_chars ( ) If true, control characters are displayed. bool draw_spaces = false void set_draw_spaces ( bool value ) bool is_drawing_spaces ( ) If true, the "space" character will have a visible representation. bool draw_tabs = false void set_draw_tabs ( bool value ) bool is_drawing_tabs ( ) If true, the "tab" character will have a visible representation. bool editable = true void set_editable ( bool value ) bool is_editable ( ) If false, existing text cannot be modified and new text cannot be added. bool highlight_all_occurrences = false void set_highlight_all_occurrences ( bool value ) bool is_highlight_all_occurrences_enabled ( ) If true, all occurrences of the selected text will be highlighted. bool highlight_current_line = false void set_highlight_current_line ( bool value ) bool is_highlight_current_line_enabled ( ) If true, the line containing the cursor is highlighted. String language = "" void set_language ( String value ) String get_language ( ) Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. bool middle_mouse_paste_enabled = true void set_middle_mouse_paste_enabled ( bool value ) bool is_middle_mouse_paste_enabled ( ) If false, using middle mouse button to paste clipboard will be disabled. Note: This method is only implemented on Linux. bool minimap_draw = false void set_draw_minimap ( bool value ) bool is_drawing_minimap ( ) If true, a minimap is shown, providing an outline of your source code. int minimap_width = 80 void set_minimap_width ( int value ) int get_minimap_width ( ) The width, in pixels, of the minimap. String placeholder_text = "" void set_placeholder ( String value ) String get_placeholder ( ) Text shown when the TextEdit is empty. It is not the TextEdit's default value (see text). bool scroll_fit_content_height = false void set_fit_content_height_enabled ( bool value ) bool is_fit_content_height_enabled ( ) If true, TextEdit will disable vertical scroll and fit minimum height to the number of visible lines. int scroll_horizontal = 0 void set_h_scroll ( int value ) int get_h_scroll ( ) If there is a horizontal scrollbar, this determines the current horizontal scroll value in pixels. bool scroll_past_end_of_file = false void set_scroll_past_end_of_file_enabled ( bool value ) bool is_scroll_past_end_of_file_enabled ( ) Allow scrolling past the last line into "virtual" space. bool scroll_smooth = false void set_smooth_scroll_enabled ( bool value ) bool is_smooth_scroll_enabled ( ) Scroll smoothly over the text rather than jumping to the next location. float scroll_v_scroll_speed = 80.0 void set_v_scroll_speed ( float value ) float get_v_scroll_speed ( ) Sets the scroll speed with the minimap or when scroll_smooth is enabled. float scroll_vertical = 0.0 void set_v_scroll ( float value ) float get_v_scroll ( ) If there is a vertical scrollbar, this determines the current vertical scroll value in line numbers, starting at 0 for the top line. bool selecting_enabled = true void set_selecting_enabled ( bool value ) bool is_selecting_enabled ( ) If true, text can be selected. If false, text can not be selected by the user or by the select or select_all methods. bool shortcut_keys_enabled = true void set_shortcut_keys_enabled ( bool value ) bool is_shortcut_keys_enabled ( ) If true, shortcut keys for context menu items are enabled, even if the context menu is disabled. StructuredTextParser structured_text_bidi_override = 0 void set_structured_text_bidi_override ( StructuredTextParser value ) StructuredTextParser get_structured_text_bidi_override ( ) Set BiDi algorithm override for the structured text. Array structured_text_bidi_override_options = [] void set_structured_text_bidi_override_options ( Array value ) Array get_structured_text_bidi_override_options ( ) Set additional options for BiDi override. SyntaxHighlighter syntax_highlighter void set_syntax_highlighter ( SyntaxHighlighter value ) SyntaxHighlighter get_syntax_highlighter ( ) Sets the SyntaxHighlighter to use. String text = "" void set_text ( String value ) String get_text ( ) String value of the TextEdit. TextDirection text_direction = 0 void set_text_direction ( TextDirection value ) TextDirection get_text_direction ( ) Base text writing direction. bool virtual_keyboard_enabled = true void set_virtual_keyboard_enabled ( bool value ) bool is_virtual_keyboard_enabled ( ) If true, the native virtual keyboard is shown when focused on platforms that support it. LineWrappingMode wrap_mode = 0 void set_line_wrapping_mode ( LineWrappingMode value ) LineWrappingMode get_line_wrapping_mode ( ) Sets the line wrapping mode to use. Method Descriptions void _backspace ( int caret_index ) virtual Override this method to define what happens when the user presses the backspace key. void _copy ( int caret_index ) virtual Override this method to define what happens when the user performs a copy operation. void _cut ( int caret_index ) virtual Override this method to define what happens when the user performs a cut operation. void _handle_unicode_input ( int unicode_char, int caret_index ) virtual Override this method to define what happens when the user types in the provided key unicode_char. void _paste ( int caret_index ) virtual Override this method to define what happens when the user performs a paste operation. void _paste_primary_clipboard ( int caret_index ) virtual Override this method to define what happens when the user performs a paste operation with middle mouse button. Note: This method is only implemented on Linux. int add_caret ( int line, int col ) Adds a new caret at the given location. Returns the index of the new caret, or -1 if the location is invalid. void add_caret_at_carets ( bool below ) Adds an additional caret above or below every caret. If below is true the new caret will be added below and above otherwise. void add_gutter ( int at=-1 ) Register a new gutter to this TextEdit. Use at to have a specific gutter order. A value of -1 appends the gutter to the right. void add_selection_for_next_occurrence ( ) Adds a selection and a caret for the next occurrence of the current selection. If there is no active selection, selects word under caret. void adjust_carets_after_edit ( int caret, int from_line, int from_col, int to_line, int to_col ) Reposition the carets affected by the edit. This assumes edits are applied in edit order, see get_caret_index_edit_order. void adjust_viewport_to_caret ( int caret_index=0 ) Adjust the viewport so the caret is visible. void backspace ( int caret_index=-1 ) Called when the user presses the backspace key. Can be overridden with _backspace. void begin_complex_operation ( ) Starts a multipart edit. All edits will be treated as one action until end_complex_operation is called. void center_viewport_to_caret ( int caret_index=0 ) Centers the viewport on the line the editing caret is at. This also resets the scroll_horizontal value to 0. void clear ( ) Performs a full reset of TextEdit, including undo history. void clear_undo_history ( ) Clears the undo history. void copy ( int caret_index=-1 ) Copies the current text selection. Can be overridden with _copy. void cut ( int caret_index=-1 ) Cut's the current selection. Can be overridden with _cut. void delete_selection ( int caret_index=-1 ) Deletes the selected text. void deselect ( int caret_index=-1 ) Deselects the current selection. void end_action ( ) Marks the end of steps in the current action started with start_action. void end_complex_operation ( ) Ends a multipart edit, started with begin_complex_operation. If called outside a complex operation, the current operation is pushed onto the undo/redo stack. int get_caret_column ( int caret_index=0 ) const Returns the column the editing caret is at. int get_caret_count ( ) const Returns the number of carets in this TextEdit. Vector2 get_caret_draw_pos ( int caret_index=0 ) const Returns the caret pixel draw position. PackedInt32Array get_caret_index_edit_order ( ) Returns a list of caret indexes in their edit order, this done from bottom to top. Edit order refers to the way actions such as insert_text_at_caret are applied. int get_caret_line ( int caret_index=0 ) const Returns the line the editing caret is on. int get_caret_wrap_index ( int caret_index=0 ) const Returns the wrap index the editing caret is on. int get_first_non_whitespace_column ( int line ) const Returns the first column containing a non-whitespace character. int get_first_visible_line ( ) const Returns the first visible line. int get_gutter_count ( ) const Returns the number of gutters registered. String get_gutter_name ( int gutter ) const Returns the name of the gutter at the given index. GutterType get_gutter_type ( int gutter ) const Returns the type of the gutter at the given index. int get_gutter_width ( int gutter ) const Returns the width of the gutter at the given index. HScrollBar get_h_scroll_bar ( ) const Returns the HScrollBar used by TextEdit. int get_indent_level ( int line ) const Returns the number of spaces and tab * tab_size before the first char. int get_last_full_visible_line ( ) const Returns the last visible line. Use get_last_full_visible_line_wrap_index for the wrap index. int get_last_full_visible_line_wrap_index ( ) const Returns the last visible wrap index of the last visible line. int get_last_unhidden_line ( ) const Returns the last unhidden line in the entire TextEdit. String get_line ( int line ) const Returns the text of a specific line. Color get_line_background_color ( int line ) const Returns the current background color of the line. Color(0, 0, 0, 0) is returned if no color is set. Vector2i get_line_column_at_pos ( Vector2i position, bool allow_out_of_bounds=true ) const Returns the line and column at the given position. In the returned vector, x is the column, y is the line. If allow_out_of_bounds is false and the position is not over the text, both vector values will be set to -1. int get_line_count ( ) const Returns the number of lines in the text. Texture2D get_line_gutter_icon ( int line, int gutter ) const Returns the icon currently in gutter at line. Color get_line_gutter_item_color ( int line, int gutter ) const Returns the color currently in gutter at line. Variant get_line_gutter_metadata ( int line, int gutter ) const Returns the metadata currently in gutter at line. String get_line_gutter_text ( int line, int gutter ) const Returns the text currently in gutter at line. int get_line_height ( ) const Returns the maximum value of the line height among all lines. Note: The return value is influenced by line_spacing and font_size. And it will not be less than 1. int get_line_width ( int line, int wrap_index=-1 ) const Returns the width in pixels of the wrap_index on line. int get_line_wrap_count ( int line ) const Returns the number of times the given line is wrapped. int get_line_wrap_index_at_column ( int line, int column ) const Returns the wrap index of the given line column. PackedStringArray get_line_wrapped_text ( int line ) const Returns an array of Strings representing each wrapped index. Vector2 get_local_mouse_pos ( ) const Returns the local mouse position adjusted for the text direction. PopupMenu get_menu ( ) const Returns the PopupMenu of this TextEdit. By default, this menu is displayed when right-clicking on the TextEdit. You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see MenuItems). For example: GDScriptfunc _ready(): var menu = get_menu() # Remove all items after "Redo". menu.item_count = menu.get_item_index(MENU_REDO) + 1 # Add custom items. menu.add_separator() menu.add_item("Insert Date", MENU_MAX + 1) # Connect callback. menu.id_pressed.connect(_on_item_pressed) func _on_item_pressed(id): if id == MENU_MAX + 1: insert_text_at_caret(Time.get_date_string_from_system()) C#public override void _Ready() { var menu = GetMenu(); // Remove all items after "Redo". menu.ItemCount = menu.GetItemIndex(TextEdit.MenuItems.Redo) + 1; // Add custom items. menu.AddSeparator(); menu.AddItem("Insert Date", TextEdit.MenuItems.Max + 1); // Add event handler. menu.IdPressed += OnItemPressed; } public void OnItemPressed(int id) { if (id == TextEdit.MenuItems.Max + 1) { InsertTextAtCaret(Time.GetDateStringFromSystem()); } } Warning: 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 Window.visible property. int get_minimap_line_at_pos ( Vector2i position ) const Returns the equivalent minimap line at position. int get_minimap_visible_lines ( ) const Returns the number of lines that may be drawn on the minimap. Vector2i get_next_visible_line_index_offset_from ( int line, int wrap_index, int visible_amount ) const Similar to get_next_visible_line_offset_from, but takes into account the line wrap indexes. In the returned vector, x is the line, y is the wrap index. int get_next_visible_line_offset_from ( int line, int visible_amount ) const Returns the count to the next visible line from line to line + visible_amount. Can also count backwards. For example if a TextEdit has 5 lines with lines 2 and 3 hidden, calling this with line = 1, visible_amount = 1 would return 3. Vector2i get_pos_at_line_column ( int line, int column ) const Returns the local position for the given line and column. If x or y of the returned vector equal -1, the position is outside of the viewable area of the control. Note: The Y position corresponds to the bottom side of the line. Use get_rect_at_line_column to get the top side position. Rect2i get_rect_at_line_column ( int line, int column ) const Returns the local position and size for the grapheme at the given line and column. If x or y position of the returned rect equal -1, the position is outside of the viewable area of the control. Note: The Y position of the returned rect corresponds to the top side of the line, unlike get_pos_at_line_column which returns the bottom side. int get_saved_version ( ) const Returns the last tagged saved version from tag_saved_version. float get_scroll_pos_for_line ( int line, int wrap_index=0 ) const Returns the scroll position for wrap_index of line. String get_selected_text ( int caret_index=-1 ) Returns the text inside the selection of a caret, or all the carets if caret_index is its default value -1. int get_selection_column ( int caret_index=0 ) const Returns the original start column of the selection. int get_selection_from_column ( int caret_index=0 ) const Returns the selection begin column. int get_selection_from_line ( int caret_index=0 ) const Returns the selection begin line. int get_selection_line ( int caret_index=0 ) const Returns the original start line of the selection. SelectionMode get_selection_mode ( ) const Returns the current selection mode. int get_selection_to_column ( int caret_index=0 ) const Returns the selection end column. int get_selection_to_line ( int caret_index=0 ) const Returns the selection end line. int get_tab_size ( ) const Returns the TextEdit's' tab size. int get_total_gutter_width ( ) const Returns the total width of all gutters and internal padding. int get_total_visible_line_count ( ) const Returns the number of lines that may be drawn. VScrollBar get_v_scroll_bar ( ) const Returns the VScrollBar of the TextEdit. int get_version ( ) const Returns the current version of the TextEdit. The version is a count of recorded operations by the undo/redo history. int get_visible_line_count ( ) const Returns the number of visible lines, including wrapped text. int get_visible_line_count_in_range ( int from_line, int to_line ) const Returns the total number of visible + wrapped lines between the two lines. String get_word_at_pos ( Vector2 position ) const Returns the word at position. String get_word_under_caret ( int caret_index=-1 ) const Returns a String text with the word under the caret's location. bool has_ime_text ( ) const Returns if the user has IME text. bool has_redo ( ) const Returns true if a "redo" action is available. bool has_selection ( int caret_index=-1 ) const Returns true if the user has selected text. bool has_undo ( ) const Returns true if an "undo" action is available. void insert_line_at ( int line, String text ) Inserts a new line with text at line. void insert_text_at_caret ( String text, int caret_index=-1 ) Insert the specified text at the caret position. bool is_caret_visible ( int caret_index=0 ) const Returns true if the caret is visible on the screen. bool is_dragging_cursor ( ) const Returns true if the user is dragging their mouse for scrolling or selecting. bool is_gutter_clickable ( int gutter ) const Returns whether the gutter is clickable. bool is_gutter_drawn ( int gutter ) const Returns whether the gutter is currently drawn. bool is_gutter_overwritable ( int gutter ) const Returns whether the gutter is overwritable. bool is_line_gutter_clickable ( int line, int gutter ) const Returns whether the gutter on the given line is clickable. bool is_line_wrapped ( int line ) const Returns if the given line is wrapped. bool is_menu_visible ( ) const Returns whether the menu is visible. Use this instead of get_menu().visible to improve performance (so the creation of the menu is avoided). bool is_mouse_over_selection ( bool edges, int caret_index=-1 ) const Returns whether the mouse is over selection. If edges is true, the edges are considered part of the selection. bool is_overtype_mode_enabled ( ) const Returns whether the user is in overtype mode. void menu_option ( int option ) Executes a given action as defined in the MenuItems enum. void merge_gutters ( int from_line, int to_line ) Merge the gutters from from_line into to_line. Only overwritable gutters will be copied. void merge_overlapping_carets ( ) Merges any overlapping carets. Will favor the newest caret, or the caret with a selection. Note: This is not called when a caret changes position but after certain actions, so it is possible to get into a state where carets overlap. void paste ( int caret_index=-1 ) Paste at the current location. Can be overridden with _paste. void paste_primary_clipboard ( int caret_index=-1 ) Pastes the primary clipboard. void redo ( ) Perform redo operation. void remove_caret ( int caret ) Removes the given caret index. Note: This can result in adjustment of all other caret indices. void remove_gutter ( int gutter ) Removes the gutter from this TextEdit. void remove_secondary_carets ( ) Removes all additional carets. void remove_text ( int from_line, int from_column, int to_line, int to_column ) Removes text between the given positions. Note: This does not adjust the caret or selection, which as a result it can end up in an invalid position. Vector2i search ( String text, int flags, int from_line, int from_colum ) const Perform a search inside the text. Search flags can be specified in the SearchFlags enum. In the returned vector, x is the column, y is the line. If no results are found, both are equal to -1. GDScriptvar result = search("print", SEARCH_WHOLE_WORDS, 0, 0) if result.x != -1: # Result found. var line_number = result.y var column_number = result.x C#Vector2I result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0); if (result.X != -1) { // Result found. int lineNumber = result.Y; int columnNumber = result.X; } void select ( int from_line, int from_column, int to_line, int to_column, int caret_index=0 ) Perform selection, from line/column to line/column. If selecting_enabled is false, no selection will occur. void select_all ( ) Select all the text. If selecting_enabled is false, no selection will occur. void select_word_under_caret ( int caret_index=-1 ) Selects the word under the caret. void set_caret_column ( int column, bool adjust_viewport=true, int caret_index=0 ) Moves the caret to the specified column index. If adjust_viewport is true, the viewport will center at the caret position after the move occurs. Note: If supporting multiple carets this will not check for any overlap. See merge_overlapping_carets. void set_caret_line ( int line, bool adjust_viewport=true, bool can_be_hidden=true, int wrap_index=0, int caret_index=0 ) Moves the caret to the specified line index. If adjust_viewport is true, the viewport will center at the caret position after the move occurs. If can_be_hidden is true, the specified line can be hidden. Note: If supporting multiple carets this will not check for any overlap. See merge_overlapping_carets. void set_gutter_clickable ( int gutter, bool clickable ) Sets the gutter as clickable. This will change the mouse cursor to a pointing hand when hovering over the gutter. void set_gutter_custom_draw ( int column, Callable draw_callback ) Set a custom draw method for the gutter. The callback method must take the following args: line: int, gutter: int, Area: Rect2. void set_gutter_draw ( int gutter, bool draw ) Sets whether the gutter should be drawn. void set_gutter_name ( int gutter, String name ) Sets the name of the gutter. void set_gutter_overwritable ( int gutter, bool overwritable ) Sets the gutter to overwritable. See merge_gutters. void set_gutter_type ( int gutter, GutterType type ) Sets the type of gutter. void set_gutter_width ( int gutter, int width ) Set the width of the gutter. void set_line ( int line, String new_text ) Sets the text for a specific line. void set_line_as_center_visible ( int line, int wrap_index=0 ) Positions the wrap_index of line at the center of the viewport. void set_line_as_first_visible ( int line, int wrap_index=0 ) Positions the wrap_index of line at the top of the viewport. void set_line_as_last_visible ( int line, int wrap_index=0 ) Positions the wrap_index of line at the bottom of the viewport. void set_line_background_color ( int line, Color color ) Sets the current background color of the line. Set to Color(0, 0, 0, 0) for no color. void set_line_gutter_clickable ( int line, int gutter, bool clickable ) If clickable is true, makes the gutter on line clickable. See gutter_clicked. void set_line_gutter_icon ( int line, int gutter, Texture2D icon ) Sets the icon for gutter on line to icon. void set_line_gutter_item_color ( int line, int gutter, Color color ) Sets the color for gutter on line to color. void set_line_gutter_metadata ( int line, int gutter, Variant metadata ) Sets the metadata for gutter on line to metadata. void set_line_gutter_text ( int line, int gutter, String text ) Sets the text for gutter on line to text. void set_overtype_mode_enabled ( bool enabled ) If true, sets the user into overtype mode. When the user types in this mode, it will override existing text. void set_search_flags ( int flags ) Sets the search flags. This is used with set_search_text to highlight occurrences of the searched text. Search flags can be specified from the SearchFlags enum. void set_search_text ( String search_text ) Sets the search text. See set_search_flags. void set_selection_mode ( SelectionMode mode, int line=-1, int column=-1, int caret_index=0 ) Sets the current selection mode. void set_tab_size ( int size ) Sets the tab size for the TextEdit to use. void set_tooltip_request_func ( Callable callback ) Provide custom tooltip text. The callback method must take the following args: hovered_word: String. void start_action ( EditAction action ) Starts an action, will end the current action if action is different. An action will also end after a call to end_action, after ProjectSettings.gui/timers/text_edit_idle_detect_sec is triggered or a new undoable step outside the start_action and end_action calls. void swap_lines ( int from_line, int to_line ) Swaps the two lines. void tag_saved_version ( ) Tag the current version as saved. void undo ( ) Perform undo operation. Theme Property Descriptions Color background_color = Color(0, 0, 0, 0) Sets the background Color of this TextEdit. Color caret_background_color = Color(0, 0, 0, 1) Color of the text behind the caret when using a block caret. Color caret_color = Color(0.875, 0.875, 0.875, 1) Color of the caret. This can be set to a fully transparent color to hide the caret entirely. Color current_line_color = Color(0.25, 0.25, 0.26, 0.8) Background Color of the line containing the caret. Color font_color = Color(0.875, 0.875, 0.875, 1) Sets the font Color. Color font_outline_color = Color(1, 1, 1, 1) The tint of text outline of the TextEdit. Color font_placeholder_color = Color(0.875, 0.875, 0.875, 0.6) Font color for placeholder_text. Color font_readonly_color = Color(0.875, 0.875, 0.875, 0.5) Sets the font Color when editable is disabled. Color font_selected_color = Color(0, 0, 0, 0) Sets the Color of the selected text. If equal to Color(0, 0, 0, 0), it will be ignored. Color search_result_border_color = Color(0.3, 0.3, 0.3, 0.4) Color of the border around text that matches the search query. Color search_result_color = Color(0.3, 0.3, 0.3, 1) Color behind the text that matches the search query. Color selection_color = Color(0.5, 0.5, 0.5, 1) Sets the highlight Color of text selections. Color word_highlighted_color = Color(0.5, 0.5, 0.5, 0.25) Sets the highlight Color of multiple occurrences. highlight_all_occurrences has to be enabled. int caret_width = 1 The caret's width in pixels. Greater values can be used to improve accessibility by ensuring the caret is easily visible, or to ensure consistency with a large font size. If set to 0 or lower, the caret width is automatically set to 1 pixel and multiplied by the display scaling factor. int line_spacing = 4 Sets the spacing between the lines. int outline_size = 0 The size of the text outline. Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended. Font font Sets the default Font. int font_size Sets default font size. Texture2D space Sets a custom Texture2D for space text characters. Texture2D tab Sets a custom Texture2D for tab text characters. StyleBox focus Sets the StyleBox when in focus. The focus StyleBox is displayed over the base StyleBox, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons. StyleBox normal Sets the StyleBox of this TextEdit. StyleBox read_only Sets the StyleBox of this TextEdit when editable is disabled. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_textedit.html classes/class_image ----------------------------------------------------------- Image Inherits: Resource < RefCounted < Object Image datatype. Description Native image datatype. Contains image data which can be converted to an ImageTexture and provides commonly used image processing methods. The maximum width and height for an Image are MAX_WIDTH and MAX_HEIGHT. An Image cannot be assigned to a texture property of an object directly (such as Sprite2D.texture), and has to be converted manually to an ImageTexture first. Note: The maximum image size is 16384×16384 pixels due to graphics hardware limitations. Larger images may fail to import. Tutorials Importing images Runtime file loading and saving Properties Dictionary data { "data": PackedByteArray(), "format": "Lum8", "height": 0, "mipmaps": false, "width": 0 } Methods void adjust_bcs ( float brightness, float contrast, float saturation ) void blend_rect ( Image src, Rect2i src_rect, Vector2i dst ) void blend_rect_mask ( Image src, Image mask, Rect2i src_rect, Vector2i dst ) void blit_rect ( Image src, Rect2i src_rect, Vector2i dst ) void blit_rect_mask ( Image src, Image mask, Rect2i src_rect, Vector2i dst ) void bump_map_to_normal_map ( float bump_scale=1.0 ) void clear_mipmaps ( ) Error compress ( CompressMode mode, CompressSource source=0, ASTCFormat astc_format=0 ) Error compress_from_channels ( CompressMode mode, UsedChannels channels, ASTCFormat astc_format=0 ) Dictionary compute_image_metrics ( Image compared_image, bool use_luma ) void convert ( Format format ) void copy_from ( Image src ) Image create ( int width, int height, bool use_mipmaps, Format format ) static Image create_from_data ( int width, int height, bool use_mipmaps, Format format, PackedByteArray data ) static void crop ( int width, int height ) Error decompress ( ) AlphaMode detect_alpha ( ) const UsedChannels detect_used_channels ( CompressSource source=0 ) const void fill ( Color color ) void fill_rect ( Rect2i rect, Color color ) void fix_alpha_edges ( ) void flip_x ( ) void flip_y ( ) Error generate_mipmaps ( bool renormalize=false ) PackedByteArray get_data ( ) const Format get_format ( ) const int get_height ( ) const int get_mipmap_count ( ) const int get_mipmap_offset ( int mipmap ) const Color get_pixel ( int x, int y ) const Color get_pixelv ( Vector2i point ) const Image get_region ( Rect2i region ) const Vector2i get_size ( ) const Rect2i get_used_rect ( ) const int get_width ( ) const bool has_mipmaps ( ) const bool is_compressed ( ) const bool is_empty ( ) const bool is_invisible ( ) const Error load ( String path ) Error load_bmp_from_buffer ( PackedByteArray buffer ) Image load_from_file ( String path ) static Error load_jpg_from_buffer ( PackedByteArray buffer ) Error load_ktx_from_buffer ( PackedByteArray buffer ) Error load_png_from_buffer ( PackedByteArray buffer ) Error load_svg_from_buffer ( PackedByteArray buffer, float scale=1.0 ) Error load_svg_from_string ( String svg_str, float scale=1.0 ) Error load_tga_from_buffer ( PackedByteArray buffer ) Error load_webp_from_buffer ( PackedByteArray buffer ) void normal_map_to_xy ( ) void premultiply_alpha ( ) void resize ( int width, int height, Interpolation interpolation=1 ) void resize_to_po2 ( bool square=false, Interpolation interpolation=1 ) Image rgbe_to_srgb ( ) void rotate_90 ( ClockDirection direction ) void rotate_180 ( ) Error save_exr ( String path, bool grayscale=false ) const PackedByteArray save_exr_to_buffer ( bool grayscale=false ) const Error save_jpg ( String path, float quality=0.75 ) const PackedByteArray save_jpg_to_buffer ( float quality=0.75 ) const Error save_png ( String path ) const PackedByteArray save_png_to_buffer ( ) const Error save_webp ( String path, bool lossy=false, float quality=0.75 ) const PackedByteArray save_webp_to_buffer ( bool lossy=false, float quality=0.75 ) const void set_data ( int width, int height, bool use_mipmaps, Format format, PackedByteArray data ) void set_pixel ( int x, int y, Color color ) void set_pixelv ( Vector2i point, Color color ) void shrink_x2 ( ) void srgb_to_linear ( ) Enumerations enum Format: Format FORMAT_L8 = 0 Texture format with a single 8-bit depth representing luminance. Format FORMAT_LA8 = 1 OpenGL texture format with two values, luminance and alpha each stored with 8 bits. Format FORMAT_R8 = 2 OpenGL texture format RED with a single component and a bitdepth of 8. Format FORMAT_RG8 = 3 OpenGL texture format RG with two components and a bitdepth of 8 for each. Format FORMAT_RGB8 = 4 OpenGL texture format RGB with three components, each with a bitdepth of 8. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_RGBA8 = 5 OpenGL texture format RGBA with four components, each with a bitdepth of 8. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_RGBA4444 = 6 OpenGL texture format RGBA with four components, each with a bitdepth of 4. Format FORMAT_RGB565 = 7 OpenGL texture format RGB with three components. Red and blue have a bitdepth of 5, and green has a bitdepth of 6. Format FORMAT_RF = 8 OpenGL texture format GL_R32F where there's one component, a 32-bit floating-point value. Format FORMAT_RGF = 9 OpenGL texture format GL_RG32F where there are two components, each a 32-bit floating-point values. Format FORMAT_RGBF = 10 OpenGL texture format GL_RGB32F where there are three components, each a 32-bit floating-point values. Format FORMAT_RGBAF = 11 OpenGL texture format GL_RGBA32F where there are four components, each a 32-bit floating-point values. Format FORMAT_RH = 12 OpenGL texture format GL_R16F where there's one component, a 16-bit "half-precision" floating-point value. Format FORMAT_RGH = 13 OpenGL texture format GL_RG16F where there are two components, each a 16-bit "half-precision" floating-point value. Format FORMAT_RGBH = 14 OpenGL texture format GL_RGB16F where there are three components, each a 16-bit "half-precision" floating-point value. Format FORMAT_RGBAH = 15 OpenGL texture format GL_RGBA16F where there are four components, each a 16-bit "half-precision" floating-point value. Format FORMAT_RGBE9995 = 16 A special OpenGL texture format where the three color components have 9 bits of precision and all three share a single 5-bit exponent. Format FORMAT_DXT1 = 17 The S3TC texture format that uses Block Compression 1, and is the smallest variation of S3TC, only providing 1 bit of alpha and color data being premultiplied with alpha. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_DXT3 = 18 The S3TC texture format that uses Block Compression 2, and color data is interpreted as not having been premultiplied by alpha. Well suited for images with sharp alpha transitions between translucent and opaque areas. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_DXT5 = 19 The S3TC texture format also known as Block Compression 3 or BC3 that contains 64 bits of alpha channel data followed by 64 bits of DXT1-encoded color data. Color data is not premultiplied by alpha, same as DXT3. DXT5 generally produces superior results for transparent gradients compared to DXT3. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_RGTC_R = 20 Texture format that uses Red Green Texture Compression, normalizing the red channel data using the same compression algorithm that DXT5 uses for the alpha channel. Format FORMAT_RGTC_RG = 21 Texture format that uses Red Green Texture Compression, normalizing the red and green channel data using the same compression algorithm that DXT5 uses for the alpha channel. Format FORMAT_BPTC_RGBA = 22 Texture format that uses BPTC compression with unsigned normalized RGBA components. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_BPTC_RGBF = 23 Texture format that uses BPTC compression with signed floating-point RGB components. Format FORMAT_BPTC_RGBFU = 24 Texture format that uses BPTC compression with unsigned floating-point RGB components. Format FORMAT_ETC = 25 Ericsson Texture Compression format 1, also referred to as "ETC1", and is part of the OpenGL ES graphics standard. This format cannot store an alpha channel. Format FORMAT_ETC2_R11 = 26 Ericsson Texture Compression format 2 (R11_EAC variant), which provides one channel of unsigned data. Format FORMAT_ETC2_R11S = 27 Ericsson Texture Compression format 2 (SIGNED_R11_EAC variant), which provides one channel of signed data. Format FORMAT_ETC2_RG11 = 28 Ericsson Texture Compression format 2 (RG11_EAC variant), which provides two channels of unsigned data. Format FORMAT_ETC2_RG11S = 29 Ericsson Texture Compression format 2 (SIGNED_RG11_EAC variant), which provides two channels of signed data. Format FORMAT_ETC2_RGB8 = 30 Ericsson Texture Compression format 2 (RGB8 variant), which is a follow-up of ETC1 and compresses RGB888 data. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_ETC2_RGBA8 = 31 Ericsson Texture Compression format 2 (RGBA8variant), which compresses RGBA8888 data with full alpha support. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_ETC2_RGB8A1 = 32 Ericsson Texture Compression format 2 (RGB8_PUNCHTHROUGH_ALPHA1 variant), which compresses RGBA data to make alpha either fully transparent or fully opaque. Note: When creating an ImageTexture, an sRGB to linear color space conversion is performed. Format FORMAT_ETC2_RA_AS_RG = 33 Ericsson Texture Compression format 2 (RGBA8 variant), which compresses RA data and interprets it as two channels (red and green). See also FORMAT_ETC2_RGBA8. Format FORMAT_DXT5_RA_AS_RG = 34 The S3TC texture format also known as Block Compression 3 or BC3, which compresses RA data and interprets it as two channels (red and green). See also FORMAT_DXT5. Format FORMAT_ASTC_4x4 = 35 Adaptive Scalable Texture Compression. This implements the 4x4 (high quality) mode. Format FORMAT_ASTC_4x4_HDR = 36 Same format as FORMAT_ASTC_4x4, but with the hint to let the GPU know it is used for HDR. Format FORMAT_ASTC_8x8 = 37 Adaptive Scalable Texture Compression. This implements the 8x8 (low quality) mode. Format FORMAT_ASTC_8x8_HDR = 38 Same format as FORMAT_ASTC_8x8, but with the hint to let the GPU know it is used for HDR. Format FORMAT_MAX = 39 Represents the size of the Format enum. enum Interpolation: Interpolation INTERPOLATE_NEAREST = 0 Performs nearest-neighbor interpolation. If the image is resized, it will be pixelated. Interpolation INTERPOLATE_BILINEAR = 1 Performs bilinear interpolation. If the image is resized, it will be blurry. This mode is faster than INTERPOLATE_CUBIC, but it results in lower quality. Interpolation INTERPOLATE_CUBIC = 2 Performs cubic interpolation. If the image is resized, it will be blurry. This mode often gives better results compared to INTERPOLATE_BILINEAR, at the cost of being slower. Interpolation INTERPOLATE_TRILINEAR = 3 Performs bilinear separately on the two most-suited mipmap levels, then linearly interpolates between them. It's slower than INTERPOLATE_BILINEAR, but produces higher-quality results with far fewer aliasing artifacts. If the image does not have mipmaps, they will be generated and used internally, but no mipmaps will be generated on the resulting image. Note: If you intend to scale multiple copies of the original image, it's better to call generate_mipmaps] on it in advance, to avoid wasting processing power in generating them again and again. On the other hand, if the image already has mipmaps, they will be used, and a new set will be generated for the resulting image. Interpolation INTERPOLATE_LANCZOS = 4 Performs Lanczos interpolation. This is the slowest image resizing mode, but it typically gives the best results, especially when downscaling images. enum AlphaMode: AlphaMode ALPHA_NONE = 0 Image does not have alpha. AlphaMode ALPHA_BIT = 1 Image stores alpha in a single bit. AlphaMode ALPHA_BLEND = 2 Image uses alpha. enum CompressMode: CompressMode COMPRESS_S3TC = 0 Use S3TC compression. CompressMode COMPRESS_ETC = 1 Use ETC compression. CompressMode COMPRESS_ETC2 = 2 Use ETC2 compression. CompressMode COMPRESS_BPTC = 3 Use BPTC compression. CompressMode COMPRESS_ASTC = 4 Use ASTC compression. CompressMode COMPRESS_MAX = 5 Represents the size of the CompressMode enum. enum UsedChannels: UsedChannels USED_CHANNELS_L = 0 The image only uses one channel for luminance (grayscale). UsedChannels USED_CHANNELS_LA = 1 The image uses two channels for luminance and alpha, respectively. UsedChannels USED_CHANNELS_R = 2 The image only uses the red channel. UsedChannels USED_CHANNELS_RG = 3 The image uses two channels for red and green. UsedChannels USED_CHANNELS_RGB = 4 The image uses three channels for red, green, and blue. UsedChannels USED_CHANNELS_RGBA = 5 The image uses four channels for red, green, blue, and alpha. enum CompressSource: CompressSource COMPRESS_SOURCE_GENERIC = 0 Source texture (before compression) is a regular texture. Default for all textures. CompressSource COMPRESS_SOURCE_SRGB = 1 Source texture (before compression) is in sRGB space. CompressSource COMPRESS_SOURCE_NORMAL = 2 Source texture (before compression) is a normal texture (e.g. it can be compressed into two channels). enum ASTCFormat: ASTCFormat ASTC_FORMAT_4x4 = 0 Hint to indicate that the high quality 4x4 ASTC compression format should be used. ASTCFormat ASTC_FORMAT_8x8 = 1 Hint to indicate that the low quality 8x8 ASTC compression format should be used. Constants MAX_WIDTH = 16777216 The maximal width allowed for Image resources. MAX_HEIGHT = 16777216 The maximal height allowed for Image resources. Property Descriptions Dictionary data = { "data": PackedByteArray(), "format": "Lum8", "height": 0, "mipmaps": false, "width": 0 } Holds all the image's color data in a given format. See Format constants. Method Descriptions void adjust_bcs ( float brightness, float contrast, float saturation ) Adjusts this image's brightness, contrast, and saturation by the given values. Does not work if the image is compressed (see is_compressed). void blend_rect ( Image src, Rect2i src_rect, Vector2i dst ) Alpha-blends src_rect from src image to this image at coordinates dst, clipped accordingly to both image bounds. This image and src image must have the same format. src_rect with non-positive size is treated as empty. void blend_rect_mask ( Image src, Image mask, Rect2i src_rect, Vector2i dst ) Alpha-blends src_rect from src image to this image using mask image at coordinates dst, clipped accordingly to both image bounds. Alpha channels are required for both src and mask. dst pixels and src pixels will blend if the corresponding mask pixel's alpha value is not 0. This image and src image must have the same format. src image and mask image must have the same size (width and height) but they can have different formats. src_rect with non-positive size is treated as empty. void blit_rect ( Image src, Rect2i src_rect, Vector2i dst ) Copies src_rect from src image to this image at coordinates dst, clipped accordingly to both image bounds. This image and src image must have the same format. src_rect with non-positive size is treated as empty. void blit_rect_mask ( Image src, Image mask, Rect2i src_rect, Vector2i dst ) Blits src_rect area from src image to this image at the coordinates given by dst, clipped accordingly to both image bounds. src pixel is copied onto dst if the corresponding mask pixel's alpha value is not 0. This image and src image must have the same format. src image and mask image must have the same size (width and height) but they can have different formats. src_rect with non-positive size is treated as empty. void bump_map_to_normal_map ( float bump_scale=1.0 ) Converts a bump map to a normal map. A bump map provides a height offset per-pixel, while a normal map provides a normal direction per pixel. void clear_mipmaps ( ) Removes the image's mipmaps. Error compress ( CompressMode mode, CompressSource source=0, ASTCFormat astc_format=0 ) Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. The source parameter helps to pick the best compression method for DXT and ETC2 formats. It is ignored for ASTC compression. For ASTC compression, the astc_format parameter must be supplied. Error compress_from_channels ( CompressMode mode, UsedChannels channels, ASTCFormat astc_format=0 ) Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. This is an alternative to compress that lets the user supply the channels used in order for the compressor to pick the best DXT and ETC2 formats. For other formats (non DXT or ETC2), this argument is ignored. For ASTC compression, the astc_format parameter must be supplied. Dictionary compute_image_metrics ( Image compared_image, bool use_luma ) Compute image metrics on the current image and the compared image. The dictionary contains max, mean, mean_squared, root_mean_squared and peak_snr. void convert ( Format format ) Converts the image's format. See Format constants. void copy_from ( Image src ) Copies src image to this image. Image create ( int width, int height, bool use_mipmaps, Format format ) static Creates an empty image of given size and format. See Format constants. If use_mipmaps is true, then generate mipmaps for this image. See the generate_mipmaps. Image create_from_data ( int width, int height, bool use_mipmaps, Format format, PackedByteArray data ) static Creates a new image of given size and format. See Format constants. Fills the image with the given raw data. If use_mipmaps is true then loads mipmaps for this image from data. See generate_mipmaps. void crop ( int width, int height ) Crops the image to the given width and height. If the specified size is larger than the current size, the extra area is filled with black pixels. Error decompress ( ) Decompresses the image if it is VRAM compressed in a supported format. Returns @GlobalScope.OK if the format is supported, otherwise @GlobalScope.ERR_UNAVAILABLE. Note: The following formats can be decompressed: DXT, RGTC, BPTC. The formats ETC1 and ETC2 are not supported. AlphaMode detect_alpha ( ) const Returns ALPHA_BLEND if the image has data for alpha values. Returns ALPHA_BIT if all the alpha values are stored in a single bit. Returns ALPHA_NONE if no data for alpha values is found. UsedChannels detect_used_channels ( CompressSource source=0 ) const Returns the color channels used by this image, as one of the UsedChannels constants. If the image is compressed, the original source must be specified. void fill ( Color color ) Fills the image with color. void fill_rect ( Rect2i rect, Color color ) Fills rect with color. void fix_alpha_edges ( ) Blends low-alpha pixels with nearby pixels. void flip_x ( ) Flips the image horizontally. void flip_y ( ) Flips the image vertically. Error generate_mipmaps ( bool renormalize=false ) Generates mipmaps for the image. Mipmaps are precalculated lower-resolution copies of the image that are automatically used if the image needs to be scaled down when rendered. They help improve image quality and performance when rendering. This method returns an error if the image is compressed, in a custom format, or if the image's width/height is 0. Enabling renormalize when generating mipmaps for normal map textures will make sure all resulting vector values are normalized. It is possible to check if the image has mipmaps by calling has_mipmaps or get_mipmap_count. Calling generate_mipmaps on an image that already has mipmaps will replace existing mipmaps in the image. PackedByteArray get_data ( ) const Returns a copy of the image's raw data. Format get_format ( ) const Returns the image's format. See Format constants. int get_height ( ) const Returns the image's height. int get_mipmap_count ( ) const Returns the number of mipmap levels or 0 if the image has no mipmaps. The largest main level image is not counted as a mipmap level by this method, so if you want to include it you can add 1 to this count. int get_mipmap_offset ( int mipmap ) const Returns the offset where the image's mipmap with index mipmap is stored in the data dictionary. Color get_pixel ( int x, int y ) const Returns the color of the pixel at (x, y). This is the same as get_pixelv, but with two integer arguments instead of a Vector2i argument. Color get_pixelv ( Vector2i point ) const Returns the color of the pixel at point. This is the same as get_pixel, but with a Vector2i argument instead of two integer arguments. Image get_region ( Rect2i region ) const Returns a new Image that is a copy of this Image's area specified with region. Vector2i get_size ( ) const Returns the image's size (width and height). Rect2i get_used_rect ( ) const Returns a Rect2i enclosing the visible portion of the image, considering each pixel with a non-zero alpha channel as visible. int get_width ( ) const Returns the image's width. bool has_mipmaps ( ) const Returns true if the image has generated mipmaps. bool is_compressed ( ) const Returns true if the image is compressed. bool is_empty ( ) const Returns true if the image has no data. bool is_invisible ( ) const Returns true if all the image's pixels have an alpha value of 0. Returns false if any pixel has an alpha value higher than 0. Error load ( String path ) Loads an image from file path. See Supported image formats for a list of supported image formats and limitations. Warning: This method should only be used in the editor or in cases when you need to load external images at run-time, such as images located at the user:// directory, and may not work in exported projects. See also ImageTexture description for usage examples. Error load_bmp_from_buffer ( PackedByteArray buffer ) Loads an image from the binary contents of a BMP file. Note: Godot's BMP module doesn't support 16-bit per pixel images. Only 1-bit, 4-bit, 8-bit, 24-bit, and 32-bit per pixel images are supported. Note: This method is only available in engine builds with the BMP module enabled. By default, the BMP module is enabled, but it can be disabled at build-time using the module_bmp_enabled=no SCons option. Image load_from_file ( String path ) static Creates a new Image and loads data from the specified file. Error load_jpg_from_buffer ( PackedByteArray buffer ) Loads an image from the binary contents of a JPEG file. Error load_ktx_from_buffer ( PackedByteArray buffer ) Loads an image from the binary contents of a KTX file. Unlike most image formats, KTX can store VRAM-compressed data and embed mipmaps. Note: Godot's libktx implementation only supports 2D images. Cubemaps, texture arrays, and de-padding are not supported. Note: This method is only available in engine builds with the KTX module enabled. By default, the KTX module is enabled, but it can be disabled at build-time using the module_ktx_enabled=no SCons option. Error load_png_from_buffer ( PackedByteArray buffer ) Loads an image from the binary contents of a PNG file. Error load_svg_from_buffer ( PackedByteArray buffer, float scale=1.0 ) Loads an image from the UTF-8 binary contents of an uncompressed SVG file (.svg). Note: Beware when using compressed SVG files (like .svgz), they need to be decompressed before loading. Note: This method is only available in engine builds with the SVG module enabled. By default, the SVG module is enabled, but it can be disabled at build-time using the module_svg_enabled=no SCons option. Error load_svg_from_string ( String svg_str, float scale=1.0 ) Loads an image from the string contents of a SVG file (.svg). Note: This method is only available in engine builds with the SVG module enabled. By default, the SVG module is enabled, but it can be disabled at build-time using the module_svg_enabled=no SCons option. Error load_tga_from_buffer ( PackedByteArray buffer ) Loads an image from the binary contents of a TGA file. Note: This method is only available in engine builds with the TGA module enabled. By default, the TGA module is enabled, but it can be disabled at build-time using the module_tga_enabled=no SCons option. Error load_webp_from_buffer ( PackedByteArray buffer ) Loads an image from the binary contents of a WebP file. void normal_map_to_xy ( ) Converts the image's data to represent coordinates on a 3D plane. This is used when the image represents a normal map. A normal map can add lots of detail to a 3D surface without increasing the polygon count. void premultiply_alpha ( ) Multiplies color values with alpha values. Resulting color values for a pixel are (color * alpha)/256. See also CanvasItemMaterial.blend_mode. void resize ( int width, int height, Interpolation interpolation=1 ) Resizes the image to the given width and height. New pixels are calculated using the interpolation mode defined via Interpolation constants. void resize_to_po2 ( bool square=false, Interpolation interpolation=1 ) Resizes the image to the nearest power of 2 for the width and height. If square is true then set width and height to be the same. New pixels are calculated using the interpolation mode defined via Interpolation constants. Image rgbe_to_srgb ( ) Converts a standard RGBE (Red Green Blue Exponent) image to an sRGB image. void rotate_90 ( ClockDirection direction ) Rotates the image in the specified direction by 90 degrees. The width and height of the image must be greater than 1. If the width and height are not equal, the image will be resized. void rotate_180 ( ) Rotates the image by 180 degrees. The width and height of the image must be greater than 1. Error save_exr ( String path, bool grayscale=false ) const Saves the image as an EXR file to path. If grayscale is true and the image has only one channel, it will be saved explicitly as monochrome rather than one red channel. This function will return @GlobalScope.ERR_UNAVAILABLE if Godot was compiled without the TinyEXR module. Note: The TinyEXR module is disabled in non-editor builds, which means save_exr will return @GlobalScope.ERR_UNAVAILABLE when it is called from an exported project. PackedByteArray save_exr_to_buffer ( bool grayscale=false ) const Saves the image as an EXR file to a byte array. If grayscale is true and the image has only one channel, it will be saved explicitly as monochrome rather than one red channel. This function will return an empty byte array if Godot was compiled without the TinyEXR module. Note: The TinyEXR module is disabled in non-editor builds, which means save_exr will return an empty byte array when it is called from an exported project. Error save_jpg ( String path, float quality=0.75 ) const Saves the image as a JPEG file to path with the specified quality between 0.01 and 1.0 (inclusive). Higher quality values result in better-looking output at the cost of larger file sizes. Recommended quality values are between 0.75 and 0.90. Even at quality 1.00, JPEG compression remains lossy. Note: JPEG does not save an alpha channel. If the Image contains an alpha channel, the image will still be saved, but the resulting JPEG file won't contain the alpha channel. PackedByteArray save_jpg_to_buffer ( float quality=0.75 ) const Saves the image as a JPEG file to a byte array with the specified quality between 0.01 and 1.0 (inclusive). Higher quality values result in better-looking output at the cost of larger byte array sizes (and therefore memory usage). Recommended quality values are between 0.75 and 0.90. Even at quality 1.00, JPEG compression remains lossy. Note: JPEG does not save an alpha channel. If the Image contains an alpha channel, the image will still be saved, but the resulting byte array won't contain the alpha channel. Error save_png ( String path ) const Saves the image as a PNG file to the file at path. PackedByteArray save_png_to_buffer ( ) const Saves the image as a PNG file to a byte array. Error save_webp ( String path, bool lossy=false, float quality=0.75 ) const Saves the image as a WebP (Web Picture) file to the file at path. By default it will save lossless. If lossy is true, the image will be saved lossy, using the quality setting between 0.0 and 1.0 (inclusive). Lossless WebP offers more efficient compression than PNG. Note: The WebP format is limited to a size of 16383×16383 pixels, while PNG can save larger images. PackedByteArray save_webp_to_buffer ( bool lossy=false, float quality=0.75 ) const Saves the image as a WebP (Web Picture) file to a byte array. By default it will save lossless. If lossy is true, the image will be saved lossy, using the quality setting between 0.0 and 1.0 (inclusive). Lossless WebP offers more efficient compression than PNG. Note: The WebP format is limited to a size of 16383×16383 pixels, while PNG can save larger images. void set_data ( int width, int height, bool use_mipmaps, Format format, PackedByteArray data ) Overwrites data of an existing Image. Non-static equivalent of create_from_data. void set_pixel ( int x, int y, Color color ) Sets the Color of the pixel at (x, y) to color. Example: GDScriptvar img_width = 10 var img_height = 5 var img = Image.create(img_width, img_height, false, Image.FORMAT_RGBA8) img.set_pixel(1, 2, Color.RED) # Sets the color at (1, 2) to red. C#int imgWidth = 10; int imgHeight = 5; var img = Image.Create(imgWidth, imgHeight, false, Image.Format.Rgba8); img.SetPixel(1, 2, Colors.Red); // Sets the color at (1, 2) to red. This is the same as set_pixelv, but with a two integer arguments instead of a Vector2i argument. void set_pixelv ( Vector2i point, Color color ) Sets the Color of the pixel at point to color. Example: GDScriptvar img_width = 10 var img_height = 5 var img = Image.create(img_width, img_height, false, Image.FORMAT_RGBA8) img.set_pixelv(Vector2i(1, 2), Color.RED) # Sets the color at (1, 2) to red. C#int imgWidth = 10; int imgHeight = 5; var img = Image.Create(imgWidth, imgHeight, false, Image.Format.Rgba8); img.SetPixelv(new Vector2I(1, 2), Colors.Red); // Sets the color at (1, 2) to red. This is the same as set_pixel, but with a Vector2i argument instead of two integer arguments. void shrink_x2 ( ) Shrinks the image by a factor of 2 on each axis (this divides the pixel count by 4). void srgb_to_linear ( ) Converts the raw data from the sRGB colorspace to a linear scale. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_image.html classes/class_resource ----------------------------------------------------------- Resource Inherits: RefCounted < Object Inherited By: Animation, AnimationLibrary, AnimationNode, AnimationNodeStateMachinePlayback, AnimationNodeStateMachineTransition, AudioBusLayout, AudioEffect, AudioStream, BitMap, BoneMap, ButtonGroup, CameraAttributes, CryptoKey, Curve, Curve2D, Curve3D, EditorNode3DGizmoPlugin, EditorSettings, Environment, Font, GDExtension, GLTFAccessor, GLTFAnimation, GLTFBufferView, GLTFCamera, GLTFDocument, GLTFDocumentExtension, GLTFLight, GLTFMesh, GLTFNode, GLTFPhysicsBody, GLTFPhysicsShape, GLTFSkeleton, GLTFSkin, GLTFSpecGloss, GLTFState, GLTFTexture, GLTFTextureSampler, Gradient, Image, ImporterMesh, InputEvent, JSON, LabelSettings, LightmapGIData, Material, Mesh, MeshLibrary, MissingResource, MultiMesh, NavigationMesh, NavigationMeshSourceGeometryData2D, NavigationMeshSourceGeometryData3D, NavigationPolygon, Noise, Occluder3D, OccluderPolygon2D, OggPacketSequence, OpenXRAction, OpenXRActionMap, OpenXRActionSet, OpenXRInteractionProfile, OpenXRIPBinding, PackedDataContainer, PackedScene, PhysicsMaterial, PolygonPathFinder, RDShaderFile, RDShaderSPIRV, RichTextEffect, SceneReplicationConfig, Script, Shader, ShaderInclude, Shape2D, Shape3D, Shortcut, SkeletonModification2D, SkeletonModificationStack2D, SkeletonProfile, Skin, Sky, SpriteFrames, StyleBox, SyntaxHighlighter, Texture, Theme, TileMapPattern, TileSet, TileSetSource, Translation, VideoStream, VideoStreamPlayback, VisualShaderNode, VoxelGIData, World2D, World3D, X509Certificate Base class for serializable objects. Description Resource is the base class for all Godot-specific resource types, serving primarily as data containers. Since they inherit from RefCounted, resources are reference-counted and freed when no longer in use. They can also be nested within other resources, and saved on disk. Once loaded from disk, further attempts to load a resource by resource_path returns the same reference. PackedScene, one of the most common Objects in a Godot project, is also a resource, uniquely capable of storing and instantiating the Nodes it contains as many times as desired. In GDScript, resources can loaded from disk by their resource_path using @GDScript.load or @GDScript.preload. Note: In C#, resources will not be freed instantly after they are no longer in use. Instead, garbage collection will run periodically and will free resources that are no longer in use. This means that unused resources will linger on for a while before being removed. Tutorials Resources When and how to avoid using nodes for everything Properties bool resource_local_to_scene false String resource_name "" String resource_path "" Methods RID _get_rid ( ) virtual void _setup_local_to_scene ( ) virtual Resource duplicate ( bool subresources=false ) const void emit_changed ( ) Node get_local_scene ( ) const RID get_rid ( ) const void setup_local_to_scene ( ) void take_over_path ( String path ) Signals changed ( ) Emitted when the resource changes, usually when one of its properties is modified. See also emit_changed. Note: This signal is not emitted automatically for properties of custom resources. If necessary, a setter needs to be created to emit the signal. setup_local_to_scene_requested ( ) Emitted by a newly duplicated resource with resource_local_to_scene set to true. Deprecated. This signal is only emitted when the resource is created. Override _setup_local_to_scene instead. Property Descriptions bool resource_local_to_scene = false void set_local_to_scene ( bool value ) bool is_local_to_scene ( ) If true, the resource is duplicated for each instance of all scenes using it. At run-time, the resource can be modified in one scene without affecting other instances (see PackedScene.instantiate). Note: Changing this property at run-time has no effect on already created duplicate resources. String resource_name = "" void set_name ( String value ) String get_name ( ) An optional name for this resource. When defined, its value is displayed to represent the resource in the Inspector dock. For built-in scripts, the name is displayed as part of the tab name in the script editor. Note: Some resource formats do not support resource names. You can still set the name in the editor or via code, but it will be lost when the resource is reloaded. For example, only built-in scripts can have a resource name, while scripts stored in separate files cannot. String resource_path = "" void set_path ( String value ) String get_path ( ) The unique path to this resource. If it has been saved to disk, the value will be its filepath. If the resource is exclusively contained within a scene, the value will be the PackedScene's filepath, followed by a unique identifier. Note: Setting this property manually may fail if a resource with the same path has already been previously loaded. If necessary, use take_over_path. Method Descriptions RID _get_rid ( ) virtual Override this method to return a custom RID when get_rid is called. void _setup_local_to_scene ( ) virtual Override this method to customize the newly duplicated resource created from PackedScene.instantiate, if the original's resource_local_to_scene is set to true. Example: Set a random damage value to every local resource from an instantiated scene. extends Resource var damage = 0 func _setup_local_to_scene(): damage = randi_range(10, 40) Resource duplicate ( bool subresources=false ) const Duplicates this resource, returning a new resource with its exported or @GlobalScope.PROPERTY_USAGE_STORAGE properties copied from the original. If subresources is false, a shallow copy is returned; nested resources within subresources are not duplicated and are shared from the original resource. If subresources is true, a deep copy is returned; nested subresources will be duplicated and are not shared. Subresource properties with the @GlobalScope.PROPERTY_USAGE_ALWAYS_DUPLICATE flag are always duplicated even with subresources set to false, and properties with the @GlobalScope.PROPERTY_USAGE_NEVER_DUPLICATE flag are never duplicated even with subresources set to true. Note: For custom resources, this method will fail if Object._init has been defined with required parameters. void emit_changed ( ) Emits the changed signal. This method is called automatically for some built-in resources. Note: For custom resources, it's recommended to call this method whenever a meaningful change occurs, such as a modified property. This ensures that custom Objects depending on the resource are properly updated. var damage: set(new_value): if damage != new_value: damage = new_value emit_changed() Node get_local_scene ( ) const If resource_local_to_scene is set to true and the resource has been loaded from a PackedScene instantiation, returns the root Node of the scene where this resource is used. Otherwise, returns null. RID get_rid ( ) const Returns the RID of this resource (or an empty RID). Many resources (such as Texture2D, Mesh, and so on) are high-level abstractions of resources stored in a specialized server (DisplayServer, RenderingServer, etc.), so this function will return the original RID. void setup_local_to_scene ( ) Calls _setup_local_to_scene. If resource_local_to_scene is set to true, this method is automatically called from PackedScene.instantiate by the newly duplicated resource within the scene instance. Deprecated. This method should only be called internally. Override _setup_local_to_scene instead. void take_over_path ( String path ) Sets the resource_path to path, potentially overriding an existing cache entry for this path. Further attempts to load an overridden resource by path will instead return this resource. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_resource.html classes/class_sprite2d ----------------------------------------------------------- Sprite2D Inherits: Node2D < CanvasItem < Node < Object General-purpose sprite node. Description A node that displays a 2D texture. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation. Tutorials Instancing Demo Properties bool centered true bool flip_h false bool flip_v false int frame 0 Vector2i frame_coords Vector2i(0, 0) int hframes 1 Vector2 offset Vector2(0, 0) bool region_enabled false bool region_filter_clip_enabled false Rect2 region_rect Rect2(0, 0, 0, 0) Texture2D texture int vframes 1 Methods Rect2 get_rect ( ) const bool is_pixel_opaque ( Vector2 pos ) const Signals frame_changed ( ) Emitted when the frame changes. texture_changed ( ) Emitted when the texture changes. Property Descriptions bool centered = true void set_centered ( bool value ) bool is_centered ( ) If true, texture is centered. bool flip_h = false void set_flip_h ( bool value ) bool is_flipped_h ( ) If true, texture is flipped horizontally. bool flip_v = false void set_flip_v ( bool value ) bool is_flipped_v ( ) If true, texture is flipped vertically. int frame = 0 void set_frame ( int value ) int get_frame ( ) Current frame to display from sprite sheet. hframes or vframes must be greater than 1. This property is automatically adjusted when hframes or vframes are changed to keep pointing to the same visual frame (same column and row). If that's impossible, this value is reset to 0. Vector2i frame_coords = Vector2i(0, 0) void set_frame_coords ( Vector2i value ) Vector2i get_frame_coords ( ) Coordinates of the frame to display from sprite sheet. This is as an alias for the frame property. hframes or vframes must be greater than 1. int hframes = 1 void set_hframes ( int value ) int get_hframes ( ) The number of columns in the sprite sheet. When this property is changed, frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, frame is reset to 0. Vector2 offset = Vector2(0, 0) void set_offset ( Vector2 value ) Vector2 get_offset ( ) The texture's drawing offset. bool region_enabled = false void set_region_enabled ( bool value ) bool is_region_enabled ( ) If true, texture is cut from a larger atlas texture. See region_rect. bool region_filter_clip_enabled = false void set_region_filter_clip_enabled ( bool value ) bool is_region_filter_clip_enabled ( ) If true, the outermost pixels get blurred out. region_enabled must be true. Rect2 region_rect = Rect2(0, 0, 0, 0) void set_region_rect ( Rect2 value ) Rect2 get_region_rect ( ) The region of the atlas texture to display. region_enabled must be true. Texture2D texture void set_texture ( Texture2D value ) Texture2D get_texture ( ) Texture2D object to draw. int vframes = 1 void set_vframes ( int value ) int get_vframes ( ) The number of rows in the sprite sheet. When this property is changed, frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, frame is reset to 0. Method Descriptions Rect2 get_rect ( ) const Returns a Rect2 representing the Sprite2D's boundary in local coordinates. Can be used to detect if the Sprite2D was clicked. Example: GDScriptfunc _input(event): if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT: if get_rect().has_point(to_local(event.position)): print("A click!") C#public override void _Input(InputEvent @event) { if (@event is InputEventMouseButton inputEventMouse) { if (inputEventMouse.Pressed && inputEventMouse.ButtonIndex == MouseButton.Left) { if (GetRect().HasPoint(ToLocal(inputEventMouse.Position))) { GD.Print("A click!"); } } } } bool is_pixel_opaque ( Vector2 pos ) const Returns true, if the pixel at the given position is opaque and false in other case. Note: It also returns false, if the sprite's texture is null or if the given position is invalid. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_sprite2d.html classes/class_systemfont ----------------------------------------------------------- SystemFont Inherits: Font < Resource < RefCounted < Object A font loaded from a system font. Falls back to a default theme font if not implemented on the host OS. Description SystemFont loads a font from a system font with the first matching name from font_names. It will attempt to match font style, but it's not guaranteed. The returned font might be part of a font collection or be a variable font with OpenType "weight", "width" and/or "italic" features set. You can create FontVariation of the system font for precise control over its features. Note: This class is implemented on iOS, Linux, macOS and Windows, on other platforms it will fallback to default theme font. Properties bool allow_system_fallback true FontAntialiasing antialiasing 1 bool font_italic false PackedStringArray font_names PackedStringArray() int font_stretch 100 int font_weight 400 bool force_autohinter false bool generate_mipmaps false Hinting hinting 1 int msdf_pixel_range 16 int msdf_size 48 bool multichannel_signed_distance_field false float oversampling 0.0 SubpixelPositioning subpixel_positioning 1 Property Descriptions bool allow_system_fallback = true void set_allow_system_fallback ( bool value ) bool is_allow_system_fallback ( ) If set to true, system fonts can be automatically used as fallbacks. FontAntialiasing antialiasing = 1 void set_antialiasing ( FontAntialiasing value ) FontAntialiasing get_antialiasing ( ) Font anti-aliasing mode. bool font_italic = false void set_font_italic ( bool value ) bool get_font_italic ( ) If set to true, italic or oblique font is preferred. PackedStringArray font_names = PackedStringArray() void set_font_names ( PackedStringArray value ) PackedStringArray get_font_names ( ) Array of font family names to search, first matching font found is used. int font_stretch = 100 void set_font_stretch ( int value ) int get_font_stretch ( ) Preferred font stretch amount, compared to a normal width. A percentage value between 50% and 200%. int font_weight = 400 void set_font_weight ( int value ) int get_font_weight ( ) Preferred weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700. bool force_autohinter = false void set_force_autohinter ( bool value ) bool is_force_autohinter ( ) If set to true, auto-hinting is supported and preferred over font built-in hinting. bool generate_mipmaps = false void set_generate_mipmaps ( bool value ) bool get_generate_mipmaps ( ) If set to true, generate mipmaps for the font textures. Hinting hinting = 1 void set_hinting ( Hinting value ) Hinting get_hinting ( ) Font hinting mode. int msdf_pixel_range = 16 void set_msdf_pixel_range ( int value ) int get_msdf_pixel_range ( ) The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, msdf_pixel_range must be set to at least twice the size of the largest font outline. The default msdf_pixel_range value of 16 allows outline sizes up to 8 to look correct. int msdf_size = 48 void set_msdf_size ( int value ) int get_msdf_size ( ) Source font size used to generate MSDF textures. Higher values allow for more precision, but are slower to render and require more memory. Only increase this value if you notice a visible lack of precision in glyph rendering. bool multichannel_signed_distance_field = false void set_multichannel_signed_distance_field ( bool value ) bool is_multichannel_signed_distance_field ( ) If set to true, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. float oversampling = 0.0 void set_oversampling ( float value ) float get_oversampling ( ) Font oversampling factor, if set to 0.0 global oversampling factor is used instead. SubpixelPositioning subpixel_positioning = 1 void set_subpixel_positioning ( SubpixelPositioning value ) SubpixelPositioning get_subpixel_positioning ( ) Font glyph subpixel positioning mode. Subpixel positioning provides shaper text and better kerning for smaller font sizes, at the cost of memory usage and font rasterization speed. Use TextServer.SUBPIXEL_POSITIONING_AUTO to automatically enable it based on the font size. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_systemfont.html classes/class_popupmenu ----------------------------------------------------------- PopupMenu Inherits: Popup < Window < Viewport < Node < Object A modal window used to display a list of options. Description PopupMenu is a modal window used to display a list of options. Useful for toolbars and context menus. The size of a PopupMenu can be limited by using Window.max_size. If the height of the list of items is larger than the maximum height of the PopupMenu, a ScrollContainer within the popup will allow the user to scroll the contents. If no maximum size is set, or if it is set to 0, the PopupMenu height will be limited by its parent rect. All set_* methods allow negative item indices, i.e. -1 to access the last item, -2 to select the second-to-last item, and so on. Incremental search: Like ItemList and Tree, PopupMenu supports searching within the list while the control is focused. Press a key that matches the first letter of an item's name to select the first item starting with the given letter. After that point, there are two ways to perform incremental search: 1) Press the same key again before the timeout duration to select the next item starting with the same letter. 2) Press letter keys that match the rest of the word before the timeout duration to match to select the item in question directly. Both of these actions will be reset to the beginning of the list if the timeout duration has passed since the last keystroke was registered. You can adjust the timeout duration by changing ProjectSettings.gui/timers/incremental_search_max_interval_msec. Note: The ID values used for items are limited to 32 bits, not full 64 bits of int. This has a range of -2^32 to 2^32 - 1, i.e. -2147483648 to 2147483647. Properties bool allow_search true bool hide_on_checkable_item_selection true bool hide_on_item_selection true bool hide_on_state_item_selection false int item_count 0 float submenu_popup_delay 0.3 Methods bool activate_item_by_event ( InputEvent event, bool for_global_only=false ) void add_check_item ( String label, int id=-1, Key accel=0 ) void add_check_shortcut ( Shortcut shortcut, int id=-1, bool global=false ) void add_icon_check_item ( Texture2D texture, String label, int id=-1, Key accel=0 ) void add_icon_check_shortcut ( Texture2D texture, Shortcut shortcut, int id=-1, bool global=false ) void add_icon_item ( Texture2D texture, String label, int id=-1, Key accel=0 ) void add_icon_radio_check_item ( Texture2D texture, String label, int id=-1, Key accel=0 ) void add_icon_radio_check_shortcut ( Texture2D texture, Shortcut shortcut, int id=-1, bool global=false ) void add_icon_shortcut ( Texture2D texture, Shortcut shortcut, int id=-1, bool global=false, bool allow_echo=false ) void add_item ( String label, int id=-1, Key accel=0 ) void add_multistate_item ( String label, int max_states, int default_state=0, int id=-1, Key accel=0 ) void add_radio_check_item ( String label, int id=-1, Key accel=0 ) void add_radio_check_shortcut ( Shortcut shortcut, int id=-1, bool global=false ) void add_separator ( String label="", int id=-1 ) void add_shortcut ( Shortcut shortcut, int id=-1, bool global=false, bool allow_echo=false ) void add_submenu_item ( String label, String submenu, int id=-1 ) void clear ( bool free_submenus=false ) int get_focused_item ( ) const Key get_item_accelerator ( int index ) const Texture2D get_item_icon ( int index ) const int get_item_icon_max_width ( int index ) const Color get_item_icon_modulate ( int index ) const int get_item_id ( int index ) const int get_item_indent ( int index ) const int get_item_index ( int id ) const String get_item_language ( int index ) const Variant get_item_metadata ( int index ) const Shortcut get_item_shortcut ( int index ) const String get_item_submenu ( int index ) const String get_item_text ( int index ) const TextDirection get_item_text_direction ( int index ) const String get_item_tooltip ( int index ) const bool is_item_checkable ( int index ) const bool is_item_checked ( int index ) const bool is_item_disabled ( int index ) const bool is_item_radio_checkable ( int index ) const bool is_item_separator ( int index ) const bool is_item_shortcut_disabled ( int index ) const void remove_item ( int index ) void scroll_to_item ( int index ) void set_focused_item ( int index ) void set_item_accelerator ( int index, Key accel ) void set_item_as_checkable ( int index, bool enable ) void set_item_as_radio_checkable ( int index, bool enable ) void set_item_as_separator ( int index, bool enable ) void set_item_checked ( int index, bool checked ) void set_item_disabled ( int index, bool disabled ) void set_item_icon ( int index, Texture2D icon ) void set_item_icon_max_width ( int index, int width ) void set_item_icon_modulate ( int index, Color modulate ) void set_item_id ( int index, int id ) void set_item_indent ( int index, int indent ) void set_item_language ( int index, String language ) void set_item_metadata ( int index, Variant metadata ) void set_item_multistate ( int index, int state ) void set_item_shortcut ( int index, Shortcut shortcut, bool global=false ) void set_item_shortcut_disabled ( int index, bool disabled ) void set_item_submenu ( int index, String submenu ) void set_item_text ( int index, String text ) void set_item_text_direction ( int index, TextDirection direction ) void set_item_tooltip ( int index, String tooltip ) void toggle_item_checked ( int index ) void toggle_item_multistate ( int index ) Theme Properties Color font_accelerator_color Color(0.7, 0.7, 0.7, 0.8) Color font_color Color(0.875, 0.875, 0.875, 1) Color font_disabled_color Color(0.4, 0.4, 0.4, 0.8) Color font_hover_color Color(0.875, 0.875, 0.875, 1) Color font_outline_color Color(1, 1, 1, 1) Color font_separator_color Color(0.875, 0.875, 0.875, 1) Color font_separator_outline_color Color(1, 1, 1, 1) int h_separation 4 int icon_max_width 0 int indent 10 int item_end_padding 2 int item_start_padding 2 int outline_size 0 int separator_outline_size 0 int v_separation 4 Font font Font font_separator int font_separator_size int font_size Texture2D checked Texture2D checked_disabled Texture2D radio_checked Texture2D radio_checked_disabled Texture2D radio_unchecked Texture2D radio_unchecked_disabled Texture2D submenu Texture2D submenu_mirrored Texture2D unchecked Texture2D unchecked_disabled StyleBox hover StyleBox labeled_separator_left StyleBox labeled_separator_right StyleBox separator Signals id_focused ( int id ) Emitted when the user navigated to an item of some id using the ProjectSettings.input/ui_up or ProjectSettings.input/ui_down input action. id_pressed ( int id ) Emitted when an item of some id is pressed or its accelerator is activated. Note: If id is negative (either explicitly or due to overflow), this will return the corresponding index instead. index_pressed ( int index ) Emitted when an item of some index is pressed or its accelerator is activated. menu_changed ( ) Emitted when any item is added, modified or removed. Property Descriptions bool allow_search = true void set_allow_search ( bool value ) bool get_allow_search ( ) If true, allows navigating PopupMenu with letter keys. bool hide_on_checkable_item_selection = true void set_hide_on_checkable_item_selection ( bool value ) bool is_hide_on_checkable_item_selection ( ) If true, hides the PopupMenu when a checkbox or radio button is selected. bool hide_on_item_selection = true void set_hide_on_item_selection ( bool value ) bool is_hide_on_item_selection ( ) If true, hides the PopupMenu when an item is selected. bool hide_on_state_item_selection = false void set_hide_on_state_item_selection ( bool value ) bool is_hide_on_state_item_selection ( ) If true, hides the PopupMenu when a state item is selected. int item_count = 0 void set_item_count ( int value ) int get_item_count ( ) The number of items currently in the list. float submenu_popup_delay = 0.3 void set_submenu_popup_delay ( float value ) float get_submenu_popup_delay ( ) Sets the delay time in seconds for the submenu item to popup on mouse hovering. If the popup menu is added as a child of another (acting as a submenu), it will inherit the delay time of the parent menu item. Method Descriptions bool activate_item_by_event ( InputEvent event, bool for_global_only=false ) Checks the provided event against the PopupMenu's shortcuts and accelerators, and activates the first item with matching events. If for_global_only is true, only shortcuts and accelerators with global set to true will be called. Returns true if an item was successfully activated. Note: Certain Controls, such as MenuButton, will call this method automatically. void add_check_item ( String label, int id=-1, Key accel=0 ) Adds a new checkable item with text label. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided, then the default value of 0 (corresponding to @GlobalScope.KEY_NONE) will be assigned to the item (which means it won't have any accelerator). See get_item_accelerator for more info on accelerators. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See set_item_checked for more info on how to control it. void add_check_shortcut ( Shortcut shortcut, int id=-1, bool global=false ) Adds a new checkable item and assigns the specified Shortcut to it. Sets the label of the checkbox to the Shortcut's name. An id can optionally be provided. If no id is provided, one will be created from the index. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See set_item_checked for more info on how to control it. void add_icon_check_item ( Texture2D texture, String label, int id=-1, Key accel=0 ) Adds a new checkable item with text label and icon texture. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided, then the default value of 0 (corresponding to @GlobalScope.KEY_NONE) will be assigned to the item (which means it won't have any accelerator). See get_item_accelerator for more info on accelerators. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See set_item_checked for more info on how to control it. void add_icon_check_shortcut ( Texture2D texture, Shortcut shortcut, int id=-1, bool global=false ) Adds a new checkable item and assigns the specified Shortcut and icon texture to it. Sets the label of the checkbox to the Shortcut's name. An id can optionally be provided. If no id is provided, one will be created from the index. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See set_item_checked for more info on how to control it. void add_icon_item ( Texture2D texture, String label, int id=-1, Key accel=0 ) Adds a new item with text label and icon texture. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided, then the default value of 0 (corresponding to @GlobalScope.KEY_NONE) will be assigned to the item (which means it won't have any accelerator). See get_item_accelerator for more info on accelerators. void add_icon_radio_check_item ( Texture2D texture, String label, int id=-1, Key accel=0 ) Same as add_icon_check_item, but uses a radio check button. void add_icon_radio_check_shortcut ( Texture2D texture, Shortcut shortcut, int id=-1, bool global=false ) Same as add_icon_check_shortcut, but uses a radio check button. void add_icon_shortcut ( Texture2D texture, Shortcut shortcut, int id=-1, bool global=false, bool allow_echo=false ) Adds a new item and assigns the specified Shortcut and icon texture to it. Sets the label of the checkbox to the Shortcut's name. An id can optionally be provided. If no id is provided, one will be created from the index. If allow_echo is true, the shortcut can be activated with echo events. void add_item ( String label, int id=-1, Key accel=0 ) Adds a new item with text label. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided, then the default value of 0 (corresponding to @GlobalScope.KEY_NONE) will be assigned to the item (which means it won't have any accelerator). See get_item_accelerator for more info on accelerators. Note: The provided id is used only in id_pressed and id_focused signals. It's not related to the index arguments in e.g. set_item_checked. void add_multistate_item ( String label, int max_states, int default_state=0, int id=-1, Key accel=0 ) Adds a new multistate item with text label. Contrarily to normal binary items, multistate items can have more than two states, as defined by max_states. Each press or activate of the item will increase the state by one. The default value is defined by default_state. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided, then the default value of 0 (corresponding to @GlobalScope.KEY_NONE) will be assigned to the item (which means it won't have any accelerator). See get_item_accelerator for more info on accelerators. void add_radio_check_item ( String label, int id=-1, Key accel=0 ) Adds a new radio check button with text label. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided, then the default value of 0 (corresponding to @GlobalScope.KEY_NONE) will be assigned to the item (which means it won't have any accelerator). See get_item_accelerator for more info on accelerators. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See set_item_checked for more info on how to control it. void add_radio_check_shortcut ( Shortcut shortcut, int id=-1, bool global=false ) Adds a new radio check button and assigns a Shortcut to it. Sets the label of the checkbox to the Shortcut's name. An id can optionally be provided. If no id is provided, one will be created from the index. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See set_item_checked for more info on how to control it. void add_separator ( String label="", int id=-1 ) Adds a separator between items. Separators also occupy an index, which you can set by using the id parameter. A label can optionally be provided, which will appear at the center of the separator. void add_shortcut ( Shortcut shortcut, int id=-1, bool global=false, bool allow_echo=false ) Adds a Shortcut. An id can optionally be provided. If no id is provided, one will be created from the index. If allow_echo is true, the shortcut can be activated with echo events. void add_submenu_item ( String label, String submenu, int id=-1 ) Adds an item that will act as a submenu of the parent PopupMenu node when clicked. The submenu argument must be the name of an existing PopupMenu that has been added as a child to this node. This submenu will be shown when the item is clicked, hovered for long enough, or activated using the ui_select or ui_right input actions. An id can optionally be provided. If no id is provided, one will be created from the index. void clear ( bool free_submenus=false ) Removes all items from the PopupMenu. If free_submenus is true, the submenu nodes are automatically freed. int get_focused_item ( ) const Returns the index of the currently focused item. Returns -1 if no item is focused. Key get_item_accelerator ( int index ) const Returns the accelerator of the item at the given index. An accelerator is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The return value is an integer which is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A). If no accelerator is defined for the specified index, get_item_accelerator returns 0 (corresponding to @GlobalScope.KEY_NONE). Texture2D get_item_icon ( int index ) const Returns the icon of the item at the given index. int get_item_icon_max_width ( int index ) const Returns the maximum allowed width of the icon for the item at the given index. Color get_item_icon_modulate ( int index ) const Returns a Color modulating the item's icon at the given index. int get_item_id ( int index ) const Returns the ID of the item at the given index. id can be manually assigned, while index can not. int get_item_indent ( int index ) const Returns the horizontal offset of the item at the given index. int get_item_index ( int id ) const Returns the index of the item containing the specified id. Index is automatically assigned to each item by the engine and can not be set manually. String get_item_language ( int index ) const Returns item's text language code. Variant get_item_metadata ( int index ) const Returns the metadata of the specified item, which might be of any type. You can set it with set_item_metadata, which provides a simple way of assigning context data to items. Shortcut get_item_shortcut ( int index ) const Returns the Shortcut associated with the item at the given index. String get_item_submenu ( int index ) const Returns the submenu name of the item at the given index. See add_submenu_item for more info on how to add a submenu. String get_item_text ( int index ) const Returns the text of the item at the given index. TextDirection get_item_text_direction ( int index ) const Returns item's text base writing direction. String get_item_tooltip ( int index ) const Returns the tooltip associated with the item at the given index. bool is_item_checkable ( int index ) const Returns true if the item at the given index is checkable in some way, i.e. if it has a checkbox or radio button. Note: Checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually. bool is_item_checked ( int index ) const Returns true if the item at the given index is checked. bool is_item_disabled ( int index ) const Returns true if the item at the given index is disabled. When it is disabled it can't be selected, or its action invoked. See set_item_disabled for more info on how to disable an item. bool is_item_radio_checkable ( int index ) const Returns true if the item at the given index has radio button-style checkability. Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups. bool is_item_separator ( int index ) const Returns true if the item is a separator. If it is, it will be displayed as a line. See add_separator for more info on how to add a separator. bool is_item_shortcut_disabled ( int index ) const Returns true if the specified item's shortcut is disabled. void remove_item ( int index ) Removes the item at the given index from the menu. Note: The indices of items after the removed item will be shifted by one. void scroll_to_item ( int index ) Moves the scroll view to make the item at the given index visible. void set_focused_item ( int index ) Sets the currently focused item as the given index. Passing -1 as the index makes so that no item is focused. void set_item_accelerator ( int index, Key accel ) Sets the accelerator of the item at the given index. An accelerator is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. accel is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A). void set_item_as_checkable ( int index, bool enable ) Sets whether the item at the given index has a checkbox. If false, sets the type of the item to plain text. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. void set_item_as_radio_checkable ( int index, bool enable ) Sets the type of the item at the given index to radio button. If false, sets the type of the item to plain text. void set_item_as_separator ( int index, bool enable ) Mark the item at the given index as a separator, which means that it would be displayed as a line. If false, sets the type of the item to plain text. void set_item_checked ( int index, bool checked ) Sets the checkstate status of the item at the given index. void set_item_disabled ( int index, bool disabled ) Enables/disables the item at the given index. When it is disabled, it can't be selected and its action can't be invoked. void set_item_icon ( int index, Texture2D icon ) Replaces the Texture2D icon of the item at the given index. void set_item_icon_max_width ( int index, int width ) Sets the maximum allowed width of the icon for the item at the given index. This limit is applied on top of the default size of the icon and on top of icon_max_width. The height is adjusted according to the icon's ratio. void set_item_icon_modulate ( int index, Color modulate ) Sets a modulating Color of the item's icon at the given index. void set_item_id ( int index, int id ) Sets the id of the item at the given index. The id is used in id_pressed and id_focused signals. void set_item_indent ( int index, int indent ) Sets the horizontal offset of the item at the given index. void set_item_language ( int index, String language ) Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead. void set_item_metadata ( int index, Variant metadata ) Sets the metadata of an item, which may be of any type. You can later get it with get_item_metadata, which provides a simple way of assigning context data to items. void set_item_multistate ( int index, int state ) Sets the state of a multistate item. See add_multistate_item for details. void set_item_shortcut ( int index, Shortcut shortcut, bool global=false ) Sets a Shortcut for the item at the given index. void set_item_shortcut_disabled ( int index, bool disabled ) Disables the Shortcut of the item at the given index. void set_item_submenu ( int index, String submenu ) Sets the submenu of the item at the given index. The submenu is the name of a child PopupMenu node that would be shown when the item is clicked. void set_item_text ( int index, String text ) Sets the text of the item at the given index. void set_item_text_direction ( int index, TextDirection direction ) Sets item's text base writing direction. void set_item_tooltip ( int index, String tooltip ) Sets the String tooltip of the item at the given index. void toggle_item_checked ( int index ) Toggles the check state of the item at the given index. void toggle_item_multistate ( int index ) Cycle to the next state of a multistate item. See add_multistate_item for details. Theme Property Descriptions Color font_accelerator_color = Color(0.7, 0.7, 0.7, 0.8) The text Color used for shortcuts and accelerators that show next to the menu item name when defined. See get_item_accelerator for more info on accelerators. Color font_color = Color(0.875, 0.875, 0.875, 1) The default text Color for menu items' names. Color font_disabled_color = Color(0.4, 0.4, 0.4, 0.8) Color used for disabled menu items' text. Color font_hover_color = Color(0.875, 0.875, 0.875, 1) Color used for the hovered text. Color font_outline_color = Color(1, 1, 1, 1) The tint of text outline of the menu item. Color font_separator_color = Color(0.875, 0.875, 0.875, 1) Color used for labeled separators' text. See add_separator. Color font_separator_outline_color = Color(1, 1, 1, 1) The tint of text outline of the labeled separator. int h_separation = 4 The horizontal space between the item's elements. int icon_max_width = 0 The maximum allowed width of the item's icon. This limit is applied on top of the default size of the icon, but before the value set with set_item_icon_max_width. The height is adjusted according to the icon's ratio. int indent = 10 Width of the single indentation level. int item_end_padding = 2 Horizontal padding to the right of the items (or left, in RTL layout). int item_start_padding = 2 Horizontal padding to the left of the items (or right, in RTL layout). int outline_size = 0 The size of the item text outline. Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended. int separator_outline_size = 0 The size of the labeled separator text outline. int v_separation = 4 The vertical space between each menu item. Font font Font used for the menu items. Font font_separator Font used for the labeled separator. int font_separator_size Font size of the labeled separator. int font_size Font size of the menu items. Texture2D checked Texture2D icon for the checked checkbox items. Texture2D checked_disabled Texture2D icon for the checked checkbox items when they are disabled. Texture2D radio_checked Texture2D icon for the checked radio button items. Texture2D radio_checked_disabled Texture2D icon for the checked radio button items when they are disabled. Texture2D radio_unchecked Texture2D icon for the unchecked radio button items. Texture2D radio_unchecked_disabled Texture2D icon for the unchecked radio button items when they are disabled. Texture2D submenu Texture2D icon for the submenu arrow (for left-to-right layouts). Texture2D submenu_mirrored Texture2D icon for the submenu arrow (for right-to-left layouts). Texture2D unchecked Texture2D icon for the unchecked checkbox items. Texture2D unchecked_disabled Texture2D icon for the unchecked checkbox items when they are disabled. StyleBox hover StyleBox displayed when the PopupMenu item is hovered. StyleBox labeled_separator_left StyleBox for the left side of labeled separator. See add_separator. StyleBox labeled_separator_right StyleBox for the right side of labeled separator. See add_separator. StyleBox separator StyleBox used for the separators. See add_separator. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_popupmenu.html classes/class_skeletonmodificationstack2d ----------------------------------------------------------- SkeletonModificationStack2D Inherits: Resource < RefCounted < Object A resource that holds a stack of SkeletonModification2Ds. Description This resource is used by the Skeleton and holds a stack of SkeletonModification2Ds. This controls the order of the modifications and how they are applied. Modification order is especially important for full-body IK setups, as you need to execute the modifications in the correct order to get the desired results. For example, you want to execute a modification on the spine before the arms on a humanoid skeleton. This resource also controls how strongly all of the modifications are applied to the Skeleton2D. Properties bool enabled false int modification_count 0 float strength 1.0 Methods void add_modification ( SkeletonModification2D modification ) void delete_modification ( int mod_idx ) void enable_all_modifications ( bool enabled ) void execute ( float delta, int execution_mode ) bool get_is_setup ( ) const SkeletonModification2D get_modification ( int mod_idx ) const Skeleton2D get_skeleton ( ) const void set_modification ( int mod_idx, SkeletonModification2D modification ) void setup ( ) Property Descriptions bool enabled = false void set_enabled ( bool value ) bool get_enabled ( ) If true, the modification's in the stack will be called. This is handled automatically through the Skeleton2D node. int modification_count = 0 void set_modification_count ( int value ) int get_modification_count ( ) The number of modifications in the stack. float strength = 1.0 void set_strength ( float value ) float get_strength ( ) The interpolation strength of the modifications in stack. A value of 0 will make it where the modifications are not applied, a strength of 0.5 will be half applied, and a strength of 1 will allow the modifications to be fully applied and override the Skeleton2D Bone2D poses. Method Descriptions void add_modification ( SkeletonModification2D modification ) Adds the passed-in SkeletonModification2D to the stack. void delete_modification ( int mod_idx ) Deletes the SkeletonModification2D at the index position mod_idx, if it exists. void enable_all_modifications ( bool enabled ) Enables all SkeletonModification2Ds in the stack. void execute ( float delta, int execution_mode ) Executes all of the SkeletonModification2Ds in the stack that use the same execution mode as the passed-in execution_mode, starting from index 0 to modification_count. Note: The order of the modifications can matter depending on the modifications. For example, modifications on a spine should operate before modifications on the arms in order to get proper results. bool get_is_setup ( ) const Returns a boolean that indicates whether the modification stack is setup and can execute. SkeletonModification2D get_modification ( int mod_idx ) const Returns the SkeletonModification2D at the passed-in index, mod_idx. Skeleton2D get_skeleton ( ) const Returns the Skeleton2D node that the SkeletonModificationStack2D is bound to. void set_modification ( int mod_idx, SkeletonModification2D modification ) Sets the modification at mod_idx to the passed-in modification, modification. void setup ( ) Sets up the modification stack so it can execute. This function should be called by Skeleton2D and shouldn't be manually called unless you know what you are doing. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_skeletonmodificationstack2d.html classes/class_packedscene ----------------------------------------------------------- PackedScene Inherits: Resource < RefCounted < Object An abstraction of a serialized scene. Description A simplified interface to a scene file. Provides access to operations and checks that can be performed on the scene resource itself. Can be used to save a node to a file. When saving, the node as well as all the nodes it owns get saved (see Node.owner property). Note: The node doesn't need to own itself. Example of loading a saved scene: GDScript# Use load() instead of preload() if the path isn't known at compile-time. var scene = preload("res://scene.tscn").instantiate() # Add the node as a child of the node the script is attached to. add_child(scene) C#// C# has no preload, so you have to always use ResourceLoader.Load(). var scene = ResourceLoader.Load("res://scene.tscn").Instantiate(); // Add the node as a child of the node the script is attached to. AddChild(scene); Example of saving a node with different owners: The following example creates 3 objects: Node2D (node), RigidBody2D (body) and CollisionObject2D (collision). collision is a child of body which is a child of node. Only body is owned by node and pack will therefore only save those two nodes, but not collision. GDScript# Create the objects. var node = Node2D.new() var body = RigidBody2D.new() var collision = CollisionShape2D.new() # Create the object hierarchy. body.add_child(collision) node.add_child(body) # Change owner of `body`, but not of `collision`. body.owner = node var scene = PackedScene.new() # Only `node` and `body` are now packed. var result = scene.pack(node) if result == OK: var error = ResourceSaver.save(scene, "res://path/name.tscn") # Or "user://..." if error != OK: push_error("An error occurred while saving the scene to disk.") C#// Create the objects. var node = new Node2D(); var body = new RigidBody2D(); var collision = new CollisionShape2D(); // Create the object hierarchy. body.AddChild(collision); node.AddChild(body); // Change owner of `body`, but not of `collision`. body.Owner = node; var scene = new PackedScene(); // Only `node` and `body` are now packed. Error result = scene.Pack(node); if (result == Error.Ok) { Error error = ResourceSaver.Save(scene, "res://path/name.tscn"); // Or "user://..." if (error != Error.Ok) { GD.PushError("An error occurred while saving the scene to disk."); } } Tutorials 2D Role Playing Game Demo Properties Dictionary _bundled { "conn_count": 0, "conns": PackedInt32Array(), "editable_instances": [], "names": PackedStringArray(), "node_count": 0, "node_paths": [], "nodes": PackedInt32Array(), "variants": [], "version": 3 } Methods bool can_instantiate ( ) const SceneState get_state ( ) const Node instantiate ( GenEditState edit_state=0 ) const Error pack ( Node path ) Enumerations enum GenEditState: GenEditState GEN_EDIT_STATE_DISABLED = 0 If passed to instantiate, blocks edits to the scene state. GenEditState GEN_EDIT_STATE_INSTANCE = 1 If passed to instantiate, provides local scene resources to the local scene. Note: Only available in editor builds. GenEditState GEN_EDIT_STATE_MAIN = 2 If passed to instantiate, provides local scene resources to the local scene. Only the main scene should receive the main edit state. Note: Only available in editor builds. GenEditState GEN_EDIT_STATE_MAIN_INHERITED = 3 It's similar to GEN_EDIT_STATE_MAIN, but for the case where the scene is being instantiated to be the base of another one. Note: Only available in editor builds. Property Descriptions Dictionary _bundled = { "conn_count": 0, "conns": PackedInt32Array(), "editable_instances": [], "names": PackedStringArray(), "node_count": 0, "node_paths": [], "nodes": PackedInt32Array(), "variants": [], "version": 3 } A dictionary representation of the scene contents. Available keys include "rnames" and "variants" for resources, "node_count", "nodes", "node_paths" for nodes, "editable_instances" for paths to overridden nodes, "conn_count" and "conns" for signal connections, and "version" for the format style of the PackedScene. Method Descriptions bool can_instantiate ( ) const Returns true if the scene file has nodes. SceneState get_state ( ) const Returns the SceneState representing the scene file contents. Node instantiate ( GenEditState edit_state=0 ) const Instantiates the scene's node hierarchy. Triggers child scene instantiation(s). Triggers a Node.NOTIFICATION_SCENE_INSTANTIATED notification on the root node. Error pack ( Node path ) Pack will ignore any sub-nodes not owned by given node. See Node.owner. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_packedscene.html classes/class_spinbox ----------------------------------------------------------- SpinBox Inherits: Range < Control < CanvasItem < Node < Object An input field for numbers. Description SpinBox is a numerical input text field. It allows entering integers and floating point numbers. Example: GDScriptvar spin_box = SpinBox.new() add_child(spin_box) var line_edit = spin_box.get_line_edit() line_edit.context_menu_enabled = false spin_box.horizontal_alignment = LineEdit.HORIZONTAL_ALIGNMENT_RIGHT C#var spinBox = new SpinBox(); AddChild(spinBox); var lineEdit = spinBox.GetLineEdit(); lineEdit.ContextMenuEnabled = false; spinBox.AlignHorizontal = LineEdit.HorizontalAlignEnum.Right; The above code will create a SpinBox, disable context menu on it and set the text alignment to right. See Range class for more options over the SpinBox. Note: With the SpinBox's context menu disabled, you can right-click the bottom half of the spinbox to set the value to its minimum, while right-clicking the top half sets the value to its maximum. Note: SpinBox relies on an underlying LineEdit node. To theme a SpinBox's background, add theme items for LineEdit and customize them. Note: If you want to implement drag and drop for the underlying LineEdit, you can use Control.set_drag_forwarding on the node returned by get_line_edit. Properties HorizontalAlignment alignment 0 float custom_arrow_step 0.0 bool editable true String prefix "" bool select_all_on_focus false BitField size_flags_vertical 1 (overrides Control) float step 1.0 (overrides Range) String suffix "" bool update_on_text_changed false Methods void apply ( ) LineEdit get_line_edit ( ) Theme Properties Texture2D updown Property Descriptions HorizontalAlignment alignment = 0 void set_horizontal_alignment ( HorizontalAlignment value ) HorizontalAlignment get_horizontal_alignment ( ) Changes the alignment of the underlying LineEdit. float custom_arrow_step = 0.0 void set_custom_arrow_step ( float value ) float get_custom_arrow_step ( ) If not 0, Range.value will always be rounded to a multiple of custom_arrow_step when interacting with the arrow buttons of the SpinBox. bool editable = true void set_editable ( bool value ) bool is_editable ( ) If true, the SpinBox will be editable. Otherwise, it will be read only. String prefix = "" void set_prefix ( String value ) String get_prefix ( ) Adds the specified prefix string before the numerical value of the SpinBox. bool select_all_on_focus = false void set_select_all_on_focus ( bool value ) bool is_select_all_on_focus ( ) If true, the SpinBox will select the whole text when the LineEdit gains focus. Clicking the up and down arrows won't trigger this behavior. String suffix = "" void set_suffix ( String value ) String get_suffix ( ) Adds the specified suffix string after the numerical value of the SpinBox. bool update_on_text_changed = false void set_update_on_text_changed ( bool value ) bool get_update_on_text_changed ( ) Sets the value of the Range for this SpinBox when the LineEdit text is changed instead of submitted. See LineEdit.text_changed and LineEdit.text_submitted. Method Descriptions void apply ( ) Applies the current value of this SpinBox. LineEdit get_line_edit ( ) Returns the LineEdit instance from this SpinBox. You can use it to access properties and methods of LineEdit. Warning: 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 CanvasItem.visible property. Theme Property Descriptions Texture2D updown Sets a custom Texture2D for up and down arrows of the SpinBox. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_spinbox.html classes/class_animationnodeoneshot ----------------------------------------------------------- AnimationNodeOneShot Inherits: AnimationNodeSync < AnimationNode < Resource < RefCounted < Object Plays an animation once in an AnimationNodeBlendTree. Description A resource to add to an AnimationNodeBlendTree. This animation node will execute a sub-animation and return once it finishes. Blend times for fading in and out can be customized, as well as filters. After setting the request and changing the animation playback, the one-shot node automatically clears the request on the next process frame by setting its request value to ONE_SHOT_REQUEST_NONE. GDScript# Play child animation connected to "shot" port. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) # Alternative syntax (same result as above). animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE # Abort child animation connected to "shot" port. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT) # Alternative syntax (same result as above). animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT # Abort child animation with fading out connected to "shot" port. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT) # Alternative syntax (same result as above). animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT # Get current state (read-only). animation_tree.get("parameters/OneShot/active") # Alternative syntax (same result as above). animation_tree["parameters/OneShot/active"] # Get current internal state (read-only). animation_tree.get("parameters/OneShot/internal_active") # Alternative syntax (same result as above). animation_tree["parameters/OneShot/internal_active"] C#// Play child animation connected to "shot" port. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire); // Abort child animation connected to "shot" port. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort); // Abort child animation with fading out connected to "shot" port. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut); // Get current state (read-only). animationTree.Get("parameters/OneShot/active"); // Get current internal state (read-only). animationTree.Get("parameters/OneShot/internal_active"); Tutorials Using AnimationTree Third Person Shooter Demo Properties bool autorestart false float autorestart_delay 1.0 float autorestart_random_delay 0.0 Curve fadein_curve float fadein_time 0.0 Curve fadeout_curve float fadeout_time 0.0 MixMode mix_mode 0 Enumerations enum OneShotRequest: OneShotRequest ONE_SHOT_REQUEST_NONE = 0 The default state of the request. Nothing is done. OneShotRequest ONE_SHOT_REQUEST_FIRE = 1 The request to play the animation connected to "shot" port. OneShotRequest ONE_SHOT_REQUEST_ABORT = 2 The request to stop the animation connected to "shot" port. OneShotRequest ONE_SHOT_REQUEST_FADE_OUT = 3 The request to fade out the animation connected to "shot" port. enum MixMode: MixMode MIX_MODE_BLEND = 0 Blends two animations. See also AnimationNodeBlend2. MixMode MIX_MODE_ADD = 1 Blends two animations additively. See also AnimationNodeAdd2. Property Descriptions bool autorestart = false void set_autorestart ( bool value ) bool has_autorestart ( ) If true, the sub-animation will restart automatically after finishing. In other words, to start auto restarting, the animation must be played once with the ONE_SHOT_REQUEST_FIRE request. The ONE_SHOT_REQUEST_ABORT request stops the auto restarting, but it does not disable the autorestart itself. So, the ONE_SHOT_REQUEST_FIRE request will start auto restarting again. float autorestart_delay = 1.0 void set_autorestart_delay ( float value ) float get_autorestart_delay ( ) The delay after which the automatic restart is triggered, in seconds. float autorestart_random_delay = 0.0 void set_autorestart_random_delay ( float value ) float get_autorestart_random_delay ( ) If autorestart is true, a random additional delay (in seconds) between 0 and this value will be added to autorestart_delay. Curve fadein_curve void set_fadein_curve ( Curve value ) Curve get_fadein_curve ( ) Determines how cross-fading between animations is eased. If empty, the transition will be linear. float fadein_time = 0.0 void set_fadein_time ( float value ) float get_fadein_time ( ) The fade-in duration. For example, setting this to 1.0 for a 5 second length animation will produce a cross-fade that starts at 0 second and ends at 1 second during the animation. Curve fadeout_curve void set_fadeout_curve ( Curve value ) Curve get_fadeout_curve ( ) Determines how cross-fading between animations is eased. If empty, the transition will be linear. float fadeout_time = 0.0 void set_fadeout_time ( float value ) float get_fadeout_time ( ) The fade-out duration. For example, setting this to 1.0 for a 5 second length animation will produce a cross-fade that starts at 4 second and ends at 5 second during the animation. MixMode mix_mode = 0 void set_mix_mode ( MixMode value ) MixMode get_mix_mode ( ) The blend type. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_animationnodeoneshot.html classes/class_scrollcontainer ----------------------------------------------------------- ScrollContainer Inherits: Container < Control < CanvasItem < Node < Object Inherited By: EditorInspector A container used to provide scrollbars to a child control when needed. Description A container used to provide a child control with scrollbars when needed. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the Control.custom_minimum_size of the Control relative to the ScrollContainer. Tutorials Using Containers Properties bool clip_contents true (overrides Control) bool follow_focus false ScrollMode horizontal_scroll_mode 1 int scroll_deadzone 0 int scroll_horizontal 0 float scroll_horizontal_custom_step -1.0 int scroll_vertical 0 float scroll_vertical_custom_step -1.0 ScrollMode vertical_scroll_mode 1 Methods void ensure_control_visible ( Control control ) HScrollBar get_h_scroll_bar ( ) VScrollBar get_v_scroll_bar ( ) Theme Properties StyleBox panel Signals scroll_ended ( ) Emitted when scrolling stops when dragging the scrollable area with a touch event. This signal is not emitted when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events. Note: This signal is only emitted on Android or iOS, or on desktop/web platforms when ProjectSettings.input_devices/pointing/emulate_touch_from_mouse is enabled. scroll_started ( ) Emitted when scrolling starts when dragging the scrollable area with a touch event. This signal is not emitted when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events. Note: This signal is only emitted on Android or iOS, or on desktop/web platforms when ProjectSettings.input_devices/pointing/emulate_touch_from_mouse is enabled. Enumerations enum ScrollMode: ScrollMode SCROLL_MODE_DISABLED = 0 Scrolling disabled, scrollbar will be invisible. ScrollMode SCROLL_MODE_AUTO = 1 Scrolling enabled, scrollbar will be visible only if necessary, i.e. container's content is bigger than the container. ScrollMode SCROLL_MODE_SHOW_ALWAYS = 2 Scrolling enabled, scrollbar will be always visible. ScrollMode SCROLL_MODE_SHOW_NEVER = 3 Scrolling enabled, scrollbar will be hidden. Property Descriptions bool follow_focus = false void set_follow_focus ( bool value ) bool is_following_focus ( ) If true, the ScrollContainer will automatically scroll to focused children (including indirect children) to make sure they are fully visible. ScrollMode horizontal_scroll_mode = 1 void set_horizontal_scroll_mode ( ScrollMode value ) ScrollMode get_horizontal_scroll_mode ( ) Controls whether horizontal scrollbar can be used and when it should be visible. See ScrollMode for options. int scroll_deadzone = 0 void set_deadzone ( int value ) int get_deadzone ( ) Deadzone for touch scrolling. Lower deadzone makes the scrolling more sensitive. int scroll_horizontal = 0 void set_h_scroll ( int value ) int get_h_scroll ( ) The current horizontal scroll value. Note: If you are setting this value in the Node._ready function or earlier, it needs to be wrapped with Object.set_deferred, since scroll bar's Range.max_value is not initialized yet. func _ready(): set_deferred("scroll_horizontal", 600) float scroll_horizontal_custom_step = -1.0 void set_horizontal_custom_step ( float value ) float get_horizontal_custom_step ( ) Overrides the ScrollBar.custom_step used when clicking the internal scroll bar's horizontal increment and decrement buttons or when using arrow keys when the ScrollBar is focused. int scroll_vertical = 0 void set_v_scroll ( int value ) int get_v_scroll ( ) The current vertical scroll value. Note: Setting it early needs to be deferred, just like in scroll_horizontal. func _ready(): set_deferred("scroll_vertical", 600) float scroll_vertical_custom_step = -1.0 void set_vertical_custom_step ( float value ) float get_vertical_custom_step ( ) Overrides the ScrollBar.custom_step used when clicking the internal scroll bar's vertical increment and decrement buttons or when using arrow keys when the ScrollBar is focused. ScrollMode vertical_scroll_mode = 1 void set_vertical_scroll_mode ( ScrollMode value ) ScrollMode get_vertical_scroll_mode ( ) Controls whether vertical scrollbar can be used and when it should be visible. See ScrollMode for options. Method Descriptions void ensure_control_visible ( Control control ) Ensures the given control is visible (must be a direct or indirect child of the ScrollContainer). Used by follow_focus. Note: This will not work on a node that was just added during the same frame. If you want to scroll to a newly added child, you must wait until the next frame using SceneTree.process_frame: add_child(child_node) await get_tree().process_frame ensure_control_visible(child_node) HScrollBar get_h_scroll_bar ( ) Returns the horizontal scrollbar HScrollBar of this ScrollContainer. Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to disable or hide a scrollbar, you can use horizontal_scroll_mode. VScrollBar get_v_scroll_bar ( ) Returns the vertical scrollbar VScrollBar of this ScrollContainer. Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to disable or hide a scrollbar, you can use vertical_scroll_mode. Theme Property Descriptions StyleBox panel The background StyleBox of the ScrollContainer. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_scrollcontainer.html classes/class_styleboxtexture ----------------------------------------------------------- StyleBoxTexture Inherits: StyleBox < Resource < RefCounted < Object A texture-based nine-patch StyleBox. Description A texture-based nine-patch StyleBox, in a way similar to NinePatchRect. This stylebox performs a 3×3 scaling of a texture, where only the center cell is fully stretched. This makes it possible to design bordered styles regardless of the stylebox's size. Properties AxisStretchMode axis_stretch_horizontal 0 AxisStretchMode axis_stretch_vertical 0 bool draw_center true float expand_margin_bottom 0.0 float expand_margin_left 0.0 float expand_margin_right 0.0 float expand_margin_top 0.0 Color modulate_color Color(1, 1, 1, 1) Rect2 region_rect Rect2(0, 0, 0, 0) Texture2D texture float texture_margin_bottom 0.0 float texture_margin_left 0.0 float texture_margin_right 0.0 float texture_margin_top 0.0 Methods float get_expand_margin ( Side margin ) const float get_texture_margin ( Side margin ) const void set_expand_margin ( Side margin, float size ) void set_expand_margin_all ( float size ) void set_texture_margin ( Side margin, float size ) void set_texture_margin_all ( float size ) Enumerations enum AxisStretchMode: AxisStretchMode AXIS_STRETCH_MODE_STRETCH = 0 Stretch the stylebox's texture. This results in visible distortion unless the texture size matches the stylebox's size perfectly. AxisStretchMode AXIS_STRETCH_MODE_TILE = 1 Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system. AxisStretchMode AXIS_STRETCH_MODE_TILE_FIT = 2 Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system. Unlike AXIS_STRETCH_MODE_TILE, the texture may be slightly stretched to make the nine-patch texture tile seamlessly. Property Descriptions AxisStretchMode axis_stretch_horizontal = 0 void set_h_axis_stretch_mode ( AxisStretchMode value ) AxisStretchMode get_h_axis_stretch_mode ( ) Controls how the stylebox's texture will be stretched or tiled horizontally. See AxisStretchMode for possible values. AxisStretchMode axis_stretch_vertical = 0 void set_v_axis_stretch_mode ( AxisStretchMode value ) AxisStretchMode get_v_axis_stretch_mode ( ) Controls how the stylebox's texture will be stretched or tiled vertically. See AxisStretchMode for possible values. bool draw_center = true void set_draw_center ( bool value ) bool is_draw_center_enabled ( ) If true, the nine-patch texture's center tile will be drawn. float expand_margin_bottom = 0.0 void set_expand_margin ( Side margin, float size ) float get_expand_margin ( Side margin ) const Expands the bottom margin of this style box when drawing, causing it to be drawn larger than requested. float expand_margin_left = 0.0 void set_expand_margin ( Side margin, float size ) float get_expand_margin ( Side margin ) const Expands the left margin of this style box when drawing, causing it to be drawn larger than requested. float expand_margin_right = 0.0 void set_expand_margin ( Side margin, float size ) float get_expand_margin ( Side margin ) const Expands the right margin of this style box when drawing, causing it to be drawn larger than requested. float expand_margin_top = 0.0 void set_expand_margin ( Side margin, float size ) float get_expand_margin ( Side margin ) const Expands the top margin of this style box when drawing, causing it to be drawn larger than requested. Color modulate_color = Color(1, 1, 1, 1) void set_modulate ( Color value ) Color get_modulate ( ) Modulates the color of the texture when this style box is drawn. Rect2 region_rect = Rect2(0, 0, 0, 0) void set_region_rect ( Rect2 value ) Rect2 get_region_rect ( ) Species a sub-region of the texture to use. This is equivalent to first wrapping the texture in an AtlasTexture with the same region. If empty (Rect2(0, 0, 0, 0)), the whole texture will be used. Texture2D texture void set_texture ( Texture2D value ) Texture2D get_texture ( ) The texture to use when drawing this style box. float texture_margin_bottom = 0.0 void set_texture_margin ( Side margin, float size ) float get_texture_margin ( Side margin ) const Increases the bottom margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the bottom border of the 3×3 box. This is also the value used as fallback for StyleBox.content_margin_bottom if it is negative. float texture_margin_left = 0.0 void set_texture_margin ( Side margin, float size ) float get_texture_margin ( Side margin ) const Increases the left margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the left border of the 3×3 box. This is also the value used as fallback for StyleBox.content_margin_left if it is negative. float texture_margin_right = 0.0 void set_texture_margin ( Side margin, float size ) float get_texture_margin ( Side margin ) const Increases the right margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the right border of the 3×3 box. This is also the value used as fallback for StyleBox.content_margin_right if it is negative. float texture_margin_top = 0.0 void set_texture_margin ( Side margin, float size ) float get_texture_margin ( Side margin ) const Increases the top margin of the 3×3 texture box. A higher value means more of the source texture is considered to be part of the top border of the 3×3 box. This is also the value used as fallback for StyleBox.content_margin_top if it is negative. Method Descriptions float get_expand_margin ( Side margin ) const Returns the expand margin size of the specified Side. float get_texture_margin ( Side margin ) const Returns the margin size of the specified Side. void set_expand_margin ( Side margin, float size ) Sets the expand margin to size pixels for the specified Side. void set_expand_margin_all ( float size ) Sets the expand margin to size pixels for all sides. void set_texture_margin ( Side margin, float size ) Sets the margin to size pixels for the specified Side. void set_texture_margin_all ( float size ) Sets the margin to size pixels for all sides. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_styleboxtexture.html classes/class_navigationobstacle3d ----------------------------------------------------------- NavigationObstacle3D Inherits: Node3D < Node < Object 3D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area. Description 3D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area. The obstacle needs a navigation map and outline vertices defined to work correctly. If the obstacle's vertices are winded in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Outlines must not cross or overlap. Obstacles are not a replacement for a (re)baked navigation mesh. Obstacles don't change the resulting path from the pathfinding, obstacles only affect the navigation avoidance agent movement by altering the suggested velocity of the avoidance agent. Obstacles using vertices can warp to a new position but should not moved every frame as each move requires a rebuild of the avoidance map. Tutorials Using NavigationObstacles Properties bool avoidance_enabled true int avoidance_layers 1 float height 1.0 float radius 0.0 bool use_3d_avoidance false Vector3 velocity Vector3(0, 0, 0) PackedVector3Array vertices PackedVector3Array() Methods bool get_avoidance_layer_value ( int layer_number ) const RID get_navigation_map ( ) const RID get_rid ( ) const void set_avoidance_layer_value ( int layer_number, bool value ) void set_navigation_map ( RID navigation_map ) Property Descriptions bool avoidance_enabled = true void set_avoidance_enabled ( bool value ) bool get_avoidance_enabled ( ) If true the obstacle affects avoidance using agents. int avoidance_layers = 1 void set_avoidance_layers ( int value ) int get_avoidance_layers ( ) A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle. float height = 1.0 void set_height ( float value ) float get_height ( ) Sets the obstacle height used in 2D avoidance. 2D avoidance using agent's ignore obstacles that are below or above them. float radius = 0.0 void set_radius ( float value ) float get_radius ( ) Sets the avoidance radius for the obstacle. bool use_3d_avoidance = false void set_use_3d_avoidance ( bool value ) bool get_use_3d_avoidance ( ) If true the obstacle affects 3D avoidance using agent's with obstacle radius. If false the obstacle affects 2D avoidance using agent's with both obstacle vertices as well as obstacle radius. Vector3 velocity = Vector3(0, 0, 0) void set_velocity ( Vector3 value ) Vector3 get_velocity ( ) Sets the wanted velocity for the obstacle so other agent's can better predict the obstacle if it is moved with a velocity regularly (every frame) instead of warped to a new position. Does only affect avoidance for the obstacles radius. Does nothing for the obstacles static vertices. PackedVector3Array vertices = PackedVector3Array() void set_vertices ( PackedVector3Array value ) PackedVector3Array get_vertices ( ) The outline vertices of the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out. Outlines can not be crossed or overlap. Should the vertices using obstacle be warped to a new position agent's can not predict this movement and may get trapped inside the obstacle. Method Descriptions bool get_avoidance_layer_value ( int layer_number ) const Returns whether or not the specified layer of the avoidance_layers bitmask is enabled, given a layer_number between 1 and 32. RID get_navigation_map ( ) const Returns the RID of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract obstacle on the NavigationServer. If the obstacle map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use set_navigation_map to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer. RID get_rid ( ) const Returns the RID of this obstacle on the NavigationServer3D. void set_avoidance_layer_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the avoidance_layers bitmask, given a layer_number between 1 and 32. void set_navigation_map ( RID navigation_map ) Sets the RID of the navigation map this NavigationObstacle node should use and also updates the obstacle on the NavigationServer. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_navigationobstacle3d.html classes/class_tabcontainer ----------------------------------------------------------- TabContainer Inherits: Container < Control < CanvasItem < Node < Object A container that creates a tab for each child control, displaying only the active tab's control. Description Arranges child controls into a tabbed view, creating a tab for each one. The active tab's corresponding control is made visible, while all other child controls are hidden. Ignores non-control children. Note: The drawing of the clickable tabs is handled by this node; TabBar is not needed. Tutorials Using Containers Properties bool all_tabs_in_front false bool clip_tabs true int current_tab 0 bool drag_to_rearrange_enabled false AlignmentMode tab_alignment 0 FocusMode tab_focus_mode 2 int tabs_rearrange_group -1 bool tabs_visible true bool use_hidden_tabs_for_min_size false Methods Control get_current_tab_control ( ) const Popup get_popup ( ) const int get_previous_tab ( ) const TabBar get_tab_bar ( ) const Texture2D get_tab_button_icon ( int tab_idx ) const Control get_tab_control ( int tab_idx ) const int get_tab_count ( ) const Texture2D get_tab_icon ( int tab_idx ) const int get_tab_idx_at_point ( Vector2 point ) const int get_tab_idx_from_control ( Control control ) const Variant get_tab_metadata ( int tab_idx ) const String get_tab_title ( int tab_idx ) const bool is_tab_disabled ( int tab_idx ) const bool is_tab_hidden ( int tab_idx ) const bool select_next_available ( ) bool select_previous_available ( ) void set_popup ( Node popup ) void set_tab_button_icon ( int tab_idx, Texture2D icon ) void set_tab_disabled ( int tab_idx, bool disabled ) void set_tab_hidden ( int tab_idx, bool hidden ) void set_tab_icon ( int tab_idx, Texture2D icon ) void set_tab_metadata ( int tab_idx, Variant metadata ) void set_tab_title ( int tab_idx, String title ) Theme Properties Color drop_mark_color Color(1, 1, 1, 1) Color font_disabled_color Color(0.875, 0.875, 0.875, 0.5) Color font_hovered_color Color(0.95, 0.95, 0.95, 1) Color font_outline_color Color(1, 1, 1, 1) Color font_selected_color Color(0.95, 0.95, 0.95, 1) Color font_unselected_color Color(0.7, 0.7, 0.7, 1) int icon_max_width 0 int icon_separation 4 int outline_size 0 int side_margin 8 Font font int font_size Texture2D decrement Texture2D decrement_highlight Texture2D drop_mark Texture2D increment Texture2D increment_highlight Texture2D menu Texture2D menu_highlight StyleBox panel StyleBox tab_disabled StyleBox tab_focus StyleBox tab_hovered StyleBox tab_selected StyleBox tab_unselected StyleBox tabbar_background Signals active_tab_rearranged ( int idx_to ) Emitted when the active tab is rearranged via mouse drag. See drag_to_rearrange_enabled. pre_popup_pressed ( ) Emitted when the TabContainer's Popup button is clicked. See set_popup for details. tab_button_pressed ( int tab ) Emitted when the user clicks on the button icon on this tab. tab_changed ( int tab ) Emitted when switching to another tab. tab_clicked ( int tab ) Emitted when a tab is clicked, even if it is the current tab. tab_hovered ( int tab ) Emitted when a tab is hovered by the mouse. tab_selected ( int tab ) Emitted when a tab is selected via click, directional input, or script, even if it is the current tab. Property Descriptions bool all_tabs_in_front = false void set_all_tabs_in_front ( bool value ) bool is_all_tabs_in_front ( ) If true, all tabs are drawn in front of the panel. If false, inactive tabs are drawn behind the panel. bool clip_tabs = true void set_clip_tabs ( bool value ) bool get_clip_tabs ( ) If true, tabs overflowing this node's width will be hidden, displaying two navigation buttons instead. Otherwise, this node's minimum size is updated so that all tabs are visible. int current_tab = 0 void set_current_tab ( int value ) int get_current_tab ( ) The current tab index. When set, this index's Control node's visible property is set to true and all others are set to false. bool drag_to_rearrange_enabled = false void set_drag_to_rearrange_enabled ( bool value ) bool get_drag_to_rearrange_enabled ( ) If true, tabs can be rearranged with mouse drag. AlignmentMode tab_alignment = 0 void set_tab_alignment ( AlignmentMode value ) AlignmentMode get_tab_alignment ( ) Sets the position at which tabs will be placed. See AlignmentMode for details. FocusMode tab_focus_mode = 2 void set_tab_focus_mode ( FocusMode value ) FocusMode get_tab_focus_mode ( ) The focus access mode for the internal TabBar node. int tabs_rearrange_group = -1 void set_tabs_rearrange_group ( int value ) int get_tabs_rearrange_group ( ) TabContainers with the same rearrange group ID will allow dragging the tabs between them. Enable drag with drag_to_rearrange_enabled. Setting this to -1 will disable rearranging between TabContainers. bool tabs_visible = true void set_tabs_visible ( bool value ) bool are_tabs_visible ( ) If true, tabs are visible. If false, tabs' content and titles are hidden. bool use_hidden_tabs_for_min_size = false void set_use_hidden_tabs_for_min_size ( bool value ) bool get_use_hidden_tabs_for_min_size ( ) If true, child Control nodes that are hidden have their minimum size take into account in the total, instead of only the currently visible one. Method Descriptions Control get_current_tab_control ( ) const Returns the child Control node located at the active tab index. Popup get_popup ( ) const Returns the Popup node instance if one has been set already with set_popup. Warning: 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 Window.visible property. int get_previous_tab ( ) const Returns the previously active tab index. TabBar get_tab_bar ( ) const Returns the TabBar contained in this container. Warning: This is a required internal node, removing and freeing it or editing its tabs may cause a crash. If you wish to edit the tabs, use the methods provided in TabContainer. Texture2D get_tab_button_icon ( int tab_idx ) const Returns the button icon from the tab at index tab_idx. Control get_tab_control ( int tab_idx ) const Returns the Control node from the tab at index tab_idx. int get_tab_count ( ) const Returns the number of tabs. Texture2D get_tab_icon ( int tab_idx ) const Returns the Texture2D for the tab at index tab_idx or null if the tab has no Texture2D. int get_tab_idx_at_point ( Vector2 point ) const Returns the index of the tab at local coordinates point. Returns -1 if the point is outside the control boundaries or if there's no tab at the queried position. int get_tab_idx_from_control ( Control control ) const Returns the index of the tab tied to the given control. The control must be a child of the TabContainer. Variant get_tab_metadata ( int tab_idx ) const Returns the metadata value set to the tab at index tab_idx using set_tab_metadata. If no metadata was previously set, returns null by default. String get_tab_title ( int tab_idx ) const Returns the title of the tab at index tab_idx. Tab titles default to the name of the indexed child node, but this can be overridden with set_tab_title. bool is_tab_disabled ( int tab_idx ) const Returns true if the tab at index tab_idx is disabled. bool is_tab_hidden ( int tab_idx ) const Returns true if the tab at index tab_idx is hidden. bool select_next_available ( ) Selects the first available tab with greater index than the currently selected. Returns true if tab selection changed. bool select_previous_available ( ) Selects the first available tab with lower index than the currently selected. Returns true if tab selection changed. void set_popup ( Node popup ) If set on a Popup node instance, a popup menu icon appears in the top-right corner of the TabContainer (setting it to null will make it go away). Clicking it will expand the Popup node. void set_tab_button_icon ( int tab_idx, Texture2D icon ) Sets the button icon from the tab at index tab_idx. void set_tab_disabled ( int tab_idx, bool disabled ) If disabled is true, disables the tab at index tab_idx, making it non-interactable. void set_tab_hidden ( int tab_idx, bool hidden ) If hidden is true, hides the tab at index tab_idx, making it disappear from the tab area. void set_tab_icon ( int tab_idx, Texture2D icon ) Sets an icon for the tab at index tab_idx. void set_tab_metadata ( int tab_idx, Variant metadata ) Sets the metadata value for the tab at index tab_idx, which can be retrieved later using get_tab_metadata. void set_tab_title ( int tab_idx, String title ) Sets a custom title for the tab at index tab_idx (tab titles default to the name of the indexed child node). Set it back to the child's name to make the tab default to it again. Theme Property Descriptions Color drop_mark_color = Color(1, 1, 1, 1) Modulation color for the drop_mark icon. Color font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) Font color of disabled tabs. Color font_hovered_color = Color(0.95, 0.95, 0.95, 1) Font color of the currently hovered tab. Color font_outline_color = Color(1, 1, 1, 1) The tint of text outline of the tab name. Color font_selected_color = Color(0.95, 0.95, 0.95, 1) Font color of the currently selected tab. Color font_unselected_color = Color(0.7, 0.7, 0.7, 1) Font color of the other, unselected tabs. int icon_max_width = 0 The maximum allowed width of the tab's icon. This limit is applied on top of the default size of the icon, but before the value set with TabBar.set_tab_icon_max_width. The height is adjusted according to the icon's ratio. int icon_separation = 4 Space between tab's name and its icon. int outline_size = 0 The size of the tab text outline. Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended. int side_margin = 8 The space at the left or right edges of the tab bar, accordingly with the current tab_alignment. The margin is ignored with TabBar.ALIGNMENT_RIGHT if the tabs are clipped (see clip_tabs) or a popup has been set (see set_popup). The margin is always ignored with TabBar.ALIGNMENT_CENTER. Font font The font used to draw tab names. int font_size Font size of the tab names. Texture2D decrement Icon for the left arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the first tab is visible), it appears semi-transparent. Texture2D decrement_highlight Icon for the left arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor. Texture2D drop_mark Icon shown to indicate where a dragged tab is gonna be dropped (see drag_to_rearrange_enabled). Texture2D increment Icon for the right arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the last tab is visible) it appears semi-transparent. Texture2D increment_highlight Icon for the right arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor. Texture2D menu The icon for the menu button (see set_popup). Texture2D menu_highlight The icon for the menu button (see set_popup) when it's being hovered with the cursor. StyleBox panel The style for the background fill. StyleBox tab_disabled The style of disabled tabs. StyleBox tab_focus StyleBox used when the TabBar is focused. The tab_focus StyleBox is displayed over the base StyleBox of the selected tab, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons. StyleBox tab_hovered The style of the currently hovered tab. Note: This style will be drawn with the same width as tab_unselected at minimum. StyleBox tab_selected The style of the currently selected tab. StyleBox tab_unselected The style of the other, unselected tabs. StyleBox tabbar_background The style for the background fill of the TabBar area. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_tabcontainer.html classes/class_viewport ----------------------------------------------------------- Viewport Inherits: Node < Object Inherited By: SubViewport, Window Abstract base class for viewports. Encapsulates drawing and interaction with a game world. Description A Viewport creates a different view into the screen, or a sub-view inside another viewport. Child 2D nodes will display on it, and child Camera3D 3D nodes will render on it too. Optionally, a viewport can have its own 2D or 3D world, so it doesn't share what it draws with other viewports. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it. Also, viewports can be assigned to different screens in case the devices have multiple screens. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw. Tutorials Using Viewports Viewport and canvas transforms GUI in 3D Demo 3D in 2D Demo 2D in 3D Demo Screen Capture Demo Dynamic Split Screen Demo 3D Viewport Scaling Demo Properties bool audio_listener_enable_2d false bool audio_listener_enable_3d false int canvas_cull_mask 4294967295 DefaultCanvasItemTextureFilter canvas_item_default_texture_filter 1 DefaultCanvasItemTextureRepeat canvas_item_default_texture_repeat 0 Transform2D canvas_transform DebugDraw debug_draw 0 bool disable_3d false float fsr_sharpness 0.2 Transform2D global_canvas_transform bool gui_disable_input false bool gui_embed_subwindows false bool gui_snap_controls_to_pixels true bool handle_input_locally true float mesh_lod_threshold 1.0 MSAA msaa_2d 0 MSAA msaa_3d 0 bool own_world_3d false bool physics_object_picking false bool physics_object_picking_sort false bool positional_shadow_atlas_16_bits true PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_0 2 PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_1 2 PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_2 3 PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_3 4 int positional_shadow_atlas_size 2048 Scaling3DMode scaling_3d_mode 0 float scaling_3d_scale 1.0 ScreenSpaceAA screen_space_aa 0 SDFOversize sdf_oversize 1 SDFScale sdf_scale 1 bool snap_2d_transforms_to_pixel false bool snap_2d_vertices_to_pixel false float texture_mipmap_bias 0.0 bool transparent_bg false bool use_debanding false bool use_hdr_2d false bool use_occlusion_culling false bool use_taa false bool use_xr false VRSMode vrs_mode 0 Texture2D vrs_texture World2D world_2d World3D world_3d Methods World2D find_world_2d ( ) const World3D find_world_3d ( ) const Camera2D get_camera_2d ( ) const Camera3D get_camera_3d ( ) const bool get_canvas_cull_mask_bit ( int layer ) const Window[] get_embedded_subwindows ( ) const Transform2D get_final_transform ( ) const Vector2 get_mouse_position ( ) const PositionalShadowAtlasQuadrantSubdiv get_positional_shadow_atlas_quadrant_subdiv ( int quadrant ) const int get_render_info ( RenderInfoType type, RenderInfo info ) Transform2D get_screen_transform ( ) const ViewportTexture get_texture ( ) const RID get_viewport_rid ( ) const Rect2 get_visible_rect ( ) const Variant gui_get_drag_data ( ) const Control gui_get_focus_owner ( ) const bool gui_is_drag_successful ( ) const bool gui_is_dragging ( ) const void gui_release_focus ( ) bool is_input_handled ( ) const void push_input ( InputEvent event, bool in_local_coords=false ) void push_text_input ( String text ) void push_unhandled_input ( InputEvent event, bool in_local_coords=false ) void set_canvas_cull_mask_bit ( int layer, bool enable ) void set_input_as_handled ( ) void set_positional_shadow_atlas_quadrant_subdiv ( int quadrant, PositionalShadowAtlasQuadrantSubdiv subdiv ) void update_mouse_cursor_state ( ) void warp_mouse ( Vector2 position ) Signals gui_focus_changed ( Control node ) Emitted when a Control node grabs keyboard focus. size_changed ( ) Emitted when the size of the viewport is changed, whether by resizing of window, or some other means. Enumerations enum PositionalShadowAtlasQuadrantSubdiv: PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED = 0 This quadrant will not be used. PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_1 = 1 This quadrant will only be used by one shadow map. PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_4 = 2 This quadrant will be split in 4 and used by up to 4 shadow maps. PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_16 = 3 This quadrant will be split 16 ways and used by up to 16 shadow maps. PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_64 = 4 This quadrant will be split 64 ways and used by up to 64 shadow maps. PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_256 = 5 This quadrant will be split 256 ways and used by up to 256 shadow maps. Unless the positional_shadow_atlas_size is very high, the shadows in this quadrant will be very low resolution. PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_1024 = 6 This quadrant will be split 1024 ways and used by up to 1024 shadow maps. Unless the positional_shadow_atlas_size is very high, the shadows in this quadrant will be very low resolution. PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_MAX = 7 Represents the size of the PositionalShadowAtlasQuadrantSubdiv enum. enum Scaling3DMode: Scaling3DMode SCALING_3D_MODE_BILINEAR = 0 Use bilinear scaling for the viewport's 3D buffer. The amount of scaling can be set using scaling_3d_scale. Values less than 1.0 will result in undersampling while values greater than 1.0 will result in supersampling. A value of 1.0 disables scaling. Scaling3DMode SCALING_3D_MODE_FSR = 1 Use AMD FidelityFX Super Resolution 1.0 upscaling for the viewport's 3D buffer. The amount of scaling can be set using scaling_3d_scale. Values less than 1.0 will be result in the viewport being upscaled using FSR. Values greater than 1.0 are not supported and bilinear downsampling will be used instead. A value of 1.0 disables scaling. Scaling3DMode SCALING_3D_MODE_FSR2 = 2 Use AMD FidelityFX Super Resolution 2.2 upscaling for the viewport's 3D buffer. The amount of scaling can be set using scaling_3d_scale. Values less than 1.0 will be result in the viewport being upscaled using FSR2. Values greater than 1.0 are not supported and bilinear downsampling will be used instead. A value of 1.0 will use FSR2 at native resolution as a TAA solution. Scaling3DMode SCALING_3D_MODE_MAX = 3 Represents the size of the Scaling3DMode enum. enum MSAA: MSAA MSAA_DISABLED = 0 Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting. MSAA MSAA_2X = 1 Use 2× Multisample Antialiasing. This has a moderate performance cost. It helps reduce aliasing noticeably, but 4× MSAA still looks substantially better. MSAA MSAA_4X = 2 Use 4× Multisample Antialiasing. This has a significant performance cost, and is generally a good compromise between performance and quality. MSAA MSAA_8X = 3 Use 8× Multisample Antialiasing. This has a very high performance cost. The difference between 4× and 8× MSAA may not always be visible in real gameplay conditions. Likely unsupported on low-end and older hardware. MSAA MSAA_MAX = 4 Represents the size of the MSAA enum. enum ScreenSpaceAA: ScreenSpaceAA SCREEN_SPACE_AA_DISABLED = 0 Do not perform any antialiasing in the full screen post-process. ScreenSpaceAA SCREEN_SPACE_AA_FXAA = 1 Use fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K. ScreenSpaceAA SCREEN_SPACE_AA_MAX = 2 Represents the size of the ScreenSpaceAA enum. enum RenderInfo: RenderInfo RENDER_INFO_OBJECTS_IN_FRAME = 0 Amount of objects in frame. RenderInfo RENDER_INFO_PRIMITIVES_IN_FRAME = 1 Amount of vertices in frame. RenderInfo RENDER_INFO_DRAW_CALLS_IN_FRAME = 2 Amount of draw calls in frame. RenderInfo RENDER_INFO_MAX = 3 Represents the size of the RenderInfo enum. enum RenderInfoType: RenderInfoType RENDER_INFO_TYPE_VISIBLE = 0 RenderInfoType RENDER_INFO_TYPE_SHADOW = 1 RenderInfoType RENDER_INFO_TYPE_MAX = 2 enum DebugDraw: DebugDraw DEBUG_DRAW_DISABLED = 0 Objects are displayed normally. DebugDraw DEBUG_DRAW_UNSHADED = 1 Objects are displayed without light information. DebugDraw DEBUG_DRAW_LIGHTING = 2 DebugDraw DEBUG_DRAW_OVERDRAW = 3 Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw means you are wasting performance on drawing pixels that are being hidden behind others. DebugDraw DEBUG_DRAW_WIREFRAME = 4 Objects are displayed in wireframe style. DebugDraw DEBUG_DRAW_NORMAL_BUFFER = 5 DebugDraw DEBUG_DRAW_VOXEL_GI_ALBEDO = 6 Objects are displayed with only the albedo value from VoxelGIs. DebugDraw DEBUG_DRAW_VOXEL_GI_LIGHTING = 7 Objects are displayed with only the lighting value from VoxelGIs. DebugDraw DEBUG_DRAW_VOXEL_GI_EMISSION = 8 Objects are displayed with only the emission color from VoxelGIs. DebugDraw DEBUG_DRAW_SHADOW_ATLAS = 9 Draws the shadow atlas that stores shadows from OmniLight3Ds and SpotLight3Ds in the upper left quadrant of the Viewport. DebugDraw DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS = 10 Draws the shadow atlas that stores shadows from DirectionalLight3Ds in the upper left quadrant of the Viewport. DebugDraw DEBUG_DRAW_SCENE_LUMINANCE = 11 DebugDraw DEBUG_DRAW_SSAO = 12 Draws the screen-space ambient occlusion texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have Environment.ssao_enabled set in your WorldEnvironment. DebugDraw DEBUG_DRAW_SSIL = 13 Draws the screen-space indirect lighting texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have Environment.ssil_enabled set in your WorldEnvironment. DebugDraw DEBUG_DRAW_PSSM_SPLITS = 14 Colors each PSSM split for the DirectionalLight3Ds in the scene a different color so you can see where the splits are. In order, they will be colored red, green, blue, and yellow. DebugDraw DEBUG_DRAW_DECAL_ATLAS = 15 Draws the decal atlas used by Decals and light projector textures in the upper left quadrant of the Viewport. DebugDraw DEBUG_DRAW_SDFGI = 16 DebugDraw DEBUG_DRAW_SDFGI_PROBES = 17 DebugDraw DEBUG_DRAW_GI_BUFFER = 18 DebugDraw DEBUG_DRAW_DISABLE_LOD = 19 DebugDraw DEBUG_DRAW_CLUSTER_OMNI_LIGHTS = 20 DebugDraw DEBUG_DRAW_CLUSTER_SPOT_LIGHTS = 21 DebugDraw DEBUG_DRAW_CLUSTER_DECALS = 22 DebugDraw DEBUG_DRAW_CLUSTER_REFLECTION_PROBES = 23 DebugDraw DEBUG_DRAW_OCCLUDERS = 24 DebugDraw DEBUG_DRAW_MOTION_VECTORS = 25 DebugDraw DEBUG_DRAW_INTERNAL_BUFFER = 26 Draws the internal resolution buffer of the scene before post-processing is applied. enum DefaultCanvasItemTextureFilter: DefaultCanvasItemTextureFilter DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST = 0 The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled). DefaultCanvasItemTextureFilter DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR = 1 The texture filter blends between the nearest 4 pixels. This makes the texture look smooth from up close, and grainy from a distance (due to mipmaps not being sampled). DefaultCanvasItemTextureFilter DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS = 2 The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true). This makes the texture look smooth from up close, and smooth from a distance. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to Camera2D zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels. DefaultCanvasItemTextureFilter DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS = 3 The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or uses the nearest mipmap if ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter is true). This makes the texture look pixelated from up close, and smooth from a distance. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to Camera2D zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels. DefaultCanvasItemTextureFilter DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX = 4 Max value for DefaultCanvasItemTextureFilter enum. enum DefaultCanvasItemTextureRepeat: DefaultCanvasItemTextureRepeat DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED = 0 Disables textures repeating. Instead, when reading UVs outside the 0-1 range, the value will be clamped to the edge of the texture, resulting in a stretched out look at the borders of the texture. DefaultCanvasItemTextureRepeat DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED = 1 Enables the texture to repeat when UV coordinates are outside the 0-1 range. If using one of the linear filtering modes, this can result in artifacts at the edges of a texture when the sampler filters across the edges of the texture. DefaultCanvasItemTextureRepeat DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR = 2 Flip the texture when repeating so that the edge lines up instead of abruptly changing. DefaultCanvasItemTextureRepeat DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX = 3 Max value for DefaultCanvasItemTextureRepeat enum. enum SDFOversize: SDFOversize SDF_OVERSIZE_100_PERCENT = 0 SDFOversize SDF_OVERSIZE_120_PERCENT = 1 SDFOversize SDF_OVERSIZE_150_PERCENT = 2 SDFOversize SDF_OVERSIZE_200_PERCENT = 3 SDFOversize SDF_OVERSIZE_MAX = 4 enum SDFScale: SDFScale SDF_SCALE_100_PERCENT = 0 SDFScale SDF_SCALE_50_PERCENT = 1 SDFScale SDF_SCALE_25_PERCENT = 2 SDFScale SDF_SCALE_MAX = 3 enum VRSMode: VRSMode VRS_DISABLED = 0 VRS is disabled. VRSMode VRS_TEXTURE = 1 VRS uses a texture. Note, for stereoscopic use a texture atlas with a texture for each view. VRSMode VRS_XR = 2 VRS texture is supplied by the primary XRInterface. VRSMode VRS_MAX = 3 Represents the size of the VRSMode enum. Property Descriptions bool audio_listener_enable_2d = false void set_as_audio_listener_2d ( bool value ) bool is_audio_listener_2d ( ) If true, the viewport will process 2D audio streams. bool audio_listener_enable_3d = false void set_as_audio_listener_3d ( bool value ) bool is_audio_listener_3d ( ) If true, the viewport will process 3D audio streams. int canvas_cull_mask = 4294967295 void set_canvas_cull_mask ( int value ) int get_canvas_cull_mask ( ) The rendering layers in which this Viewport renders CanvasItem nodes. DefaultCanvasItemTextureFilter canvas_item_default_texture_filter = 1 void set_default_canvas_item_texture_filter ( DefaultCanvasItemTextureFilter value ) DefaultCanvasItemTextureFilter get_default_canvas_item_texture_filter ( ) Sets the default filter mode used by CanvasItems in this Viewport. See DefaultCanvasItemTextureFilter for options. DefaultCanvasItemTextureRepeat canvas_item_default_texture_repeat = 0 void set_default_canvas_item_texture_repeat ( DefaultCanvasItemTextureRepeat value ) DefaultCanvasItemTextureRepeat get_default_canvas_item_texture_repeat ( ) Sets the default repeat mode used by CanvasItems in this Viewport. See DefaultCanvasItemTextureRepeat for options. Transform2D canvas_transform void set_canvas_transform ( Transform2D value ) Transform2D get_canvas_transform ( ) The canvas transform of the viewport, useful for changing the on-screen positions of all child CanvasItems. This is relative to the global canvas transform of the viewport. DebugDraw debug_draw = 0 void set_debug_draw ( DebugDraw value ) DebugDraw get_debug_draw ( ) The overlay mode for test rendered geometry in debug purposes. bool disable_3d = false void set_disable_3d ( bool value ) bool is_3d_disabled ( ) Disable 3D rendering (but keep 2D rendering). float fsr_sharpness = 0.2 void set_fsr_sharpness ( float value ) float get_fsr_sharpness ( ) Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference. To control this property on the root viewport, set the ProjectSettings.rendering/scaling_3d/fsr_sharpness project setting. Transform2D global_canvas_transform void set_global_canvas_transform ( Transform2D value ) Transform2D get_global_canvas_transform ( ) The global canvas transform of the viewport. The canvas transform is relative to this. bool gui_disable_input = false void set_disable_input ( bool value ) bool is_input_disabled ( ) If true, the viewport will not receive input events. bool gui_embed_subwindows = false void set_embedding_subwindows ( bool value ) bool is_embedding_subwindows ( ) If true, sub-windows (popups and dialogs) will be embedded inside application window as control-like nodes. If false, they will appear as separate windows handled by the operating system. bool gui_snap_controls_to_pixels = true void set_snap_controls_to_pixels ( bool value ) bool is_snap_controls_to_pixels_enabled ( ) If true, the GUI controls on the viewport will lay pixel perfectly. bool handle_input_locally = true void set_handle_input_locally ( bool value ) bool is_handling_input_locally ( ) If true, this viewport will mark incoming input events as handled by itself. If false, this is instead done by the first parent viewport that is set to handle input locally. A SubViewportContainer will automatically set this property to false for the Viewport contained inside of it. See also set_input_as_handled and is_input_handled. float mesh_lod_threshold = 1.0 void set_mesh_lod_threshold ( float value ) float get_mesh_lod_threshold ( ) The automatic LOD bias to use for meshes rendered within the Viewport (this is analogous to ReflectionProbe.mesh_lod_threshold). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to 0.0, automatic LOD is disabled. Increase mesh_lod_threshold to improve performance at the cost of geometry detail. To control this property on the root viewport, set the ProjectSettings.rendering/mesh_lod/lod_change/threshold_pixels project setting. Note: mesh_lod_threshold does not affect GeometryInstance3D visibility ranges (also known as "manual" LOD or hierarchical LOD). MSAA msaa_2d = 0 void set_msaa_2d ( MSAA value ) MSAA get_msaa_2d ( ) The multisample anti-aliasing mode for 2D/Canvas rendering. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. This has no effect on shader-induced aliasing or texture aliasing. MSAA msaa_3d = 0 void set_msaa_3d ( MSAA value ) MSAA get_msaa_3d ( ) The multisample anti-aliasing mode for 3D rendering. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. See also bilinear scaling 3d scaling_3d_mode for supersampling, which provides higher quality but is much more expensive. This has no effect on shader-induced aliasing or texture aliasing. bool own_world_3d = false void set_use_own_world_3d ( bool value ) bool is_using_own_world_3d ( ) If true, the viewport will use a unique copy of the World3D defined in world_3d. bool physics_object_picking = false void set_physics_object_picking ( bool value ) bool get_physics_object_picking ( ) If true, the objects rendered by viewport become subjects of mouse picking process. Note: The number of simultaneously pickable objects is limited to 64 and they are selected in a non-deterministic order, which can be different in each picking process. bool physics_object_picking_sort = false void set_physics_object_picking_sort ( bool value ) bool get_physics_object_picking_sort ( ) If true, objects receive mouse picking events sorted primarily by their CanvasItem.z_index and secondarily by their position in the scene tree. If false, the order is undetermined. Note: This setting is disabled by default because of its potential expensive computational cost. Note: Sorting happens after selecting the pickable objects. Because of the limitation of 64 simultaneously pickable objects, it is not guaranteed that the object with the highest CanvasItem.z_index receives the picking event. bool positional_shadow_atlas_16_bits = true void set_positional_shadow_atlas_16_bits ( bool value ) bool get_positional_shadow_atlas_16_bits ( ) Use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices. PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_0 = 2 void set_positional_shadow_atlas_quadrant_subdiv ( int quadrant, PositionalShadowAtlasQuadrantSubdiv subdiv ) PositionalShadowAtlasQuadrantSubdiv get_positional_shadow_atlas_quadrant_subdiv ( int quadrant ) const The subdivision amount of the first quadrant on the shadow atlas. PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_1 = 2 void set_positional_shadow_atlas_quadrant_subdiv ( int quadrant, PositionalShadowAtlasQuadrantSubdiv subdiv ) PositionalShadowAtlasQuadrantSubdiv get_positional_shadow_atlas_quadrant_subdiv ( int quadrant ) const The subdivision amount of the second quadrant on the shadow atlas. PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_2 = 3 void set_positional_shadow_atlas_quadrant_subdiv ( int quadrant, PositionalShadowAtlasQuadrantSubdiv subdiv ) PositionalShadowAtlasQuadrantSubdiv get_positional_shadow_atlas_quadrant_subdiv ( int quadrant ) const The subdivision amount of the third quadrant on the shadow atlas. PositionalShadowAtlasQuadrantSubdiv positional_shadow_atlas_quad_3 = 4 void set_positional_shadow_atlas_quadrant_subdiv ( int quadrant, PositionalShadowAtlasQuadrantSubdiv subdiv ) PositionalShadowAtlasQuadrantSubdiv get_positional_shadow_atlas_quadrant_subdiv ( int quadrant ) const The subdivision amount of the fourth quadrant on the shadow atlas. int positional_shadow_atlas_size = 2048 void set_positional_shadow_atlas_size ( int value ) int get_positional_shadow_atlas_size ( ) The shadow atlas' resolution (used for omni and spot lights). The value is rounded up to the nearest power of 2. Note: If this is set to 0, no positional shadows will be visible at all. This can improve performance significantly on low-end systems by reducing both the CPU and GPU load (as fewer draw calls are needed to draw the scene without shadows). Scaling3DMode scaling_3d_mode = 0 void set_scaling_3d_mode ( Scaling3DMode value ) Scaling3DMode get_scaling_3d_mode ( ) Sets scaling 3d mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible. To control this property on the root viewport, set the ProjectSettings.rendering/scaling_3d/mode project setting. float scaling_3d_scale = 1.0 void set_scaling_3d_scale ( float value ) float get_scaling_3d_scale ( ) Scales the 3D render buffer based on the viewport size uses an image filter specified in ProjectSettings.rendering/scaling_3d/mode to scale the output image to the full viewport size. Values lower than 1.0 can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than 1.0 are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also ProjectSettings.rendering/anti_aliasing/quality/msaa_3d for multi-sample antialiasing, which is significantly cheaper but only smooths the edges of polygons. When using FSR upscaling, AMD recommends exposing the following values as preset options to users "Ultra Quality: 0.77", "Quality: 0.67", "Balanced: 0.59", "Performance: 0.5" instead of exposing the entire scale. To control this property on the root viewport, set the ProjectSettings.rendering/scaling_3d/scale project setting. ScreenSpaceAA screen_space_aa = 0 void set_screen_space_aa ( ScreenSpaceAA value ) ScreenSpaceAA get_screen_space_aa ( ) Sets the screen-space antialiasing method used. Screen-space antialiasing works by selectively blurring edges in a post-process shader. It differs from MSAA which takes multiple coverage samples while rendering objects. Screen-space AA methods are typically faster than MSAA and will smooth out specular aliasing, but tend to make scenes appear blurry. SDFOversize sdf_oversize = 1 void set_sdf_oversize ( SDFOversize value ) SDFOversize get_sdf_oversize ( ) There is currently no description for this property. Please help us by contributing one! SDFScale sdf_scale = 1 void set_sdf_scale ( SDFScale value ) SDFScale get_sdf_scale ( ) There is currently no description for this property. Please help us by contributing one! bool snap_2d_transforms_to_pixel = false void set_snap_2d_transforms_to_pixel ( bool value ) bool is_snap_2d_transforms_to_pixel_enabled ( ) There is currently no description for this property. Please help us by contributing one! bool snap_2d_vertices_to_pixel = false void set_snap_2d_vertices_to_pixel ( bool value ) bool is_snap_2d_vertices_to_pixel_enabled ( ) There is currently no description for this property. Please help us by contributing one! float texture_mipmap_bias = 0.0 void set_texture_mipmap_bias ( float value ) float get_texture_mipmap_bias ( ) Affects the final texture sharpness by reading from a lower or higher mipmap (also called "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close). Enabling temporal antialiasing (use_taa) will automatically apply a -0.5 offset to this value, while enabling FXAA (screen_space_aa) will automatically apply a -0.25 offset to this value. If both TAA and FXAA are enabled at the same time, an offset of -0.75 is applied to this value. Note: If scaling_3d_scale is lower than 1.0 (exclusive), texture_mipmap_bias is used to adjust the automatic mipmap bias which is calculated internally based on the scale factor. The formula for this is log2(scaling_3d_scale) + mipmap_bias. To control this property on the root viewport, set the ProjectSettings.rendering/textures/default_filters/texture_mipmap_bias project setting. bool transparent_bg = false void set_transparent_background ( bool value ) bool has_transparent_background ( ) If true, the viewport should render its background as transparent. bool use_debanding = false void set_use_debanding ( bool value ) bool is_using_debanding ( ) If true, uses a fast post-processing filter to make banding significantly less visible in 3D. 2D rendering is not affected by debanding unless the Environment.background_mode is Environment.BG_CANVAS. See also ProjectSettings.rendering/anti_aliasing/quality/use_debanding. In some cases, debanding may introduce a slightly noticeable dithering pattern. It's recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger. bool use_hdr_2d = false void set_use_hdr_2d ( bool value ) bool is_using_hdr_2d ( ) If true, 2D rendering will use an high dynamic range (HDR) format framebuffer matching the bit depth of the 3D framebuffer. When using the Forward+ renderer this will be a RGBA16 framebuffer, while when using the Mobile renderer it will be a RGB10_A2 framebuffer. Additionally, 2D rendering will take place in linear color space and will be converted to sRGB space immediately before blitting to the screen (if the Viewport is attached to the screen). Practically speaking, this means that the end result of the Viewport will not be clamped into the 0-1 range and can be used in 3D rendering without color space adjustments. This allows 2D rendering to take advantage of effects requiring high dynamic range (e.g. 2D glow) as well as substantially improves the appearance of effects requiring highly detailed gradients. Note: This setting will have no effect when using the GL Compatibility renderer as the GL Compatibility renderer always renders in low dynamic range for performance reasons. bool use_occlusion_culling = false void set_use_occlusion_culling ( bool value ) bool is_using_occlusion_culling ( ) If true, OccluderInstance3D nodes will be usable for occlusion culling in 3D for this viewport. For the root viewport, ProjectSettings.rendering/occlusion_culling/use_occlusion_culling must be set to true instead. Note: Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it, and think whether your scene can actually benefit from occlusion culling. Large, open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges (GeometryInstance3D.visibility_range_begin and GeometryInstance3D.visibility_range_end) compared to occlusion culling. Note: Due to memory constraints, occlusion culling is not supported by default in Web export templates. It can be enabled by compiling custom Web export templates with module_raycast_enabled=yes. bool use_taa = false void set_use_taa ( bool value ) bool is_using_taa ( ) Enables Temporal Anti-Aliasing for this viewport. TAA works by jittering the camera and accumulating the images of the last rendered frames, motion vector rendering is used to account for camera and object motion. Note: The implementation is not complete yet, some visual instances such as particles and skinned meshes may show artifacts. bool use_xr = false void set_use_xr ( bool value ) bool is_using_xr ( ) If true, the viewport will use the primary XR interface to render XR output. When applicable this can result in a stereoscopic image and the resulting render being output to a headset. VRSMode vrs_mode = 0 void set_vrs_mode ( VRSMode value ) VRSMode get_vrs_mode ( ) The Variable Rate Shading (VRS) mode that is used for this viewport. Note, if hardware does not support VRS this property is ignored. Texture2D vrs_texture void set_vrs_texture ( Texture2D value ) Texture2D get_vrs_texture ( ) Texture to use when vrs_mode is set to VRS_TEXTURE. The texture must use a lossless compression format so that colors can be matched precisely. The following VRS densities are mapped to various colors, with brighter colors representing a lower level of shading precision: - 1x1 = rgb(0, 0, 0) - #000000 - 1x2 = rgb(0, 85, 0) - #005500 - 2x1 = rgb(85, 0, 0) - #550000 - 2x2 = rgb(85, 85, 0) - #555500 - 2x4 = rgb(85, 170, 0) - #55aa00 - 4x2 = rgb(170, 85, 0) - #aa5500 - 4x4 = rgb(170, 170, 0) - #aaaa00 - 4x8 = rgb(170, 255, 0) - #aaff00 - Not supported on most hardware - 8x4 = rgb(255, 170, 0) - #ffaa00 - Not supported on most hardware - 8x8 = rgb(255, 255, 0) - #ffff00 - Not supported on most hardware World2D world_2d void set_world_2d ( World2D value ) World2D get_world_2d ( ) The custom World2D which can be used as 2D environment source. World3D world_3d void set_world_3d ( World3D value ) World3D get_world_3d ( ) The custom World3D which can be used as 3D environment source. Method Descriptions World2D find_world_2d ( ) const Returns the first valid World2D for this viewport, searching the world_2d property of itself and any Viewport ancestor. World3D find_world_3d ( ) const Returns the first valid World3D for this viewport, searching the world_3d property of itself and any Viewport ancestor. Camera2D get_camera_2d ( ) const Returns the currently active 2D camera. Returns null if there are no active cameras. Camera3D get_camera_3d ( ) const Returns the currently active 3D camera. bool get_canvas_cull_mask_bit ( int layer ) const Returns an individual bit on the rendering layer mask. Window[] get_embedded_subwindows ( ) const Returns a list of the visible embedded Windows inside the viewport. Note: Windows inside other viewports will not be listed. Transform2D get_final_transform ( ) const Returns the transform from the viewport's coordinate system to the embedder's coordinate system. Vector2 get_mouse_position ( ) const Returns the mouse's position in this Viewport using the coordinate system of this Viewport. PositionalShadowAtlasQuadrantSubdiv get_positional_shadow_atlas_quadrant_subdiv ( int quadrant ) const Returns the PositionalShadowAtlasQuadrantSubdiv of the specified quadrant. int get_render_info ( RenderInfoType type, RenderInfo info ) Returns rendering statistics of the given type. See RenderInfoType and RenderInfo for options. Transform2D get_screen_transform ( ) const Returns the transform from the Viewport's coordinates to the screen coordinates of the containing window manager window. ViewportTexture get_texture ( ) const Returns the viewport's texture. Note: When trying to store the current texture (e.g. in a file), it might be completely black or outdated if used too early, especially when used in e.g. Node._ready. To make sure the texture you get is correct, you can await RenderingServer.frame_post_draw signal. func _ready(): await RenderingServer.frame_post_draw $Viewport.get_texture().get_image().save_png("user://Screenshot.png") RID get_viewport_rid ( ) const Returns the viewport's RID from the RenderingServer. Rect2 get_visible_rect ( ) const Returns the visible rectangle in global screen coordinates. Variant gui_get_drag_data ( ) const Returns the drag data from the GUI, that was previously returned by Control._get_drag_data. Control gui_get_focus_owner ( ) const Returns the Control having the focus within this viewport. If no Control has the focus, returns null. bool gui_is_drag_successful ( ) const Returns true if the drag operation is successful. bool gui_is_dragging ( ) const Returns true if the viewport is currently performing a drag operation. Alternative to Node.NOTIFICATION_DRAG_BEGIN and Node.NOTIFICATION_DRAG_END when you prefer polling the value. void gui_release_focus ( ) Removes the focus from the currently focused Control within this viewport. If no Control has the focus, does nothing. bool is_input_handled ( ) const Returns whether the current InputEvent has been handled. Input events are not handled until set_input_as_handled has been called during the lifetime of an InputEvent. This is usually done as part of input handling methods like Node._input, Control._gui_input or others, as well as in corresponding signal handlers. If handle_input_locally is set to false, this method will try finding the first parent viewport that is set to handle input locally, and return its value for is_input_handled instead. void push_input ( InputEvent event, bool in_local_coords=false ) Triggers the given event in this Viewport. This can be used to pass an InputEvent between viewports, or to locally apply inputs that were sent over the network or saved to a file. If in_local_coords is false, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If in_local_coords is true, the event's position is in viewport coordinates. While this method serves a similar purpose as Input.parse_input_event, it does not remap the specified event based on project settings like ProjectSettings.input_devices/pointing/emulate_touch_from_mouse. Calling this method will propagate calls to child nodes for following methods in the given order: Node._input Control._gui_input for Control nodes Node._shortcut_input Node._unhandled_key_input Node._unhandled_input If an earlier method marks the input as handled via set_input_as_handled, any later method in this list will not be called. If none of the methods handle the event and physics_object_picking is true, the event is used for physics object picking. void push_text_input ( String text ) Helper method which calls the set_text() method on the currently focused Control, provided that it is defined (e.g. if the focused Control is Button or LineEdit). void push_unhandled_input ( InputEvent event, bool in_local_coords=false ) Triggers the given InputEvent in this Viewport. This can be used to pass input events between viewports, or to locally apply inputs that were sent over the network or saved to a file. If in_local_coords is false, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If in_local_coords is true, the event's position is in viewport coordinates. While this method serves a similar purpose as Input.parse_input_event, it does not remap the specified event based on project settings like ProjectSettings.input_devices/pointing/emulate_touch_from_mouse. Calling this method will propagate calls to child nodes for following methods in the given order: Node._shortcut_input Node._unhandled_key_input Node._unhandled_input If an earlier method marks the input as handled via set_input_as_handled, any later method in this list will not be called. If none of the methods handle the event and physics_object_picking is true, the event is used for physics object picking. Note: This method doesn't propagate input events to embedded Windows or SubViewports. Deprecated. Use push_input instead. void set_canvas_cull_mask_bit ( int layer, bool enable ) Set/clear individual bits on the rendering layer mask. This simplifies editing this Viewport's layers. void set_input_as_handled ( ) Stops the input from propagating further down the SceneTree. Note: This does not affect the methods in Input, only the way events are propagated. void set_positional_shadow_atlas_quadrant_subdiv ( int quadrant, PositionalShadowAtlasQuadrantSubdiv subdiv ) Sets the number of subdivisions to use in the specified quadrant. A higher number of subdivisions allows you to have more shadows in the scene at once, but reduces the quality of the shadows. A good practice is to have quadrants with a varying number of subdivisions and to have as few subdivisions as possible. void update_mouse_cursor_state ( ) Force instantly updating the display based on the current mouse cursor position. This includes updating the mouse cursor shape and sending necessary Control.mouse_entered, CollisionObject2D.mouse_entered, CollisionObject3D.mouse_entered and Window.mouse_entered signals and their respective mouse_exited counterparts. void warp_mouse ( Vector2 position ) Moves the mouse pointer to the specified position in this Viewport using the coordinate system of this Viewport. Note: warp_mouse is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_viewport.html classes/class_navigationregion2d ----------------------------------------------------------- NavigationRegion2D Inherits: Node2D < CanvasItem < Node < Object A traversable 2D region that NavigationAgent2Ds can use for pathfinding. Description A traversable 2D region based on a NavigationPolygon that NavigationAgent2Ds can use for pathfinding. Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using NavigationServer2D.map_set_edge_connection_margin. Note: Overlapping two regions' navigation polygons is not enough for connecting two regions. They must share a similar edge. The pathfinding cost of entering a region from another region can be controlled with the enter_cost value. Note: This value is not added to the path cost when the start position is already inside this region. The pathfinding cost of traveling distances inside this region can be controlled with the travel_cost multiplier. Note: This node caches changes to its properties, so if you make changes to the underlying region RID in NavigationServer2D, they will not be reflected in this node's properties. Tutorials Using NavigationRegions Properties int avoidance_layers 1 bool constrain_avoidance false bool enabled true float enter_cost 0.0 int navigation_layers 1 NavigationPolygon navigation_polygon float travel_cost 1.0 bool use_edge_connections true Methods void bake_navigation_polygon ( bool on_thread=true ) bool get_avoidance_layer_value ( int layer_number ) const bool get_navigation_layer_value ( int layer_number ) const RID get_navigation_map ( ) const RID get_region_rid ( ) const RID get_rid ( ) const void set_avoidance_layer_value ( int layer_number, bool value ) void set_navigation_layer_value ( int layer_number, bool value ) void set_navigation_map ( RID navigation_map ) Signals bake_finished ( ) Emitted when a navigation polygon bake operation is completed. navigation_polygon_changed ( ) Emitted when the used navigation polygon is replaced or changes to the internals of the current navigation polygon are committed. Property Descriptions int avoidance_layers = 1 void set_avoidance_layers ( int value ) int get_avoidance_layers ( ) A bitfield determining all avoidance layers for the avoidance constrain. bool constrain_avoidance = false void set_constrain_avoidance ( bool value ) bool get_constrain_avoidance ( ) If true constraints avoidance agent's with an avoidance mask bit that matches with a bit of the avoidance_layers to the navigation polygon. Due to each navigation polygon outline creating an obstacle and each polygon edge creating an avoidance line constrain keep the navigation polygon shape as simple as possible for performance. Experimental: This is an experimental feature and should not be used in production as agent's can get stuck on the navigation polygon corners and edges especially at high frame rate. bool enabled = true void set_enabled ( bool value ) bool is_enabled ( ) Determines if the NavigationRegion2D is enabled or disabled. float enter_cost = 0.0 void set_enter_cost ( float value ) float get_enter_cost ( ) When pathfinding enters this region's navigation mesh from another regions navigation mesh the enter_cost value is added to the path distance for determining the shortest path. int navigation_layers = 1 void set_navigation_layers ( int value ) int get_navigation_layers ( ) A bitfield determining all navigation layers the region belongs to. These navigation layers can be checked upon when requesting a path with NavigationServer2D.map_get_path. NavigationPolygon navigation_polygon void set_navigation_polygon ( NavigationPolygon value ) NavigationPolygon get_navigation_polygon ( ) The NavigationPolygon resource to use. float travel_cost = 1.0 void set_travel_cost ( float value ) float get_travel_cost ( ) When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with travel_cost for determining the shortest path. bool use_edge_connections = true void set_use_edge_connections ( bool value ) bool get_use_edge_connections ( ) If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin. Method Descriptions void bake_navigation_polygon ( bool on_thread=true ) Bakes the NavigationPolygon. If on_thread is set to true (default), the baking is done on a separate thread. bool get_avoidance_layer_value ( int layer_number ) const Returns whether or not the specified layer of the avoidance_layers bitmask is enabled, given a layer_number between 1 and 32. bool get_navigation_layer_value ( int layer_number ) const Returns whether or not the specified layer of the navigation_layers bitmask is enabled, given a layer_number between 1 and 32. RID get_navigation_map ( ) const Returns the current navigation map RID used by this region. RID get_region_rid ( ) const Returns the RID of this region on the NavigationServer2D. Deprecated. Use get_rid instead. RID get_rid ( ) const Returns the RID of this region on the NavigationServer2D. Combined with NavigationServer2D.map_get_closest_point_owner can be used to identify the NavigationRegion2D closest to a point on the merged navigation map. void set_avoidance_layer_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the avoidance_layers bitmask, given a layer_number between 1 and 32. void set_navigation_layer_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the navigation_layers bitmask, given a layer_number between 1 and 32. void set_navigation_map ( RID navigation_map ) Sets the RID of the navigation map this region should use. By default the region will automatically join the World2D default navigation map so this function is only required to override the default map. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_navigationregion2d.html classes/class_animationplayer ----------------------------------------------------------- AnimationPlayer Inherits: AnimationMixer < Node < Object A node used for animation playback. Description An animation player is used for general-purpose playback of animations. It contains a dictionary of AnimationLibrary resources and custom blend times between animation transitions. Some methods and properties use a single key to reference an animation directly. These keys are formatted as the key for the library, followed by a forward slash, then the key for the animation within the library, for example "movement/run". If the library's key is an empty string (known as the default library), the forward slash is omitted, being the same key used by the library. AnimationPlayer is better-suited than Tween for more complex animations, for example ones with non-trivial timings. It can also be used over Tween if the animation track editor is more convenient than doing it in code. Updating the target properties of animations occurs at the process frame. Tutorials 2D Sprite animation Animation documentation index Third Person Shooter Demo Properties String assigned_animation String autoplay "" String current_animation "" float current_animation_length float current_animation_position bool movie_quit_on_finish false float playback_default_blend_time 0.0 float speed_scale 1.0 Methods StringName animation_get_next ( StringName animation_from ) const void animation_set_next ( StringName animation_from, StringName animation_to ) void clear_queue ( ) float get_blend_time ( StringName animation_from, StringName animation_to ) const AnimationMethodCallMode get_method_call_mode ( ) const float get_playing_speed ( ) const AnimationProcessCallback get_process_callback ( ) const PackedStringArray get_queue ( ) NodePath get_root ( ) const bool is_playing ( ) const void pause ( ) void play ( StringName name="", float custom_blend=-1, float custom_speed=1.0, bool from_end=false ) void play_backwards ( StringName name="", float custom_blend=-1 ) void queue ( StringName name ) void seek ( float seconds, bool update=false, bool update_only=false ) void set_blend_time ( StringName animation_from, StringName animation_to, float sec ) void set_method_call_mode ( AnimationMethodCallMode mode ) void set_process_callback ( AnimationProcessCallback mode ) void set_root ( NodePath path ) void stop ( bool keep_state=false ) Signals animation_changed ( StringName old_name, StringName new_name ) Emitted when a queued animation plays after the previous animation finished. See also queue. Note: The signal is not emitted when the animation is changed via play or by an AnimationTree. current_animation_changed ( String name ) Emitted when current_animation changes. Enumerations enum AnimationProcessCallback: AnimationProcessCallback ANIMATION_PROCESS_PHYSICS = 0 For backward compatibility. See AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS. AnimationProcessCallback ANIMATION_PROCESS_IDLE = 1 For backward compatibility. See AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_IDLE. AnimationProcessCallback ANIMATION_PROCESS_MANUAL = 2 For backward compatibility. See AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_MANUAL. enum AnimationMethodCallMode: AnimationMethodCallMode ANIMATION_METHOD_CALL_DEFERRED = 0 For backward compatibility. See AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_DEFERRED. AnimationMethodCallMode ANIMATION_METHOD_CALL_IMMEDIATE = 1 For backward compatibility. See AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE. Property Descriptions String assigned_animation void set_assigned_animation ( String value ) String get_assigned_animation ( ) If playing, the current animation's key, otherwise, the animation last played. When set, this changes the animation, but will not play it unless already playing. See also current_animation. String autoplay = "" void set_autoplay ( String value ) String get_autoplay ( ) The key of the animation to play when the scene loads. String current_animation = "" void set_current_animation ( String value ) String get_current_animation ( ) The key of the currently playing animation. If no animation is playing, the property's value is an empty string. Changing this value does not restart the animation. See play for more information on playing animations. Note: While this property appears in the Inspector, it's not meant to be edited, and it's not saved in the scene. This property is mainly used to get the currently playing animation, and internally for animation playback tracks. For more information, see Animation. float current_animation_length float get_current_animation_length ( ) The length (in seconds) of the currently playing animation. float current_animation_position float get_current_animation_position ( ) The position (in seconds) of the currently playing animation. bool movie_quit_on_finish = false void set_movie_quit_on_finish_enabled ( bool value ) bool is_movie_quit_on_finish_enabled ( ) If true and the engine is running in Movie Maker mode (see MovieWriter), exits the engine with SceneTree.quit as soon as an animation is done playing in this AnimationPlayer. A message is printed when the engine quits for this reason. Note: This obeys the same logic as the AnimationMixer.animation_finished signal, so it will not quit the engine if the animation is set to be looping. float playback_default_blend_time = 0.0 void set_default_blend_time ( float value ) float get_default_blend_time ( ) The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision. float speed_scale = 1.0 void set_speed_scale ( float value ) float get_speed_scale ( ) The speed scaling ratio. For example, if this value is 1, then the animation plays at normal speed. If it's 0.5, then it plays at half speed. If it's 2, then it plays at double speed. If set to a negative value, the animation is played in reverse. If set to 0, the animation will not advance. Method Descriptions StringName animation_get_next ( StringName animation_from ) const Returns the key of the animation which is queued to play after the animation_from animation. void animation_set_next ( StringName animation_from, StringName animation_to ) Triggers the animation_to animation when the animation_from animation completes. void clear_queue ( ) Clears all queued, unplayed animations. float get_blend_time ( StringName animation_from, StringName animation_to ) const Returns the blend time (in seconds) between two animations, referenced by their keys. AnimationMethodCallMode get_method_call_mode ( ) const For backward compatibility. See AnimationCallbackModeMethod. float get_playing_speed ( ) const Returns the actual playing speed of current animation or 0 if not playing. This speed is the speed_scale property multiplied by custom_speed argument specified when calling the play method. Returns a negative value if the current animation is playing backwards. AnimationProcessCallback get_process_callback ( ) const For backward compatibility. See AnimationCallbackModeProcess. PackedStringArray get_queue ( ) Returns a list of the animation keys that are currently queued to play. NodePath get_root ( ) const For backward compatibility. See AnimationMixer.root_node. bool is_playing ( ) const Returns true if an animation is currently playing (even if speed_scale and/or custom_speed are 0). void pause ( ) Pauses the currently playing animation. The current_animation_position will be kept and calling play or play_backwards without arguments or with the same animation name as assigned_animation will resume the animation. See also stop. void play ( StringName name="", float custom_blend=-1, float custom_speed=1.0, bool from_end=false ) Plays the animation with key name. Custom blend times and speed can be set. The from_end option only affects when switching to a new animation track, or if the same track but at the start or end. It does not affect resuming playback that was paused in the middle of an animation. If custom_speed is negative and from_end is true, the animation will play backwards (which is equivalent to calling play_backwards). The AnimationPlayer keeps track of its current or last played animation with assigned_animation. If this method is called with that same animation name, or with no name parameter, the assigned animation will resume playing if it was paused. Note: The animation will be updated the next time the AnimationPlayer is processed. If other variables are updated at the same time this is called, they may be updated too early. To perform the update immediately, call advance(0). void play_backwards ( StringName name="", float custom_blend=-1 ) Plays the animation with key name in reverse. This method is a shorthand for play with custom_speed = -1.0 and from_end = true, so see its description for more information. void queue ( StringName name ) Queues an animation for playback once the current one is done. Note: If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow. void seek ( float seconds, bool update=false, bool update_only=false ) Seeks the animation to the seconds point in time (in seconds). If update is true, the animation updates too, otherwise it updates at process time. Events between the current frame and seconds are skipped. If update_only is true, the method / audio / animation playback tracks will not be processed. Note: Seeking to the end of the animation doesn't emit AnimationMixer.animation_finished. If you want to skip animation and emit the signal, use AnimationMixer.advance. void set_blend_time ( StringName animation_from, StringName animation_to, float sec ) Specifies a blend time (in seconds) between two animations, referenced by their keys. void set_method_call_mode ( AnimationMethodCallMode mode ) For backward compatibility. See AnimationCallbackModeMethod. void set_process_callback ( AnimationProcessCallback mode ) For backward compatibility. See AnimationCallbackModeProcess. void set_root ( NodePath path ) For backward compatibility. See AnimationMixer.root_node. void stop ( bool keep_state=false ) Stops the currently playing animation. The animation position is reset to 0 and the custom_speed is reset to 1.0. See also pause. If keep_state is true, the animation state is not updated visually. Note: The method / audio / animation playback tracks will not be processed by this method. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_animationplayer.html classes/class_stylebox ----------------------------------------------------------- StyleBox Inherits: Resource < RefCounted < Object Inherited By: StyleBoxEmpty, StyleBoxFlat, StyleBoxLine, StyleBoxTexture Abstract base class for defining stylized boxes for UI elements. Description StyleBox is an abstract base class for drawing stylized boxes for UI elements. It is used for panels, buttons, LineEdit backgrounds, Tree backgrounds, etc. and also for testing a transparency mask for pointer signals. If mask test fails on a StyleBox assigned as mask to a control, clicks and motion signals will go through it to the one below. Note: For control nodes that have Theme Properties, the focus StyleBox is displayed over the normal, hover or pressed StyleBox. This makes the focus StyleBox more reusable across different nodes. Properties float content_margin_bottom -1.0 float content_margin_left -1.0 float content_margin_right -1.0 float content_margin_top -1.0 Methods void _draw ( RID to_canvas_item, Rect2 rect ) virtual const Rect2 _get_draw_rect ( Rect2 rect ) virtual const Vector2 _get_minimum_size ( ) virtual const bool _test_mask ( Vector2 point, Rect2 rect ) virtual const void draw ( RID canvas_item, Rect2 rect ) const float get_content_margin ( Side margin ) const CanvasItem get_current_item_drawn ( ) const float get_margin ( Side margin ) const Vector2 get_minimum_size ( ) const Vector2 get_offset ( ) const void set_content_margin ( Side margin, float offset ) void set_content_margin_all ( float offset ) bool test_mask ( Vector2 point, Rect2 rect ) const Property Descriptions float content_margin_bottom = -1.0 void set_content_margin ( Side margin, float offset ) float get_content_margin ( Side margin ) const The bottom margin for the contents of this style box. Increasing this value reduces the space available to the contents from the bottom. If this value is negative, it is ignored and a child-specific margin is used instead. For example, for StyleBoxFlat, the border thickness (if any) is used instead. It is up to the code using this style box to decide what these contents are: for example, a Button respects this content margin for the textual contents of the button. get_margin should be used to fetch this value as consumer instead of reading these properties directly. This is because it correctly respects negative values and the fallback mentioned above. float content_margin_left = -1.0 void set_content_margin ( Side margin, float offset ) float get_content_margin ( Side margin ) const The left margin for the contents of this style box. Increasing this value reduces the space available to the contents from the left. Refer to content_margin_bottom for extra considerations. float content_margin_right = -1.0 void set_content_margin ( Side margin, float offset ) float get_content_margin ( Side margin ) const The right margin for the contents of this style box. Increasing this value reduces the space available to the contents from the right. Refer to content_margin_bottom for extra considerations. float content_margin_top = -1.0 void set_content_margin ( Side margin, float offset ) float get_content_margin ( Side margin ) const The top margin for the contents of this style box. Increasing this value reduces the space available to the contents from the top. Refer to content_margin_bottom for extra considerations. Method Descriptions void _draw ( RID to_canvas_item, Rect2 rect ) virtual const There is currently no description for this method. Please help us by contributing one! Rect2 _get_draw_rect ( Rect2 rect ) virtual const There is currently no description for this method. Please help us by contributing one! Vector2 _get_minimum_size ( ) virtual const Virtual method to be implemented by the user. Returns a custom minimum size that the stylebox must respect when drawing. By default get_minimum_size only takes content margins into account. This method can be overridden to add another size restriction. A combination of the default behavior and the output of this method will be used, to account for both sizes. bool _test_mask ( Vector2 point, Rect2 rect ) virtual const There is currently no description for this method. Please help us by contributing one! void draw ( RID canvas_item, Rect2 rect ) const Draws this stylebox using a canvas item identified by the given RID. The RID value can either be the result of CanvasItem.get_canvas_item called on an existing CanvasItem-derived node, or directly from creating a canvas item in the RenderingServer with RenderingServer.canvas_item_create. float get_content_margin ( Side margin ) const Returns the default margin of the specified Side. CanvasItem get_current_item_drawn ( ) const Returns the CanvasItem that handles its CanvasItem.NOTIFICATION_DRAW or CanvasItem._draw callback at this moment. float get_margin ( Side margin ) const Returns the content margin offset for the specified Side. Positive values reduce size inwards, unlike Control's margin values. Vector2 get_minimum_size ( ) const Returns the minimum size that this stylebox can be shrunk to. Vector2 get_offset ( ) const Returns the "offset" of a stylebox. This helper function returns a value equivalent to Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP)). void set_content_margin ( Side margin, float offset ) Sets the default value of the specified Side to offset pixels. void set_content_margin_all ( float offset ) Sets the default margin to offset pixels for all sides. bool test_mask ( Vector2 point, Rect2 rect ) const Test a position in a rectangle, return whether it passes the mask test. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_stylebox.html classes/class_navigationpolygon ----------------------------------------------------------- NavigationPolygon Inherits: Resource < RefCounted < Object A 2D navigation mesh that describes a traversable surface for pathfinding. Description A navigation mesh can be created either by baking it with the help of the NavigationServer2D, or by adding vertices and convex polygon indices arrays manually. To bake a navigation mesh at least one outline needs to be added that defines the outer bounds of the baked area. GDScriptvar new_navigation_mesh = NavigationPolygon.new() var bounding_outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) new_navigation_mesh.add_outline(bounding_outline) NavigationServer2D.bake_from_source_geometry_data(new_navigation_mesh, NavigationMeshSourceGeometryData2D.new()); $NavigationRegion2D.navigation_polygon = new_navigation_mesh C#var newNavigationMesh = new NavigationPolygon(); var boundingOutline = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; newNavigationMesh.AddOutline(boundingOutline); NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D()); GetNode("NavigationRegion2D").NavigationPolygon = newNavigationMesh; Adding vertices and polygon indices manually. GDScriptvar new_navigation_mesh = NavigationPolygon.new() var new_vertices = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) new_navigation_mesh.vertices = new_vertices var new_polygon_indices = PackedInt32Array([0, 1, 2, 3]) new_navigation_mesh.add_polygon(new_polygon_indices) $NavigationRegion2D.navigation_polygon = new_navigation_mesh C#var newNavigationMesh = new NavigationPolygon(); var newVertices = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; newNavigationMesh.Vertices = newVertices; var newPolygonIndices = new int[] { 0, 1, 2, 3 }; newNavigationMesh.AddPolygon(newPolygonIndices); GetNode("NavigationRegion2D").NavigationPolygon = newNavigationMesh; Tutorials 2D Navigation Demo Using NavigationMeshes Properties float agent_radius 10.0 float cell_size 1.0 int parsed_collision_mask 4294967295 ParsedGeometryType parsed_geometry_type 2 StringName source_geometry_group_name &"navigation_polygon_source_geometry_group" SourceGeometryMode source_geometry_mode 0 Methods void add_outline ( PackedVector2Array outline ) void add_outline_at_index ( PackedVector2Array outline, int index ) void add_polygon ( PackedInt32Array polygon ) void clear ( ) void clear_outlines ( ) void clear_polygons ( ) NavigationMesh get_navigation_mesh ( ) PackedVector2Array get_outline ( int idx ) const int get_outline_count ( ) const bool get_parsed_collision_mask_value ( int layer_number ) const PackedInt32Array get_polygon ( int idx ) int get_polygon_count ( ) const PackedVector2Array get_vertices ( ) const void make_polygons_from_outlines ( ) void remove_outline ( int idx ) void set_outline ( int idx, PackedVector2Array outline ) void set_parsed_collision_mask_value ( int layer_number, bool value ) void set_vertices ( PackedVector2Array vertices ) Enumerations enum ParsedGeometryType: ParsedGeometryType PARSED_GEOMETRY_MESH_INSTANCES = 0 Parses mesh instances as obstruction geometry. This includes Polygon2D, MeshInstance2D, MultiMeshInstance2D, and TileMap nodes. Meshes are only parsed when they use a 2D vertices surface format. ParsedGeometryType PARSED_GEOMETRY_STATIC_COLLIDERS = 1 Parses StaticBody2D and TileMap colliders as obstruction geometry. The collider should be in any of the layers specified by parsed_collision_mask. ParsedGeometryType PARSED_GEOMETRY_BOTH = 2 Both PARSED_GEOMETRY_MESH_INSTANCES and PARSED_GEOMETRY_STATIC_COLLIDERS. ParsedGeometryType PARSED_GEOMETRY_MAX = 3 Represents the size of the ParsedGeometryType enum. enum SourceGeometryMode: SourceGeometryMode SOURCE_GEOMETRY_ROOT_NODE_CHILDREN = 0 Scans the child nodes of the root node recursively for geometry. SourceGeometryMode SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN = 1 Scans nodes in a group and their child nodes recursively for geometry. The group is specified by source_geometry_group_name. SourceGeometryMode SOURCE_GEOMETRY_GROUPS_EXPLICIT = 2 Uses nodes in a group for geometry. The group is specified by source_geometry_group_name. SourceGeometryMode SOURCE_GEOMETRY_MAX = 3 Represents the size of the SourceGeometryMode enum. Property Descriptions float agent_radius = 10.0 void set_agent_radius ( float value ) float get_agent_radius ( ) The distance to erode/shrink the walkable surface when baking the navigation mesh. float cell_size = 1.0 void set_cell_size ( float value ) float get_cell_size ( ) The cell size used to rasterize the navigation mesh vertices. Must match with the cell size on the navigation map. int parsed_collision_mask = 4294967295 void set_parsed_collision_mask ( int value ) int get_parsed_collision_mask ( ) The physics layers to scan for static colliders. Only used when parsed_geometry_type is PARSED_GEOMETRY_STATIC_COLLIDERS or PARSED_GEOMETRY_BOTH. ParsedGeometryType parsed_geometry_type = 2 void set_parsed_geometry_type ( ParsedGeometryType value ) ParsedGeometryType get_parsed_geometry_type ( ) Determines which type of nodes will be parsed as geometry. See ParsedGeometryType for possible values. StringName source_geometry_group_name = &"navigation_polygon_source_geometry_group" void set_source_geometry_group_name ( StringName value ) StringName get_source_geometry_group_name ( ) The group name of nodes that should be parsed for baking source geometry. Only used when source_geometry_mode is SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN or SOURCE_GEOMETRY_GROUPS_EXPLICIT. SourceGeometryMode source_geometry_mode = 0 void set_source_geometry_mode ( SourceGeometryMode value ) SourceGeometryMode get_source_geometry_mode ( ) The source of the geometry used when baking. See SourceGeometryMode for possible values. Method Descriptions void add_outline ( PackedVector2Array outline ) Appends a PackedVector2Array that contains the vertices of an outline to the internal array that contains all the outlines. void add_outline_at_index ( PackedVector2Array outline, int index ) Adds a PackedVector2Array that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position. void add_polygon ( PackedInt32Array polygon ) Adds a polygon using the indices of the vertices you get when calling get_vertices. void clear ( ) Clears the internal arrays for vertices and polygon indices. void clear_outlines ( ) Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them. void clear_polygons ( ) Clears the array of polygons, but it doesn't clear the array of outlines and vertices. NavigationMesh get_navigation_mesh ( ) Returns the NavigationMesh resulting from this navigation polygon. This navigation mesh can be used to update the navigation mesh of a region with the NavigationServer3D.region_set_navigation_mesh API directly (as 2D uses the 3D server behind the scene). PackedVector2Array get_outline ( int idx ) const Returns a PackedVector2Array containing the vertices of an outline that was created in the editor or by script. int get_outline_count ( ) const Returns the number of outlines that were created in the editor or by script. bool get_parsed_collision_mask_value ( int layer_number ) const Returns whether or not the specified layer of the parsed_collision_mask is enabled, given a layer_number between 1 and 32. PackedInt32Array get_polygon ( int idx ) Returns a PackedInt32Array containing the indices of the vertices of a created polygon. int get_polygon_count ( ) const Returns the count of all polygons. PackedVector2Array get_vertices ( ) const Returns a PackedVector2Array containing all the vertices being used to create the polygons. void make_polygons_from_outlines ( ) Creates polygons from the outlines added in the editor or by script. Deprecated. This function is deprecated, and might be removed in a future release. Use NavigationServer2D.parse_source_geometry_data and NavigationServer2D.bake_from_source_geometry_data instead. void remove_outline ( int idx ) Removes an outline created in the editor or by script. You have to call make_polygons_from_outlines for the polygons to update. void set_outline ( int idx, PackedVector2Array outline ) Changes an outline created in the editor or by script. You have to call make_polygons_from_outlines for the polygons to update. void set_parsed_collision_mask_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the parsed_collision_mask, given a layer_number between 1 and 32. void set_vertices ( PackedVector2Array vertices ) Sets the vertices that can be then indexed to create polygons with the add_polygon method. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_navigationpolygon.html classes/class_visualinstance3d ----------------------------------------------------------- VisualInstance3D Inherits: Node3D < Node < Object Inherited By: Decal, FogVolume, GeometryInstance3D, GPUParticlesAttractor3D, GPUParticlesCollision3D, Light3D, LightmapGI, ReflectionProbe, RootMotionView, VisibleOnScreenNotifier3D, VoxelGI Parent of all visual 3D nodes. Description The VisualInstance3D is used to connect a resource to a visual representation. All visual 3D nodes inherit from the VisualInstance3D. In general, you should not access the VisualInstance3D properties directly as they are accessed and managed by the nodes that inherit from VisualInstance3D. VisualInstance3D is the node representation of the RenderingServer instance. Properties int layers 1 float sorting_offset 0.0 bool sorting_use_aabb_center Methods AABB _get_aabb ( ) virtual const AABB get_aabb ( ) const RID get_base ( ) const RID get_instance ( ) const bool get_layer_mask_value ( int layer_number ) const void set_base ( RID base ) void set_layer_mask_value ( int layer_number, bool value ) Property Descriptions int layers = 1 void set_layer_mask ( int value ) int get_layer_mask ( ) The render layer(s) this VisualInstance3D is drawn on. This object will only be visible for Camera3Ds whose cull mask includes any of the render layers this VisualInstance3D is set to. For Light3Ds, this can be used to control which VisualInstance3Ds are affected by a specific light. For GPUParticles3D, this can be used to control which particles are effected by a specific attractor. For Decals, this can be used to control which VisualInstance3Ds are affected by a specific decal. To adjust layers more easily using a script, use get_layer_mask_value and set_layer_mask_value. Note: VoxelGI, SDFGI and LightmapGI will always take all layers into account to determine what contributes to global illumination. If this is an issue, set GeometryInstance3D.gi_mode to GeometryInstance3D.GI_MODE_DISABLED for meshes and Light3D.light_bake_mode to Light3D.BAKE_DISABLED for lights to exclude them from global illumination. float sorting_offset = 0.0 void set_sorting_offset ( float value ) float get_sorting_offset ( ) The amount by which the depth of this VisualInstance3D will be adjusted when sorting by depth. Uses the same units as the engine (which are typically meters). Adjusting it to a higher value will make the VisualInstance3D reliably draw on top of other VisualInstance3Ds that are otherwise positioned at the same spot. To ensure it always draws on top of other objects around it (not positioned at the same spot), set the value to be greater than the distance between this VisualInstance3D and the other nearby VisualInstance3Ds. bool sorting_use_aabb_center void set_sorting_use_aabb_center ( bool value ) bool is_sorting_use_aabb_center ( ) If true, the object is sorted based on the AABB center. The object will be sorted based on the global position otherwise. The AABB center based sorting is generally more accurate for 3D models. The position based sorting instead allows to better control the drawing order when working with GPUParticles3D and CPUParticles3D. Method Descriptions AABB _get_aabb ( ) virtual const There is currently no description for this method. Please help us by contributing one! AABB get_aabb ( ) const Returns the AABB (also known as the bounding box) for this VisualInstance3D. RID get_base ( ) const Returns the RID of the resource associated with this VisualInstance3D. For example, if the Node is a MeshInstance3D, this will return the RID of the associated Mesh. RID get_instance ( ) const Returns the RID of this instance. This RID is the same as the RID returned by RenderingServer.instance_create. This RID is needed if you want to call RenderingServer functions directly on this VisualInstance3D. bool get_layer_mask_value ( int layer_number ) const Returns whether or not the specified layer of the layers is enabled, given a layer_number between 1 and 20. void set_base ( RID base ) Sets the resource that is instantiated by this VisualInstance3D, which changes how the engine handles the VisualInstance3D under the hood. Equivalent to RenderingServer.instance_set_base. void set_layer_mask_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the layers, given a layer_number between 1 and 20. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_visualinstance3d.html classes/class_softbody3d ----------------------------------------------------------- SoftBody3D Inherits: MeshInstance3D < GeometryInstance3D < VisualInstance3D < Node3D < Node < Object A deformable 3D physics mesh. Description A deformable 3D physics mesh. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials. Note: There are many known bugs in SoftBody3D. Therefore, it's not recommended to use them for things that can affect gameplay (such as trampolines). Tutorials SoftBody Properties int collision_layer 1 int collision_mask 1 float damping_coefficient 0.01 DisableMode disable_mode 0 float drag_coefficient 0.0 float linear_stiffness 0.5 NodePath parent_collision_ignore NodePath("") float pressure_coefficient 0.0 bool ray_pickable true int simulation_precision 5 float total_mass 1.0 Methods void add_collision_exception_with ( Node body ) PhysicsBody3D[] get_collision_exceptions ( ) bool get_collision_layer_value ( int layer_number ) const bool get_collision_mask_value ( int layer_number ) const RID get_physics_rid ( ) const Vector3 get_point_transform ( int point_index ) bool is_point_pinned ( int point_index ) const void remove_collision_exception_with ( Node body ) void set_collision_layer_value ( int layer_number, bool value ) void set_collision_mask_value ( int layer_number, bool value ) void set_point_pinned ( int point_index, bool pinned, NodePath attachment_path=NodePath("") ) Enumerations enum DisableMode: DisableMode DISABLE_MODE_REMOVE = 0 When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, remove from the physics simulation to stop all physics interactions with this SoftBody3D. Automatically re-added to the physics simulation when the Node is processed again. DisableMode DISABLE_MODE_KEEP_ACTIVE = 1 When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, do not affect the physics simulation. Property Descriptions int collision_layer = 1 void set_collision_layer ( int value ) int get_collision_layer ( ) The physics layers this SoftBody3D is in. Collision objects can exist in one or more of 32 different layers. See also collision_mask. Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information. int collision_mask = 1 void set_collision_mask ( int value ) int get_collision_mask ( ) The physics layers this SoftBody3D scans. Collision objects can scan one or more of 32 different layers. See also collision_layer. Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information. float damping_coefficient = 0.01 void set_damping_coefficient ( float value ) float get_damping_coefficient ( ) The body's damping coefficient. Higher values will slow down the body more noticeably when forces are applied. DisableMode disable_mode = 0 void set_disable_mode ( DisableMode value ) DisableMode get_disable_mode ( ) Defines the behavior in physics when Node.process_mode is set to Node.PROCESS_MODE_DISABLED. See DisableMode for more details about the different modes. float drag_coefficient = 0.0 void set_drag_coefficient ( float value ) float get_drag_coefficient ( ) The body's drag coefficient. Higher values increase this body's air resistance. Note: This value is currently unused by Godot's default physics implementation. float linear_stiffness = 0.5 void set_linear_stiffness ( float value ) float get_linear_stiffness ( ) Higher values will result in a stiffer body, while lower values will increase the body's ability to bend. The value can be between 0.0 and 1.0 (inclusive). NodePath parent_collision_ignore = NodePath("") void set_parent_collision_ignore ( NodePath value ) NodePath get_parent_collision_ignore ( ) NodePath to a CollisionObject3D this SoftBody3D should avoid clipping. float pressure_coefficient = 0.0 void set_pressure_coefficient ( float value ) float get_pressure_coefficient ( ) The pressure coefficient of this soft body. Simulate pressure build-up from inside this body. Higher values increase the strength of this effect. bool ray_pickable = true void set_ray_pickable ( bool value ) bool is_ray_pickable ( ) If true, the SoftBody3D will respond to RayCast3Ds. int simulation_precision = 5 void set_simulation_precision ( int value ) int get_simulation_precision ( ) Increasing this value will improve the resulting simulation, but can affect performance. Use with care. float total_mass = 1.0 void set_total_mass ( float value ) float get_total_mass ( ) The SoftBody3D's mass. Method Descriptions void add_collision_exception_with ( Node body ) Adds a body to the list of bodies that this body can't collide with. PhysicsBody3D[] get_collision_exceptions ( ) Returns an array of nodes that were added as collision exceptions for this body. bool get_collision_layer_value ( int layer_number ) const Returns whether or not the specified layer of the collision_layer is enabled, given a layer_number between 1 and 32. bool get_collision_mask_value ( int layer_number ) const Returns whether or not the specified layer of the collision_mask is enabled, given a layer_number between 1 and 32. RID get_physics_rid ( ) const Returns the internal RID used by the PhysicsServer3D for this body. Vector3 get_point_transform ( int point_index ) Returns local translation of a vertex in the surface array. bool is_point_pinned ( int point_index ) const Returns true if vertex is set to pinned. void remove_collision_exception_with ( Node body ) Removes a body from the list of bodies that this body can't collide with. void set_collision_layer_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the collision_layer, given a layer_number between 1 and 32. void set_collision_mask_value ( int layer_number, bool value ) Based on value, enables or disables the specified layer in the collision_mask, given a layer_number between 1 and 32. void set_point_pinned ( int point_index, bool pinned, NodePath attachment_path=NodePath("") ) Sets the pinned state of a surface vertex. When set to true, the optional attachment_path can define a Node3D the pinned vertex will be attached to. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_softbody3d.html classes/class_rigidbody2d ----------------------------------------------------------- RigidBody2D Inherits: PhysicsBody2D < CollisionObject2D < Node2D < CanvasItem < Node < Object Inherited By: PhysicalBone2D A 2D physics body that is moved by a physics simulation. Description RigidBody2D implements full 2D physics. It cannot be controlled directly, instead, you must apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, rotation, react to collisions, and affect other physics bodies in its path. The body's behavior can be adjusted via lock_rotation, freeze, and freeze_mode. By changing various properties of the object, such as mass, you can control how the physics simulation acts on it. A rigid body will always maintain its shape and size, even when forces are applied to it. It is useful for objects that can be interacted with in an environment, such as a tree that can be knocked over or a stack of crates that can be pushed around. If you need to override the default physics behavior, you can write a custom force integration function. See custom_integrator. Note: Changing the 2D transform or linear_velocity of a RigidBody2D very often may lead to some unpredictable behaviors. If you need to directly affect the body, prefer _integrate_forces as it allows you to directly access the physics state. Tutorials 2D Physics Platformer Demo Instancing Demo Properties float angular_damp 0.0 DampMode angular_damp_mode 0 float angular_velocity 0.0 bool can_sleep true Vector2 center_of_mass Vector2(0, 0) CenterOfMassMode center_of_mass_mode 0 Vector2 constant_force Vector2(0, 0) float constant_torque 0.0 bool contact_monitor false CCDMode continuous_cd 0 bool custom_integrator false bool freeze false FreezeMode freeze_mode 0 float gravity_scale 1.0 float inertia 0.0 float linear_damp 0.0 DampMode linear_damp_mode 0 Vector2 linear_velocity Vector2(0, 0) bool lock_rotation false float mass 1.0 int max_contacts_reported 0 PhysicsMaterial physics_material_override bool sleeping false Methods void _integrate_forces ( PhysicsDirectBodyState2D state ) virtual void add_constant_central_force ( Vector2 force ) void add_constant_force ( Vector2 force, Vector2 position=Vector2(0, 0) ) void add_constant_torque ( float torque ) void apply_central_force ( Vector2 force ) void apply_central_impulse ( Vector2 impulse=Vector2(0, 0) ) void apply_force ( Vector2 force, Vector2 position=Vector2(0, 0) ) void apply_impulse ( Vector2 impulse, Vector2 position=Vector2(0, 0) ) void apply_torque ( float torque ) void apply_torque_impulse ( float torque ) Node2D[] get_colliding_bodies ( ) const int get_contact_count ( ) const void set_axis_velocity ( Vector2 axis_velocity ) Signals body_entered ( Node body ) Emitted when a collision with another PhysicsBody2D or TileMap occurs. Requires contact_monitor to be set to true and max_contacts_reported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body the Node, if it exists in the tree, of the other PhysicsBody2D or TileMap. body_exited ( Node body ) Emitted when the collision with another PhysicsBody2D or TileMap ends. Requires contact_monitor to be set to true and max_contacts_reported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body the Node, if it exists in the tree, of the other PhysicsBody2D or TileMap. body_shape_entered ( RID body_rid, Node body, int body_shape_index, int local_shape_index ) Emitted when one of this RigidBody2D's Shape2Ds collides with another PhysicsBody2D or TileMap's Shape2Ds. Requires contact_monitor to be set to true and max_contacts_reported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body_rid the RID of the other PhysicsBody2D or TileSet's CollisionObject2D used by the PhysicsServer2D. body the Node, if it exists in the tree, of the other PhysicsBody2D or TileMap. body_shape_index the index of the Shape2D of the other PhysicsBody2D or TileMap used by the PhysicsServer2D. Get the CollisionShape2D node with body.shape_owner_get_owner(body.shape_find_owner(body_shape_index)). local_shape_index the index of the Shape2D of this RigidBody2D used by the PhysicsServer2D. Get the CollisionShape2D node with self.shape_owner_get_owner(self.shape_find_owner(local_shape_index)). body_shape_exited ( RID body_rid, Node body, int body_shape_index, int local_shape_index ) Emitted when the collision between one of this RigidBody2D's Shape2Ds and another PhysicsBody2D or TileMap's Shape2Ds ends. Requires contact_monitor to be set to true and max_contacts_reported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body_rid the RID of the other PhysicsBody2D or TileSet's CollisionObject2D used by the PhysicsServer2D. body the Node, if it exists in the tree, of the other PhysicsBody2D or TileMap. body_shape_index the index of the Shape2D of the other PhysicsBody2D or TileMap used by the PhysicsServer2D. Get the CollisionShape2D node with body.shape_owner_get_owner(body.shape_find_owner(body_shape_index)). local_shape_index the index of the Shape2D of this RigidBody2D used by the PhysicsServer2D. Get the CollisionShape2D node with self.shape_owner_get_owner(self.shape_find_owner(local_shape_index)). sleeping_state_changed ( ) Emitted when the physics engine changes the body's sleeping state. Note: Changing the value sleeping will not trigger this signal. It is only emitted if the sleeping state is changed by the physics engine or emit_signal("sleeping_state_changed") is used. Enumerations enum FreezeMode: FreezeMode FREEZE_MODE_STATIC = 0 Static body freeze mode (default). The body is not affected by gravity and forces. It can be only moved by user code and doesn't collide with other bodies along its path. FreezeMode FREEZE_MODE_KINEMATIC = 1 Kinematic body freeze mode. Similar to FREEZE_MODE_STATIC, but collides with other bodies along its path when moved. Useful for a frozen body that needs to be animated. enum CenterOfMassMode: CenterOfMassMode CENTER_OF_MASS_MODE_AUTO = 0 In this mode, the body's center of mass is calculated automatically based on its shapes. This assumes that the shapes' origins are also their center of mass. CenterOfMassMode CENTER_OF_MASS_MODE_CUSTOM = 1 In this mode, the body's center of mass is set through center_of_mass. Defaults to the body's origin position. enum DampMode: DampMode DAMP_MODE_COMBINE = 0 In this mode, the body's damping value is added to any value set in areas or the default value. DampMode DAMP_MODE_REPLACE = 1 In this mode, the body's damping value replaces any value set in areas or the default value. enum CCDMode: CCDMode CCD_MODE_DISABLED = 0 Continuous collision detection disabled. This is the fastest way to detect body collisions, but can miss small, fast-moving objects. CCDMode CCD_MODE_CAST_RAY = 1 Continuous collision detection enabled using raycasting. This is faster than shapecasting but less precise. CCDMode CCD_MODE_CAST_SHAPE = 2 Continuous collision detection enabled using shapecasting. This is the slowest CCD method and the most precise. Property Descriptions float angular_damp = 0.0 void set_angular_damp ( float value ) float get_angular_damp ( ) Damps the body's rotation. By default, the body will use the Default Angular Damp in Project > Project Settings > Physics > 2d or any value override set by an Area2D the body is in. Depending on angular_damp_mode, you can set angular_damp to be added to or to replace the body's damping value. See ProjectSettings.physics/2d/default_angular_damp for more details about damping. DampMode angular_damp_mode = 0 void set_angular_damp_mode ( DampMode value ) DampMode get_angular_damp_mode ( ) Defines how angular_damp is applied. See DampMode for possible values. float angular_velocity = 0.0 void set_angular_velocity ( float value ) float get_angular_velocity ( ) The body's rotational velocity in radians per second. bool can_sleep = true void set_can_sleep ( bool value ) bool is_able_to_sleep ( ) If true, the body can enter sleep mode when there is no movement. See sleeping. Vector2 center_of_mass = Vector2(0, 0) void set_center_of_mass ( Vector2 value ) Vector2 get_center_of_mass ( ) The body's custom center of mass, relative to the body's origin position, when center_of_mass_mode is set to CENTER_OF_MASS_MODE_CUSTOM. This is the balanced point of the body, where applied forces only cause linear acceleration. Applying forces outside of the center of mass causes angular acceleration. When center_of_mass_mode is set to CENTER_OF_MASS_MODE_AUTO (default value), the center of mass is automatically computed. CenterOfMassMode center_of_mass_mode = 0 void set_center_of_mass_mode ( CenterOfMassMode value ) CenterOfMassMode get_center_of_mass_mode ( ) Defines the way the body's center of mass is set. See CenterOfMassMode for possible values. Vector2 constant_force = Vector2(0, 0) void set_constant_force ( Vector2 value ) Vector2 get_constant_force ( ) The body's total constant positional forces applied during each physics update. See add_constant_force and add_constant_central_force. float constant_torque = 0.0 void set_constant_torque ( float value ) float get_constant_torque ( ) The body's total constant rotational forces applied during each physics update. See add_constant_torque. bool contact_monitor = false void set_contact_monitor ( bool value ) bool is_contact_monitor_enabled ( ) If true, the RigidBody2D will emit signals when it collides with another body. Note: By default the maximum contacts reported is set to 0, meaning nothing will be recorded, see max_contacts_reported. CCDMode continuous_cd = 0 void set_continuous_collision_detection_mode ( CCDMode value ) CCDMode get_continuous_collision_detection_mode ( ) Continuous collision detection mode. Continuous collision detection tries to predict where a moving body will collide instead of moving it and correcting its movement after collision. Continuous collision detection is slower, but more precise and misses fewer collisions with small, fast-moving objects. Raycasting and shapecasting methods are available. See CCDMode for details. bool custom_integrator = false void set_use_custom_integrator ( bool value ) bool is_using_custom_integrator ( ) If true, internal force integration is disabled for this body. Aside from collision response, the body will only move as determined by the _integrate_forces function. bool freeze = false void set_freeze_enabled ( bool value ) bool is_freeze_enabled ( ) If true, the body is frozen. Gravity and forces are not applied anymore. See freeze_mode to set the body's behavior when frozen. For a body that is always frozen, use StaticBody2D or AnimatableBody2D instead. FreezeMode freeze_mode = 0 void set_freeze_mode ( FreezeMode value ) FreezeMode get_freeze_mode ( ) The body's freeze mode. Can be used to set the body's behavior when freeze is enabled. See FreezeMode for possible values. For a body that is always frozen, use StaticBody2D or AnimatableBody2D instead. float gravity_scale = 1.0 void set_gravity_scale ( float value ) float get_gravity_scale ( ) Multiplies the gravity applied to the body. The body's gravity is calculated from the Default Gravity value in Project > Project Settings > Physics > 2d and/or any additional gravity vector applied by Area2Ds. float inertia = 0.0 void set_inertia ( float value ) float get_inertia ( ) The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body. The moment of inertia is usually computed automatically from the mass and the shapes, but this property allows you to set a custom value. If set to 0, inertia is automatically computed (default value). Note: This value does not change when inertia is automatically computed. Use PhysicsServer2D to get the computed inertia. GDScript@onready var ball = $Ball func get_ball_inertia(): return 1.0 / PhysicsServer2D.body_get_direct_state(ball.get_rid()).inverse_inertia C#private RigidBody2D _ball; public override void _Ready() { _ball = GetNode("Ball"); } private float GetBallInertia() { return 1.0f / PhysicsServer2D.BodyGetDirectState(_ball.GetRid()).InverseInertia; } float linear_damp = 0.0 void set_linear_damp ( float value ) float get_linear_damp ( ) Damps the body's movement. By default, the body will use the Default Linear Damp in Project > Project Settings > Physics > 2d or any value override set by an Area2D the body is in. Depending on linear_damp_mode, you can set linear_damp to be added to or to replace the body's damping value. See ProjectSettings.physics/2d/default_linear_damp for more details about damping. DampMode linear_damp_mode = 0 void set_linear_damp_mode ( DampMode value ) DampMode get_linear_damp_mode ( ) Defines how linear_damp is applied. See DampMode for possible values. Vector2 linear_velocity = Vector2(0, 0) void set_linear_velocity ( Vector2 value ) Vector2 get_linear_velocity ( ) The body's linear velocity in pixels per second. Can be used sporadically, but don't set this every frame, because physics may run in another thread and runs at a different granularity. Use _integrate_forces as your process loop for precise control of the body state. bool lock_rotation = false void set_lock_rotation_enabled ( bool value ) bool is_lock_rotation_enabled ( ) If true, the body cannot rotate. Gravity and forces only apply linear movement. float mass = 1.0 void set_mass ( float value ) float get_mass ( ) The body's mass. int max_contacts_reported = 0 void set_max_contacts_reported ( int value ) int get_max_contacts_reported ( ) The maximum number of contacts that will be recorded. Requires a value greater than 0 and contact_monitor to be set to true to start to register contacts. Use get_contact_count to retrieve the count or get_colliding_bodies to retrieve bodies that have been collided with. Note: The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end), and collisions between parallel faces will result in four contacts (one at each corner). PhysicsMaterial physics_material_override void set_physics_material_override ( PhysicsMaterial value ) PhysicsMaterial get_physics_material_override ( ) The physics material override for the body. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one. bool sleeping = false void set_sleeping ( bool value ) bool is_sleeping ( ) If true, the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the apply_impulse or apply_force methods. Method Descriptions void _integrate_forces ( PhysicsDirectBodyState2D state ) virtual Allows you to read and safely modify the simulation state for the object. Use this instead of Node._physics_process if you need to directly change the body's position or other physics properties. By default, it works in addition to the usual physics behavior, but custom_integrator allows you to disable the default behavior and write custom force integration for a body. void add_constant_central_force ( Vector2 force ) Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with constant_force = Vector2(0, 0). This is equivalent to using add_constant_force at the body's center of mass. void add_constant_force ( Vector2 force, Vector2 position=Vector2(0, 0) ) Adds a constant positioned force to the body that keeps being applied over time until cleared with constant_force = Vector2(0, 0). position is the offset from the body origin in global coordinates. void add_constant_torque ( float torque ) Adds a constant rotational force without affecting position that keeps being applied over time until cleared with constant_torque = 0. void apply_central_force ( Vector2 force ) Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update. This is equivalent to using apply_force at the body's center of mass. void apply_central_impulse ( Vector2 impulse=Vector2(0, 0) ) Applies a directional impulse without affecting rotation. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). This is equivalent to using apply_impulse at the body's center of mass. void apply_force ( Vector2 force, Vector2 position=Vector2(0, 0) ) Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update. position is the offset from the body origin in global coordinates. void apply_impulse ( Vector2 impulse, Vector2 position=Vector2(0, 0) ) Applies a positioned impulse to the body. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). position is the offset from the body origin in global coordinates. void apply_torque ( float torque ) Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update. Note: inertia is required for this to work. To have inertia, an active CollisionShape2D must be a child of the node, or you can manually set inertia. void apply_torque_impulse ( float torque ) Applies a rotational impulse to the body without affecting the position. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). Note: inertia is required for this to work. To have inertia, an active CollisionShape2D must be a child of the node, or you can manually set inertia. Node2D[] get_colliding_bodies ( ) const Returns a list of the bodies colliding with this one. Requires contact_monitor to be set to true and max_contacts_reported to be set high enough to detect all the collisions. Note: The result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead. int get_contact_count ( ) const Returns the number of contacts this body has with other bodies. By default, this returns 0 unless bodies are configured to monitor contacts (see contact_monitor). Note: To retrieve the colliding bodies, use get_colliding_bodies. void set_axis_velocity ( Vector2 axis_velocity ) Sets the body's velocity on the given axis. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_rigidbody2d.html classes/class_animationnodestatemachine ----------------------------------------------------------- AnimationNodeStateMachine Inherits: AnimationRootNode < AnimationNode < Resource < RefCounted < Object A state machine with multiple AnimationRootNodes, used by AnimationTree. Description Contains multiple AnimationRootNodes representing animation states, connected in a graph. State transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the AnimationNodeStateMachinePlayback object from the AnimationTree node to control it programmatically. Example: GDScriptvar state_machine = $AnimationTree.get("parameters/playback") state_machine.travel("some_state") C#var stateMachine = GetNode("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback; stateMachine.Travel("some_state"); Tutorials Using AnimationTree Properties bool allow_transition_to_self false bool reset_ends false StateMachineType state_machine_type 0 Methods void add_node ( StringName name, AnimationNode node, Vector2 position=Vector2(0, 0) ) void add_transition ( StringName from, StringName to, AnimationNodeStateMachineTransition transition ) Vector2 get_graph_offset ( ) const AnimationNode get_node ( StringName name ) const StringName get_node_name ( AnimationNode node ) const Vector2 get_node_position ( StringName name ) const AnimationNodeStateMachineTransition get_transition ( int idx ) const int get_transition_count ( ) const StringName get_transition_from ( int idx ) const StringName get_transition_to ( int idx ) const bool has_node ( StringName name ) const bool has_transition ( StringName from, StringName to ) const void remove_node ( StringName name ) void remove_transition ( StringName from, StringName to ) void remove_transition_by_index ( int idx ) void rename_node ( StringName name, StringName new_name ) void replace_node ( StringName name, AnimationNode node ) void set_graph_offset ( Vector2 offset ) void set_node_position ( StringName name, Vector2 position ) Enumerations enum StateMachineType: StateMachineType STATE_MACHINE_TYPE_ROOT = 0 Seeking to the beginning is treated as playing from the start state. Transition to the end state is treated as exiting the state machine. StateMachineType STATE_MACHINE_TYPE_NESTED = 1 Seeking to the beginning is treated as seeking to the beginning of the animation in the current state. Transition to the end state, or the absence of transitions in each state, is treated as exiting the state machine. StateMachineType STATE_MACHINE_TYPE_GROUPED = 2 This is a grouped state machine that can be controlled from a parent state machine. It does not work independently. There must be a state machine with state_machine_type of STATE_MACHINE_TYPE_ROOT or STATE_MACHINE_TYPE_NESTED in the parent or ancestor. Property Descriptions bool allow_transition_to_self = false void set_allow_transition_to_self ( bool value ) bool is_allow_transition_to_self ( ) If true, allows teleport to the self state with AnimationNodeStateMachinePlayback.travel. When the reset option is enabled in AnimationNodeStateMachinePlayback.travel, the animation is restarted. If false, nothing happens on the teleportation to the self state. bool reset_ends = false void set_reset_ends ( bool value ) bool are_ends_reset ( ) If true, treat the cross-fade to the start and end nodes as a blend with the RESET animation. In most cases, when additional cross-fades are performed in the parent AnimationNode of the state machine, setting this property to false and matching the cross-fade time of the parent AnimationNode and the state machine's start node and end node gives good results. StateMachineType state_machine_type = 0 void set_state_machine_type ( StateMachineType value ) StateMachineType get_state_machine_type ( ) This property can define the process of transitions for different use cases. See also StateMachineType. Method Descriptions void add_node ( StringName name, AnimationNode node, Vector2 position=Vector2(0, 0) ) Adds a new animation node to the graph. The position is used for display in the editor. void add_transition ( StringName from, StringName to, AnimationNodeStateMachineTransition transition ) Adds a transition between the given animation nodes. Vector2 get_graph_offset ( ) const Returns the draw offset of the graph. Used for display in the editor. AnimationNode get_node ( StringName name ) const Returns the animation node with the given name. StringName get_node_name ( AnimationNode node ) const Returns the given animation node's name. Vector2 get_node_position ( StringName name ) const Returns the given animation node's coordinates. Used for display in the editor. AnimationNodeStateMachineTransition get_transition ( int idx ) const Returns the given transition. int get_transition_count ( ) const Returns the number of connections in the graph. StringName get_transition_from ( int idx ) const Returns the given transition's start node. StringName get_transition_to ( int idx ) const Returns the given transition's end node. bool has_node ( StringName name ) const Returns true if the graph contains the given animation node. bool has_transition ( StringName from, StringName to ) const Returns true if there is a transition between the given animation nodes. void remove_node ( StringName name ) Deletes the given animation node from the graph. void remove_transition ( StringName from, StringName to ) Deletes the transition between the two specified animation nodes. void remove_transition_by_index ( int idx ) Deletes the given transition by index. void rename_node ( StringName name, StringName new_name ) Renames the given animation node. void replace_node ( StringName name, AnimationNode node ) There is currently no description for this method. Please help us by contributing one! void set_graph_offset ( Vector2 offset ) Sets the draw offset of the graph. Used for display in the editor. void set_node_position ( StringName name, Vector2 position ) Sets the animation node's coordinates. Used for display in the editor. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_animationnodestatemachine.html classes/class_theme ----------------------------------------------------------- Theme Inherits: Resource < RefCounted < Object A resource used for styling/skinning Controls and Windows. Description A resource used for styling/skinning Control and Window nodes. While individual controls can be styled using their local theme overrides (see Control.add_theme_color_override), theme resources allow you to store and apply the same settings across all controls sharing the same type (e.g. style all Buttons the same). One theme resource can be used for the entire project, but you can also set a separate theme resource to a branch of control nodes. A theme resource assigned to a control applies to the control itself, as well as all of its direct and indirect children (as long as a chain of controls is uninterrupted). Use ProjectSettings.gui/theme/custom to set up a project-scope theme that will be available to every control in your project. Use Control.theme of any control node to set up a theme that will be available to that control and all of its direct and indirect children. Tutorials GUI skinning Using the theme editor Properties float default_base_scale 0.0 Font default_font int default_font_size -1 Methods void add_type ( StringName theme_type ) void clear ( ) void clear_color ( StringName name, StringName theme_type ) void clear_constant ( StringName name, StringName theme_type ) void clear_font ( StringName name, StringName theme_type ) void clear_font_size ( StringName name, StringName theme_type ) void clear_icon ( StringName name, StringName theme_type ) void clear_stylebox ( StringName name, StringName theme_type ) void clear_theme_item ( DataType data_type, StringName name, StringName theme_type ) void clear_type_variation ( StringName theme_type ) Color get_color ( StringName name, StringName theme_type ) const PackedStringArray get_color_list ( String theme_type ) const PackedStringArray get_color_type_list ( ) const int get_constant ( StringName name, StringName theme_type ) const PackedStringArray get_constant_list ( String theme_type ) const PackedStringArray get_constant_type_list ( ) const Font get_font ( StringName name, StringName theme_type ) const PackedStringArray get_font_list ( String theme_type ) const int get_font_size ( StringName name, StringName theme_type ) const PackedStringArray get_font_size_list ( String theme_type ) const PackedStringArray get_font_size_type_list ( ) const PackedStringArray get_font_type_list ( ) const Texture2D get_icon ( StringName name, StringName theme_type ) const PackedStringArray get_icon_list ( String theme_type ) const PackedStringArray get_icon_type_list ( ) const StyleBox get_stylebox ( StringName name, StringName theme_type ) const PackedStringArray get_stylebox_list ( String theme_type ) const PackedStringArray get_stylebox_type_list ( ) const Variant get_theme_item ( DataType data_type, StringName name, StringName theme_type ) const PackedStringArray get_theme_item_list ( DataType data_type, String theme_type ) const PackedStringArray get_theme_item_type_list ( DataType data_type ) const PackedStringArray get_type_list ( ) const StringName get_type_variation_base ( StringName theme_type ) const PackedStringArray get_type_variation_list ( StringName base_type ) const bool has_color ( StringName name, StringName theme_type ) const bool has_constant ( StringName name, StringName theme_type ) const bool has_default_base_scale ( ) const bool has_default_font ( ) const bool has_default_font_size ( ) const bool has_font ( StringName name, StringName theme_type ) const bool has_font_size ( StringName name, StringName theme_type ) const bool has_icon ( StringName name, StringName theme_type ) const bool has_stylebox ( StringName name, StringName theme_type ) const bool has_theme_item ( DataType data_type, StringName name, StringName theme_type ) const bool is_type_variation ( StringName theme_type, StringName base_type ) const void merge_with ( Theme other ) void remove_type ( StringName theme_type ) void rename_color ( StringName old_name, StringName name, StringName theme_type ) void rename_constant ( StringName old_name, StringName name, StringName theme_type ) void rename_font ( StringName old_name, StringName name, StringName theme_type ) void rename_font_size ( StringName old_name, StringName name, StringName theme_type ) void rename_icon ( StringName old_name, StringName name, StringName theme_type ) void rename_stylebox ( StringName old_name, StringName name, StringName theme_type ) void rename_theme_item ( DataType data_type, StringName old_name, StringName name, StringName theme_type ) void set_color ( StringName name, StringName theme_type, Color color ) void set_constant ( StringName name, StringName theme_type, int constant ) void set_font ( StringName name, StringName theme_type, Font font ) void set_font_size ( StringName name, StringName theme_type, int font_size ) void set_icon ( StringName name, StringName theme_type, Texture2D texture ) void set_stylebox ( StringName name, StringName theme_type, StyleBox texture ) void set_theme_item ( DataType data_type, StringName name, StringName theme_type, Variant value ) void set_type_variation ( StringName theme_type, StringName base_type ) Enumerations enum DataType: DataType DATA_TYPE_COLOR = 0 Theme's Color item type. DataType DATA_TYPE_CONSTANT = 1 Theme's constant item type. DataType DATA_TYPE_FONT = 2 Theme's Font item type. DataType DATA_TYPE_FONT_SIZE = 3 Theme's font size item type. DataType DATA_TYPE_ICON = 4 Theme's icon Texture2D item type. DataType DATA_TYPE_STYLEBOX = 5 Theme's StyleBox item type. DataType DATA_TYPE_MAX = 6 Maximum value for the DataType enum. Property Descriptions float default_base_scale = 0.0 void set_default_base_scale ( float value ) float get_default_base_scale ( ) The default base scale factor of this theme resource. Used by some controls to scale their visual properties based on the global scale factor. If this value is set to 0.0, the global scale factor is used (see ThemeDB.fallback_base_scale). Use has_default_base_scale to check if this value is valid. Font default_font void set_default_font ( Font value ) Font get_default_font ( ) The default font of this theme resource. Used as the default value when trying to fetch a font resource that doesn't exist in this theme or is in invalid state. If the default font is also missing or invalid, the engine fallback value is used (see ThemeDB.fallback_font). Use has_default_font to check if this value is valid. int default_font_size = -1 void set_default_font_size ( int value ) int get_default_font_size ( ) The default font size of this theme resource. Used as the default value when trying to fetch a font size value that doesn't exist in this theme or is in invalid state. If the default font size is also missing or invalid, the engine fallback value is used (see ThemeDB.fallback_font_size). Values below 0 are invalid and can be used to unset the property. Use has_default_font_size to check if this value is valid. Method Descriptions void add_type ( StringName theme_type ) Adds an empty theme type for every valid data type. Note: Empty types are not saved with the theme. This method only exists to perform in-memory changes to the resource. Use available set_* methods to add theme items. void clear ( ) Removes all the theme properties defined on the theme resource. void clear_color ( StringName name, StringName theme_type ) Removes the Color property defined by name and theme_type, if it exists. Fails if it doesn't exist. Use has_color to check for existence. void clear_constant ( StringName name, StringName theme_type ) Removes the constant property defined by name and theme_type, if it exists. Fails if it doesn't exist. Use has_constant to check for existence. void clear_font ( StringName name, StringName theme_type ) Removes the Font property defined by name and theme_type, if it exists. Fails if it doesn't exist. Use has_font to check for existence. void clear_font_size ( StringName name, StringName theme_type ) Removes the font size property defined by name and theme_type, if it exists. Fails if it doesn't exist. Use has_font_size to check for existence. void clear_icon ( StringName name, StringName theme_type ) Removes the icon property defined by name and theme_type, if it exists. Fails if it doesn't exist. Use has_icon to check for existence. void clear_stylebox ( StringName name, StringName theme_type ) Removes the StyleBox property defined by name and theme_type, if it exists. Fails if it doesn't exist. Use has_stylebox to check for existence. void clear_theme_item ( DataType data_type, StringName name, StringName theme_type ) Removes the theme property of data_type defined by name and theme_type, if it exists. Fails if it doesn't exist. Use has_theme_item to check for existence. Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. void clear_type_variation ( StringName theme_type ) Unmarks theme_type as being a variation of another theme type. See set_type_variation. Color get_color ( StringName name, StringName theme_type ) const Returns the Color property defined by name and theme_type, if it exists. Returns the default color value if the property doesn't exist. Use has_color to check for existence. PackedStringArray get_color_list ( String theme_type ) const Returns a list of names for Color properties defined with theme_type. Use get_color_type_list to get a list of possible theme type names. PackedStringArray get_color_type_list ( ) const Returns a list of all unique theme type names for Color properties. Use get_type_list to get a list of all unique theme types. int get_constant ( StringName name, StringName theme_type ) const Returns the constant property defined by name and theme_type, if it exists. Returns 0 if the property doesn't exist. Use has_constant to check for existence. PackedStringArray get_constant_list ( String theme_type ) const Returns a list of names for constant properties defined with theme_type. Use get_constant_type_list to get a list of possible theme type names. PackedStringArray get_constant_type_list ( ) const Returns a list of all unique theme type names for constant properties. Use get_type_list to get a list of all unique theme types. Font get_font ( StringName name, StringName theme_type ) const Returns the Font property defined by name and theme_type, if it exists. Returns the default theme font if the property doesn't exist and the default theme font is set up (see default_font). Use has_font to check for existence of the property and has_default_font to check for existence of the default theme font. Returns the engine fallback font value, if neither exist (see ThemeDB.fallback_font). PackedStringArray get_font_list ( String theme_type ) const Returns a list of names for Font properties defined with theme_type. Use get_font_type_list to get a list of possible theme type names. int get_font_size ( StringName name, StringName theme_type ) const Returns the font size property defined by name and theme_type, if it exists. Returns the default theme font size if the property doesn't exist and the default theme font size is set up (see default_font_size). Use has_font_size to check for existence of the property and has_default_font_size to check for existence of the default theme font. Returns the engine fallback font size value, if neither exist (see ThemeDB.fallback_font_size). PackedStringArray get_font_size_list ( String theme_type ) const Returns a list of names for font size properties defined with theme_type. Use get_font_size_type_list to get a list of possible theme type names. PackedStringArray get_font_size_type_list ( ) const Returns a list of all unique theme type names for font size properties. Use get_type_list to get a list of all unique theme types. PackedStringArray get_font_type_list ( ) const Returns a list of all unique theme type names for Font properties. Use get_type_list to get a list of all unique theme types. Texture2D get_icon ( StringName name, StringName theme_type ) const Returns the icon property defined by name and theme_type, if it exists. Returns the engine fallback icon value if the property doesn't exist (see ThemeDB.fallback_icon). Use has_icon to check for existence. PackedStringArray get_icon_list ( String theme_type ) const Returns a list of names for icon properties defined with theme_type. Use get_icon_type_list to get a list of possible theme type names. PackedStringArray get_icon_type_list ( ) const Returns a list of all unique theme type names for icon properties. Use get_type_list to get a list of all unique theme types. StyleBox get_stylebox ( StringName name, StringName theme_type ) const Returns the StyleBox property defined by name and theme_type, if it exists. Returns the engine fallback stylebox value if the property doesn't exist (see ThemeDB.fallback_stylebox). Use has_stylebox to check for existence. PackedStringArray get_stylebox_list ( String theme_type ) const Returns a list of names for StyleBox properties defined with theme_type. Use get_stylebox_type_list to get a list of possible theme type names. PackedStringArray get_stylebox_type_list ( ) const Returns a list of all unique theme type names for StyleBox properties. Use get_type_list to get a list of all unique theme types. Variant get_theme_item ( DataType data_type, StringName name, StringName theme_type ) const Returns the theme property of data_type defined by name and theme_type, if it exists. Returns the engine fallback value if the property doesn't exist (see ThemeDB). Use has_theme_item to check for existence. Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. PackedStringArray get_theme_item_list ( DataType data_type, String theme_type ) const Returns a list of names for properties of data_type defined with theme_type. Use get_theme_item_type_list to get a list of possible theme type names. Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. PackedStringArray get_theme_item_type_list ( DataType data_type ) const Returns a list of all unique theme type names for data_type properties. Use get_type_list to get a list of all unique theme types. Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. PackedStringArray get_type_list ( ) const Returns a list of all unique theme type names. Use the appropriate get_*_type_list method to get a list of unique theme types for a single data type. StringName get_type_variation_base ( StringName theme_type ) const Returns the name of the base theme type if theme_type is a valid variation type. Returns an empty string otherwise. PackedStringArray get_type_variation_list ( StringName base_type ) const Returns a list of all type variations for the given base_type. bool has_color ( StringName name, StringName theme_type ) const Returns true if the Color property defined by name and theme_type exists. Returns false if it doesn't exist. Use set_color to define it. bool has_constant ( StringName name, StringName theme_type ) const Returns true if the constant property defined by name and theme_type exists. Returns false if it doesn't exist. Use set_constant to define it. bool has_default_base_scale ( ) const Returns true if default_base_scale has a valid value. Returns false if it doesn't. The value must be greater than 0.0 to be considered valid. bool has_default_font ( ) const Returns true if default_font has a valid value. Returns false if it doesn't. bool has_default_font_size ( ) const Returns true if default_font_size has a valid value. Returns false if it doesn't. The value must be greater than 0 to be considered valid. bool has_font ( StringName name, StringName theme_type ) const Returns true if the Font property defined by name and theme_type exists, or if the default theme font is set up (see has_default_font). Returns false if neither exist. Use set_font to define the property. bool has_font_size ( StringName name, StringName theme_type ) const Returns true if the font size property defined by name and theme_type exists, or if the default theme font size is set up (see has_default_font_size). Returns false if neither exist. Use set_font_size to define the property. bool has_icon ( StringName name, StringName theme_type ) const Returns true if the icon property defined by name and theme_type exists. Returns false if it doesn't exist. Use set_icon to define it. bool has_stylebox ( StringName name, StringName theme_type ) const Returns true if the StyleBox property defined by name and theme_type exists. Returns false if it doesn't exist. Use set_stylebox to define it. bool has_theme_item ( DataType data_type, StringName name, StringName theme_type ) const Returns true if the theme property of data_type defined by name and theme_type exists. Returns false if it doesn't exist. Use set_theme_item to define it. Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. bool is_type_variation ( StringName theme_type, StringName base_type ) const Returns true if theme_type is marked as a variation of base_type. void merge_with ( Theme other ) Adds missing and overrides existing definitions with values from the other theme resource. Note: This modifies the current theme. If you want to merge two themes together without modifying either one, create a new empty theme and merge the other two into it one after another. void remove_type ( StringName theme_type ) Removes the theme type, gracefully discarding defined theme items. If the type is a variation, this information is also erased. If the type is a base for type variations, those variations lose their base. void rename_color ( StringName old_name, StringName name, StringName theme_type ) Renames the Color property defined by old_name and theme_type to name, if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use has_color to check for existence, and clear_color to remove the existing property. void rename_constant ( StringName old_name, StringName name, StringName theme_type ) Renames the constant property defined by old_name and theme_type to name, if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use has_constant to check for existence, and clear_constant to remove the existing property. void rename_font ( StringName old_name, StringName name, StringName theme_type ) Renames the Font property defined by old_name and theme_type to name, if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use has_font to check for existence, and clear_font to remove the existing property. void rename_font_size ( StringName old_name, StringName name, StringName theme_type ) Renames the font size property defined by old_name and theme_type to name, if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use has_font_size to check for existence, and clear_font_size to remove the existing property. void rename_icon ( StringName old_name, StringName name, StringName theme_type ) Renames the icon property defined by old_name and theme_type to name, if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use has_icon to check for existence, and clear_icon to remove the existing property. void rename_stylebox ( StringName old_name, StringName name, StringName theme_type ) Renames the StyleBox property defined by old_name and theme_type to name, if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use has_stylebox to check for existence, and clear_stylebox to remove the existing property. void rename_theme_item ( DataType data_type, StringName old_name, StringName name, StringName theme_type ) Renames the theme property of data_type defined by old_name and theme_type to name, if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use has_theme_item to check for existence, and clear_theme_item to remove the existing property. Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. void set_color ( StringName name, StringName theme_type, Color color ) Creates or changes the value of the Color property defined by name and theme_type. Use clear_color to remove the property. void set_constant ( StringName name, StringName theme_type, int constant ) Creates or changes the value of the constant property defined by name and theme_type. Use clear_constant to remove the property. void set_font ( StringName name, StringName theme_type, Font font ) Creates or changes the value of the Font property defined by name and theme_type. Use clear_font to remove the property. void set_font_size ( StringName name, StringName theme_type, int font_size ) Creates or changes the value of the font size property defined by name and theme_type. Use clear_font_size to remove the property. void set_icon ( StringName name, StringName theme_type, Texture2D texture ) Creates or changes the value of the icon property defined by name and theme_type. Use clear_icon to remove the property. void set_stylebox ( StringName name, StringName theme_type, StyleBox texture ) Creates or changes the value of the StyleBox property defined by name and theme_type. Use clear_stylebox to remove the property. void set_theme_item ( DataType data_type, StringName name, StringName theme_type, Variant value ) Creates or changes the value of the theme property of data_type defined by name and theme_type. Use clear_theme_item to remove the property. Fails if the value type is not accepted by data_type. Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. void set_type_variation ( StringName theme_type, StringName base_type ) Marks theme_type as a variation of base_type. This adds theme_type as a suggested option for Control.theme_type_variation on a Control that is of the base_type class. Variations can also be nested, i.e. base_type can be another variation. If a chain of variations ends with a base_type matching the class of the Control, the whole chain is going to be suggested as options. Note: Suggestions only show up if this theme resource is set as the project default theme. See ProjectSettings.gui/theme/custom. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_theme.html classes/class_gltfdocument ----------------------------------------------------------- GLTFDocument Inherits: Resource < RefCounted < Object Class for importing and exporting glTF files in and out of Godot. Description GLTFDocument supports reading data from a glTF file, buffer, or Godot scene. This data can then be written to the filesystem, buffer, or used to create a Godot scene. All of the data in a GLTF scene is stored in the GLTFState class. GLTFDocument processes state objects, but does not contain any scene data itself. GLTFDocument has member variables to store export configuration settings such as the image format, but is otherwise stateless. Multiple scenes can be processed with the same settings using the same GLTFDocument object and different GLTFState objects. GLTFDocument can be extended with arbitrary functionality by extending the GLTFDocumentExtension class and registering it with GLTFDocument via register_gltf_document_extension. This allows for custom data to be imported and exported. Tutorials Runtime file loading and saving glTF 'What the duck?' guide Khronos glTF specification Properties String image_format "PNG" float lossy_quality 0.75 RootNodeMode root_node_mode 0 Methods Error append_from_buffer ( PackedByteArray bytes, String base_path, GLTFState state, int flags=0 ) Error append_from_file ( String path, GLTFState state, int flags=0, String base_path="" ) Error append_from_scene ( Node node, GLTFState state, int flags=0 ) PackedByteArray generate_buffer ( GLTFState state ) Node generate_scene ( GLTFState state, float bake_fps=30, bool trimming=false, bool remove_immutable_tracks=true ) void register_gltf_document_extension ( GLTFDocumentExtension extension, bool first_priority=false ) static void unregister_gltf_document_extension ( GLTFDocumentExtension extension ) static Error write_to_filesystem ( GLTFState state, String path ) Enumerations enum RootNodeMode: RootNodeMode ROOT_NODE_MODE_SINGLE_ROOT = 0 Treat the Godot scene's root node as the root node of the glTF file, and mark it as the single root node via the GODOT_single_root glTF extension. This will be parsed the same as ROOT_NODE_MODE_KEEP_ROOT if the implementation does not support GODOT_single_root. RootNodeMode ROOT_NODE_MODE_KEEP_ROOT = 1 Treat the Godot scene's root node as the root node of the glTF file, but do not mark it as anything special. An extra root node will be generated when importing into Godot. This uses only vanilla glTF features. This is equivalent to the behavior in Godot 4.1 and earlier. RootNodeMode ROOT_NODE_MODE_MULTI_ROOT = 2 Treat the Godot scene's root node as the name of the glTF scene, and add all of its children as root nodes of the glTF file. This uses only vanilla glTF features. This avoids an extra root node, but only the name of the Godot scene's root node will be preserved, as it will not be saved as a node. Property Descriptions String image_format = "PNG" void set_image_format ( String value ) String get_image_format ( ) The user-friendly name of the export image format. This is used when exporting the GLTF file, including writing to a file and writing to a byte array. By default, Godot allows the following options: "None", "PNG", "JPEG", "Lossless WebP", and "Lossy WebP". Support for more image formats can be added in GLTFDocumentExtension classes. float lossy_quality = 0.75 void set_lossy_quality ( float value ) float get_lossy_quality ( ) If image_format is a lossy image format, this determines the lossy quality of the image. On a range of 0.0 to 1.0, where 0.0 is the lowest quality and 1.0 is the highest quality. A lossy quality of 1.0 is not the same as lossless. RootNodeMode root_node_mode = 0 void set_root_node_mode ( RootNodeMode value ) RootNodeMode get_root_node_mode ( ) How to process the root node during export. See RootNodeMode for details. The default and recommended value is ROOT_NODE_MODE_SINGLE_ROOT. Note: Regardless of how the glTF file is exported, when importing, the root node type and name can be overridden in the scene import settings tab. Method Descriptions Error append_from_buffer ( PackedByteArray bytes, String base_path, GLTFState state, int flags=0 ) Takes a PackedByteArray defining a GLTF and imports the data to the given GLTFState object through the state parameter. Note: The base_path tells append_from_buffer where to find dependencies and can be empty. Error append_from_file ( String path, GLTFState state, int flags=0, String base_path="" ) Takes a path to a GLTF file and imports the data at that file path to the given GLTFState object through the state parameter. Note: The base_path tells append_from_file where to find dependencies and can be empty. Error append_from_scene ( Node node, GLTFState state, int flags=0 ) Takes a Godot Engine scene node and exports it and its descendants to the given GLTFState object through the state parameter. PackedByteArray generate_buffer ( GLTFState state ) Takes a GLTFState object through the state parameter and returns a GLTF PackedByteArray. Node generate_scene ( GLTFState state, float bake_fps=30, bool trimming=false, bool remove_immutable_tracks=true ) Takes a GLTFState object through the state parameter and returns a Godot Engine scene node. void register_gltf_document_extension ( GLTFDocumentExtension extension, bool first_priority=false ) static Registers the given GLTFDocumentExtension instance with GLTFDocument. If first_priority is true, this extension will be run first. Otherwise, it will be run last. Note: Like GLTFDocument itself, all GLTFDocumentExtension classes must be stateless in order to function properly. If you need to store data, use the set_additional_data and get_additional_data methods in GLTFState or GLTFNode. void unregister_gltf_document_extension ( GLTFDocumentExtension extension ) static Unregisters the given GLTFDocumentExtension instance. Error write_to_filesystem ( GLTFState state, String path ) Takes a GLTFState object through the state parameter and writes a glTF file to the filesystem. Note: The extension of the glTF file determines if it is a .glb binary file or a .gltf file. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_gltfdocument.html classes/class_curve3d ----------------------------------------------------------- Curve3D Inherits: Resource < RefCounted < Object Describes a Bézier curve in 3D space. Description This class describes a Bézier curve in 3D space. It is mainly used to give a shape to a Path3D, but can be manually sampled for other purposes. It keeps a cache of precalculated points along the curve, to speed up further calculations. Properties float bake_interval 0.2 int point_count 0 bool up_vector_enabled true Methods void add_point ( Vector3 position, Vector3 in=Vector3(0, 0, 0), Vector3 out=Vector3(0, 0, 0), int index=-1 ) void clear_points ( ) float get_baked_length ( ) const PackedVector3Array get_baked_points ( ) const PackedFloat32Array get_baked_tilts ( ) const PackedVector3Array get_baked_up_vectors ( ) const float get_closest_offset ( Vector3 to_point ) const Vector3 get_closest_point ( Vector3 to_point ) const Vector3 get_point_in ( int idx ) const Vector3 get_point_out ( int idx ) const Vector3 get_point_position ( int idx ) const float get_point_tilt ( int idx ) const void remove_point ( int idx ) Vector3 sample ( int idx, float t ) const Vector3 sample_baked ( float offset=0.0, bool cubic=false ) const Vector3 sample_baked_up_vector ( float offset, bool apply_tilt=false ) const Transform3D sample_baked_with_rotation ( float offset=0.0, bool cubic=false, bool apply_tilt=false ) const Vector3 samplef ( float fofs ) const void set_point_in ( int idx, Vector3 position ) void set_point_out ( int idx, Vector3 position ) void set_point_position ( int idx, Vector3 position ) void set_point_tilt ( int idx, float tilt ) PackedVector3Array tessellate ( int max_stages=5, float tolerance_degrees=4 ) const PackedVector3Array tessellate_even_length ( int max_stages=5, float tolerance_length=0.2 ) const Property Descriptions float bake_interval = 0.2 void set_bake_interval ( float value ) float get_bake_interval ( ) The distance in meters between two adjacent cached points. Changing it forces the cache to be recomputed the next time the get_baked_points or get_baked_length function is called. The smaller the distance, the more points in the cache and the more memory it will consume, so use with care. int point_count = 0 void set_point_count ( int value ) int get_point_count ( ) The number of points describing the curve. bool up_vector_enabled = true void set_up_vector_enabled ( bool value ) bool is_up_vector_enabled ( ) If true, the curve will bake up vectors used for orientation. This is used when PathFollow3D.rotation_mode is set to PathFollow3D.ROTATION_ORIENTED. Changing it forces the cache to be recomputed. Method Descriptions void add_point ( Vector3 position, Vector3 in=Vector3(0, 0, 0), Vector3 out=Vector3(0, 0, 0), int index=-1 ) Adds a point with the specified position relative to the curve's own position, with control points in and out. Appends the new point at the end of the point list. If index is given, the new point is inserted before the existing point identified by index index. Every existing point starting from index is shifted further down the list of points. The index must be greater than or equal to 0 and must not exceed the number of existing points in the line. See point_count. void clear_points ( ) Removes all points from the curve. float get_baked_length ( ) const Returns the total length of the curve, based on the cached points. Given enough density (see bake_interval), it should be approximate enough. PackedVector3Array get_baked_points ( ) const Returns the cache of points as a PackedVector3Array. PackedFloat32Array get_baked_tilts ( ) const Returns the cache of tilts as a PackedFloat32Array. PackedVector3Array get_baked_up_vectors ( ) const Returns the cache of up vectors as a PackedVector3Array. If up_vector_enabled is false, the cache will be empty. float get_closest_offset ( Vector3 to_point ) const Returns the closest offset to to_point. This offset is meant to be used in sample_baked or sample_baked_up_vector. to_point must be in this curve's local space. Vector3 get_closest_point ( Vector3 to_point ) const Returns the closest point on baked segments (in curve's local space) to to_point. to_point must be in this curve's local space. Vector3 get_point_in ( int idx ) const Returns the position of the control point leading to the vertex idx. The returned position is relative to the vertex idx. If the index is out of bounds, the function sends an error to the console, and returns (0, 0, 0). Vector3 get_point_out ( int idx ) const Returns the position of the control point leading out of the vertex idx. The returned position is relative to the vertex idx. If the index is out of bounds, the function sends an error to the console, and returns (0, 0, 0). Vector3 get_point_position ( int idx ) const Returns the position of the vertex idx. If the index is out of bounds, the function sends an error to the console, and returns (0, 0, 0). float get_point_tilt ( int idx ) const Returns the tilt angle in radians for the point idx. If the index is out of bounds, the function sends an error to the console, and returns 0. void remove_point ( int idx ) Deletes the point idx from the curve. Sends an error to the console if idx is out of bounds. Vector3 sample ( int idx, float t ) const Returns the position between the vertex idx and the vertex idx + 1, where t controls if the point is the first vertex (t = 0.0), the last vertex (t = 1.0), or in between. Values of t outside the range (0.0 >= t <=1) give strange, but predictable results. If idx is out of bounds it is truncated to the first or last vertex, and t is ignored. If the curve has no points, the function sends an error to the console, and returns (0, 0, 0). Vector3 sample_baked ( float offset=0.0, bool cubic=false ) const Returns a point within the curve at position offset, where offset is measured as a distance in 3D units along the curve. To do that, it finds the two cached points where the offset lies between, then interpolates the values. This interpolation is cubic if cubic is set to true, or linear if set to false. Cubic interpolation tends to follow the curves better, but linear is faster (and often, precise enough). Vector3 sample_baked_up_vector ( float offset, bool apply_tilt=false ) const Returns an up vector within the curve at position offset, where offset is measured as a distance in 3D units along the curve. To do that, it finds the two cached up vectors where the offset lies between, then interpolates the values. If apply_tilt is true, an interpolated tilt is applied to the interpolated up vector. If the curve has no up vectors, the function sends an error to the console, and returns (0, 1, 0). Transform3D sample_baked_with_rotation ( float offset=0.0, bool cubic=false, bool apply_tilt=false ) const Returns a Transform3D with origin as point position, basis.x as sideway vector, basis.y as up vector, basis.z as forward vector. When the curve length is 0, there is no reasonable way to calculate the rotation, all vectors aligned with global space axes. See also sample_baked. Vector3 samplef ( float fofs ) const Returns the position at the vertex fofs. It calls sample using the integer part of fofs as idx, and its fractional part as t. void set_point_in ( int idx, Vector3 position ) Sets the position of the control point leading to the vertex idx. If the index is out of bounds, the function sends an error to the console. The position is relative to the vertex. void set_point_out ( int idx, Vector3 position ) Sets the position of the control point leading out of the vertex idx. If the index is out of bounds, the function sends an error to the console. The position is relative to the vertex. void set_point_position ( int idx, Vector3 position ) Sets the position for the vertex idx. If the index is out of bounds, the function sends an error to the console. void set_point_tilt ( int idx, float tilt ) Sets the tilt angle in radians for the point idx. If the index is out of bounds, the function sends an error to the console. The tilt controls the rotation along the look-at axis an object traveling the path would have. In the case of a curve controlling a PathFollow3D, this tilt is an offset over the natural tilt the PathFollow3D calculates. PackedVector3Array tessellate ( int max_stages=5, float tolerance_degrees=4 ) const Returns a list of points along the curve, with a curvature controlled point density. That is, the curvier parts will have more points than the straighter parts. This approximation makes straight segments between each point, then subdivides those segments until the resulting shape is similar enough. max_stages controls how many subdivisions a curve segment may face before it is considered approximate enough. Each subdivision splits the segment in half, so the default 5 stages may mean up to 32 subdivisions per curve segment. Increase with care! tolerance_degrees controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided. PackedVector3Array tessellate_even_length ( int max_stages=5, float tolerance_length=0.2 ) const Returns a list of points along the curve, with almost uniform density. max_stages controls how many subdivisions a curve segment may face before it is considered approximate enough. Each subdivision splits the segment in half, so the default 5 stages may mean up to 32 subdivisions per curve segment. Increase with care! tolerance_length controls the maximal distance between two neighboring points, before the segment has to be subdivided. © 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_curve3d.html classes/class_control ----------------------------------------------------------- Control Inherits: CanvasItem < Node < Object Inherited By: BaseButton, ColorRect, Container, GraphEdit, ItemList, Label, LineEdit, MenuBar, NinePatchRect, Panel, Range, ReferenceRect, RichTextLabel, Separator, TabBar, TextEdit, TextureRect, Tree, VideoStreamPlayer Base class for all GUI controls. Adapts its position and size based on its parent control. Description Base class for all UI-related nodes. Control features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and offsets relative to the anchor. The offsets update automatically when the node, any of its parents, or the screen size change. For more information on Godot's UI system, anchors, offsets, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from Control and Container nodes. User Interface nodes and input Godot propagates input events via viewports. Each Viewport is responsible for propagating InputEvents to their child nodes. As the SceneTree.root is a Window, this already happens automatically for all UI elements in your game. Input events are propagated through the SceneTree from the root node to all child nodes by calling Node._input. For UI elements specifically, it makes more sense to override the virtual method _gui_input, which filters out unrelated input events, such as by checking z-order, mouse_filter, focus, or if the event was inside of the control's bounding box. Call accept_event so no other node receives the event. Once you accept an input, it becomes handled so Node._unhandled_input will not process it. Only one Control node can be in focus. Only the node in focus will receive events. To get the focus, call grab_focus. Control nodes lose focus when another node grabs it, or if you hide the node in focus. Sets mouse_filter to MOUSE_FILTER_IGNORE to tell a Control node to ignore mouse or touch events. You'll need it if you place an icon on top of a button. Theme resources change the Control's appearance. If you change the Theme on a Control node, it affects all of its children. To override some of the theme's parameters, call one of the add_theme_*_override methods, like add_theme_font_override. You can override the theme with the Inspector. Note: Theme items are not Object properties. This means you can't access their values using Object.get and Object.set. Instead, use the get_theme_* and add_theme_*_override methods provided by this class. Tutorials GUI documentation index Custom drawing in 2D Control node gallery Multiple resolutions All GUI Demos Properties float anchor_bottom 0.0 float anchor_left 0.0 float anchor_right 0.0 float anchor_top 0.0 bool auto_translate true bool clip_contents false Vector2 custom_minimum_size Vector2(0, 0) FocusMode focus_mode 0 NodePath focus_neighbor_bottom NodePath("") NodePath focus_neighbor_left NodePath("") NodePath focus_neighbor_right NodePath("") NodePath focus_neighbor_top NodePath("") NodePath focus_next NodePath("") NodePath focus_previous NodePath("") Vector2 global_position GrowDirection grow_horizontal 1 GrowDirection grow_vertical 1 LayoutDirection layout_direction 0 bool localize_numeral_system true CursorShape mouse_default_cursor_shape 0 MouseFilter mouse_filter 0 bool mouse_force_pass_scroll_events true float offset_bottom 0.0 float offset_left 0.0 float offset_right 0.0 float offset_top 0.0 Vector2 pivot_offset Vector2(0, 0) Vector2 position Vector2(0, 0) float rotation 0.0 float rotation_degrees Vector2 scale Vector2(1, 1) Node shortcut_context Vector2 size Vector2(0, 0) BitField size_flags_horizontal 1 float size_flags_stretch_ratio 1.0 BitField size_flags_vertical 1 Theme theme StringName theme_type_variation &"" String tooltip_text "" Methods bool _can_drop_data ( Vector2 at_position, Variant data ) virtual const void _drop_data ( Vector2 at_position, Variant data ) virtual Variant _get_drag_data ( Vector2 at_position ) virtual Vector2 _get_minimum_size ( ) virtual const String _get_tooltip ( Vector2 at_position ) virtual const void _gui_input ( InputEvent event ) virtual bool _has_point ( Vector2 point ) virtual const Object _make_custom_tooltip ( String for_text ) virtual const Vector3i[] _structured_text_parser ( Array args, String text ) virtual const void accept_event ( ) void add_theme_color_override ( StringName name, Color color ) void add_theme_constant_override ( StringName name, int constant ) void add_theme_font_override ( StringName name, Font font ) void add_theme_font_size_override ( StringName name, int font_size ) void add_theme_icon_override ( StringName name, Texture2D texture ) void add_theme_stylebox_override ( StringName name, StyleBox stylebox ) void begin_bulk_theme_override ( ) void end_bulk_theme_override ( ) Control find_next_valid_focus ( ) const Control find_prev_valid_focus ( ) const Control find_valid_focus_neighbor ( Side side ) const void force_drag ( Variant data, Control preview ) float get_anchor ( Side side ) const Vector2 get_begin ( ) const Vector2 get_combined_minimum_size ( ) const CursorShape get_cursor_shape ( Vector2 position=Vector2(0, 0) ) const Vector2 get_end ( ) const NodePath get_focus_neighbor ( Side side ) const Rect2 get_global_rect ( ) const Vector2 get_minimum_size ( ) const float get_offset ( Side offset ) const Vector2 get_parent_area_size ( ) const Control get_parent_control ( ) const Rect2 get_rect ( ) const Vector2 get_screen_position ( ) const Color get_theme_color ( StringName name, StringName theme_type="" ) const int get_theme_constant ( StringName name, StringName theme_type="" ) const float get_theme_default_base_scale ( ) const Font get_theme_default_font ( ) const int get_theme_default_font_size ( ) const Font get_theme_font ( StringName name, StringName theme_type="" ) const int get_theme_font_size ( StringName name, StringName theme_type="" ) const Texture2D get_theme_icon ( StringName name, StringName theme_type="" ) const StyleBox get_theme_stylebox ( StringName name, StringName theme_type="" ) const String get_tooltip ( Vector2 at_position=Vector2(0, 0) ) const void grab_click_focus ( ) void grab_focus ( ) bool has_focus ( ) const bool has_theme_color ( StringName name, StringName theme_type="" ) const bool has_theme_color_override ( StringName name ) const bool has_theme_constant ( StringName name, StringName theme_type="" ) const bool has_theme_constant_override ( StringName name ) const bool has_theme_font ( StringName name, StringName theme_type="" ) const bool has_theme_font_override ( StringName name ) const bool has_theme_font_size ( StringName name, StringName theme_type="" ) const bool has_theme_font_size_override ( StringName name ) const bool has_theme_icon ( StringName name, StringName theme_type="" ) const bool has_theme_icon_override ( StringName name ) const bool has_theme_stylebox ( StringName name, StringName theme_type="" ) const bool has_theme_stylebox_override ( StringName name ) const bool is_drag_successful ( ) const bool is_layout_rtl ( ) const void release_focus ( ) void remove_theme_color_override ( StringName name ) void remove_theme_constant_override ( StringName name ) void remove_theme_font_override ( StringName name ) void remove_theme_font_size_override ( StringName name ) void remove_theme_icon_override ( StringName name ) void remove_theme_stylebox_override ( StringName name ) void reset_size ( ) void set_anchor ( Side side, float anchor, bool keep_offset=false, bool push_opposite_anchor=true ) void set_anchor_and_offset ( Side side, float anchor, float offset, bool push_opposite_anchor=false ) void set_anchors_and_offsets_preset ( LayoutPreset preset, LayoutPresetMode resize_mode=0, int margin=0 ) void set_anchors_preset ( LayoutPreset preset, bool keep_offsets=false ) void set_begin ( Vector2 position ) void set_drag_forwarding ( Callable drag_func, Callable can_drop_func, Callable drop_func ) void set_drag_preview ( Control control ) void set_end ( Vector2 position ) void set_focus_neighbor ( Side side, NodePath neighbor ) void set_global_position ( Vector2 position, bool keep_offsets=false ) void set_offset ( Side side, float offset ) void set_offsets_preset ( LayoutPreset preset, LayoutPresetMode resize_mode=0, int margin=0 ) void set_position ( Vector2 position, bool keep_offsets=false ) void set_size ( Vector2 size, bool keep_offsets=false ) void update_minimum_size ( ) void warp_mouse ( Vector2 position ) Signals focus_entered ( ) Emitted when the node gains focus. focus_exited ( ) Emitted when the node loses focus. gui_input ( InputEvent event ) Emitted when the node receives an InputEvent. minimum_size_changed ( ) Emitted when the node's minimum size changes. mouse_entered ( ) Emitted when the mouse cursor enters the control's (or any child control's) visible area, that is not occluded behind other Controls or Windows, provided its mouse_filter lets the event reach it and regardless if it's currently focused or not. Note: CanvasItem.z_index doesn't affect, which Control receives the signal. mouse_exited ( ) Emitted when the mouse cursor leaves the control's (and all child control's) visible area, that is not occluded behind other Controls or Windows, provided its mouse_filter lets the event reach it and regardless if it's currently focused or not. Note: CanvasItem.z_index doesn't affect, which Control receives the signal. Note: If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this: func _on_mouse_exited(): if not Rect2(Vector2(), size).has_point(get_local_mouse_position()): # Not hovering over area. resized ( ) Emitted when the control changes size. size_flags_changed ( ) Emitted when one of the size flags changes. See size_flags_horizontal and size_flags_vertical. theme_changed ( ) Emitted when the NOTIFICATION_THEME_CHANGED notification is sent. Enumerations enum FocusMode: FocusMode FOCUS_NONE = 0 The node cannot grab focus. Use with focus_mode. FocusMode FOCUS_CLICK = 1 The node can only grab focus on mouse clicks. Use with focus_mode. FocusMode FOCUS_ALL = 2 The node can grab focus on mouse click, using the arrows and the Tab keys on the keyboard, or using the D-pad buttons on a gamepad. Use with focus_mode. enum CursorShape: CursorShape CURSOR_ARROW = 0 Show the system's arrow mouse cursor when the user hovers the node. Use with mouse_default_cursor_shape. CursorShape CURSOR_IBEAM = 1 Show the system's I-beam mouse cursor when the user hovers the node. The I-beam pointer has a shape similar to "I". It tells the user they can highlight or insert text. CursorShape CURSOR_POINTING_HAND = 2 Show the system's pointing hand mouse cursor when the user hovers the node. CursorShape CURSOR_CROSS = 3 Show the system's cross mouse cursor when the user hovers the node. CursorShape CURSOR_WAIT = 4 Show the system's wait mouse cursor when the user hovers the node. Often an hourglass. CursorShape CURSOR_BUSY = 5 Show the system's busy mouse cursor when the user hovers the node. Often an arrow with a small hourglass. CursorShape CURSOR_DRAG = 6 Show the system's drag mouse cursor, often a closed fist or a cross symbol, when the user hovers the node. It tells the user they're currently dragging an item, like a node in the Scene dock. CursorShape CURSOR_CAN_DROP = 7 Show the system's drop mouse cursor when the user hovers the node. It can be an open hand. It tells the user they can drop an item they're currently grabbing, like a node in the Scene dock. CursorShape CURSOR_FORBIDDEN = 8 Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle. CursorShape CURSOR_VSIZE = 9 Show the system's vertical resize mouse cursor when the user hovers the node. A double-headed vertical arrow. It tells the user they can resize the window or the panel vertically. CursorShape CURSOR_HSIZE = 10 Show the system's horizontal resize mouse cursor when the user hovers the node. A double-headed horizontal arrow. It tells the user they can resize the window or the panel horizontally. CursorShape CURSOR_BDIAGSIZE = 11 Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double-headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically. CursorShape CURSOR_FDIAGSIZE = 12 Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double-headed arrow that goes from the top left to the bottom right, the opposite of CURSOR_BDIAGSIZE. It tells the user they can resize the window or the panel both horizontally and vertically. CursorShape CURSOR_MOVE = 13 Show the system's move mouse cursor when the user hovers the node. It shows 2 double-headed arrows at a 90 degree angle. It tells the user they can move a UI element freely. CursorShape CURSOR_VSPLIT = 14 Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as CURSOR_VSIZE. CursorShape CURSOR_HSPLIT = 15 Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as CURSOR_HSIZE. CursorShape CURSOR_HELP = 16 Show the system's help mouse cursor when the user hovers the node, a question mark. enum LayoutPreset: LayoutPreset PRESET_TOP_LEFT = 0 Snap all 4 anchors to the top-left of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_TOP_RIGHT = 1 Snap all 4 anchors to the top-right of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_BOTTOM_LEFT = 2 Snap all 4 anchors to the bottom-left of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_BOTTOM_RIGHT = 3 Snap all 4 anchors to the bottom-right of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_CENTER_LEFT = 4 Snap all 4 anchors to the center of the left edge of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_CENTER_TOP = 5 Snap all 4 anchors to the center of the top edge of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_CENTER_RIGHT = 6 Snap all 4 anchors to the center of the right edge of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_CENTER_BOTTOM = 7 Snap all 4 anchors to the center of the bottom edge of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_CENTER = 8 Snap all 4 anchors to the center of the parent control's bounds. Use with set_anchors_preset. LayoutPreset PRESET_LEFT_WIDE = 9 Snap all 4 anchors to the left edge of the parent control. The left offset becomes relative to the left edge and the top offset relative to the top left corner of the node's parent. Use with set_anchors_preset. LayoutPreset PRESET_TOP_WIDE = 10 Snap all 4 anchors to the top edge of the parent control. The left offset becomes relative to the top left corner, the top offset relative to the top edge, and the right offset relative to the top right corner of the node's parent. Use with set_anchors_preset. LayoutPreset PRESET_RIGHT_WIDE = 11 Snap all 4 anchors to the right edge of the parent control. The right offset becomes relative to the right edge and the top offset relative to the top right corner of the node's parent. Use with set_anchors_preset. LayoutPreset PRESET_BOTTOM_WIDE = 12 Snap all 4 anchors to the bottom edge of the parent control. The left offset becomes relative to the bottom left corner, the bottom offset relative to the bottom edge, and the right offset relative to the bottom right corner of the node's parent. Use with set_anchors_preset. LayoutPreset PRESET_VCENTER_WIDE = 13 Snap all 4 anchors to a vertical line that cuts the parent control in half. Use with set_anchors_preset. LayoutPreset PRESET_HCENTER_WIDE = 14 Snap all 4 anchors to a horizontal line that cuts the parent control in half. Use with set_anchors_preset. LayoutPreset PRESET_FULL_RECT = 15 Snap all 4 anchors to the respective corners of the parent control. Set all 4 offsets to 0 after you applied this preset and the Control will fit its parent control. Use with set_anchors_preset. enum LayoutPresetMode: LayoutPresetMode PRESET_MODE_MINSIZE = 0 The control will be resized to its minimum size. LayoutPresetMode PRESET_MODE_KEEP_WIDTH = 1 The control's width will not change. LayoutPresetMode PRESET_MODE_KEEP_HEIGHT = 2 The control's height will not change. LayoutPresetMode PRESET_MODE_KEEP_SIZE = 3 The control's size will not change. flags SizeFlags: SizeFlags SIZE_SHRINK_BEGIN = 0 Tells the parent Container to align the node with its start, either the top or the left edge. It is mutually exclusive with SIZE_FILL and other shrink size flags, but can be used with SIZE_EXPAND in some containers. Use with size_flags_horizontal and size_flags_vertical. Note: Setting this flag is equal to not having any size flags. SizeFlags SIZE_FILL = 1 Tells the parent Container to expand the bounds of this node to fill all the available space without pushing any other node. It is mutually exclusive with shrink size flags. Use with size_flags_horizontal and size_flags_vertical. SizeFlags SIZE_EXPAND = 2 Tells the parent Container to let this node take all the available space on the axis you flag. If multiple neighboring nodes are set to expand, they'll share the space based on their stretch ratio. See size_flags_stretch_ratio. Use with size_flags_horizontal and size_flags_vertical. SizeFlags SIZE_EXPAND_FILL = 3 Sets the node's size flags to both fill and expand. See SIZE_FILL and SIZE_EXPAND for more information. SizeFlags SIZE_SHRINK_CENTER = 4 Tells the parent Container to center the node in the available space. It is mutually exclusive with SIZE_FILL and other shrink size flags, but can be used with SIZE_EXPAND in some containers. Use with size_flags_horizontal and size_flags_vertical. SizeFlags SIZE_SHRINK_END = 8 Tells the parent Container to align the node with its end, either the bottom or the right edge. It is mutually exclusive with SIZE_FILL and other shrink size flags, but can be used with SIZE_EXPAND in some containers. Use with size_flags_horizontal and size_flags_vertical. enum MouseFilter: MouseFilter MOUSE_FILTER_STOP = 0 The control will receive mouse movement input events and mouse button input events if clicked on through _gui_input. And the control will receive the mouse_entered and mouse_exited signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls. MouseFilter MOUSE_FILTER_PASS = 1 The control will receive mouse movement input events and mouse button input events if clicked on through _gui_input. And the control will receive the mouse_entered and mouse_exited signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. If no control handled it, the event will be passed to Node._shortcut_input for further processing. MouseFilter MOUSE_FILTER_IGNORE = 2 The control will not receive mouse movement input events and mouse button input events if clicked on through _gui_input. The control will also not receive the mouse_entered nor mouse_exited signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically. Note: If the control has received mouse_entered but not mouse_exited, changing the mouse_filter to MOUSE_FILTER_IGNORE will cause mouse_exited to be emitted. enum GrowDirection: GrowDirection GROW_DIRECTION_BEGIN = 0 The control will grow to the left or top to make up if its minimum size is changed to be greater than its current size on the respective axis. GrowDirection GROW_DIRECTION_END = 1 The control will grow to the right or bottom to make up if its minimum size is changed to be greater than its current size on the respective axis. GrowDirection GROW_DIRECTION_BOTH = 2 The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size. enum Anchor: Anchor ANCHOR_BEGIN = 0 Snaps one of the 4 anchor's sides to the origin of the node's Rect, in the top left. Use it with one of the anchor_* member variables, like anchor_left. To change all 4 anchors at once, use set_anchors_preset. Anchor ANCHOR_END = 1 Snaps one of the 4 anchor's sides to the end of the node's Rect, in the bottom right. Use it with one of the anchor_* member variables, like anchor_left. To change all 4 anchors at once, use set_anchors_preset. enum LayoutDirection: LayoutDirection LAYOUT_DIRECTION_INHERITED = 0 Automatic layout direction, determined from the parent control layout direction. LayoutDirection LAYOUT_DIRECTION_LOCALE = 1 Automatic layout direction, determined from the current locale. LayoutDirection LAYOUT_DIRECTION_LTR = 2 Left-to-right layout direction. LayoutDirection LAYOUT_DIRECTION_RTL = 3 Right-to-left layout direction. enum TextDirection: TextDirection TEXT_DIRECTION_INHERITED = 3 Text writing direction is the same as layout direction. TextDirection TEXT_DIRECTION_AUTO = 0 Automatic text writing direction, determined from the current locale and text content. TextDirection TEXT_DIRECTION_LTR = 1 Left-to-right text writing direction. TextDirection TEXT_DIRECTION_RTL = 2 Right-to-left text writing direction. Constants NOTIFICATION_RESIZED = 40 Sent when the node changes size. Use size to get the new size. NOTIFICATION_MOUSE_ENTER = 41 Sent when the mouse cursor enters the control's (or any child control's) visible area, that is not occluded behind other Controls or Windows, provided its mouse_filter lets the event reach it and regardless if it's currently focused or not. Note: CanvasItem.z_index doesn't affect which Control receives the notification. See also NOTIFICATION_MOUSE_ENTER_SELF. NOTIFICATION_MOUSE_EXIT = 42 Sent when the mouse cursor leaves the control's (and all child control's) visible area, that is not occluded behind other Controls or Windows, provided its mouse_filter lets the event reach it and regardless if it's currently focused or not. Note: CanvasItem.z_index doesn't affect which Control receives the notification. See also NOTIFICATION_MOUSE_EXIT_SELF. NOTIFICATION_MOUSE_ENTER_SELF = 60 Sent when the mouse cursor enters the control's visible area, that is not occluded behind other Controls or Windows, provided its mouse_filter lets the event reach it and regardless if it's currently focused or not. Note: CanvasItem.z_index doesn't affect which Control receives the notification. See also NOTIFICATION_MOUSE_ENTER. NOTIFICATION_MOUSE_EXIT_SELF = 61 Sent when the mouse cursor leaves the control's visible area, that is not occluded behind other Controls or Windows, provided its mouse_filter lets the event reach it and regardless if it's currently focused or not. Note: CanvasItem.z_index doesn't affect which Control receives the notification. See also NOTIFICATION_MOUSE_EXIT. NOTIFICATION_FOCUS_ENTER = 43 Sent when the node grabs focus. NOTIFICATION_FOCUS_EXIT = 44 Sent when the node loses focus. NOTIFICATION_THEME_CHANGED = 45 Sent when the node needs to refresh its theme items. This happens in one of the following cases: The theme property is changed on this node or any of its ancestors. The theme_type_variation property is changed on this node. One of the node's theme property overrides is changed. The node enters the scene tree. Note: As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree. NOTIFICATION_SCROLL_BEGIN = 47 Sent when this node is inside a ScrollContainer which has begun being scrolled when dragging the scrollable area with a touch event. This notification is not sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events. Note: This signal is only emitted on Android or iOS, or on desktop/web platforms when ProjectSettings.input_devices/pointing/emulate_touch_from_mouse is enabled. NOTIFICATION_SCROLL_END = 48 Sent when this node is inside a ScrollContainer which has stopped being scrolled when dragging the scrollable area with a touch event. This notification is not sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events. Note: This signal is only emitted on Android or iOS, or on desktop/web platforms when ProjectSettings.input_devices/pointing/emulate_touch_from_mouse is enabled. NOTIFICATION_LAYOUT_DIRECTION_CHANGED = 49 Sent when control layout direction is changed. Property Descriptions float anchor_bottom = 0.0 float get_anchor ( Side side ) const Anchors the bottom edge of the node to the origin, the center, or the end of its parent control. It changes how the bottom offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience. float anchor_left = 0.0 float get_anchor ( Side side ) const Anchors the left edge of the node to the origin, the center or the end of its parent control. It changes how the left offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience. float anchor_right = 0.0 float get_anchor ( Side side ) const Anchors the right edge of the node to the origin, the center or the end of its parent control. It changes how the right offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience. float anchor_top = 0.0 float get_anchor ( Side side ) const Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience. bool auto_translate = true void set_auto_translate ( bool value ) bool is_auto_translating ( ) Toggles if any text should automatically change to its translated version depending on the current locale. Also decides if the node's strings should be parsed for POT generation. bool clip_contents = false void set_clip_contents ( bool value ) bool is_clipping_contents ( ) Enables whether rendering of CanvasItem based children should be clipped to this control's rectangle. If true, parts of a child which would be visibly outside of this control's rectangle will not be rendered and won't receive input. Vector2 custom_minimum_size = Vector2(0, 0) void set_custom_minimum_size ( Vector2 value ) Vector2 get_custom_minimum_size ( ) The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes. FocusMode focus_mode = 0 void set_focus_mode ( FocusMode value ) FocusMode get_focus_mode ( ) The focus access mode for the control (None, Click or All). Only one Control can be focused at the same time, and it will receive keyboard, gamepad, and mouse signals. NodePath focus_neighbor_bottom = NodePath("") void set_focus_neighbor ( Side side, NodePath neighbor ) NodePath get_focus_neighbor ( Side side ) const Tells Godot which node it should give focus to if the user presses the down arrow on the keyboard or down on a gamepad by default. You can change the key by editing the ProjectSettings.input/ui_down input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the bottom of this one. NodePath focus_neighbor_left = NodePath("") void set_focus_neighbor ( Side side, NodePath neighbor ) NodePath get_focus_neighbor ( Side side ) const Tells Godot which node it should give focus to if the user presses the left arrow on the keyboard or left on a gamepad by default. You can change the key by editing the ProjectSettings.input/ui_left input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the left of this one. NodePath focus_neighbor_right = NodePath("") void set_focus_neighbor ( Side side, NodePath neighbor ) NodePath get_focus_neighbor ( Side side ) const Tells Godot which node it should give focus to if the user presses the right arrow on the keyboard or right on a gamepad by default. You can change the key by editing the ProjectSettings.input/ui_right input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the right of this one. NodePath focus_neighbor_top = NodePath("") void set_focus_neighbor ( Side side, NodePath neighbor ) NodePath get_focus_neighbor ( Side side ) const Tells Godot which node it should give focus to if the user presses the top arrow on the keyboard or top on a gamepad by default. You can change the key by editing the ProjectSettings.input/ui_up input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the top of this one. NodePath focus_next = NodePath("") void set_focus_next ( NodePath value ) NodePath get_focus_next ( ) Tells Godot which node it should give focus to if the user presses Tab on a keyboard by default. You can change the key by editing the ProjectSettings.input/ui_focus_next input action. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree. NodePath focus_previous = NodePath("") void set_focus_previous ( NodePath value ) NodePath get_focus_previous ( ) Tells Godot which node it should give focus to if the user presses Shift + Tab on a keyboard by default. You can change the key by editing the ProjectSettings.input/ui_focus_prev input action. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree. Vector2 global_position Vector2 get_global_position ( ) The node's global position, relative to the world (usually to the CanvasLayer). GrowDirection grow_horizontal = 1 void set_h_grow_direction ( GrowDirection value ) GrowDirection get_h_grow_direction ( ) Controls the direction on the horizontal axis in which the control should grow if its horizontal minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size. GrowDirection grow_vertical = 1 void set_v_grow_direction ( GrowDirection value ) GrowDirection get_v_grow_direction ( ) Controls the direction on the vertical axis in which the control should grow if its vertical minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size. LayoutDirection layout_direction = 0 void set_layout_direction ( LayoutDirection value ) LayoutDirection get_layout_direction ( ) Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). bool localize_numeral_system = true void set_localize_numeral_system ( bool value ) bool is_localizing_numeral_system ( ) If true, automatically converts code line numbers, list indices, SpinBox and ProgressBar values from the Western Arabic (0..9) to the numeral systems used in current locale. Note: Numbers within the text are not automatically converted, it can be done manually, using TextServer.format_number. CursorShape mouse_default_cursor_shape = 0 void set_default_cursor_shape ( CursorShape value ) CursorShape get_default_cursor_shape ( ) The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors. Note: On Linux, shapes may vary depending on the cursor theme of the system. MouseFilter mouse_filter = 0 void set_mouse_filter ( MouseFilter value ) MouseFilter get_mouse_filter ( ) Controls whether the control will be able to receive mouse button input events through _gui_input and how these events should be handled. Also controls whether the control can receive the mouse_entered, and mouse_exited signals. See the constants to learn what each does. bool mouse_force_pass_scroll_events = true void set_force_pass_scroll_events ( bool value ) bool is_force_pass_scroll_events ( ) When enabled, scroll wheel events processed by _gui_input will be passed to the parent control even if mouse_filter is set to MOUSE_FILTER_STOP. As it defaults to true, this allows nested scrollable containers to work out of the box. You should disable it on the root of your UI if you do not want scroll events to go to the Node._unhandled_input processing. float offset_bottom = 0.0 void set_offset ( Side side, float offset ) float get_offset ( Side offset ) const Distance between the node's bottom edge and its parent control, based on anchor_bottom. Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node. float offset_left = 0.0 void set_offset ( Side side, float offset ) float get_offset ( Side offset ) const Distance between the node's left edge and its parent control, based on anchor_left. Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node. float offset_right = 0.0 void set_offset ( Side side, float offset ) float get_offset ( Side offset ) const Distance between the node's right edge and its parent control, based on anchor_right. Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node. float offset_top = 0.0 void set_offset ( Side side, float offset ) float get_offset ( Side offset ) const Distance between the node's top edge and its parent control, based on anchor_top. Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node. Vector2 pivot_offset = Vector2(0, 0) void set_pivot_offset ( Vector2 value ) Vector2 get_pivot_offset ( ) By default, the node's pivot is its top-left corner. When you change its rotation or scale, it will rotate or scale around this pivot. Set this property to size / 2 to pivot around the Control's center. Vector2 position = Vector2(0, 0) Vector2 get_position ( ) The node's position, relative to its containing node. It corresponds to the rectangle's top-left corner. The property is not affected by pivot_offset. float rotation = 0.0 void set_rotation ( float value ) float get_rotation ( ) The node's rotation around its pivot, in radians. See pivot_offset to change the pivot's position. Note: This property is edited in the inspector in degrees. If you want to use degrees in a script, use rotation_degrees. float rotation_degrees void set_rotation_degrees ( float value ) float get_rotation_degrees ( ) Helper property to access rotation in degrees instead of radians. Vector2 scale = Vector2(1, 1) void set_scale ( Vector2 value ) Vector2 get_scale ( ) The node's scale, relative to its size. Change this property to scale the node around its pivot_offset. The Control's tooltip_text will also scale according to this value. Note: This property is mainly intended to be used for animation purposes. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the documentation instead of scaling Controls individually. Note: FontFile.oversampling does not take Control scale into account. This means that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by enabling ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field (applies to the default project font only), or enabling Multichannel Signed Distance Field in the import options of a DynamicFont for custom fonts. On system fonts, SystemFont.multichannel_signed_distance_field can be enabled in the inspector. Note: If the Control node is a child of a Container node, the scale will be reset to Vector2(1, 1) when the scene is instantiated. To set the Control's scale when it's instantiated, wait for one frame using await get_tree().process_frame then set its scale property. Node shortcut_context void set_shortcut_context ( Node value ) Node get_shortcut_context ( ) The Node which must be a parent of the focused Control for the shortcut to be activated. If null, the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused. Vector2 size = Vector2(0, 0) Vector2 get_size ( ) The size of the node's bounding rectangle, in the node's coordinate system. Container nodes update this property automatically. BitField size_flags_horizontal = 1 void set_h_size_flags ( BitField value ) BitField get_h_size_flags ( ) Tells the parent Container nodes how they should resize and place the node on the X axis. Use a combination of the SizeFlags constants to change the flags. See the constants to learn what each does. float size_flags_stretch_ratio = 1.0 void set_stretch_ratio ( float value ) float get_stretch_ratio ( ) If the node and at least one of its neighbors uses the SIZE_EXPAND size flag, the parent Container will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbor a ratio of 1, this node will take two thirds of the available space. BitField size_flags_vertical = 1 void set_v_size_flags ( BitField value ) BitField get_v_size_flags ( ) Tells the parent Container nodes how they should resize and place the node on the Y axis. Use a combination of the SizeFlags constants to change the flags. See the constants to learn what each does. Theme theme void set_theme ( Theme value ) Theme get_theme ( ) The Theme resource this node and all its Control and Window children use. If a child node has its own Theme resource set, theme items are merged with child's definitions having higher priority. Note: Window styles will have no effect unless the window is embedded. StringName theme_type_variation = &"" void set_theme_type_variation ( StringName value ) StringName get_theme_type_variation ( ) The name of a theme type variation used by this Control to look up its own theme items. When empty, the class name of the node is used (e.g. Button for the Button control), as well as the class names of all parent classes (in order of inheritance). When set, this property gives the highest priority to the type of the specified name. This type can in turn extend another type, forming a dependency chain. See Theme.set_type_variation. If the theme item cannot be found using this type or its base types, lookup falls back on the class names. Note: To look up Control's own items use various get_theme_* methods without specifying theme_type. Note: Theme items are looked for in the tree order, from branch to root, where each Control node is checked for its theme property. The earliest match against any type/class name is returned. The project-level Theme and the default Theme are checked last. String tooltip_text = "" void set_tooltip_text ( String value ) String get_tooltip_text ( ) The default tooltip text. The tooltip appears when the user's mouse cursor stays idle over this control for a few moments, provided that the mouse_filter property is not MOUSE_FILTER_IGNORE. The time required for the tooltip to appear can be changed with the ProjectSettings.gui/timers/tooltip_delay_sec option. See also get_tooltip. The tooltip popup will use either a default implementation, or a custom one that you can provide by overriding _make_custom_tooltip. The default tooltip includes a PopupPanel and Label whose theme properties can be customized using Theme methods with the "TooltipPanel" and "TooltipLabel" respectively. For example: GDScriptvar style_box = StyleBoxFlat.new() style_box.set_bg_color(Color(1, 1, 0)) style_box.set_border_width_all(2) # We assume here that the `theme` property has been assigned a custom Theme beforehand. theme.set_stylebox("panel", "TooltipPanel", style_box) theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1)) C#var styleBox = new StyleBoxFlat(); styleBox.SetBgColor(new Color(1, 1, 0)); styleBox.SetBorderWidthAll(2); // We assume here that the `Theme` property has been assigned a custom Theme beforehand. Theme.SetStyleBox("panel", "TooltipPanel", styleBox); Theme.SetColor("font_color", "TooltipLabel", new Color(0, 1, 1)); Method Descriptions bool _can_drop_data ( Vector2 at_position, Variant data ) virtual const Godot calls this method to test if data from a control's _get_drag_data can be dropped at at_position. at_position is local to this control. This method should only be used to test the data. Process the data in _drop_data. GDScriptfunc _can_drop_data(position, data): # Check position if it is relevant to you # Otherwise, just check data return typeof(data) == TYPE_DICTIONARY and data.has("expected") C#public override bool _CanDropData(Vector2 atPosition, Variant data) { // Check position if it is relevant to you // Otherwise, just check data return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("expected"); } void _drop_data ( Vector2 at_position, Variant data ) virtual Godot calls this method to pass you the data from a control's _get_drag_data result. Godot first calls _can_drop_data to test if data is allowed to drop at at_position where at_position is local to this control. GDScriptfunc _can_drop_data(position, data): return typeof(data) == TYPE_DICTIONARY and data.has("color") func _drop_data(position, data): var color = data["color"] C#public override bool _CanDropData(Vector2 atPosition, Variant data) { return data.VariantType == Variant.Type.Dictionary && dict.AsGodotDictionary().ContainsKey("color"); } public override void _DropData(Vector2 atPosition, Variant data) { Color color = data.AsGodotDictionary()["color"].AsColor(); } Variant _get_drag_data ( Vector2 at_position ) virtual Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns null if there is no data to drag. Controls that want to receive drop data should implement _can_drop_data and _drop_data. at_position is local to this control. Drag may be forced with force_drag. A preview that will follow the mouse that should represent the data can be set with set_drag_preview. A good time to set the preview is in this method. GDScriptfunc _get_drag_data(position): var mydata = make_data() # This is your custom method generating the drag data. set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data. return mydata C#public override Variant _GetDragData(Vector2 atPosition) { var myData = MakeData(); // This is your custom method generating the drag data. SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data. return myData; } Vector2 _get_minimum_size ( ) virtual const Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to custom_minimum_size for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately). If not overridden, defaults to Vector2.ZERO. Note: This method will not be called when the script is attached to a Control node that already overrides its minimum size (e.g. Label, Button, PanelContainer etc.). It can only be used with most basic GUI nodes, like Control, Container, Panel etc. String _get_tooltip ( Vector2 at_position ) virtual const Virtual method to be implemented by the user. Returns the tooltip text for the position at_position in control's local coordinates, which will typically appear when the cursor is resting over this control. See get_tooltip. Note: If this method returns an empty String, no tooltip is displayed. void _gui_input ( InputEvent event ) virtual Virtual method to be implemented by the user. Use this method to process and accept inputs on UI elements. See accept_event. Example usage for clicking a control: GDScriptfunc _gui_input(event): if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_LEFT and event.pressed: print("I've been clicked D:") C#public override void _GuiInput(InputEvent @event) { if (@event is InputEventMouseButton mb) { if (mb.ButtonIndex == MouseButton.Left && mb.Pressed) { GD.Print("I've been clicked D:"); } } } The event won't trigger if: * clicking outside the control (see _has_point); * control has mouse_filter set to MOUSE_FILTER_IGNORE; * control is obstructed by another Control on top of it, which doesn't have mouse_filter set to MOUSE_FILTER_IGNORE; * control's parent has mouse_filter set to MOUSE_FILTER_STOP or has accepted the event; * it happens outside the parent's rectangle and the parent has either clip_contents enabled. Note: Event position is relative to the control origin. bool _has_point ( Vector2 point ) virtual const Virtual method to be implemented by the user. Returns whether the given point is inside this control. If not overridden, default behavior is checking if the point is within control's Rect. Note: If you want to check if a point is inside the control, you can use Rect2(Vector2.ZERO, size).has_point(point). Object _make_custom_tooltip ( String for_text ) virtual const Virtual method to be implemented by the user. Returns a Control node that should be used as a tooltip instead of the default one. The for_text includes the contents of the tooltip_text property. The returned node must be of type Control or Control-derived. It can have child nodes of any type. It is freed when the tooltip disappears, so make sure you always provide a new instance (if you want to use a pre-existing node from your scene tree, you can duplicate it and pass the duplicated instance). When null or a non-Control node is returned, the default tooltip will be used instead. The returned node will be added as child to a PopupPanel, so you should only provide the contents of that panel. That PopupPanel can be themed using Theme.set_stylebox for the type "TooltipPanel" (see tooltip_text for an example). Note: The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its custom_minimum_size to some non-zero value. Note: The node (and any relevant children) should be CanvasItem.visible when returned, otherwise, the viewport that instantiates it will not be able to calculate its minimum size reliably. Example of usage with a custom-constructed node: GDScriptfunc _make_custom_tooltip(for_text): var label = Label.new() label.text = for_text return label C#public override Control _MakeCustomTooltip(string forText) { var label = new Label(); label.Text = forText; return label; } Example of usage with a custom scene instance: GDScriptfunc _make_custom_tooltip(for_text): var tooltip = preload("res://some_tooltip_scene.tscn").instantiate() tooltip.get_node("Label").text = for_text return tooltip C#public override Control _MakeCustomTooltip(string forText) { Node tooltip = ResourceLoader.Load("res://some_tooltip_scene.tscn").Instantiate(); tooltip.GetNode