Assembly: CommandInsertLink: Hide hidden objects
This commit is contained in:
committed by
Chris Hennes
parent
b1709292a0
commit
5ab2f3ea7e
@@ -91,6 +91,7 @@ class TaskAssemblyInsertLink(QtCore.QObject):
|
||||
self.assembly = assembly
|
||||
self.view = view
|
||||
self.doc = App.ActiveDocument
|
||||
self.showHidden = False
|
||||
|
||||
self.form = Gui.PySideUic.loadUi(":/panels/TaskAssemblyInsertLink.ui")
|
||||
self.form.installEventFilter(self)
|
||||
@@ -196,6 +197,9 @@ class TaskAssemblyInsertLink(QtCore.QObject):
|
||||
continue # Prevent dependency loop.
|
||||
# For instance if asm1/asm2 with asm2 active, we don't want to have asm1 in the list
|
||||
|
||||
if not obj.ViewObject.ShowInTree and not self.showHidden:
|
||||
continue
|
||||
|
||||
if (
|
||||
obj.isDerivedFrom("Part::Feature")
|
||||
or obj.isDerivedFrom("App::Part")
|
||||
@@ -565,9 +569,26 @@ class TaskAssemblyInsertLink(QtCore.QObject):
|
||||
self.form.partList.setItemSelected(item, False)
|
||||
|
||||
return True
|
||||
else:
|
||||
menu = QtWidgets.QMenu()
|
||||
|
||||
# Add the checkbox action
|
||||
showHiddenAction = QtWidgets.QAction("Show objects hidden in tree view", menu)
|
||||
showHiddenAction.setCheckable(True)
|
||||
showHiddenAction.setChecked(self.showHidden)
|
||||
|
||||
# Connect the action to toggle `self.showHidden`
|
||||
showHiddenAction.toggled.connect(self.toggleShowHidden)
|
||||
menu.addAction(showHiddenAction)
|
||||
menu.exec_(event.globalPos())
|
||||
return True
|
||||
|
||||
return super().eventFilter(watched, event)
|
||||
|
||||
def toggleShowHidden(self, checked):
|
||||
self.showHidden = checked
|
||||
self.buildPartList()
|
||||
|
||||
def getTranslationVec(self, part):
|
||||
bb = part.Shape.BoundBox
|
||||
if bb:
|
||||
|
||||
Reference in New Issue
Block a user