| 1281 | } |
| 1282 | |
| 1283 | IDataWidget* MainWindow::makeSceneDock(const QString& kind, QWidget* parent) { |
| 1284 | // Single construct + wire site for object-widget docks, shared by the drop |
| 1285 | // and layout-restore paths. Wiring (session / transform service / theme) is |
| 1286 | // identical regardless of how the dock is later populated. |
| 1287 | if (kind == QStringLiteral("scene3d")) { |
| 1288 | auto* widget = new Scene3DDockWidget(parent); |
| 1289 | widget->setSessionManager(&session_->sessionManager()); |
| 1290 | widget->setTransformService(transform_service_.get()); |
| 1291 | widget->setSettings(app_settings_.get()); |
| 1292 | // Seed the resolver's per-source remembered-roots map + auto search roots |
| 1293 | // from the most recent load. Single-path approximation (the dock's own |
| 1294 | // dataset may differ in a multi-file session); see setSourcePath's doc. |
| 1295 | if (const auto src = session_->sessionManager().lastLoadedSource(); src.has_value()) { |
| 1296 | widget->setSourcePath(src->path); |
| 1297 | } |
| 1298 | // Apply the persisted scene controls once the lazily-created view exists, so |
| 1299 | // a dock created by layout restore (never bound to the panel) still matches |
| 1300 | // the shared look. Connect for the deferred view, and apply now if it is |
| 1301 | // already realized (M.3). The QSettings schema stays owned by the panel. |
| 1302 | if (scene3d_config_panel_ != nullptr) { |
| 1303 | auto* panel = scene3d_config_panel_; |
| 1304 | connect(widget, &Scene3DDockWidget::sceneViewReady, panel, [panel, widget]() { |
| 1305 | panel->applySceneControlsTo(widget); |
| 1306 | }); |
| 1307 | if (widget->sceneView() != nullptr) { |
| 1308 | panel->applySceneControlsTo(widget); |
| 1309 | } |
| 1310 | } |
| 1311 | // No theme push needed: SceneViewWidget derives dark/light from its own |
| 1312 | // palette luminance and repaints on QEvent::PaletteChange. |
| 1313 | return widget; |
| 1314 | } |
| 1315 | if (kind == QStringLiteral("scene2d")) { |
| 1316 | auto* widget = new Scene2DDockWidget(parent); |
| 1317 | widget->setSessionManager(&session_->sessionManager()); |
| 1318 | return widget; |
| 1319 | } |
| 1320 | return nullptr; |
| 1321 | } |
| 1322 | |
| 1323 | IDataWidget* MainWindow::makeSeededEmptyObjectDock(const QString& kind, QWidget* parent) { |
| 1324 | IDataWidget* widget = makeSceneDock(kind, parent); |
nothing calls this directly
no test coverage detected