Merge branch 'master' of github.com:FreeCAD/FreeCAD

This commit is contained in:
Yorik van Havre
2021-02-25 13:30:09 +01:00
3 changed files with 21 additions and 0 deletions

View File

@@ -93,6 +93,19 @@ DrawView::~DrawView()
{
}
App::DocumentObjectExecReturn *DrawView::recompute(void)
{
try {
return App::DocumentObject::recompute();
}
catch (Standard_Failure& e) {
App::DocumentObjectExecReturn* ret = new App::DocumentObjectExecReturn(e.GetMessageString());
if (ret->Why.empty())
ret->Why = "Unknown OCC exception";
return ret;
}
}
App::DocumentObjectExecReturn *DrawView::execute(void)
{
// Base::Console().Message("DV::execute() - %s touched: %d\n", getNameInDocument(), isTouched());

View File

@@ -66,6 +66,7 @@ public:
/** @name methods override Feature */
//@{
/// recalculate the Feature
virtual App::DocumentObjectExecReturn *recompute() override;
virtual App::DocumentObjectExecReturn *execute(void) override;
virtual void onDocumentRestored() override;
virtual short mustExecute() const override;

View File

@@ -335,6 +335,13 @@ short DrawViewPart::mustExecute() const
void DrawViewPart::onChanged(const App::Property* prop)
{
// If the user has set PropertyVector Direction to zero, set it along the default value instead (Front View).
// Otherwise bad things will happen because there'll be a normalization for direction calculations later.
Base::Vector3d dir = Direction.getValue();
if (DrawUtil::fpCompare(dir.Length(), 0.0)) {
Direction.setValue(Base::Vector3d(0.0, -1.0, 0.0));
}
DrawView::onChanged(prop);
//TODO: when scale changes, any Dimensions for this View sb recalculated. DVD should pick this up subject to topological naming issues.