| 519 | } |
| 520 | |
| 521 | ObjectTopicId Scene3DDockWidget::addRobotModelLayer(const QString& urdf_path) { |
| 522 | const ObjectTopicId topic_id = allocateLocalRobotLayerId(); |
| 523 | if (topic_id.id == 0) { |
| 524 | qCWarning(lcScene3DDock) << "addRobotModelLayer: exhausted local topic ids"; |
| 525 | return ObjectTopicId{0}; |
| 526 | } |
| 527 | const QString title = urdf_path.isEmpty() ? tr("Robot model") : QFileInfo(urdf_path).fileName(); |
| 528 | if (!addTopic(topic_id, sdk::BuiltinObjectType::kRobotDescription, title)) { |
| 529 | local_robot_layer_ids_.erase(topic_id.id); |
| 530 | return ObjectTopicId{0}; |
| 531 | } |
| 532 | // One-click flow: point the freshly created File-source layer at the chosen |
| 533 | // URDF immediately (the creator already forced kFile per the PUNCH-4 rule). |
| 534 | if (!urdf_path.isEmpty()) { |
| 535 | if (auto* layer = dynamic_cast<RobotModelLayer*>(layerFor(topic_id)); layer != nullptr) { |
| 536 | layer->setSourceFile(urdf_path); |
| 537 | } |
| 538 | } |
| 539 | return topic_id; |
| 540 | } |
| 541 | |
| 542 | ObjectTopicId Scene3DDockWidget::addRobotModelLayerFromUrl(const QString& url) { |
| 543 | const ObjectTopicId topic_id = allocateLocalRobotLayerId(); |
no test coverage detected