gui: change auto element visibility command behavior
This commit is contained in:
parent
2dcbb2e1fb
commit
5dacdb4fde
11
assembly.py
11
assembly.py
|
@ -561,8 +561,7 @@ class ViewProviderAsmElement(ViewProviderAsmOnTop):
|
||||||
|
|
||||||
def attach(self,vobj):
|
def attach(self,vobj):
|
||||||
super(ViewProviderAsmElement,self).attach(vobj)
|
super(ViewProviderAsmElement,self).attach(vobj)
|
||||||
if gui.AsmCmdManager.AutoElementVis:
|
vobj.OnTopWhenSelected = 2
|
||||||
vobj.OnTopWhenSelected = 2
|
|
||||||
|
|
||||||
def getDefaultColor(self):
|
def getDefaultColor(self):
|
||||||
return (60.0/255.0,1.0,1.0)
|
return (60.0/255.0,1.0,1.0)
|
||||||
|
@ -956,7 +955,7 @@ class AsmElementLink(AsmBase):
|
||||||
ViewProviderAsmElementLink(link.ViewObject)
|
ViewProviderAsmElementLink(link.ViewObject)
|
||||||
info.Constraint.setLink({-1:link})
|
info.Constraint.setLink({-1:link})
|
||||||
link.Proxy.setLink(info.Owner,info.Subname)
|
link.Proxy.setLink(info.Owner,info.Subname)
|
||||||
if not gui.AsmCmdManager.AutoElementVis:
|
if gui.AsmCmdManager.AutoElementVis:
|
||||||
info.Constraint.setElementVisible(link.Name,False)
|
info.Constraint.setElementVisible(link.Name,False)
|
||||||
return link
|
return link
|
||||||
|
|
||||||
|
@ -974,8 +973,7 @@ class ViewProviderAsmElementLink(ViewProviderAsmOnTop):
|
||||||
|
|
||||||
def attach(self,vobj):
|
def attach(self,vobj):
|
||||||
super(ViewProviderAsmElementLink,self).attach(vobj)
|
super(ViewProviderAsmElementLink,self).attach(vobj)
|
||||||
if gui.AsmCmdManager.AutoElementVis:
|
vobj.OnTopWhenSelected = 2
|
||||||
vobj.OnTopWhenSelected = 2
|
|
||||||
|
|
||||||
def getDefaultColor(self):
|
def getDefaultColor(self):
|
||||||
return (1.0,60.0/255.0,60.0/255.0)
|
return (1.0,60.0/255.0,60.0/255.0)
|
||||||
|
@ -1248,8 +1246,7 @@ class AsmConstraint(AsmGroup):
|
||||||
class ViewProviderAsmConstraint(ViewProviderAsmGroup):
|
class ViewProviderAsmConstraint(ViewProviderAsmGroup):
|
||||||
def attach(self,vobj):
|
def attach(self,vobj):
|
||||||
super(ViewProviderAsmConstraint,self).attach(vobj)
|
super(ViewProviderAsmConstraint,self).attach(vobj)
|
||||||
if gui.AsmCmdManager.AutoElementVis:
|
vobj.OnTopWhenSelected = 2
|
||||||
vobj.OnTopWhenSelected = 2
|
|
||||||
|
|
||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
return Constraint.getIcon(self.ViewObject.Object)
|
return Constraint.getIcon(self.ViewObject.Object)
|
||||||
|
|
8
gui.py
8
gui.py
|
@ -431,19 +431,19 @@ class AsmCmdAutoElementVis(AsmCmdCheckable):
|
||||||
super(AsmCmdAutoElementVis,cls).Activated(checked)
|
super(AsmCmdAutoElementVis,cls).Activated(checked)
|
||||||
from .assembly import isTypeOf,AsmConstraint,\
|
from .assembly import isTypeOf,AsmConstraint,\
|
||||||
AsmElement,AsmElementLink,AsmElementGroup
|
AsmElement,AsmElementLink,AsmElementGroup
|
||||||
visible = not checked
|
|
||||||
for doc in FreeCAD.listDocuments().values():
|
for doc in FreeCAD.listDocuments().values():
|
||||||
for obj in doc.Objects:
|
for obj in doc.Objects:
|
||||||
if isTypeOf(obj,(AsmConstraint,AsmElementGroup)):
|
if isTypeOf(obj,(AsmConstraint,AsmElementGroup)):
|
||||||
obj.Visibility = False
|
obj.Visibility = False
|
||||||
if isTypeOf(obj,AsmConstraint):
|
if isTypeOf(obj,AsmConstraint):
|
||||||
obj.ViewObject.OnTopWhenSelected = 2 if checked else 0
|
obj.ViewObject.OnTopWhenSelected = 2
|
||||||
obj.setPropertyStatus('VisibilityList',
|
obj.setPropertyStatus('VisibilityList',
|
||||||
'NoModify' if checked else '-NoModify')
|
'NoModify' if checked else '-NoModify')
|
||||||
elif isTypeOf(obj,(AsmElementLink,AsmElement)):
|
elif isTypeOf(obj,(AsmElementLink,AsmElement)):
|
||||||
|
if checked:
|
||||||
|
obj.Proxy.parent.Object.setElementVisible(
|
||||||
|
obj.Name,False)
|
||||||
obj.Visibility = False
|
obj.Visibility = False
|
||||||
vis = visible and not isTypeOf(obj,AsmElement)
|
|
||||||
obj.Proxy.parent.Object.setElementVisible(obj.Name,vis)
|
|
||||||
obj.ViewObject.OnTopWhenSelected = 2
|
obj.ViewObject.OnTopWhenSelected = 2
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user