virtualx-engine-docs/_sources/classes/class_canvasitemmaterial.rst.txt
2024-10-23 09:41:33 -07:00

253 lines
9.7 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/CanvasItemMaterial.xml.
.. _class_CanvasItemMaterial:
CanvasItemMaterial
==================
**Inherits:** :ref:`Material<class_Material>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
A material for :ref:`CanvasItem<class_CanvasItem>`\ s.
.. rst-class:: classref-introduction-group
Description
-----------
**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>`.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
| :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` | :ref:`blend_mode<class_CanvasItemMaterial_property_blend_mode>` | ``0`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
| :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` | :ref:`light_mode<class_CanvasItemMaterial_property_light_mode>` | ``0`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
| :ref:`int<class_int>` | :ref:`particles_anim_h_frames<class_CanvasItemMaterial_property_particles_anim_h_frames>` | |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`particles_anim_loop<class_CanvasItemMaterial_property_particles_anim_loop>` | |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
| :ref:`int<class_int>` | :ref:`particles_anim_v_frames<class_CanvasItemMaterial_property_particles_anim_v_frames>` | |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` | ``false`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+-----------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_CanvasItemMaterial_BlendMode:
.. rst-class:: classref-enumeration
enum **BlendMode**:
.. _class_CanvasItemMaterial_constant_BLEND_MODE_MIX:
.. rst-class:: classref-enumeration-constant
:ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_MIX** = ``0``
Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value.
.. _class_CanvasItemMaterial_constant_BLEND_MODE_ADD:
.. rst-class:: classref-enumeration-constant
:ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_ADD** = ``1``
Additive blending mode.
.. _class_CanvasItemMaterial_constant_BLEND_MODE_SUB:
.. rst-class:: classref-enumeration-constant
:ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_SUB** = ``2``
Subtractive blending mode.
.. _class_CanvasItemMaterial_constant_BLEND_MODE_MUL:
.. rst-class:: classref-enumeration-constant
:ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_MUL** = ``3``
Multiplicative blending mode.
.. _class_CanvasItemMaterial_constant_BLEND_MODE_PREMULT_ALPHA:
.. rst-class:: classref-enumeration-constant
:ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **BLEND_MODE_PREMULT_ALPHA** = ``4``
Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
.. rst-class:: classref-item-separator
----
.. _enum_CanvasItemMaterial_LightMode:
.. rst-class:: classref-enumeration
enum **LightMode**:
.. _class_CanvasItemMaterial_constant_LIGHT_MODE_NORMAL:
.. rst-class:: classref-enumeration-constant
:ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **LIGHT_MODE_NORMAL** = ``0``
Render the material using both light and non-light sensitive material properties.
.. _class_CanvasItemMaterial_constant_LIGHT_MODE_UNSHADED:
.. rst-class:: classref-enumeration-constant
:ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **LIGHT_MODE_UNSHADED** = ``1``
Render the material as if there were no light.
.. _class_CanvasItemMaterial_constant_LIGHT_MODE_LIGHT_ONLY:
.. rst-class:: classref-enumeration-constant
:ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **LIGHT_MODE_LIGHT_ONLY** = ``2``
Render the material as if there were only light.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_CanvasItemMaterial_property_blend_mode:
.. rst-class:: classref-property
:ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **blend_mode** = ``0``
.. rst-class:: classref-property-setget
- void **set_blend_mode** **(** :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` value **)**
- :ref:`BlendMode<enum_CanvasItemMaterial_BlendMode>` **get_blend_mode** **(** **)**
The manner in which a material's rendering is applied to underlying textures.
.. rst-class:: classref-item-separator
----
.. _class_CanvasItemMaterial_property_light_mode:
.. rst-class:: classref-property
:ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **light_mode** = ``0``
.. rst-class:: classref-property-setget
- void **set_light_mode** **(** :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` value **)**
- :ref:`LightMode<enum_CanvasItemMaterial_LightMode>` **get_light_mode** **(** **)**
The manner in which material reacts to lighting.
.. rst-class:: classref-item-separator
----
.. _class_CanvasItemMaterial_property_particles_anim_h_frames:
.. rst-class:: classref-property
:ref:`int<class_int>` **particles_anim_h_frames**
.. rst-class:: classref-property-setget
- void **set_particles_anim_h_frames** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_particles_anim_h_frames** **(** **)**
The number of columns in the spritesheet assigned as :ref:`Texture<class_Texture>` for a :ref:`Particles2D<class_Particles2D>` or :ref:`CPUParticles2D<class_CPUParticles2D>`.
\ **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
.. rst-class:: classref-item-separator
----
.. _class_CanvasItemMaterial_property_particles_anim_loop:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **particles_anim_loop**
.. rst-class:: classref-property-setget
- void **set_particles_anim_loop** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **get_particles_anim_loop** **(** **)**
If ``true``, the particles animation will loop.
\ **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
.. rst-class:: classref-item-separator
----
.. _class_CanvasItemMaterial_property_particles_anim_v_frames:
.. rst-class:: classref-property
:ref:`int<class_int>` **particles_anim_v_frames**
.. rst-class:: classref-property-setget
- void **set_particles_anim_v_frames** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_particles_anim_v_frames** **(** **)**
The number of rows in the spritesheet assigned as :ref:`Texture<class_Texture>` for a :ref:`Particles2D<class_Particles2D>` or :ref:`CPUParticles2D<class_CPUParticles2D>`.
\ **Note:** This property is only used and visible in the editor if :ref:`particles_animation<class_CanvasItemMaterial_property_particles_animation>` is ``true``.
.. rst-class:: classref-item-separator
----
.. _class_CanvasItemMaterial_property_particles_animation:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **particles_animation** = ``false``
.. rst-class:: classref-property-setget
- void **set_particles_animation** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **get_particles_animation** **(** **)**
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.
This property (and other ``particles_anim_*`` properties that depend on it) has no effect on other types of nodes.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`