def disableAllHotKeys():
    #Forces Maya to save prefs
    #Sometimes Maya doesn't save the hotkeys properly
    #   and restarts with them disabled.
    cmds.savePrefs(hotkeys=True)
    """
    This method loops through all the hotkeys we want to disable and calls
    disableHotKey on each of them.

    First we build up our own char list...
    Why not use string.printable? Because it includes unwanted whitespace.
    Why not just use string.letters + string.digits + string.punctuation?
    Because Python in Maya barfs with the following in the lowercase portion
    of string.letters: TypeError: bad argument type for built-in operation.
    """
    letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    digits = '0123456789'
    punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
    chars = digits + punctuation + letters
    for c in chars:
        disableHotKey(c)

    # Function keys F1 through F12
    for key in range(1, 13):
        disableHotKey("F" + str(key))

    # Other named keys
    otherHotKeys = [
        "Up", "Down", "Right", "Left", "Home", "End", "Page_Up", "Page_Down",
        "Insert", "Return", "Space"
    ]
    for key in otherHotKeys:
        disableHotKey(key)
Beispiel #2
0
 def store_list(self, var_list):
     list_items = cmds.textScrollList(self.outline_list, q=True, ai=True)
     if list_items:
         list_items = ','.join(list_items)
         cmds.optionVar(sv=[var_list, list_items])
     cmds.savePrefs(general=True)
     return
Beispiel #3
0
def disableAllHotKeys():
    #Forces Maya to save prefs
    #Sometimes Maya doesn't save the hotkeys properly
    #   and restarts with them disabled.
    cmds.savePrefs(hotkeys=True)

    """
    This method loops through all the hotkeys we want to disable and calls
    disableHotKey on each of them.

    First we build up our own char list...
    Why not use string.printable? Because it includes unwanted whitespace.
    Why not just use string.letters + string.digits + string.punctuation?
    Because Python in Maya barfs with the following in the lowercase portion
    of string.letters: TypeError: bad argument type for built-in operation.
    """
    letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    digits = '0123456789'
    punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
    chars = digits + punctuation + letters
    for c in chars:
        disableHotKey(c)

    # Function keys F1 through F12
    for key in range(1, 13):
        disableHotKey("F" + str(key))

    # Other named keys
    otherHotKeys = ["Up", "Down", "Right", "Left", "Home", "End",
                    "Page_Up", "Page_Down", "Insert", "Return", "Space"]
    for key in otherHotKeys:
        disableHotKey(key)
Beispiel #4
0
def main():
    """Creates the dmptools hotkeys"""

    defaultPrint('creating hotkeys...')

    for hotKey in HOTKEY_ITEMS:
        setHotkey(hotKey)
    # save hotkeys pref files
    cmds.savePrefs(hotkeys=True)
Beispiel #5
0
 def sendBatch(self):
     old = self.prepared
     self.prepared = False
     cmds.savePrefs(general=True)
     mayabatch.Mayabatch(objectRecorded=self,
                         exportList=self.mergeExportList(),
                         mailEnabled=self.mail(),
                         modulesExtra=True)
     self.prepared = old
def restoreAllHotKeys():
    global disabledHotKeys
    for hotkey in disabledHotKeys:
        cmds.hotkey(k=hotkey.key,
                    n=hotkey.name,
                    rn=hotkey.rname,
                    alt=hotkey.alt,
                    ctl=hotkey.ctl,
                    cmd=hotkey.cmd)
    disabledHotKeys = []

    cmds.savePrefs(hotkeys=True)
Beispiel #7
0
def restoreAllHotKeys():
    global disabledHotKeys
    for hotkey in disabledHotKeys:
        cmds.hotkey(
                k=hotkey.key,
                n=hotkey.name,
                rn=hotkey.rname,
                alt=hotkey.alt,
                ctl=hotkey.ctl,
                cmd=hotkey.cmd)
    disabledHotKeys = []

    cmds.savePrefs(hotkeys=True)
Beispiel #8
0
    def setHotkey(self, hotkeyDict):
        message = "Are you sure?\n\n"

        #format message
        for loopIndex, loopCommand in enumerate(hotkeyDict):

            command = loopCommand["command"]
            name = loopCommand["name"]
            key = loopCommand["hotkey"]
            alt = loopCommand["alt"]
            ctl = loopCommand["ctl"]
            q = cmds.text("query%s" % name, query=True, label=True)

            commandKeys = ""
            if ctl: commandKeys += "Ctl + "
            if alt: commandKeys += "Alt + "

            message += "%s (%s%s)" % (name, commandKeys, key)
            if q != "": message += " is assigned to: %s" % q
            message += "\n"

        confirm = cmds.confirmDialog(title='Confirm',
                                     message=message,
                                     button=['Yes', 'No'],
                                     defaultButton='Yes',
                                     cancelButton='No',
                                     dismissString='No')

        if confirm == 'Yes':
            for loopIndex, loopCommand in enumerate(hotkeyDict):

                command = loopCommand["command"]
                name = loopCommand["name"]
                key = loopCommand["hotkey"]
                alt = loopCommand["alt"]
                ctl = loopCommand["ctl"]

                cmds.nameCommand(name,
                                 command='python("%s");' % command,
                                 annotation=name)
                cmds.hotkey(k=key, alt=alt, ctl=ctl, name=name)

                aToolsMod.saveInfoWithUser("hotkeys", name, [key, alt, ctl])
                self.updateHotkeyCheck(name)

            cmds.savePrefs(hotkeys=True)
Beispiel #9
0
    def setup_hotKey(self):
        self.validate_hotkeySet()

        _press = ''
        if self._valid_cmdPress:
            #_press = mc.nameCommand( self._valid_cmdPress + 'COMMAND', annotation=self._valid_cmdPress, command=self._valid_cmdPress)
            _press = self._valid_cmdPress

        _release = ''
        if self._valid_cmdRelease:
            #_release = mc.nameCommand( self._valid_cmdRelease + 'COMMAND', annotation=self._valid_cmdRelease, command=self._valid_cmdRelease)
            _release = self._valid_cmdRelease

        _d = {
            'keyShortcut': self._d_fromUI.get('hotkey', self._d_kws['hotkey']),
            'name': _press,
            'releaseName': _release,
            'altModifier': False,
            'ctrlModifier': False,
            'shiftModifier': False
        }
        _l_order = ['keyShortcut']
        _modifer = self.validateModifier()

        if _modifer and _modifer + 'Modifier' in _d.keys():
            _d[_modifer + 'Modifier'] = True

        if mayaVersion < 2016:
            _d.pop('shiftModifier')
            if _modifer == 'shift':
                log.error(
                    "The shiftModifer was added in Maya 2016. Cannot setup.")
                return
        cgmGeneral.log_info_dict(_d, 'hotkey args')

        _k = _d.get('keyShortcut')

        log.info(_k)
        log.info(_d)
        mc.hotkey(_k, **_d)  #...run it
        mc.savePrefs(
            hk=True)  #...have to save prefs after setup or it won't keep
Beispiel #10
0
 def setHotkey(self, hotkeyDict):
     message = "Are you sure?\n\n"    
     
     #format message
     for loopIndex, loopCommand in enumerate(hotkeyDict):
             
         command = loopCommand["command"]
         name    = loopCommand["name"]
         key     = loopCommand["hotkey"]
         alt     = loopCommand["alt"]
         ctl     = loopCommand["ctl"]
         q       = cmds.text("query%s"%name, query=True, label=True)
         
         commandKeys = ""
         if ctl: commandKeys += "Ctl + "
         if alt: commandKeys += "Alt + "
         
         message += "%s (%s%s)"%(name, commandKeys, key)
         if q != "": message += " is assigned to: %s"%q
         message += "\n"
         
     confirm = cmds.confirmDialog( title='Confirm', message=message, button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
 
     if confirm == 'Yes':    
         for loopIndex, loopCommand in enumerate(hotkeyDict):
             
             command = loopCommand["command"]
             name    = loopCommand["name"]
             key     = loopCommand["hotkey"]
             alt     = loopCommand["alt"]
             ctl     = loopCommand["ctl"]       
             
             cmds.nameCommand(name, command='python("%s");'%command, annotation=name)
             cmds.hotkey(k=key, alt=alt, ctl=ctl, name=name)
 
             aToolsMod.saveInfoWithUser("hotkeys", name, [key, alt, ctl]) 
             self.updateHotkeyCheck(name)
             
         cmds.savePrefs( hotkeys=True )
Beispiel #11
0
    def setup_hotKey(self):
        self.validate_hotkeySet()
   
        _press = ''
        if self._valid_cmdPress:
            #_press = mc.nameCommand( self._valid_cmdPress + 'COMMAND', annotation=self._valid_cmdPress, command=self._valid_cmdPress) 
            _press = self._valid_cmdPress
            
        _release = ''
        if self._valid_cmdRelease:
            #_release = mc.nameCommand( self._valid_cmdRelease + 'COMMAND', annotation=self._valid_cmdRelease, command=self._valid_cmdRelease) 
            _release = self._valid_cmdRelease
        
        _d = {'keyShortcut':self._d_fromUI.get('hotkey', self._d_kws['hotkey']),
              'name':_press,
              'releaseName':_release,
              'altModifier':False,
              'ctrlModifier':False,
              'shiftModifier':False}       
        _l_order = ['keyShortcut']
        _modifer = self.validateModifier()
        
        if _modifer and _modifer+'Modifier' in _d.keys():
            _d[_modifer+'Modifier'] = True
            
        if mayaVersion < 2016:
            _d.pop('shiftModifier')
            if _modifer == 'shift':
                log.error("The shiftModifer was added in Maya 2016. Cannot setup.")
                return
        cgmGeneral.log_info_dict(_d,'hotkey args')

        _k = _d.get('keyShortcut')

        log.info(_k)
        log.info(_d)
        mc.hotkey(_k,**_d)#...run it                                        
        mc.savePrefs(hk = True)#...have to save prefs after setup or it won't keep        
Beispiel #12
0
def save():
    # Ragdoll's preferences are Maya's native "optionVar"
    cmds.savePrefs(general=True)
Beispiel #13
0
def savePrefs():
	cmds.savePrefs(g=True)
	print ''
	return
Beispiel #14
0
import sgtk
from maya import cmds

try:
    app = sgtk.platform.current_engine()
    pipe = app.context.tank.pipeline_configuration.get_name()

    if pipe == 'zombieProd' or pipe == 'zombieDev':
        if not cmds.colorManagementPrefs(q=True, cmEnabled=True):
            cmds.colorManagementPrefs(e=True, cmEnabled=True)
            cmds.colorManagementPrefs(e=True, configFilePath="R:/Zombie Dropbox/INHOUSE/OCIO/aces_1.0.3/config.ocio")
            cmds.colorManagementPrefs(e=True, policyFileName="R:/Zombie Dropbox/INHOUSE/OCIO/maya/ACES.xml")
            cmds.colorManagementPrefs(e=True, ocioRulesEnabled=True)
            cmds.colorManagementPrefs(e=True, cmConfigFileEnabled=True)
            cmds.colorManagementPrefs(e=True, refresh=True)
    else:
        if cmds.colorManagementPrefs(q=True, cmEnabled=True):
            cmds.colorManagementPrefs(e=True, ocioRulesEnabled=False)
            cmds.colorManagementPrefs(e=True, cmConfigFileEnabled=False)
            cmds.colorManagementPrefs(e=True, cmEnabled=False)
            cmds.colorManagementPrefs(e=True, configFilePath="")
            cmds.colorManagementPrefs(e=True, policyFileName="")
            cmds.colorManagementPrefs(e=True, refresh=False)

    cmds.SavePreferences()
    cmds.savePrefs()
    cmds.saveToolSettings()
    cmds.saveViewportSettings()
except Exception as error:
    print(error)
Beispiel #15
0
 def sendBatch(self):
     old = self.prepared
     self.prepared = False
     cmds.savePrefs(general=True)
     mayabatch.Mayabatch(objectRecorded=self, exportList=self.mergeExportList(), mailEnabled=self.mail(), modulesExtra=True, stats=initstats)
     self.prepared = old