Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some _validate_property not correctly refactored #64553

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/csg/csg_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ void CSGShape3D::_validate_property(PropertyInfo &property) const {
//hide collision if not root
property.usage = PROPERTY_USAGE_NO_EDITOR;
} else if (is_collision_prefixed && !bool(get("use_collision"))) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
GeometryInstance3D::_validate_property(property);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/noise/noise_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void NoiseTexture::_bind_methods() {
void NoiseTexture::_validate_property(PropertyInfo &property) const {
if (property.name == "bump_strength") {
if (!as_normal_map) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

Expand Down
6 changes: 3 additions & 3 deletions modules/visual_script/visual_script_func_nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ Dictionary VisualScriptFunctionCall::_get_argument_cache() const {
void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const {
if (property.name == "base_type") {
if (call_mode != CALL_MODE_INSTANCE) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

Expand Down Expand Up @@ -1293,7 +1293,7 @@ VisualScriptPropertySet::AssignOp VisualScriptPropertySet::get_assign_op() const
void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
if (property.name == "base_type") {
if (call_mode != CALL_MODE_INSTANCE) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

Expand Down Expand Up @@ -1999,7 +1999,7 @@ StringName VisualScriptPropertyGet::get_index() const {
void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
if (property.name == "base_type") {
if (call_mode != CALL_MODE_INSTANCE) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

Expand Down
10 changes: 5 additions & 5 deletions scene/2d/area_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,25 +512,25 @@ void Area2D::_validate_property(PropertyInfo &property) const {
property.hint_string = options;
} else if (property.name.begins_with("gravity") && property.name != "gravity_space_override") {
if (gravity_space_override == SPACE_OVERRIDE_DISABLED) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
} else {
if (gravity_is_point) {
if (property.name == "gravity_direction") {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
} else {
if (property.name.begins_with("gravity_point_")) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
}
} else if (property.name.begins_with("linear_damp") && property.name != "linear_damp_space_override") {
if (linear_damp_space_override == SPACE_OVERRIDE_DISABLED) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
} else if (property.name.begins_with("angular_damp") && property.name != "angular_damp_space_override") {
if (angular_damp_space_override == SPACE_OVERRIDE_DISABLED) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions scene/2d/physics_body_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ void RigidDynamicBody2D::_bind_methods() {
void RigidDynamicBody2D::_validate_property(PropertyInfo &property) const {
if (center_of_mass_mode != CENTER_OF_MASS_MODE_CUSTOM) {
if (property.name == "center_of_mass") {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
}
Expand Down Expand Up @@ -1779,11 +1779,11 @@ void CharacterBody2D::_bind_methods() {
void CharacterBody2D::_validate_property(PropertyInfo &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 | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
} else {
if (property.name == "wall_min_slide_angle") {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions scene/3d/area_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,25 +612,25 @@ void Area3D::_validate_property(PropertyInfo &property) const {
property.hint_string = options;
} else if (property.name.begins_with("gravity") && property.name != "gravity_space_override") {
if (gravity_space_override == SPACE_OVERRIDE_DISABLED) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
} else {
if (gravity_is_point) {
if (property.name == "gravity_direction") {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
} else {
if (property.name.begins_with("gravity_point_")) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
}
} else if (property.name.begins_with("linear_damp") && property.name != "linear_damp_space_override") {
if (linear_damp_space_override == SPACE_OVERRIDE_DISABLED) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
} else if (property.name.begins_with("angular_damp") && property.name != "angular_damp_space_override") {
if (angular_damp_space_override == SPACE_OVERRIDE_DISABLED) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

Expand Down
4 changes: 2 additions & 2 deletions scene/3d/physics_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ void RigidDynamicBody3D::_bind_methods() {
void RigidDynamicBody3D::_validate_property(PropertyInfo &property) const {
if (center_of_mass_mode != CENTER_OF_MASS_MODE_CUSTOM) {
if (property.name == "center_of_mass") {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
PhysicsBody3D::_validate_property(property);
Expand Down Expand Up @@ -2025,7 +2025,7 @@ void CharacterBody3D::_bind_methods() {
void CharacterBody3D::_validate_property(PropertyInfo &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 | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
PhysicsBody3D::_validate_property(property);
Expand Down
4 changes: 2 additions & 2 deletions scene/3d/reflection_probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ AABB ReflectionProbe::get_aabb() const {
}

void ReflectionProbe::_validate_property(PropertyInfo &property) const {
if (property.name == "interior/ambient_color" || property.name == "interior/ambient_color_energy") {
if (property.name == "ambient_color" || property.name == "ambient_color_energy") {
if (ambient_mode != AMBIENT_COLOR) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
VisualInstance3D::_validate_property(property);
Expand Down
20 changes: 10 additions & 10 deletions scene/resources/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,39 +1038,39 @@ void Environment::_update_adjustment() {
// Private methods, constructor and destructor

void Environment::_validate_property(PropertyInfo &property) const {
if (property.name == "sky" || property.name == "sky_custom_fov" || property.name == "sky_rotation" || property.name == "ambient_light/sky_contribution") {
if (property.name == "sky" || property.name == "sky_custom_fov" || property.name == "sky_rotation" || property.name == "ambient_light_sky_contribution") {
if (bg_mode != BG_SKY && ambient_source != AMBIENT_SOURCE_SKY && reflection_source != REFLECTION_SOURCE_SKY) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

if (property.name == "fog_aerial_perspective") {
if (bg_mode != BG_SKY) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

if (property.name == "tonemap_white" && tone_mapper == TONE_MAPPER_LINEAR) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}

if (property.name == "glow_intensity" && glow_blend_mode == GLOW_BLEND_MODE_MIX) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}

if (property.name == "glow_mix" && glow_blend_mode != GLOW_BLEND_MODE_MIX) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}

if (property.name == "background_color") {
if (bg_mode != BG_COLOR && ambient_source != AMBIENT_SOURCE_COLOR) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

if (property.name == "background_canvas_max_layer") {
if (bg_mode != BG_CANVAS) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}

Expand Down Expand Up @@ -1108,7 +1108,7 @@ void Environment::_validate_property(PropertyInfo &property) const {

String enabled = prefix + "enabled";
if (property.name.begins_with(prefix) && property.name != enabled && !bool(get(enabled))) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
return;
}

Expand All @@ -1121,7 +1121,7 @@ void Environment::_validate_property(PropertyInfo &property) const {
String prefix = String(*prefixes);

if (property.name.begins_with(prefix)) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
property.usage = PROPERTY_USAGE_NO_EDITOR;
return;
}

Expand Down
6 changes: 4 additions & 2 deletions scene/resources/navigation_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,10 @@ void NavigationMesh::_bind_methods() {
ADD_GROUP("Geometry", "geometry_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_parsed_geometry_type", PROPERTY_HINT_ENUM, "Mesh Instances,Static Colliders,Both"), "set_parsed_geometry_type", "get_parsed_geometry_type");
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
ADD_PROPERTY_DEFAULT("geometry_collision_mask", 0xFFFFFFFF);
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_source_geometry_mode", PROPERTY_HINT_ENUM, "NavMesh Children, Group With Children, Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "geometry_source_group_name"), "set_source_group_name", "get_source_group_name");
ADD_PROPERTY_DEFAULT("geometry_source_group_name", StringName("navmesh"));
ADD_GROUP("Cells", "cell_");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell_size", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater,suffix:m"), "set_cell_size", "get_cell_size");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell_height", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater,suffix:m"), "set_cell_height", "get_cell_height");
Expand Down Expand Up @@ -659,14 +661,14 @@ void NavigationMesh::_bind_methods() {
}

void NavigationMesh::_validate_property(PropertyInfo &property) const {
if (property.name == "geometry/collision_mask") {
if (property.name == "geometry_collision_mask") {
if (parsed_geometry_type == PARSED_GEOMETRY_MESH_INSTANCES) {
property.usage = PROPERTY_USAGE_NONE;
return;
}
}

if (property.name == "geometry/source_group_name") {
if (property.name == "geometry_source_group_name") {
if (source_geometry_mode == SOURCE_GEOMETRY_NAVMESH_CHILDREN) {
property.usage = PROPERTY_USAGE_NONE;
return;
Expand Down