Skip to content

Commit 2443622

Browse files
committed
Compile out editor-only logic within validate_property in export template
1 parent a2aefab commit 2443622

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

+280
-123
lines changed

modules/csg/csg_shape.cpp

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

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

modules/noise/fastnoise_lite.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
/**************************************************************************/
3030

3131
#include "fastnoise_lite.h"
32+
#include "core/config/engine.h"
3233

3334
_FastNoiseLite::FractalType FastNoiseLite::_convert_domain_warp_fractal_type_enum(DomainWarpFractalType p_domain_warp_fractal_type) {
3435
_FastNoiseLite::FractalType type;
@@ -477,6 +478,9 @@ void FastNoiseLite::_bind_methods() {
477478
}
478479

479480
void FastNoiseLite::_validate_property(PropertyInfo &p_property) const {
481+
if (!Engine::get_singleton()->is_editor_hint()) {
482+
return;
483+
}
480484
if (p_property.name.begins_with("cellular") && get_noise_type() != TYPE_CELLULAR) {
481485
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
482486
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ Rect2 AnimatedSprite2D::_get_rect() const {
113113
}
114114

115115
void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const {
116+
if (!Engine::get_singleton()->is_editor_hint()) {
117+
return;
118+
}
116119
if (frames.is_null()) {
117120
return;
118121
}

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/camera_2d.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,9 @@ bool Camera2D::is_margin_drawing_enabled() const {
921921
}
922922

923923
void Camera2D::_validate_property(PropertyInfo &p_property) const {
924+
if (!Engine::get_singleton()->is_editor_hint()) {
925+
return;
926+
}
924927
if (!limit_enabled && (p_property.name == "limit_smoothed" || p_property.name == "limit_left" || p_property.name == "limit_top" || p_property.name == "limit_right" || p_property.name == "limit_bottom")) {
925928
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
926929
}

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)