add primitive preview visualization
This commit is contained in:
parent
0a82185b66
commit
c5ae4530ab
|
@ -100,12 +100,14 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri
|
|||
}
|
||||
catch(const Base::Exception&) {
|
||||
|
||||
//as we use this for preview we can add it even if useless for subtractive
|
||||
AddSubShape.setValue(primitiveShape);
|
||||
|
||||
if(getAddSubType() == FeatureAddSub::Additive)
|
||||
Shape.setValue(primitiveShape);
|
||||
else
|
||||
return new App::DocumentObjectExecReturn("Cannot subtract primitive feature without base feature");
|
||||
|
||||
AddSubShape.setValue(base);
|
||||
return new App::DocumentObjectExecReturn("Cannot subtract primitive feature without base feature");
|
||||
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
|
|
|
@ -799,7 +799,6 @@ TaskPrimitiveParameters::TaskPrimitiveParameters(ViewProviderPrimitive* Primitiv
|
|||
vp->Visibility.setValue(true);
|
||||
if(prm->BaseFeature.getValue()) {
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(prm->BaseFeature.getValue())->setVisible(true);
|
||||
vp_prm->setVisible(false);
|
||||
}
|
||||
|
||||
parameter = new TaskDatumParameters(vp);
|
||||
|
@ -827,7 +826,6 @@ bool TaskPrimitiveParameters::accept()
|
|||
if(prm->BaseFeature.getValue()) {
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(prm->BaseFeature.getValue())->setVisible(false);
|
||||
}
|
||||
vp_prm->setVisible(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -849,7 +847,6 @@ bool TaskPrimitiveParameters::reject() {
|
|||
if(prm->BaseFeature.getValue()) {
|
||||
Gui::Application::Instance->activeDocument()->getViewProvider(prm->BaseFeature.getValue())->setVisible(false);
|
||||
}
|
||||
vp_prm->setVisible(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -57,8 +57,6 @@ PROPERTY_SOURCE(PartDesignGui::ViewProviderPrimitive,PartDesignGui::ViewProvider
|
|||
ViewProviderPrimitive::ViewProviderPrimitive()
|
||||
{
|
||||
|
||||
previewSwitch = new SoSwitch();
|
||||
previewSwitch->ref();
|
||||
previewShape = new SoSeparator();
|
||||
previewShape->ref();
|
||||
previewFaceSet = new PartGui::SoBrepFaceSet();
|
||||
|
@ -76,7 +74,6 @@ ViewProviderPrimitive::~ViewProviderPrimitive()
|
|||
previewCoords->unref();
|
||||
previewNorm->unref();
|
||||
previewShape->unref();
|
||||
previewSwitch->unref();
|
||||
}
|
||||
|
||||
void ViewProviderPrimitive::attach(App::DocumentObject* obj) {
|
||||
|
@ -101,9 +98,8 @@ void ViewProviderPrimitive::attach(App::DocumentObject* obj) {
|
|||
previewShape->addChild(previewCoords);
|
||||
previewShape->addChild(previewNorm);
|
||||
previewShape->addChild(previewFaceSet);
|
||||
previewSwitch->addChild(previewShape);
|
||||
previewSwitch->whichChild = -1;
|
||||
getRoot()->addChild(previewSwitch);
|
||||
|
||||
addDisplayMaskMode(previewShape, "Shape preview");
|
||||
updateAddSubShapeIndicator();
|
||||
}
|
||||
|
||||
|
@ -272,7 +268,8 @@ void ViewProviderPrimitive::updateAddSubShapeIndicator() {
|
|||
|
||||
bool ViewProviderPrimitive::setEdit(int ModNum)
|
||||
{
|
||||
previewSwitch->whichChild = 0;
|
||||
displayMode = getActiveDisplayMode();
|
||||
setDisplayMaskMode("Shape preview");
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// When double-clicking on the item for this fillet the
|
||||
// object unsets and sets its edit mode without closing
|
||||
|
@ -314,7 +311,7 @@ bool ViewProviderPrimitive::setEdit(int ModNum)
|
|||
}
|
||||
|
||||
void ViewProviderPrimitive::unsetEdit(int ModNum) {
|
||||
previewSwitch->whichChild = -1;
|
||||
setDisplayMaskMode(displayMode.c_str());
|
||||
}
|
||||
|
||||
void ViewProviderPrimitive::updateData(const App::Property* p) {
|
||||
|
@ -375,4 +372,3 @@ QIcon ViewProviderPrimitive::getIcon(void) const {
|
|||
str += QString::fromAscii(".svg");
|
||||
return Gui::BitmapFactory().pixmap(str.toStdString().c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "ViewProvider.h"
|
||||
#include <Mod/Part/Gui/SoBrepFaceSet.h>
|
||||
|
||||
class SoSwitch;
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
class PartDesignGuiExport ViewProviderPrimitive : public ViewProvider
|
||||
|
@ -52,7 +50,7 @@ protected:
|
|||
|
||||
void updateAddSubShapeIndicator();
|
||||
|
||||
SoSwitch* previewSwitch;
|
||||
std::string displayMode;
|
||||
SoSeparator* previewShape;
|
||||
PartGui::SoBrepFaceSet* previewFaceSet;
|
||||
SoCoordinate3* previewCoords;
|
||||
|
|
Loading…
Reference in New Issue
Block a user