diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-07-28 19:33:14 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-07-28 19:33:14 +0200 |
commit | 48fc5b2480dc394feae9cd7c4ec62cf8740cddbc (patch) | |
tree | cdf4e6701109843eb931db0ff98c96ae06c8f6ac /scene/3d/visual_instance_3d.cpp | |
parent | 60eb508fbb9ddd30fa567f183f8f50b74af38cd6 (diff) | |
download | redot-engine-48fc5b2480dc394feae9cd7c4ec62cf8740cddbc.tar.gz |
Add node configuration warning for GeometryInstance3D distance
Diffstat (limited to 'scene/3d/visual_instance_3d.cpp')
-rw-r--r-- | scene/3d/visual_instance_3d.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp index 70a7021f22..c155819159 100644 --- a/scene/3d/visual_instance_3d.cpp +++ b/scene/3d/visual_instance_3d.cpp @@ -153,6 +153,7 @@ Ref<Material> GeometryInstance3D::get_material_override() const { void GeometryInstance3D::set_visibility_range_begin(float p_dist) { visibility_range_begin = p_dist; RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin); + update_configuration_warnings(); } float GeometryInstance3D::get_visibility_range_begin() const { @@ -162,6 +163,7 @@ float GeometryInstance3D::get_visibility_range_begin() const { void GeometryInstance3D::set_visibility_range_end(float p_dist) { visibility_range_end = p_dist; RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin); + update_configuration_warnings(); } float GeometryInstance3D::get_visibility_range_end() const { @@ -351,6 +353,16 @@ bool GeometryInstance3D::is_ignoring_occlusion_culling() { return ignore_occlusion_culling; } +TypedArray<String> GeometryInstance3D::get_configuration_warnings() const { + TypedArray<String> warnings = Node::get_configuration_warnings(); + + if (!Math::is_zero_approx(visibility_range_end) && visibility_range_end <= visibility_range_begin) { + warnings.push_back(TTR("The GeometryInstance3D visibility range's End distance is set to a non-zero value, but is lower than the Begin distance.\nThis means the GeometryInstance3D will never be visible.\nTo resolve this, set the End distance to 0 or to a value greater than the Begin distance.")); + } + + return warnings; +} + void GeometryInstance3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance3D::set_material_override); ClassDB::bind_method(D_METHOD("get_material_override"), &GeometryInstance3D::get_material_override); |