def override_add_hypershade_panel(panel):
    # create HyperShade with Maya command
    if cmds.optionVar(exists=VAR_HS_CMD):
        mel.eval('%s("%s")' % (cmds.optionVar(query=VAR_HS_CMD), panel))
    else:
        mel.eval('addHyperShadePanel("%s")' % panel)

    # set HyperShade toolbar current parent (name is hardcoded in mel files)
    cmds.setParent('hyperShadeToolbarForm')

    # add custom buttons
    cmds.separator(height=ICON_SIZE, horizontal=False, style='single')

    cmds.iconTextButton(
        image='nodeGrapherAddNodes.png',
        width=ICON_SIZE,
        height=ICON_SIZE,
        command=partial(hypershade_add_node, panel)
    )

    cmds.iconTextButton(
        image='nodeGrapherRemoveNodes.png',
        width=ICON_SIZE,
        height=ICON_SIZE,
        command=partial(hypershade_remove_node, panel)
    )

    cmds.separator(height=ICON_SIZE, horizontal=False, style='single')

    cmds.iconTextButton(
        image='MTT_CreateNode.png',
        width=ICON_SIZE,
        height=ICON_SIZE,
        command=create_nodes
    )
示例#2
0
def create_shelf():
    """
    Create the OBB shelf

    Raises:
        None

    Returns:
        None
    """

    tab_layout = mel.eval('$pytmp=$gShelfTopLevel')
    shelf_exists = cmds.shelfLayout('OBB', exists=True)

    if shelf_exists:
        cmds.deleteUI('OBB', layout=True)

    shelf = cmds.shelfLayout('OBB', parent=tab_layout)

    for button, kwargs in buttons.items():

        img = QtGui.QImage(kwargs['image'])
        kwargs['width'] = img.width()
        kwargs['height'] = img.height()

        cmds.shelfButton(label=button, parent=shelf, **kwargs)

    # Fix object 0 error.
    shelves = cmds.shelfTabLayout(tab_layout, query=True, tabLabelIndex=True)

    for index, shelf in enumerate(shelves):
        cmds.optionVar(stringValue=("shelfName%d" % (index+1), str(shelf)))
示例#3
0
文件: gator.py 项目: Regnareb/Maya
 def loadPrefs(self):
     """Load all preferences and create default ones if they do not exists"""
     for label in self.preferences:
         if cmds.optionVar(exists='pns_' + label):
             self.preferences[label] = cmds.optionVar(query='pns_' + label)
         else:
             cmds.optionVar(intValue=('pns_' + label, self.preferences[label]))
示例#4
0
def load(file_path, obj_name, parent_name):
    """Import a file exported from ZBrush.

    This is the command sent over the Maya command port from ZBrush.

    Parameters
    ----------
    file_path : str
        Path to the file that we are importing
    obj_name : str
        Name of the object being imported
    parent_name : str
        Name of the parent for the object being imported
    """
    file_name = utils.split_file_name(file_path)
    _cleanup(file_name)
    cmds.file(file_path, i=True,
              usingNamespaces=False,
              removeDuplicateNetworks=True)

    # Set smoothing options if necessary
    if cmds.optionVar(ex='gozbruh_smooth') and not cmds.optionVar(q='gozbruh_smooth'):
        cmds.displaySmoothness(obj_name, du=0, dv=0, pw=4, ps=1, po=1)

    if not cmds.attributeQuery("gozbruhParent", n=obj_name, ex=True):
        cmds.addAttr(obj_name, longName='gozbruhParent', dataType='string')
    cmds.setAttr(obj_name + '.gozbruhParent', parent_name, type='string')
def override_panels(custom_hs_cmd=None, custom_ne_cmd=None):
    # check if icons is in maya resources, if not, copy into userBitmapsDir
    user_icons_path = cmds.internalVar(userBitmapsDir=True)
    mtt_icons_path = os.path.join(os.path.dirname(__file__), 'icons')
    maya_icons = os.listdir(user_icons_path)

    for ico in MTT_ICONS_NAME:
        if ico not in maya_icons:
            source_file = os.path.join(mtt_icons_path, ico)
            destination_file = os.path.join(user_icons_path, ico)
            shutil.copy2(source_file, destination_file)

    # create MEL global proc
    cmd = mel.createMelWrapper(
        override_add_hypershade_panel, types=['string'], returnCmd=True)
    mel.eval(cmd)
    cmd = mel.createMelWrapper(
        override_add_node_editor_panel, types=['string'], returnCmd=True)
    mel.eval(cmd)

    # edit callback of scripted panel
    cmds.scriptedPanelType(
        'hyperShadePanel', edit=True,
        addCallback='override_add_hypershade_panel')

    cmds.scriptedPanelType(
        'nodeEditorPanel', edit=True,
        addCallback='override_add_node_editor_panel')

    # store custom cmd
    if custom_hs_cmd:
        cmds.optionVar(sv=[VAR_HS_CMD, custom_hs_cmd])
    if custom_ne_cmd:
        cmds.optionVar(sv=[VAR_NE_CMD, custom_hs_cmd])
def getFileName():
    base = studioBase.StudioSQL()

    loadType = {'Load saved reference load state':'', 
                'Load all references':'all', 
                'Load top-level references only':'topOnly', 
                'Load no references':'none'}

    fileData = mop.OpenDialog.openFile()
    if fileData[0] and fileData[1] and fileData[2]:
        fileName = fileData[1] + '/' + fileData[2]
    else:
        return False

    ref = loadType[fileData[3]]
    selective = fileData[4]
    print('filename', fileName, ref, 'selective', selective, fileData)

    base.setAction('open', fileName)
    if selective:
        cmds.file(fileName, open=True, buildLoadSettings=True )
        num = cmds.selLoadSettings( q=True, numSettings=True)
        cmds.optionVar(sv=('preloadRefEdTopLevelFile', fileName))
        mel.eval('PreloadReferenceEditor')

    else:
        if ref:
            cmds.file(fileName, o=True, f=True, lrd=ref)
        else:
            cmds.file(fileName, o=True, f=True)

    setRecentFile(fileName)

    return True
示例#7
0
def ui():
    '''Launch the UI
    '''
    mc.optionVar( sv=('colorManagementColorPickerColorSpaceSelection','Display Space') )
    win = ColorControlUI()
    win.buildMainLayout()
    win.finish()
    def select_file(self):
        """ Maya Open Dialog to select file texture """
        self.open_dialog_visible = True

        if MTTSettings.value('browserFirstStart'):
            image_dir = cmds.optionVar(query='MTT_browserStartFolder')
        else:
            image_dir = cmds.workspace(query=True,
                                       rootDirectory=True) + cmds.workspace(
                fileRuleEntry='sourceImages')
            MTTSettings.set_value('browserFirstStart', True)

        file_path = cmds.fileDialog2(fileMode=1, startingDirectory=image_dir,
                                     caption='Select a texture',
                                     okCaption='Select')

        if file_path:
            new_path = file_path[0]
            cmds.optionVar(
                sv=['MTT_browserStartFolder', os.path.dirname(new_path)])
            if MTTSettings.value('forceRelativePath'):
                new_path = convert_to_relative_path(new_path)
                # relative_path = workspace(projectPath=new_path)
                # if relative_path != new_path:
                #     new_path = '/%s' % relative_path
            self.line_edit.setText(new_path)
        self.open_dialog_visible = False
        self.close()
        self.editingFinished.emit()
        cmds.showWindow(WINDOW_NAME)
示例#9
0
def hw(*args, **kwargs):
    t0 = float(time.time())
    try:
        verbose = kwargs["verbose"]
    except KeyError:
        verbose = False
        if cmds.optionVar(exists="checkmateVerbosity"):
            verbose = cmds.optionVar(query="checkmateVerbosity")
    else:
        pass

    scenefilename = cmds.file(query=True, sn=True, shn=True)
    root, ext = os.path.splitext(scenefilename)
    fullscenepath = cmds.file(query=True, sn=True, shn=False)
    fullscenedirname = os.path.dirname(fullscenepath)
    reportname = "".join([root, ext.replace(".", "_")])
    img_dir = os.path.join(fullscenedirname, reportname)

    print "save HW rendered images to : %s" % img_dir

    # before we render, save render globals presets
    cmds.nodePreset(save=("defaultRenderQuality", "ttRestorePreviousDefaultRenderViewPreset"))
    cmds.nodePreset(save=("defaultRenderGlobals", "ttRestorePreviousDefaultRenderViewPreset"))
    cmds.nodePreset(save=("defaultResolution", "ttRestorePreviousDefaultRenderViewPreset"))

    # override the user settings
    cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
    ext = ".png"
    # set resolution ot 320x240
    cmds.setAttr("defaultResolution.width", 640)
    cmds.setAttr("defaultResolution.height", 480)
    cmds.setAttr("defaultResolution.deviceAspectRatio", (float(320) / float(240)))

    # set file format to png
    cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
    ext = ".png"
    cmds.setAttr("defaultRenderGlobals.outFormatControl", 0)  # default name.ext
    cmds.setAttr("defaultRenderGlobals.animation", False)

    # cmds.setAttr('defaultRenderGlobals.imageFilePrefix', "../<Camera>", type="string")
    cmds.setAttr("defaultRenderGlobals.imageFilePrefix", "<Camera>", type="string")

    cmds.workspace(fileRule=["images", img_dir])
    print "save rendered images to : %s" % img_dir
    cmds.hwRender(currentFrame=True, cam="top", edgeAntiAliasing=[2, 4], fullRenderSupport=True)
    cmds.hwRender(currentFrame=True, cam="persp", edgeAntiAliasing=[2, 16], fullRenderSupport=True)
    cmds.hwRender(currentFrame=True, cam="front", edgeAntiAliasing=[2, 16], fullRenderSupport=True)
    cmds.hwRender(currentFrame=True, cam="side", edgeAntiAliasing=[2, 16], fullRenderSupport=True)

    # move rendererd images from the default project images dir to the report dir
    sourcedir = os.path.join(cmds.workspace(q=True, rd=True), cmds.workspace(fileRuleEntry="images"))
    targetdir = img_dir
    print "from : ", sourcedir
    print "to   : ", targetdir

    # for img in ['side.png', 'front.png', 'persp.png', 'top.png'] :
    #    os.rename(os.path.join(sourcedir, img),  os.path.join(targetdir, img))

    print "%-24s : %.6f seconds" % ("render.hw()", (float(time.time()) - t0))
    return img_dir
示例#10
0
	def on_highlightModeChange( self, *a ):
		highlightMode = cmd.optionVar( q='zooTrigHighlighting' )
		cmd.optionVar( iv=('zooTrigHighlighting', not highlightMode) )
		if highlightMode:
			pass
		else:
			triggered.Triggered().unhighlightAllTriggers()
示例#11
0
def deleteCustomOptions():
    variablePrefix = "ngSkinTools"
    for varName in cmds.optionVar(list=True):
        if varName.startswith(variablePrefix):
            cmds.optionVar(remove=varName)  
        
    cmds.windowPref('MirrorWeightsWindow',ra=True)  
示例#12
0
def toggleModeState(OptionSelection,OptionList,OptionVarName,ListOfContainers,forceInt = False):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Toggle for turning off and on the visbility of a list of containers

    ARGUMENTS:
    optionSelection(string) - this should point to the variable holding a (bool) value
    optionList(list) - the option selection must be in the optionList

    RETURNS:
    locatorName(string)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    visOn = OptionList.index(OptionSelection)
    if forceInt:
        mc.optionVar(iv=(OptionVarName,int(visOn)))
    else:
        mc.optionVar(sv=(OptionVarName,OptionSelection))

    cnt = 0
    for Container in ListOfContainers:
        if cnt == visOn:
            #Container(e=True,vis=True)
            setUIObjectVisibility(Container,True)
        else:
            #Container(e=True,vis=False)
            setUIObjectVisibility(Container,False)
        cnt+=1
示例#13
0
    def __init__( self,*args,**kws):
        #Check our tool option var for debug mode to set logger level if so
        if mc.optionVar(exists = "cgmVar_guiDebug") and mc.optionVar(q="cgmVar_guiDebug"):
            log.setLevel(logging.DEBUG)	
        self.__toolName__ = __toolName__		
        self.l_allowedDockAreas = ['right', 'left']
        self.WINDOW_NAME = cgmSimpleUI.WINDOW_NAME
        self.WINDOW_TITLE = cgmSimpleUI.WINDOW_TITLE
        self.DEFAULT_SIZE = cgmSimpleUI.DEFAULT_SIZE
        #>>> Standard cgm variables
        #====================	    
        #self.initializeTemplates() 

        #>>> Insert our init, overloaded for other tools
        #self.insert_init(*args,**kws)

        #>>> Menu
        #self.setup_Variables()	
        #self.build_menus()

        #>>> Body
        #====================        
        self.build_layoutWrapper(self)

        self.show()
示例#14
0
def doToggleModeState(OptionSelection,OptionList,OptionVarName,ListOfContainers,forceInt = False):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    This connects to a cgm rework of tabs in maya gui's. Mainly to be used with a form layout is needed
    with tabs. Tabs and form layouts don't work well together. This is a work around

    ARGUMENTS:
    optionSelection(string) - this should point to the variable holding a (int) value
    optionList(list) - the option selection must be in the optionList
    OptionVarName(string)
    ListOfContainers(list) -- list of containers
    forceInt -- forces the optionVar to set

    RETURNS:
    locatorName(string)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    visOn = OptionList.index(OptionSelection)
    if forceInt:
        mc.optionVar(iv=(OptionVarName,int(visOn)))
    else:
        mc.optionVar(sv=(OptionVarName,OptionSelection))

    for cnt,Container in enumerate(ListOfContainers):
        if cnt == visOn:
            Container(e=True,vis=True)
            #doToggleMenuShowState(Container,True)
        else:
            Container(e=True,vis=False)
            #doToggleMenuShowState(Container,False)
        cnt+=1
示例#15
0
def setToDefault(*args):
    cmds.optionVar( intValue=('ui_DefaultMode', 1) )
    cmds.optionVar( intValue=('ui_selectedTabIndex', 1) )
    cmds.optionVar( intValue=('ui_debug', 0) )
    cmds.optionVar( intValue=('ui_updateMode', 1) )

    cmds.optionVar( intValue=('ui_OptionVar', 1) )
示例#16
0
def UI_RBG_updateMode(*args):
    global _updateMode

    _updateMode = args[0]
    cmds.optionVar( intValue=('ui_updateMode', _updateMode ))

    update_from_Select()
	def onBrowse(self, _):
		self.settingsXML = cmds.fileDialog2(fm=1, fileFilter="XML Files (*.xml)", okc="Set")[0]
		cmds.optionVar( sv=(SETTINGS_FILE_SETTING, self.settingsXML) )
		cmds.textField(self.settingsDirCtrl, edit=True, text=self.settingsXML)
		# Set up a new settings manager with the new XML.
		self.settingsManager = OptimizationSettingsManager(self.settingsXML)
		self.updateSettingFileList()
示例#18
0
def run(*args, **kwargs):
    """ prepare the scene for the tests
    converts scene to use centimeters
    set the grid to the default
    
    """
    valid_kwargs = ['verbose']
    for k, v in kwargs.iteritems():
        if k not in valid_kwargs:
            raise TypeError("Invalid keyword argument %s" % k)
    # verbose defaults to False if verbose option not set in menu or set 
    # as cmdline argument
     
    try:
        verbose = kwargs['verbose']
    except KeyError:
        verbose = False 
    	if cmds.optionVar(exists='checkmateVerbosity'):
    		verbose = cmds.optionVar(query='checkmateVerbosity')
    else:
        verbose = False       
    batch = cmds.about(batch=True)    
    # get the name of the script Editor's output control
    from maya import mel as mel
    # Turn off Echo All Commands in the Script Editor  
    # Disable Stack Tracevin the Script Editor  
    # Turn off Line Numbers in errors in the Script Editor  
    # Reset the grid
    # Set the background color
    # Turn off the heads-up displays
    # Switch to wrireframe mode
    # Close all windows (except main)
    # Close ChannelBox, Attribute Editor and Outliner ()
    
    if not batch:
        try:
            gCommandReporter = mel.eval("proc string f(string $g){return $g;}f($gCommandReporter);")
        except RuntimeError:
            gCommandReporter = ''
            pass
        try:
            cmds.cmdScrollFieldReporter(gCommandReporter, 
                edit=True, 
                echoAllCommands=False,
                lineNumbers=True,
                stackTrace=True,
                suppressResults=False,
                suppressInfo=False,
                suppressWarnings=False,
                suppressErrors=False,
                suppressStackTrace=False,
                )
        except RuntimeError:
            if verbose:
                print 'No Script Editor'
            pass
    
    # convert scene to cm to fix crashes in nearestnormal
    cmds.currentUnit(linear='cm')
    def _set_filter_value(self, key, value):
        self.model.layoutAboutToBeChanged.emit()

        MTTSettings.set_value(key, value)
        cmds.optionVar(stringValue=('filtered_instances', ''))

        self.model.layoutChanged.emit()
        self.update_node_file_count()
示例#20
0
    def cleanAndClose(self,*args):
        if cmds.checkBox('n_pHoldKeys', query = True, v = True) == True:
            cmds.optionVar(intValue = ('kT_kC_preserveHoldKeys', 1))
        else:
            cmds.optionVar(intValue = ('kT_kC_preserveHoldKeys',0))

        keyCleanup()
        self.closeUI()
示例#21
0
文件: gator.py 项目: Regnareb/Maya
 def savePrefs(self, label, refresh, *args):
     """Save preferences in optionVars"""
     method = getattr(cmds, self.typeUI[label])
     argument = 'value' if 'heckBox' in self.typeUI[label] else 'collapsable'
     variable = {'query':True, argument:True}
     self.preferences[label] = method(self.interface[label], **variable)
     cmds.optionVar(intValue=('pns_' + label, self.preferences[label]))
     self.updateUI(label, refresh)
示例#22
0
 def getDefaultStrValue( self, name, value ):
   name = 'meCheckTexturePaths_' + name
   if cmds.optionVar( exists=name ) == 1:
     ret = cmds.optionVar( q=name )
   else:
     cmds.optionVar( sv=( name, value) )
     ret = value
   return ret
示例#23
0
def add_CheckBox(self,parent,optionVarName,*a,**kw):
    fullName = self.create_guiOptionVar(optionVarName)    

    return mUI.MelCheckBox(parent,
                           v = mc.optionVar(q=fullName),
                           onCommand = lambda *a: mc.optionVar(iv=(fullName,1)),
                           offCommand = lambda *a: mc.optionVar(iv=(fullName,0)),
                           *a,**kw)
示例#24
0
def _disabled_inview_messages():
    """Disable in-view help messages during the context"""
    original = cmds.optionVar(q="inViewMessageEnable")
    cmds.optionVar(iv=("inViewMessageEnable", 0))
    try:
        yield
    finally:
        cmds.optionVar(iv=("inViewMessageEnable", original))
示例#25
0
def getDefaultFloatValue( self_prefix, name, value ):
  var_name = self_prefix + name
  if cmds.optionVar( exists=var_name ) == 1:
    ret = cmds.optionVar( q=var_name )
  else:
    cmds.optionVar( fv=( var_name, value) )
    ret = value
  return ret
示例#26
0
def SundayUIToolsDockedShaderlinerSwatchToggle():
    if cmds.optionVar(query = 'SundayShaderlinerSwatch'):
        cmds.optionVar(intValue = ('SundayShaderlinerSwatch', 0))
        cmds.iconTextButton('SundayShaderlinerIcon', edit = True, image = SundayImage + 'SundaySolidSphereColor.png')
    else:
        cmds.optionVar(intValue = ('SundayShaderlinerSwatch', 1))
        cmds.iconTextButton('SundayShaderlinerIcon', edit = True, image = SundayImage + 'SundaySolidSphere.png')
    SundayUIToolsDockedShaderlinerUpdate()
示例#27
0
 def load(self):
     if not m.optionVar(exists=self.optVarName):
         return {}
     try:
         obj = json.loads(m.optionVar(q=self.optVarName))
     except Exception as e:
         message('Error occurred while loading option variable {0}.\nAdditional exception info:\n{1}'.format(self.optVarName, str(e)))
         raise
     return obj
示例#28
0
 def loadOption(varName,defaultValue):
     '''
     loads value from optionVar
     '''
     
     if cmds.optionVar(exists=varName):
         return cmds.optionVar(q=varName)
     
     return defaultValue; 
示例#29
0
def setLinearUnit(unit):
    validUnits = ["mm", "millimeter", "cm", "centimeter", "m", "meter", "km", "kilometer", "in", "inch", "ft", "foot", "yd", "yard", "mi", "mile"]

    if unit in validUnits:
        cmds.optionVar(sv = ["workingUnitLinear", unit])
        cmds.optionVar(sv = ["workingUnitLinearDefault", unit])
        cmds.currentUnit(linear=unit)
    else:
        cmds.warning('Please specify a valid unit.')
 def set_hotkeys(self, key_set, category=HOTKEY_CATEGORY, *args):
     """Set hotkeys to given key set under given category."""
     self.active = key_set
     cmds.optionVar(sv=(OPTVAR, key_set))
     for key in self.hotkey_map[key_set]:
         if not cmd_exists(key.name):
             self.create_runtime_cmd(key)
         self.create_name_cmd(key)
         cmds.hotkey(**key.key_args)
示例#31
0
文件: install.py 项目: afatka/Pabuito
def install():

    #ask the user to install pabuito on the active shelf or a new shelf
    install_type = cmds.confirmDialog(
        title='Install Pabuito',
        message='Install to active shelf or new shelf?',
        button=['Active', 'New'],
        defaultButton='New',
        cancelButton='New',
        dismissString='New')

    icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
    parent_shelfTabLayout = mel.eval(
        "global string $gShelfTopLevel; $temp = $gShelfTopLevel;")
    shelves = cmds.tabLayout(parent_shelfTabLayout,
                             query=True,
                             childArray=True)
    if install_type == 'Active':
        for shelf in shelves:
            if cmds.shelfLayout(shelf, query=True, visible=True):
                install_shelf = shelf
    if install_type == 'New':
        install_shelf = 'PGS'
        i = 1
        while True:
            if install_shelf not in shelves:
                break
            else:
                install_shelf = 'PGS' + str(i)
                i += 1
        cmds.shelfLayout(install_shelf, parent=parent_shelfTabLayout)

    #Pabuito shelf maker button
    cmds.shelfButton(parent=install_shelf,
                     annotation='Pabtuito Shelf Maker',
                     image1=os.path.join(icon_dir, 'psm.png'),
                     command="""
#pabuito shelf maker
from pabuito import pabuitoShelfMaker as psm
reload(psm)

with psm.PabuitoShelfMaker() as psm:
	print 'PSM Running'
		""",
                     sourceType='python',
                     label='PSM')

    #Pabuito Pickle Loader Button
    cmds.shelfButton(parent=install_shelf,
                     annotation='Pabuito Pickle Loader',
                     image1=os.path.join(icon_dir, 'ppl.png'),
                     command="""
#Pabuito Pickle Loader
import maya.cmds as cmds
PGSFile = cmds.fileDialog2(caption = 'Please select project file', fileMode = 1, fileFilter = "PGS (*.pgs)")[0]

from pabuito import pabuitoGradingSystem as pgs
pgsGUI = pgs.PabuitoGradingSystem(PGSFile)
		""",
                     sourceType='python',
                     label='PPL')

    shelfDirectory = cmds.internalVar(
        userShelfDir=True) + 'shelf_' + install_shelf
    cmds.saveShelf(install_shelf, shelfDirectory)

    cmds.confirmDialog(title='Install Complete',
                       message='Pabuito Install Complete!',
                       button=['Awesome'])

    #this is a fix for a Maya issue 'provided' from Gary Fixler > in the comments MAR 2012
    # http://www.nkoubi.com/blog/tutorial/how-to-create-a-dynamic-shelf-plugin-for-maya/

    topLevelShelf = mel.eval(
        "global string $gShelfTopLevel; $temp = $gShelfTopLevel;")
    shelves = cmds.shelfTabLayout(topLevelShelf,
                                  query=True,
                                  tabLabelIndex=True)
    for index, shelf in enumerate(shelves):
        cmds.optionVar(stringValue=('shelfName%d' % (index + 1), str(shelf)))
示例#32
0
	def Match_buildLayout(self,parent):
		mc.setParent(parent)
		guiFactory.header('Update')

		#>>>Match Mode
		self.MatchModeCollection = MelRadioCollection()
		self.MatchModeCollectionChoices = []		
		if not mc.optionVar( ex='cgmVar_AnimToolsMatchMode' ):
			mc.optionVar( iv=('cgmVar_AnimToolsMatchMode', 0) )	
			
		guiFactory.appendOptionVarList(self,'cgmVar_AnimToolsMatchMode')
			
		#MatchModeFlagsRow = MelHLayout(parent,ut='cgmUISubTemplate',padding = 2)	
		MatchModeFlagsRow = MelHSingleStretchLayout(parent,ut='cgmUIReservedTemplate',padding = 2)	
		MelSpacer(MatchModeFlagsRow,w=2)				
		self.MatchModeOptions = ['parent','point','orient']
		for item in self.MatchModeOptions:
			cnt = self.MatchModeOptions.index(item)
			self.MatchModeCollectionChoices.append(self.MatchModeCollection.createButton(MatchModeFlagsRow,label=self.MatchModeOptions[cnt],
			                                                                             onCommand = Callback(guiFactory.toggleOptionVarState,self.MatchModeOptions[cnt],self.MatchModeOptions,'cgmVar_AnimToolsMatchMode',True)))
			MelSpacer(MatchModeFlagsRow,w=3)
		MatchModeFlagsRow.setStretchWidget( self.MatchModeCollectionChoices[-1] )
		MelSpacer(MatchModeFlagsRow,w=2)		
		MatchModeFlagsRow.layout()	
		
		mc.radioCollection(self.MatchModeCollection ,edit=True,sl= (self.MatchModeCollectionChoices[ (mc.optionVar(q='cgmVar_AnimToolsMatchMode')) ]))
		
		#>>>Time Section
		UpdateOptionRadioCollection = MelRadioCollection()
		
		#>>> Time Menu Container
		self.BakeModeOptionList = ['Current Frame','Bake']
		cgmVar_Name = 'cgmVar_AnimToolsBakeState'
		if not mc.optionVar( ex=cgmVar_Name ):
			mc.optionVar( iv=(cgmVar_Name, 0) )
			
		EveryFrameOption = mc.optionVar( q='cgmVar_AnimToolsBakeState' )
		guiFactory.appendOptionVarList(self,'cgmVar_AnimToolsBakeState')
		
		#build our sub section options
		self.ContainerList = []
		
		#Mode Change row 
		ModeSetRow = MelHSingleStretchLayout(parent,ut='cgmUISubTemplate')
		self.BakeModeRadioCollection = MelRadioCollection()
		self.BakeModeChoiceList = []	
		MelSpacer(ModeSetRow,w=2)

		self.BakeModeChoiceList.append(self.BakeModeRadioCollection.createButton(ModeSetRow,label=self.BakeModeOptionList[0],
	                                                                      onCommand = Callback(guiFactory.toggleModeState,self.BakeModeOptionList[0],self.BakeModeOptionList,cgmVar_Name,self.ContainerList,True)))
		
		ModeSetRow.setStretchWidget( MelSpacer(ModeSetRow) )
		
		self.BakeModeChoiceList.append(self.BakeModeRadioCollection.createButton(ModeSetRow,label=self.BakeModeOptionList[1],
	                                                                      onCommand = Callback(guiFactory.toggleModeState,self.BakeModeOptionList[1],self.BakeModeOptionList,cgmVar_Name,self.ContainerList,True)))
		
		ModeSetRow.layout()
		
		
		#>>>
		self.ContainerList.append( self.buildPlaceHolder(parent) )
		self.ContainerList.append( self.buildTimeSubMenu( parent) )
		
		mc.radioCollection(self.BakeModeRadioCollection,edit=True, sl=self.BakeModeChoiceList[mc.optionVar(q=cgmVar_Name)])
		#>>>
		
		mc.setParent(parent)

		guiFactory.doButton2(parent,'Do it!',
	                         lambda *a: locinatorLib.doUpdateLoc(self),
	                         'Update an obj or locator at a particular frame or through a timeline')

		guiFactory.lineSubBreak()


		#>>>  Loc Me Section
		guiFactory.lineBreak()
		guiFactory.lineSubBreak()
		guiFactory.doButton2(parent,'Just Loc Selected',
			                 lambda *a: locinatorLib.doLocMe(self),
			                 'Create an updateable locator based off the selection and options')


		#>>>  Tag Section
		guiFactory.lineSubBreak()
		guiFactory.doButton2(parent,'Tag it',
		                     lambda *a: locinatorLib.doTagObjects(self),
				             "Tag the selected objects to the first locator in the selection set. After this relationship is set up, you can match objects to that locator.")
 def saveWnd(self):
     geo = self.geometry()
     cmds.optionVar(iv=('selector_geo_x',geo.x()))
     cmds.optionVar(iv=('selector_geo_y',geo.y()))
     cmds.optionVar(iv=('selector_geo_w',geo.width()))
     cmds.optionVar(iv=('selector_geo_h',geo.height()))
def clearOptionVars():
    '''
    testing function to clear the saved optionVars
    '''
    cmds.optionVar(rm='playblastFFmpeg_ffmpegLoc')
    cmds.optionVar(rm='playblastFFmpeg_outputLoc')
    cmds.optionVar(rm='playblastFFmpeg_outframe')
    #print cmds.optionVar(q='playblastFFmpeg_outframe')
    cmds.optionVar(rm='playblastFFmpeg_inframe')
    cmds.optionVar(rm='playblastFFmpeg_resolutionx')
    cmds.optionVar(rm='playblastFFmpeg_resolutiony')
    #print cmds.optionVar(q='playblastFFmpeg_ffmpegLoc')
    print "cleared Option Vars"
示例#35
0
def setup_scene(file_path=''):
    # RESOLUTION
    try:
        cmds.setAttr("defaultResolution.width",
                     Tank().data['project']['resolution'][0])
        cmds.setAttr("defaultResolution.height",
                     Tank().data['project']['resolution'][1])
        cmds.setAttr('defaultResolution.deviceAspectRatio',
                     ((Tank().data['project']['resolution'][0]) /
                      (Tank().data['project']['resolution'][1])))
    except:
        LOG.error('FAILED load resolution.', exc_info=True)

    # IMG FORMAT
    # try:
    #     cmds.setAttr("defaultRenderGlobals.imageFormat", 8)
    # except: LOG.error('FAILED load img format.', exc_info=True)

    # FPS
    try:
        fps = software_data['SETTINGS']['FPS'][Tank().data['project']['fps']]
        cmds.currentUnit(time=fps)
        cmds.optionVar(sv=("workingUnitTime", fps))
        cmds.optionVar(sv=("workingUnitTimeDefault", fps))
    except:
        LOG.error('FAILED load fps.', exc_info=True)

    # UNIT
    try:
        cmds.currentUnit(linear=software_data['SETTINGS']['unit'])
    except:
        LOG.error('FAILED load unit.', exc_info=True)

    # RENDERER
    try:
        renderer = software_data['renderer']
        cmds.optionVar(sv=("preferredRenderer", software_data['renderer']))
        cmds.optionVar(sv=("preferredRendererHold", software_data['renderer']))
    except:
        LOG.error('FAILED load renderer.', exc_info=True)

    # ANIMATION extension
    try:
        cmds.setAttr('defaultRenderGlobals.animation', 1)
        cmds.setAttr('defaultRenderGlobals.putFrameBeforeExt', 1)
        cmds.setAttr('defaultRenderGlobals.extensionPadding', 4)
    except:
        LOG.error('FAILED set extension.', exc_info=True)

    if file_path:
        try:
            render_path = os.path.dirname(os.path.dirname(file_path))
            render_path += "/" + Tank(
            ).data['rules']["STATUS"]["render"] + "/<Scene>/<Scene>"
            cmds.setAttr('defaultRenderGlobals.imageFilePrefix',
                         render_path,
                         type='string')
        except:
            LOG.error('FAILED set image path.', exc_info=True)

        try:
            import pymel.core as pm
            pm.mel.setProject(os.path.dirname(file_path))
        except:
            LOG.error('FAILED set project path.', exc_info=True)
示例#36
0
def hideMainMenuBar():
    global mainMenuBarVisible
    mainMenuBarVisible = cmds.optionVar(q="mainWindowMenubarVis")
 def save_settings(*args):
     if cmds.textFieldButtonGrp('ffmpegLoc', q=True, text=True):
         cmds.optionVar(
             sv=('playblastFFmpeg_ffmpegLoc',
                 cmds.textFieldButtonGrp('ffmpegLoc', q=True, text=True)))
     if cmds.textFieldButtonGrp(outputLocationText, q=True, text=True):
         cmds.optionVar(sv=(
             'playblastFFmpeg_outputLoc',
             cmds.textFieldButtonGrp('VideoOutputLoc', q=True, text=True)))
     cmds.optionVar(sv=('playblastFFmpeg_resolutionx',
                        cmds.textField(set_resolutionx, q=True, text=True)))
     cmds.optionVar(sv=('playblastFFmpeg_resolutiony',
                        cmds.textField(set_resolutiony, q=True, text=True)))
     cmds.optionVar(sv=('playblastFFmpeg_inframe',
                        cmds.textField(set_inframe, q=True, text=True)))
     cmds.optionVar(sv=('playblastFFmpeg_outframe',
                        cmds.textField(set_outframe, q=True, text=True)))
示例#38
0
    def assignObjectId(self):
        assetName = str(self.ui.name_lineEdit.text())
        row = self.ui.id_tableWidget.currentRow()
        widget = 'id_tableWidget'
        allAssetData = self.getAllData(self.assetColumn, widget)
        allAssetId = self.getAllData(self.objectIDColumn, widget)
        allAssetPath = self.getAllData(self.assetPathColumn, widget)
        assetPath = str(self.ui.path_lineEdit.text())
        user = mc.optionVar(q='PTuser')

        occupiedIdList = self.occupiedId()

        text = assetName
        column = 1
        assetExists = False
        assetExistingId = 0

        # check for assigning duplicate asset
        loopRow = 0
        duplicateRow = []
        for eachAsset in allAssetData:
            dataAssetPath = allAssetPath[loopRow]

            if eachAsset == assetName or assetPath == dataAssetPath:
                objectId = int(allAssetId[loopRow])

                if not objectId in occupiedIdList:
                    if not loopRow in duplicateRow:
                        duplicateRow.append(loopRow)

                else:
                    assetExists = True
                    assetExistingId = objectId

            loopRow += 1

        # remove duplicate asset
        if duplicateRow:
            for each in duplicateRow:
                self.fillInTable(each,
                                 self.assetColumn,
                                 '-',
                                 widget,
                                 color=[1, 1, 1])
                self.fillInTable(each,
                                 self.userColumn,
                                 '-',
                                 widget,
                                 color=[1, 1, 1])
                self.fillInTable(each,
                                 self.assetPathColumn,
                                 '-',
                                 widget,
                                 color=[1, 1, 1])

        if not assetExists:
            # fill data
            self.fillInTable(row,
                             self.assetColumn,
                             text,
                             widget,
                             color=[1, 1, 1])
            self.fillInTable(row,
                             self.userColumn,
                             user,
                             widget,
                             color=[1, 1, 1])
            self.fillInTable(row,
                             self.assetPathColumn,
                             assetPath,
                             widget,
                             color=[1, 1, 1])

            self.ui.assignMatteID_pushButton.setEnabled(True)
            self.ui.createMultiMatte_pushButton.setEnabled(False)
            self.ui.assignObjectID_pushButton.setEnabled(False)

            self.ui.id_tableWidget.resizeColumnToContents(self.userColumn)
            self.ui.id_tableWidget.resizeColumnToContents(self.assetPathColumn)

            self.assignObjectIdStatus = True

        else:
            self.messageBox(
                'Asset already exists',
                '"%s" or "%s" already in database. id "%s".' %
                (assetName, assetPath, assetExistingId))

            if self.ui.vrayProp_checkBox.isChecked():
                self.createVrayProps(assetName, assetExistingId)
示例#39
0
 def _debugButton(self, *args):
     """
     Debugging button, handy for testing.
     """
     directory = cmds.optionVar(q='MacroToolsDirectory')
     print(directory)
 def on_node_type_changed(self, index):
     cmds.optionVar(
         sv=['MTT_lastNodeType', self.supported_node_type[index]])
    def __create_ui(self):
        """ Create main UI """
        self.setWindowTitle(CREATE_NODE_TITLE)

        # remove window decoration if path and type is set
        if self.defined_path and self.defined_type:
            self.setWindowFlags(Qt.FramelessWindowHint | Qt.Popup)

        main_layout = QVBoxLayout(self)
        main_layout.setSpacing(1)
        main_layout.setContentsMargins(2, 2, 2, 2)

        # content layout
        content_layout = QVBoxLayout()
        self.files_model = QFileSystemModel()
        self.files_model.setNameFilterDisables(False)
        self.files_list = MTTFileList()
        self.files_list.setAlternatingRowColors(True)
        self.files_list.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.files_list.selectionValidated.connect(self.do_validate_selection)
        self.files_list.goToParentDirectory.connect(self.on_go_up_parent)
        self.files_list.doubleClicked.connect(self.on_double_click)
        self.files_list.setModel(self.files_model)

        buttons_layout = QHBoxLayout()

        content_layout.addLayout(self.__create_filter_ui())
        content_layout.addWidget(self.files_list)
        content_layout.addLayout(buttons_layout)
        self.files_list.filter_line = self.filter_line

        if not self.defined_path:
            # path line
            path_layout = QHBoxLayout()
            # bookmark button
            bookmark_btn = QPushButton('')
            bookmark_btn.setFlat(True)
            bookmark_btn.setIcon(QIcon(':/addBookmark.png'))
            bookmark_btn.setToolTip('Bookmark this Folder')
            bookmark_btn.setStatusTip('Bookmark this Folder')
            bookmark_btn.clicked.connect(self.on_add_bookmark)
            # path line edit
            self.path_edit = QLineEdit()
            self.path_edit.editingFinished.connect(self.on_enter_path)
            # parent folder button
            self.parent_folder_btn = QPushButton('')
            self.parent_folder_btn.setFlat(True)
            self.parent_folder_btn.setIcon(
                QIcon(':/SP_FileDialogToParent.png'))
            self.parent_folder_btn.setToolTip('Parent Directory')
            self.parent_folder_btn.setStatusTip('Parent Directory')
            self.parent_folder_btn.clicked.connect(self.on_go_up_parent)
            # browse button
            browse_btn = QPushButton('')
            browse_btn.setFlat(True)
            browse_btn.setIcon(QIcon(':/navButtonBrowse.png'))
            browse_btn.setToolTip('Browse Directory')
            browse_btn.setStatusTip('Browse Directory')
            browse_btn.clicked.connect(self.on_browse)
            # parent widget and layout
            path_layout.addWidget(bookmark_btn)
            path_layout.addWidget(self.path_edit)
            path_layout.addWidget(self.parent_folder_btn)
            path_layout.addWidget(browse_btn)
            main_layout.addLayout(path_layout)

            # bookmark list
            bookmark_parent_layout = QHBoxLayout()
            bookmark_frame = QFrame()
            bookmark_frame.setFixedWidth(120)
            bookmark_layout = QVBoxLayout()
            bookmark_layout.setSpacing(1)
            bookmark_layout.setContentsMargins(2, 2, 2, 2)
            bookmark_frame.setLayout(bookmark_layout)
            bookmark_frame.setFrameStyle(QFrame.Sunken)
            bookmark_frame.setFrameShape(QFrame.StyledPanel)
            self.bookmark_list = MTTBookmarkList()
            self.bookmark_list.bookmarkDeleted.connect(self.do_delete_bookmark)
            self.bookmark_list.setAlternatingRowColors(True)
            self.bookmark_list.dragEnabled()
            self.bookmark_list.setAcceptDrops(True)
            self.bookmark_list.setDropIndicatorShown(True)
            self.bookmark_list.setDragDropMode(QListView.InternalMove)
            self.bookmark_list_sel_model = self.bookmark_list.selectionModel()
            self.bookmark_list_sel_model.selectionChanged.connect(
                self.on_select_bookmark)

            bookmark_layout.addWidget(self.bookmark_list)
            bookmark_parent_layout.addWidget(bookmark_frame)
            bookmark_parent_layout.addLayout(content_layout)
            main_layout.addLayout(bookmark_parent_layout)

            self.do_populate_bookmarks()

        else:
            main_layout.addLayout(content_layout)

        if not self.defined_type:
            # type layout
            self.types = QComboBox()
            self.types.addItems(self.supported_node_type)
            self.types.currentIndexChanged.connect(self.on_node_type_changed)
            if cmds.optionVar(exists='MTT_lastNodeType'):
                last = cmds.optionVar(query='MTT_lastNodeType')
                if last in self.supported_node_type:
                    self.types.setCurrentIndex(
                        self.supported_node_type.index(last))
            buttons_layout.addWidget(self.types)

        if not self.defined_path or not self.defined_type:
            create_btn = QPushButton('C&reate')
            create_btn.clicked.connect(self.accept)
            cancel_btn = QPushButton('&Cancel')
            cancel_btn.clicked.connect(self.reject)

            buttons_layout.addStretch()
            buttons_layout.addWidget(create_btn)
            buttons_layout.addWidget(cancel_btn)
示例#42
0
def checkIfp4Edit(sceneName):
    p4Enabled = isPerforceEnabled()
    sceneName = P4File(sceneName)

    #check out of perforce
    if not Path(sceneName).exists:
        return

    if not p4Enabled:
        ans = cmd.confirmDialog(
            t="p4 integration disabled",
            m=
            "perforce integration has been turned off\ndo you want to turn it back on?",
            b=("Yes", "No"),
            db="Yes")
        if ans == "Yes":
            enablePerforce()
        else:
            return

    names = []
    data = []
    isEdit = sceneName.isEdit()

    if isEdit is False:
        ans = ''
        default = cmd.optionVar(q='vSaveAutoCheckout') if cmd.optionVar(
            ex='vSaveAutoCheckout') else ''
        if default == "":
            ans = cmd.confirmDialog(
                t="file isn't checked out",
                m="the file: %s\nisn't checked out\ndo you want me to open for edit?"
                % sceneName,
                b=("Yes", "No", "always", "never"),
                db="OK")
            if ans == "always":
                cmd.optionVar(sv=('vSaveAutoCheckout', "always"))
            elif ans == "never":
                cmd.optionVar(sv=('vSaveAutoCheckout', "never"))
                melWarning(
                    "file is checked into perforce - and pref is set to never checkout before save, so bailing..."
                )
                return

            default = cmd.optionVar(q='vSaveAutoCheckout')

        #if the user has specified never - and the file isn't open for edit, then bail.  we don't even want to try to save because the file isn't writeable
        if default == "never":
            ans = cmd.confirmDialog(
                t="file isn't checked out",
                m="file isn't checked out - bailing on save",
                b=("OK", "turn auto checkout back on"),
                db="OK")
            if ans != "OK":
                cmd.optionVar(rm='vSaveAutoCheckout')
            else:
                melWarning(
                    "file is checked into perforce - and pref is set to never checkout before save, so bailing..."
                )
                return

        if ans == "Yes" or ans == "always":
            sceneName.edit()
示例#43
0
def reset_persistent_settings_auto_fk():
    ''' Resets persistant settings for GT Auto FK '''
    cmds.optionVar(remove='gt_auto_fk_using_custom_curve')
    cmds.optionVar(remove='gt_auto_fk_custom_curve')
    cmds.optionVar(remove='gt_auto_fk_failed_to_build_curve')
    cmds.optionVar(remove='gt_auto_fk_mimic_hierarchy')
    cmds.optionVar(remove='gt_auto_fk_constraint_joint')
    cmds.optionVar(remove='gt_auto_fk_auto_color_ctrls')
    cmds.optionVar(remove='gt_auto_fk_select_hierarchy')
    cmds.optionVar(remove='gt_auto_fk_curve_radius')
    cmds.optionVar(remove='gt_auto_fk_string_ctrl_suffix')
    cmds.optionVar(remove='gt_auto_fk_string_ctrl_grp_suffix')
    cmds.optionVar(remove='gt_auto_fk_string_joint_suffix')
    cmds.optionVar(remove='gt_auto_fk_undesired_strings')

    for def_value in gt_auto_fk_settings_default_values:
        for value in gt_auto_fk_settings:
            if def_value == value:
                gt_auto_fk_settings[
                    value] = gt_auto_fk_settings_default_values[def_value]

    get_persistent_settings_auto_fk()
    build_gui_auto_fk()
    cmds.warning('Persistent settings for ' + script_name + ' were cleared.')
示例#44
0
def create_wrap(driver,
                driven,
                weightThreshold=0,
                limitWrapInfluence=0,
                maxDistance=1,
                wrapInflType=2,
                exclusiveBind=1,
                autoWeightThreshold=1,
                renderInfl=0,
                falloffMode="surface"):

    cmds.optionVar(fv=["weightThreshold", weightThreshold])
    cmds.optionVar(iv=["limitWrapInfluence", limitWrapInfluence])
    cmds.optionVar(iv=["maxDistance", maxDistance])
    cmds.optionVar(iv=["wrapInflType", wrapInflType])
    cmds.optionVar(iv=["exclusiveBind", exclusiveBind])
    cmds.optionVar(iv=["autoWeightThreshold", autoWeightThreshold])
    cmds.optionVar(iv=["renderInfl", renderInfl])
    print("falloffMode", falloffMode)
    cmds.optionVar(sv=["falloffMode", falloffMode])

    cmds.select(cl=True)
    cmds.select(driven)
    cmds.select(driver, add=True)

    mel.eval("CreateWrap;")

    if isinstance(driven, list):
        driven_node = driven[0]
    else:
        driven_node = driven
    driven_type = cmds.nodeType(driven_node)

    if driven_type == "transform":
        driven_node = cmds.listRelatives(driven_node, shapes=True)[0]
    return cmds.listConnections(driven_node, type="wrap")[0]
示例#45
0
def hideGrid():
    global gridVisible
    gridVisible = cmds.optionVar(q="showGrid")
    cmds.grid(toggle=0)
示例#46
0
	def setupVariables(self):
		self.LocinatorUpdateObjectsOptionVar = OptionVarFactory('cgmVar_AnimToolsUpdateMode',defaultValue = 0)
		guiFactory.appendOptionVarList(self,self.LocinatorUpdateObjectsOptionVar.name)
		
		self.LocinatorUpdateObjectsBufferOptionVar = OptionVarFactory('cgmVar_LocinatorUpdateObjectsBuffer',defaultValue = [''])
		guiFactory.appendOptionVarList(self,self.LocinatorUpdateObjectsBufferOptionVar.name)	
		
		if not mc.optionVar( ex='cgmVar_ForceBoundingBoxState' ):
			mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 0) )
		if not mc.optionVar( ex='cgmVar_ForceEveryFrame' ):
			mc.optionVar( iv=('cgmVar_ForceEveryFrame', 0) )
		if not mc.optionVar( ex='cgmVar_animToolsShowHelp' ):
			mc.optionVar( iv=('cgmVar_animToolsShowHelp', 0) )
		if not mc.optionVar( ex='cgmVar_CurrentFrameOnly' ):
			mc.optionVar( iv=('cgmVar_CurrentFrameOnly', 0) )
		if not mc.optionVar( ex='cgmVar_animToolsShowHelp' ):
			mc.optionVar( iv=('cgmVar_animToolsShowHelp', 0) )
			
		guiFactory.appendOptionVarList(self,'cgmVar_animToolsShowHelp')
def create_window():
    '''
    checks if optionVars exist, and if not, create them with defaults
    '''
    if not cmds.optionVar(q='playblastFFmpeg_ffmpegLoc'):
        cmds.optionVar(sv=('playblastFFmpeg_ffmpegLoc', ''))
    if not cmds.optionVar(q='playblastFFmpeg_outputLoc'):
        cmds.optionVar(sv=('playblastFFmpeg_outputLoc',
                           '/movies/playblast.mov'))
    if not cmds.optionVar(q='playblastFFmpeg_resolutionx'):
        cmds.optionVar(sv=('playblastFFmpeg_resolutionx', 1920))
    if not cmds.optionVar(q='playblastFFmpeg_resolutiony'):
        cmds.optionVar(sv=('playblastFFmpeg_resolutiony', 1080))
    if not cmds.optionVar(q='playblastFFmpeg_inframe'):
        cmds.optionVar(sv=('playblastFFmpeg_inframe', 0))
    if not cmds.optionVar(q='playblastFFmpeg_outframe'):
        cmds.optionVar(sv=('playblastFFmpeg_outframe', 100))
    '''
    sets window ID variable, 
    checks if it already exists, and if it does, deletes the existing one
    then creates the new window
    '''
    winID = 'playblastFFmpeg'
    if cmds.window(winID, exists=True):
        cmds.deleteUI(winID)
    cmds.window(winID, title='Playblast FFmpeg')
    '''
    creates optionVars to save variables into maya, so textboxes will keep their text after reloading window or Maya
    '''
    def save_settings(*args):
        if cmds.textFieldButtonGrp('ffmpegLoc', q=True, text=True):
            cmds.optionVar(
                sv=('playblastFFmpeg_ffmpegLoc',
                    cmds.textFieldButtonGrp('ffmpegLoc', q=True, text=True)))
        if cmds.textFieldButtonGrp(outputLocationText, q=True, text=True):
            cmds.optionVar(sv=(
                'playblastFFmpeg_outputLoc',
                cmds.textFieldButtonGrp('VideoOutputLoc', q=True, text=True)))
        cmds.optionVar(sv=('playblastFFmpeg_resolutionx',
                           cmds.textField(set_resolutionx, q=True, text=True)))
        cmds.optionVar(sv=('playblastFFmpeg_resolutiony',
                           cmds.textField(set_resolutiony, q=True, text=True)))
        cmds.optionVar(sv=('playblastFFmpeg_inframe',
                           cmds.textField(set_inframe, q=True, text=True)))
        cmds.optionVar(sv=('playblastFFmpeg_outframe',
                           cmds.textField(set_outframe, q=True, text=True)))

    # FFMPEG LOCATION
    '''
    function to open a file dialog, and then edit the textbox for ffmpeg location with the selected location
    '''

    def get_ffmpeg_path(*args):
        file_path = cmds.fileDialog2(fm=1)[0]
        cmds.textFieldButtonGrp('ffmpegLoc', e=1, text=file_path)
        save_settings()

    '''
    Text box and button to set the ffmpeg location for the ffmpeg command after playblasting
    '''
    cmds.columnLayout(w=300, rs=5)
    ffmpegLocation = cmds.optionVar(q='playblastFFmpeg_ffmpegLoc')
    ffmpegLocationText = cmds.textFieldButtonGrp('ffmpegLoc',
                                                 label='FFmpeg Location',
                                                 buttonLabel='FFmpeg Location',
                                                 text=ffmpegLocation,
                                                 cc=save_settings,
                                                 bc=get_ffmpeg_path)
    cmds.setParent('..')

    # RESOLUTION
    '''
    Text boxes to set the X and Y playblast resolution
    '''
    cmds.columnLayout()
    cmds.text(label="")
    cmds.text(label="Video Resolution")
    resolutionx = cmds.optionVar(q='playblastFFmpeg_resolutionx')
    set_resolutionx = cmds.textField(text=resolutionx, cc=save_settings)
    resolutiony = cmds.optionVar(q='playblastFFmpeg_resolutiony')
    set_resolutiony = cmds.textField(text=resolutiony, cc=save_settings)

    # IN/OUT
    '''
    Set the in and out frames for the playblast
    '''
    cmds.columnLayout()
    cmds.text(label="")
    cmds.text(label="In and Out Frames")
    inframe = cmds.optionVar(q="playblastFFmpeg_inframe")
    set_inframe = cmds.textField(text=inframe, cc=save_settings)
    outframe = cmds.optionVar(q="playblastFFmpeg_outframe")
    set_outframe = cmds.textField(text=outframe, cc=save_settings)

    # VIDEO FORMAT
    '''
    Dropdown menu to let the user select the output video format
    '''
    cmds.columnLayout()
    cmds.text(label="")
    cmds.text(label="")
    cmds.optionMenu('selected_video_format',
                    label='Format',
                    cc=printFormatMenuItem)
    cmds.menuItem('ext', label="use extension")
    #cmds.menuItem('jpeg', label='jpeg sequence')
    #cmds.menuItem('mov', label="mov")
    #cmds.menuItem('mp4', label="mp4")
    #cmds.menuItem('webm', label="Webm")

    # ENCODE FORMAT
    '''
    Dropdown menu to let the user select the video encode format for ffmpeg
    '''
    cmds.columnLayout()
    cmds.optionMenu('selected_encode_format',
                    label='Encoder',
                    cc=printEncodeMenuItem)
    cmds.menuItem('libx264', label="(mov/mp4) h.264")
    cmds.menuItem('libx265', label="(mov/mp4) h.265/HEVC")
    cmds.menuItem('libvpx-vp9', label="(Webm) AV9")
    '''
    Function to open a file dialog, and then edit the textbox for output location with the selected location
    '''

    def get_video_output_path(*args):
        file_path = cmds.fileDialog2()[0]
        cmds.textFieldButtonGrp('VideoOutputLoc', e=1, text=file_path)
        save_settings()

    # OUTPUT LOCATION
    '''
    Text box and button to set the output location for the playblast
    '''
    cmds.columnLayout()
    OutputLocation = cmds.optionVar(q='playblastFFmpeg_outputLoc')
    outputLocationText = cmds.textFieldButtonGrp(
        'VideoOutputLoc',
        label="Video Output Location",
        buttonLabel="Set Output Location",
        text=OutputLocation,
        cc=save_settings,
        bc=get_video_output_path)
    cmds.setParent('..')

    # EXPORT PLAYBLAST
    '''
    Button to run the ffmpeg_playblast function, and pass in the textbox & dropdown inputs
    '''
    cmds.columnLayout()
    cmds.button(
        label="Export Playblast",
        h=50,
        c="ffmpeg_playblast(cmds.optionVar(q='playblastFFmpeg_resolutionx'), cmds.optionVar(q='playblastFFmpeg_resolutiony'), cmds.optionVar(q='playblastFFmpeg_inframe'), cmds.optionVar(q='playblastFFmpeg_outframe'), cmds.optionVar(q='playblastFFmpeg_outputLoc'))"
    )
    cmds.showWindow(winID)

    selected_video_format = cmds.optionMenu('selected_video_format',
                                            q=True,
                                            value=True)
    #selected_encode_format = cmds.optionMenu('selected_encode_format', q=True, value=True)
    selected_output_location = cmds.textFieldButtonGrp('VideoOutputLoc',
                                                       q=True,
                                                       text=True)
    return ffmpegLocation, selected_video_format, selected_output_location
示例#48
0
        def execute_operation():
            # Define Current Version
            stored_gt_tools_version_exists = cmds.optionVar(exists=("gt_tools_version"))

            if stored_gt_tools_version_exists:
                gt_check_for_updates['current_version'] = "v" + str(cmds.optionVar(q=("gt_tools_version")))
            else:
                gt_check_for_updates['current_version'] = 'v0.0.0'
            
            # Retrive Latest Version
            response_list = get_github_release(gt_tools_latest_release_api)

            gt_check_for_updates['latest_version'] = response_list[0].get('tag_name') or "v0.0.0"
            
            success_codes = [200, 201, 202, 203, 204, 205, 206]
            web_response_color = (0, 1, 0)
            if response_list[1] not in success_codes:
                web_response_color = (1, .5, .5)
                
            cmds.text(web_response_text, e=True, l=response_list[2], bgc=web_response_color)
            cmds.text(installed_version_text, e=True, l=gt_check_for_updates.get('current_version'))
            cmds.text(latest_version_text, e=True, l=gt_check_for_updates.get('latest_version'))
            
            current_version_int = int(re.sub("[^0-9]", "", str(gt_check_for_updates.get('current_version'))))
            latest_version_int = int(re.sub("[^0-9]", "", str(gt_check_for_updates.get('latest_version'))))
            
            if current_version_int < latest_version_int:
                cmds.button(update_btn, e=True, en=True, bgc=(.6, .6, .6))
                cmds.text(update_status, e=True, l="New Update Available!", fn="tinyBoldLabelFont", bgc=(1, .5, .5))
            elif current_version_int > latest_version_int:
                cmds.text(update_status, e=True, l="Unreleased update!", fn="tinyBoldLabelFont", bgc=(.7, 0 , 1))
                cmds.button(update_btn, e=True, en=False)
            else:
                cmds.text(update_status, e=True, l="You're up to date!", fn="tinyBoldLabelFont", bgc=(0, 1, 0))
                cmds.button(update_btn, e=True, en=False)
            
            published_at = ''
            try:
                published_at = response_list[0].get('published_at').split('T')[0]
            except:
                pass
            
            cmds.scrollField(output_scroll_field, e=True, clear=True)
            cmds.scrollField(output_scroll_field, e=True, ip=0, it=(response_list[0].get('tag_name') + (' ' * 80) + '(' + published_at + ')\n'))
            cmds.scrollField(output_scroll_field, e=True, ip=0, it=response_list[0].get('body'))
            
            if latest_version_int != 0:
                try:
                    previous_version = str(latest_version_int - 1)
                    previous_version_tag = 'v'
                    for c in previous_version:
                        previous_version_tag += c + '.'
                    previous_version_tag = previous_version_tag[:-1]
                    
                    before_previous_version = str(latest_version_int - 2)
                    before_previous_version_tag = 'v'
                    for c in before_previous_version:
                        before_previous_version_tag += c + '.'
                    before_previous_version_tag = before_previous_version_tag[:-1]
                    

                    previous_version_response = get_github_release(gt_tools_tag_release_api + previous_version_tag)
                    before_previous_version_response = get_github_release(gt_tools_tag_release_api + before_previous_version_tag)
                    
                    if previous_version_response[1] in success_codes:
                        published_at = ''
                        try:
                            published_at = previous_version_response[0].get('published_at').split('T')[0]
                        except:
                            pass
                        cmds.scrollField(output_scroll_field, e=True, ip=0, it='\n\n' + (previous_version_response[0].get('tag_name') + (' ' * 80) + '(' + published_at + ')\n'))
                        cmds.scrollField(output_scroll_field, e=True, ip=0, it=previous_version_response[0].get('body'))
                    

                    
                    if before_previous_version_response[1] in success_codes:
                        published_at = ''
                        try:
                            published_at = before_previous_version_response[0].get('published_at').split('T')[0]
                        except:
                            pass
                        cmds.scrollField(output_scroll_field, e=True, ip=0, it='\n\n' + (before_previous_version_response[0].get('tag_name') + (' ' * 80) + '(' + published_at + ')\n'))
                        cmds.scrollField(output_scroll_field, e=True, ip=0, it=before_previous_version_response[0].get('body'))

                except:
                    pass
                
            if response_list[1] not in success_codes:
                cmds.text(update_status, e=True, l="Unknown", fn="tinyBoldLabelFont", bgc=(1, .5, .5))
                
            cmds.scrollField(output_scroll_field, e=True, ip=1, it='') # Bring Back to the Top
示例#49
0
 def sb_maxInfluenceEdited(self):
     val = self.sb_maxInfluence.value()
     cmds.optionVar(iv=("ariCleanSkin_MI", val))
示例#50
0
    def change_auto_update_interval(refresh_only=False):
        ''' 
        Toggle the auto check for updates button while updating an optionVar that controls this behaviour
        
                Parameters:
                    refresh_only (bool): Is it only refreshing or toggling?

        '''
        check_interval = gt_check_for_updates.get('def_auto_updater_interval')
        persistent_check_interval_exists = cmds.optionVar(exists=('gt_check_for_updates_interval_days'))
        if persistent_check_interval_exists:
            check_interval = int(cmds.optionVar(q=("gt_check_for_updates_interval_days")))
                  
        interval_list = {'five_days' : 5,
                         'half_month' : 15,
                         'one_month' : 30,
                         'three_months' : 91,
                         'six_months': 182,
                         'one_year': 365}
                
        if not refresh_only:
            if check_interval == interval_list.get('five_days'):
                check_interval = interval_list.get('half_month')
                cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval)))
            elif check_interval == interval_list.get('half_month'):
                check_interval = interval_list.get('one_month')
                cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval)))
            elif check_interval == interval_list.get('one_month'):
                check_interval = interval_list.get('three_months')
                cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval)))
            elif check_interval == interval_list.get('three_months'):
                check_interval = interval_list.get('six_months')
                cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval)))
            elif check_interval == interval_list.get('six_months'):
                check_interval = interval_list.get('one_year')
                cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval)))
            elif check_interval == interval_list.get('one_year'):
                check_interval = interval_list.get('five_days') # Restart
                cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval)))
                
        new_interval = ''
        if check_interval == interval_list.get('half_month') or check_interval == interval_list.get('one_month') or check_interval == interval_list.get('five_days'):
            new_interval = str(check_interval) + ' days'
        elif check_interval == interval_list.get('three_months'):
            new_interval = '3 months'
        elif check_interval == interval_list.get('six_months'):
            new_interval = '6 months'
        elif check_interval == interval_list.get('one_year'):
            new_interval = '1 year'

        cmds.button(auto_updater_interval_btn, e=True, label='Interval: ' + new_interval)
示例#51
0
    def __init__(self):
        self.toolName = 'cgm.puppetBox'
        self.description = 'This is a series of tools for working with cgm Sets'
        self.author = 'Josh Burton'
        self.owner = 'CG Monks'
        self.website = 'www.cgmonks.com'
        self.dockCnt = 'cgmPuppetBoxDoc'
        self.version = __version__
        self.optionVars = []
        self.scenePuppets = []
        self.Puppet = False
        self.PuppetBridge = {}
        self.puppetStateOptions = ['define']
        self.puppetStateOptions.extend(ModuleFactory.moduleStates)
        #self.addModules = ['Spine','Leg','Arm','Limb','Finger','Foot','Neck','Head','Spine']
        self.addModules = ['Segment']
        self.moduleFrames = {}
        self.moduleBaseNameFields = {}
        self.moduleHandleFields = {}
        self.moduleRollFields = {}
        self.moduleCurveFields = {}
        self.moduleStiffIndexFields = {}

        self.moduleDirectionMenus = {}
        self.modulePositionMenus = {}

        self.moduleDirections = ['none', 'left', 'right']
        self.modulePositions = [
            'none', 'front', 'rear', 'forward', 'back', 'top', 'bottom'
        ]

        self.setModes = ['<<< All Loaded Sets >>>', '<<< Active Sets >>>']
        self.scenePuppets = modules.returnPuppetObjects()
        self.UI_StateRows = {
            'define': [],
            'template': [],
            'skeleton': [],
            'rig': []
        }

        self.showHelp = False
        self.helpBlurbs = []
        self.oldGenBlurbs = []

        #Menu
        self.setupVariables()

        self.UI_PuppetMenu = MelMenu(l='Puppet', pmc=self.buildPuppetMenu)
        self.UI_AddModulesMenu = MelMenu(l='Add', pmc=self.buildAddModulesMenu)
        self.UI_OptionsMenu = MelMenu(l='Options', pmc=self.buildOptionsMenu)
        self.UI_HelpMenu = MelMenu(l='Help', pmc=self.buildHelpMenu)

        self.ShowHelpOption = mc.optionVar(q='cgmVar_AnimToolsShowHelp')

        #GUI

        self.Main_buildLayout(self)

        if self.Puppet:
            puppetBoxLib.updateUIPuppet(self)

        if self.scenePuppets:
            puppetBoxLib.activatePuppet(self, self.scenePuppets[0])

        #====================
        # Show and Dock
        #====================
        #Maya2011 QT docking - from Red9's examples
        try:
            #'Maya2011 dock delete'
            if mc.dockControl(self.dockCnt, exists=True):
                mc.deleteUI(self.dockCnt, control=True)
        except:
            pass

        if self.dockOptionVar.value:
            try:
                allowedAreas = ['right', 'left']
                mc.dockControl(self.dockCnt,
                               area='right',
                               label=self.WINDOW_TITLE,
                               content=self.WINDOW_NAME,
                               floating=False,
                               allowedArea=allowedAreas,
                               width=400)
            except:
                #Dock failed, opening standard Window
                self.show()
        else:
            self.show()
示例#52
0
 def dsb_maxWeightEdited(self):
     val = self.dsb_maxWeight.value()
     cmds.optionVar(fv=("ariCleanSkin_MW", val))
示例#53
0
	def do_showHelpToggle( self):
		guiFactory.toggleMenuShowState(self.ShowHelpOption,self.helpBlurbs)
		mc.optionVar( iv=('cgmVar_animToolsShowHelp', not self.ShowHelpOption))
		self.ShowHelpOption = mc.optionVar( q='cgmVar_animToolsShowHelp' )
示例#54
0
def get_persistent_settings_auto_fk():
    ''' 
    Checks if persistant settings for GT GT Auto FK exists and transfer them to the settings variables.
    It assumes that persistent settings were stored using the cmds.optionVar function.
    '''
    stored_using_custom_curve_exists = cmds.optionVar(
        exists=("gt_auto_fk_using_custom_curve"))
    stored_custom_curve_exists = cmds.optionVar(
        exists=("gt_auto_fk_custom_curve"))
    stored_failed_to_build_curve_exists = cmds.optionVar(
        exists=("gt_auto_fk_failed_to_build_curve"))

    stored_mimic_hierarchy_exists = cmds.optionVar(
        exists=("gt_auto_fk_mimic_hierarchy"))
    stored_constraint_joint_exists = cmds.optionVar(
        exists=("gt_auto_fk_constraint_joint"))
    stored_auto_color_ctrls_exists = cmds.optionVar(
        exists=("gt_auto_fk_auto_color_ctrls"))
    stored_select_hierarchy_exists = cmds.optionVar(
        exists=("gt_auto_fk_select_hierarchy"))
    stored_curve_radius_exists = cmds.optionVar(
        exists=("gt_auto_fk_curve_radius"))

    stored_string_ctrl_suffix_exists = cmds.optionVar(
        exists=("gt_auto_fk_string_ctrl_suffix"))
    stored_string_ctrl_grp_suffix_exists = cmds.optionVar(
        exists=("gt_auto_fk_string_ctrl_grp_suffix"))
    stored_string_joint_suffix_exists = cmds.optionVar(
        exists=("gt_auto_fk_string_joint_suffix"))
    stored_undesired_strings_exists = cmds.optionVar(
        exists=("gt_auto_fk_undesired_strings"))

    # Custom Curve
    if stored_using_custom_curve_exists:
        gt_auto_fk_settings['using_custom_curve'] = cmds.optionVar(
            q=("gt_auto_fk_using_custom_curve"))

    if stored_custom_curve_exists:
        gt_auto_fk_settings['custom_curve'] = str(
            cmds.optionVar(q=("gt_auto_fk_custom_curve")))

    if stored_failed_to_build_curve_exists:
        gt_auto_fk_settings['failed_to_build_curve'] = cmds.optionVar(
            q=("gt_auto_fk_failed_to_build_curve"))

    # General Settings
    if stored_mimic_hierarchy_exists:
        gt_auto_fk_settings['mimic_hierarchy'] = cmds.optionVar(
            q=("gt_auto_fk_mimic_hierarchy"))

    if stored_constraint_joint_exists:
        gt_auto_fk_settings['constraint_joint'] = cmds.optionVar(
            q=("gt_auto_fk_constraint_joint"))

    if stored_auto_color_ctrls_exists:
        gt_auto_fk_settings['auto_color_ctrls'] = cmds.optionVar(
            q=("gt_auto_fk_auto_color_ctrls"))

    if stored_select_hierarchy_exists:
        gt_auto_fk_settings['select_hierarchy'] = cmds.optionVar(
            q=("gt_auto_fk_select_hierarchy"))

    if stored_curve_radius_exists:
        gt_auto_fk_settings['curve_radius'] = str(
            cmds.optionVar(q=("gt_auto_fk_curve_radius")))

    # Strings
    if stored_string_joint_suffix_exists:
        gt_auto_fk_settings['string_joint_suffix'] = str(
            cmds.optionVar(q=("gt_auto_fk_string_joint_suffix")))

    if stored_string_ctrl_suffix_exists:
        gt_auto_fk_settings['string_ctrl_suffix'] = str(
            cmds.optionVar(q=("gt_auto_fk_string_ctrl_suffix")))

    if stored_string_ctrl_grp_suffix_exists:
        gt_auto_fk_settings['string_ctrl_grp_suffix'] = str(
            cmds.optionVar(q=("gt_auto_fk_string_ctrl_grp_suffix")))

    if stored_undesired_strings_exists:
        gt_auto_fk_settings['undesired_strings'] = str(
            cmds.optionVar(q=("gt_auto_fk_undesired_strings")))
示例#55
0
def silent_update_check():
    '''
    Checks if there is a new released version. In case there is one, the "Check for Updates" window will open.
    This function is threaded, so the user won't notice the check happening. 
    It also doesn't request a response unless it's time to check for new updates. (So it doesn't affect performance)
    '''
    # Check if auto updater is active
    is_active = False
    persistent_auto_updater_exists = cmds.optionVar(exists=('gt_check_for_updates_auto_active'))
    if persistent_auto_updater_exists:
        is_active = bool(cmds.optionVar(q=("gt_check_for_updates_auto_active")))
    
    if is_active:
        def compare_current_latest():
            # Get Interval
            check_interval = gt_check_for_updates.get('def_auto_updater_interval')
            persistent_check_interval_exists = cmds.optionVar(exists=('gt_check_for_updates_interval_days'))
            if persistent_check_interval_exists:
                check_interval = int(cmds.optionVar(q=("gt_check_for_updates_interval_days")))
                
            # Get Dates
            today_date = datetime(datetime.now().year, datetime.now().month, datetime.now().day) 
            persistent_last_date_exists = cmds.optionVar(exists=('gt_check_for_updates_last_date'))
            if persistent_last_date_exists:
                try:
                    date_time_str = str(cmds.optionVar(q=("gt_check_for_updates_last_date")))
                    last_check_date = datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S') 
                except:
                    last_check_date = today_date # Failed to extract date
            else: 
                last_check_date = today_date # Failed to extract date

            # Calculate Delta
            delta = today_date - last_check_date
            days_since_last_check = delta.days

            if days_since_last_check > check_interval:
                # Define Current Version
                stored_gt_tools_version_exists = cmds.optionVar(exists=("gt_tools_version"))

                if stored_gt_tools_version_exists:
                    gt_check_for_updates['current_version'] = "v" + str(cmds.optionVar(q=("gt_tools_version")))
                else:
                    gt_check_for_updates['current_version'] = 'v0.0.0'
                    
                # Retrive Latest Version
                response_list = get_github_release(gt_tools_latest_release_api)
                gt_check_for_updates['latest_version'] = response_list[0].get('tag_name') or "v0.0.0"
                
                current_version_int = int(re.sub("[^0-9]", "", str(gt_check_for_updates.get('current_version'))))
                latest_version_int = int(re.sub("[^0-9]", "", str(gt_check_for_updates.get('latest_version'))))
                
                if current_version_int == 0 or latest_version_int == 0:
                    pass
                else:
                    cmds.optionVar( sv=('gt_check_for_updates_last_date', str(today_date))) # Store check date
                    if current_version_int < latest_version_int:
                        #print("New Update Available!")
                        build_gui_gt_check_for_updates()
                
                # Print Output - Debugging
                # print('Check Interval: ' + str(check_interval))
                # print('Check Delta: ' + str(days_since_last_check))
                # print('Current Version: ' + str(current_version_int))
                # print('Latest Version: ' + str(latest_version_int))

        # Threaded Check
        def threaded_version_check():
            try:
                utils.executeDeferred(compare_current_latest)
            except Exception as e:
                print(e)
                
        thread = threading.Thread(None, target = threaded_version_check)
        thread.start()
示例#56
0
	def do_showTimeSubMenuToggleOff( self):
		guiFactory.toggleMenuShowState(0,self.timeSubMenu)
		mc.optionVar( iv=('cgmVar_CurrentFrameOnly', 0))
示例#57
0
	def do_everyFrameToggle( self):
		EveryFrameOption = mc.optionVar( q='cgmVar_ForceEveryFrame' )
		guiFactory.toggleMenuShowState(EveryFrameOption,self.timeSubMenu)
		mc.optionVar( iv=('cgmVar_ForceEveryFrame', not EveryFrameOption))
示例#58
0
	def buildTimeSubMenu(self,parent):
		self.containerName = MelColumnLayout(parent,ut='cgmUISubTemplate')
		# Time Submenu
		mc.setParent(self.containerName)
		self.helpBlurbs.extend(guiFactory.instructions(" Set your time range",vis = self.ShowHelpOption))

		timelineInfo = search.returnTimelineInfo()


		# TimeInput Row
		TimeInputRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate')
		self.timeSubMenu.append( TimeInputRow )
		MelSpacer(TimeInputRow)
		MelLabel(TimeInputRow,l='start')

		self.startFrameField = MelIntField(TimeInputRow,'cgmLocWinStartFrameField',
	                                       width = 40,
	                                       value= timelineInfo['rangeStart'])
		TimeInputRow.setStretchWidget( MelSpacer(TimeInputRow) )
		MelLabel(TimeInputRow,l='end')

		self.endFrameField = MelIntField(TimeInputRow,'cgmLocWinEndFrameField',
	                                     width = 40,
	                                     value= timelineInfo['rangeEnd'])

		MelSpacer(TimeInputRow)
		TimeInputRow.layout()

		MelSeparator(self.containerName,ut = 'cgmUISubTemplate',style='none',height = 5)
		

		# Button Row
		TimeButtonRow = MelHSingleStretchLayout(self.containerName,padding = 1, ut='cgmUISubTemplate')
		MelSpacer(TimeButtonRow,w=2)
		currentRangeButton = guiFactory.doButton2(TimeButtonRow,'Current Range',
	                                              lambda *a: locinatorLib.setGUITimeRangeToCurrent(self),
	                                              'Sets the time range to the current slider range')
		TimeButtonRow.setStretchWidget( MelSpacer(TimeButtonRow,w=2) )
		sceneRangeButton = guiFactory.doButton2(TimeButtonRow,'Scene Range',
	                                            lambda *a: locinatorLib.setGUITimeRangeToScene(self),
	                                            'Sets the time range to the current slider range')
		MelSpacer(TimeButtonRow,w=2)
		
		TimeButtonRow.layout()

		
		#>>> Base Settings Flags
		self.KeyingModeCollection = MelRadioCollection()
		self.KeyingModeCollectionChoices = []		
		if not mc.optionVar( ex='cgmVar_AnimToolsKeyingMode' ):
			mc.optionVar( iv=('cgmVar_AnimToolsKeyingMode', 0) )
		guiFactory.appendOptionVarList(self,'cgmVar_AnimToolsKeyingMode')
		
		KeysSettingsFlagsRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 2)
		MelSpacer(KeysSettingsFlagsRow,w=2)	
		KeysSettingsFlagsRow.setStretchWidget( MelLabel(KeysSettingsFlagsRow,l='Anim Option: ',align='right') )
		self.keyingOptions = ['Keys','All']
		for item in self.keyingOptions:
			cnt = self.keyingOptions.index(item)
			self.KeyingModeCollectionChoices.append(self.KeyingModeCollection.createButton(KeysSettingsFlagsRow,label=self.keyingOptions[cnt],
			                                                                               onCommand = Callback(guiFactory.toggleOptionVarState,self.keyingOptions[cnt],self.keyingOptions,'cgmVar_AnimToolsKeyingMode',True)))
			MelSpacer(KeysSettingsFlagsRow,w=5)
		mc.radioCollection(self.KeyingModeCollection ,edit=True,sl= (self.KeyingModeCollectionChoices[ (mc.optionVar(q='cgmVar_AnimToolsKeyingMode')) ]))
		
		KeysSettingsFlagsRow.layout()

		#>>> Base Settings Flags
		self.KeyingTargetCollection = MelRadioCollection()
		self.KeyingTargetCollectionChoices = []		
		if not mc.optionVar( ex='cgmVar_AnimToolsKeyingTarget' ):
			mc.optionVar( iv=('cgmVar_AnimToolsKeyingTarget', 0) )
		guiFactory.appendOptionVarList(self,'cgmVar_AnimToolsKeyingTarget')
		
		BakeSettingsFlagsRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 2)
		MelSpacer(BakeSettingsFlagsRow,w=2)	
		BakeSettingsFlagsRow.setStretchWidget( MelLabel(BakeSettingsFlagsRow,l='From: ',align='right') )
		MelSpacer(BakeSettingsFlagsRow)
		self.keyTargetOptions = ['source','self']
		for item in self.keyTargetOptions:
			cnt = self.keyTargetOptions.index(item)
			self.KeyingTargetCollectionChoices.append(self.KeyingTargetCollection.createButton(BakeSettingsFlagsRow,label=self.keyTargetOptions[cnt],
		                                                                                       onCommand = Callback(guiFactory.toggleOptionVarState,self.keyTargetOptions[cnt],self.keyTargetOptions,'cgmVar_AnimToolsKeyingTarget',True)))
			MelSpacer(BakeSettingsFlagsRow,w=5)
		mc.radioCollection(self.KeyingTargetCollection ,edit=True,sl= (self.KeyingTargetCollectionChoices[ (mc.optionVar(q='cgmVar_AnimToolsKeyingTarget')) ]))
		
		BakeSettingsFlagsRow.layout()
		
		return self.containerName
示例#59
0
 def _getOptionVars(self):
     """Get the preference values.
     """
     self._viewType = cmds.optionVar(query=MESSAGE_TYPE)
示例#60
0
 def updateGeometry(self):
     geo = self.geometry()
     cmds.optionVar(iv=("ariCleanSkin_Geo", geo.x()))
     cmds.optionVar(iva=("ariCleanSkin_Geo", geo.y()))
     cmds.optionVar(iva=("ariCleanSkin_Geo", geo.width()))
     cmds.optionVar(iva=("ariCleanSkin_Geo", geo.height()))