summaryrefslogtreecommitdiff
path: root/doc/classes/CanvasItem.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/CanvasItem.xml')
-rw-r--r--doc/classes/CanvasItem.xml553
1 files changed, 204 insertions, 349 deletions
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index d36a997330..4641bc52a4 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -9,7 +9,7 @@
Canvas items are drawn in tree order. 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 also be hidden, which will also hide its children. It provides many ways to change parameters such as modulation (for itself and its children) and self modulation (only for itself), as well as its blend mode.
Ultimately, a transform notification can be requested, which will notify the node that its global position changed in case the parent tree changed.
- [b]Note:[/b] Unless otherwise specified, all methods that have angle parameters must have angles specified as [i]radians[/i]. To convert degrees to radians, use [method @GDScript.deg2rad].
+ [b]Note:[/b] Unless otherwise specified, all methods that have angle parameters must have angles specified as [i]radians[/i]. To convert degrees to radians, use [method @GlobalScope.deg2rad].
</description>
<tutorials>
<link title="Viewport and canvas transforms">https://docs.godotengine.org/en/latest/tutorials/2d/2d_transforms.html</link>
@@ -18,306 +18,233 @@
</tutorials>
<methods>
<method name="_draw" qualifiers="virtual">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Overridable function called by the engine (if defined) to draw the canvas item.
</description>
</method>
+ <method name="draw_animation_slice">
+ <return type="void" />
+ <argument index="0" name="animation_length" type="float" />
+ <argument index="1" name="slice_begin" type="float" />
+ <argument index="2" name="slice_end" type="float" />
+ <argument index="3" name="offset" type="float" default="0.0" />
+ <description>
+ 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.
+ </description>
+ </method>
<method name="draw_arc">
- <return type="void">
- </return>
- <argument index="0" name="center" type="Vector2">
- </argument>
- <argument index="1" name="radius" type="float">
- </argument>
- <argument index="2" name="start_angle" type="float">
- </argument>
- <argument index="3" name="end_angle" type="float">
- </argument>
- <argument index="4" name="point_count" type="int">
- </argument>
- <argument index="5" name="color" type="Color">
- </argument>
- <argument index="6" name="width" type="float" default="1.0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="center" type="Vector2" />
+ <argument index="1" name="radius" type="float" />
+ <argument index="2" name="start_angle" type="float" />
+ <argument index="3" name="end_angle" type="float" />
+ <argument index="4" name="point_count" type="int" />
+ <argument index="5" name="color" type="Color" />
+ <argument index="6" name="width" type="float" default="1.0" />
+ <argument index="7" name="antialiased" type="bool" default="false" />
<description>
Draws an arc between the given angles. The larger the value of [code]point_count[/code], the smoother the curve.
</description>
</method>
- <method name="draw_char">
- <return type="float">
- </return>
- <argument index="0" name="font" type="Font">
- </argument>
- <argument index="1" name="position" type="Vector2">
- </argument>
- <argument index="2" name="char" type="String">
- </argument>
- <argument index="3" name="next" type="String">
- </argument>
- <argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
+ <method name="draw_char" qualifiers="const">
+ <return type="float" />
+ <argument index="0" name="font" type="Font" />
+ <argument index="1" name="pos" type="Vector2" />
+ <argument index="2" name="char" type="String" />
+ <argument index="3" name="next" type="String" default="&quot;&quot;" />
+ <argument index="4" name="size" type="int" default="-1" />
+ <argument index="5" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <argument index="6" name="outline_size" type="int" default="0" />
+ <argument index="7" name="outline_modulate" type="Color" default="Color(1, 1, 1, 0)" />
<description>
Draws a string character using a custom font. Returns the advance, depending on the character width and kerning with an optional next character.
</description>
</method>
<method name="draw_circle">
- <return type="void">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="radius" type="float">
- </argument>
- <argument index="2" name="color" type="Color">
- </argument>
+ <return type="void" />
+ <argument index="0" name="position" type="Vector2" />
+ <argument index="1" name="radius" type="float" />
+ <argument index="2" name="color" type="Color" />
<description>
Draws a colored circle.
</description>
</method>
<method name="draw_colored_polygon">
- <return type="void">
- </return>
- <argument index="0" name="points" type="PackedVector2Array">
- </argument>
- <argument index="1" name="color" type="Color">
- </argument>
- <argument index="2" name="uvs" type="PackedVector2Array" default="PackedVector2Array( )">
- </argument>
- <argument index="3" name="texture" type="Texture2D" default="null">
- </argument>
- <argument index="4" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="5" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="6" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="7" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="8" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="points" type="PackedVector2Array" />
+ <argument index="1" name="color" type="Color" />
+ <argument index="2" name="uvs" type="PackedVector2Array" default="PackedVector2Array()" />
+ <argument index="3" name="texture" type="Texture2D" default="null" />
<description>
Draws a colored polygon of any amount of points, convex or concave.
</description>
</method>
+ <method name="draw_end_animation">
+ <return type="void" />
+ <description>
+ After submitting all animations slices via [method 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.
+ </description>
+ </method>
<method name="draw_line">
- <return type="void">
- </return>
- <argument index="0" name="from" type="Vector2">
- </argument>
- <argument index="1" name="to" type="Vector2">
- </argument>
- <argument index="2" name="color" type="Color">
- </argument>
- <argument index="3" name="width" type="float" default="1.0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="from" type="Vector2" />
+ <argument index="1" name="to" type="Vector2" />
+ <argument index="2" name="color" type="Color" />
+ <argument index="3" name="width" type="float" default="1.0" />
<description>
Draws a line from a 2D point to another, with a given color and width.
</description>
</method>
<method name="draw_mesh">
- <return type="void">
- </return>
- <argument index="0" name="mesh" type="Mesh">
- </argument>
- <argument index="1" name="texture" type="Texture2D">
- </argument>
- <argument index="2" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="3" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="4" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="5" name="transform" type="Transform2D" default="Transform2D( 1, 0, 0, 1, 0, 0 )">
- </argument>
- <argument index="6" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="7" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="8" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="mesh" type="Mesh" />
+ <argument index="1" name="texture" type="Texture2D" />
+ <argument index="2" name="transform" type="Transform2D" default="Transform2D(1, 0, 0, 1, 0, 0)" />
+ <argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
<description>
Draws a [Mesh] in 2D, using the provided texture. See [MeshInstance2D] for related documentation.
</description>
</method>
+ <method name="draw_msdf_texture_rect_region">
+ <return type="void" />
+ <argument index="0" name="texture" type="Texture2D" />
+ <argument index="1" name="rect" type="Rect2" />
+ <argument index="2" name="src_rect" type="Rect2" />
+ <argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <argument index="4" name="outline" type="float" default="0.0" />
+ <argument index="5" name="pixel_range" type="float" default="4.0" />
+ <description>
+ Draws a textured rectangle region of the multi-channel signed distance field texture at a given position, optionally modulated by a color.
+ If [code]outline[/code] is positive, each alpha channel value of pixel in region is set to maximum value of true distance in the [code]outline[/code] radius.
+ Value of the [code]pixel_range[/code] should the same that was used during distance field texture generation.
+ </description>
+ </method>
<method name="draw_multiline">
- <return type="void">
- </return>
- <argument index="0" name="points" type="PackedVector2Array">
- </argument>
- <argument index="1" name="color" type="Color">
- </argument>
- <argument index="2" name="width" type="float" default="1.0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="points" type="PackedVector2Array" />
+ <argument index="1" name="color" type="Color" />
+ <argument index="2" name="width" type="float" default="1.0" />
<description>
Draws multiple, parallel lines with a uniform [code]color[/code].
</description>
</method>
<method name="draw_multiline_colors">
- <return type="void">
- </return>
- <argument index="0" name="points" type="PackedVector2Array">
- </argument>
- <argument index="1" name="colors" type="PackedColorArray">
- </argument>
- <argument index="2" name="width" type="float" default="1.0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="points" type="PackedVector2Array" />
+ <argument index="1" name="colors" type="PackedColorArray" />
+ <argument index="2" name="width" type="float" default="1.0" />
<description>
Draws multiple, parallel lines with a uniform [code]width[/code] and segment-by-segment coloring. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code].
</description>
</method>
+ <method name="draw_multiline_string" qualifiers="const">
+ <return type="void" />
+ <argument index="0" name="font" type="Font" />
+ <argument index="1" name="pos" type="Vector2" />
+ <argument index="2" name="text" type="String" />
+ <argument index="3" name="align" type="int" enum="HAlign" default="0" />
+ <argument index="4" name="width" type="float" default="-1" />
+ <argument index="5" name="max_lines" type="int" default="-1" />
+ <argument index="6" name="size" type="int" default="-1" />
+ <argument index="7" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <argument index="8" name="outline_size" type="int" default="0" />
+ <argument index="9" name="outline_modulate" type="Color" default="Color(1, 1, 1, 0)" />
+ <argument index="10" name="flags" type="int" default="51" />
+ <description>
+ Breaks [code]text[/code] to the lines and draws it using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
+ </description>
+ </method>
<method name="draw_multimesh">
- <return type="void">
- </return>
- <argument index="0" name="multimesh" type="MultiMesh">
- </argument>
- <argument index="1" name="texture" type="Texture2D">
- </argument>
- <argument index="2" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="3" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="4" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="5" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="6" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="multimesh" type="MultiMesh" />
+ <argument index="1" name="texture" type="Texture2D" />
<description>
Draws a [MultiMesh] in 2D with the provided texture. See [MultiMeshInstance2D] for related documentation.
</description>
</method>
<method name="draw_polygon">
- <return type="void">
- </return>
- <argument index="0" name="points" type="PackedVector2Array">
- </argument>
- <argument index="1" name="colors" type="PackedColorArray">
- </argument>
- <argument index="2" name="uvs" type="PackedVector2Array" default="PackedVector2Array( )">
- </argument>
- <argument index="3" name="texture" type="Texture2D" default="null">
- </argument>
- <argument index="4" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="5" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="6" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="7" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="8" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="points" type="PackedVector2Array" />
+ <argument index="1" name="colors" type="PackedColorArray" />
+ <argument index="2" name="uvs" type="PackedVector2Array" default="PackedVector2Array()" />
+ <argument index="3" name="texture" type="Texture2D" default="null" />
<description>
Draws a polygon of any amount of points, convex or concave.
</description>
</method>
<method name="draw_polyline">
- <return type="void">
- </return>
- <argument index="0" name="points" type="PackedVector2Array">
- </argument>
- <argument index="1" name="color" type="Color">
- </argument>
- <argument index="2" name="width" type="float" default="1.0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="points" type="PackedVector2Array" />
+ <argument index="1" name="color" type="Color" />
+ <argument index="2" name="width" type="float" default="1.0" />
+ <argument index="3" name="antialiased" type="bool" default="false" />
<description>
Draws interconnected line segments with a uniform [code]color[/code] and [code]width[/code].
</description>
</method>
<method name="draw_polyline_colors">
- <return type="void">
- </return>
- <argument index="0" name="points" type="PackedVector2Array">
- </argument>
- <argument index="1" name="colors" type="PackedColorArray">
- </argument>
- <argument index="2" name="width" type="float" default="1.0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="points" type="PackedVector2Array" />
+ <argument index="1" name="colors" type="PackedColorArray" />
+ <argument index="2" name="width" type="float" default="1.0" />
+ <argument index="3" name="antialiased" type="bool" default="false" />
<description>
Draws interconnected line segments with a uniform [code]width[/code] and segment-by-segment coloring. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code].
</description>
</method>
<method name="draw_primitive">
- <return type="void">
- </return>
- <argument index="0" name="points" type="PackedVector2Array">
- </argument>
- <argument index="1" name="colors" type="PackedColorArray">
- </argument>
- <argument index="2" name="uvs" type="PackedVector2Array">
- </argument>
- <argument index="3" name="texture" type="Texture2D" default="null">
- </argument>
- <argument index="4" name="width" type="float" default="1.0">
- </argument>
- <argument index="5" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="6" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="7" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="8" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="9" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="points" type="PackedVector2Array" />
+ <argument index="1" name="colors" type="PackedColorArray" />
+ <argument index="2" name="uvs" type="PackedVector2Array" />
+ <argument index="3" name="texture" type="Texture2D" default="null" />
+ <argument index="4" name="width" type="float" default="1.0" />
<description>
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.
</description>
</method>
<method name="draw_rect">
- <return type="void">
- </return>
- <argument index="0" name="rect" type="Rect2">
- </argument>
- <argument index="1" name="color" type="Color">
- </argument>
- <argument index="2" name="filled" type="bool" default="true">
- </argument>
- <argument index="3" name="width" type="float" default="1.0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="rect" type="Rect2" />
+ <argument index="1" name="color" type="Color" />
+ <argument index="2" name="filled" type="bool" default="true" />
+ <argument index="3" name="width" type="float" default="1.0" />
<description>
Draws a rectangle. If [code]filled[/code] is [code]true[/code], the rectangle will be filled with the [code]color[/code] specified. If [code]filled[/code] is [code]false[/code], the rectangle will be drawn as a stroke with the [code]color[/code] and [code]width[/code] specified.
[b]Note:[/b] [code]width[/code] is only effective if [code]filled[/code] is [code]false[/code].
</description>
</method>
<method name="draw_set_transform">
- <return type="void">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <argument index="1" name="rotation" type="float" default="0.0">
- </argument>
- <argument index="2" name="scale" type="Vector2" default="Vector2( 1, 1 )">
- </argument>
+ <return type="void" />
+ <argument index="0" name="position" type="Vector2" />
+ <argument index="1" name="rotation" type="float" default="0.0" />
+ <argument index="2" name="scale" type="Vector2" default="Vector2(1, 1)" />
<description>
Sets a custom transform for drawing via components. Anything drawn afterwards will be transformed by this.
</description>
</method>
<method name="draw_set_transform_matrix">
- <return type="void">
- </return>
- <argument index="0" name="xform" type="Transform2D">
- </argument>
+ <return type="void" />
+ <argument index="0" name="xform" type="Transform2D" />
<description>
Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this.
</description>
</method>
- <method name="draw_string">
- <return type="void">
- </return>
- <argument index="0" name="font" type="Font">
- </argument>
- <argument index="1" name="position" type="Vector2">
- </argument>
- <argument index="2" name="text" type="String">
- </argument>
- <argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="4" name="clip_w" type="int" default="-1">
- </argument>
- <description>
- Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
+ <method name="draw_string" qualifiers="const">
+ <return type="void" />
+ <argument index="0" name="font" type="Font" />
+ <argument index="1" name="pos" type="Vector2" />
+ <argument index="2" name="text" type="String" />
+ <argument index="3" name="align" type="int" enum="HAlign" default="0" />
+ <argument index="4" name="width" type="float" default="-1" />
+ <argument index="5" name="size" type="int" default="-1" />
+ <argument index="6" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <argument index="7" name="outline_size" type="int" default="0" />
+ <argument index="8" name="outline_modulate" type="Color" default="Color(1, 1, 1, 0)" />
+ <argument index="9" name="flags" type="int" default="3" />
+ <description>
+ Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (bottom-left corner using the baseline of the font). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
[b]Example using the default project font:[/b]
[codeblocks]
[gdscript]
@@ -325,291 +252,216 @@
# `default_font` declaration to a member variable assigned in `_ready()`
# so the Control is only created once.
var default_font = Control.new().get_font("font")
- draw_string(default_font, Vector2(64, 64), "Hello world")
+ var default_font_size = Control.new().get_font_size("font_size")
+ draw_string(default_font, Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, font_size)
[/gdscript]
[csharp]
// 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 = new Control().GetFont("font");
- DrawString(defaultFont, new Vector2(64, 64), "Hello world");
+ int defaultFontSize = new Control().GetFontSize("font_size");
+ DrawString(defaultFont, new Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, defaultFontSize);
[/csharp]
[/codeblocks]
- See also [method Font.draw].
+ See also [method Font.draw_string].
</description>
</method>
<method name="draw_style_box">
- <return type="void">
- </return>
- <argument index="0" name="style_box" type="StyleBox">
- </argument>
- <argument index="1" name="rect" type="Rect2">
- </argument>
+ <return type="void" />
+ <argument index="0" name="style_box" type="StyleBox" />
+ <argument index="1" name="rect" type="Rect2" />
<description>
Draws a styled rectangle.
</description>
</method>
<method name="draw_texture">
- <return type="void">
- </return>
- <argument index="0" name="texture" type="Texture2D">
- </argument>
- <argument index="1" name="position" type="Vector2">
- </argument>
- <argument index="2" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="3" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="4" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="5" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="6" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="7" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="texture" type="Texture2D" />
+ <argument index="1" name="position" type="Vector2" />
+ <argument index="2" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
<description>
Draws a texture at a given position.
</description>
</method>
<method name="draw_texture_rect">
- <return type="void">
- </return>
- <argument index="0" name="texture" type="Texture2D">
- </argument>
- <argument index="1" name="rect" type="Rect2">
- </argument>
- <argument index="2" name="tile" type="bool">
- </argument>
- <argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="4" name="transpose" type="bool" default="false">
- </argument>
- <argument index="5" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="6" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="7" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="8" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="9" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="texture" type="Texture2D" />
+ <argument index="1" name="rect" type="Rect2" />
+ <argument index="2" name="tile" type="bool" />
+ <argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <argument index="4" name="transpose" type="bool" default="false" />
<description>
Draws a textured rectangle at a given position, optionally modulated by a color. If [code]transpose[/code] is [code]true[/code], the texture will have its X and Y coordinates swapped.
</description>
</method>
<method name="draw_texture_rect_region">
- <return type="void">
- </return>
- <argument index="0" name="texture" type="Texture2D">
- </argument>
- <argument index="1" name="rect" type="Rect2">
- </argument>
- <argument index="2" name="src_rect" type="Rect2">
- </argument>
- <argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="4" name="transpose" type="bool" default="false">
- </argument>
- <argument index="5" name="normal_map" type="Texture2D" default="null">
- </argument>
- <argument index="6" name="specular_map" type="Texture2D" default="null">
- </argument>
- <argument index="7" name="specular_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
- </argument>
- <argument index="8" name="clip_uv" type="bool" default="true">
- </argument>
- <argument index="9" name="texture_filter" type="int" enum="CanvasItem.TextureFilter" default="0">
- </argument>
- <argument index="10" name="texture_repeat" type="int" enum="CanvasItem.TextureRepeat" default="0">
- </argument>
+ <return type="void" />
+ <argument index="0" name="texture" type="Texture2D" />
+ <argument index="1" name="rect" type="Rect2" />
+ <argument index="2" name="src_rect" type="Rect2" />
+ <argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <argument index="4" name="transpose" type="bool" default="false" />
+ <argument index="5" name="clip_uv" type="bool" default="true" />
<description>
Draws a textured rectangle region at a given position, optionally modulated by a color. If [code]transpose[/code] is [code]true[/code], the texture will have its X and Y coordinates swapped.
</description>
</method>
<method name="force_update_transform">
- <return type="void">
- </return>
+ <return type="void" />
<description>
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.
</description>
</method>
<method name="get_canvas" qualifiers="const">
- <return type="RID">
- </return>
+ <return type="RID" />
<description>
Returns the [RID] of the [World2D] canvas where this item is in.
</description>
</method>
<method name="get_canvas_item" qualifiers="const">
- <return type="RID">
- </return>
+ <return type="RID" />
<description>
Returns the canvas item RID used by [RenderingServer] for this item.
</description>
</method>
<method name="get_canvas_transform" qualifiers="const">
- <return type="Transform2D">
- </return>
+ <return type="Transform2D" />
<description>
Returns the transform matrix of this item's canvas.
</description>
</method>
<method name="get_global_mouse_position" qualifiers="const">
- <return type="Vector2">
- </return>
+ <return type="Vector2" />
<description>
Returns the global position of the mouse.
</description>
</method>
<method name="get_global_transform" qualifiers="const">
- <return type="Transform2D">
- </return>
+ <return type="Transform2D" />
<description>
Returns the global transform matrix of this item.
</description>
</method>
<method name="get_global_transform_with_canvas" qualifiers="const">
- <return type="Transform2D">
- </return>
+ <return type="Transform2D" />
<description>
Returns the global transform matrix of this item in relation to the canvas.
</description>
</method>
<method name="get_local_mouse_position" qualifiers="const">
- <return type="Vector2">
- </return>
+ <return type="Vector2" />
<description>
Returns the mouse position relative to this item's position.
</description>
</method>
<method name="get_transform" qualifiers="const">
- <return type="Transform2D">
- </return>
+ <return type="Transform2D" />
<description>
Returns the transform matrix of this item.
</description>
</method>
<method name="get_viewport_rect" qualifiers="const">
- <return type="Rect2">
- </return>
+ <return type="Rect2" />
<description>
Returns the viewport's boundaries as a [Rect2].
</description>
</method>
<method name="get_viewport_transform" qualifiers="const">
- <return type="Transform2D">
- </return>
+ <return type="Transform2D" />
<description>
Returns this item's transform in relation to the viewport.
</description>
</method>
<method name="get_world_2d" qualifiers="const">
- <return type="World2D">
- </return>
+ <return type="World2D" />
<description>
Returns the [World2D] where this item is in.
</description>
</method>
<method name="hide">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Hide the [CanvasItem] if it's currently visible.
</description>
</method>
<method name="is_local_transform_notification_enabled" qualifiers="const">
- <return type="bool">
- </return>
+ <return type="bool" />
<description>
Returns [code]true[/code] if local transform notifications are communicated to children.
</description>
</method>
<method name="is_transform_notification_enabled" qualifiers="const">
- <return type="bool">
- </return>
+ <return type="bool" />
<description>
Returns [code]true[/code] if global transform notifications are communicated to children.
</description>
</method>
<method name="is_visible_in_tree" qualifiers="const">
- <return type="bool">
- </return>
+ <return type="bool" />
<description>
Returns [code]true[/code] if the node is present in the [SceneTree], its [member visible] property is [code]true[/code] and all its antecedents are also visible. If any antecedent is hidden, this node will not be visible in the scene tree.
</description>
</method>
<method name="make_canvas_position_local" qualifiers="const">
- <return type="Vector2">
- </return>
- <argument index="0" name="screen_point" type="Vector2">
- </argument>
+ <return type="Vector2" />
+ <argument index="0" name="screen_point" type="Vector2" />
<description>
Assigns [code]screen_point[/code] as this node's new local transform.
</description>
</method>
<method name="make_input_local" qualifiers="const">
- <return type="InputEvent">
- </return>
- <argument index="0" name="event" type="InputEvent">
- </argument>
+ <return type="InputEvent" />
+ <argument index="0" name="event" type="InputEvent" />
<description>
Transformations issued by [code]event[/code]'s inputs are applied in local space instead of global space.
</description>
</method>
<method name="set_notify_local_transform">
- <return type="void">
- </return>
- <argument index="0" name="enable" type="bool">
- </argument>
+ <return type="void" />
+ <argument index="0" name="enable" type="bool" />
<description>
If [code]enable[/code] is [code]true[/code], children will be updated with local transform data.
</description>
</method>
<method name="set_notify_transform">
- <return type="void">
- </return>
- <argument index="0" name="enable" type="bool">
- </argument>
+ <return type="void" />
+ <argument index="0" name="enable" type="bool" />
<description>
If [code]enable[/code] is [code]true[/code], children will be updated with global transform data.
</description>
</method>
<method name="show">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Show the [CanvasItem] if it's currently hidden. For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead.
</description>
</method>
<method name="update">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Queue the [CanvasItem] for update. [constant NOTIFICATION_DRAW] will be called on idle time to request redraw.
</description>
</method>
</methods>
<members>
+ <member name="clip_children" type="bool" setter="set_clip_children" getter="is_clipping_children" default="false">
+ </member>
<member name="light_mask" type="int" setter="set_light_mask" getter="get_light_mask" default="1">
The rendering layers in which this [CanvasItem] responds to [Light2D] nodes.
</member>
<member name="material" type="Material" setter="set_material" getter="get_material">
The material applied to textures on this [CanvasItem].
</member>
- <member name="modulate" type="Color" setter="set_modulate" getter="get_modulate" default="Color( 1, 1, 1, 1 )">
+ <member name="modulate" type="Color" setter="set_modulate" getter="get_modulate" default="Color(1, 1, 1, 1)">
The color applied to textures on this [CanvasItem].
</member>
- <member name="self_modulate" type="Color" setter="set_self_modulate" getter="get_self_modulate" default="Color( 1, 1, 1, 1 )">
+ <member name="self_modulate" type="Color" setter="set_self_modulate" getter="get_self_modulate" default="Color(1, 1, 1, 1)">
The color applied to textures on this [CanvasItem]. This is not inherited by children [CanvasItem]s.
</member>
<member name="show_behind_parent" type="bool" setter="set_draw_behind_parent" getter="is_draw_behind_parent_enabled" default="false">
If [code]true[/code], the object draws behind its parent.
</member>
- <member name="top_level" type="bool" setter="set_as_top_level" getter="is_set_as_top_level">
- If [code]true[/code], the node will not inherit its transform from parent [CanvasItem]s.
- </member>
<member name="show_on_top" type="bool" setter="_set_on_top" getter="_is_on_top">
If [code]true[/code], the object draws on top of its parent.
</member>
@@ -619,6 +471,9 @@
<member name="texture_repeat" type="int" setter="set_texture_repeat" getter="get_texture_repeat" enum="CanvasItem.TextureRepeat" default="0">
The texture repeating mode to use on this [CanvasItem].
</member>
+ <member name="top_level" type="bool" setter="set_as_top_level" getter="is_set_as_top_level" default="false">
+ If [code]true[/code], the node will not inherit its transform from parent [CanvasItem]s.
+ </member>
<member name="use_parent_material" type="bool" setter="set_use_parent_material" getter="get_use_parent_material" default="false">
If [code]true[/code], the parent [CanvasItem]'s [member material] property is used as this one's material.
</member>
@@ -633,14 +488,14 @@
Emitted when the [CanvasItem] must redraw. This can only be connected realtime, as deferred will not allow drawing.
</description>
</signal>
- <signal name="hide">
+ <signal name="hidden">
<description>
Emitted when becoming hidden.
</description>
</signal>
<signal name="item_rect_changed">
<description>
- Emitted when the item rect has 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 [member Sprite2D.texture]).
</description>
</signal>
<signal name="visibility_changed">