diff --git a/src/Gui/PreferencePages/DlgSettingsNavigation.cpp b/src/Gui/PreferencePages/DlgSettingsNavigation.cpp index af4c8372aa..9e307a8816 100644 --- a/src/Gui/PreferencePages/DlgSettingsNavigation.cpp +++ b/src/Gui/PreferencePages/DlgSettingsNavigation.cpp @@ -58,6 +58,7 @@ DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent) { ui->setupUi(this); ui->naviCubeBaseColor->setAllowTransparency(true); + ui->rotationCenterColor->setAllowTransparency(true); retranslate(); } @@ -84,7 +85,8 @@ void DlgSettingsNavigation::saveSettings() ui->checkBoxZoomAtCursor->onSave(); ui->checkBoxInvertZoom->onSave(); ui->checkBoxDisableTilt->onSave(); - ui->checkBoxShowRotationCenter->onSave(); + ui->rotationCenterSize->onSave(); + ui->rotationCenterColor->onSave(); ui->spinBoxZoomStep->onSave(); ui->checkBoxNavigationAnimations->onSave(); ui->spinBoxAnimationDuration->onSave(); @@ -98,6 +100,9 @@ void DlgSettingsNavigation::saveSettings() bool showNaviCube = ui->groupBoxNaviCube->isChecked(); hGrp->SetBool("ShowNaviCube", showNaviCube); + bool showRotationCenter = ui->groupBoxRotationCenter->isChecked(); + hGrp->SetBool("ShowRotationCenter", showRotationCenter); + QVariant camera = ui->comboNewDocView->itemData(ui->comboNewDocView->currentIndex(), Qt::UserRole); hGrp->SetASCII("NewDocumentCameraOrientation", (const char*)camera.toByteArray()); @@ -122,7 +127,8 @@ void DlgSettingsNavigation::loadSettings() ui->checkBoxZoomAtCursor->onRestore(); ui->checkBoxInvertZoom->onRestore(); ui->checkBoxDisableTilt->onRestore(); - ui->checkBoxShowRotationCenter->onRestore(); + ui->rotationCenterSize->onRestore(); + ui->rotationCenterColor->onRestore(); ui->spinBoxZoomStep->onRestore(); ui->checkBoxNavigationAnimations->onRestore(); ui->spinBoxAnimationDuration->onRestore(); @@ -149,6 +155,9 @@ void DlgSettingsNavigation::loadSettings() bool showNaviCube = hGrp->GetBool("ShowNaviCube", true); ui->groupBoxNaviCube->setChecked(showNaviCube); + bool showRotationCenter = hGrp->GetBool("ShowRotationCenter", true); + ui->groupBoxRotationCenter->setChecked(showRotationCenter); + ui->comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric")); ui->comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric")); ui->comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric")); diff --git a/src/Gui/PreferencePages/DlgSettingsNavigation.ui b/src/Gui/PreferencePages/DlgSettingsNavigation.ui index c107e57cf2..2e7879bdd9 100644 --- a/src/Gui/PreferencePages/DlgSettingsNavigation.ui +++ b/src/Gui/PreferencePages/DlgSettingsNavigation.ui @@ -6,8 +6,8 @@ 0 0 - 432 - 423 + 484 + 586 @@ -229,6 +229,99 @@ + + + + Rotation center indicator + + + true + + + + + + Sphere size + + + + + + + Color and transparency + + + + + + + + 60 + 16777215 + + + + The size of the rotation center indicator + + + 1 + + + 1.0 + + + 100.0 + + + 0.5 + + + 5.0 + + + RotationCenterSize + + + View + + + + + + + The color of the rotation center indicator + + + + 255 + 0 + 0 + + + + RotationCenterColor + + + View + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + @@ -679,25 +772,6 @@ Mouse tilting is not disabled by this setting. - - - - Show the rotation center when dragging. - - - Enable rotation center indication - - - true - - - ShowRotationCenter - - - View - - - diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index d5636d75f5..4ca6a20fb9 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1319,6 +1319,17 @@ void View3DInventorViewer::showRotationCenter(bool show) } if (!rotationCenterGroup) { + float size = App::GetApplication() + .GetParameterGroupByPath("User parameter:BaseApp/Preferences/View") + ->GetFloat("RotationCenterSize", 5.0); + + unsigned long rotationCenterColor = + App::GetApplication() + .GetParameterGroupByPath("User parameter:BaseApp/Preferences/View") + ->GetUnsigned("RotationCenterColor", 4278190131); + + QColor color = App::Color::fromPackedRGBA(rotationCenterColor); + rotationCenterGroup = new SoSkipBoundingGroup(); auto sphere = new SoSphere(); @@ -1334,8 +1345,8 @@ void View3DInventorViewer::showRotationCenter(bool show) complexity->value = 1; auto material = new SoMaterial(); - material->emissiveColor = SbColor(1, 0, 0); - material->transparency = 0.8F; + material->emissiveColor = SbColor(color.redF(), color.greenF(), color.blueF()); + material->transparency = 1.0F - color.alphaF(); auto translation = new SoTranslation(); translation->translation.setValue(center); @@ -1347,7 +1358,7 @@ void View3DInventorViewer::showRotationCenter(bool show) auto scaledSphere = new SoShapeScale(); scaledSphere->setPart("shape", annotation); - scaledSphere->scaleFactor = 4.0; + scaledSphere->scaleFactor = size; rotationCenterGroup->addChild(translation); rotationCenterGroup->addChild(hidden);