コード例 #1
0
def resetHotkeys():

    if lib.checkAboveVersion(2015):
        #check if hotkeyset exists
        if cmds.hotkeySet('coopAnim', exists=True):
            cmds.hotkeySet('coopAnim', current=True, e=True)
        else:
            cmds.hotkeySet( 'coopAnim', current=True )


    '''reset hotkeys'''
    #outliner
    cmds.hotkey( k='o', alt=False, name='PolyBrushMarkingMenuNameCommand', releaseName='PolyBrushMarkingMenuPopDownNameCommand')
    cmds.hotkey( k='o', alt=True, name='' )
    #attribute editor
    cmds.hotkey( k='a', alt=False, name='NameComFit_All_in_Active_Panel_MMenu', rn='NameComFit_All_in_Active_Panel_MMenu_release' )
    cmds.hotkey( k='a', alt=True, name='artisanToggleWireframe_press' )
    #graph editor
    cmds.hotkey( k='g', alt=False, name='NameComRepeat_Last_Menu_Action' )
    cmds.hotkey( k='g', alt=True, name='HyperGraph_IncreaseDepth' )
    #tool settings
    cmds.hotkey( k='t', alt=False, name='NameComShowManip_Tool' )
    cmds.hotkey( k='t', alt=True, name='HyperGraph_DecreaseDepth' )
    #trax editor
    cmds.hotkey( k='t', ctl=True, name='NameComUniversalManip' )
    if lib.checkAboveVersion(2015):
        #keys are not modified if below 2015
        #special key
        cmds.hotkey( k='s', alt=True, name='NameCom_HIKSetFullBodyKey' )
        #breakdown key
        cmds.hotkey( k='s', sht=True, name='KeyframeTangentMarkingMenuNameCommand' )
    #curvesel key TODO
    #
    print "reverted to default maya hotkeys (to change or reset hotkeys, right mouse click on the same shelf button\n",
コード例 #2
0
def validate_hotkeySet(setName='cgmHotkeySet'):
    """
    Validates a given setName as existing and is current set.
    
    :param setName: Name for the hotkeySet
    
    :returns validated name
    """
    if mayaVersion >= 2016:
        if setName:
            _str_hotKeySet = setName
            _exists = mc.hotkeySet(_str_hotKeySet, q=True, exists=True)
            if not _exists:
                _str_hotKeySet = mc.hotkeySet(_str_hotKeySet,
                                              source='Maya_Default')
                log.info("Created: " + _str_hotKeySet)
            mc.hotkeySet(_str_hotKeySet, edit=True, current=True)
            #if mc.hotkeySet(q=True, current=True) == "Maya_Default":
            #...if it's another set, it'll use whatever your current set is
            #log.error("Current maya default hot key set is active. Creating new one as maya's is unchangable")
            #if mc.hotkeySet(_str_hotKeySet, q=True, exists =True):#...if our name exists, make it current
            #log.info("cgm default set exists..changing to that...")
            #mc.hotkeySet(_str_hotKeySet,e = True, current = True)
            #else:#...else, make it
            #mc.hotkeySet(_str_hotKeySet, source = 'Maya_Default', current = True)
        return mc.hotkeySet(q=True, current=True)
    return "Maya_Default"
コード例 #3
0
ファイル: HotkeyFactory.py プロジェクト: GuidoPollini/MuTools
def validate_hotkeySet(setName = 'cgmHotkeySet'):
    """
    Validates a given setName as existing and is current set.
    
    :param setName: Name for the hotkeySet
    
    :returns validated name
    """
    if mayaVersion >= 2016:
        if setName:
            _str_hotKeySet = setName
            _exists = mc.hotkeySet(_str_hotKeySet, q=True, exists =True)
            if not _exists:
                _str_hotKeySet = mc.hotkeySet(_str_hotKeySet, source = 'Maya_Default')
                log.info("Created: "+ _str_hotKeySet)
            mc.hotkeySet(_str_hotKeySet, edit = True, current = True)
            #if mc.hotkeySet(q=True, current=True) == "Maya_Default":
                #...if it's another set, it'll use whatever your current set is
                #log.error("Current maya default hot key set is active. Creating new one as maya's is unchangable")
                #if mc.hotkeySet(_str_hotKeySet, q=True, exists =True):#...if our name exists, make it current
                    #log.info("cgm default set exists..changing to that...")
                    #mc.hotkeySet(_str_hotKeySet,e = True, current = True)                    
                #else:#...else, make it
                    #mc.hotkeySet(_str_hotKeySet, source = 'Maya_Default', current = True)
        return mc.hotkeySet(q=True, current=True)
    return "Maya_Default"
コード例 #4
0
def change_to(keymap):
    # type: (Text) -> None
    import maya.mel as mel
    import maya.cmds as cmds

    menu_set = mel.eval("""findMenuSetFromLabel("{}");""".format(keymap))

    cmds.hotkeySet(keymap, e=True, current=True)
    if cmds.menuSet(q=True, exists=menu_set):
        cmd = """workingMode("{}");""".format(menu_set)
        mel.eval(cmd)
コード例 #5
0
ファイル: hkTools.py プロジェクト: kohyuk91/hkTools
def createUpdateHotkey():
    # Returns all available hotkey sets in Maya
    hotkeySetList = cmds.hotkeySet( q=True, hotkeySetArray=True )

    # Delete old hkTools hotkey set
    if "hkTools" in hotkeySetList:
        cmds.hotkeySet( "hkTools", edit=True, delete=True )

    # Import hkTools hotkey set
    hkTools_mhk_filepath = os.path.join(getCurrentDir(), "hkTools.mhk")
    cmds.hotkeySet( e=True, ip=hkTools_mhk_filepath )
コード例 #6
0
def runtimeCommand():
    if not cmds.runTimeCommand('switchRTC', exists = True):
        cmds.runTimeCommand('switchRTC',
                            default = True,
                            category = 'User',
                            ann = "switches wieght unlocked influences",
                            c = 'switchInfluence()')
    
    cmds.nameCommand('switchNC',
                     ann = "Create a Sphere",
                     default = True,
                     command = 'switchRTC')
    if version >= 2016:
        clHotkeySet = "slHotKeySet"
        if not cmds.hotkeySet (clHotkeySet, exists = True):
            cmds.hotkeySet(clHotkeySet, source = 'Maya_Default', current = True)
        else:
            cmds.hotkeySet (clHotkeySet, e = True, current = True)
    cmds.hotkey(k = ';', n = 'switchNC')
コード例 #7
0
def getOrCreateCustomHotkeySet():
    allHotkey = cmds.hotkeySet(q=1, hsa=1)
    currentHotkey = cmds.hotkeySet(q=1, current=1)
    if currentHotkey == 'Maya_Default' and len(allHotkey) == 1:
        cmds.hotkeySet("MyHotkeySet", current=1)
    elif currentHotkey == 'Maya_Default':
        for i in allHotkey:
            if i != "Maya_Default":
                cmds.hotkeySet(i, e=1, current=1)
    currentHotkey = cmds.hotkeySet(q=1, current=1)
    return currentHotkey
コード例 #8
0
ファイル: utilsBin.py プロジェクト: matthieuCantat/python
	def createHotkeySet(self):

		hotkeySetArray =  mc.hotkeySet( q = True, hotkeySetArray = True )	
		if( self.newKeySet in hotkeySetArray ):
			mc.hotkeySet( self.newKeySet , e = True , delete = True  )
		
		self.lastKeySet = mc.hotkeySet( q = True, current = True ) 
		mc.hotkeySet( self.newKeySet , current = True , source = self.lastKeySet )		
コード例 #9
0
ファイル: MayaGame.py プロジェクト: Malent3218/MayaGameJam
def SetHotKeys():
    if 'MayaGame' in cmds.hotkeySet(q=True, hotkeySetArray=True):
        cmds.hotkeySet('MayaGame', edit=True, delete=True)
    cmds.hotkeySet('MayaGame', current=True)
    cmds.nameCommand('pushKeyUp',
                     ann='Push Up Key',
                     c='python("MayaGame.PushKeyUp(True)")')
    cmds.nameCommand('pushKeyDown',
                     ann='Push Down Key',
                     c='python("MayaGame.PushKeyDown(True)")')
    cmds.nameCommand('pushKeyLeft',
                     ann='Push Left Key',
                     c='python("MayaGame.PushKeyLeft(True)")')
    cmds.nameCommand('pushKeyRight',
                     ann='Push Right Key',
                     c='python("MayaGame.PushKeyRight(True)")')
    cmds.nameCommand('releaseKeyUp',
                     ann='Release Up Key',
                     c='python("MayaGame.PushKeyUp(False)")')
    cmds.nameCommand('releaseKeyDown',
                     ann='Release Down Key',
                     c='python("MayaGame.PushKeyDown(False)")')
    cmds.nameCommand('releaseKeyLeft',
                     ann='Release Left Key',
                     c='python("MayaGame.PushKeyLeft(False)")')
    cmds.nameCommand('releaseKeyRight',
                     ann='Release Right Key',
                     c='python("MayaGame.PushKeyRight(False)")')
    cmds.hotkey(keyShortcut='Up', name='pushKeyUp', releaseName='releaseKeyUp')
    cmds.hotkey(keyShortcut='Down',
                name='pushKeyDown',
                releaseName='releaseKeyDown')
    cmds.hotkey(keyShortcut='Left',
                name='pushKeyLeft',
                releaseName='releaseKeyLeft')
    cmds.hotkey(keyShortcut='Right',
                name='pushKeyRight',
                releaseName='releaseKeyRight')
コード例 #10
0
def initialize():
    if cmds.hotkeySet(query=True, current=True) != "Tomayto":
        if "Tomayto" in cmds.hotkeySet(query=True, hotkeySetArray=True):
            cmds.hotkeySet("Tomayto", edit=True, current=True)
        else:
            cmds.hotkeySet("Tomayto", current=True)
    core.disable()
    core.enable()
    tom = core.Tomayto(START.stateSTART)
    return tom
コード例 #11
0
    def set_hotkey(self, name, mode, sequence, open_cmd, close_cmd,
                   switch_cmd):
        from maya import cmds, mel

        current_hotkey_set = cmds.hotkeySet(current=True, query=True)
        if current_hotkey_set == 'Maya_Default':
            msg = 'The current hotkey set is locked, change in the hotkey editor'
            warning('Hotbox designer', msg)
            return mel.eval('hotkeyEditorWindow;')

        use_alt = 'Alt' in sequence
        use_ctrl = 'Ctrl' in sequence
        use_shift = 'Shift' in sequence
        touch = sequence.split('+')[-1]
        show_name = 'showHotbox_{n}'.format(n=name)
        hide_name = 'hideHotbox_{n}'.format(n=name)
        switch_name = 'switchHotbox_{n}'.format(n=name)

        if mode == SETMODE_PRESS_RELEASE:
            cmds.nameCommand(show_name,
                             annotation='show {n} hotbox'.format(n=name),
                             command=format_command_for_mel(open_cmd),
                             sourceType='python')

            cmds.nameCommand(hide_name,
                             annotation='hide {n} hotbox'.format(n=name),
                             command=format_command_for_mel(close_cmd),
                             sourceType='python')

            cmds.hotkey(keyShortcut=touch,
                        altModifier=use_alt,
                        ctrlModifier=use_ctrl,
                        shiftModifier=use_shift,
                        name=show_name,
                        releaseName=hide_name)
        else:
            cmds.nameCommand(switch_name,
                             annotation='switch {n} hotbox'.format(n=name),
                             command=format_command_for_mel(switch_cmd),
                             sourceType='python')

            cmds.hotkey(keyShortcut=touch,
                        altModifier=use_alt,
                        ctrlModifier=use_ctrl,
                        shiftModifier=use_shift,
                        name=switch_name)
コード例 #12
0
    def __init__(self,
                 keymaps=None,
                 current=None,
                 implicitSave=False,
                 parent=None):
        # type: (Text, Dict, QtCore.QObject) -> None
        super(SelectorCombobox, self).__init__(parent)

        self.implicitSave = implicitSave

        if not keymaps:
            self.keymaps = keymapswitcher.get_keymaps().keys()
        else:
            self.keymaps = keymaps

        if not current:
            self.current = cmds.hotkeySet(q=True, current=True)
        else:
            self.current = current

        self.keymaps.insert(0, "Maya_Default")
        items = self.keymaps
        self.selector = QtWidgets.QComboBox(self)
        self.selector.addItems(items)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.addWidget(QtWidgets.QLabel("hotkey:"))
        self.layout.addWidget(self.selector)
        self.layout.setContentsMargins(0, 0, 0, 0)

        try:
            self.selector.setCurrentText(self.current)

        except AttributeError:
            for i, name in enumerate(items):
                if self.current == name:
                    self.selector.setCurrentIndex(i)

        if self.implicitSave:
            self.selector.currentIndexChanged.connect(self.selectorChanged)
コード例 #13
0
def main():
    sSet = 'CustomHotkeySet'
    sDefault = 'Maya_Default'
    sOriginalSet = 'CustomHotkeySet_BU'  # This one is the BU set to be duplicated from.
    aSet = [str(s) for s in cmds.hotkeySet(q=True, hotkeySetArray=True)]
    sCurrentSet = cmds.hotkeySet(q=True, current=True)

    if sSet in aSet:
        cmds.hotkeySet(sSet, edit=True, delete=True)

    if sCurrentSet == sDefault:
        cmds.hotkeySet(sSet, current=True, source=sOriginalSet)
        aPrint = ['a7a8af', sSet, 0x6b6c75]  # Gray
    else:
        cmds.hotkeySet(sSet)
        aPrint = ['a7a8af', sDefault, 0x6b6c75]  # Gray

    cmds.inViewMessage(amg='<text style="color:#%s";>%s</text>' %
                       (aPrint[0], aPrint[1]),
                       pos='botCenter',
                       fade=True,
                       fts=7,
                       ft='arial',
                       bkc=aPrint[2])
コード例 #14
0
def enable (hotkeySetName="Tomayto", **kwargs):
    try:
        cmds.hotkeySet(hotkeySetName, current=True) # create, fail on existing
    except:
        cmds.hotkeySet(hotkeySetName, edit=True, current=True)
    util.createTomaytoKeymap(**kwargs)
コード例 #15
0
def disable (removeHotkeySet=False, hotkeySetName="Tomayto", **kwargs):
    util.removeTomaytoKeymap(**kwargs)
    cmds.hotkeySet("Maya_Default", edit=True, current=True)
コード例 #16
0
            pass
    except:
        if cmds.runTimeCommand(name, q=True, exists=True):
            cmds.runTimeCommand(name, e=True, delete=True)
        if not cmds.runTimeCommand(name, q=True, exists=True):
            cmds.runTimeCommand(name,
                                annotation=annotation,
                                command=command,
                                commandLanguage="python",
                                category="Custom Scripts")

            cmds.nameCommand("{0}NameCommand".format(name),
                             annotation=annotation,
                             command=name)

        if cmds.hotkeySet(q=True, current=True) == "Maya_Default":
            if not cmds.hotkeySet("Custom", q=True, exists=True):
                cmds.hotkeySet("Custom", current=True)
            else:
                cmds.hotkeySet("Custom", edit=True, current=True)

            cmds.hotkey(keyShortcut="w",
                        ctl=True,
                        sht=True,
                        name="{0}NameCommand".format(name))

        ### Register Menu ###
        MainMayaWindow = mel.eval('$tmpVar=$gMainWindow')
        if cmds.menu('MayaWindow|Welcome_Screen', q=True, ex=True):
            cmds.deleteUI(cmds.menu('MayaWindow|Welcome_Screen', e=1,
                                    dai=True))
コード例 #17
0
def delete_set(name):
    if cmds.hotkeySet(name, q=True, exists=True):
        cmds.hotkeySet(name, e=True, delete=True)
    cmds.hotkeySet('Maya_Default', e=True, current=True)
コード例 #18
0
def current_set(name):
    if not cmds.hotkeySet(name, q=True, exists=True):
        cmds.hotkeySet(name, current=True)
    cmds.hotkeySet(name, e=True, current=True)
コード例 #19
0
ファイル: util.py プロジェクト: gfixler/tomayto
def currentHotkeySet():
    return cmds.hotkeySet(query=True, current=True)
コード例 #20
0
ファイル: util.py プロジェクト: gfixler/tomayto
def listHotkeySets():
    print cmds.hotkeySet(query=True, hotkeySetArray=True)
コード例 #21
0
ファイル: START.py プロジェクト: gfixler/tomayto
 def switchToMayaHotkeys(self):
     cmds.hotkeySet("Maya_Default", edit=True, current=True)
コード例 #22
0
ファイル: MayaGame.py プロジェクト: Malent3218/MayaGameJam
def KillGameThread(arg=False):
    print "Dbg: Stopping Game thread"
    if GameThread.Instance != None:
        GameThread.Instance.keepRunning = False  # stop existing thread
        GameThread.Instance = None
        cmds.hotkeySet('MayaGame', edit=True, delete=True)
コード例 #23
0
ファイル: utilsBin.py プロジェクト: matthieuCantat/python
	def deleteHotkeySet(self):	
		mc.hotkeySet( self.newKeySet  , e = True , delete = True )			
		for runTimeCmdName in self.runTimeCmdNames:
			melToEval = 'runTimeCommand -e -delete {0}; '.format( runTimeCmdName )
			mel.eval(melToEval)
		mc.hotkeySet( self.lastKeySet ,e = True , current = True )