Fix icons in tree lost after save-load sequence
This commit is contained in:
parent
e65a1650b3
commit
ef51f78aab
|
@ -38,7 +38,7 @@ import latticeCompoundExplorer as LCE
|
|||
|
||||
def makeLatticeApply(name):
|
||||
'''makeLatticeApply(name): makes a LatticeApply object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeApply,'Lattice_Apply.svg', ViewProviderLatticeApply)
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeApply, ViewProviderLatticeApply)
|
||||
|
||||
class LatticeApply(latticeBaseFeature.LatticeFeature):
|
||||
"The Lattice Apply object"
|
||||
|
@ -111,6 +111,9 @@ class LatticeApply(latticeBaseFeature.LatticeFeature):
|
|||
|
||||
class ViewProviderLatticeApply(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath("Lattice_Apply.svg")
|
||||
|
||||
def claimChildren(self):
|
||||
return [self.Object.Base, self.Object.Tool]
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import latticeGeomUtils as Utils
|
|||
|
||||
def makeLatticeArrayFromShape(name):
|
||||
'''makeLatticeArrayFromShape(name): makes a LatticeArrayFromShape object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeArrayFromShape,'Lattice_ArrayFromShape.svg')
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeArrayFromShape, ViewProviderArrayFromShape)
|
||||
|
||||
class LatticeArrayFromShape(latticeBaseFeature.LatticeFeature):
|
||||
"The Lattice ArrayFromShape object"
|
||||
|
@ -167,6 +167,12 @@ class LatticeArrayFromShape(latticeBaseFeature.LatticeFeature):
|
|||
break #output just one placement if modes are set so that placement does not depend on current child
|
||||
return outputPlms
|
||||
|
||||
|
||||
class ViewProviderArrayFromShape(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath('Lattice_ArrayFromShape.svg')
|
||||
|
||||
# -------------------------- /document object --------------------------------------------------
|
||||
|
||||
# -------------------------- Gui command --------------------------------------------------
|
||||
|
|
|
@ -46,7 +46,7 @@ def getDefShapeColor():
|
|||
return (r/255.0, g/255.0, b/255.0, (255-o)/255.0)
|
||||
|
||||
|
||||
def makeLatticeFeature(name, AppClass, icon, ViewClass = None):
|
||||
def makeLatticeFeature(name, AppClass, ViewClass):
|
||||
'''makeLatticeFeature(name, AppClass, ViewClass = None): makes a document object for a LatticeFeature-derived object.'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
AppClass(obj)
|
||||
|
@ -55,8 +55,6 @@ def makeLatticeFeature(name, AppClass, icon, ViewClass = None):
|
|||
else:
|
||||
vp = ViewProviderLatticeFeature(obj.ViewObject)
|
||||
|
||||
vp.icon = icon
|
||||
|
||||
return obj
|
||||
|
||||
|
||||
|
@ -189,10 +187,6 @@ class ViewProviderLatticeFeature:
|
|||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
self.Object.Proxy.verifyIntegrity(self.Object)
|
||||
if hasattr(self, "icon"):
|
||||
if self.icon:
|
||||
return getIconPath(self.icon)
|
||||
return getIconPath("Lattice.svg")
|
||||
|
||||
def attach(self, vobj):
|
||||
|
@ -213,6 +207,7 @@ class ViewProviderLatticeFeature:
|
|||
return None
|
||||
|
||||
def claimChildren(self):
|
||||
self.Object.Proxy.verifyIntegrity(self.Object)
|
||||
return []
|
||||
|
||||
def onDelete(self, feature, subelements): # subelements is a tuple of strings
|
||||
|
|
|
@ -38,7 +38,7 @@ import latticeCompoundExplorer as LCE
|
|||
|
||||
def makeCompose(name):
|
||||
'''makeCompose(name): makes a Compose object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, Compose,'Lattice_Compose.svg', ViewProviderCompose)
|
||||
return latticeBaseFeature.makeLatticeFeature(name, Compose, ViewProviderCompose)
|
||||
|
||||
class Compose(latticeBaseFeature.LatticeFeature):
|
||||
"The Lattice Compose object"
|
||||
|
@ -165,6 +165,9 @@ class Compose(latticeBaseFeature.LatticeFeature):
|
|||
obj.Shape = Part.makeCompound(outputShapes)
|
||||
|
||||
class ViewProviderCompose(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath('Lattice_Compose.svg')
|
||||
|
||||
def claimChildren(self):
|
||||
return [self.Object.Base, self.Object.Tool]
|
||||
|
|
|
@ -35,7 +35,7 @@ import latticeBaseFeature
|
|||
|
||||
def makeLatticePlacement(name):
|
||||
'''makePlacement(name): makes a Placement object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticePlacement,'Lattice_Placement.svg')
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticePlacement, ViewProviderLatticePlacement)
|
||||
|
||||
class LatticePlacement(latticeBaseFeature.LatticeFeature):
|
||||
"The Lattice Placement object"
|
||||
|
@ -88,7 +88,12 @@ class LatticePlacement(latticeBaseFeature.LatticeFeature):
|
|||
|
||||
return [App.Placement()] #always return default placement, because Placement property is automatically applied on top of it.
|
||||
|
||||
# -------------------------- /common stuff --------------------------------------------------
|
||||
class ViewProviderLatticePlacement(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath('Lattice_Placement.svg')
|
||||
|
||||
# -------------------------- /document object --------------------------------------------------
|
||||
|
||||
# -------------------------- Gui command --------------------------------------------------
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ import latticeBaseFeature
|
|||
|
||||
def makePolarArray(name):
|
||||
'''makePolarArray(name): makes a PolarArray object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, PolarArray,'Lattice_PolarArray.svg')
|
||||
return latticeBaseFeature.makeLatticeFeature(name, PolarArray, ViewProviderPolarArray)
|
||||
|
||||
class PolarArray(latticeBaseFeature.LatticeFeature):
|
||||
"The Lattice PolarArray object"
|
||||
|
@ -191,7 +191,12 @@ class PolarArray(latticeBaseFeature.LatticeFeature):
|
|||
|
||||
return output
|
||||
|
||||
# -------------------------- /common stuff --------------------------------------------------
|
||||
class ViewProviderPolarArray(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath('Lattice_PolarArray.svg')
|
||||
|
||||
# -------------------------- /document object --------------------------------------------------
|
||||
|
||||
# -------------------------- Gui command --------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user