Merge pull request #52728 from jmb462/ninepatchrect_node_warning

This commit is contained in:
Rémi Verschelde 2021-09-17 20:22:10 +02:00 committed by GitHub
commit d92405de74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -156,6 +156,7 @@ bool NinePatchRect::is_draw_center_enabled() const {
void NinePatchRect::set_h_axis_stretch_mode(AxisStretchMode p_mode) {
axis_h = p_mode;
update_configuration_warning();
update();
}
@ -165,6 +166,7 @@ NinePatchRect::AxisStretchMode NinePatchRect::get_h_axis_stretch_mode() const {
void NinePatchRect::set_v_axis_stretch_mode(AxisStretchMode p_mode) {
axis_v = p_mode;
update_configuration_warning();
update();
}
@ -172,6 +174,21 @@ NinePatchRect::AxisStretchMode NinePatchRect::get_v_axis_stretch_mode() const {
return axis_v;
}
String NinePatchRect::get_configuration_warning() const {
String warning = Control::get_configuration_warning();
if (String(GLOBAL_GET("rendering/quality/driver/driver_name")) == "GLES2") {
if (axis_v > AXIS_STRETCH_MODE_STRETCH || axis_h > AXIS_STRETCH_MODE_STRETCH) {
if (!warning.empty()) {
warning += "\n\n";
}
warning += TTR("The Tile and Tile Fit options for Axis Stretch properties are only effective when using the GLES3 rendering backend.\nThe GLES2 backend is currently in use, so these modes will act like Stretch instead.");
}
}
return warning;
}
NinePatchRect::NinePatchRect() {
margin[MARGIN_LEFT] = 0;
margin[MARGIN_RIGHT] = 0;

View File

@ -74,6 +74,8 @@ public:
void set_v_axis_stretch_mode(AxisStretchMode p_mode);
AxisStretchMode get_v_axis_stretch_mode() const;
String get_configuration_warning() const;
NinePatchRect();
~NinePatchRect();
};