diff options
Diffstat (limited to 'doc/classes/CanvasItem.xml')
-rw-r--r-- | doc/classes/CanvasItem.xml | 74 |
1 files changed, 62 insertions, 12 deletions
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index d8c1af0b3c..5171e0acbe 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -114,7 +114,7 @@ <param index="2" name="src_rect" type="Rect2" /> <param index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" /> <description> - Draws a textured rectangle region of the font texture with LCD sub-pixel anti-aliasing at a given position, optionally modulated by a color. + 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: [codeblock] dst.r = texture.r * modulate.r * modulate.a + dst.r * (1.0 - texture.r * modulate.a); @@ -153,6 +153,7 @@ <param index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" /> <param index="4" name="outline" type="float" default="0.0" /> <param index="5" name="pixel_range" type="float" default="4.0" /> + <param index="6" name="scale" type="float" default="1.0" /> <description> Draws a textured rectangle region of the multi-channel signed distance field texture at a given position, optionally modulated by a color. See [member FontFile.multichannel_signed_distance_field] for more information and caveats about MSDF font rendering. If [param outline] is positive, each alpha channel value of pixel in region is set to maximum value of true distance in the [param outline] radius. @@ -310,16 +311,16 @@ # 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 = Control.new().get_font("font") - var default_font_size = Control.new().get_font_size("font_size") - draw_string(default_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size) + 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) [/gdscript] [csharp] // If using this method in a script that redraws constantly, move the - // `default_font` declaration to a member variable assigned in `_ready()` + // `default_font` declaration to a member variable assigned in `_Ready()` // so the Control is only created once. - Font defaultFont = new Control().GetFont("font"); - int defaultFontSize = new Control().GetFontSize("font_size"); + Font defaultFont = ThemeDB.FallbackFont; + int defaultFontSize = ThemeDB.FallbackFontSize; DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, defaultFontSize); [/csharp] [/codeblocks] @@ -404,7 +405,7 @@ <method name="get_canvas_transform" qualifiers="const"> <return type="Transform2D" /> <description> - Returns the transform matrix of this item's canvas. + Returns the transform from the coordinate system of the canvas, this item is in, to the [Viewport]s coordinate system. </description> </method> <method name="get_global_mouse_position" qualifiers="const"> @@ -416,13 +417,13 @@ <method name="get_global_transform" qualifiers="const"> <return type="Transform2D" /> <description> - Returns the global transform matrix of this item. + 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 [member top_level] enabled. </description> </method> <method name="get_global_transform_with_canvas" qualifiers="const"> <return type="Transform2D" /> <description> - Returns the global transform matrix of this item in relation to the canvas. + Returns the transform from the local coordinate system of this [CanvasItem] to the [Viewport]s coordinate system. </description> </method> <method name="get_local_mouse_position" qualifiers="const"> @@ -453,7 +454,14 @@ <method name="get_viewport_transform" qualifiers="const"> <return type="Transform2D" /> <description> - Returns this item's transform in relation to the viewport. + Returns the transform from the coordinate system of the canvas, this item is in, to the [Viewport]s embedders coordinate system. + </description> + </method> + <method name="get_visibility_layer_bit" qualifiers="const"> + <return type="bool" /> + <param index="0" name="layer" type="int" /> + <description> + Returns an individual bit on the rendering visibility layer. </description> </method> <method name="get_world_2d" qualifiers="const"> @@ -500,6 +508,13 @@ Transformations issued by [param event]'s inputs are applied in local space instead of global space. </description> </method> + <method name="move_to_front"> + <return type="void" /> + <description> + 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. + </description> + </method> <method name="queue_redraw"> <return type="void" /> <description> @@ -520,6 +535,14 @@ If [param enable] is [code]true[/code], this node will receive [constant NOTIFICATION_TRANSFORM_CHANGED] when its global transform changes. </description> </method> + <method name="set_visibility_layer_bit"> + <return type="void" /> + <param index="0" name="layer" type="int" /> + <param index="1" name="enabled" type="bool" /> + <description> + Set/clear individual bits on the rendering visibility layer. This simplifies editing this [CanvasItem]'s visibility layer. + </description> + </method> <method name="show"> <return type="void" /> <description> @@ -528,7 +551,8 @@ </method> </methods> <members> - <member name="clip_children" type="bool" setter="set_clip_children" getter="is_clipping_children" default="false"> + <member name="clip_children" type="int" setter="set_clip_children_mode" getter="get_clip_children_mode" enum="CanvasItem.ClipChildrenMode" default="0"> + Allows the current node to clip children nodes, essentially acting as a mask. </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. @@ -557,10 +581,24 @@ <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> + <member name="visibility_layer" type="int" setter="set_visibility_layer" getter="get_visibility_layer" default="1"> + 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. + </member> <member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true"> If [code]true[/code], this [CanvasItem] is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]). [b]Note:[/b] For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead. </member> + <member name="y_sort_enabled" type="bool" setter="set_y_sort_enabled" getter="is_y_sort_enabled" default="false"> + If [code]true[/code], child nodes with the lowest Y position are drawn before those with a higher Y position. If [code]false[/code], 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. + </member> + <member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative" default="true"> + If [code]true[/code], 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. + </member> + <member name="z_index" type="int" setter="set_z_index" getter="get_z_index" default="0"> + 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 [constant RenderingServer.CANVAS_ITEM_Z_MIN] and [constant RenderingServer.CANVAS_ITEM_Z_MAX] (inclusive). + [b]Note:[/b] 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. + </member> </members> <signals> <signal name="draw"> @@ -645,5 +683,17 @@ <constant name="TEXTURE_REPEAT_MAX" value="4" enum="TextureRepeat"> Represents the size of the [enum TextureRepeat] enum. </constant> + <constant name="CLIP_CHILDREN_DISABLED" value="0" enum="ClipChildrenMode"> + Child draws over parent and is not clipped. + </constant> + <constant name="CLIP_CHILDREN_ONLY" value="1" enum="ClipChildrenMode"> + Parent is used for the purposes of clipping only. Child is clipped to the parent's visible area, parent is not drawn. + </constant> + <constant name="CLIP_CHILDREN_AND_DRAW" value="2" enum="ClipChildrenMode"> + Parent is used for clipping child, but parent is also drawn underneath child as normal before clipping child to its visible area. + </constant> + <constant name="CLIP_CHILDREN_MAX" value="3" enum="ClipChildrenMode"> + Represents the size of the [enum ClipChildrenMode] enum. + </constant> </constants> </class> |