From c15bb8147e391028635be6fdcce0799e27ef5181 Mon Sep 17 00:00:00 2001 From: Mark Riedesel Date: Mon, 24 Oct 2022 09:33:03 -0500 Subject: [PATCH] Handle closed splines in Collada importer (cherry picked from commit 8f7ab02bc637975a707455563f4954c2c43e976d) --- editor/collada/collada.cpp | 2 ++ editor/import/editor_import_collada.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index d45b280ec12..bd9a68cdd1c 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -845,6 +845,8 @@ void Collada::_parse_curve_geometry(XMLParser &parser, String p_id, String p_nam CurveData &curvedata = state.curve_data_map[p_id]; curvedata.name = p_name; + String closed = parser.get_attribute_value_safe("closed").to_lower(); + curvedata.closed = closed == "true" || closed == "1"; COLLADA_PRINT("curve name: " + p_name); diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 93b76767acb..4164ef9959f 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -1074,6 +1074,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, uint32_t p_use_com c->set_point_tilt(i, tilts->array[i]); } } + if (cd.closed && pc > 1) { + Vector3 pos = c->get_point_position(0); + Vector3 in = c->get_point_in(0); + Vector3 out = c->get_point_out(0); + c->add_point(pos, in, out, -1); + } curve_cache[ng->source] = c; path->set_curve(c);