Part: Fix AttachmentSupport when loading files from previous versions
Commit 6b6ff58d3c4a ("Part: Rename AttachExtension::Support property to
AttachmentSupport...") provided code to convert property name when loading
files saved with previous versions. Unfortunately a41f176f596a
("Toponaming: bring in missing code fragments in Part") was based on
at the time obsolete code which did not contain before mentioned tweak,
so AttachmentSupport ended unassigned.
Fixes: a41f176f596a ("Toponaming: bring in missing code fragments in Part")
This commit is contained in:
committed by
Chris Hennes
parent
c5de6ccfc7
commit
2bb41bd1e7
@@ -104,14 +104,6 @@ AttachExtension::AttachExtension()
|
||||
"Attach engine object driving the attachment.");
|
||||
AttacherEngine.setEnums(EngineEnums);
|
||||
|
||||
EXTENSION_ADD_PROPERTY_TYPE(
|
||||
Support,
|
||||
(nullptr, nullptr),
|
||||
"Attachment",
|
||||
(App::PropertyType)(App::Prop_Hidden),
|
||||
"Support of the 2D geometry (Deprecated! Use AttachmentSupport instead");
|
||||
Support.setScope(App::LinkScope::Global);
|
||||
|
||||
EXTENSION_ADD_PROPERTY_TYPE(AttachmentSupport,
|
||||
(nullptr, nullptr),
|
||||
"Attachment",
|
||||
@@ -405,24 +397,10 @@ App::DocumentObjectExecReturn* AttachExtension::extensionExecute()
|
||||
void AttachExtension::extensionOnChanged(const App::Property* prop)
|
||||
{
|
||||
if (!getExtendedObject()->isRestoring()) {
|
||||
if (prop == &Support) {
|
||||
if (!prop->testStatus(App::Property::User3)) {
|
||||
Base::ObjectStatusLocker<App::Property::Status, App::Property> guard(
|
||||
App::Property::User3,
|
||||
&Support);
|
||||
AttachmentSupport.Paste(Support);
|
||||
}
|
||||
}
|
||||
else if (prop == &AttacherEngine) {
|
||||
if (prop == &AttacherEngine) {
|
||||
AttacherType.setValue(enumToClass(AttacherEngine.getValueAsString()));
|
||||
}
|
||||
else if (_props.matchProperty(prop)) {
|
||||
if (prop == &AttachmentSupport) {
|
||||
Base::ObjectStatusLocker<App::Property::Status, App::Property> guard(
|
||||
App::Property::User3,
|
||||
&Support);
|
||||
Support.Paste(AttachmentSupport);
|
||||
}
|
||||
_active = -1;
|
||||
updateAttacherVals(/*base*/ false);
|
||||
updatePropertyStatus(isAttacherActive());
|
||||
@@ -443,23 +421,39 @@ void AttachExtension::extensionOnChanged(const App::Property* prop)
|
||||
App::DocumentObjectExtension::extensionOnChanged(prop);
|
||||
}
|
||||
|
||||
void AttachExtension::extHandleChangedPropertyName(Base::XMLReader& reader,
|
||||
const char* TypeName,
|
||||
const char* PropName)
|
||||
bool AttachExtension::extensionHandleChangedPropertyName(Base::XMLReader& reader,
|
||||
const char* TypeName,
|
||||
const char* PropName)
|
||||
{
|
||||
// Was superPlacement
|
||||
Base::Type type = Base::Type::fromName(TypeName);
|
||||
if (AttachmentOffset.getClassTypeId() == type && strcmp(PropName, "superPlacement") == 0) {
|
||||
// superPlacement -> AttachmentOffset
|
||||
if (strcmp(PropName, "superPlacement") == 0 && AttachmentOffset.getClassTypeId() == type) {
|
||||
AttachmentOffset.Restore(reader);
|
||||
return true;
|
||||
}
|
||||
// Support -> AttachmentSupport
|
||||
if (strcmp(PropName, "Support") == 0) {
|
||||
// At one point, the type of Support changed from PropertyLinkSub to its present type
|
||||
// of PropertyLinkSubList. Later, the property name changed to AttachmentSupport
|
||||
App::PropertyLinkSub tmp;
|
||||
if (strcmp(tmp.getTypeId().getName(), TypeName) == 0) {
|
||||
tmp.setContainer(this->getExtendedContainer());
|
||||
tmp.Restore(reader);
|
||||
AttachmentSupport.setValue(tmp.getValue(), tmp.getSubValues());
|
||||
this->MapMode.setValue(Attacher::mmFlatFace);
|
||||
return true;
|
||||
}
|
||||
if (AttachmentSupport.getClassTypeId() == type) {
|
||||
AttachmentSupport.Restore(reader);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return App::DocumentObjectExtension::extensionHandleChangedPropertyName(reader, TypeName, PropName);
|
||||
}
|
||||
|
||||
void AttachExtension::onExtendedDocumentRestored()
|
||||
{
|
||||
try {
|
||||
if (Support.getValue()) {
|
||||
AttachmentSupport.Paste(Support);
|
||||
}
|
||||
initBase(false);
|
||||
if (_baseProps.attachment) {
|
||||
_baseProps.attachment->setScope(App::LinkScope::Hidden);
|
||||
|
||||
@@ -88,7 +88,6 @@ public:
|
||||
|
||||
App::PropertyString AttacherType;
|
||||
App::PropertyEnumeration AttacherEngine;
|
||||
App::PropertyLinkSubList Support; // deprecated, leave here for backward compatibility
|
||||
App::PropertyLinkSubList AttachmentSupport;
|
||||
App::PropertyEnumeration MapMode; // see AttachEngine::eMapMode
|
||||
App::PropertyBool MapReversed; // inverts Z and X internal axes
|
||||
@@ -139,9 +138,9 @@ public:
|
||||
|
||||
protected:
|
||||
void extensionOnChanged(const App::Property* /*prop*/) override;
|
||||
virtual void extHandleChangedPropertyName(Base::XMLReader& reader,
|
||||
const char* TypeName,
|
||||
const char* PropName);
|
||||
virtual bool extensionHandleChangedPropertyName(Base::XMLReader& reader,
|
||||
const char* TypeName,
|
||||
const char* PropName) override;
|
||||
|
||||
App::PropertyPlacement& getPlacement() const;
|
||||
void initBase(bool force);
|
||||
|
||||
Reference in New Issue
Block a user