CanvasItemMaterial
A material for CanvasItems.
A material for CanvasItems.
CanvasItemMaterials provide a means of modifying the textures associated with a CanvasItem. They specialize in describing blend and lighting behaviors for textures. Use a ShaderMaterial to more fully customize a material's interactions with a CanvasItem.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
CanvasItemMaterialConstructor
public CanvasItemMaterial();Properties6
BlendModeProperty
public CanvasItemMaterial.BlendModeEnum BlendMode { get; set; }The manner in which a material's rendering is applied to underlying textures.
LightModeProperty
public CanvasItemMaterial.LightModeEnum LightMode { get; set; }The manner in which material reacts to lighting.
ParticlesAnimHFramesProperty
public int ParticlesAnimHFrames { get; set; }The number of columns in the spritesheet assigned as Texture2D for a GpuParticles2D or CpuParticles2D.
Note: This property is only used and visible in the editor if CanvasItemMaterial.ParticlesAnimation is true.
ParticlesAnimLoopProperty
public bool ParticlesAnimLoop { get; set; }If true, the particles animation will loop.
Note: This property is only used and visible in the editor if CanvasItemMaterial.ParticlesAnimation is true.
ParticlesAnimVFramesProperty
public int ParticlesAnimVFrames { get; set; }The number of rows in the spritesheet assigned as Texture2D for a GpuParticles2D or CpuParticles2D.
Note: This property is only used and visible in the editor if CanvasItemMaterial.ParticlesAnimation is true.
ParticlesAnimationProperty
public bool ParticlesAnimation { get; set; }If true, enable spritesheet-based animation features when assigned to GpuParticles2D and CpuParticles2D nodes. The ParticleProcessMaterial.AnimSpeedMax or CpuParticles2D.AnimSpeedMax 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.
Methods12
GetBlendModeCanvasItemMaterial.BlendModeEnum
public CanvasItemMaterial.BlendModeEnum GetBlendMode();CanvasItemMaterial.BlendModeEnumGetLightModeCanvasItemMaterial.LightModeEnum
public CanvasItemMaterial.LightModeEnum GetLightMode();CanvasItemMaterial.LightModeEnumGetParticlesAnimHFramesint
public int GetParticlesAnimHFrames();intGetParticlesAnimLoopbool
public bool GetParticlesAnimLoop();boolGetParticlesAnimVFramesint
public int GetParticlesAnimVFrames();intGetParticlesAnimationbool
public bool GetParticlesAnimation();boolSetBlendModevoid
public void SetBlendMode(CanvasItemMaterial.BlendModeEnum blendMode);| Name | Type | Default |
|---|---|---|
blendMode | CanvasItemMaterial.BlendModeEnum | — |
SetLightModevoid
public void SetLightMode(CanvasItemMaterial.LightModeEnum lightMode);| Name | Type | Default |
|---|---|---|
lightMode | CanvasItemMaterial.LightModeEnum | — |
SetParticlesAnimHFramesvoid
public void SetParticlesAnimHFrames(int frames);| Name | Type | Default |
|---|---|---|
frames | int | — |
SetParticlesAnimLoopvoid
public void SetParticlesAnimLoop(bool loop);| Name | Type | Default |
|---|---|---|
loop | bool | — |
SetParticlesAnimVFramesvoid
public void SetParticlesAnimVFrames(int frames);| Name | Type | Default |
|---|---|---|
frames | int | — |
SetParticlesAnimationvoid
public void SetParticlesAnimation(bool particlesAnim);| Name | Type | Default |
|---|---|---|
particlesAnim | bool | — |
CanvasItemMaterial.BlendModeEnum
| Value | Description |
|---|---|
Add = 1 | Additive blending mode. |
Mix = 0 | Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value. |
Mul = 3 | Multiplicative blending mode. |
PremultAlpha = 4 | Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value. |
Sub = 2 | Subtractive blending mode. |
CanvasItemMaterial.LightModeEnum
| Value | Description |
|---|---|
LightOnly = 2 | Render the material as if there were only light. |
Normal = 0 | Render the material using both light and non-light sensitive material properties. |
Unshaded = 1 | Render the material as if there were no light. |