PartDesign: Adopt primitive preview
The preview was developed when the "one feature only" visibility rule was not yet introduced. This commit maks it work again.
This commit is contained in:
parent
6bf31e841e
commit
8b0d53358a
|
@ -621,10 +621,7 @@ TaskPrimitiveParameters::TaskPrimitiveParameters(ViewProviderPrimitive* Primitiv
|
|||
//make sure the relevant things are visible
|
||||
cs_visibility = vp->isVisible();
|
||||
vp->Visibility.setValue(true);
|
||||
if(prm->BaseFeature.getValue()) {
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(prm->BaseFeature.getValue())->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
parameter = new TaskDatumParameters(vp);
|
||||
Content.push_back(parameter);
|
||||
|
||||
|
@ -659,12 +656,7 @@ bool TaskPrimitiveParameters::accept()
|
|||
ViewProviderDatumCoordinateSystem* vp = static_cast<ViewProviderDatumCoordinateSystem*>(
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(cs));
|
||||
vp->setVisible(cs_visibility);
|
||||
|
||||
auto* prm = static_cast<PartDesign::FeaturePrimitive*>(vp_prm->getObject());
|
||||
if(prm->BaseFeature.getValue()) {
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(prm->BaseFeature.getValue())->setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
connection.disconnect();
|
||||
return true;
|
||||
}
|
||||
|
@ -679,15 +671,9 @@ bool TaskPrimitiveParameters::reject() {
|
|||
ViewProviderDatumCoordinateSystem* vp = static_cast<ViewProviderDatumCoordinateSystem*>(
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(cs));
|
||||
|
||||
if(vp) {
|
||||
if(vp)
|
||||
vp->setVisible(cs_visibility);
|
||||
|
||||
auto* prm = static_cast<PartDesign::FeaturePrimitive*>(vp_prm->getObject());
|
||||
if(prm->BaseFeature.getValue()) {
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(prm->BaseFeature.getValue())->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
connection.disconnect();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#ifndef _PreComp_
|
||||
# include <QMessageBox>
|
||||
#include <Inventor/nodes/SoSwitch.h>
|
||||
#endif
|
||||
|
||||
#include <Gui/Command.h>
|
||||
|
@ -237,3 +238,12 @@ void ViewProvider::setBodyMode(bool bodymode) {
|
|||
prop->setStatus(App::Property::Hidden, bodymode);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProvider::makeTemporaryVisible(bool onoff)
|
||||
{
|
||||
//make sure to not use the overridden versions, as they change proeprties
|
||||
if(onoff)
|
||||
Gui::ViewProvider::show();
|
||||
else
|
||||
Gui::ViewProvider::hide();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,12 @@ public:
|
|||
//visual properties, not the features. Hence setting body mode to true will hide most
|
||||
//viewprovider properties.
|
||||
void setBodyMode(bool bodymode);
|
||||
|
||||
//makes this viewprovider visible in the scene graph without chaning any properties,
|
||||
//not the visibility one and also not the display mode. This can be used to show the
|
||||
//shape of this viewprovider from other viewproviders without doing anything to the
|
||||
//document and properties.
|
||||
void makeTemporaryVisible(bool);
|
||||
|
||||
protected:
|
||||
virtual bool setEdit(int ModNum);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
#include <Inventor/nodes/SoSwitch.h>
|
||||
|
@ -282,4 +283,8 @@ void ViewProviderAddSub::setPreviewDisplayMode(bool onoff) {
|
|||
if(!onoff) {
|
||||
setDisplayMaskMode(displayMode.c_str());
|
||||
}
|
||||
|
||||
App::DocumentObject* obj = static_cast<PartDesign::Feature*>(getObject())->BaseFeature.getValue();
|
||||
if(obj)
|
||||
static_cast<PartDesignGui::ViewProvider*>(Gui::Application::Instance->getViewProvider(obj))->makeTemporaryVisible(onoff);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user