diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index cf73f5efa6..878704c783 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -316,8 +316,7 @@ void InputEventWithModifiers::_validate_property(PropertyInfo &p_property) const if (p_property.name == "meta_pressed") { p_property.usage ^= PROPERTY_USAGE_STORAGE; p_property.usage ^= PROPERTY_USAGE_EDITOR; - } - if (p_property.name == "ctrl_pressed") { + } else if (p_property.name == "ctrl_pressed") { p_property.usage ^= PROPERTY_USAGE_STORAGE; p_property.usage ^= PROPERTY_USAGE_EDITOR; } diff --git a/modules/interactive_music/audio_stream_interactive.cpp b/modules/interactive_music/audio_stream_interactive.cpp index 5b05e929eb..da62d49b12 100644 --- a/modules/interactive_music/audio_stream_interactive.cpp +++ b/modules/interactive_music/audio_stream_interactive.cpp @@ -437,7 +437,7 @@ void AudioStreamInteractive::_validate_property(PropertyInfo &r_property) const r_property.usage = PROPERTY_USAGE_INTERNAL; } else if (prop == "clip_" + itos(clip) + "/next_clip") { if (clips[clip].auto_advance != AUTO_ADVANCE_ENABLED) { - r_property.usage = 0; + r_property.usage = PROPERTY_USAGE_NONE; } else if (Engine::get_singleton()->is_editor_hint()) { #ifdef TOOLS_ENABLED r_property.hint_string = _get_streams_hint(); diff --git a/modules/interactive_music/audio_stream_playlist.cpp b/modules/interactive_music/audio_stream_playlist.cpp index 2dc4019a9d..7b40a9152d 100644 --- a/modules/interactive_music/audio_stream_playlist.cpp +++ b/modules/interactive_music/audio_stream_playlist.cpp @@ -128,9 +128,8 @@ bool AudioStreamPlaylist::has_loop() const { } void AudioStreamPlaylist::_validate_property(PropertyInfo &r_property) const { - String prop = r_property.name; - if (prop != "stream_count" && prop.begins_with("stream_")) { - int stream = prop.get_slicec('/', 0).get_slicec('_', 1).to_int(); + if (r_property.name != "stream_count" && r_property.name.begins_with("stream_")) { + int stream = r_property.name.get_slicec('/', 0).get_slicec('_', 1).to_int(); if (stream >= stream_count) { r_property.usage = PROPERTY_USAGE_INTERNAL; } diff --git a/modules/noise/fastnoise_lite.cpp b/modules/noise/fastnoise_lite.cpp index c31bcffc4d..57c2c272cb 100644 --- a/modules/noise/fastnoise_lite.cpp +++ b/modules/noise/fastnoise_lite.cpp @@ -482,18 +482,24 @@ void FastNoiseLite::_validate_property(PropertyInfo &p_property) const { if (!Engine::get_singleton()->is_editor_hint()) { return; } - if (p_property.name.begins_with("cellular") && get_noise_type() != TYPE_CELLULAR) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name.begins_with("cellular")) { + if (get_noise_type() != TYPE_CELLULAR) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } return; } - if (p_property.name != "fractal_type" && p_property.name.begins_with("fractal") && get_fractal_type() == FRACTAL_NONE) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name != "fractal_type" && p_property.name.begins_with("fractal")) { + if (get_fractal_type() == FRACTAL_NONE) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } return; } - if (p_property.name == "fractal_ping_pong_strength" && get_fractal_type() != FRACTAL_PING_PONG) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "fractal_ping_pong_strength") { + if (get_fractal_type() != FRACTAL_PING_PONG) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } return; } } diff --git a/modules/noise/noise_texture_2d.cpp b/modules/noise/noise_texture_2d.cpp index 0cd2d5a2ae..a2ed1bd81c 100644 --- a/modules/noise/noise_texture_2d.cpp +++ b/modules/noise/noise_texture_2d.cpp @@ -106,9 +106,7 @@ void NoiseTexture2D::_validate_property(PropertyInfo &p_property) const { if (!as_normal_map) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } - } - - if (p_property.name == "seamless_blend_skirt") { + } else if (p_property.name == "seamless_blend_skirt") { if (!seamless) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 193527d808..57a097d6ca 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -117,10 +117,12 @@ void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const { return; } if (!Engine::get_singleton()->is_editor_hint()) { - if (p_property.name == "frame" && playing) { - p_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY; + if (p_property.name == "frame") { + if (playing) { + p_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY; + } + return; } - return; } if (p_property.name == "animation") { List names; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index e85839afcd..ef28d67937 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -634,44 +634,46 @@ void CPUParticles2D::request_particles_process(real_t p_requested_process_time) void CPUParticles2D::_validate_property(PropertyInfo &p_property) const { if (Engine::get_singleton()->is_editor_hint() && p_property.name == "emitting") { p_property.hint = one_shot ? PROPERTY_HINT_ONESHOT : PROPERTY_HINT_NONE; - } - - if (p_property.name == "emission_sphere_radius" && (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE)) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_rect_extents" && emission_shape != EMISSION_SHAPE_RECTANGLE) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if ((p_property.name == "emission_point_texture" || p_property.name == "emission_color_texture") && (emission_shape < EMISSION_SHAPE_POINTS)) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_normals" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_points" && emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_colors" && emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { - p_property.usage = PROPERTY_USAGE_NONE; - } - if (p_property.name.begins_with("scale_curve_") && !split_scale) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_ring_inner_radius" && emission_shape != EMISSION_SHAPE_RING) { - p_property.usage = PROPERTY_USAGE_NONE; - } - if (p_property.name == "emission_ring_radius" && emission_shape != EMISSION_SHAPE_RING) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "seed" && !use_fixed_seed) { - p_property.usage = PROPERTY_USAGE_NONE; + } else if (p_property.name == "emission_sphere_radius") { + if (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_rect_extents") { + if (emission_shape != EMISSION_SHAPE_RECTANGLE) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_point_texture" || p_property.name == "emission_color_texture") { + if (emission_shape < EMISSION_SHAPE_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_normals") { + if (emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_points") { + if (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_colors") { + if (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name.begins_with("scale_curve_")) { + if (!split_scale) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_ring_inner_radius") { + if (emission_shape != EMISSION_SHAPE_RING) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_ring_radius") { + if (emission_shape != EMISSION_SHAPE_RING) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "seed") { + if (!use_fixed_seed) { + p_property.usage = PROPERTY_USAGE_NONE; + } } } diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index 9eaf1d2589..3567baf8c9 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -428,10 +428,11 @@ Ref GPUParticles2D::get_texture() const { } void GPUParticles2D::_validate_property(PropertyInfo &p_property) const { - if (p_property.name == "seed" && !use_fixed_seed) { - p_property.usage = PROPERTY_USAGE_NONE; - } - if (Engine::get_singleton()->is_editor_hint() && p_property.name == "emitting") { + if (p_property.name == "seed") { + if (!use_fixed_seed) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (Engine::get_singleton()->is_editor_hint() && p_property.name == "emitting") { p_property.hint = one_shot ? PROPERTY_HINT_ONESHOT : PROPERTY_HINT_NONE; } } diff --git a/scene/2d/physics/rigid_body_2d.cpp b/scene/2d/physics/rigid_body_2d.cpp index e3de3dab63..f1eb54020c 100644 --- a/scene/2d/physics/rigid_body_2d.cpp +++ b/scene/2d/physics/rigid_body_2d.cpp @@ -795,9 +795,7 @@ void RigidBody2D::_validate_property(PropertyInfo &p_property) const { } if (center_of_mass_mode != CENTER_OF_MASS_MODE_CUSTOM && p_property.name == "center_of_mass") { p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - - if (!contact_monitor && p_property.name == "max_contacts_reported") { + } else if (!contact_monitor && p_property.name == "max_contacts_reported") { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index 0d40c03e4a..421033d4ad 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -468,9 +468,7 @@ void Sprite2D::_validate_property(PropertyInfo &p_property) const { p_property.hint = PROPERTY_HINT_RANGE; p_property.hint_string = "0," + itos(vframes * hframes - 1) + ",1"; p_property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS; - } - - if (p_property.name == "frame_coords") { + } else if (p_property.name == "frame_coords") { p_property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS; } } diff --git a/scene/3d/bone_attachment_3d.cpp b/scene/3d/bone_attachment_3d.cpp index e6dce81b26..61eec8eabd 100644 --- a/scene/3d/bone_attachment_3d.cpp +++ b/scene/3d/bone_attachment_3d.cpp @@ -52,6 +52,7 @@ void BoneAttachment3D::_validate_property(PropertyInfo &p_property) const { p_property.hint = PROPERTY_HINT_NONE; p_property.hint_string = ""; } + return; } if (p_property.name == "external_skeleton" && !use_external_skeleton) { diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index ce22a4dc7b..799f9b5c51 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -122,14 +122,17 @@ void Camera3D::_validate_property(PropertyInfo &p_property) const { if (mode != PROJECTION_PERSPECTIVE) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } else if (p_property.name == "size") { if (mode != PROJECTION_ORTHOGONAL && mode != PROJECTION_FRUSTUM) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } else if (p_property.name == "frustum_offset") { if (mode != PROJECTION_FRUSTUM) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } } diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index d255fcf910..7304253aa7 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -590,38 +590,38 @@ void CPUParticles3D::request_particles_process(real_t p_requested_process_time) void CPUParticles3D::_validate_property(PropertyInfo &p_property) const { if (Engine::get_singleton()->is_editor_hint() && p_property.name == "emitting") { p_property.hint = one_shot ? PROPERTY_HINT_ONESHOT : PROPERTY_HINT_NONE; - } - - if (p_property.name == "emission_sphere_radius" && (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE)) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_box_extents" && emission_shape != EMISSION_SHAPE_BOX) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if ((p_property.name == "emission_point_texture" || p_property.name == "emission_color_texture" || p_property.name == "emission_points") && (emission_shape != EMISSION_SHAPE_POINTS && (emission_shape != EMISSION_SHAPE_DIRECTED_POINTS))) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_normals" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name.begins_with("emission_ring_") && emission_shape != EMISSION_SHAPE_RING) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name.begins_with("orbit_") && !particle_flags[PARTICLE_FLAG_DISABLE_Z]) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name.begins_with("scale_curve_") && !split_scale) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "seed" && !use_fixed_seed) { - p_property.usage = PROPERTY_USAGE_NONE; + } else if (p_property.name == "emission_sphere_radius") { + if (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_box_extents") { + if (emission_shape != EMISSION_SHAPE_BOX) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_point_texture" || p_property.name == "emission_color_texture" || p_property.name == "emission_points") { + if (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_normals") { + if (emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name.begins_with("emission_ring_")) { + if (emission_shape != EMISSION_SHAPE_RING) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name.begins_with("orbit_")) { + if (!particle_flags[PARTICLE_FLAG_DISABLE_Z]) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name.begins_with("scale_curve_")) { + if (!split_scale) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "seed") { + if (!use_fixed_seed) { + p_property.usage = PROPERTY_USAGE_NONE; + } } } diff --git a/scene/3d/fog_volume.cpp b/scene/3d/fog_volume.cpp index e43d2be738..1f82123182 100644 --- a/scene/3d/fog_volume.cpp +++ b/scene/3d/fog_volume.cpp @@ -51,7 +51,6 @@ void FogVolume::_bind_methods() { void FogVolume::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "size" && shape == RS::FOG_VOLUME_SHAPE_WORLD) { p_property.usage = PROPERTY_USAGE_NONE; - return; } } diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 8f14297edb..8da2073c7f 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -457,16 +457,13 @@ AABB GPUParticles3D::capture_aabb() const { void GPUParticles3D::_validate_property(PropertyInfo &p_property) const { if (Engine::get_singleton()->is_editor_hint() && p_property.name == "emitting") { p_property.hint = one_shot ? PROPERTY_HINT_ONESHOT : PROPERTY_HINT_NONE; - } - - if (p_property.name.begins_with("draw_pass_")) { + } else if (p_property.name.begins_with("draw_pass_")) { int index = p_property.name.get_slicec('_', 2).to_int() - 1; if (index >= draw_passes.size()) { p_property.usage = PROPERTY_USAGE_NONE; return; } - } - if (p_property.name == "seed" && !use_fixed_seed) { + } else if (p_property.name == "seed" && !use_fixed_seed) { p_property.usage = PROPERTY_USAGE_NONE; } } diff --git a/scene/3d/label_3d.cpp b/scene/3d/label_3d.cpp index fce6920a17..b23fb9c8f6 100644 --- a/scene/3d/label_3d.cpp +++ b/scene/3d/label_3d.cpp @@ -191,9 +191,7 @@ void Label3D::_validate_property(PropertyInfo &p_property) const { p_property.name == "gi_mode" || p_property.name == "gi_lightmap_scale") { p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - - if (p_property.name == "cast_shadow" && alpha_cut == ALPHA_CUT_DISABLED) { + } else if (p_property.name == "cast_shadow" && alpha_cut == ALPHA_CUT_DISABLED) { // Alpha-blended materials can't cast shadows. p_property.usage = PROPERTY_USAGE_NO_EDITOR; } diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index 9c30ddbd87..d1ad1f7c31 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -327,9 +327,7 @@ void Light3D::_validate_property(PropertyInfo &p_property) const { p_property.usage = PROPERTY_USAGE_NONE; } else if (get_light_type() == RS::LIGHT_DIRECTIONAL && p_property.name == "light_intensity_lumens") { p_property.usage = PROPERTY_USAGE_NONE; - } - - if (!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units") && (p_property.name == "light_intensity_lumens" || p_property.name == "light_intensity_lux" || p_property.name == "light_temperature")) { + } else if (!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units") && (p_property.name == "light_intensity_lumens" || p_property.name == "light_intensity_lux" || p_property.name == "light_temperature")) { p_property.usage = PROPERTY_USAGE_NONE; } } @@ -551,14 +549,10 @@ void DirectionalLight3D::_validate_property(PropertyInfo &p_property) const { // Splits 3 and 4 are only used with the PSSM 4 Splits shadow mode. p_property.usage = PROPERTY_USAGE_NO_EDITOR; } - } - - if (p_property.name == "light_size" || p_property.name == "light_projector") { + } else if (p_property.name == "light_size" || p_property.name == "light_projector") { // Not implemented in DirectionalLight3D (`light_size` is replaced by `light_angular_distance`). p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "distance_fade_enabled" || p_property.name == "distance_fade_begin" || p_property.name == "distance_fade_shadow" || p_property.name == "distance_fade_length") { + } else if (p_property.name == "distance_fade_enabled" || p_property.name == "distance_fade_begin" || p_property.name == "distance_fade_shadow" || p_property.name == "distance_fade_length") { // Not relevant for DirectionalLight3D, as the light LOD system only pertains to point lights. // For DirectionalLight3D, `directional_shadow_max_distance` can be used instead. p_property.usage = PROPERTY_USAGE_NONE; diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp index 92f48b8f9d..46b7856a6f 100644 --- a/scene/3d/lightmap_gi.cpp +++ b/scene/3d/lightmap_gi.cpp @@ -1828,23 +1828,30 @@ void LightmapGI::_validate_property(PropertyInfo &p_property) const { if (!Engine::get_singleton()->is_editor_hint()) { return; } - if (p_property.name == "supersampling_factor" && !supersampling_enabled) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - if (p_property.name == "environment_custom_sky" && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - if (p_property.name == "environment_custom_color" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - if (p_property.name == "environment_custom_energy" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - if (p_property.name == "denoiser_strength" && !use_denoiser) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - if (p_property.name == "denoiser_range" && !use_denoiser) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "supersampling_factor") { + if (!supersampling_enabled) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + } else if (p_property.name == "environment_custom_sky") { + if (environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + } else if (p_property.name == "environment_custom_color") { + if (environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + } else if (p_property.name == "environment_custom_energy") { + if (environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + } else if (p_property.name == "denoiser_strength") { + if (!use_denoiser) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + } else if (p_property.name == "denoiser_range") { + if (!use_denoiser) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } } } diff --git a/scene/3d/navigation/navigation_agent_3d.cpp b/scene/3d/navigation/navigation_agent_3d.cpp index f21a3e2c16..d83d3c9529 100644 --- a/scene/3d/navigation/navigation_agent_3d.cpp +++ b/scene/3d/navigation/navigation_agent_3d.cpp @@ -347,7 +347,6 @@ void NavigationAgent3D::_notification(int p_what) { void NavigationAgent3D::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "keep_y_velocity" && use_3d_avoidance) { p_property.usage = PROPERTY_USAGE_NONE; - return; } } diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index b083a10035..f8553985db 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -1350,19 +1350,15 @@ NodePath Node3D::get_visibility_parent() const { void Node3D::_validate_property(PropertyInfo &p_property) const { if (data.rotation_edit_mode != ROTATION_EDIT_MODE_BASIS && p_property.name == "basis") { - p_property.usage = 0; - } - if (data.rotation_edit_mode == ROTATION_EDIT_MODE_BASIS && p_property.name == "scale") { - p_property.usage = 0; - } - if (data.rotation_edit_mode != ROTATION_EDIT_MODE_QUATERNION && p_property.name == "quaternion") { - p_property.usage = 0; - } - if (data.rotation_edit_mode != ROTATION_EDIT_MODE_EULER && p_property.name == "rotation") { - p_property.usage = 0; - } - if (data.rotation_edit_mode != ROTATION_EDIT_MODE_EULER && p_property.name == "rotation_order") { - p_property.usage = 0; + p_property.usage = PROPERTY_USAGE_NONE; + } else if (data.rotation_edit_mode == ROTATION_EDIT_MODE_BASIS && p_property.name == "scale") { + p_property.usage = PROPERTY_USAGE_NONE; + } else if (data.rotation_edit_mode != ROTATION_EDIT_MODE_QUATERNION && p_property.name == "quaternion") { + p_property.usage = PROPERTY_USAGE_NONE; + } else if (data.rotation_edit_mode != ROTATION_EDIT_MODE_EULER && p_property.name == "rotation") { + p_property.usage = PROPERTY_USAGE_NONE; + } else if (data.rotation_edit_mode != ROTATION_EDIT_MODE_EULER && p_property.name == "rotation_order") { + p_property.usage = PROPERTY_USAGE_NONE; } } diff --git a/scene/3d/physics/rigid_body_3d.cpp b/scene/3d/physics/rigid_body_3d.cpp index 1f2921137a..fad1e53293 100644 --- a/scene/3d/physics/rigid_body_3d.cpp +++ b/scene/3d/physics/rigid_body_3d.cpp @@ -813,9 +813,7 @@ void RigidBody3D::_validate_property(PropertyInfo &p_property) const { } if (center_of_mass_mode != CENTER_OF_MASS_MODE_CUSTOM && p_property.name == "center_of_mass") { p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - - if (!contact_monitor && p_property.name == "max_contacts_reported") { + } else if (!contact_monitor && p_property.name == "max_contacts_reported") { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index 0444427d0f..6cfa6f8098 100644 --- a/scene/animation/animation_blend_space_2d.cpp +++ b/scene/animation/animation_blend_space_2d.cpp @@ -599,8 +599,7 @@ String AnimationNodeBlendSpace2D::get_caption() const { void AnimationNodeBlendSpace2D::_validate_property(PropertyInfo &p_property) const { if (auto_triangles && p_property.name == "triangles") { p_property.usage = PROPERTY_USAGE_NONE; - } - if (p_property.name.begins_with("blend_point_")) { + } else if (p_property.name.begins_with("blend_point_")) { String left = p_property.name.get_slicec('/', 0); int idx = left.get_slicec('_', 2).to_int(); if (idx >= blend_points_used) { diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index eb8325ff6f..5bcc77d204 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -91,9 +91,7 @@ void AnimationNodeAnimation::_validate_property(PropertyInfo &p_property) const p_property.hint = PROPERTY_HINT_ENUM; p_property.hint_string = anims; } - } - - if (!use_custom_timeline) { + } else if (!use_custom_timeline) { if (p_property.name == "timeline_length" || p_property.name == "start_offset" || p_property.name == "loop_mode" || p_property.name == "stretch_time_scale") { p_property.usage = PROPERTY_USAGE_NONE; } diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index ddbc42bb52..6d1054607b 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -137,6 +137,7 @@ void AnimationMixer::_validate_property(PropertyInfo &p_property) const { #ifdef TOOLS_ENABLED // `editing` is surrounded by TOOLS_ENABLED so this should also be. if (Engine::get_singleton()->is_editor_hint() && editing && (p_property.name == "active" || p_property.name == "deterministic" || p_property.name == "root_motion_track")) { p_property.usage |= PROPERTY_USAGE_READ_ONLY; + return; } #endif // TOOLS_ENABLED if (root_motion_track.is_empty() && p_property.name == "root_motion_local") { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 428c1279aa..26f3057cef 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -514,6 +514,7 @@ void Control::_validate_property(PropertyInfo &p_property) const { } p_property.hint_string = hint_string; + return; } if (Engine::get_singleton()->is_editor_hint() && p_property.name == "mouse_force_pass_scroll_events") { @@ -521,6 +522,7 @@ void Control::_validate_property(PropertyInfo &p_property) const { if (data.mouse_filter != MOUSE_FILTER_STOP) { p_property.usage |= PROPERTY_USAGE_READ_ONLY; } + return; } if (Engine::get_singleton()->is_editor_hint() && p_property.name == "scale") { diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp index a72aaee53b..9d5588055a 100644 --- a/scene/gui/progress_bar.cpp +++ b/scene/gui/progress_bar.cpp @@ -190,8 +190,7 @@ void ProgressBar::_notification(int p_what) { void ProgressBar::_validate_property(PropertyInfo &p_property) const { if (Engine::get_singleton()->is_editor_hint() && indeterminate && p_property.name == "show_percentage") { p_property.usage |= PROPERTY_USAGE_READ_ONLY; - } - if (!indeterminate && p_property.name == "editor_preview_indeterminate") { + } else if (!indeterminate && p_property.name == "editor_preview_indeterminate") { p_property.usage = PROPERTY_USAGE_NONE; } } diff --git a/scene/gui/texture_progress_bar.cpp b/scene/gui/texture_progress_bar.cpp index b63fbe6803..c7cb3204ab 100644 --- a/scene/gui/texture_progress_bar.cpp +++ b/scene/gui/texture_progress_bar.cpp @@ -641,9 +641,7 @@ void TextureProgressBar::_validate_property(PropertyInfo &p_property) const { } if (p_property.name.begins_with("stretch_margin_") && !nine_patch_stretch) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - - if (p_property.name.begins_with("radial_") && (mode != FillMode::FILL_CLOCKWISE && mode != FillMode::FILL_COUNTER_CLOCKWISE && mode != FillMode::FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE)) { + } else if (p_property.name.begins_with("radial_") && (mode != FillMode::FILL_CLOCKWISE && mode != FillMode::FILL_COUNTER_CLOCKWISE && mode != FillMode::FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE)) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index aceb027c0c..67ddee8229 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -3584,7 +3584,7 @@ void Node::_call_unhandled_key_input(const Ref &p_event) { void Node::_validate_property(PropertyInfo &p_property) const { if ((p_property.name == "process_thread_group_order" || p_property.name == "process_thread_messages") && data.process_thread_group == PROCESS_THREAD_GROUP_INHERIT) { - p_property.usage = 0; + p_property.usage = PROPERTY_USAGE_NONE; } } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a9a1090720..5a32764c88 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -5339,9 +5339,7 @@ void Viewport::_validate_property(PropertyInfo &p_property) const { } if (vrs_mode != VRS_TEXTURE && (p_property.name == "vrs_texture")) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; - } - - if (vrs_mode == VRS_DISABLED && (p_property.name == "vrs_update_mode")) { + } else if (vrs_mode == VRS_DISABLED && (p_property.name == "vrs_update_mode")) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } diff --git a/scene/resources/2d/navigation_polygon.cpp b/scene/resources/2d/navigation_polygon.cpp index 43498bfe40..daa6ba7a4d 100644 --- a/scene/resources/2d/navigation_polygon.cpp +++ b/scene/resources/2d/navigation_polygon.cpp @@ -625,14 +625,13 @@ void NavigationPolygon::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "parsed_collision_mask") { if (parsed_geometry_type == PARSED_GEOMETRY_MESH_INSTANCES) { p_property.usage = PROPERTY_USAGE_NONE; - return; } + return; } if (p_property.name == "parsed_source_group_name") { if (source_geometry_mode == SOURCE_GEOMETRY_ROOT_NODE_CHILDREN) { p_property.usage = PROPERTY_USAGE_NONE; - return; } } } diff --git a/scene/resources/2d/tile_set.cpp b/scene/resources/2d/tile_set.cpp index c69e1bc478..7fcf617784 100644 --- a/scene/resources/2d/tile_set.cpp +++ b/scene/resources/2d/tile_set.cpp @@ -4235,10 +4235,14 @@ void TileSet::_validate_property(PropertyInfo &p_property) const { if (!Engine::get_singleton()->is_editor_hint()) { return; } - if (p_property.name == "tile_layout" && tile_shape == TILE_SHAPE_SQUARE) { - p_property.usage ^= PROPERTY_USAGE_READ_ONLY; - } else if (p_property.name == "tile_offset_axis" && tile_shape == TILE_SHAPE_SQUARE) { - p_property.usage ^= PROPERTY_USAGE_READ_ONLY; + if (p_property.name == "tile_layout") { + if (tile_shape == TILE_SHAPE_SQUARE) { + p_property.usage ^= PROPERTY_USAGE_READ_ONLY; + } + } else if (p_property.name == "tile_offset_axis") { + if (tile_shape == TILE_SHAPE_SQUARE) { + p_property.usage ^= PROPERTY_USAGE_READ_ONLY; + } } } diff --git a/scene/resources/camera_attributes.cpp b/scene/resources/camera_attributes.cpp index 33e9cdaace..bd68c4e6d4 100644 --- a/scene/resources/camera_attributes.cpp +++ b/scene/resources/camera_attributes.cpp @@ -458,7 +458,6 @@ void CameraAttributesPhysical::_validate_property(PropertyInfo &property) const } if (!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units") && (property.name == "exposure_aperture" || property.name == "exposure_shutter_speed")) { property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL; - return; } } diff --git a/scene/resources/compositor.cpp b/scene/resources/compositor.cpp index 1f6ea53a2d..8b142faac4 100644 --- a/scene/resources/compositor.cpp +++ b/scene/resources/compositor.cpp @@ -74,14 +74,18 @@ void CompositorEffect::_bind_methods() { } void CompositorEffect::_validate_property(PropertyInfo &p_property) const { - if (p_property.name == "access_resolved_color" && effect_callback_type == EFFECT_CALLBACK_TYPE_POST_TRANSPARENT) { - p_property.usage = PROPERTY_USAGE_NONE; - } - if (p_property.name == "access_resolved_depth" && effect_callback_type == EFFECT_CALLBACK_TYPE_POST_TRANSPARENT) { - p_property.usage = PROPERTY_USAGE_NONE; - } - if (p_property.name == "needs_separate_specular" && effect_callback_type != EFFECT_CALLBACK_TYPE_POST_SKY) { - p_property.usage = PROPERTY_USAGE_NONE; + if (p_property.name == "access_resolved_color") { + if (effect_callback_type == EFFECT_CALLBACK_TYPE_POST_TRANSPARENT) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "access_resolved_depth") { + if (effect_callback_type == EFFECT_CALLBACK_TYPE_POST_TRANSPARENT) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "needs_separate_specular") { + if (effect_callback_type != EFFECT_CALLBACK_TYPE_POST_SKY) { + p_property.usage = PROPERTY_USAGE_NONE; + } } } diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 0d891d81a6..a425bd168e 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1108,56 +1108,75 @@ void Environment::_validate_property(PropertyInfo &p_property) const { if (bg_mode != BG_SKY && ambient_source != AMBIENT_SOURCE_SKY && reflection_source != REFLECTION_SOURCE_SKY) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } if (p_property.name == "fog_depth_curve" || p_property.name == "fog_depth_begin" || p_property.name == "fog_depth_end") { if (fog_mode == FOG_MODE_EXPONENTIAL) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } if (p_property.name == "ambient_light_color" || p_property.name == "ambient_light_energy") { if (ambient_source == AMBIENT_SOURCE_DISABLED) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } if (p_property.name == "ambient_light_sky_contribution") { if (ambient_source == AMBIENT_SOURCE_DISABLED || ambient_source == AMBIENT_SOURCE_COLOR) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } if (p_property.name == "fog_aerial_perspective") { if (bg_mode != BG_SKY) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } - if (p_property.name == "tonemap_white" && (tone_mapper == TONE_MAPPER_LINEAR || tone_mapper == TONE_MAPPER_AGX)) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "tonemap_white") { + if (tone_mapper == TONE_MAPPER_LINEAR || tone_mapper == TONE_MAPPER_AGX) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + return; } - if (p_property.name == "tonemap_agx_white" && tone_mapper != TONE_MAPPER_AGX) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "tonemap_agx_white") { + if (tone_mapper != TONE_MAPPER_AGX) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + return; } - if (p_property.name == "tonemap_agx_contrast" && tone_mapper != TONE_MAPPER_AGX) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "tonemap_agx_contrast") { + if (tone_mapper != TONE_MAPPER_AGX) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + return; } - if (p_property.name == "glow_intensity" && glow_blend_mode == GLOW_BLEND_MODE_MIX && OS::get_singleton()->get_current_rendering_method() != "gl_compatibility") { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "glow_intensity") { + if (glow_blend_mode == GLOW_BLEND_MODE_MIX && OS::get_singleton()->get_current_rendering_method() != "gl_compatibility") { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + return; } if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { // Hide glow properties we do not support in GL Compatibility. if (p_property.name.begins_with("glow_levels") || p_property.name == "glow_normalized" || p_property.name == "glow_strength" || p_property.name == "glow_mix" || p_property.name == "glow_blend_mode" || p_property.name == "glow_map_strength" || p_property.name == "glow_map") { p_property.usage = PROPERTY_USAGE_NO_EDITOR; + return; } } else { if (p_property.name == "glow_mix" && glow_blend_mode != GLOW_BLEND_MODE_MIX) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; + return; } } @@ -1167,6 +1186,7 @@ void Environment::_validate_property(PropertyInfo &p_property) const { if ((p_property.name != "ssao_enabled") && (p_property.name != "ssao_radius") && (p_property.name != "ssao_intensity")) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } } @@ -1174,18 +1194,21 @@ void Environment::_validate_property(PropertyInfo &p_property) const { if (bg_mode != BG_COLOR && ambient_source != AMBIENT_SOURCE_COLOR) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } if (p_property.name == "background_canvas_max_layer") { if (bg_mode != BG_CANVAS) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } if (p_property.name == "background_camera_feed_id") { if (bg_mode != BG_CAMERA_FEED) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + return; } if (p_property.name == "background_intensity" && !GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) { diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 20733cfeb3..c1c3b2f010 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -84,8 +84,7 @@ RID Material::get_rid() const { void Material::_validate_property(PropertyInfo &p_property) const { if (!_can_do_next_pass() && p_property.name == "next_pass") { p_property.usage = PROPERTY_USAGE_NONE; - } - if (!_can_use_render_priority() && p_property.name == "render_priority") { + } else if (!_can_use_render_priority() && p_property.name == "render_priority") { p_property.usage = PROPERTY_USAGE_NONE; } } diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp index 77fef549d3..96602a4d27 100644 --- a/scene/resources/navigation_mesh.cpp +++ b/scene/resources/navigation_mesh.cpp @@ -630,9 +630,7 @@ void NavigationMesh::_validate_property(PropertyInfo &p_property) const { p_property.usage = PROPERTY_USAGE_NONE; return; } - } - - if (p_property.name == "geometry_source_group_name") { + } else if (p_property.name == "geometry_source_group_name") { if (source_geometry_mode == SOURCE_GEOMETRY_ROOT_NODE_CHILDREN) { p_property.usage = PROPERTY_USAGE_NONE; return; diff --git a/scene/resources/particle_process_material.cpp b/scene/resources/particle_process_material.cpp index f7314de774..b26eea36c2 100644 --- a/scene/resources/particle_process_material.cpp +++ b/scene/resources/particle_process_material.cpp @@ -1882,66 +1882,68 @@ RID ParticleProcessMaterial::get_shader_rid() const { } void ParticleProcessMaterial::_validate_property(PropertyInfo &p_property) const { - if (p_property.name == "emission_sphere_radius" && (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE)) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_box_extents" && emission_shape != EMISSION_SHAPE_BOX) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if ((p_property.name == "emission_point_texture" || p_property.name == "emission_color_texture") && (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS)) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_normal_texture" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "emission_point_count" && (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS)) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name.begins_with("emission_ring_") && emission_shape != EMISSION_SHAPE_RING) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "sub_emitter_frequency" && sub_emitter_mode != SUB_EMITTER_CONSTANT) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "sub_emitter_amount_at_end" && sub_emitter_mode != SUB_EMITTER_AT_END) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "sub_emitter_amount_at_collision" && sub_emitter_mode != SUB_EMITTER_AT_COLLISION) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "sub_emitter_amount_at_start" && sub_emitter_mode != SUB_EMITTER_AT_START) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "collision_friction" && collision_mode != COLLISION_RIGID) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (p_property.name == "collision_bounce" && collision_mode != COLLISION_RIGID) { - p_property.usage = PROPERTY_USAGE_NONE; - } - if ((p_property.name == "directional_velocity_min" || p_property.name == "directional_velocity_max") && !tex_parameters[PARAM_DIRECTIONAL_VELOCITY].is_valid()) { - p_property.usage = PROPERTY_USAGE_NONE; - } - - if (Engine::get_singleton()->is_editor_hint()) { - if ((p_property.name == "scale_over_velocity_min" || p_property.name == "scale_over_velocity_max") && !tex_parameters[PARAM_SCALE_OVER_VELOCITY].is_valid()) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "emission_sphere_radius") { + if (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE) { + p_property.usage = PROPERTY_USAGE_NONE; } - if ((p_property.name == "orbit_velocity_min" || p_property.name == "orbit_velocity_max") && (!tex_parameters[PARAM_ORBIT_VELOCITY].is_valid() && !particle_flags[PARTICLE_FLAG_DISABLE_Z])) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } else if (p_property.name == "emission_box_extents") { + if (emission_shape != EMISSION_SHAPE_BOX) { + p_property.usage = PROPERTY_USAGE_NONE; } - - if (p_property.usage & PROPERTY_USAGE_EDITOR && (p_property.name.ends_with("_min") || p_property.name.ends_with("_max"))) { + } else if (p_property.name == "emission_point_texture" || p_property.name == "emission_color_texture") { + if (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_normal_texture") { + if (emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "emission_point_count") { + if (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name.begins_with("emission_ring_")) { + if (emission_shape != EMISSION_SHAPE_RING) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "sub_emitter_frequency") { + if (sub_emitter_mode != SUB_EMITTER_CONSTANT) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "sub_emitter_amount_at_end") { + if (sub_emitter_mode != SUB_EMITTER_AT_END) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "sub_emitter_amount_at_collision") { + if (sub_emitter_mode != SUB_EMITTER_AT_COLLISION) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "sub_emitter_amount_at_start") { + if (sub_emitter_mode != SUB_EMITTER_AT_START) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "collision_friction") { + if (collision_mode != COLLISION_RIGID) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "collision_bounce") { + if (collision_mode != COLLISION_RIGID) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (p_property.name == "directional_velocity_min" || p_property.name == "directional_velocity_max") { + if (!tex_parameters[PARAM_DIRECTIONAL_VELOCITY].is_valid()) { + p_property.usage = PROPERTY_USAGE_NONE; + } + } else if (Engine::get_singleton()->is_editor_hint()) { + if (p_property.name == "scale_over_velocity_min" || p_property.name == "scale_over_velocity_max") { + if (!tex_parameters[PARAM_SCALE_OVER_VELOCITY].is_valid()) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + } else if (p_property.name == "orbit_velocity_min" || p_property.name == "orbit_velocity_max") { + if (!tex_parameters[PARAM_ORBIT_VELOCITY].is_valid() && !particle_flags[PARTICLE_FLAG_DISABLE_Z]) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; + } + } else if (p_property.usage & PROPERTY_USAGE_EDITOR && (p_property.name.ends_with("_min") || p_property.name.ends_with("_max"))) { p_property.usage &= ~PROPERTY_USAGE_EDITOR; } }