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:
@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user