Make _validate_property a multilevel method
This commit is contained in:
parent
fdc36ad082
commit
1a24c9e14b
135 changed files with 770 additions and 800 deletions
|
|
@ -598,8 +598,8 @@ float Area3D::get_reverb_uniformity() const {
|
|||
return reverb_uniformity;
|
||||
}
|
||||
|
||||
void Area3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "audio_bus_name" || property.name == "reverb_bus_name") {
|
||||
void Area3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "audio_bus_name" || p_property.name == "reverb_bus_name") {
|
||||
String options;
|
||||
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
|
||||
if (i > 0) {
|
||||
|
|
@ -609,32 +609,30 @@ void Area3D::_validate_property(PropertyInfo &property) const {
|
|||
options += name;
|
||||
}
|
||||
|
||||
property.hint_string = options;
|
||||
} else if (property.name.begins_with("gravity") && property.name != "gravity_space_override") {
|
||||
p_property.hint_string = options;
|
||||
} else if (p_property.name.begins_with("gravity") && p_property.name != "gravity_space_override") {
|
||||
if (gravity_space_override == SPACE_OVERRIDE_DISABLED) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
} else {
|
||||
if (gravity_is_point) {
|
||||
if (property.name == "gravity_direction") {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
if (p_property.name == "gravity_direction") {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
} else {
|
||||
if (property.name.begins_with("gravity_point_")) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
if (p_property.name.begins_with("gravity_point_")) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (property.name.begins_with("linear_damp") && property.name != "linear_damp_space_override") {
|
||||
} else if (p_property.name.begins_with("linear_damp") && p_property.name != "linear_damp_space_override") {
|
||||
if (linear_damp_space_override == SPACE_OVERRIDE_DISABLED) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
} else if (property.name.begins_with("angular_damp") && property.name != "angular_damp_space_override") {
|
||||
} else if (p_property.name.begins_with("angular_damp") && p_property.name != "angular_damp_space_override") {
|
||||
if (angular_damp_space_override == SPACE_OVERRIDE_DISABLED) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
|
||||
CollisionObject3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void Area3D::_bind_methods() {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ private:
|
|||
float reverb_amount = 0.0;
|
||||
float reverb_uniformity = 0.0;
|
||||
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
void _initialize_wind();
|
||||
|
||||
|
|
|
|||
|
|
@ -648,8 +648,8 @@ bool AudioStreamPlayer3D::_is_active() const {
|
|||
return active.is_set();
|
||||
}
|
||||
|
||||
void AudioStreamPlayer3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "bus") {
|
||||
void AudioStreamPlayer3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "bus") {
|
||||
String options;
|
||||
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
|
||||
if (i > 0) {
|
||||
|
|
@ -659,10 +659,8 @@ void AudioStreamPlayer3D::_validate_property(PropertyInfo &property) const {
|
|||
options += name;
|
||||
}
|
||||
|
||||
property.hint_string = options;
|
||||
p_property.hint_string = options;
|
||||
}
|
||||
|
||||
Node3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void AudioStreamPlayer3D::_bus_layout_changed() {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ private:
|
|||
float cached_global_panning_strength = 1.0f;
|
||||
|
||||
protected:
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "bone_attachment_3d.h"
|
||||
|
||||
void BoneAttachment3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "bone_name") {
|
||||
void BoneAttachment3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "bone_name") {
|
||||
// Because it is a constant function, we cannot use the _get_skeleton_3d function.
|
||||
const Skeleton3D *parent = nullptr;
|
||||
if (use_external_skeleton) {
|
||||
|
|
@ -51,15 +51,13 @@ void BoneAttachment3D::_validate_property(PropertyInfo &property) const {
|
|||
names += parent->get_bone_name(i);
|
||||
}
|
||||
|
||||
property.hint = PROPERTY_HINT_ENUM;
|
||||
property.hint_string = names;
|
||||
p_property.hint = PROPERTY_HINT_ENUM;
|
||||
p_property.hint_string = names;
|
||||
} else {
|
||||
property.hint = PROPERTY_HINT_NONE;
|
||||
property.hint_string = "";
|
||||
p_property.hint = PROPERTY_HINT_NONE;
|
||||
p_property.hint_string = "";
|
||||
}
|
||||
}
|
||||
|
||||
Node3D::_validate_property(property);
|
||||
}
|
||||
|
||||
bool BoneAttachment3D::_set(const StringName &p_path, const Variant &p_value) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class BoneAttachment3D : public Node3D {
|
|||
Skeleton3D *_get_skeleton3d();
|
||||
|
||||
protected:
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
bool _get(const StringName &p_path, Variant &r_ret) const;
|
||||
bool _set(const StringName &p_path, const Variant &p_value);
|
||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||
|
|
|
|||
|
|
@ -71,8 +71,6 @@ void Camera3D::_validate_property(PropertyInfo &p_property) const {
|
|||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
|
||||
Node3D::_validate_property(p_property);
|
||||
}
|
||||
|
||||
void Camera3D::_update_camera() {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ protected:
|
|||
void _update_camera_mode();
|
||||
|
||||
void _notification(int p_what);
|
||||
virtual void _validate_property(PropertyInfo &p_property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
|
|
|
|||
|
|
@ -516,36 +516,34 @@ bool CPUParticles3D::get_split_scale() {
|
|||
return split_scale;
|
||||
}
|
||||
|
||||
void CPUParticles3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "emission_sphere_radius" && (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE)) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
void CPUParticles3D::_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 (property.name == "emission_box_extents" && emission_shape != EMISSION_SHAPE_BOX) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
if (p_property.name == "emission_box_extents" && emission_shape != EMISSION_SHAPE_BOX) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
if ((property.name == "emission_point_texture" || property.name == "emission_color_texture" || property.name == "emission_points") && (emission_shape != EMISSION_SHAPE_POINTS && (emission_shape != EMISSION_SHAPE_DIRECTED_POINTS))) {
|
||||
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 (property.name == "emission_normals" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
if (p_property.name == "emission_normals" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
if (property.name.begins_with("emission_ring_") && emission_shape != EMISSION_SHAPE_RING) {
|
||||
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 (property.name.begins_with("orbit_") && !particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
|
||||
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 (property.name.begins_with("scale_curve_") && !split_scale) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
if (p_property.name.begins_with("scale_curve_") && !split_scale) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
Node3D::_validate_property(property);
|
||||
}
|
||||
|
||||
static uint32_t idhash(uint32_t x) {
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ private:
|
|||
protected:
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
AABB get_aabb() const override;
|
||||
|
|
|
|||
|
|
@ -152,11 +152,10 @@ AABB Decal::get_aabb() const {
|
|||
return aabb;
|
||||
}
|
||||
|
||||
void Decal::_validate_property(PropertyInfo &property) const {
|
||||
if (!distance_fade_enabled && (property.name == "distance_fade_begin" || property.name == "distance_fade_length")) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
void Decal::_validate_property(PropertyInfo &p_property) const {
|
||||
if (!distance_fade_enabled && (p_property.name == "distance_fade_begin" || p_property.name == "distance_fade_length")) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
VisualInstance3D::_validate_property(property);
|
||||
}
|
||||
|
||||
TypedArray<String> Decal::get_configuration_warnings() const {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ private:
|
|||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
virtual TypedArray<String> get_configuration_warnings() const override;
|
||||
|
|
|
|||
|
|
@ -45,12 +45,11 @@ void FogVolume::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "FogMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||
}
|
||||
|
||||
void FogVolume::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "extents" && shape == RS::FOG_VOLUME_SHAPE_WORLD) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
void FogVolume::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "extents" && shape == RS::FOG_VOLUME_SHAPE_WORLD) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
return;
|
||||
}
|
||||
VisualInstance3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void FogVolume::set_extents(const Vector3 &p_extents) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class FogVolume : public VisualInstance3D {
|
|||
protected:
|
||||
_FORCE_INLINE_ RID _get_volume() { return volume; }
|
||||
static void _bind_methods();
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
|
|
|
|||
|
|
@ -376,16 +376,14 @@ AABB GPUParticles3D::capture_aabb() const {
|
|||
return RS::get_singleton()->particles_get_current_aabb(particles);
|
||||
}
|
||||
|
||||
void GPUParticles3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name.begins_with("draw_pass_")) {
|
||||
int index = property.name.get_slicec('_', 2).to_int() - 1;
|
||||
void GPUParticles3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name.begins_with("draw_pass_")) {
|
||||
int index = p_property.name.get_slicec('_', 2).to_int() - 1;
|
||||
if (index >= draw_passes.size()) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GeometryInstance3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void GPUParticles3D::emit_particle(const Transform3D &p_transform, const Vector3 &p_velocity, const Color &p_color, const Color &p_custom, uint32_t p_emit_flags) {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ private:
|
|||
protected:
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
AABB get_aabb() const override;
|
||||
|
|
|
|||
|
|
@ -162,19 +162,19 @@ void Label3D::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS);
|
||||
}
|
||||
|
||||
void Label3D::_validate_property(PropertyInfo &property) const {
|
||||
void Label3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (
|
||||
property.name == "material_override" ||
|
||||
property.name == "material_overlay" ||
|
||||
property.name == "lod_bias" ||
|
||||
property.name == "gi_mode" ||
|
||||
property.name == "gi_lightmap_scale") {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.name == "material_override" ||
|
||||
p_property.name == "material_overlay" ||
|
||||
p_property.name == "lod_bias" ||
|
||||
p_property.name == "gi_mode" ||
|
||||
p_property.name == "gi_lightmap_scale") {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
|
||||
if (property.name == "cast_shadow" && alpha_cut == ALPHA_CUT_DISABLED) {
|
||||
if (p_property.name == "cast_shadow" && alpha_cut == ALPHA_CUT_DISABLED) {
|
||||
// Alpha-blended materials can't cast shadows.
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ protected:
|
|||
|
||||
static void _bind_methods();
|
||||
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
void _im_update();
|
||||
void _font_changed();
|
||||
|
|
|
|||
|
|
@ -223,21 +223,19 @@ bool Light3D::is_editor_only() const {
|
|||
return editor_only;
|
||||
}
|
||||
|
||||
void Light3D::_validate_property(PropertyInfo &property) const {
|
||||
if (!shadow && (property.name == "shadow_bias" || property.name == "shadow_normal_bias" || property.name == "shadow_reverse_cull_face" || property.name == "shadow_transmittance_bias" || property.name == "shadow_fog_fade" || property.name == "shadow_opacity" || property.name == "shadow_blur" || property.name == "distance_fade_shadow")) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
void Light3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (!shadow && (p_property.name == "shadow_bias" || p_property.name == "shadow_normal_bias" || p_property.name == "shadow_reverse_cull_face" || p_property.name == "shadow_transmittance_bias" || p_property.name == "shadow_fog_fade" || p_property.name == "shadow_opacity" || p_property.name == "shadow_blur" || p_property.name == "distance_fade_shadow")) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
|
||||
if (get_light_type() != RS::LIGHT_DIRECTIONAL && property.name == "light_angular_distance") {
|
||||
if (get_light_type() != RS::LIGHT_DIRECTIONAL && p_property.name == "light_angular_distance") {
|
||||
// Angular distance is only used in DirectionalLight3D.
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
if (!distance_fade_enabled && (property.name == "distance_fade_begin" || property.name == "distance_fade_shadow" || property.name == "distance_fade_length")) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
if (!distance_fade_enabled && (p_property.name == "distance_fade_begin" || p_property.name == "distance_fade_shadow" || p_property.name == "distance_fade_length")) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
|
||||
VisualInstance3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void Light3D::_bind_methods() {
|
||||
|
|
@ -429,29 +427,27 @@ DirectionalLight3D::SkyMode DirectionalLight3D::get_sky_mode() const {
|
|||
return sky_mode;
|
||||
}
|
||||
|
||||
void DirectionalLight3D::_validate_property(PropertyInfo &property) const {
|
||||
if (shadow_mode == SHADOW_ORTHOGONAL && (property.name == "directional_shadow_split_1" || property.name == "directional_shadow_blend_splits")) {
|
||||
void DirectionalLight3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (shadow_mode == SHADOW_ORTHOGONAL && (p_property.name == "directional_shadow_split_1" || p_property.name == "directional_shadow_blend_splits")) {
|
||||
// Split 2 and split blending are only used with the PSSM 2 Splits and PSSM 4 Splits shadow modes.
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
|
||||
if ((shadow_mode == SHADOW_ORTHOGONAL || shadow_mode == SHADOW_PARALLEL_2_SPLITS) && (property.name == "directional_shadow_split_2" || property.name == "directional_shadow_split_3")) {
|
||||
if ((shadow_mode == SHADOW_ORTHOGONAL || shadow_mode == SHADOW_PARALLEL_2_SPLITS) && (p_property.name == "directional_shadow_split_2" || p_property.name == "directional_shadow_split_3")) {
|
||||
// Splits 3 and 4 are only used with the PSSM 4 Splits shadow mode.
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
|
||||
if (property.name == "light_size" || property.name == "light_projector" || property.name == "light_specular") {
|
||||
if (p_property.name == "light_size" || p_property.name == "light_projector" || p_property.name == "light_specular") {
|
||||
// Not implemented in DirectionalLight3D (`light_size` is replaced by `light_angular_distance`).
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
if (property.name == "distance_fade_enabled" || property.name == "distance_fade_begin" || property.name == "distance_fade_shadow" || property.name == "distance_fade_length") {
|
||||
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.
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
Light3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void DirectionalLight3D::_bind_methods() {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ protected:
|
|||
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
Light3D(RenderingServer::LightType p_type);
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ private:
|
|||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
void set_shadow_mode(ShadowMode p_mode);
|
||||
|
|
|
|||
|
|
@ -1410,17 +1410,16 @@ LightmapGI::GenerateProbes LightmapGI::get_generate_probes() const {
|
|||
return gen_probes;
|
||||
}
|
||||
|
||||
void LightmapGI::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "environment_custom_sky" && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
void LightmapGI::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "environment_custom_sky" && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
if (property.name == "environment_custom_color" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
if (p_property.name == "environment_custom_color" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
if (property.name == "environment_custom_energy" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
if (p_property.name == "environment_custom_energy" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
VisualInstance3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void LightmapGI::_bind_methods() {
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ private:
|
|||
void _gen_new_positions_from_octree(const GenProbesOctree *p_cell, float p_cell_size, const Vector<Vector3> &probe_positions, LocalVector<Vector3> &new_probe_positions, HashMap<Vector3i, bool> &positions_used, const AABB &p_bounds);
|
||||
|
||||
protected:
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class NavigationObstacle3D : public Node {
|
|||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &p_property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -879,21 +879,21 @@ NodePath Node3D::get_visibility_parent() const {
|
|||
return visibility_parent_path;
|
||||
}
|
||||
|
||||
void Node3D::_validate_property(PropertyInfo &property) const {
|
||||
if (data.rotation_edit_mode != ROTATION_EDIT_MODE_BASIS && property.name == "basis") {
|
||||
property.usage = 0;
|
||||
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 && property.name == "scale") {
|
||||
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 && property.name == "quaternion") {
|
||||
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 && property.name == "rotation") {
|
||||
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 && property.name == "rotation_order") {
|
||||
property.usage = 0;
|
||||
if (data.rotation_edit_mode != ROTATION_EDIT_MODE_EULER && p_property.name == "rotation_order") {
|
||||
p_property.usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ protected:
|
|||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
bool _property_can_revert(const StringName &p_name) const;
|
||||
bool _property_get_revert(const StringName &p_name, Variant &r_property) const;
|
||||
|
|
|
|||
|
|
@ -330,16 +330,15 @@ bool PathFollow3D::get_cubic_interpolation() const {
|
|||
return cubic;
|
||||
}
|
||||
|
||||
void PathFollow3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "offset") {
|
||||
void PathFollow3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "offset") {
|
||||
real_t max = 10000;
|
||||
if (path && path->get_curve().is_valid()) {
|
||||
max = path->get_curve()->get_baked_length();
|
||||
}
|
||||
|
||||
property.hint_string = "0," + rtos(max) + ",0.01,or_lesser,or_greater";
|
||||
p_property.hint_string = "0," + rtos(max) + ",0.01,or_lesser,or_greater";
|
||||
}
|
||||
Node3D::_validate_property(property);
|
||||
}
|
||||
|
||||
TypedArray<String> PathFollow3D::get_configuration_warnings() const {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ private:
|
|||
void _update_transform(bool p_update_xyz_rot = true);
|
||||
|
||||
protected:
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
|
|
|||
|
|
@ -1124,13 +1124,12 @@ void RigidDynamicBody3D::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(DAMP_MODE_REPLACE);
|
||||
}
|
||||
|
||||
void RigidDynamicBody3D::_validate_property(PropertyInfo &property) const {
|
||||
void RigidDynamicBody3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (center_of_mass_mode != CENTER_OF_MASS_MODE_CUSTOM) {
|
||||
if (property.name == "center_of_mass") {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
if (p_property.name == "center_of_mass") {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
PhysicsBody3D::_validate_property(property);
|
||||
}
|
||||
|
||||
RigidDynamicBody3D::RigidDynamicBody3D() :
|
||||
|
|
@ -2022,13 +2021,12 @@ void CharacterBody3D::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(PLATFORM_VEL_ON_LEAVE_NEVER);
|
||||
}
|
||||
|
||||
void CharacterBody3D::_validate_property(PropertyInfo &property) const {
|
||||
void CharacterBody3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (motion_mode == MOTION_MODE_FLOATING) {
|
||||
if (property.name.begins_with("floor_") || property.name == "up_direction" || property.name == "slide_on_ceiling") {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
if (p_property.name.begins_with("floor_") || p_property.name == "up_direction" || p_property.name == "slide_on_ceiling") {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
PhysicsBody3D::_validate_property(property);
|
||||
}
|
||||
|
||||
CharacterBody3D::CharacterBody3D() :
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ protected:
|
|||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
GDVIRTUAL1(_integrate_forces, PhysicsDirectBodyState3D *)
|
||||
|
||||
|
|
@ -483,7 +483,7 @@ private:
|
|||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(CharacterBody3D::MotionMode);
|
||||
|
|
|
|||
|
|
@ -178,13 +178,12 @@ AABB ReflectionProbe::get_aabb() const {
|
|||
return aabb;
|
||||
}
|
||||
|
||||
void ReflectionProbe::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "ambient_color" || property.name == "ambient_color_energy") {
|
||||
void ReflectionProbe::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "ambient_color" || p_property.name == "ambient_color_energy") {
|
||||
if (ambient_mode != AMBIENT_COLOR) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
VisualInstance3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void ReflectionProbe::_bind_methods() {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ private:
|
|||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
void set_intensity(float p_intensity);
|
||||
|
|
|
|||
|
|
@ -176,39 +176,37 @@ void Skeleton3D::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
}
|
||||
}
|
||||
|
||||
void Skeleton3D::_validate_property(PropertyInfo &property) const {
|
||||
PackedStringArray split = property.name.split("/");
|
||||
void Skeleton3D::_validate_property(PropertyInfo &p_property) const {
|
||||
PackedStringArray split = p_property.name.split("/");
|
||||
if (split.size() == 3 && split[0] == "bones") {
|
||||
if (split[2] == "rest") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
if (is_show_rest_only()) {
|
||||
if (split[2] == "enabled") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
if (split[2] == "position") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
if (split[2] == "rotation") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
if (split[2] == "scale") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
} else if (!is_bone_enabled(split[1].to_int())) {
|
||||
if (split[2] == "position") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
if (split[2] == "rotation") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
if (split[2] == "scale") {
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
p_property.usage |= PROPERTY_USAGE_READ_ONLY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Node3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void Skeleton3D::_update_process_order() {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ protected:
|
|||
bool _get(const StringName &p_path, Variant &r_ret) const;
|
||||
bool _set(const StringName &p_path, const Variant &p_value);
|
||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
|
|
|
|||
|
|
@ -329,8 +329,8 @@ void FabrikInverseKinematic::_update_chain(const Skeleton3D *p_sk, ChainItem *p_
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletonIK3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "root_bone" || property.name == "tip_bone") {
|
||||
void SkeletonIK3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "root_bone" || p_property.name == "tip_bone") {
|
||||
if (skeleton) {
|
||||
String names("--,");
|
||||
for (int i = 0; i < skeleton->get_bone_count(); i++) {
|
||||
|
|
@ -340,15 +340,13 @@ void SkeletonIK3D::_validate_property(PropertyInfo &property) const {
|
|||
names += skeleton->get_bone_name(i);
|
||||
}
|
||||
|
||||
property.hint = PROPERTY_HINT_ENUM;
|
||||
property.hint_string = names;
|
||||
p_property.hint = PROPERTY_HINT_ENUM;
|
||||
p_property.hint_string = names;
|
||||
} else {
|
||||
property.hint = PROPERTY_HINT_NONE;
|
||||
property.hint_string = "";
|
||||
p_property.hint = PROPERTY_HINT_NONE;
|
||||
p_property.hint_string = "";
|
||||
}
|
||||
}
|
||||
|
||||
Node::_validate_property(property);
|
||||
}
|
||||
|
||||
void SkeletonIK3D::_bind_methods() {
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class SkeletonIK3D : public Node {
|
|||
FabrikInverseKinematic::Task *task = nullptr;
|
||||
|
||||
protected:
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
static void _bind_methods();
|
||||
virtual void _notification(int p_what);
|
||||
|
|
|
|||
|
|
@ -751,18 +751,16 @@ Rect2 Sprite3D::get_item_rect() const {
|
|||
return Rect2(ofs, s);
|
||||
}
|
||||
|
||||
void Sprite3D::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "frame") {
|
||||
property.hint = PROPERTY_HINT_RANGE;
|
||||
property.hint_string = "0," + itos(vframes * hframes - 1) + ",1";
|
||||
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||
void Sprite3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "frame") {
|
||||
p_property.hint = PROPERTY_HINT_RANGE;
|
||||
p_property.hint_string = "0," + itos(vframes * hframes - 1) + ",1";
|
||||
p_property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||
}
|
||||
|
||||
if (property.name == "frame_coords") {
|
||||
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||
if (p_property.name == "frame_coords") {
|
||||
p_property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||
}
|
||||
|
||||
SpriteBase3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void Sprite3D::_bind_methods() {
|
||||
|
|
@ -1000,12 +998,12 @@ void AnimatedSprite3D::_draw() {
|
|||
}
|
||||
}
|
||||
|
||||
void AnimatedSprite3D::_validate_property(PropertyInfo &property) const {
|
||||
void AnimatedSprite3D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (!frames.is_valid()) {
|
||||
return;
|
||||
}
|
||||
if (property.name == "animation") {
|
||||
property.hint = PROPERTY_HINT_ENUM;
|
||||
if (p_property.name == "animation") {
|
||||
p_property.hint = PROPERTY_HINT_ENUM;
|
||||
List<StringName> names;
|
||||
frames->get_animation_list(&names);
|
||||
names.sort_custom<StringName::AlphCompare>();
|
||||
|
|
@ -1014,36 +1012,34 @@ void AnimatedSprite3D::_validate_property(PropertyInfo &property) const {
|
|||
|
||||
for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
|
||||
if (E->prev()) {
|
||||
property.hint_string += ",";
|
||||
p_property.hint_string += ",";
|
||||
}
|
||||
|
||||
property.hint_string += String(E->get());
|
||||
p_property.hint_string += String(E->get());
|
||||
if (animation == E->get()) {
|
||||
current_found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!current_found) {
|
||||
if (property.hint_string.is_empty()) {
|
||||
property.hint_string = String(animation);
|
||||
if (p_property.hint_string.is_empty()) {
|
||||
p_property.hint_string = String(animation);
|
||||
} else {
|
||||
property.hint_string = String(animation) + "," + property.hint_string;
|
||||
p_property.hint_string = String(animation) + "," + p_property.hint_string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (property.name == "frame") {
|
||||
property.hint = PROPERTY_HINT_RANGE;
|
||||
if (p_property.name == "frame") {
|
||||
p_property.hint = PROPERTY_HINT_RANGE;
|
||||
if (frames->has_animation(animation) && frames->get_frame_count(animation) > 0) {
|
||||
property.hint_string = "0," + itos(frames->get_frame_count(animation) - 1) + ",1";
|
||||
p_property.hint_string = "0," + itos(frames->get_frame_count(animation) - 1) + ",1";
|
||||
} else {
|
||||
// Avoid an error, `hint_string` is required for `PROPERTY_HINT_RANGE`.
|
||||
property.hint_string = "0,0,1";
|
||||
p_property.hint_string = "0,0,1";
|
||||
}
|
||||
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||
p_property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||
}
|
||||
|
||||
SpriteBase3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void AnimatedSprite3D::_notification(int p_what) {
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ protected:
|
|||
virtual void _draw() override;
|
||||
static void _bind_methods();
|
||||
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
void set_texture(const Ref<Texture2D> &p_texture);
|
||||
|
|
@ -229,7 +229,7 @@ protected:
|
|||
virtual void _draw() override;
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
|
||||
public:
|
||||
void set_sprite_frames(const Ref<SpriteFrames> &p_frames);
|
||||
|
|
|
|||
|
|
@ -244,27 +244,25 @@ void XRNode3D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("trigger_haptic_pulse", "action_name", "frequency", "amplitude", "duration_sec", "delay_sec"), &XRNode3D::trigger_haptic_pulse);
|
||||
};
|
||||
|
||||
void XRNode3D::_validate_property(PropertyInfo &property) const {
|
||||
void XRNode3D::_validate_property(PropertyInfo &p_property) const {
|
||||
XRServer *xr_server = XRServer::get_singleton();
|
||||
ERR_FAIL_NULL(xr_server);
|
||||
|
||||
if (property.name == "tracker") {
|
||||
if (p_property.name == "tracker") {
|
||||
PackedStringArray names = xr_server->get_suggested_tracker_names();
|
||||
String hint_string;
|
||||
for (const String &name : names) {
|
||||
hint_string += name + ",";
|
||||
}
|
||||
property.hint_string = hint_string;
|
||||
} else if (property.name == "pose") {
|
||||
p_property.hint_string = hint_string;
|
||||
} else if (p_property.name == "pose") {
|
||||
PackedStringArray names = xr_server->get_suggested_pose_names(tracker_name);
|
||||
String hint_string;
|
||||
for (const String &name : names) {
|
||||
hint_string += name + ",";
|
||||
}
|
||||
property.hint_string = hint_string;
|
||||
p_property.hint_string = hint_string;
|
||||
}
|
||||
|
||||
Node3D::_validate_property(property);
|
||||
}
|
||||
|
||||
void XRNode3D::set_tracker(const StringName p_tracker_name) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ protected:
|
|||
void _pose_changed(const Ref<XRPose> &p_pose);
|
||||
|
||||
public:
|
||||
virtual void _validate_property(PropertyInfo &property) const override;
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
void set_tracker(const StringName p_tracker_name);
|
||||
StringName get_tracker() const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue