Add some codes, returnes directly if the value is not changed.

Avoid executing the following value-changed logics if the value does not really change.
This commit is contained in:
风青山
2022-03-16 15:50:48 +08:00
committed by Rindbee
parent ba0421f3d9
commit e561c68256
33 changed files with 952 additions and 34 deletions

View File

@ -46,6 +46,10 @@ void ReferenceRect::_notification(int p_what) {
}
void ReferenceRect::set_border_color(const Color &p_color) {
if (border_color == p_color) {
return;
}
border_color = p_color;
update();
}
@ -55,7 +59,12 @@ Color ReferenceRect::get_border_color() const {
}
void ReferenceRect::set_border_width(float p_width) {
border_width = MAX(0.0, p_width);
float width_max = MAX(0.0, p_width);
if (border_width == width_max) {
return;
}
border_width = width_max;
update();
}
@ -64,6 +73,10 @@ float ReferenceRect::get_border_width() const {
}
void ReferenceRect::set_editor_only(const bool &p_enabled) {
if (editor_only == p_enabled) {
return;
}
editor_only = p_enabled;
update();
}