TD: Fix loading project files

With PR 19941 there is a regression where parts of the document
won't be restored. This is caused by overriding the virtual method
handleChangedPropertyType() but not calling the method of the base class.

While searching for a fix another problem showed up where (due to the
incomplete loading) exceptions are thrown but not handled within TD.
Therefore the method recompute() is overridden in DrawView to also handle
OCC exceptions.
This commit is contained in:
wmayer
2025-04-13 17:49:44 +02:00
committed by Ladislav Michl
parent cd31d0e698
commit eb2c6bf73f
4 changed files with 19 additions and 0 deletions

View File

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

View File

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

View File

@@ -1537,6 +1537,8 @@ void DrawViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char
}
return;
}
DrawView::handleChangedPropertyType(reader, TypeName, prop);
}
// true if owner->element is a cosmetic vertex

View File

@@ -1254,6 +1254,8 @@ void DrawViewSection::handleChangedPropertyType(Base::XMLReader &reader, const c
}
return;
}
DrawViewPart::handleChangedPropertyType(reader, TypeName, prop);
}
// checks that SectionNormal and XDirection are perpendicular and that Direction is the same as