Skip to content

Commit

Permalink
Show warning when scaling Light3D nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
RedMser committed Oct 10, 2022
1 parent 77f4670 commit 87aeb59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scene/3d/light_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ AABB Light3D::get_aabb() const {
return AABB();
}

PackedStringArray Light3D::get_configuration_warnings() const {
PackedStringArray warnings = VisualInstance3D::get_configuration_warnings();

if (!get_scale().is_equal_approx(Vector3(1, 1, 1))) {
warnings.push_back(RTR("A light's scale does not affect the visual size of the light."));
}

return warnings;
}

void Light3D::set_bake_mode(BakeMode p_mode) {
bake_mode = p_mode;
RS::get_singleton()->light_set_bake_mode(light, RS::LightBakeMode(p_mode));
Expand Down Expand Up @@ -579,7 +589,7 @@ OmniLight3D::ShadowMode OmniLight3D::get_shadow_mode() const {
}

PackedStringArray OmniLight3D::get_configuration_warnings() const {
PackedStringArray warnings = Node::get_configuration_warnings();
PackedStringArray warnings = Light3D::get_configuration_warnings();

if (!has_shadow() && get_projector().is_valid()) {
warnings.push_back(RTR("Projector texture only works with shadows active."));
Expand Down Expand Up @@ -609,7 +619,7 @@ OmniLight3D::OmniLight3D() :
}

PackedStringArray SpotLight3D::get_configuration_warnings() const {
PackedStringArray warnings = Node::get_configuration_warnings();
PackedStringArray warnings = Light3D::get_configuration_warnings();

if (has_shadow() && get_param(PARAM_SPOT_ANGLE) >= 90.0) {
warnings.push_back(RTR("A SpotLight3D with an angle wider than 90 degrees cannot cast shadows."));
Expand Down
1 change: 1 addition & 0 deletions scene/3d/light_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class Light3D : public VisualInstance3D {
Color get_correlated_color() const;

virtual AABB get_aabb() const override;
virtual PackedStringArray get_configuration_warnings() const override;

Light3D();
~Light3D();
Expand Down

0 comments on commit 87aeb59

Please sign in to comment.