diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-01 10:11:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 10:11:28 +0200 |
commit | 979e7729472ce4e67d7d04cfeebdba9a1f60b9f0 (patch) | |
tree | 0902c8123b8b6367155084d87a5bd47043b59cc1 /scene | |
parent | 00aabec8bb598592b8a8702797b51fc9f6ca6169 (diff) | |
parent | 8c8dc6f026d40030757c4636035fc99271ed480a (diff) |
Merge pull request #31839 from Calinou/canvasitem-update-only-if-needed
Call some CanvasItem property setters only if needed
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/canvas_item.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index b605be47df..fc5e5cbba2 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -641,6 +641,9 @@ void CanvasItem::update() { void CanvasItem::set_modulate(const Color &p_modulate) { + if (modulate == p_modulate) + return; + modulate = p_modulate; VisualServer::get_singleton()->canvas_item_set_modulate(canvas_item, modulate); } @@ -679,6 +682,9 @@ CanvasItem *CanvasItem::get_parent_item() const { void CanvasItem::set_self_modulate(const Color &p_self_modulate) { + if (self_modulate == p_self_modulate) + return; + self_modulate = p_self_modulate; VisualServer::get_singleton()->canvas_item_set_self_modulate(canvas_item, self_modulate); } @@ -689,6 +695,9 @@ Color CanvasItem::get_self_modulate() const { void CanvasItem::set_light_mask(int p_light_mask) { + if (light_mask == p_light_mask) + return; + light_mask = p_light_mask; VS::get_singleton()->canvas_item_set_light_mask(canvas_item, p_light_mask); } |