summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorMark Riedesel <mark@klowner.com>2022-10-24 09:33:03 -0500
committerMark Riedesel <mark@klowner.com>2022-10-24 09:35:09 -0500
commit8f7ab02bc637975a707455563f4954c2c43e976d (patch)
tree61bc8a1061870b58dbab72d2cd2d55f329f80480 /editor
parent040f49ed6e71a6e7f23d763c4b56095cbf319ef7 (diff)
Handle closed splines in Collada importer
Diffstat (limited to 'editor')
-rw-r--r--editor/import/collada.cpp2
-rw-r--r--editor/import/editor_import_collada.cpp6
2 files changed, 8 insertions, 0 deletions
diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp
index 7cf35c519b..c54b10842f 100644
--- a/editor/import/collada.cpp
+++ b/editor/import/collada.cpp
@@ -848,6 +848,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 8d44329022..6890a46193 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1090,6 +1090,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
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);