From 1b376b32cdfd410d26d825fc53b3030aae59c194 Mon Sep 17 00:00:00 2001 From: David Trallero Date: Fri, 6 Sep 2024 07:52:54 +0800 Subject: [PATCH] Update FollowPath2D children of Path2D when a curve_changed event occurs --- scene/2d/path_2d.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index c3768386e9f..7f7bf8c2867 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -167,17 +167,16 @@ void Path2D::_curve_changed() { return; } - if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_paths_hint()) { - return; - } - - queue_redraw(); for (int i = 0; i < get_child_count(); i++) { PathFollow2D *follow = Object::cast_to(get_child(i)); if (follow) { follow->path_changed(); } } + + if (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_paths_hint()) { + queue_redraw(); + } } void Path2D::set_curve(const Ref &p_curve) {