ReferencePlacement: workaround for FC bug 3564
https://freecadweb.org/tracker/view.php?id=3564
This commit is contained in:
parent
c566979574
commit
340c51b108
|
@ -345,17 +345,28 @@ class ViewProviderLatticeFeature(object):
|
||||||
FreeCAD.Console.PrintError("__init__() of lattice object view provider is overridden. Please don't! Fix it!\n")
|
FreeCAD.Console.PrintError("__init__() of lattice object view provider is overridden. Please don't! Fix it!\n")
|
||||||
except AttributeError as err:
|
except AttributeError as err:
|
||||||
pass # quick-n-dirty fix for Py3. TODO: restore the functionality in Py3, or remove this routine altogether.
|
pass # quick-n-dirty fix for Py3. TODO: restore the functionality in Py3, or remove this routine altogether.
|
||||||
|
|
||||||
|
def fixProxy(self, vobj):
|
||||||
|
if vobj is not self.ViewObject:
|
||||||
|
vobj.Proxy = vobj.ProxyBackup
|
||||||
|
raise RuntimeError('fixing broken proxy...')
|
||||||
|
|
||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
return getIconPath("Lattice.svg")
|
return getIconPath("Lattice.svg")
|
||||||
|
|
||||||
def attach(self, vobj):
|
def attach(self, vobj):
|
||||||
self.ViewObject = vobj
|
self.ViewObject = vobj
|
||||||
self.Object = vobj.Object
|
self.Object = vobj.Object
|
||||||
|
try:
|
||||||
|
vobj.ProxyBackup = self
|
||||||
|
except Exception:
|
||||||
|
vobj.addProperty('App::PropertyPythonObject', 'ProxyBackup', 'Base', "helper property for workaround FC bug #3564", 0, False, True)
|
||||||
|
vobj.ProxyBackup = self
|
||||||
self.makeRefplmVisual(vobj)
|
self.makeRefplmVisual(vobj)
|
||||||
from pivy import coin
|
from pivy import coin
|
||||||
self.modenode = next((node for node in vobj.RootNode.getChildren() if node.isOfType(coin.SoSwitch.getClassTypeId())))
|
self.modenode = next((node for node in vobj.RootNode.getChildren() if node.isOfType(coin.SoSwitch.getClassTypeId())))
|
||||||
|
|
||||||
|
|
||||||
def makeRefplmVisual(self, vobj):
|
def makeRefplmVisual(self, vobj):
|
||||||
import pivy
|
import pivy
|
||||||
from pivy import coin
|
from pivy import coin
|
||||||
|
@ -401,6 +412,7 @@ class ViewProviderLatticeFeature(object):
|
||||||
|
|
||||||
def updateData(self, obj, prop):
|
def updateData(self, obj, prop):
|
||||||
if prop == 'ReferencePlacement' or prop == 'MarkerSizeActual' or prop == 'Placement':
|
if prop == 'ReferencePlacement' or prop == 'MarkerSizeActual' or prop == 'Placement':
|
||||||
|
self.fixProxy(obj.ViewObject)
|
||||||
self.makeRefplmVisual(obj.ViewObject)
|
self.makeRefplmVisual(obj.ViewObject)
|
||||||
|
|
||||||
def onChanged(self, vobj, prop):
|
def onChanged(self, vobj, prop):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user