def selectionChanged(self, selected, deselected):
        select_indexes = [idx for idx in selected.indexes()]
        deselect_indexes = [idx for idx in deselected.indexes()]
        selected_indexes = self.selModel.selectedRows()
        select_nodes = _lookupMayaNodesFromAttrUINodes(select_indexes,
                                                       self.filterModel)
        deselect_nodes = _lookupMayaNodesFromAttrUINodes(
            deselect_indexes, self.filterModel)
        selected_nodes = _lookupMayaNodesFromAttrUINodes(
            selected_indexes, self.filterModel)
        if self.isActiveWindow() is True:
            # Only allow Maya selection changes when the user has the
            # UI focused. This breaks the Maya and Qt selection
            # callback cycle.

            # Because an attribute and node may refer to the same
            # underlying node name, we must be sure we don't deselect a
            # node that has other attributes selected.
            deselect_nodes = list(set(deselect_nodes) - set(selected_nodes))
            try:
                mmapi.set_solver_running(True)  # disable selection callback.
                lib_maya_utils.add_scene_selection(select_nodes)
                lib_maya_utils.remove_scene_selection(deselect_nodes)
            finally:
                mmapi.set_solver_running(False)  # enable selection callback
        return
 def selectionChanged(self, selected, deselected):
     """
     Look up the Maya node from the 'selected' nodes, and add them
     to the Maya selection.
     """
     select_indexes = [idx for idx in selected.indexes()]
     deselect_indexes = [idx for idx in deselected.indexes()]
     select_nodes = _lookupUINodesFromIndexes(
         select_indexes,
         self.filterModel
     )
     deselect_nodes = _lookupUINodesFromIndexes(
         deselect_indexes,
         self.filterModel
     )
     if self.isActiveWindow() is True:
         # Only allow Maya selection changes when the user has the
         # UI focused. This breaks the Maya and Qt selection
         # callback cycle.
         try:
             mmapi.set_solver_running(True)  # disable selection callback.
             lib_maya_utils.add_scene_selection(select_nodes)
             lib_maya_utils.remove_scene_selection(deselect_nodes)
         finally:
             mmapi.set_solver_running(False)  # enable selection callback
     return
Ejemplo n.º 3
0
 def selectionChanged(self, selected, deselected):
     select_indexes = [idx for idx in selected.indexes()]
     deselect_indexes = [idx for idx in deselected.indexes()]
     select_nodes = _lookupAttrNodes(select_indexes, self.filterModel)
     deselect_nodes = _lookupAttrNodes(deselect_indexes, self.filterModel)
     lib_maya_utils.add_scene_selection(select_nodes)
     lib_maya_utils.remove_scene_selection(deselect_nodes)
     return
Ejemplo n.º 4
0
    def selectionChanged(self, selected, deselected):
        """
        Look up the Maya node from the 'selected' nodes, and add them
        to the Maya selection.
        """
        select_indexes = [idx for idx in selected.indexes()]
        deselect_indexes = [idx for idx in deselected.indexes()]

        select_nodes = _lookupNodes(select_indexes, self.filterModel)
        deselect_nodes = _lookupNodes(deselect_indexes, self.filterModel)

        lib_maya_utils.add_scene_selection(select_nodes)
        lib_maya_utils.remove_scene_selection(deselect_nodes)
        return