Struct gdnative_bindings::SpatialMaterial
source · [−]pub struct SpatialMaterial { /* private fields */ }Expand description
core class SpatialMaterial inherits Material (reference-counted).
This class has related types in the spatial_material module.
Official documentation
See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.
Memory management
The lifetime of this object is automatically managed through reference counting.
Class hierarchy
SpatialMaterial inherits methods from:
Safety
All types in the Godot API have interior mutability in Rust parlance.
To enforce that the official thread-safety guidelines are
followed, the typestate pattern is used in the Ref and TRef smart pointers,
and the Instance API. The typestate Ownership in these types tracks whether
ownership is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref.
Implementations
sourceimpl SpatialMaterial
impl SpatialMaterial
Constants
pub const BILLBOARD_DISABLED: i64 = 0i64
pub const BLEND_MODE_MIX: i64 = 0i64
pub const CULL_BACK: i64 = 0i64
pub const DEPTH_DRAW_OPAQUE_ONLY: i64 = 0i64
pub const DETAIL_UV_1: i64 = 0i64
pub const DIFFUSE_BURLEY: i64 = 0i64
pub const DISTANCE_FADE_DISABLED: i64 = 0i64
pub const EMISSION_OP_ADD: i64 = 0i64
pub const FEATURE_TRANSPARENT: i64 = 0i64
pub const FLAG_UNSHADED: i64 = 0i64
pub const SPECULAR_SCHLICK_GGX: i64 = 0i64
pub const TEXTURE_ALBEDO: i64 = 0i64
pub const TEXTURE_CHANNEL_RED: i64 = 0i64
pub const BILLBOARD_ENABLED: i64 = 1i64
pub const BLEND_MODE_ADD: i64 = 1i64
pub const CULL_FRONT: i64 = 1i64
pub const DEPTH_DRAW_ALWAYS: i64 = 1i64
pub const DETAIL_UV_2: i64 = 1i64
pub const DIFFUSE_LAMBERT: i64 = 1i64
pub const DISTANCE_FADE_PIXEL_ALPHA: i64 = 1i64
pub const EMISSION_OP_MULTIPLY: i64 = 1i64
pub const FEATURE_EMISSION: i64 = 1i64
pub const FLAG_USE_VERTEX_LIGHTING: i64 = 1i64
pub const SPECULAR_BLINN: i64 = 1i64
pub const TEXTURE_CHANNEL_GREEN: i64 = 1i64
pub const TEXTURE_METALLIC: i64 = 1i64
pub const BILLBOARD_FIXED_Y: i64 = 2i64
pub const BLEND_MODE_SUB: i64 = 2i64
pub const CULL_DISABLED: i64 = 2i64
pub const DEPTH_DRAW_DISABLED: i64 = 2i64
pub const DIFFUSE_LAMBERT_WRAP: i64 = 2i64
pub const DISTANCE_FADE_PIXEL_DITHER: i64 = 2i64
pub const FEATURE_NORMAL_MAPPING: i64 = 2i64
pub const FLAG_DISABLE_DEPTH_TEST: i64 = 2i64
pub const SPECULAR_PHONG: i64 = 2i64
pub const TEXTURE_CHANNEL_BLUE: i64 = 2i64
pub const TEXTURE_ROUGHNESS: i64 = 2i64
pub const BILLBOARD_PARTICLES: i64 = 3i64
pub const BLEND_MODE_MUL: i64 = 3i64
pub const DEPTH_DRAW_ALPHA_OPAQUE_PREPASS: i64 = 3i64
pub const DIFFUSE_OREN_NAYAR: i64 = 3i64
pub const DISTANCE_FADE_OBJECT_DITHER: i64 = 3i64
pub const FEATURE_RIM: i64 = 3i64
pub const FLAG_ALBEDO_FROM_VERTEX_COLOR: i64 = 3i64
pub const SPECULAR_TOON: i64 = 3i64
pub const TEXTURE_CHANNEL_ALPHA: i64 = 3i64
pub const TEXTURE_EMISSION: i64 = 3i64
pub const DIFFUSE_TOON: i64 = 4i64
pub const FEATURE_CLEARCOAT: i64 = 4i64
pub const FLAG_SRGB_VERTEX_COLOR: i64 = 4i64
pub const SPECULAR_DISABLED: i64 = 4i64
pub const TEXTURE_CHANNEL_GRAYSCALE: i64 = 4i64
pub const TEXTURE_NORMAL: i64 = 4i64
pub const FEATURE_ANISOTROPY: i64 = 5i64
pub const FLAG_USE_POINT_SIZE: i64 = 5i64
pub const TEXTURE_RIM: i64 = 5i64
pub const FEATURE_AMBIENT_OCCLUSION: i64 = 6i64
pub const FLAG_FIXED_SIZE: i64 = 6i64
pub const TEXTURE_CLEARCOAT: i64 = 6i64
pub const FEATURE_DEPTH_MAPPING: i64 = 7i64
pub const FLAG_BILLBOARD_KEEP_SCALE: i64 = 7i64
pub const TEXTURE_FLOWMAP: i64 = 7i64
pub const FEATURE_SUBSURACE_SCATTERING: i64 = 8i64
pub const FLAG_UV1_USE_TRIPLANAR: i64 = 8i64
pub const TEXTURE_AMBIENT_OCCLUSION: i64 = 8i64
pub const FEATURE_TRANSMISSION: i64 = 9i64
pub const FLAG_UV2_USE_TRIPLANAR: i64 = 9i64
pub const TEXTURE_DEPTH: i64 = 9i64
pub const FEATURE_REFRACTION: i64 = 10i64
pub const FLAG_TRIPLANAR_USE_WORLD: i64 = 10i64
pub const TEXTURE_SUBSURFACE_SCATTERING: i64 = 10i64
pub const FEATURE_DETAIL: i64 = 11i64
pub const FLAG_AO_ON_UV2: i64 = 11i64
pub const TEXTURE_TRANSMISSION: i64 = 11i64
pub const FEATURE_MAX: i64 = 12i64
pub const FLAG_EMISSION_ON_UV2: i64 = 12i64
pub const TEXTURE_REFRACTION: i64 = 12i64
pub const FLAG_USE_ALPHA_SCISSOR: i64 = 13i64
pub const TEXTURE_DETAIL_MASK: i64 = 13i64
pub const FLAG_ALBEDO_TEXTURE_FORCE_SRGB: i64 = 14i64
pub const TEXTURE_DETAIL_ALBEDO: i64 = 14i64
pub const FLAG_DONT_RECEIVE_SHADOWS: i64 = 15i64
pub const TEXTURE_DETAIL_NORMAL: i64 = 15i64
pub const FLAG_ENSURE_CORRECT_NORMALS: i64 = 16i64
pub const TEXTURE_MAX: i64 = 16i64
pub const FLAG_DISABLE_AMBIENT_LIGHT: i64 = 17i64
pub const FLAG_USE_SHADOW_TO_OPACITY: i64 = 18i64
pub const FLAG_MAX: i64 = 19i64
sourceimpl SpatialMaterial
impl SpatialMaterial
sourcepub fn new() -> Ref<Self, Unique>
pub fn new() -> Ref<Self, Unique>
Creates a new instance of this object.
This is a reference-counted type. The returned object is automatically managed
by Ref.
sourcepub fn alpha_scissor_threshold(&self) -> f64
pub fn alpha_scissor_threshold(&self) -> f64
Threshold at which the alpha scissor will discard values.
sourcepub fn anisotropy(&self) -> f64
pub fn anisotropy(&self) -> f64
The strength of the anisotropy effect.
sourcepub fn ao_light_affect(&self) -> f64
pub fn ao_light_affect(&self) -> f64
Amount that ambient occlusion affects lighting from lights. If 0, ambient occlusion only affects ambient light. If 1, ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
sourcepub fn ao_texture_channel(&self) -> TextureChannel
pub fn ao_texture_channel(&self) -> TextureChannel
Specifies the channel of the [ao_texture][Self::ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn billboard_mode(&self) -> BillboardMode
pub fn billboard_mode(&self) -> BillboardMode
Controls how the object faces the camera. See BillboardMode.
Note: Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See GitHub issue #41567 for details.
sourcepub fn blend_mode(&self) -> BlendMode
pub fn blend_mode(&self) -> BlendMode
The material’s blend mode.
Note: Values other than Mix force the object into the transparent pipeline. See BlendMode.
sourcepub fn clearcoat(&self) -> f64
pub fn clearcoat(&self) -> f64
Sets the strength of the clearcoat effect. Setting to 0 looks the same as disabling the clearcoat effect.
sourcepub fn clearcoat_gloss(&self) -> f64
pub fn clearcoat_gloss(&self) -> f64
Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
sourcepub fn cull_mode(&self) -> CullMode
pub fn cull_mode(&self) -> CullMode
Which side of the object is not drawn when backfaces are rendered. See CullMode.
sourcepub fn depth_deep_parallax_flip_binormal(&self) -> bool
pub fn depth_deep_parallax_flip_binormal(&self) -> bool
If true, direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
sourcepub fn depth_deep_parallax_flip_tangent(&self) -> bool
pub fn depth_deep_parallax_flip_tangent(&self) -> bool
If true, direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
sourcepub fn depth_deep_parallax_max_layers(&self) -> i64
pub fn depth_deep_parallax_max_layers(&self) -> i64
Number of layers to use when using [depth_deep_parallax][Self::depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn depth_deep_parallax_min_layers(&self) -> i64
pub fn depth_deep_parallax_min_layers(&self) -> i64
Number of layers to use when using [depth_deep_parallax][Self::depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn depth_draw_mode(&self) -> DepthDrawMode
pub fn depth_draw_mode(&self) -> DepthDrawMode
Determines when depth rendering takes place. See DepthDrawMode. See also [flags_transparent][Self::flags_transparent].
sourcepub fn depth_scale(&self) -> f64
pub fn depth_scale(&self) -> f64
Scales the depth offset effect. A higher number will create a larger depth.
sourcepub fn detail_blend_mode(&self) -> BlendMode
pub fn detail_blend_mode(&self) -> BlendMode
Specifies how the [detail_albedo][Self::detail_albedo] should blend with the current ALBEDO. See BlendMode for options.
sourcepub fn detail_uv(&self) -> DetailUv
pub fn detail_uv(&self) -> DetailUv
Specifies whether to use UV or UV2 for the detail layer. See [DetailUV][DetailUV] for options.
sourcepub fn diffuse_mode(&self) -> DiffuseMode
pub fn diffuse_mode(&self) -> DiffuseMode
The algorithm used for diffuse light scattering. See DiffuseMode.
sourcepub fn distance_fade(&self) -> DistanceFadeMode
pub fn distance_fade(&self) -> DistanceFadeMode
Specifies which type of fade to use. Can be any of the DistanceFadeModes.
sourcepub fn distance_fade_max_distance(&self) -> f64
pub fn distance_fade_max_distance(&self) -> f64
Distance at which the object appears fully opaque.
Note: If distance_fade_max_distance is less than distance_fade_min_distance, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance and will fully disappear once it reaches distance_fade_min_distance.
sourcepub fn distance_fade_min_distance(&self) -> f64
pub fn distance_fade_min_distance(&self) -> f64
Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
Note: If distance_fade_min_distance is greater than distance_fade_max_distance, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance and will fully disappear once it reaches distance_fade_min_distance.
sourcepub fn emission(&self) -> Color
pub fn emission(&self) -> Color
The emitted light’s color. See [emission_enabled][Self::emission_enabled].
sourcepub fn emission_energy(&self) -> f64
pub fn emission_energy(&self) -> f64
The emitted light’s strength. See [emission_enabled][Self::emission_enabled].
sourcepub fn emission_operator(&self) -> EmissionOperator
pub fn emission_operator(&self) -> EmissionOperator
Sets how emission interacts with [emission_texture][Self::emission_texture]. Can either add or multiply. See EmissionOperator for options.
sourcepub fn line_width(&self) -> f64
pub fn line_width(&self) -> f64
Currently unimplemented in Godot.
sourcepub fn metallic(&self) -> f64
pub fn metallic(&self) -> f64
A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between 0 and 1 should only be used for blending between metal and non-metal sections. To alter the amount of reflection use roughness.
sourcepub fn metallic_texture_channel(&self) -> TextureChannel
pub fn metallic_texture_channel(&self) -> TextureChannel
Specifies the channel of the [metallic_texture][Self::metallic_texture] in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn normal_scale(&self) -> f64
pub fn normal_scale(&self) -> f64
The strength of the normal map’s effect.
sourcepub fn particles_anim_h_frames(&self) -> i64
pub fn particles_anim_h_frames(&self) -> i64
The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].
sourcepub fn particles_anim_loop(&self) -> bool
pub fn particles_anim_loop(&self) -> bool
If true, particle animations are looped. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].
sourcepub fn particles_anim_v_frames(&self) -> i64
pub fn particles_anim_v_frames(&self) -> i64
The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].
sourcepub fn point_size(&self) -> f64
pub fn point_size(&self) -> f64
The point size in pixels. See [flags_use_point_size][Self::flags_use_point_size].
sourcepub fn proximity_fade_distance(&self) -> f64
pub fn proximity_fade_distance(&self) -> f64
Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
sourcepub fn refraction(&self) -> f64
pub fn refraction(&self) -> f64
The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
sourcepub fn refraction_texture_channel(&self) -> TextureChannel
pub fn refraction_texture_channel(&self) -> TextureChannel
Specifies the channel of the [refraction_texture][Self::refraction_texture] in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn rim_tint(&self) -> f64
pub fn rim_tint(&self) -> f64
The amount of to blend light and albedo color when rendering rim effect. If 0 the light color is used, while 1 means albedo color is used. An intermediate value generally works best.
sourcepub fn roughness(&self) -> f64
pub fn roughness(&self) -> f64
Surface reflection. A value of 0 represents a perfect mirror while a value of 1 completely blurs the reflection. See also metallic.
sourcepub fn roughness_texture_channel(&self) -> TextureChannel
pub fn roughness_texture_channel(&self) -> TextureChannel
Specifies the channel of the [ao_texture][Self::ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn specular_mode(&self) -> SpecularMode
pub fn specular_mode(&self) -> SpecularMode
The method for rendering the specular blob. See SpecularMode.
sourcepub fn subsurface_scattering_strength(&self) -> f64
pub fn subsurface_scattering_strength(&self) -> f64
The strength of the subsurface scattering effect.
sourcepub fn texture(&self, param: i64) -> Option<Ref<Texture, Shared>>
pub fn texture(&self, param: i64) -> Option<Ref<Texture, Shared>>
Texture used to control the transmission effect per-pixel. Added to transmission.
sourcepub fn transmission(&self) -> Color
pub fn transmission(&self) -> Color
The color used by the transmission effect. Represents the light passing through an object.
sourcepub fn uv1_offset(&self) -> Vector3
pub fn uv1_offset(&self) -> Vector3
How much to offset the UV coordinates. This amount will be added to UV in the vertex function. This can be used to offset a texture.
sourcepub fn uv1_scale(&self) -> Vector3
pub fn uv1_scale(&self) -> Vector3
How much to scale the UV coordinates. This is multiplied by UV in the vertex function.
sourcepub fn uv1_triplanar_blend_sharpness(&self) -> f64
pub fn uv1_triplanar_blend_sharpness(&self) -> f64
A lower number blends the texture more softly while a higher number blends the texture more sharply.
sourcepub fn uv2_offset(&self) -> Vector3
pub fn uv2_offset(&self) -> Vector3
How much to offset the UV2 coordinates. This amount will be added to UV2 in the vertex function. This can be used to offset a texture.
sourcepub fn uv2_scale(&self) -> Vector3
pub fn uv2_scale(&self) -> Vector3
How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function.
sourcepub fn uv2_triplanar_blend_sharpness(&self) -> f64
pub fn uv2_triplanar_blend_sharpness(&self) -> f64
A lower number blends the texture more softly while a higher number blends the texture more sharply.
sourcepub fn is_depth_deep_parallax_enabled(&self) -> bool
pub fn is_depth_deep_parallax_enabled(&self) -> bool
If true, the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
sourcepub fn is_grow_enabled(&self) -> bool
pub fn is_grow_enabled(&self) -> bool
If true, enables the vertex grow setting. See [params_grow_amount][Self::params_grow_amount].
sourcepub fn is_proximity_fade_enabled(&self) -> bool
pub fn is_proximity_fade_enabled(&self) -> bool
If true, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
sourcepub fn set_albedo(&self, albedo: Color)
pub fn set_albedo(&self, albedo: Color)
The material’s base color.
sourcepub fn set_alpha_scissor_threshold(&self, threshold: f64)
pub fn set_alpha_scissor_threshold(&self, threshold: f64)
Threshold at which the alpha scissor will discard values.
sourcepub fn set_anisotropy(&self, anisotropy: f64)
pub fn set_anisotropy(&self, anisotropy: f64)
The strength of the anisotropy effect.
sourcepub fn set_ao_light_affect(&self, amount: f64)
pub fn set_ao_light_affect(&self, amount: f64)
Amount that ambient occlusion affects lighting from lights. If 0, ambient occlusion only affects ambient light. If 1, ambient occlusion affects lights just as much as it affects ambient light. This can be used to impact the strength of the ambient occlusion effect, but typically looks unrealistic.
sourcepub fn set_ao_texture_channel(&self, channel: i64)
pub fn set_ao_texture_channel(&self, channel: i64)
Specifies the channel of the [ao_texture][Self::ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_billboard_mode(&self, mode: i64)
pub fn set_billboard_mode(&self, mode: i64)
Controls how the object faces the camera. See BillboardMode.
Note: Billboard mode is not suitable for VR because the left-right vector of the camera is not horizontal when the screen is attached to your head instead of on the table. See GitHub issue #41567 for details.
sourcepub fn set_blend_mode(&self, blend_mode: i64)
pub fn set_blend_mode(&self, blend_mode: i64)
The material’s blend mode.
Note: Values other than Mix force the object into the transparent pipeline. See BlendMode.
sourcepub fn set_clearcoat(&self, clearcoat: f64)
pub fn set_clearcoat(&self, clearcoat: f64)
Sets the strength of the clearcoat effect. Setting to 0 looks the same as disabling the clearcoat effect.
sourcepub fn set_clearcoat_gloss(&self, clearcoat_gloss: f64)
pub fn set_clearcoat_gloss(&self, clearcoat_gloss: f64)
Sets the roughness of the clearcoat pass. A higher value results in a smoother clearcoat while a lower value results in a rougher clearcoat.
sourcepub fn set_cull_mode(&self, cull_mode: i64)
pub fn set_cull_mode(&self, cull_mode: i64)
Which side of the object is not drawn when backfaces are rendered. See CullMode.
sourcepub fn set_depth_deep_parallax(&self, enable: bool)
pub fn set_depth_deep_parallax(&self, enable: bool)
If true, the shader will read depth texture at multiple points along the view ray to determine occlusion and parrallax. This can be very performance demanding, but results in more realistic looking depth mapping.
sourcepub fn set_depth_deep_parallax_flip_binormal(&self, flip: bool)
pub fn set_depth_deep_parallax_flip_binormal(&self, flip: bool)
If true, direction of the binormal is flipped before using in the depth effect. This may be necessary if you have encoded your binormals in a way that is conflicting with the depth effect.
sourcepub fn set_depth_deep_parallax_flip_tangent(&self, flip: bool)
pub fn set_depth_deep_parallax_flip_tangent(&self, flip: bool)
If true, direction of the tangent is flipped before using in the depth effect. This may be necessary if you have encoded your tangents in a way that is conflicting with the depth effect.
sourcepub fn set_depth_deep_parallax_max_layers(&self, layer: i64)
pub fn set_depth_deep_parallax_max_layers(&self, layer: i64)
Number of layers to use when using [depth_deep_parallax][Self::depth_deep_parallax] and the view direction is perpendicular to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn set_depth_deep_parallax_min_layers(&self, layer: i64)
pub fn set_depth_deep_parallax_min_layers(&self, layer: i64)
Number of layers to use when using [depth_deep_parallax][Self::depth_deep_parallax] and the view direction is parallel to the surface of the object. A higher number will be more performance demanding while a lower number may not look as crisp.
sourcepub fn set_depth_draw_mode(&self, depth_draw_mode: i64)
pub fn set_depth_draw_mode(&self, depth_draw_mode: i64)
Determines when depth rendering takes place. See DepthDrawMode. See also [flags_transparent][Self::flags_transparent].
sourcepub fn set_depth_scale(&self, depth_scale: f64)
pub fn set_depth_scale(&self, depth_scale: f64)
Scales the depth offset effect. A higher number will create a larger depth.
sourcepub fn set_detail_blend_mode(&self, detail_blend_mode: i64)
pub fn set_detail_blend_mode(&self, detail_blend_mode: i64)
Specifies how the [detail_albedo][Self::detail_albedo] should blend with the current ALBEDO. See BlendMode for options.
sourcepub fn set_detail_uv(&self, detail_uv: i64)
pub fn set_detail_uv(&self, detail_uv: i64)
Specifies whether to use UV or UV2 for the detail layer. See [DetailUV][DetailUV] for options.
sourcepub fn set_diffuse_mode(&self, diffuse_mode: i64)
pub fn set_diffuse_mode(&self, diffuse_mode: i64)
The algorithm used for diffuse light scattering. See DiffuseMode.
sourcepub fn set_distance_fade(&self, mode: i64)
pub fn set_distance_fade(&self, mode: i64)
Specifies which type of fade to use. Can be any of the DistanceFadeModes.
sourcepub fn set_distance_fade_max_distance(&self, distance: f64)
pub fn set_distance_fade_max_distance(&self, distance: f64)
Distance at which the object appears fully opaque.
Note: If distance_fade_max_distance is less than distance_fade_min_distance, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance and will fully disappear once it reaches distance_fade_min_distance.
sourcepub fn set_distance_fade_min_distance(&self, distance: f64)
pub fn set_distance_fade_min_distance(&self, distance: f64)
Distance at which the object starts to become visible. If the object is less than this distance away, it will be invisible.
Note: If distance_fade_min_distance is greater than distance_fade_max_distance, the behavior will be reversed. The object will start to fade away at distance_fade_max_distance and will fully disappear once it reaches distance_fade_min_distance.
sourcepub fn set_emission(&self, emission: Color)
pub fn set_emission(&self, emission: Color)
The emitted light’s color. See [emission_enabled][Self::emission_enabled].
sourcepub fn set_emission_energy(&self, emission_energy: f64)
pub fn set_emission_energy(&self, emission_energy: f64)
The emitted light’s strength. See [emission_enabled][Self::emission_enabled].
sourcepub fn set_emission_operator(&self, operator: i64)
pub fn set_emission_operator(&self, operator: i64)
Sets how emission interacts with [emission_texture][Self::emission_texture]. Can either add or multiply. See EmissionOperator for options.
sourcepub fn set_feature(&self, feature: i64, enable: bool)
pub fn set_feature(&self, feature: i64, enable: bool)
If true, the transmission effect is enabled.
sourcepub fn set_flag(&self, flag: i64, enable: bool)
pub fn set_flag(&self, flag: i64, enable: bool)
If true, the vertex color is used as albedo color.
sourcepub fn set_grow_enabled(&self, enable: bool)
pub fn set_grow_enabled(&self, enable: bool)
If true, enables the vertex grow setting. See [params_grow_amount][Self::params_grow_amount].
sourcepub fn set_line_width(&self, line_width: f64)
pub fn set_line_width(&self, line_width: f64)
Currently unimplemented in Godot.
sourcepub fn set_metallic(&self, metallic: f64)
pub fn set_metallic(&self, metallic: f64)
A high value makes the material appear more like a metal. Non-metals use their albedo as the diffuse color and add diffuse to the specular reflection. With non-metals, the reflection appears on top of the albedo color. Metals use their albedo as a multiplier to the specular reflection and set the diffuse color to black resulting in a tinted reflection. Materials work better when fully metal or fully non-metal, values between 0 and 1 should only be used for blending between metal and non-metal sections. To alter the amount of reflection use roughness.
sourcepub fn set_metallic_texture_channel(&self, channel: i64)
pub fn set_metallic_texture_channel(&self, channel: i64)
Specifies the channel of the [metallic_texture][Self::metallic_texture] in which the metallic information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_normal_scale(&self, normal_scale: f64)
pub fn set_normal_scale(&self, normal_scale: f64)
The strength of the normal map’s effect.
sourcepub fn set_particles_anim_h_frames(&self, frames: i64)
pub fn set_particles_anim_h_frames(&self, frames: i64)
The number of horizontal frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].
sourcepub fn set_particles_anim_loop(&self, loop_: bool)
pub fn set_particles_anim_loop(&self, loop_: bool)
If true, particle animations are looped. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].
sourcepub fn set_particles_anim_v_frames(&self, frames: i64)
pub fn set_particles_anim_v_frames(&self, frames: i64)
The number of vertical frames in the particle sprite sheet. Only enabled when using BILLBOARD_PARTICLES. See [params_billboard_mode][Self::params_billboard_mode].
sourcepub fn set_point_size(&self, point_size: f64)
pub fn set_point_size(&self, point_size: f64)
The point size in pixels. See [flags_use_point_size][Self::flags_use_point_size].
sourcepub fn set_proximity_fade(&self, enabled: bool)
pub fn set_proximity_fade(&self, enabled: bool)
If true, the proximity fade effect is enabled. The proximity fade effect fades out each pixel based on its distance to another object.
sourcepub fn set_proximity_fade_distance(&self, distance: f64)
pub fn set_proximity_fade_distance(&self, distance: f64)
Distance over which the fade effect takes place. The larger the distance the longer it takes for an object to fade.
sourcepub fn set_refraction(&self, refraction: f64)
pub fn set_refraction(&self, refraction: f64)
The strength of the refraction effect. Higher values result in a more distorted appearance for the refraction.
sourcepub fn set_refraction_texture_channel(&self, channel: i64)
pub fn set_refraction_texture_channel(&self, channel: i64)
Specifies the channel of the [refraction_texture][Self::refraction_texture] in which the refraction information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_rim_tint(&self, rim_tint: f64)
pub fn set_rim_tint(&self, rim_tint: f64)
The amount of to blend light and albedo color when rendering rim effect. If 0 the light color is used, while 1 means albedo color is used. An intermediate value generally works best.
sourcepub fn set_roughness(&self, roughness: f64)
pub fn set_roughness(&self, roughness: f64)
Surface reflection. A value of 0 represents a perfect mirror while a value of 1 completely blurs the reflection. See also metallic.
sourcepub fn set_roughness_texture_channel(&self, channel: i64)
pub fn set_roughness_texture_channel(&self, channel: i64)
Specifies the channel of the [ao_texture][Self::ao_texture] in which the ambient occlusion information is stored. This is useful when you store the information for multiple effects in a single texture. For example if you stored metallic in the red channel, roughness in the blue, and ambient occlusion in the green you could reduce the number of textures you use.
sourcepub fn set_specular(&self, specular: f64)
pub fn set_specular(&self, specular: f64)
sourcepub fn set_specular_mode(&self, specular_mode: i64)
pub fn set_specular_mode(&self, specular_mode: i64)
The method for rendering the specular blob. See SpecularMode.
sourcepub fn set_subsurface_scattering_strength(&self, strength: f64)
pub fn set_subsurface_scattering_strength(&self, strength: f64)
The strength of the subsurface scattering effect.
sourcepub fn set_texture(&self, param: i64, texture: impl AsArg<Texture>)
pub fn set_texture(&self, param: i64, texture: impl AsArg<Texture>)
Texture used to control the transmission effect per-pixel. Added to transmission.
sourcepub fn set_transmission(&self, transmission: Color)
pub fn set_transmission(&self, transmission: Color)
The color used by the transmission effect. Represents the light passing through an object.
sourcepub fn set_uv1_offset(&self, offset: Vector3)
pub fn set_uv1_offset(&self, offset: Vector3)
How much to offset the UV coordinates. This amount will be added to UV in the vertex function. This can be used to offset a texture.
sourcepub fn set_uv1_scale(&self, scale: Vector3)
pub fn set_uv1_scale(&self, scale: Vector3)
How much to scale the UV coordinates. This is multiplied by UV in the vertex function.
sourcepub fn set_uv1_triplanar_blend_sharpness(&self, sharpness: f64)
pub fn set_uv1_triplanar_blend_sharpness(&self, sharpness: f64)
A lower number blends the texture more softly while a higher number blends the texture more sharply.
sourcepub fn set_uv2_offset(&self, offset: Vector3)
pub fn set_uv2_offset(&self, offset: Vector3)
How much to offset the UV2 coordinates. This amount will be added to UV2 in the vertex function. This can be used to offset a texture.
sourcepub fn set_uv2_scale(&self, scale: Vector3)
pub fn set_uv2_scale(&self, scale: Vector3)
How much to scale the UV2 coordinates. This is multiplied by UV2 in the vertex function.
sourcepub fn set_uv2_triplanar_blend_sharpness(&self, sharpness: f64)
pub fn set_uv2_triplanar_blend_sharpness(&self, sharpness: f64)
A lower number blends the texture more softly while a higher number blends the texture more sharply.
Methods from Deref<Target = Material>
pub const RENDER_PRIORITY_MIN: i64 = -128i64
pub const RENDER_PRIORITY_MAX: i64 = 127i64
sourcepub fn next_pass(&self) -> Option<Ref<Material, Shared>>
pub fn next_pass(&self) -> Option<Ref<Material, Shared>>
Sets the Material to be used for the next pass. This renders the object again using a different material.
Note: This only applies to SpatialMaterials and ShaderMaterials with type “Spatial”.
sourcepub fn render_priority(&self) -> i64
pub fn render_priority(&self) -> i64
Sets the render priority for transparent objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
sourcepub fn set_next_pass(&self, next_pass: impl AsArg<Material>)
pub fn set_next_pass(&self, next_pass: impl AsArg<Material>)
Sets the Material to be used for the next pass. This renders the object again using a different material.
Note: This only applies to SpatialMaterials and ShaderMaterials with type “Spatial”.
sourcepub fn set_render_priority(&self, priority: i64)
pub fn set_render_priority(&self, priority: i64)
Sets the render priority for transparent objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
Methods from Deref<Target = Resource>
sourcepub fn duplicate(&self, subresources: bool) -> Option<Ref<Resource, Shared>>
pub fn duplicate(&self, subresources: bool) -> Option<Ref<Resource, Shared>>
Duplicates the resource, returning a new resource with the exported members copied. Note: To duplicate the resource the constructor is called without arguments. This method will error when the constructor doesn’t have default values.
By default, sub-resources are shared between resource copies for efficiency. This can be changed by passing true to the subresources argument which will copy the subresources.
Note: If subresources is true, this method will only perform a shallow copy. Nested resources within subresources will not be duplicated and will still be shared.
Note: When duplicating a resource, only exported properties are copied. Other properties will be set to their default value in the new resource.
Default Arguments
subresources-false
sourcepub fn emit_changed(&self)
pub fn emit_changed(&self)
Sample code is GDScript unless otherwise noted.
Emits the changed signal.
If external objects which depend on this resource should be updated, this method must be called manually whenever the state of this resource has changed (such as modification of properties).
The method is equivalent to:
emit_signal("changed")Note: This method is called automatically for built-in resources.
sourcepub fn get_local_scene(&self) -> Option<Ref<Node, Shared>>
pub fn get_local_scene(&self) -> Option<Ref<Node, Shared>>
If [resource_local_to_scene][Self::resource_local_to_scene] is enabled and the resource was loaded from a PackedScene instantiation, returns the local scene where this resource’s unique copy is in use. Otherwise, returns null.
sourcepub fn name(&self) -> GodotString
pub fn name(&self) -> GodotString
The name of the resource. This is an optional identifier. If [resource_name][Self::resource_name] is not empty, its value will be displayed to represent the current resource in the editor inspector. For built-in scripts, the [resource_name][Self::resource_name] will be displayed as the tab name in the script editor.
sourcepub fn path(&self) -> GodotString
pub fn path(&self) -> GodotString
The path to the resource. In case it has its own file, it will return its filepath. If it’s tied to the scene, it will return the scene’s path, followed by the resource’s index.
sourcepub fn is_local_to_scene(&self) -> bool
pub fn is_local_to_scene(&self) -> bool
If true, the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.
sourcepub fn set_local_to_scene(&self, enable: bool)
pub fn set_local_to_scene(&self, enable: bool)
If true, the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.
sourcepub fn set_name(&self, name: impl Into<GodotString>)
pub fn set_name(&self, name: impl Into<GodotString>)
The name of the resource. This is an optional identifier. If [resource_name][Self::resource_name] is not empty, its value will be displayed to represent the current resource in the editor inspector. For built-in scripts, the [resource_name][Self::resource_name] will be displayed as the tab name in the script editor.
sourcepub fn set_path(&self, path: impl Into<GodotString>)
pub fn set_path(&self, path: impl Into<GodotString>)
The path to the resource. In case it has its own file, it will return its filepath. If it’s tied to the scene, it will return the scene’s path, followed by the resource’s index.
sourcepub fn setup_local_to_scene(&self)
pub fn setup_local_to_scene(&self)
This method is called when a resource with [resource_local_to_scene][Self::resource_local_to_scene] enabled is loaded from a PackedScene instantiation. Its behavior can be customized by overriding [_setup_local_to_scene][Self::_setup_local_to_scene] from script.
For most resources, this method performs no base logic. ViewportTexture performs custom logic to properly set the proxy texture and flags in the local viewport.
sourcepub fn take_over_path(&self, path: impl Into<GodotString>)
pub fn take_over_path(&self, path: impl Into<GodotString>)
Sets the path of the resource, potentially overriding an existing cache entry for this path. This differs from setting [resource_path][Self::resource_path], as the latter would error out if another resource was already cached for the given path.
Methods from Deref<Target = Object>
pub const NOTIFICATION_POSTINITIALIZE: i64 = 0i64
pub const CONNECT_DEFERRED: i64 = 1i64
pub const NOTIFICATION_PREDELETE: i64 = 1i64
pub const CONNECT_PERSIST: i64 = 2i64
pub const CONNECT_ONESHOT: i64 = 4i64
pub const CONNECT_REFERENCE_COUNTED: i64 = 8i64
sourcepub fn add_user_signal(
&self,
signal: impl Into<GodotString>,
arguments: VariantArray
)
pub fn add_user_signal(
&self,
signal: impl Into<GodotString>,
arguments: VariantArray
)
Adds a user-defined signal. Arguments are optional, but can be added as an Array of dictionaries, each containing name: String and type: int (see [enum Variant.Type]) entries.
Default Arguments
arguments-[ ]
sourcepub unsafe fn call(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
pub unsafe fn call(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
Sample code is GDScript unless otherwise noted.
Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
call("set", "position", Vector2(42.0, 0.0))Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).
Safety
This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).
sourcepub unsafe fn call_deferred(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
pub unsafe fn call_deferred(
&self,
method: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
Sample code is GDScript unless otherwise noted.
Calls the method on the object during idle time. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
call_deferred("set", "position", Vector2(42.0, 0.0))Note: In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase).
Safety
This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).
sourcepub unsafe fn callv(
&self,
method: impl Into<GodotString>,
arg_array: VariantArray
) -> Variant
pub unsafe fn callv(
&self,
method: impl Into<GodotString>,
arg_array: VariantArray
) -> Variant
Sample code is GDScript unless otherwise noted.
Calls the method on the object and returns the result. Contrarily to call, this method does not support a variable number of arguments but expects all parameters to be via a single Array.
callv("set", [ "position", Vector2(42.0, 0.0) ])Safety
This function bypasses Rust’s static type checks (aliasing, thread boundaries, calls to free(), …).
sourcepub fn can_translate_messages(&self) -> bool
pub fn can_translate_messages(&self) -> bool
Returns true if the object can translate strings. See set_message_translation and tr.
sourcepub fn connect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>,
binds: VariantArray,
flags: i64
) -> GodotResult
pub fn connect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>,
binds: VariantArray,
flags: i64
) -> GodotResult
Sample code is GDScript unless otherwise noted.
Connects a signal to a method on a target object. Pass optional binds to the call as an Array of parameters. These parameters will be passed to the method after any parameter used in the call to emit_signal. Use flags to set deferred or one-shot connections. See ConnectFlags constants.
A signal can only be connected once to a method. It will throw an error if already connected, unless the signal was connected with CONNECT_REFERENCE_COUNTED. To avoid this, first, use is_connected to check for existing connections.
If the target is destroyed in the game’s lifecycle, the connection will be lost.
Examples:
connect("pressed", self, "_on_Button_pressed") # BaseButton signal
connect("text_entered", self, "_on_LineEdit_text_entered") # LineEdit signal
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # User-defined signalAn example of the relationship between binds passed to connect and parameters used when calling emit_signal:
connect("hit", self, "_on_Player_hit", [ weapon_type, damage ]) # weapon_type and damage are passed last
emit_signal("hit", "Dark lord", 5) # "Dark lord" and 5 are passed first
func _on_Player_hit(hit_by, level, weapon_type, damage):
print("Hit by %s (lvl %d) with weapon %s for %d damage" % [hit_by, level, weapon_type, damage])Default Arguments
binds-[ ]flags-0
sourcepub fn disconnect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
)
pub fn disconnect(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
)
Disconnects a signal from a method on the given target.
If you try to disconnect a connection that does not exist, the method will throw an error. Use is_connected to ensure that the connection exists.
sourcepub fn emit_signal(
&self,
signal: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
pub fn emit_signal(
&self,
signal: impl Into<GodotString>,
varargs: &[Variant]
) -> Variant
Sample code is GDScript unless otherwise noted.
Emits the given signal. The signal must exist, so it should be a built-in signal of this class or one of its parent classes, or a user-defined signal. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example:
emit_signal("hit", weapon_type, damage)
emit_signal("game_over")sourcepub fn get(&self, property: impl Into<GodotString>) -> Variant
pub fn get(&self, property: impl Into<GodotString>) -> Variant
Returns the Variant value of the given property. If the property doesn’t exist, this will return null.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
sourcepub fn get_class(&self) -> GodotString
pub fn get_class(&self) -> GodotString
sourcepub fn get_incoming_connections(&self) -> VariantArray
pub fn get_incoming_connections(&self) -> VariantArray
Returns an Array of dictionaries with information about signals that are connected to the object.
Each Dictionary contains three String entries:
sourceis a reference to the signal emitter.signal_nameis the name of the connected signal.method_nameis the name of the method to which the signal is connected.
sourcepub fn get_indexed(&self, property: impl Into<NodePath>) -> Variant
pub fn get_indexed(&self, property: impl Into<NodePath>) -> Variant
Gets the object’s property indexed by the given NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Examples: "position:x" or "material:next_pass:blend_mode".
sourcepub fn get_instance_id(&self) -> i64
pub fn get_instance_id(&self) -> i64
Returns the object’s unique instance ID.
This ID can be saved in EncodedObjectAsID, and can be used to retrieve the object instance with [method @GDScript.instance_from_id].
sourcepub fn get_meta(&self, name: impl Into<GodotString>) -> Variant
pub fn get_meta(&self, name: impl Into<GodotString>) -> Variant
Returns the object’s metadata entry for the given name.
sourcepub fn get_meta_list(&self) -> StringArray
pub fn get_meta_list(&self) -> StringArray
Returns the object’s metadata as a PoolStringArray.
sourcepub fn get_method_list(&self) -> VariantArray
pub fn get_method_list(&self) -> VariantArray
Returns the object’s methods and their signatures as an Array.
sourcepub fn get_property_list(&self) -> VariantArray
pub fn get_property_list(&self) -> VariantArray
Returns the object’s property list as an Array of dictionaries.
Each property’s Dictionary contain at least name: String and type: int (see [enum Variant.Type]) entries. Optionally, it can also include hint: int (see [PropertyHint][PropertyHint]), hint_string: String, and usage: int (see [PropertyUsageFlags][PropertyUsageFlags]).
sourcepub fn get_script(&self) -> Option<Ref<Reference, Shared>>
pub fn get_script(&self) -> Option<Ref<Reference, Shared>>
Returns the object’s Script instance, or null if none is assigned.
sourcepub fn get_signal_connection_list(
&self,
signal: impl Into<GodotString>
) -> VariantArray
pub fn get_signal_connection_list(
&self,
signal: impl Into<GodotString>
) -> VariantArray
Returns an Array of connections for the given signal.
sourcepub fn get_signal_list(&self) -> VariantArray
pub fn get_signal_list(&self) -> VariantArray
Returns the list of signals as an Array of dictionaries.
sourcepub fn has_meta(&self, name: impl Into<GodotString>) -> bool
pub fn has_meta(&self, name: impl Into<GodotString>) -> bool
Returns true if a metadata entry is found with the given name.
sourcepub fn has_method(&self, method: impl Into<GodotString>) -> bool
pub fn has_method(&self, method: impl Into<GodotString>) -> bool
Returns true if the object contains the given method.
sourcepub fn has_signal(&self, signal: impl Into<GodotString>) -> bool
pub fn has_signal(&self, signal: impl Into<GodotString>) -> bool
Returns true if the given signal exists.
sourcepub fn has_user_signal(&self, signal: impl Into<GodotString>) -> bool
pub fn has_user_signal(&self, signal: impl Into<GodotString>) -> bool
Returns true if the given user-defined signal exists. Only signals added using add_user_signal are taken into account.
sourcepub fn is_blocking_signals(&self) -> bool
pub fn is_blocking_signals(&self) -> bool
Returns true if signal emission blocking is enabled.
sourcepub fn is_class(&self, class: impl Into<GodotString>) -> bool
pub fn is_class(&self, class: impl Into<GodotString>) -> bool
sourcepub fn is_connected(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
) -> bool
pub fn is_connected(
&self,
signal: impl Into<GodotString>,
target: impl AsArg<Object>,
method: impl Into<GodotString>
) -> bool
Returns true if a connection exists for a given signal, target, and method.
sourcepub fn is_queued_for_deletion(&self) -> bool
pub fn is_queued_for_deletion(&self) -> bool
Returns true if the Node.queue_free method was called for the object.
sourcepub fn notification(&self, what: i64, reversed: bool)
pub fn notification(&self, what: i64, reversed: bool)
Send a given notification to the object, which will also trigger a call to the [_notification][Self::_notification] method of all classes that the object inherits from.
If reversed is true, [_notification][Self::_notification] is called first on the object’s own class, and then up to its successive parent classes. If reversed is false, [_notification][Self::_notification] is called first on the highest ancestor (Object itself), and then down to its successive inheriting classes.
Default Arguments
reversed-false
sourcepub fn property_list_changed_notify(&self)
pub fn property_list_changed_notify(&self)
Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.
sourcepub fn remove_meta(&self, name: impl Into<GodotString>)
pub fn remove_meta(&self, name: impl Into<GodotString>)
Removes a given entry from the object’s metadata. See also set_meta.
sourcepub fn set(&self, property: impl Into<GodotString>, value: impl OwnedToVariant)
pub fn set(&self, property: impl Into<GodotString>, value: impl OwnedToVariant)
Assigns a new value to the given property. If the property does not exist, nothing will happen.
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
sourcepub fn set_block_signals(&self, enable: bool)
pub fn set_block_signals(&self, enable: bool)
If set to true, signal emission is blocked.
sourcepub fn set_deferred(
&self,
property: impl Into<GodotString>,
value: impl OwnedToVariant
)
pub fn set_deferred(
&self,
property: impl Into<GodotString>,
value: impl OwnedToVariant
)
Assigns a new value to the given property, after the current frame’s physics step. This is equivalent to calling set via call_deferred, i.e. call_deferred("set", property, value).
Note: In C#, the property name must be specified as snake_case if it is defined by a built-in Godot node. This doesn’t apply to user-defined properties where you should use the same convention as in the C# source (typically PascalCase).
sourcepub fn set_indexed(
&self,
property: impl Into<NodePath>,
value: impl OwnedToVariant
)
pub fn set_indexed(
&self,
property: impl Into<NodePath>,
value: impl OwnedToVariant
)
Sample code is GDScript unless otherwise noted.
Assigns a new value to the property identified by the NodePath. The node path should be relative to the current object and can use the colon character (:) to access nested properties. Example:
set_indexed("position", Vector2(42, 0))
set_indexed("position:y", -10)
print(position) # (42, -10)sourcepub fn set_message_translation(&self, enable: bool)
pub fn set_message_translation(&self, enable: bool)
Defines whether the object can translate strings (with calls to tr). Enabled by default.
sourcepub fn set_meta(&self, name: impl Into<GodotString>, value: impl OwnedToVariant)
pub fn set_meta(&self, name: impl Into<GodotString>, value: impl OwnedToVariant)
Adds, changes or removes a given entry in the object’s metadata. Metadata are serialized and can take any Variant value.
To remove a given entry from the object’s metadata, use remove_meta. Metadata is also removed if its value is set to null. This means you can also use set_meta("name", null) to remove metadata for "name".
sourcepub fn set_script(&self, script: impl AsArg<Reference>)
pub fn set_script(&self, script: impl AsArg<Reference>)
Assigns a script to the object. Each object can have a single script assigned to it, which are used to extend its functionality.
If the object already had a script, the previous script instance will be freed and its variables and state will be lost. The new script’s [_init][Self::_init] method will be called.
sourcepub fn to_string(&self) -> GodotString
pub fn to_string(&self) -> GodotString
sourcepub fn tr(&self, message: impl Into<GodotString>) -> GodotString
pub fn tr(&self, message: impl Into<GodotString>) -> GodotString
Translates a message using translation catalogs configured in the Project Settings.
Only works if message translation is enabled (which it is by default), otherwise it returns the message unchanged. See set_message_translation.
Trait Implementations
sourceimpl Debug for SpatialMaterial
impl Debug for SpatialMaterial
sourceimpl Deref for SpatialMaterial
impl Deref for SpatialMaterial
sourceimpl DerefMut for SpatialMaterial
impl DerefMut for SpatialMaterial
sourceimpl GodotObject for SpatialMaterial
impl GodotObject for SpatialMaterial
type Memory = RefCounted
type Memory = RefCounted
fn class_name() -> &'static str
sourcefn null() -> Null<Self>
fn null() -> Null<Self>
Creates an explicitly null reference of Self as a method argument. This makes type
inference easier for the compiler compared to Option. Read more
sourcefn new() -> Ref<Self, Unique>where
Self: Instanciable,
fn new() -> Ref<Self, Unique>where
Self: Instanciable,
Creates a new instance of Self using a zero-argument constructor, as a Unique
reference. Read more
sourcefn cast<T>(&self) -> Option<&T>where
T: GodotObject + SubClass<Self>,
fn cast<T>(&self) -> Option<&T>where
T: GodotObject + SubClass<Self>,
Performs a dynamic reference downcast to target type. Read more
sourcefn upcast<T>(&self) -> &Twhere
T: GodotObject,
Self: SubClass<T>,
fn upcast<T>(&self) -> &Twhere
T: GodotObject,
Self: SubClass<T>,
Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more
Creates a persistent reference to the same Godot object with shared thread access. Read more
sourceunsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal>where
Self: GodotObject<Memory = RefCounted>,
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal>where
Self: GodotObject<Memory = RefCounted>,
Creates a persistent reference to the same Godot object with thread-local thread access. Read more
sourceunsafe fn assume_unique(&self) -> Ref<Self, Unique>
unsafe fn assume_unique(&self) -> Ref<Self, Unique>
Creates a persistent reference to the same Godot object with unique access. Read more
sourceimpl Instanciable for SpatialMaterial
impl Instanciable for SpatialMaterial
impl Sealed for SpatialMaterial
impl SubClass<Material> for SpatialMaterial
impl SubClass<Object> for SpatialMaterial
impl SubClass<Reference> for SpatialMaterial
impl SubClass<Resource> for SpatialMaterial
Auto Trait Implementations
impl RefUnwindSafe for SpatialMaterial
impl !Send for SpatialMaterial
impl !Sync for SpatialMaterial
impl Unpin for SpatialMaterial
impl UnwindSafe for SpatialMaterial
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more