Skip to content

Commit 6de8252

Browse files
committed
Compile out editor-only logic within _validate_property in games
1 parent d9cd011 commit 6de8252

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+308
-159
lines changed

modules/csg/csg_shape.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,9 @@ bool CSGShape3D::is_calculating_tangents() const {
950950
}
951951

952952
void CSGShape3D::_validate_property(PropertyInfo &p_property) const {
953+
if (!Engine::get_singleton()->is_editor_hint()) {
954+
return;
955+
}
953956
bool is_collision_prefixed = p_property.name.begins_with("collision_");
954957
if ((is_collision_prefixed || p_property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) {
955958
//hide collision if not root

modules/interactive_music/audio_stream_interactive.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,14 @@ String AudioStreamInteractive::_get_streams_hint() const {
419419
void AudioStreamInteractive::_validate_property(PropertyInfo &r_property) const {
420420
String prop = r_property.name;
421421

422+
if (Engine::get_singleton()->is_editor_hint() && prop == "switch_to") {
422423
#ifdef TOOLS_ENABLED
423-
if (prop == "switch_to") {
424424
r_property.hint_string = _get_streams_hint();
425+
#endif
425426
return;
426427
}
427-
#endif
428428

429-
if (prop == "initial_clip") {
429+
if (Engine::get_singleton()->is_editor_hint() && prop == "initial_clip") {
430430
#ifdef TOOLS_ENABLED
431431
r_property.hint_string = _get_streams_hint();
432432
#endif
@@ -437,7 +437,7 @@ void AudioStreamInteractive::_validate_property(PropertyInfo &r_property) const
437437
} else if (prop == "clip_" + itos(clip) + "/next_clip") {
438438
if (clips[clip].auto_advance != AUTO_ADVANCE_ENABLED) {
439439
r_property.usage = 0;
440-
} else {
440+
} else if (Engine::get_singleton()->is_editor_hint()) {
441441
#ifdef TOOLS_ENABLED
442442
r_property.hint_string = _get_streams_hint();
443443
#endif

modules/noise/fastnoise_lite.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "fastnoise_lite.h"
3232

33+
#include "core/config/engine.h"
34+
3335
_FastNoiseLite::FractalType FastNoiseLite::_convert_domain_warp_fractal_type_enum(DomainWarpFractalType p_domain_warp_fractal_type) {
3436
_FastNoiseLite::FractalType type;
3537
switch (p_domain_warp_fractal_type) {
@@ -477,6 +479,9 @@ void FastNoiseLite::_bind_methods() {
477479
}
478480

479481
void FastNoiseLite::_validate_property(PropertyInfo &p_property) const {
482+
if (!Engine::get_singleton()->is_editor_hint()) {
483+
return;
484+
}
480485
if (p_property.name.begins_with("cellular") && get_noise_type() != TYPE_CELLULAR) {
481486
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
482487
return;

modules/noise/noise_texture_2d.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ void NoiseTexture2D::_bind_methods() {
9797
}
9898

9999
void NoiseTexture2D::_validate_property(PropertyInfo &p_property) const {
100+
if (!Engine::get_singleton()->is_editor_hint()) {
101+
return;
102+
}
100103
if (p_property.name == "bump_strength") {
101104
if (!as_normal_map) {
102105
p_property.usage = PROPERTY_USAGE_NO_EDITOR;

modules/noise/noise_texture_3d.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ void NoiseTexture3D::_bind_methods() {
8383
}
8484

8585
void NoiseTexture3D::_validate_property(PropertyInfo &p_property) const {
86+
if (!Engine::get_singleton()->is_editor_hint()) {
87+
return;
88+
}
8689
if (p_property.name == "seamless_blend_skirt") {
8790
if (!seamless) {
8891
p_property.usage = PROPERTY_USAGE_NO_EDITOR;

modules/openxr/scene/openxr_composition_layer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,9 @@ bool OpenXRCompositionLayer::_set(const StringName &p_property, const Variant &p
677677
}
678678

679679
void OpenXRCompositionLayer::_validate_property(PropertyInfo &p_property) const {
680+
if (!Engine::get_singleton()->is_editor_hint()) {
681+
return;
682+
}
680683
if (p_property.name == "layer_viewport") {
681684
if (use_android_surface) {
682685
p_property.usage &= ~PROPERTY_USAGE_EDITOR;

scene/2d/animated_sprite_2d.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const {
116116
if (frames.is_null()) {
117117
return;
118118
}
119-
119+
if (!Engine::get_singleton()->is_editor_hint()) {
120+
if (p_property.name == "frame" && playing) {
121+
p_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY;
122+
}
123+
return;
124+
}
120125
if (p_property.name == "animation") {
121126
List<StringName> names;
122127
frames->get_animation_list(&names);

scene/2d/back_buffer_copy.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ BackBufferCopy::CopyMode BackBufferCopy::get_copy_mode() const {
8080
}
8181

8282
void BackBufferCopy::_validate_property(PropertyInfo &p_property) const {
83+
if (!Engine::get_singleton()->is_editor_hint()) {
84+
return;
85+
}
8386
if (copy_mode != COPY_MODE_RECT && p_property.name == "rect") {
8487
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
8588
}

scene/2d/cpu_particles_2d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ void CPUParticles2D::request_particles_process(real_t p_requested_process_time)
616616
}
617617

618618
void CPUParticles2D::_validate_property(PropertyInfo &p_property) const {
619-
if (p_property.name == "emitting") {
619+
if (Engine::get_singleton()->is_editor_hint() && p_property.name == "emitting") {
620620
p_property.hint = one_shot ? PROPERTY_HINT_ONESHOT : PROPERTY_HINT_NONE;
621621
}
622622

scene/2d/gpu_particles_2d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ void GPUParticles2D::_validate_property(PropertyInfo &p_property) const {
431431
if (p_property.name == "seed" && !use_fixed_seed) {
432432
p_property.usage = PROPERTY_USAGE_NONE;
433433
}
434-
if (p_property.name == "emitting") {
434+
if (Engine::get_singleton()->is_editor_hint() && p_property.name == "emitting") {
435435
p_property.hint = one_shot ? PROPERTY_HINT_ONESHOT : PROPERTY_HINT_NONE;
436436
}
437437
}

0 commit comments

Comments
 (0)