From c401f9d75c945117fbd20a45af3a4a403e5f323b Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Tue, 12 Sep 2017 13:58:50 -0700 Subject: [PATCH] Replace Base property type with LinkSubListGlobal in order to keep Path ops working. --- src/Mod/Path/PathScripts/PathOp.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 7c9c7010a1..bc14b4cac3 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -39,7 +39,7 @@ if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) PathLog.trackModule() else: - PathLog.setLevel(PathLog.Level.NOTICE, PathLog.thisModule()) + PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) # Qt tanslation handling def translate(context, text, disambig=None): @@ -88,6 +88,10 @@ class ObjectOp(object): implementation - otherwise the base functionality might be broken. ''' + def addBaseProperty(self, obj): + obj.addProperty("App::PropertyLinkSubListGlobal", "Base", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The base geometry for this operation")) + + def __init__(self, obj): PathLog.track() @@ -98,7 +102,7 @@ class ObjectOp(object): features = self.opFeatures(obj) if FeatureBaseGeometry & features: - obj.addProperty("App::PropertyLinkSubList", "Base", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The base geometry for this operation")) + self.addBaseProperty(obj) if FeatureLocations & features: obj.addProperty("App::PropertyVectorList", "Locations", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Base locations for this operation")) @@ -129,6 +133,16 @@ class ObjectOp(object): obj.Proxy = self self.setDefaultValues(obj) + def onDocumentRestored(self, obj): + if FeatureBaseGeometry & self.opFeatures(obj) and 'App::PropertyLinkSubList' == obj.getTypeIdOfProperty('Base'): + PathLog.info("Replacing link property with global link (%s)." % obj.State) + base = obj.Base + obj.removeProperty('Base') + self.addBaseProperty(obj) + obj.Base = base + obj.touch() + obj.Document.recompute() + def __getstate__(self): '''__getstat__(self) ... called when receiver is saved. Can safely be overwritten by subclasses.'''