| 1271 | } |
| 1272 | |
| 1273 | void Viewer::loadMesh(const mx::FilePath& filename) |
| 1274 | { |
| 1275 | _geometryHandler->clearGeometry(); |
| 1276 | if (_geometryHandler->loadGeometry(filename)) |
| 1277 | { |
| 1278 | _meshFilename = filename; |
| 1279 | if (_splitByUdims) |
| 1280 | { |
| 1281 | for (auto mesh : _geometryHandler->getMeshes()) |
| 1282 | { |
| 1283 | mesh->splitByUdims(); |
| 1284 | } |
| 1285 | } |
| 1286 | |
| 1287 | updateGeometrySelections(); |
| 1288 | |
| 1289 | // Assign the selected material to all geometries. |
| 1290 | _materialAssignments.clear(); |
| 1291 | mx::MaterialPtr material = getSelectedMaterial(); |
| 1292 | if (material) |
| 1293 | { |
| 1294 | for (mx::MeshPartitionPtr geom : _geometryList) |
| 1295 | { |
| 1296 | assignMaterial(geom, material); |
| 1297 | } |
| 1298 | } |
| 1299 | |
| 1300 | // Unbind utility materials from the previous geometry. |
| 1301 | if (_wireMaterial) |
| 1302 | { |
| 1303 | _wireMaterial->unbindGeometry(); |
| 1304 | } |
| 1305 | if (_shadowMaterial) |
| 1306 | { |
| 1307 | _shadowMaterial->unbindGeometry(); |
| 1308 | } |
| 1309 | |
| 1310 | invalidateShadowMap(); |
| 1311 | } |
| 1312 | else |
| 1313 | { |
| 1314 | new ng::MessageDialog(this, ng::MessageDialog::Type::Warning, "Mesh Loading Error", filename); |
| 1315 | } |
| 1316 | } |
| 1317 | |
| 1318 | void Viewer::loadDocument(const mx::FilePath& filename, mx::DocumentPtr libraries) |
| 1319 | { |
nothing calls this directly
no test coverage detected