[PD] fix pad/pocket UI issues
- update the preview when the direction is changed in the dialog - don't uncheck the direction viewbox without any reason - only recompute once - update the direction information on reversion - only pocket: add missing code we have in pad (proper code merging will follow the next days)
This commit is contained in:
@@ -474,13 +474,6 @@ void TaskPadParameters::onDirectionCBChanged(int num)
|
||||
// in case the user is in selection mode, but changed his mind before selecting anything
|
||||
exitSelectionMode();
|
||||
|
||||
try {
|
||||
recomputeFeature();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
e.ReportException();
|
||||
}
|
||||
|
||||
// disable AlongSketchNormal when the direction is already normal
|
||||
if (num == 0)
|
||||
ui->checkBoxAlongDirection->setEnabled(false);
|
||||
@@ -492,7 +485,6 @@ void TaskPadParameters::onDirectionCBChanged(int num)
|
||||
pcPad->UseCustomVector.setValue(true);
|
||||
}
|
||||
else {
|
||||
ui->checkBoxDirection->setChecked(false);
|
||||
pcPad->UseCustomVector.setValue(false);
|
||||
}
|
||||
// if we dont use custom direction, only allow to show its direction
|
||||
@@ -507,7 +499,13 @@ void TaskPadParameters::onDirectionCBChanged(int num)
|
||||
ui->ZDirectionEdit->setEnabled(true);
|
||||
}
|
||||
// recompute and update the direction
|
||||
recomputeFeature();
|
||||
pcPad->ReferenceAxis.setValue(lnk.getValue(), lnk.getSubValues());
|
||||
try {
|
||||
recomputeFeature();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
e.ReportException();
|
||||
}
|
||||
updateDirectionEdits();
|
||||
}
|
||||
|
||||
@@ -531,7 +529,7 @@ void TaskPadParameters::onXDirectionEditChanged(double len)
|
||||
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(vp->getObject());
|
||||
pcPad->Direction.setValue(len, pcPad->Direction.getValue().y, pcPad->Direction.getValue().z);
|
||||
recomputeFeature();
|
||||
// checking for case of a null vector is done in FeaturePad.cpp
|
||||
// checking for case of a null vector is done in FeatureExtrude.cpp
|
||||
// if there was a null vector, the normal vector of the sketch is used.
|
||||
// therefore the vector component edits must be updated
|
||||
updateDirectionEdits();
|
||||
@@ -553,16 +551,23 @@ void TaskPadParameters::onZDirectionEditChanged(double len)
|
||||
updateDirectionEdits();
|
||||
}
|
||||
|
||||
void TaskPadParameters::updateDirectionEdits(void)
|
||||
void TaskPadParameters::updateDirectionEdits(bool Reversed)
|
||||
{
|
||||
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(vp->getObject());
|
||||
// we don't want to execute the onChanged edits, but just update their contents
|
||||
ui->XDirectionEdit->blockSignals(true);
|
||||
ui->YDirectionEdit->blockSignals(true);
|
||||
ui->ZDirectionEdit->blockSignals(true);
|
||||
ui->XDirectionEdit->setValue(pcPad->Direction.getValue().x);
|
||||
ui->YDirectionEdit->setValue(pcPad->Direction.getValue().y);
|
||||
ui->ZDirectionEdit->setValue(pcPad->Direction.getValue().z);
|
||||
if (Reversed) {
|
||||
ui->XDirectionEdit->setValue(-1 * pcPad->Direction.getValue().x);
|
||||
ui->YDirectionEdit->setValue(-1 * pcPad->Direction.getValue().y);
|
||||
ui->ZDirectionEdit->setValue(-1 * pcPad->Direction.getValue().z);
|
||||
}
|
||||
else {
|
||||
ui->XDirectionEdit->setValue(pcPad->Direction.getValue().x);
|
||||
ui->YDirectionEdit->setValue(pcPad->Direction.getValue().y);
|
||||
ui->ZDirectionEdit->setValue(pcPad->Direction.getValue().z);
|
||||
}
|
||||
ui->XDirectionEdit->blockSignals(false);
|
||||
ui->YDirectionEdit->blockSignals(false);
|
||||
ui->ZDirectionEdit->blockSignals(false);
|
||||
@@ -592,7 +597,7 @@ void TaskPadParameters::onReversedChanged(bool on)
|
||||
ui->checkBoxMidplane->setEnabled(!on);
|
||||
recomputeFeature();
|
||||
// update the direction
|
||||
updateDirectionEdits();
|
||||
updateDirectionEdits(on);
|
||||
}
|
||||
|
||||
void TaskPadParameters::onModeChanged(int index)
|
||||
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
QString getFaceName(void) const;
|
||||
void onSelectionChanged(const Gui::SelectionChanges& msg) override;
|
||||
void updateUI(int index);
|
||||
void updateDirectionEdits(void);
|
||||
void updateDirectionEdits(bool Reversed = false);
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
|
||||
@@ -478,13 +478,6 @@ void TaskPocketParameters::onDirectionCBChanged(int num)
|
||||
// in case the user is in selection mode, but changed his mind before selecting anything
|
||||
exitSelectionMode();
|
||||
|
||||
try {
|
||||
recomputeFeature();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
e.ReportException();
|
||||
}
|
||||
|
||||
// disable AlongSketchNormal when the direction is already normal
|
||||
if (num == 0)
|
||||
ui->checkBoxAlongDirection->setEnabled(false);
|
||||
@@ -497,7 +490,6 @@ void TaskPocketParameters::onDirectionCBChanged(int num)
|
||||
pcPocket->UseCustomVector.setValue(true);
|
||||
}
|
||||
else {
|
||||
ui->checkBoxDirection->setChecked(false);
|
||||
pcPocket->UseCustomVector.setValue(false);
|
||||
}
|
||||
// if we dont use custom direction, only allow to show its direction
|
||||
@@ -512,7 +504,13 @@ void TaskPocketParameters::onDirectionCBChanged(int num)
|
||||
ui->ZDirectionEdit->setEnabled(true);
|
||||
}
|
||||
// recompute and update the direction
|
||||
recomputeFeature();
|
||||
pcPocket->ReferenceAxis.setValue(lnk.getValue(), lnk.getSubValues());
|
||||
try {
|
||||
recomputeFeature();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
e.ReportException();
|
||||
}
|
||||
updateDirectionEdits();
|
||||
}
|
||||
|
||||
@@ -536,7 +534,7 @@ void TaskPocketParameters::onXDirectionEditChanged(double len)
|
||||
PartDesign::Pocket* pcPocket = static_cast<PartDesign::Pocket*>(vp->getObject());
|
||||
pcPocket->Direction.setValue(len, pcPocket->Direction.getValue().y, pcPocket->Direction.getValue().z);
|
||||
recomputeFeature();
|
||||
// checking for case of a null vector is done in FeaturePocket.cpp
|
||||
// checking for case of a null vector is done in FeatureExtrude.cpp
|
||||
// if there was a null vector, the normal vector of the sketch is used.
|
||||
// therefore the vector component edits must be updated
|
||||
updateDirectionEdits();
|
||||
@@ -558,16 +556,23 @@ void TaskPocketParameters::onZDirectionEditChanged(double len)
|
||||
updateDirectionEdits();
|
||||
}
|
||||
|
||||
void TaskPocketParameters::updateDirectionEdits(void)
|
||||
void TaskPocketParameters::updateDirectionEdits(bool Reversed)
|
||||
{
|
||||
PartDesign::Pocket* pcPocket = static_cast<PartDesign::Pocket*>(vp->getObject());
|
||||
// we don't want to execute the onChanged edits, but just update their contents
|
||||
ui->XDirectionEdit->blockSignals(true);
|
||||
ui->YDirectionEdit->blockSignals(true);
|
||||
ui->ZDirectionEdit->blockSignals(true);
|
||||
ui->XDirectionEdit->setValue(pcPocket->Direction.getValue().x);
|
||||
ui->YDirectionEdit->setValue(pcPocket->Direction.getValue().y);
|
||||
ui->ZDirectionEdit->setValue(pcPocket->Direction.getValue().z);
|
||||
if (Reversed) {
|
||||
ui->XDirectionEdit->setValue(-1 * pcPocket->Direction.getValue().x);
|
||||
ui->YDirectionEdit->setValue(-1 * pcPocket->Direction.getValue().y);
|
||||
ui->ZDirectionEdit->setValue(-1 * pcPocket->Direction.getValue().z);
|
||||
}
|
||||
else {
|
||||
ui->XDirectionEdit->setValue(pcPocket->Direction.getValue().x);
|
||||
ui->YDirectionEdit->setValue(pcPocket->Direction.getValue().y);
|
||||
ui->ZDirectionEdit->setValue(pcPocket->Direction.getValue().z);
|
||||
}
|
||||
ui->XDirectionEdit->blockSignals(false);
|
||||
ui->YDirectionEdit->blockSignals(false);
|
||||
ui->ZDirectionEdit->blockSignals(false);
|
||||
@@ -585,7 +590,11 @@ void TaskPocketParameters::onReversedChanged(bool on)
|
||||
{
|
||||
PartDesign::Pocket* pcPocket = static_cast<PartDesign::Pocket*>(vp->getObject());
|
||||
pcPocket->Reversed.setValue(on);
|
||||
// midplane is not sensible when reversed
|
||||
ui->checkBoxMidplane->setEnabled(!on);
|
||||
recomputeFeature();
|
||||
// update the direction
|
||||
updateDirectionEdits(on);
|
||||
}
|
||||
|
||||
void TaskPocketParameters::onModeChanged(int index)
|
||||
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
|
||||
void onSelectionChanged(const Gui::SelectionChanges& msg) override;
|
||||
void updateUI(int index);
|
||||
void updateDirectionEdits(void);
|
||||
void updateDirectionEdits(bool Reversed = false);
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
|
||||
Reference in New Issue
Block a user