TextureRect.xml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TextureRect" inherits="Control" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Control for drawing textures.
  5. </brief_description>
  6. <description>
  7. Used to draw icons and sprites in a user interface. The texture's placement can be controlled with the [member stretch_mode] property. It can scale, tile, or stay centered inside its bounding rectangle.
  8. [b]Note:[/b] You should enable [member flip_v] when using a TextureRect to display a [ViewportTexture]. Alternatively, you can enable [member Viewport.render_target_v_flip] on the Viewport. Otherwise, the image will appear upside down.
  9. </description>
  10. <tutorials>
  11. <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/676</link>
  12. </tutorials>
  13. <methods>
  14. </methods>
  15. <members>
  16. <member name="expand" type="bool" setter="set_expand" getter="has_expand" default="false">
  17. If [code]true[/code], the texture scales to fit its bounding rectangle.
  18. </member>
  19. <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h" default="false">
  20. If [code]true[/code], texture is flipped horizontally.
  21. </member>
  22. <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v" default="false">
  23. If [code]true[/code], texture is flipped vertically.
  24. </member>
  25. <member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" overrides="Control" enum="Control.MouseFilter" default="1" />
  26. <member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureRect.StretchMode" default="0">
  27. Controls the texture's behavior when resizing the node's bounding rectangle. See [enum StretchMode].
  28. </member>
  29. <member name="texture" type="Texture" setter="set_texture" getter="get_texture">
  30. The node's [Texture] resource.
  31. </member>
  32. </members>
  33. <constants>
  34. <constant name="STRETCH_SCALE_ON_EXPAND" value="0" enum="StretchMode">
  35. Scale to fit the node's bounding rectangle, only if [code]expand[/code] is [code]true[/code]. Default [code]stretch_mode[/code], for backwards compatibility. Until you set [code]expand[/code] to [code]true[/code], the texture will behave like [constant STRETCH_KEEP].
  36. </constant>
  37. <constant name="STRETCH_SCALE" value="1" enum="StretchMode">
  38. Scale to fit the node's bounding rectangle.
  39. </constant>
  40. <constant name="STRETCH_TILE" value="2" enum="StretchMode">
  41. Tile inside the node's bounding rectangle.
  42. </constant>
  43. <constant name="STRETCH_KEEP" value="3" enum="StretchMode">
  44. The texture keeps its original size and stays in the bounding rectangle's top-left corner.
  45. </constant>
  46. <constant name="STRETCH_KEEP_CENTERED" value="4" enum="StretchMode">
  47. The texture keeps its original size and stays centered in the node's bounding rectangle.
  48. </constant>
  49. <constant name="STRETCH_KEEP_ASPECT" value="5" enum="StretchMode">
  50. Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
  51. </constant>
  52. <constant name="STRETCH_KEEP_ASPECT_CENTERED" value="6" enum="StretchMode">
  53. Scale the texture to fit the node's bounding rectangle, center it and maintain its aspect ratio.
  54. </constant>
  55. <constant name="STRETCH_KEEP_ASPECT_COVERED" value="7" enum="StretchMode">
  56. Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
  57. </constant>
  58. </constants>
  59. </class>