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:
@@ -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());
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
|
||||
/** @name methods override Feature */
|
||||
//@{
|
||||
App::DocumentObjectExecReturn* recompute() override;
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
void onDocumentRestored() override;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user