Sketcher/BackEdit: makes clip plane switch side according to view side

This commit is contained in:
0penBrain
2022-08-31 09:55:31 +02:00
committed by wwmayer
parent 77f83ce716
commit 968fb5be34
3 changed files with 18 additions and 3 deletions

View File

@@ -964,7 +964,17 @@ CmdSketcherViewSection::CmdSketcherViewSection()
void CmdSketcherViewSection::activated(int iMsg)
{
Q_UNUSED(iMsg);
doCommand(Doc,"ActiveSketch.ViewObject.TempoVis.sketchClipPlane(ActiveSketch)");
QString cmdStr = QLatin1String("ActiveSketch.ViewObject.TempoVis.sketchClipPlane(ActiveSketch, None, %1)\n");
Gui::Document *doc = getActiveGuiDocument();
bool revert = false;
if(doc) {
SketcherGui::ViewProviderSketch* vp = dynamic_cast<SketcherGui::ViewProviderSketch*>(doc->getInEdit());
if (vp) {
revert = vp->getViewOrientationFactor() < 0?true:false;
}
}
cmdStr = cmdStr.arg(revert?QLatin1String("True"):QLatin1String("False"));
doCommand(Doc, cmdStr.toLatin1());
}
bool CmdSketcherViewSection::isActive()

View File

@@ -3149,6 +3149,11 @@ void ViewProviderSketch::camSensCB(void *data, SoSensor *)
Base::Console().Log("Switching side, now %s, redrawing\n", tmpFactor < 0 ? "back" : "front");
vp->viewOrientationFactor = tmpFactor;
vp->draw();
QString cmdStr = QStringLiteral(
"ActiveSketch.ViewObject.TempoVis.sketchClipPlane(ActiveSketch, ActiveSketch.ViewObject.SectionView, %1)\n")
.arg(tmpFactor<0?QLatin1String("True"):QLatin1String("False"));
Base::Interpreter().runStringObject(cmdStr.toLatin1());
}
}

View File

@@ -500,6 +500,8 @@ public:
void centerSelection();
/// returns the scale factor
float getScaleFactor() const;
/// returns view orientation factor
int getViewOrientationFactor() const;
//@}
/** @name constraint Virtual Space visibility management */
@@ -685,8 +687,6 @@ private:
int getApplicationLogicalDPIX() const;
int getViewOrientationFactor() const;
double getRotation(SbVec3f pos0, SbVec3f pos1) const;
bool isSketchInvalid() const;