class-description NEWS COMMUNITY STORE LABS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE LABS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectNode CanvasItem
Abstract base class for everything in 2D space.

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.

draw draw<>():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 hidden<>():hidden

Emitted when becoming hidden.

item_rect_changed item_rect_changed<>():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 visibility_changed<>():visibility_changed

Emitted when the visibility (hidden/visible) changes.

Enum TextureFilter<>():Enum

TEXTURE_FILTER_PARENT_NODE = 0

The CanvasItem will inherit the filter from its parent.


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).


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).


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.


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.


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.


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.


TEXTURE_FILTER_MAX = 7

Represents the size of the TextureFilter enum.

Enum TextureRepeat<>():Enum

TEXTURE_REPEAT_PARENT_NODE = 0

The CanvasItem will inherit the filter from its parent.


TEXTURE_REPEAT_DISABLED = 1

Texture will not repeat.


TEXTURE_REPEAT_ENABLED = 2

Texture will repeat normally.


TEXTURE_REPEAT_MIRROR = 3

Texture will repeat in a 2x2 tiled mode, where elements at even positions are mirrored.


TEXTURE_REPEAT_MAX = 4

Represents the size of the TextureRepeat enum.

Enum ClipChildrenMode<>():Enum

CLIP_CHILDREN_DISABLED = 0

Child draws over parent and is not clipped.


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.


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.


CLIP_CHILDREN_MAX = 3

Represents the size of the ClipChildrenMode enum.

ClipChildrenMode clip_children<>():ClipChildrenMode

Allows the current node to clip children nodes, essentially acting as a mask.

int light_mask<>():int

The rendering layers in which this CanvasItem responds to Light2D nodes.

Material material<>():Material

The material applied to this CanvasItem.

Color modulate<>():Color

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

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<>():bool

If true, the object draws behind its parent.

TextureFilter texture_filter<>():TextureFilter

The texture filtering mode to use on this CanvasItem.

TextureRepeat texture_repeat<>():TextureRepeat

The texture repeating mode to use on this CanvasItem.

bool top_level<>():bool

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<>():bool

If true, the parent CanvasItem's material property is used as this one's material.

int visibility_layer<>():int

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<>():bool

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<>():bool

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<>():bool

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<>():int

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.

void _draw<>():void

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=, animation_length:float=, float slice_begin=, slice_begin:float=, float slice_end=, slice_end:float=, float offset=0.0, offset:float=0.0, ):void

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=, center:Vector2=, float radius=, radius:float=, float start_angle=, start_angle:float=, float end_angle=, end_angle:float=, int point_count=, point_count:int=, Color color=, color:Color=, float=, float:=, bool antialiased=false, antialiased:bool=false, ):void

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=, font:Font=, Vector2 pos=, pos:Vector2=, String char=, char:String=, int font_size=16, font_size:int=16, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, ):void

Draws a string first character using a custom font.

void draw_char_outline<>( Font font=, font:Font=, Vector2 pos=, pos:Vector2=, String char=, char:String=, int font_size=16, font_size:int=16, int=, int:=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, ):void

Draws a string first character outline using a custom font.

void draw_circle<>( Vector2 position=, position:Vector2=, float radius=, radius:float=, Color color=, color:Color=, ):void

Draws a colored, filled circle. See also draw_arc, draw_polyline and draw_polygon.

void draw_colored_polygon<>( PackedVector2Array points=, points:PackedVector2Array=, Color color=, color:Color=, PackedVector2Array=, PackedVector2Array:=, Texture2D texture=null, texture:Texture2D=null, ):void

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=, from:Vector2=, Vector2 to=, to:Vector2=, Color color=, color:Color=, float=, float:=, float dash=2.0, dash:float=2.0, bool aligned=true, aligned:bool=true, ):void

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<>():void

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=, texture:Texture2D=, Rect2 rect=, rect:Rect2=, Rect2 src_rect=, src_rect:Rect2=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, ):void

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=, from:Vector2=, Vector2 to=, to:Vector2=, Color color=, color:Color=, float=, float:=, bool antialiased=false, antialiased:bool=false, ):void

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=, mesh:Mesh=, Texture2D texture=, texture:Texture2D=, Transform2D=, Transform2D:=, 0=, 0:=, 0=, 0:=, 1=, 1:=, 0=, 0:=, 0 )=, ):0=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, ):void

Draws a Mesh in 2D, using the provided texture. See MeshInstance2D for related documentation.

void draw_msdf_texture_rect_region<>( Texture2D texture=, texture:Texture2D=, Rect2 rect=, rect:Rect2=, Rect2 src_rect=, src_rect:Rect2=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, float outline=0.0, outline:float=0.0, float pixel_range=4.0, pixel_range:float=4.0, float scale=1.0, scale:float=1.0, ):void

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=, points:PackedVector2Array=, Color color=, color:Color=, float=, float:=, ):void

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=, points:PackedVector2Array=, PackedColorArray colors=, colors:PackedColorArray=, float=, float:=, ):void

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=, font:Font=, Vector2 pos=, pos:Vector2=, String text=, text:String=, HorizontalAlignment alignment=0, alignment:HorizontalAlignment=0, float=, float:=, int font_size=16, font_size:int=16, int=, int:=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, BitField=, BitField:=, BitField=, BitField:=, Direction direction=0, direction:Direction=0, Orientation orientation=0, orientation:Orientation=0, ):void

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=, font:Font=, Vector2 pos=, pos:Vector2=, String text=, text:String=, HorizontalAlignment alignment=0, alignment:HorizontalAlignment=0, float=, float:=, int font_size=16, font_size:int=16, int=, int:=, int size=1, size:int=1, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, BitField=, BitField:=, BitField=, BitField:=, Direction direction=0, direction:Direction=0, Orientation orientation=0, orientation:Orientation=0, ):void

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=, multimesh:MultiMesh=, Texture2D texture=, texture:Texture2D=, ):void

Draws a MultiMesh in 2D with the provided texture. See MultiMeshInstance2D for related documentation.

void draw_polygon<>( PackedVector2Array points=, points:PackedVector2Array=, PackedColorArray colors=, colors:PackedColorArray=, PackedVector2Array=, PackedVector2Array:=, Texture2D texture=null, texture:Texture2D=null, ):void

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=, points:PackedVector2Array=, Color color=, color:Color=, float=, float:=, bool antialiased=false, antialiased:bool=false, ):void

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=, points:PackedVector2Array=, PackedColorArray colors=, colors:PackedColorArray=, float=, float:=, bool antialiased=false, antialiased:bool=false, ):void

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=, points:PackedVector2Array=, PackedColorArray colors=, colors:PackedColorArray=, PackedVector2Array uvs=, uvs:PackedVector2Array=, Texture2D texture=null, texture:Texture2D=null, ):void

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=, rect:Rect2=, Color color=, color:Color=, bool filled=true, filled:bool=true, float=, float:=, ):void

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=, position:Vector2=, float rotation=0.0, rotation:float=0.0, Vector2=, Vector2:=, 1 )=, ):1=, ):void

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=, xform:Transform2D=, ):void

Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this.

void draw_string<>( Font font=, font:Font=, Vector2 pos=, pos:Vector2=, String text=, text:String=, HorizontalAlignment alignment=0, alignment:HorizontalAlignment=0, float=, float:=, int font_size=16, font_size:int=16, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, BitField=, BitField:=, Direction direction=0, direction:Direction=0, Orientation orientation=0, orientation:Orientation=0, ):void

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:

# 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)

See also Font.draw_string.

void draw_string_outline<>( Font font=, font:Font=, Vector2 pos=, pos:Vector2=, String text=, text:String=, HorizontalAlignment alignment=0, alignment:HorizontalAlignment=0, float=, float:=, int font_size=16, font_size:int=16, int size=1, size:int=1, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, BitField=, BitField:=, Direction direction=0, direction:Direction=0, Orientation orientation=0, orientation:Orientation=0, ):void

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=, style_box:StyleBox=, Rect2 rect=, rect:Rect2=, ):void

Draws a styled rectangle.

void draw_texture<>( Texture2D texture=, texture:Texture2D=, Vector2 position=, position:Vector2=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, ):void

Draws a texture at a given position.

void draw_texture_rect<>( Texture2D texture=, texture:Texture2D=, Rect2 rect=, rect:Rect2=, bool tile=, tile:bool=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, bool transpose=false, transpose:bool=false, ):void

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=, texture:Texture2D=, Rect2 rect=, rect:Rect2=, Rect2 src_rect=, src_rect:Rect2=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, bool transpose=false, transpose:bool=false, bool clip_uv=true, clip_uv:bool=true, ):void

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<>():void

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<>():RID

Returns the RID of the World2D canvas where this item is in.

RID get_canvas_item<>():RID

Returns the canvas item RID used by RenderingServer for this item.

Transform2D get_canvas_transform<>():Transform2D

Returns the transform from the coordinate system of the canvas, this item is in, to the Viewports coordinate system.

Vector2 get_global_mouse_position<>():Vector2

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<>():Transform2D

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<>():Transform2D

Returns the transform from the local coordinate system of this CanvasItem to the Viewports coordinate system.

Vector2 get_local_mouse_position<>():Vector2

Returns the mouse's position in this CanvasItem using the local coordinate system of this CanvasItem.

Transform2D get_screen_transform<>():Transform2D

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<>():Transform2D

Returns the transform matrix of this item.

Rect2 get_viewport_rect<>():Rect2

Returns the viewport's boundaries as a Rect2.

Transform2D get_viewport_transform<>():Transform2D

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=, layer:int=, ):bool

Returns an individual bit on the rendering visibility layer.

World2D get_world_2d<>():World2D

Returns the World2D where this item is in.

void hide<>():void

Hide the CanvasItem if it's currently visible. This is equivalent to setting visible to false.

bool is_local_transform_notification_enabled<>():bool

Returns true if local transform notifications are communicated to children.

bool is_transform_notification_enabled<>():bool

Returns true if global transform notifications are communicated to children.

bool is_visible_in_tree<>():bool

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=, screen_point:Vector2=, ):Vector2

Assigns screen_point as this node's new local transform.

InputEvent make_input_local<>( InputEvent event=, event:InputEvent=, ):InputEvent

Transformations issued by event's inputs are applied in local space instead of global space.

void move_to_front<>():void

Moves this node to display on top of its siblings.

Internally, the node is moved to the bottom of parent's children list. The method has no effect on nodes without a parent.

void queue_redraw<>():void

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=, enable:bool=, ):void

If enable is true, this node will receive NOTIFICATION_LOCAL_TRANSFORM_CHANGED when its local transform changes.

void set_notify_transform<>( bool enable=, enable:bool=, ):void

If enable is true, this node will receive NOTIFICATION_TRANSFORM_CHANGED when its global transform changes.

void set_visibility_layer_bit<>( int layer=, layer:int=, bool enabled=, enabled:bool=, ):void

Set/clear individual bits on the rendering visibility layer. This simplifies editing this CanvasItem's visibility layer.

void show<>():void

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.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...