Ejemplo n.º 1
0
    def run(self, nodes=None):
        current_selection = nodes or pm.selected()
        nodes_to_select = list()

        for node in current_selection:

            side = crab.config.get_side(node)
            opp = crab.config.MIDDLE

            if node.name().endswith(crab.config.RIGHT):
                opp = crab.config.LEFT

            if node.name().endswith(crab.config.LEFT):
                opp = crab.config.RIGHT

            opp_name = node.name().replace(side, opp)

            if pm.objExists(opp_name):
                nodes_to_select.append(opp_name)

        kwargs = dict()

        if pm.getModifiers() == 1:  # Shift
            kwargs['add'] = 1

        pm.select(nodes_to_select, **kwargs)
Ejemplo n.º 2
0
def isShiftHeld():
    """
    Gets whether shift is held or not. Returns false during batch.

    Returns:
        (bool): True if shift is held.
    """
    return False if pm.about(batch=True) else (pm.getModifiers() & 1) > 0
Ejemplo n.º 3
0
def isAltHeld():
    """
    Gets whether ALT key is held or not. Returns false during batch.

    Returns:
        (bool): True if alt is held.
    """
    return False if pm.about(batch=True) else (pm.getModifiers() & 8) > 0
Ejemplo n.º 4
0
def isCtrlHeld():
    """
    Gets whether CTRL key is held or not. Returns false during batch.

    Returns:
        (bool): True if ctrl is held.
    """
    return False if pm.about(batch=True) else (pm.getModifiers() & 4) > 0
Ejemplo n.º 5
0
 def selectCtrl(self, button):
     ctrl = self.getCtrlForButton(button)
     if ctrl:
         alreadySelected = ctrl in pmc.ls(selection=True)
         mods = pmc.getModifiers()
         # shift is 1 bit, ctrl is 4 bit
         addMod = mods & 1 or mods & 4
         # deselect instead of adding if ctrl or shift, AND
         # target is already selected
         desel = alreadySelected and addMod
         pmc.select(ctrl, deselect=desel, add=addMod)
     else:
         pmc.warning("Ctrl doesn't exist")