class_canvasitemmaterial.rst 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the CanvasItemMaterial.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_CanvasItemMaterial:
  6. CanvasItemMaterial
  7. ==================
  8. **Inherits:** :ref:`Material<class_Material>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. A material for :ref:`CanvasItem<class_CanvasItem>`\ s.
  10. Description
  11. -----------
  12. ``CanvasItemMaterial``\ s provide a means of modifying the textures associated with a CanvasItem. They specialize in describing blend and lighting behaviors for textures. Use a :ref:`ShaderMaterial<class_ShaderMaterial>` to more fully customize a material's interactions with a :ref:`CanvasItem<class_CanvasItem>`.
  13. Properties
  14. ----------
  15. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  16. | :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` | :ref:`blend_mode<class_CanvasItemMaterial_property_blend_mode>` | ``0`` |
  17. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  18. | :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` | :ref:`light_mode<class_CanvasItemMaterial_property_light_mode>` | ``0`` |
  19. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  20. | :ref:`int<class_int>` | :ref:`particles_anim_h_frames<class_CanvasItemMaterial_property_particles_anim_h_frames>` | |
  21. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  22. | :ref:`bool<class_bool>` | :ref:`particles_anim_loop<class_CanvasItemMaterial_property_particles_anim_loop>` | |
  23. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  24. | :ref:`int<class_int>` | :ref:`particles_anim_v_frames<class_CanvasItemMaterial_property_particles_anim_v_frames>` | |
  25. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  26. | :ref:`bool<class_bool>` | :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` | ``false`` |
  27. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  28. Enumerations
  29. ------------
  30. .. _enum_CanvasItemMaterial_BlendMode:
  31. .. _class_CanvasItemMaterial_constant_BLEND_MODE_MIX:
  32. .. _class_CanvasItemMaterial_constant_BLEND_MODE_ADD:
  33. .. _class_CanvasItemMaterial_constant_BLEND_MODE_SUB:
  34. .. _class_CanvasItemMaterial_constant_BLEND_MODE_MUL:
  35. .. _class_CanvasItemMaterial_constant_BLEND_MODE_PREMULT_ALPHA:
  36. enum **BlendMode**:
  37. - **BLEND_MODE_MIX** = **0** --- Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value.
  38. - **BLEND_MODE_ADD** = **1** --- Additive blending mode.
  39. - **BLEND_MODE_SUB** = **2** --- Subtractive blending mode.
  40. - **BLEND_MODE_MUL** = **3** --- Multiplicative blending mode.
  41. - **BLEND_MODE_PREMULT_ALPHA** = **4** --- Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
  42. ----
  43. .. _enum_CanvasItemMaterial_LightMode:
  44. .. _class_CanvasItemMaterial_constant_LIGHT_MODE_NORMAL:
  45. .. _class_CanvasItemMaterial_constant_LIGHT_MODE_UNSHADED:
  46. .. _class_CanvasItemMaterial_constant_LIGHT_MODE_LIGHT_ONLY:
  47. enum **LightMode**:
  48. - **LIGHT_MODE_NORMAL** = **0** --- Render the material using both light and non-light sensitive material properties.
  49. - **LIGHT_MODE_UNSHADED** = **1** --- Render the material as if there were no light.
  50. - **LIGHT_MODE_LIGHT_ONLY** = **2** --- Render the material as if there were only light.
  51. Property Descriptions
  52. ---------------------
  53. .. _class_CanvasItemMaterial_property_blend_mode:
  54. - :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **blend_mode**
  55. +-----------+-----------------------+
  56. | *Default* | ``0`` |
  57. +-----------+-----------------------+
  58. | *Setter* | set_blend_mode(value) |
  59. +-----------+-----------------------+
  60. | *Getter* | get_blend_mode() |
  61. +-----------+-----------------------+
  62. The manner in which a material's rendering is applied to underlying textures.
  63. ----
  64. .. _class_CanvasItemMaterial_property_light_mode:
  65. - :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **light_mode**
  66. +-----------+-----------------------+
  67. | *Default* | ``0`` |
  68. +-----------+-----------------------+
  69. | *Setter* | set_light_mode(value) |
  70. +-----------+-----------------------+
  71. | *Getter* | get_light_mode() |
  72. +-----------+-----------------------+
  73. The manner in which material reacts to lighting.
  74. ----
  75. .. _class_CanvasItemMaterial_property_particles_anim_h_frames:
  76. - :ref:`int<class_int>` **particles_anim_h_frames**
  77. +----------+------------------------------------+
  78. | *Setter* | set_particles_anim_h_frames(value) |
  79. +----------+------------------------------------+
  80. | *Getter* | get_particles_anim_h_frames() |
  81. +----------+------------------------------------+
  82. The number of columns in the spritesheet assigned as :ref:`Texture<class_Texture>` for a :ref:`Particles2D<class_Particles2D>` or :ref:`CPUParticles2D<class_CPUParticles2D>`.
  83. **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
  84. ----
  85. .. _class_CanvasItemMaterial_property_particles_anim_loop:
  86. - :ref:`bool<class_bool>` **particles_anim_loop**
  87. +----------+--------------------------------+
  88. | *Setter* | set_particles_anim_loop(value) |
  89. +----------+--------------------------------+
  90. | *Getter* | get_particles_anim_loop() |
  91. +----------+--------------------------------+
  92. If ``true``, the particles animation will loop.
  93. **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
  94. ----
  95. .. _class_CanvasItemMaterial_property_particles_anim_v_frames:
  96. - :ref:`int<class_int>` **particles_anim_v_frames**
  97. +----------+------------------------------------+
  98. | *Setter* | set_particles_anim_v_frames(value) |
  99. +----------+------------------------------------+
  100. | *Getter* | get_particles_anim_v_frames() |
  101. +----------+------------------------------------+
  102. The number of rows in the spritesheet assigned as :ref:`Texture<class_Texture>` for a :ref:`Particles2D<class_Particles2D>` or :ref:`CPUParticles2D<class_CPUParticles2D>`.
  103. **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
  104. ----
  105. .. _class_CanvasItemMaterial_property_particles_animation:
  106. - :ref:`bool<class_bool>` **particles_animation**
  107. +-----------+--------------------------------+
  108. | *Default* | ``false`` |
  109. +-----------+--------------------------------+
  110. | *Setter* | set_particles_animation(value) |
  111. +-----------+--------------------------------+
  112. | *Getter* | get_particles_animation() |
  113. +-----------+--------------------------------+
  114. If ``true``, enable spritesheet-based animation features when assigned to :ref:`Particles2D<class_Particles2D>` and :ref:`CPUParticles2D<class_CPUParticles2D>` nodes. The :ref:`ParticlesMaterial.anim_speed<class_ParticlesMaterial_property_anim_speed>` or :ref:`CPUParticles2D.anim_speed<class_CPUParticles2D_property_anim_speed>` should also be set to a positive value for the animation to play.
  115. This property (and other ``particles_anim_*`` properties that depend on it) has no effect on other types of nodes.
  116. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  117. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  118. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`