support of loading old projects with shape binder or PartDesign boolean
This commit is contained in:
@@ -939,8 +939,8 @@ void PropertyLinkSubList::Restore(Base::XMLReader &reader)
|
||||
// referenced objects in XML which do not exist anymore in the new
|
||||
// document. Thus, we should silently ignore this.
|
||||
// Property not in an object!
|
||||
DocumentObject* father = static_cast<DocumentObject*>(getContainer());
|
||||
App::Document* document = father->getDocument();
|
||||
DocumentObject* father = dynamic_cast<DocumentObject*>(getContainer());
|
||||
App::Document* document = father ? father->getDocument() : 0;
|
||||
DocumentObject* child = document ? document->getObject(name.c_str()) : 0;
|
||||
if (child)
|
||||
values.push_back(child);
|
||||
|
||||
@@ -149,4 +149,13 @@ void Boolean::onChanged(const App::Property* prop) {
|
||||
PartDesign::Feature::onChanged(prop);
|
||||
}
|
||||
|
||||
void Boolean::handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName)
|
||||
{
|
||||
// The App::PropertyLinkList property was Bodies in the past
|
||||
Base::Type type = Base::Type::fromName(TypeName);
|
||||
if (Group.getClassTypeId() == type && strcmp(PropName, "Bodies") == 0) {
|
||||
Group.Restore(reader);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ public:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
//@}
|
||||
|
||||
protected:
|
||||
void handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName);
|
||||
|
||||
private:
|
||||
static const char* TypeEnums[];
|
||||
|
||||
|
||||
@@ -149,3 +149,11 @@ Part::TopoShape ShapeBinder::buildShapeFromReferences( Part::Feature* obj, std::
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
void ShapeBinder::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
{
|
||||
// The type of Support was App::PropertyLinkSubList in the past
|
||||
if (prop == &Support && strcmp(TypeName, "App::PropertyLinkSubList") == 0) {
|
||||
Support.Restore(reader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop);
|
||||
virtual short int mustExecute(void) const;
|
||||
virtual App::DocumentObjectExecReturn* execute(void);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user