Compile out editor-only logic within validate_property in games

This commit is contained in:
LuoZhihao 2025-06-12 12:54:19 +08:00
parent d9cd011e2f
commit 8ba4656ea3
69 changed files with 274 additions and 119 deletions

View file

@ -950,6 +950,9 @@ bool CSGShape3D::is_calculating_tangents() const {
}
void CSGShape3D::_validate_property(PropertyInfo &p_property) const {
if (!Engine::get_singleton()->is_editor_hint()) {
return;
}
bool is_collision_prefixed = p_property.name.begins_with("collision_");
if ((is_collision_prefixed || p_property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) {
//hide collision if not root

View file

@ -416,17 +416,18 @@ String AudioStreamInteractive::_get_streams_hint() const {
}
#endif
void AudioStreamInteractive::_validate_property(PropertyInfo &r_property) const {
String prop = r_property.name;
if (Engine::get_singleton()->is_editor_hint() && prop == "switch_to") {
#ifdef TOOLS_ENABLED
if (prop == "switch_to") {
r_property.hint_string = _get_streams_hint();
#endif
return;
}
#endif
if (prop == "initial_clip") {
if (Engine::get_singleton()->is_editor_hint() && prop == "initial_clip") {
#ifdef TOOLS_ENABLED
r_property.hint_string = _get_streams_hint();
#endif
@ -437,7 +438,7 @@ void AudioStreamInteractive::_validate_property(PropertyInfo &r_property) const
} else if (prop == "clip_" + itos(clip) + "/next_clip") {
if (clips[clip].auto_advance != AUTO_ADVANCE_ENABLED) {
r_property.usage = 0;
} else {
} else if (Engine::get_singleton()->is_editor_hint()) {
#ifdef TOOLS_ENABLED
r_property.hint_string = _get_streams_hint();
#endif

View file

@ -30,6 +30,8 @@
#include "fastnoise_lite.h"
#include "core/config/engine.h"
_FastNoiseLite::FractalType FastNoiseLite::_convert_domain_warp_fractal_type_enum(DomainWarpFractalType p_domain_warp_fractal_type) {
_FastNoiseLite::FractalType type;
switch (p_domain_warp_fractal_type) {
@ -477,6 +479,9 @@ void FastNoiseLite::_bind_methods() {
}
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;
return;

View file

@ -97,6 +97,9 @@ void NoiseTexture2D::_bind_methods() {
}
void NoiseTexture2D::_validate_property(PropertyInfo &p_property) const {
if (!Engine::get_singleton()->is_editor_hint()) {
return;
}
if (p_property.name == "bump_strength") {
if (!as_normal_map) {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;

View file

@ -83,6 +83,9 @@ void NoiseTexture3D::_bind_methods() {
}
void NoiseTexture3D::_validate_property(PropertyInfo &p_property) const {
if (!Engine::get_singleton()->is_editor_hint()) {
return;
}
if (p_property.name == "seamless_blend_skirt") {
if (!seamless) {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;

View file

@ -677,6 +677,9 @@ bool OpenXRCompositionLayer::_set(const StringName &p_property, const Variant &p
}
void OpenXRCompositionLayer::_validate_property(PropertyInfo &p_property) const {
if (!Engine::get_singleton()->is_editor_hint()) {
return;
}
if (p_property.name == "layer_viewport") {
if (use_android_surface) {
p_property.usage &= ~PROPERTY_USAGE_EDITOR;