PartDesign: make MultiTransform honour the "Update view" checkbox when adding transformations
This commit is contained in:
parent
e5d1643878
commit
08043f46c2
|
@ -101,6 +101,8 @@ TaskMultiTransformParameters::TaskMultiTransformParameters(ViewProviderTransform
|
|||
this, SLOT(onMoveDown()));
|
||||
ui->listTransformFeatures->addAction(action);
|
||||
ui->listTransformFeatures->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onUpdateView(bool)));
|
||||
|
||||
connect(ui->listTransformFeatures, SIGNAL(activated(QModelIndex)),
|
||||
this, SLOT(onTransformActivated(QModelIndex)));
|
||||
|
@ -214,7 +216,7 @@ void TaskMultiTransformParameters::onTransformAddMirrored()
|
|||
|
||||
Gui::Command::openCommand("Mirrored");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::Mirrored\",\"%s\")",newFeatName.c_str());
|
||||
Gui::Command::updateActive();
|
||||
//Gui::Command::updateActive();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdMirrorPlane = \"XY\"", newFeatName.c_str());
|
||||
|
||||
finishAdd(newFeatName);
|
||||
|
@ -227,7 +229,7 @@ void TaskMultiTransformParameters::onTransformAddLinearPattern()
|
|||
|
||||
Gui::Command::openCommand("LinearPattern");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::LinearPattern\",\"%s\")",newFeatName.c_str());
|
||||
Gui::Command::updateActive();
|
||||
//Gui::Command::updateActive();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdDirection = \"X\"", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Length = 100", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
|
||||
|
@ -242,7 +244,7 @@ void TaskMultiTransformParameters::onTransformAddPolarPattern()
|
|||
|
||||
Gui::Command::openCommand("PolarPattern");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::PolarPattern\",\"%s\")",newFeatName.c_str());
|
||||
Gui::Command::updateActive();
|
||||
//Gui::Command::updateActive();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdAxis = \"X\"", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Angle = 360", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
|
||||
|
@ -257,7 +259,7 @@ void TaskMultiTransformParameters::onTransformAddScaled()
|
|||
|
||||
Gui::Command::openCommand("Scaled");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::Scaled\",\"%s\")",newFeatName.c_str());
|
||||
Gui::Command::updateActive();
|
||||
//Gui::Command::updateActive();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Factor = 2", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
|
||||
|
||||
|
@ -357,6 +359,13 @@ void TaskMultiTransformParameters::onSubTaskButtonOK() {
|
|||
closeSubTask();
|
||||
}
|
||||
|
||||
void TaskMultiTransformParameters::onUpdateView(bool on)
|
||||
{
|
||||
blockUpdate = !on;
|
||||
if (on)
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
const std::vector<App::DocumentObject*> TaskMultiTransformParameters::getTransformFeatures(void) const
|
||||
{
|
||||
PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(TransformedView->getObject());
|
||||
|
|
|
@ -76,6 +76,7 @@ private Q_SLOTS:
|
|||
virtual void onSubTaskButtonOK();
|
||||
// Note: There is no Cancel button because I couldn't work out how to save the state of
|
||||
// a subFeature so as to revert the changes of an edit operation
|
||||
virtual void onUpdateView(bool);
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent *e);
|
||||
|
|
|
@ -110,7 +110,7 @@ void TaskTransformedParameters::recomputeFeature()
|
|||
if (insideMultiTransform) {
|
||||
// redirect recompute and let the parent decide if recompute has to be blocked
|
||||
parentTask->recomputeFeature();
|
||||
} else if (!blockRecompute) {
|
||||
} else if (!blockUpdate) {
|
||||
PartDesign::Transformed* pcTransformed = static_cast<PartDesign::Transformed*>(TransformedView->getObject());
|
||||
pcTransformed->getDocument()->recomputeFeature(pcTransformed);
|
||||
}
|
||||
|
|
|
@ -94,10 +94,8 @@ protected:
|
|||
TaskMultiTransformParameters* parentTask;
|
||||
/// Flag indicating whether this object is a container for MultiTransform
|
||||
bool insideMultiTransform;
|
||||
/// Lock updateUI() and applying changes to the underlying feature
|
||||
/// Lock updateUI(), applying changes to the underlying feature and calling recomputeFeature()
|
||||
bool blockUpdate;
|
||||
/// Lock recomputeFeature()
|
||||
bool blockRecompute;
|
||||
};
|
||||
|
||||
/// simulation dialog for the TaskView
|
||||
|
|
Loading…
Reference in New Issue
Block a user