MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / loadControlsFromDock

Method loadControlsFromDock

pj_app/src/ui/Scene3DConfigPanel.cpp:559–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559void Scene3DConfigPanel::loadControlsFromDock(Scene3DDockWidget* dock) {
560 if (dock == nullptr) {
561 return;
562 }
563 auto* view = dock->sceneView();
564 if (view == nullptr) {
565 return;
566 }
567 // Inverse of applySceneControlsTo (keep the field set in sync — 4 sites).
568 // Reflect the dock's OWN look in the widgets without echoing it straight back
569 // through the change handlers (which would re-apply + re-persist). Scrubbers
570 // are blocked; the eye toggles are set + their icon refreshed by hand (the
571 // toggled handler that normally swaps the icon is suppressed by the blocker).
572 const auto set_eye = [this](QToolButton* eye, bool on) {
573 const QSignalBlocker block(eye);
574 eye->setChecked(on);
575 setEyeIcon(eye, on);
576 };
577
578 {
579 const QSignalBlocker b_grid_size(grid_size_);
580 const QSignalBlocker b_grid_div(grid_divisions_);
581 const QSignalBlocker b_gizmo_size(gizmo_size_);
582 const QSignalBlocker b_gizmo_op(gizmo_opacity_);
583 const QSignalBlocker b_mesh_op(mesh_opacity_);
584 const QSignalBlocker b_coll_op(collision_opacity_);
585
586 grid_size_->setValue(view->gridExtentMetres());
587 grid_divisions_->setValue(view->gridDivisions());
588 gizmo_size_->setValue(view->gizmoSize());
589 gizmo_opacity_->setValue(view->gizmoOpacity());
590
591 const auto& shading = view->meshShadingParams();
592 mesh_opacity_->setValue(shading.mesh_opacity);
593 collision_opacity_->setValue(shading.collision_opacity);
594 set_eye(mesh_eye_, shading.meshes_visible);
595 set_eye(collision_eye_, shading.collisions_visible);
596 set_eye(shadows_eye_, shading.shadows_enabled);
597 }
598
599 // idClicked (the connected signal) fires only on user clicks, not programmatic
600 // setChecked, so the exclusive style group needs no blocker.
601 (view->gridStyle() == pj::scene3d::GridRenderPass::Style::kFilledCells ? grid_cells_button_ : grid_lines_button_)
602 ->setChecked(true);
603 set_eye(grid_eye_, view->gridVisible());
604 set_eye(gizmo_eye_, view->axesVisible());
605 // Not an eye toggle (static glyph): just reflect the checked state without
606 // echoing back through the toggled handler (which would re-persist/re-apply).
607 {
608 const QSignalBlocker block(tf_lines_button_);
609 tf_lines_button_->setChecked(view->tfConnectionsVisible());
610 }
611}
612
613void Scene3DConfigPanel::setEyeIcon(QToolButton* eye, bool on) {
614 eye->setIcon(loadSvg(QLatin1String(on ? kVisibilityOnPath : kVisibilityOffPath), theme_));

Callers

nothing calls this directly

Calls 11

sceneViewMethod · 0.80
gridExtentMetresMethod · 0.80
gridDivisionsMethod · 0.80
gridStyleMethod · 0.80
axesVisibleMethod · 0.80
tfConnectionsVisibleMethod · 0.80
setCheckedMethod · 0.45
setValueMethod · 0.45
gizmoSizeMethod · 0.45
gizmoOpacityMethod · 0.45
gridVisibleMethod · 0.45

Tested by

no test coverage detected