class_canvasitemmaterial.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CanvasItemMaterial.xml.
  6. .. _class_CanvasItemMaterial:
  7. CanvasItemMaterial
  8. ==================
  9. **Inherits:** :ref:`Material<class_Material>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A material for :ref:`CanvasItem<class_CanvasItem>`\ s.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **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>`.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  21. | :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` | :ref:`blend_mode<class_CanvasItemMaterial_property_blend_mode>` | ``0`` |
  22. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  23. | :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` | :ref:`light_mode<class_CanvasItemMaterial_property_light_mode>` | ``0`` |
  24. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  25. | :ref:`int<class_int>` | :ref:`particles_anim_h_frames<class_CanvasItemMaterial_property_particles_anim_h_frames>` | |
  26. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  27. | :ref:`bool<class_bool>` | :ref:`particles_anim_loop<class_CanvasItemMaterial_property_particles_anim_loop>` | |
  28. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  29. | :ref:`int<class_int>` | :ref:`particles_anim_v_frames<class_CanvasItemMaterial_property_particles_anim_v_frames>` | |
  30. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  31. | :ref:`bool<class_bool>` | :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` | ``false`` |
  32. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
  33. .. rst-class:: classref-section-separator
  34. ----
  35. .. rst-class:: classref-descriptions-group
  36. Enumerations
  37. ------------
  38. .. _enum_CanvasItemMaterial_BlendMode:
  39. .. rst-class:: classref-enumeration
  40. enum **BlendMode**: :ref:`🔗<enum_CanvasItemMaterial_BlendMode>`
  41. .. _class_CanvasItemMaterial_constant_BLEND_MODE_MIX:
  42. .. rst-class:: classref-enumeration-constant
  43. :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_MIX** = ``0``
  44. Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value.
  45. .. _class_CanvasItemMaterial_constant_BLEND_MODE_ADD:
  46. .. rst-class:: classref-enumeration-constant
  47. :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_ADD** = ``1``
  48. Additive blending mode.
  49. .. _class_CanvasItemMaterial_constant_BLEND_MODE_SUB:
  50. .. rst-class:: classref-enumeration-constant
  51. :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_SUB** = ``2``
  52. Subtractive blending mode.
  53. .. _class_CanvasItemMaterial_constant_BLEND_MODE_MUL:
  54. .. rst-class:: classref-enumeration-constant
  55. :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_MUL** = ``3``
  56. Multiplicative blending mode.
  57. .. _class_CanvasItemMaterial_constant_BLEND_MODE_PREMULT_ALPHA:
  58. .. rst-class:: classref-enumeration-constant
  59. :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_PREMULT_ALPHA** = ``4``
  60. Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _enum_CanvasItemMaterial_LightMode:
  64. .. rst-class:: classref-enumeration
  65. enum **LightMode**: :ref:`🔗<enum_CanvasItemMaterial_LightMode>`
  66. .. _class_CanvasItemMaterial_constant_LIGHT_MODE_NORMAL:
  67. .. rst-class:: classref-enumeration-constant
  68. :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **LIGHT_MODE_NORMAL** = ``0``
  69. Render the material using both light and non-light sensitive material properties.
  70. .. _class_CanvasItemMaterial_constant_LIGHT_MODE_UNSHADED:
  71. .. rst-class:: classref-enumeration-constant
  72. :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **LIGHT_MODE_UNSHADED** = ``1``
  73. Render the material as if there were no light.
  74. .. _class_CanvasItemMaterial_constant_LIGHT_MODE_LIGHT_ONLY:
  75. .. rst-class:: classref-enumeration-constant
  76. :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **LIGHT_MODE_LIGHT_ONLY** = ``2``
  77. Render the material as if there were only light.
  78. .. rst-class:: classref-section-separator
  79. ----
  80. .. rst-class:: classref-descriptions-group
  81. Property Descriptions
  82. ---------------------
  83. .. _class_CanvasItemMaterial_property_blend_mode:
  84. .. rst-class:: classref-property
  85. :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **blend_mode** = ``0`` :ref:`🔗<class_CanvasItemMaterial_property_blend_mode>`
  86. .. rst-class:: classref-property-setget
  87. - |void| **set_blend_mode**\ (\ value\: :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>`\ )
  88. - :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **get_blend_mode**\ (\ )
  89. The manner in which a material's rendering is applied to underlying textures.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_CanvasItemMaterial_property_light_mode:
  93. .. rst-class:: classref-property
  94. :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **light_mode** = ``0`` :ref:`🔗<class_CanvasItemMaterial_property_light_mode>`
  95. .. rst-class:: classref-property-setget
  96. - |void| **set_light_mode**\ (\ value\: :ref:`LightMode<enum_CanvasItemMaterial_LightMode>`\ )
  97. - :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **get_light_mode**\ (\ )
  98. The manner in which material reacts to lighting.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_CanvasItemMaterial_property_particles_anim_h_frames:
  102. .. rst-class:: classref-property
  103. :ref:`int<class_int>` **particles_anim_h_frames** :ref:`🔗<class_CanvasItemMaterial_property_particles_anim_h_frames>`
  104. .. rst-class:: classref-property-setget
  105. - |void| **set_particles_anim_h_frames**\ (\ value\: :ref:`int<class_int>`\ )
  106. - :ref:`int<class_int>` **get_particles_anim_h_frames**\ (\ )
  107. The number of columns in the spritesheet assigned as :ref:`Texture2D<class_Texture2D>` for a :ref:`GPUParticles2D<class_GPUParticles2D>` or :ref:`CPUParticles2D<class_CPUParticles2D>`.
  108. \ **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
  109. .. rst-class:: classref-item-separator
  110. ----
  111. .. _class_CanvasItemMaterial_property_particles_anim_loop:
  112. .. rst-class:: classref-property
  113. :ref:`bool<class_bool>` **particles_anim_loop** :ref:`🔗<class_CanvasItemMaterial_property_particles_anim_loop>`
  114. .. rst-class:: classref-property-setget
  115. - |void| **set_particles_anim_loop**\ (\ value\: :ref:`bool<class_bool>`\ )
  116. - :ref:`bool<class_bool>` **get_particles_anim_loop**\ (\ )
  117. If ``true``, the particles animation will loop.
  118. \ **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_CanvasItemMaterial_property_particles_anim_v_frames:
  122. .. rst-class:: classref-property
  123. :ref:`int<class_int>` **particles_anim_v_frames** :ref:`🔗<class_CanvasItemMaterial_property_particles_anim_v_frames>`
  124. .. rst-class:: classref-property-setget
  125. - |void| **set_particles_anim_v_frames**\ (\ value\: :ref:`int<class_int>`\ )
  126. - :ref:`int<class_int>` **get_particles_anim_v_frames**\ (\ )
  127. The number of rows in the spritesheet assigned as :ref:`Texture2D<class_Texture2D>` for a :ref:`GPUParticles2D<class_GPUParticles2D>` or :ref:`CPUParticles2D<class_CPUParticles2D>`.
  128. \ **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_CanvasItemMaterial_property_particles_animation:
  132. .. rst-class:: classref-property
  133. :ref:`bool<class_bool>` **particles_animation** = ``false`` :ref:`🔗<class_CanvasItemMaterial_property_particles_animation>`
  134. .. rst-class:: classref-property-setget
  135. - |void| **set_particles_animation**\ (\ value\: :ref:`bool<class_bool>`\ )
  136. - :ref:`bool<class_bool>` **get_particles_animation**\ (\ )
  137. If ``true``, enable spritesheet-based animation features when assigned to :ref:`GPUParticles2D<class_GPUParticles2D>` and :ref:`CPUParticles2D<class_CPUParticles2D>` nodes. The :ref:`ParticleProcessMaterial.anim_speed_max<class_ParticleProcessMaterial_property_anim_speed_max>` or :ref:`CPUParticles2D.anim_speed_max<class_CPUParticles2D_property_anim_speed_max>` should also be set to a positive value for the animation to play.
  138. This property (and other ``particles_anim_*`` properties that depend on it) has no effect on other types of nodes.
  139. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  140. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  141. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  142. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  143. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  144. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  145. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  146. .. |void| replace:: :abbr:`void (No return value.)`