| 343 | } |
| 344 | |
| 345 | void ExportOCAF2::exportObjects(std::vector<App::DocumentObject*>& objs, const char* name) |
| 346 | { |
| 347 | if (objs.empty()) { |
| 348 | return; |
| 349 | } |
| 350 | myObjects.clear(); |
| 351 | myNames.clear(); |
| 352 | mySetups.clear(); |
| 353 | if (objs.size() == 1) { |
| 354 | exportObject(objs.front(), nullptr, TDF_Label()); |
| 355 | } |
| 356 | else { |
| 357 | auto label = aShapeTool->NewShape(); |
| 358 | App::Document* doc = nullptr; |
| 359 | bool sameDoc = true; |
| 360 | for (auto obj : objs) { |
| 361 | if (doc) { |
| 362 | sameDoc = sameDoc && doc == obj->getDocument(); |
| 363 | } |
| 364 | else { |
| 365 | doc = obj->getDocument(); |
| 366 | } |
| 367 | exportObject(obj, nullptr, label); |
| 368 | } |
| 369 | |
| 370 | if (!name && doc && sameDoc) { |
| 371 | name = doc->getName(); |
| 372 | } |
| 373 | setName(label, nullptr, name); |
| 374 | } |
| 375 | |
| 376 | if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) { |
| 377 | Tools::dumpLabels(pDoc->Main(), aShapeTool, aColorTool); |
| 378 | } |
| 379 | |
| 380 | // Update is not performed automatically anymore: |
| 381 | // https://tracker.dev.opencascade.org/view.php?id=28055 |
| 382 | aShapeTool->UpdateAssemblies(); |
| 383 | } |
| 384 | |
| 385 | TDF_Label ExportOCAF2::exportObject( |
| 386 | App::DocumentObject* parentObj, |