Merge pull request #67834 from Klowner/collada-closed-curves-16658

Handle closed splines in Collada importer
This commit is contained in:
Clay John 2022-10-27 09:48:21 -07:00 committed by GitHub
commit 8a5e0b8caf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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);

View File

@ -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);