Esempio n. 1
0
    def actuSelection(self):
        self.initVisibility()
        # self.initDoubleSide()
        # self.initVisPivot()

        histNum = mc.optionMenu(self.om_history, query=True, numberOfItems=True) + 1
        print ">>>  : ", histNum
        mc.textField(self.tf_transformName, edit=True, text='')
        mc.textField(self.tf_shapeName, edit=True, text='')
        for n in range(1, histNum):
            itemName = "hist_" + str(n)
            mc.deleteUI(itemName, menuItem=True)
            print ">>> : ", itemName, " deleted !!"

        selectionList = mc.ls(selection=True, o=True)
        if selectionList:
            # print selectionList[-1]
            history = mc.listHistory(selectionList, interestLevel=2)
            histNum = len(history)
            mc.textField(self.tf_transformName, edit=True, text=selectionList[-1])
            mc.textField(self.tf_shapeName, edit=True, text=history[0])
            mc.optionMenu(self.om_history, edit=True, numberOfItems=histNum)
            for n in range(1, histNum):
                selec = history[n]
                itemName = "hist_" + str(n)
                mc.menuItem(itemName, parent=self.om_history, label=selec)
        else:
            mc.iconTextCheckBox(self.bt_visibility, edit=True, value=False)
            print "pas de selection"
def add_to_menu_snippet():
	model_panels = cmds.getPanel(type='modelPanel')
	TAG_NAME = '_viewport_button'
	for panel in model_panels:
		bar_layout = cmds.modelPanel(panel, query=True, barLayout=True)
		if not bar_layout:
			continue
		menu_layout = cmds.layout(bar_layout, query=True, childArray=True)[0]
		# example for icontextcheckbox
		tagged_items = [
			child for child in cmds.layout(layout, query=True, childArray=True)
			if cmds.objectTypeUI(child) == 'iconTextCheckBox'
			and cmds.iconTextCheckBox(child, query=True, label=True) == TAG_NAME
		]
		if not tagged_items:
			cmds.iconTextCheckBox(
				image=icon_path,
				style='iconOnly',
				annotation='Toggle ' + name.capitalize(),
				label=TAG_NAME
				width=18,
				height=18,
				onCommand=on_command, # some function
				offCommand=off_command, # some function
				parent=menu_layout,
			)
		OpenMayaUI.M3dView.getM3dViewFromModelPanel(menu_layout).refresh(force=True)
Esempio n. 3
0
def doRefreshSwatchDisplay(arg=None):
    '''Display swatches for selected category.
    '''
    # Get selected category folder.
    directory = getCategoryFolder()
    
    # Get the list of files on disk.
    swatchFiles = [x for x in os.listdir(directory) if x.endswith(".png")]
    
    clearShadersDispay()
    for swatch in swatchFiles:
        # Build the buttons. 
        swatchLabel = swatch.rpartition(os.sep)[2].replace(".png", "")
        imageFilePath = os.path.join(directory, swatch)
        button = cmds.iconTextCheckBox(
                "%sBTN" % swatchLabel, parent="displaySwatchesGL", style="iconAndTextVertical", 
                width=144, height=144, image=imageFilePath, label=swatchLabel, 
                onCommand=partial(addSwatchToSelection, swatchLabel), 
                offCommand=partial(removeSwatchFromSelection, swatchLabel)
                )
        # If shader exists in file, set display font to oblique.
        if cmds.objExists("%s_SG" % swatchLabel):
            cmds.iconTextCheckBox("%sBTN" % swatchLabel, edit=True, font="obliqueLabelFont")
    
    # Build the move to list for this category.
    doBuildMoveToList()
    # Clear hidden textField.
    cmds.textField("currentlySelectedTFD", edit=True, text="")
Esempio n. 4
0
def UI():
    mc.frameLayout('Furioso',w=ui.rowWidth,cll=1,bgc=[.2,.2,.2],fn='smallBoldLabelFont',bs='in',l='Furioso')
    
    mc.columnLayout('furiosoObjectConform',cal='center',w=ui.rowWidth-10)
    mc.rowColumnLayout(numberOfColumns=8)
    mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,ann="Create 10x10 Tile",l= "Tile" ,i= "polyPlane.png",c=partial(delay,'mel.eval','("polyPlane -w 10 -h 10 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1")'))	
    mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,ann="Create 1x1 Tile",l= "Tile" ,i= "plane.png",c=partial(delay,'mel.eval','("polyPlane -w 10 -h 10 -sx 1 -sy 1 -ax 0 1 0 -cuv 2 -ch 1;")'))
    mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "cube.png",c=partial(delay,'mel.eval','("polyCube -w 10 -h 10 -d 10 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;")'))
    mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "historyPulldownIcon.png",bgc=[.5,0,0],c=partial(delay,'mel.eval','("DeleteHistory")'))
    mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "",en=0,c=partial(delay,'mel.eval','("polyPlane -w 10 -h 10 -sx 1 -sy 1 -ax 0 1 0 -cuv 2 -ch 1;")'))  
    mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,ann="Set Camera to Meters",en=1,l= "Set Camera" ,i= "CameraAE.png",c=partial(delay,'mel.eval','("rcSetCameraClip .5 100000")'))
    mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "polyQuad",c=partial(delay,'mel.eval','("TogglePolyCount")'))
    mc.iconTextCheckBox(w=ui.iconSize,h=ui.iconSize,ann="Snap",l= "Tile" ,i= "snapGrid.png",onc=partial(delay,'rc.stepSnap','(5,1)'),ofc=partial(delay,'rc.stepSnap','(5,0)'),v=mc.manipMoveContext('Move',q=1,s=1))    
    mc.setParent('..')

    mc.rowLayout(w=ui.rowWidth,numberOfColumns=3)
    mc.button(w=ui.rowWidth/3,h=ui.btn_large,al='left',l=' + ',c=partial(delay,'btnPlus','(mc.ls(sl=1))'))  #
    mc.button(h=ui.btn_large,w=ui.rowWidth/3,al='center',l=' - ',c=partial(delay,'btnDel','("sel")')) 
    mc.button(h=ui.btn_large,w=ui.rowWidth/3,al='right',l='NUKE',c=partial(delay,'btnDel','("all")'))
    mc.setParent('..')
    
    mc.checkBox('Object',vis=0,l='Object',v=int(furiosoPrefs.get('Object')),cc=partial(delay,'furiosoPrefs.checkBox',"('Object')"))
    mc.checkBox('Material',l='Material',vis=1,v=int(furiosoPrefs.get('Material')),cc=partial(delay,'furiosoPrefs.checkBox',"('Material')"))
    mc.checkBox('Flag',l='Flag',vis=0,v=int(furiosoPrefs.get('Flag')),cc=partial(delay,'furiosoPrefs.checkBox',"('Flag')"))
    mc.iconTextScrollList('FuriosoObjScroll',w=ui.rowWidth,h=500)
    mc.setParent('furiosoObjectConform')
    mc.setParent('..')
    
    buildUILists()
Esempio n. 5
0
def deselectAll(arg=None):
    '''Deselect the shaders.
    '''
    allItems = cmds.gridLayout("displaySwatchesGL", query=True, childArray=True)
    for item in allItems:
        cmds.iconTextCheckBox(item, edit=True, value=False)
    text = cmds.textField("currentlySelectedTFD", edit=True, text="")
Esempio n. 6
0
def deselectAllAssets(arg=None):
    '''Deselect the assets.
    '''
    allItems = cmds.gridLayout("displayAssetsGL", query=True, childArray=True) or []
    for item in allItems:
        cmds.iconTextCheckBox(item, edit=True, value=False)
    text = cmds.textField("currentAssetTFD", edit=True, text="")
Esempio n. 7
0
 def updateReminder(self):
     value = self.prefs.load("daily_reminder")
     value = value if value else False
     imgOn = os.path.join(os.path.dirname(os.path.realpath(__file__)), "images", "icons", "calendar-clock-on-small.png")
     imgOff = os.path.join(os.path.dirname(os.path.realpath(__file__)), "images", "icons", "calendar-clock-off-small.png")
     text = "Reminders are on." if value else "Click to trigger a Pose reminder each day."
     img = imgOn if value else imgOff
     cmds.text(self.GUI["text4"], e=True, label=text)
     cmds.iconTextCheckBox(self.GUI["check1"], e=True, v=value, i=img)
Esempio n. 8
0
 def initVisibility(self):
     selectionList = mc.ls(selection=True, type='transform')
     if selectionList:
         #selectionList = mc.ls(selection=True, type='transform')
         stateVIS = mc.getAttr(selectionList[-1] + ".visibility")
         if stateVIS:
             mc.iconTextCheckBox(self.bt_visibility, edit=True, value=True)
         else:
             mc.iconTextCheckBox(self.bt_visibility, edit=True, value=False)
Esempio n. 9
0
def addAssetToSelection(assetName, arg=None):
    '''Stores name of selected asset into hidden textField to prevent multi-selection.
    '''
    # Get name of currently stored selectedAsset.
    selectedAsset = cmds.textField("currentAssetTFD", query=True, text=True)
    if selectedAsset:
        cmds.iconTextCheckBox("%sBTN" % selectedAsset, edit=True, value=False)
    
    # Update hidden textField with currently selected selectedAsset.
    cmds.textField("currentAssetTFD", edit=True, text=assetName)
    sys.stdout.write("--> %s\n" % assetName)
Esempio n. 10
0
 def refreshBoxChange(self, force):
     if force == 9 or cmds.menuItem('OFFmeunItem_JellyBean', q=1, cb=1):
         if cmds.text('spJobVtxParent_JellyBean', q=1, ex=1):
             cmds.deleteUI('spJobVtxParent_JellyBean', ctl=1)
         mel.eval('source "dagMenuProc.mel"')
         if cmds.window('WeightTool_JellyBean', q=1, ex=1):
             cmds.iconTextCheckBox('refresh_JellyBean', e=1, v=0)
     else:
         self.spJobStart()
         cmds.iconTextCheckBox('refresh_JellyBean', e=1, v=1)
         self.refreshJointList(0)
Esempio n. 11
0
def addSwatchToSelection(swatchName, arg=None):
    '''Stores name of selected swatch into hidden textField to prevent multi-selection.
    '''
    # Get name of last selected swatch.
    swatch = cmds.textField("currentlySelectedTFD", query=True, text=True)
    if swatch:
        # Deselect checkbox.
        cmds.iconTextCheckBox("%sBTN" % swatch, edit=True, value=False)
    
    # Update hidden textField with currently selected swatch.
    cmds.textField("currentlySelectedTFD", edit=True, text=swatchName)
Esempio n. 12
0
 def _loadObj():
     lslist = cmds.ls(sl=1, o=1, typ='transform')
     if lslist:
         if cmds.listRelatives(lslist[0], s=1, typ='mesh'):
             cmds.menu('loadobj_KitKat', e=1, l=lslist[0])
     else:
         cmds.menu('loadobj_KitKat', e=1, l='| Load Object |')
         if cmds.iconTextCheckBox('editPoseButton_KitKat', q=1, v=1):
             cmds.iconTextButton('addPoseButton_KitKat', e=1, en=1)
             cmds.iconTextButton('subPoseButton_KitKat', e=1, en=1)
             cmds.iconTextCheckBox('editPoseButton_KitKat', e=1, v=0)
Esempio n. 13
0
def override_component_mask_commands():
    """Override component mask ctrl+click behavior.

    This implements special behavior for Maya's component
    mask menu items where a ctrl+click will instantly make
    it an isolated behavior disabling all others.
    
    Tested in Maya 2016 and 2018

    """
    log.info("Installing override_component_mask_commands..")

    # Get all object mask buttons
    buttons = mc.formLayout("objectMaskIcons", query=True, childArray=True)
    # Skip the triangle list item
    buttons = [btn for btn in buttons if btn != "objPickMenuLayout"]

    def on_changed_callback(raw_command, state):
        """New callback"""

        # If "control" is held force the toggled one to on and
        # toggle the others based on whether any of the buttons
        # was remaining active after the toggle, if not then
        # enable all
        if mc.getModifiers() == 4:  # = CTRL
            state = True
            active = [
                mc.iconTextCheckBox(btn, query=True, value=True)
                for btn in buttons
            ]
            if any(active):
                mc.selectType(allObjects=False)
            else:
                mc.selectType(allObjects=True)

        # Replace #1 with the current button state
        cmd = raw_command.replace(" #1", " {}".format(int(state)))
        mel.eval(cmd)

    for btn in buttons:

        # Store a reference to the original command so that if
        # we rerun this override command it doesn't recursively
        # try to implement the fix. (This also allows us to
        # "uninstall" the behavior later)
        if btn not in COMPONENT_MASK_ORIGINAL:
            original = mc.iconTextCheckBox(btn, query=True, cc=True)
            COMPONENT_MASK_ORIGINAL[btn] = original

        # Assign the special callback
        original = COMPONENT_MASK_ORIGINAL[btn]
        new_fn = partial(on_changed_callback, original)
        mc.iconTextCheckBox(btn, edit=True, cc=new_fn)
Esempio n. 14
0
    def addAssetInfo(self, name, status, pointedver, latest):
        """
        Add checkbox/list item for asset
        """

        padlen = 30 - len(name)
        pad = " " * padlen

        if self.atype == "rig":
            icon = RIG_ICON
        elif self.atype == "prop":
            icon = PROP_ICON
        elif self.atype == "env":
            icon = ENV_ICON
        else:
            icon = SHOT_ICON

        if status == 2:
            color = LATEST_BGC
            assetstatus = pad + "@MASTER -> " + pointedver
        elif status == 1:
            color = OLD_BGC
            assetstatus = pad + "@MASTER -> " + pointedver + " (" + latest + ")"
        elif status == 0:
            color = INVALID_BGC
            assetstatus = pad + "(" + latest + ")"
        else:
            cmds.error("Invalid status")

        #color = su.multvec(color, (1.0,1.0,1.0))
        """
        if self.lastwasdark:
            color = su.multvec(color, (0.8,0.8,0.0))

        self.lastwasdark = not self.lastwasdark
        """

        # FooBar    @MASTER -> 003 (007)

        cmds.iconTextCheckBox(
            name,
            width=490,
            height=30,
            style='iconAndTextHorizontal',
            image1=icon,
            label=name + assetstatus,
            parent=self.ui["assetList"],
            bgc=color,
            font="fixedWidthFont",
            onCommand=lambda _, x=name: self.C_switchToAssetNamed(x),
            offCommand=lambda _, x=name: self.selectAssetListItem(x))
Esempio n. 15
0
    def addShotInfoFor(self, shot):
        padlen = 16 - len(shot.name)
        pad = " " * padlen

        sep = " | "
        blank = "   "

        image = SHOT_ICON
        color = NEUTRAL_BGC
        name = shot.name

        if shot.shotstages["Layout"].masterstatus == 2:
            layoutver = "MASTER"
        else:
            layoutver = shot.shotstages["Layout"].latest
            layoutver = blank if not layoutver else layoutver

        if shot.shotstages["Animation"].masterstatus == 2:
            animationver = "MASTER"
        else:
            animationver = shot.shotstages["Animation"].latest
            animationver = blank if not animationver else animationver

        if shot.shotstages["Lighting"].masterstatus == 2:
            lightingver = "MASTER"
        else:
            lightingver = shot.shotstages["Lighting"].latest
            lightingver = blank if not lightingver else lightingver

        if self.lastwasdark:
            color = su.multvec(color, (1.3, 1.3, 1.3))

        self.lastwasdark = not self.lastwasdark

        # C20    LO: MASTER | Anim: 004 | Light: 007

        assetstatus = pad + "LO: " + layoutver + sep + "Anim: " + animationver + sep + "Light: " + lightingver

        cmds.iconTextCheckBox(
            name,
            width=490,
            height=30,
            style='iconAndTextHorizontal',
            image1=image,
            label=name + assetstatus,
            parent=self.ui["assetList"],
            bgc=color,
            font="fixedWidthFont",
            onCommand=lambda _, x=name: self.C_switchToAssetNamed(x),
            offCommand=lambda _, x=name: self.selectAssetListItem(x))
Esempio n. 16
0
 def selectionStyleSwitch(self, *args):
     if mc.selectPref(query=True, paintSelect=True):
         mc.selectPref(paintSelect=False)
         mc.iconTextRadioButton(self.bt_marqueeSelStyle, edit=True, select=True)
         #self.bt_selectionStyle.setText("Marquee")
         print ">> Selection mode is MARQUEE."
         if mc.selectPref(query=True, useDepth=True):
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True)
             #self.bt_camSwitch.setChecked(True)
             #self.buttonOn(self.bt_camSwitch)
         else:
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
             #self.bt_camSwitch.setChecked(False)
             #self.buttonOff(self.bt_camSwitch)
     else:
         mc.selectPref(paintSelect=True)
         mc.iconTextRadioButton(self.bt_dragSelStyle, edit=True, select=True)
         #self.bt_selectionStyle.setText("Drag")
         print ">> Selection mode is DRAG."
         if mc.selectPref(query=True, paintSelectWithDepth=True):
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True)
             #self.bt_camSwitch.setChecked(True)
             #self.buttonOn(self.bt_camSwitch)
         else:
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
Esempio n. 17
0
 def installCreateButton(self):
     """"""
     layout = cmds.frameLayout("createLayout", lv=False, bv=False)
     form = cmds.formLayout()
     self.createBtn = cmds.iconTextButton(st='iconOnly',
                                          l='Create',
                                          ann="Create cluster by default, turn on \"J\" to create joint.",
                                          c=lambda *args: self.createSoftDeformerCmd() )
     
     self.jointCheck = cmds.iconTextCheckBox(st='textOnly',
                                             l='   J   ',
                                             ann="Create joint",
                                             cc=lambda *args: self.setCreateBtnIcon())
     cmds.formLayout(form,
                     e=1,
                     af=[(self.createBtn, 'left', 0),
                         (self.createBtn, 'right', 0),
                         (self.createBtn, 'top', 0),
                         (self.createBtn, 'bottom', 0),
                         (self.jointCheck, 'right', 0),
                         (self.jointCheck, 'top', 0)]
                     )
     cmds.setParent( '..' )
     cmds.setParent( '..' )
     
     self.setCreateBtnIcon()
     return layout
Esempio n. 18
0
def doRefreshAssetDisplay(arg=None):
    '''Display assets for selected category.
    '''
    currentImageLibrary = getImageLibrary()

    # Get selected category folder.
    directory = getCategoryFolder()
    if not directory:
        return
    
    # Get the list of files on disk.
    assetFiles = [x for x in os.listdir(directory) if x.endswith(".jpg")]
    clearAssetsDisplay()
    for assetFile in assetFiles:
        # Build the buttons. 
        assetLabel = assetFile.rpartition(os.sep)[2].replace(".jpg", "")
        imageFilePath = os.path.join(directory, assetFile)
        button = cmds.iconTextCheckBox(
                "%sBTN" % assetLabel, parent="displayAssetsGL", style="iconAndTextVertical", 
                width=144, height=144, image=imageFilePath, label=assetLabel, annotation=assetLabel,
                onCommand=partial(addAssetToSelection, assetLabel), 
                offCommand=partial(removeAssetFromSelection, assetLabel)
                )
    
    # Clear hidden textField.
    cmds.textField("currentAssetTFD", edit=True, text="")
Esempio n. 19
0
def __execute(*arg):

    if not os.path.isfile(CACHE["file"]):
        mc.confirmDialog(t=" ", m="File not found: " + CACHE["file"], b="ok")
        return

    cmd = CACHE["name"] + '=imp.load_source("' + CACHE[
        "name"] + '", "' + CACHE["file"] + '")'
    print("import imp\n" + cmd)
    exec(cmd)

    for idx in sorted(CACHE["index"].viewkeys()):
        fn = CACHE["index"][idx][0]
        mc.image(CACHE["function"][fn]["error"], e=True, vis=False)
        if type(arg[0]) != int:
            if not mc.iconTextCheckBox(
                    CACHE["function"][fn]["checkbox"], q=True, v=True):
                continue
        elif idx != arg[0]:
            continue
        cmd = CACHE["name"] + "." + fn + "(" + __arguments(idx) + ")"
        print(cmd)
        try:
            exec(cmd)
        except Exception as e:
            mc.image(CACHE["function"][fn]["error"], e=True, vis=True)
            raise Exception(e)

    if type(arg[0]) == bool: __icon()
Esempio n. 20
0
def __saveStatePreset(*arg):

    if not os.path.isfile(CACHE["file"]):
        mc.confirmDialog(t=" ", m="File not found: " + CACHE["file"], b="ok")
        return

    cb = CACHE["function"][CACHE["index"][arg[0]][0]]["checkbox"]
    val = str(mc.iconTextCheckBox(cb, q=True, v=True))
    fn = CACHE["index"][arg[0]][0]
    filepath = CACHE["file"][:-3] + ".pre"
    if os.path.isfile(filepath):
        add = False
        f = open(filepath)
        l = f.readlines()
        f.close()
        for i in range(len(l)):
            s = l[i].strip()
            if "=" not in s: continue
            l2 = s.split("=")
            if "." in l2[0]: continue
            if fn != l2[0].strip(): continue
            add = True
            l[i] = fn + " = " + val + "\n"
            break
        if not add: l.append(fn + " = " + val + "\n")
        f = open(filepath, "w")
        f.writelines(l)
        f.close()
    else:
        s = fn + " = " + val + "\n"
        f = open(filepath, "w")
        f.write(s)
        f.close()
Esempio n. 21
0
    def installCreateButton(self):
        """"""
        layout = cmds.frameLayout("createLayout", lv=False, bv=False)
        form = cmds.formLayout()
        self.createBtn = cmds.iconTextButton(
            st='iconOnly',
            l='Create',
            ann="Create cluster by default, turn on \"J\" to create joint.",
            c=lambda *args: self.createSoftDeformerCmd())

        self.jointCheck = cmds.iconTextCheckBox(
            st='textOnly',
            l='   J   ',
            ann="Create joint",
            cc=lambda *args: self.setCreateBtnIcon())
        cmds.formLayout(form,
                        e=1,
                        af=[(self.createBtn, 'left', 0),
                            (self.createBtn, 'right', 0),
                            (self.createBtn, 'top', 0),
                            (self.createBtn, 'bottom', 0),
                            (self.jointCheck, 'right', 0),
                            (self.jointCheck, 'top', 0)])
        cmds.setParent('..')
        cmds.setParent('..')

        self.setCreateBtnIcon()
        return layout
Esempio n. 22
0
 def installConvertOption(self):
     """"""
     cmds.rowLayout(nc=2, adj=2)
     cmds.text(l=' Convert:', fn='boldLabelFont')
     self.keepCheck = cmds.iconTextCheckBox( st='textOnly', l='Keep original', v=True )
     cmds.setParent( '..' )
     cmds.separator( style='none' )
Esempio n. 23
0
    def getCheckedShots(self):
        shots = []
        for checkbox, shot in self.scenes.iteritems():
            if cmds.iconTextCheckBox(checkbox, q=True, value=True):
                shots.append(shot)

        return shots
Esempio n. 24
0
 def installConvertOption(self):
     """"""
     cmds.rowLayout(nc=2, adj=2)
     cmds.text(l=' Convert:', fn='boldLabelFont')
     self.keepCheck = cmds.iconTextCheckBox( st='textOnly', l='Keep original', v=True )
     cmds.setParent( '..' )
     cmds.separator( style='none' )
Esempio n. 25
0
def SundayWarehouseBrowserUI():
    global warehouseBrowserUI
    if cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet':
        SundayDialogPy.SundayDialogConfirm('Error                                        ', 'Warehouse path not set.\nOpen settings and set the path.', 'OK')
        return None
    SundayMayaGuiPath = mel.eval('getenv SundayGui;')
    
    try:
        if cmds.window(warehouseBrowserUI, query = True, exists = True):
            cmds.deleteUI(warehouseBrowserUI)
        
        warehouseBrowserUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayWarehouseBrowser.ui')
    except:
        cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet'
        warehouseBrowserUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayWarehouseBrowser.ui')

    if cmds.dockControl('sundayWarehouseBrowserDock', query = True, exists = True):
        cmds.deleteUI('sundayWarehouseBrowserDock')
    
    
    try:
        cmds.optionMenu('whIconViewComboBox', edit = True, value = cmds.optionVar(query = 'whIconViewComboBox'))
    except:
        cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet'

    cmds.setParent(cmds.button('whIconCaptionDummy', query = True, fullPathName = True, parent = True))
    cmds.deleteUI('whIconCaptionDummy')
    cmds.iconTextCheckBox('whIconCaption', image1 = SundayImage + 'SundayImageCaption.png', changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateAssets()')
    cmds.setParent(warehouseBrowserUI)
    if cmds.optionVar(query = 'whIconCaption') == 'True':
        cmds.iconTextCheckBox('whIconCaption', edit = True, value = True)
    
    cmds.showWindow(warehouseBrowserUI)
    if platform.system() == 'Windows':
        cmds.window(warehouseBrowserUI, edit = True, topLeftCorner = [
            100,
            100])
    
    cmds.optionMenu('whIconViewComboBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateAssets()')
    cmds.optionMenu('whCategoryComboBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateType()')
    cmds.optionMenu('whTypeComboBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateAssets()')
    SundayWarehouseBrowserUpdate()
    
    try:
        cmds.deleteUI('sundayWarehouseBrowserDock')
    except:
        cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet'
Esempio n. 26
0
def SLiBBrowserUI():
    global slBrowserUI
    if cmds.optionVar(query = 'SLiBLib') == 'NoPath':
        SLiBDialogConfirm('Error', 'SLiB Library path not set.\nCheck Settings...', 'OK')
        return None
    SLiBGuiPath = mel.eval('getenv SLiBGui;')
    SLiBImage = mel.eval('getenv SLiBImage;')
    
    try:
        if cmds.window(slBrowserUI, query = True, exists = True):
            cmds.deleteUI(slBrowserUI)
        
        slBrowserUI = cmds.loadUI(uiFile = SLiBGuiPath + 'SLiBBrowser.ui')
    except:
        cmds.optionVar(query = 'SLiBLib') == 'NoPath'
        slBrowserUI = cmds.loadUI(uiFile = SLiBGuiPath + 'SLiBBrowser.ui')

    if cmds.dockControl('slBrowserDock', query = True, exists = True):
        cmds.deleteUI('slBrowserDock')
    
    
    try:
        cmds.optionMenu('SLiBThumbSizeComboBox', edit = True, value = cmds.optionVar(query = 'SLiBThumbSizeComboBox'))
    except:
        cmds.optionVar(query = 'SLiBLib') == 'NoPath'

    cmds.setParent(cmds.button('SLiB_BUTTON_Caption', query = True, fullPathName = True, parent = True))
    cmds.deleteUI('SLiB_BUTTON_Caption')
    cmds.iconTextCheckBox('SLiBIconCaption', image = SLiBImage + 'SLiB_ic_off.png', selectionImage = SLiBImage + 'SLiB_ic_on.png', changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateShader()')
    cmds.setParent(slBrowserUI)
    if cmds.optionVar(query = 'SLiBIconCaption') == 'True':
        cmds.iconTextCheckBox('SLiBIconCaption', edit = True, value = True)
    
    cmds.showWindow(slBrowserUI)
    if platform.system() == 'Windows':
        cmds.window(slBrowserUI, edit = True, topEdge = True, maximizeButton = False)
    
    cmds.optionMenu('SLiBThumbSizeComboBox', edit = True, changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateShader()')
    cmds.optionMenu('SLiBCategoryComboBox', edit = True, changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateType()')
    cmds.optionMenu('SLiBTypeComboBox', edit = True, changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateShader()')
    SLiBBrowserUpdate()
    
    try:
        cmds.deleteUI('slBrowserDock')
    except:
        cmds.optionVar(query = 'SLiBLib') == 'NoPath'
Esempio n. 27
0
 def helpDoc(self):
     if cmds.window('HelpDoc_KitKat', q=1, ex=1):
         cmds.deleteUI('HelpDoc_KitKat')
     cmds.window('HelpDoc_KitKat', t='Help Doc', rtf=1, s=1, tlb=1, wh=(480, 500))
     _iconwh = 60
     cmds.columnLayout(cat=('both', 2), rs=2, cw=480)
     fn = 'fixedWidthFont'
     cmds.rowLayout(nc=2)
     cmds.iconTextButton(st='iconAndTextVertical', i='pi-add.png', w=_iconwh, h=_iconwh, l='Add')
     cmds.popupMenu()
     cmds.menuItem(l='Mirror', c=lambda *args: self.mirrorPose())
     cmds.text(l=u'*初始化PSD(首次添加): 选择骨骼 + 控制器 \n*添加Pose: 选择骨骼/控制器 \n*右键菜单: Mirror功能, 可以镜像单个Pose或整个PSD节点', al='left', fn=fn)
     cmds.setParent('..')
     cmds.rowLayout(nc=2)
     cmds.iconTextButton(st='iconAndTextVertical', i=self.tempIco, w=_iconwh, h=_iconwh, l='Delete')
     cmds.text(l=u'选择一个PSD节点或多个Pose, 进行删除操作', al='left', fn=fn)
     cmds.setParent('..')
     cmds.rowLayout(nc=2)
     cmds.iconTextCheckBox(st='iconAndTextVertical', i='animPrefsWndIcon.png', w=_iconwh, h=_iconwh, l='Edit')
     cmds.text(l=u'选择单个Pose, 将跳转到选择的Pose \n*选择单个Pose, 调出当前修型开始编辑 \n按钮点亮时: 将当前的修型模型,塞回指定的BS', al='left', fn=fn)
     cmds.setParent('..')
     cmds.rowLayout(nc=2)
     cmds.iconTextButton(st="textOnly", l='Bake', h=50, w=_iconwh)
     cmds.text(l=u'*选择一个PSD节点或多个Pose, 提取出修型目标体', al='left', fn=fn)
     cmds.setParent('..')
     cmds.rowLayout(nc=2)
     cmds.iconTextButton(st="textOnly", l='Remake', h=50, w=_iconwh)
     cmds.text(l=u'*选择一个或多个修型目标体, 根据模型信息新增或修改指定Pose', al='left', fn=fn)
     cmds.setParent('..')
     cmds.rowLayout(nc=2)
     cmds.iconTextButton(st='iconAndTextVertical', i='kinMirrorJoint_S.png', l='Filp Target', w=_iconwh, h=52)
     cmds.popupMenu()
     cmds.radioMenuItemCollection()
     cmds.menuItem(l='X', rb=1)
     cmds.menuItem(l='Y', rb=0)
     cmds.menuItem(l='Z', rb=0)
     cmds.text(l=u'*一般模型: 将选择的模型翻转, 得到一个对称的模型 \n*PSD模型: 将选择的修型目标体翻转, 得到一个对称的可通过Remake按钮\n \
                 添加Pose的修型目标体 \n右键菜单: 修改翻转对称轴', al='left', fn=fn)
     cmds.setParent('..')
     cmds.rowLayout(nc=2)
     cmds.iconTextButton(st='iconAndTextVertical', i='substGeometry.png', l='Bake Cloth', w=_iconwh, h=52)
     cmds.text(l=u'*选择一个PSD节点或多个Pose, 将提取出指定Pose时的模型形状?', al='left', fn=fn)
     cmds.setParent('..')
     cmds.text(l=u'带 * 表示需要在 | Load Object | (加载模型)的前提下操作', h=50, fn='obliqueLabelFont')
     cmds.showWindow('HelpDoc_KitKat')
Esempio n. 28
0
 def blastCallback(*args):
     for checkbox, shot in self.scenes.iteritems():
         if cmds.iconTextCheckBox(checkbox, q=True, value=True):
             ss = shot.getLatestShotstage()
             shot.playblastVersion(shot.shotstages[ss].latest, 
                                   ss, 
                                   toPath=getBlastDir(shot),
                                   resolutionMult=1.0,
                                   terseName=True)
Esempio n. 29
0
    def createAssetBtn(self, shot, has_blender, update_blender, has_render, update_render):
        # checkbox
        name = shot.name
        assetstatus = self.getShotStatus(shot)
        color = (0.23, 0.23, 0.23) if self.lastWasDark else (0.3, 0.3, 0.3)
        self.lastWasDark = not self.lastWasDark
        cb = cmds.iconTextCheckBox(
                name,
                width=3 * (WIDTH / 4),
                height=30,
                style='iconAndTextHorizontal',
                image1="render.png",
                label=name + assetstatus,
                bgc=color,
                font="fixedWidthFont",
                parent=self.ui["scrollViewLeft"])

        # status icon
        if has_render:
            if update_render:
                status_col = OLD_BGC
            else:
                status_col = LATEST_BGC
        else:
            status_col = BG_COL

        icn = cmds.button(l=" ",
                          w=(WIDTH / 4 / 4),
                          h=30,
                          bgc=status_col,
                          p=self.ui["scrollViewMid"])

        # blender button
        if has_blender:
            label = "Update"
            callback = lambda _, x=shot: sendToBlender(shot, update=True)
            if update_blender:
                b_col = OLD_BGC
            else:
                b_col = LATEST_BGC
        else:
            label = "Create"
            callback = lambda _, x=shot: sendToBlender(shot, update=False)
            b_col = color
        if not shot.shotstages["Lighting"].latest:
            b_col = BG_COL

        btn = cmds.button(l=label,
                          w=(WIDTH / 4 / 2),
                          h=30,
                          bgc=b_col,
                          p=self.ui["scrollViewRight"],
                          c=callback)

        self.scenes[cb] = shot
        self.b_scenes[btn] = shot
Esempio n. 30
0
 def initSelectStyle(self):
     if mc.selectPref(q=True, paintSelect=True):
         mc.iconTextRadioButton(self.bt_dragSelStyle, edit=True, select=True)
         if mc.selectPref(q=True, paintSelectWithDepth=True):
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True)
         else:
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
     else:
         mc.iconTextRadioButton(self.bt_marqueeSelStyle, edit=True, select=True)
         if mc.selectPref(q=True, useDepth=True):
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True)
         else:
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
Esempio n. 31
0
def side_icon_TOOL():
    par_form = cmds.iconTextButton('statusFieldButton', q=1, p=1)
    if cmds.iconTextCheckBox("toolManager", q=1, ex=1):
        cmds.deleteUI("toolManager")

    cmds.iconTextButton(
        "toolManager",
        image1="mayaTool.png",
        p=par_form,
        c='import toolmanageui ;reload(toolmanageui);tool_win = toolmanageui.ToolManageUI() ;tool_win.show()'
    )
Esempio n. 32
0
    def bakeAll(self, *args):
	
	cmds.select(self.character + ":*_space_switcher_follow")
	nodes = cmds.ls(sl = True)
	spaceSwitchers = []
	bakeNodes = []
	
	for node in nodes:
	    if node.find("invis") == -1:
		if node.find(self.character + ":spine_01_space_switcher") == -1:
		    spaceSwitchers.append(node)
		    
	cmds.select(clear = True)
	
	
	#get the value of the bake toggle
	for control in spaceSwitchers:
	    cmds.iconTextCheckBox(self.widgets[control + "_bakeToggle"], edit = True, v = True)
	    
	    
	self.bakeSpace()
Esempio n. 33
0
 def camSwitch(self, *args):
     if mc.selectPref(q=True, paintSelect=True):
         if mc.selectPref(q=True, paintSelectWithDepth=True):
             mc.selectPref(paintSelectWithDepth=False)
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
         else:
             mc.selectPref(paintSelectWithDepth=True)
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True)
     else:
         if mc.selectPref(q=True, useDepth=True):
             mc.selectPref(useDepth=0)
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
         else:
             mc.selectPref(useDepth=1)
             mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True)
	def createHeaderUi(self):
		headerUiLayout = cmds.rowColumnLayout(numberOfRows = 1)

		mainMenuBtn = cmds.iconTextButton(label = 'Menu', style = 'iconOnly', image = 'freeformOff.png')
		relAllTexBtn = cmds.iconTextButton(label = ' Rel Tex ', style = 'textOnly', c = self.onReloadTexturesPressed)
		dockBtn = cmds.iconTextButton(label = ' Dock To ', style = 'textOnly')
		self.refreshBtn = cmds.iconTextButton(label = ' Refresh ', style = 'textOnly', c = self.manualRefreshNodeList)
		self.autoRefreshCkbx = cmds.iconTextCheckBox(label = ' Auto Refresh ', value = 1, style = 'textOnly', changeCommand = self.onAutoRefreshCkbxPressed)
		self.menuDockTo(dockBtn)
		self.menuMainMenu(mainMenuBtn)

		cmds.iconTextButton(self.refreshBtn, e = 1, enable = not self.isAutoRefresh())

		return headerUiLayout
Esempio n. 35
0
 def addLayer(layer):
     enable = False if layer == "BaseAnimation" else True
     cmds.rowLayout(nc=3, adj=3)
     cmds.iconTextCheckBox(
         i="Solo_OFF.png",
         si="Solo_ON.png",
         v=True if enable and layer in s.anim.data["layers"]["solo"] else False,
         en=enable,
         cc=lambda x: s.updateLayer(layer, "solo", x)
     )
     cmds.iconTextCheckBox(
         i="Mute_OFF.png",
         si="Mute_ON.png",
         v=True if enable and layer in s.anim.data["layers"]["mute"] else False,
         en=enable,
         cc=lambda x: s.updateLayer(layer, "mute", x)
     )
     cmds.text(
         l="|    " * s.layers[layer]["depth"] + layer if enable else layer,
         al="left",
         en=enable,
     )
     cmds.setParent("..")
Esempio n. 36
0
 def convertDeformerCmd(self):
     """"""
     sels = cmds.ls(sl=1, ap=1)
     if not sels: cmds.error("Please select clusters or joints!")
         
     start = clock()
     for sel in sels:
         if cmds.objectType( sel, isType='joint' ):
             self.jointToCluster(sel)
         elif cmds.listRelatives(sel, s=1, typ='clusterHandle'):
             self.clusterToJoint(sel)
         else: cmds.warning("%s is skipped!" % sel)
         
         if not cmds.iconTextCheckBox(self.keepCheck, q=1, v=1):
             cmds.delete(sel)
     finish = clock()
     om.MGlobal.displayInfo( "Convert Time Cost: %fs" % (finish-start) )
Esempio n. 37
0
 def convertDeformerCmd(self):
     """"""
     sels = cmds.ls(sl=1, ap=1)
     if not sels: cmds.error("Please select clusters or joints!")
         
     start = clock()
     for sel in sels:
         if cmds.objectType( sel, isType='joint' ):
             self.jointToCluster(sel)
         elif cmds.listRelatives(sel, s=1, typ='clusterHandle'):
             self.clusterToJoint(sel)
         else: cmds.warning("%s is skipped!" % sel)
         
         if not cmds.iconTextCheckBox(self.keepCheck, q=1, v=1):
             cmds.delete(sel)
     finish = clock()
     om.MGlobal.displayInfo( "Convert Time Cost: %fs" % (finish-start) )
Esempio n. 38
0
 def visibility(self, *args):
     selectionList = mc.ls(selection=True, type='transform')
     if selectionList:
         state = mc.getAttr(selectionList[-1] + ".visibility")
         if state:
             mc.setAttr(selectionList[-1] + ".visibility", 0)
             mc.iconTextCheckBox(self.bt_visibility, edit=True, value=False)
         else:
             mc.setAttr(selectionList[-1] + ".visibility", 1)
             mc.iconTextCheckBox(self.bt_visibility, edit=True, value=True)
     else:
         mc.iconTextCheckBox(self.bt_visibility, edit=True, value=False)
         print ">> No selection"
Esempio n. 39
0
    def on_changed_callback(raw_command, state):
        """New callback"""

        # If "control" is held force the toggled one to on and
        # toggle the others based on whether any of the buttons
        # was remaining active after the toggle, if not then
        # enable all
        if mc.getModifiers() == 4:  # = CTRL
            state = True
            active = [mc.iconTextCheckBox(btn, query=True, value=True) for btn
                      in buttons]
            if any(active):
                mc.selectType(allObjects=False)
            else:
                mc.selectType(allObjects=True)

        # Replace #1 with the current button state
        cmd = raw_command.replace(" #1", " {}".format(int(state)))
        mel.eval(cmd)
Esempio n. 40
0
 def installCreateButton(self):
     """"""
     form = cmds.formLayout()
     btn = cmds.iconTextButton(st='iconOnly',
                               l='Create',
                               i=setup.getBanner(),
                               c=lambda *args: self.createSoftDeformerCmd() )
     
     self.jointCheck = cmds.iconTextCheckBox(st='textOnly', l='   J   ',  ann="Create joint")
     cmds.formLayout(form,
                     e=1,
                     af=[(btn, 'left', 0),
                         (btn, 'right', 0),
                         (btn, 'top', 0),
                         (btn, 'bottom', 0),
                         (self.jointCheck, 'right', 0),
                         (self.jointCheck, 'top', 0)],
                     )
     cmds.setParent( '..' )
     return form
Esempio n. 41
0
    def createSoftDeformerCmd(self):
        """"""
        self.excludeItems = cmds.textScrollList(self.excludeScrollList, q=1, ai=1)

        supportTypes = []
        for typeCB, typeName in zip(self.supportTypeCB, self._supportTypes):
            if cmds.checkBox(typeCB, q=1, v=1):
                supportTypes.append(typeName)

        if not supportTypes:
            cmds.error('Please check at least one support type!')
        
        start = clock()
        
        if not cmds.iconTextCheckBox(self.jointCheck, q=1, v=1):
            scData.ClusterFn.createSoftCluster(self.excludeItems, supportTypes)
        else:
            scData.JointFn.createSoftJoint(self.excludeItems, supportTypes)
            
        finish = clock()
        om.MGlobal.displayInfo( "Create Time Cost: %fs" % (finish-start) )
Esempio n. 42
0
    def createSoftDeformerCmd(self):
        """"""
        self.excludeItems = cmds.textScrollList(self.excludeScrollList, q=1, ai=1)

        supportTypes = []
        for typeCB, typeName in zip(self.supportTypeCB, self._supportTypes):
            if cmds.checkBox(typeCB, q=1, v=1):
                supportTypes.append(typeName)

        if not supportTypes:
            cmds.error('Please check at least one support type!')
        
        start = clock()
        
        if not cmds.iconTextCheckBox(self.jointCheck, q=1, v=1):
            scData.ClusterFn.createSoftCluster(self.excludeItems, supportTypes)
        else:
            scData.JointFn.createSoftJoint(self.excludeItems, supportTypes)
            
        finish = clock()
        om.MGlobal.displayInfo( "Create Time Cost: %fs" % (finish-start) )
Esempio n. 43
0
    def __init__(self):
        self.GUI = {}  # Store GUI elements
        self.prefs = preferences.Preferences()  # Preferences

        def button(text, command, icon):
            image = os.path.join(os.path.dirname(os.path.realpath(__file__)), "images", "icons", icon)
            ui = []
            ui.append(cmds.rowLayout(ad2=2, nc=2))
            ui.append(cmds.symbolButton(image=image, h=50, w=50, c=command))
            ui.append(cmds.button(label=text, h=50, c=command))
            cmds.setParent("..")
            return ui

        title = "Settings:"
        self.GUI['window'] = cmds.window(title=title, rtf=True, s=False)
        self.GUI['layout1'] = cmds.columnLayout(adjustableColumn=True)
        self.GUI["text1"] = cmds.text(label="Settings")
        cmds.separator()
        self.GUI["button1"] = cmds.button(label="Open Template", h=50, c=self.openTemplate)
        self.GUI["layout1"] = cmds.rowColumnLayout(nc=2)

        self.GUI['layout2'] = cmds.columnLayout(adjustableColumn=True, bgc=[0.8, 0.8, 0.8])
        self.GUI["button2"] = button("Set Template File", self.setTemplate, "Upload-Folder-icon.png")
        self.GUI["button3"] = button("Set Pose Folder", self.setPoseFolder, "Edit-Folder-icon.png")
        # self.GUI["check1"] = cmds.symbolCheckBox(ann="Reminder", h=50, w=50, oni=imgOn, ofi=imgOff, cc=self.toggleReminder)
        self.GUI["check1"] = cmds.iconTextCheckBox(l="Reminder", style='iconAndTextHorizontal', h=50, al="center", cc=self.toggleReminder)
        cmds.setParent('..')

        self.GUI['layout3'] = cmds.columnLayout(adjustableColumn=True)
        self.GUI["text2"] = cmds.text(h=50, label="STUFF IN HERE")
        self.GUI["text3"] = cmds.text(h=50, label="MORE STUFF HERE")
        self.GUI["text4"] = cmds.text(h=50, label="Trigger reminder popups each day.")

        self.updateTemplate()
        self.updatePoseFolder()
        self.updateReminder()
        cmds.setParent('..')

        cmds.showWindow(self.GUI["window"])
Esempio n. 44
0
    def createModulesList(self):

        moduleList = util.findAllModules(RIGGING_TOOL_ROOT)

        for module in moduleList:
            ## creates the buttons on the
            #    importing modules where we won't know the specific name of the module being imported
            module = __import__(environ.BlueprintModulePath + module, {}, {}, [module])
            reload(module)

            className = module.ClassName

            buttonSize = [self.moduleListWidth - 24, 48]
            self.UIwidgets[className] = cmds.iconTextCheckBox(
                className,
                w=buttonSize[0],
                h=buttonSize[1],
                style="iconAndTextVertical",
                image1="cube.png",
                parent=self.UIwidgets["modulesScrollLayout"],
                label=className,
                changeCommand=partial(self.moduleButtonCommand, className),
            )
Esempio n. 45
0
 def EditCallBack(self, stEd=0, fhEd=0):
     if stEd:
         cmds.iconTextButton('addPoseButton_KitKat', e=1, en=0)
         cmds.iconTextButton('subPoseButton_KitKat', e=1, en=0)
         cmds.iconTextCheckBox('editPoseButton_KitKat', e=1, v=1)
         return
     if fhEd:
         cmds.iconTextButton('addPoseButton_KitKat', e=1, en=1)
         cmds.iconTextButton('subPoseButton_KitKat', e=1, en=1)
         cmds.iconTextCheckBox('editPoseButton_KitKat', e=1, v=0)
         return
     if not cmds.iconTextCheckBox('editPoseButton_KitKat', q=1, v=1):
         # 按钮为点亮状态
         self.EditCallBack(0, 1)
         self.transfer2Bs(cmds.text('editTarget_KitKat', q=1, l=1))
     else:
         if cmds.menu('loadobj_KitKat', q=1, l=1) == '| Load Object |':
             self.goToPose()
             cmds.iconTextCheckBox('editPoseButton_KitKat', e=1, v=0)
         else:
             if self.EditProc():   #调出bs, 开始编辑
                 self.EditCallBack(1)
             else:
                 self.EditCallBack(0, 1)
Esempio n. 46
0
    def moduleButtonCommand(self, ClassName, *args):

        ##  get a list of all the modules button
        moduleList = cmds.scrollLayout(self.UIwidgets["modulesScrollLayout"], q=True, childArray=True)
        moduleButtonSelected = cmds.iconTextCheckBox(ClassName, q=True, fullPathName=True)
        #  deselects module buttons if another module is selected
        for mod in moduleList:
            moduleButtonPath = cmds.iconTextCheckBox(mod, q=True, fullPathName=True)
            if moduleButtonSelected != moduleButtonPath:
                cmds.iconTextCheckBox(mod, edit=True, v=False)
            if moduleButtonSelected == moduleButtonPath:
                cmds.iconTextCheckBox(mod, edit=True, v=True)

        """
        mod = __import__(environ.BlueprintModulePath + module, {}, {}, [module])
        reload(mod)

        # Get class reference for Blueprint module class, then create user specified instance of Blueprint module class and call it's Constructor and install method.
        #  getAttr returns import reference,
        moduleClass = getattr(mod, mod.ClassName)
        moduleInstance = moduleClass(moduleName)
        """
        self.createModulesOptions(ClassName)
Esempio n. 47
0
 def setCreateBtnIcon(self):
     """"""
     if cmds.iconTextCheckBox(self.jointCheck, q=1, v=1):
         cmds.iconTextButton(self.createBtn, e=1, i=setup.getBannerJ())
     else:
         cmds.iconTextButton(self.createBtn, e=1, i=setup.getBanner())
Esempio n. 48
0
def main():
    toggleState = mc.iconTextCheckBox("objSelSurfaceBtn", q=True, v=True)
    mm.eval('setObjectPickMask "Surface" false;') if toggleState else mm.eval(
        'setObjectPickMask "Surface" true;')
Esempio n. 49
0
def SundayWarehouseBrowserUpdateAssets():
    cmds.optionVar(stringValue = ('whIconViewComboBox', cmds.optionMenu('whIconViewComboBox', query = True, value = True)))
    cmds.setParent(warehouseBrowserUI)
    cmds.setParent(cmds.button('warehouseIconDummyButtonToGrabParent', query = True, fullPathName = True, parent = True))
    if cmds.scrollLayout('whScrollLayout', query = True, exists = True):
        cmds.deleteUI('whScrollLayout', layout = True)
    
    iconLayout = cmds.optionMenu('whIconViewComboBox', query = True, value = True)
    iconSize = iconLayout.split('x')
    if len(iconSize) > 1:
        cmds.scrollLayout('whScrollLayout', childResizable = True)
        if iconLayout == '64x64':
            cmds.rowColumnLayout(numberOfColumns = 8)
        
        if iconLayout == '96x96':
            cmds.rowColumnLayout(numberOfColumns = 5)
        
        if iconLayout == '128x128':
            cmds.rowColumnLayout(numberOfColumns = 4)
        
        if iconLayout == '192x192':
            cmds.rowColumnLayout(numberOfColumns = 2)
        
        if iconLayout == '256x256':
            cmds.rowColumnLayout(numberOfColumns = 2)
        
    else:
        cmds.scrollLayout('whScrollLayout', childResizable = True)
        cmds.rowColumnLayout(numberOfColumns = 1)
    assetPath = cmds.optionVar(query = 'SundayWarehousePath') + '/' + cmds.optionMenu('whCategoryComboBox', query = True, value = True) + '/' + cmds.optionMenu('whTypeComboBox', query = True, value = True)
    assetDir = os.listdir(assetPath)
    cmds.optionVar(stringValue = ('whIconCaption', cmds.iconTextCheckBox('whIconCaption', query = True, value = True)))
    if len(assetDir) != 0:
        cmds.iconTextRadioCollection('whAssetCollection')
        for curAsset in assetDir:
            curAssetPath = assetPath + '/' + curAsset + '/'
            if curAsset != '.DS_Store':
                assetFile = os.listdir(curAssetPath)
                for curFile in assetFile:
                    file = os.path.splitext(curFile)[0]
                    fileEx = os.path.splitext(curFile)[1]
                    if fileEx == '.mb' or fileEx == '.ma':
                        image = curAssetPath + file + '.png'
                        if len(iconSize) > 1:
                            if cmds.optionVar(query = 'whIconCaption') == 'True':
                                cmds.columnLayout(rowSpacing = 0, columnWidth = int(iconSize[0]))
                            
                            assetIcon = cmds.iconTextRadioButton(image1 = image, height = int(iconSize[0]), width = int(iconSize[0]), onCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateInfo("' + curAssetPath + '")', label = curAssetPath + curFile, annotation = file)
                            cmds.popupMenu(button = 3, markingMenu = True)
                            cmds.menuItem(label = 'View Icon', command = 'SundayWarehousePy.SundayWarehouseBrowserViewIcon("' + curAssetPath + file + '")')
                            if os.path.exists(curAssetPath + file + '.dae'):
                                cmds.menuItem(label = 'View Collada', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenInColladaViewer("' + curAssetPath + file + '")')
                            else:
                                cmds.menuItem(label = 'View Collada (No .DAE)', enable = False)
                            cmds.menuItem(label = 'Reveal Asset', command = 'SundayWarehousePy.SundayWarehouseBrowserRevealAsset("' + curAssetPath + file + '")')
                            cmds.menuItem(divider = True)
                            cmds.menuItem(label = 'Open Original', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenFile("' + curAssetPath + file + fileEx + '")')
                            if cmds.optionVar(query = 'whIconCaption') == 'True':
                                cmds.text(label = file, width = int(iconSize[0]), align = 'left')
                                cmds.setParent('..')
                            
                        else:
                            cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [
                                (1, 64),
                                (2, 8),
                                (3, 435)])
                            assetIcon = cmds.iconTextRadioButton(image1 = image, height = 64, width = 64, onCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateInfo("' + curAssetPath + '")', label = curAssetPath + curFile, annotation = file)
                            cmds.popupMenu(button = 3, markingMenu = True)
                            cmds.menuItem(label = 'View Icon', command = 'SundayWarehousePy.SundayWarehouseBrowserViewIcon("' + curAssetPath + file + '")')
                            if os.path.exists(curAssetPath + file + '.dae'):
                                cmds.menuItem(label = 'View Collada', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenInColladaViewer("' + curAssetPath + file + '")')
                            else:
                                cmds.menuItem(label = 'View Collada (No .DAE)', enable = False)
                            cmds.menuItem(label = 'Reveal Asset', command = 'SundayWarehousePy.SundayWarehouseBrowserRevealAsset("' + curAssetPath + file + '")')
                            cmds.menuItem(divider = True)
                            cmds.menuItem(label = 'Open Original', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenFile("' + curAssetPath + file + '")')
                            cmds.text(label = '')
                            cmds.text(label = file, align = 'left')
                            cmds.setParent('..')
                    len(iconSize) > 1
                
        
    
    cmds.optionVar(stringValue = ('whCategoryComboBox', cmds.optionMenu('whCategoryComboBox', query = True, value = True)))
    cmds.optionVar(stringValue = ('whTypeComboBox', cmds.optionMenu('whTypeComboBox', query = True, value = True)))
Esempio n. 50
0
    def buildUI(self):
        if mc.window(self.winName, query=True, exists=True):
            mc.deleteUI(self.winName)
        if mc.windowPref(self.winName, exists=1):
            mc.windowPref(self.winName, r=1)
        if mc.toolBar(self.toolBarName, query=True, exists=True):
            mc.deleteUI(self.toolBarName)
        '''
        if mc.workspaceControl(wscName, query=True, exists=True):
            mc.deleteUI(wscName, control=True)
        '''

        mc.window(self.winName, title='kTool', sizeable=False, widthHeight=(186, 1100))
        mc.columnLayout('columnLayout1', height=1100, adjustableColumn=True)


        # build UI : Common Selection Options

        mc.frameLayout('selection_Layout', parent='columnLayout1', collapsable=True, label='Common Selection Options')
        mc.columnLayout('columnLayout2')
        mc.rowColumnLayout(numberOfColumns=2)
        self.lb_tool = mc.iconTextStaticLabel(width=44, visible=True, image=self.path + 'selectTool.png')
        mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextRadioCollection()
        self.bt_selObj = mc.iconTextRadioButton(width=44, height=32, enableBackground=False, image=self.path + 'objectnex.png', select=True, onCommand=self.selObject)
        self.bt_selMulti = mc.iconTextRadioButton(width=44, height=32, enableBackground=False, label='Multi',  style='textOnly', onCommand=self.selMulti)
        self.bt_selUv = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'uvnex.png', onCommand=self.selUv)
        self.bt_selVert = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'vertexnex.png', onCommand=self.selVertex)
        self.bt_selEdge = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'edgesnex.png', onCommand=self.selEdge)
        self.bt_selFace = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'facesnex.png', onCommand=self.selFace)
        mc.rowColumnLayout(parent='columnLayout2', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextRadioCollection()
        self.bt_marqueeSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Marquee',  style='textOnly', font='tinyBoldLabelFont', onCommand=self.selectionStyleSwitch)
        self.bt_dragSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Drag',  style='textOnly', font='tinyBoldLabelFont', onCommand=self.selectionStyleSwitch)
        self.bt_tweakSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Tweak',  style='textOnly', font='tinyBoldLabelFont')
        self.bt_camSwitch = mc.iconTextCheckBox(width=44, height=22, label='Cam B',  style='textOnly', font='tinyBoldLabelFont', changeCommand=self.camSwitch)
        mc.rowColumnLayout('rowColumnLayout4', parent='columnLayout2', numberOfColumns=2, columnWidth=[[1, 20], [2, 160]])
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'transform.png')
        self.tf_transformName = mc.textField(enterCommand=self.renameTransform)
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'shape.png')
        self.tf_shapeName = mc.textField(editable=False)
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'constructionHistory.png')
        self.om_history = mc.optionMenu(changeCommand=self.openAttributEditor, alwaysCallChangeCommand=True, maxVisibleItems=10)
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'quickRename.png')
        self.tf_selByName = mc.textField(placeholderText='select by name', enterCommand=self.selectByName)


        # build UI : Transform

        mc.frameLayout('transform_Layout', parent='columnLayout1', collapsable=True, label='Transform')
        mc.columnLayout('columnLayout3')
        mc.channelBox('channelBox1', width=180, height=192, # preventOverride=False,
                                    # attributeEditorMode=False,
                                    # containerAtToparent=False,
                                    precision=3,
                                    fixedAttrList=("translateX", "translateY", "translateZ", "rotateX", "rotateY",
                                                   "rotateZ", "scaleX", "scaleY", "scaleZ", 'visibility'))
        mc.gridLayout(numberOfRows=5, numberOfColumns=4, cellWidth=45, cellHeight=44)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'deleteHistory.png', command=self.deleteHistory)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'centerPivot.png', command=self.centerPivot)
        mc.iconTextButton(width=44, height=44, enableBackground=False, label='//',  style='textOnly', enable=False)
        self.bt_visibility = mc.iconTextCheckBox(width=44, height=44, image=self.path + 'visibility.png', changeCommand=self.visibility)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'resetTransform.png', command=self.resetAllTransform)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'matchTransform.png', command=self.matchAllTransforms)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'freezeTransform.png', command=self.freezeAllTransform)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'unfreeze.png', command=self.unFreeze)
        mc.gridLayout(parent='columnLayout3', numberOfRows=4, numberOfColumns=4, cellWidth=45, cellHeight=22)
        mc.iconTextButton(width=44, height=22, label='R.T', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetTranslation)
        mc.iconTextButton(width=44, height=22, label='M.T', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchTranslate)
        mc.iconTextButton(width=44, height=22, label='F.T', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeTranslate)
        mc.iconTextButton(width=44, height=22, label='//',  style='textOnly', enable=False)
        mc.iconTextButton(width=44, height=22, label='R.R', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetRotation)
        mc.iconTextButton(width=44, height=22, label='M.R', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchRotate)
        mc.iconTextButton(width=44, height=22, label='F.R', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeRotate)
        mc.iconTextCheckBox(width=44, height=22, image=self.path + 'snapToggle.png')
        mc.iconTextButton(width=44, height=22, label='R.S', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetScaling)
        mc.iconTextButton(width=44, height=22, label='M.S', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchScale)
        mc.iconTextButton(width=44, height=22, label='F.S', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeScale)
        mc.iconTextButton(width=44, height=22, label='//',  style='textOnly', enable=False)


        # build UI : Display

        mc.frameLayout('display_Layout', parent='columnLayout1', collapsable=True, label='Display')


        # build UI : Tool Settings

        self.fl_tool = mc.frameLayout('tool_Layout', parent='columnLayout1', collapsable=True, label='Tool Settings')
        mc.columnLayout('columnLayout6')
        mc.rowColumnLayout(numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Object',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='World',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Comp.',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Parent',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Normal',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Gimbal',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(enable=False, width=44, height=22, enableBackground=True, label='//',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Custom',  style='textOnly', font='tinyBoldLabelFont')
        mc.separator(parent='columnLayout6', height=1,  style='none')
        mc.rowColumnLayout(parent='columnLayout6', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Default',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Object',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Manip',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Selection',  style='textOnly', font='tinyBoldLabelFont')
        mc.separator(parent='columnLayout6', height=1,  style='none')
        mc.rowColumnLayout(parent='columnLayout6', enable=False, visible=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.text(width=44, height=22, label='Snap :', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Relative',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Absolute',  style='textOnly', font='tinyBoldLabelFont')
        mc.floatField(width=44, height=22, precision=3)
        mc.separator(parent='columnLayout6', height=1,  style='none')
        mc.rowColumnLayout(parent='columnLayout6', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Tweak',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Pr.UVs',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Pr.Child',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Free Rot.',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='No Neg.S',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Smt.Dup',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Smt.Ext',  style='textOnly', font='tinyBoldLabelFont')


        # build UI : Soft selection

        mc.frameLayout('soft_Layout', parent='columnLayout1', collapsable=True, label='Soft')
        mc.columnLayout('columnLayout5')
        mc.rowColumnLayout('rowColumnLayout9', height=46, numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextCheckBox(width=44, height=44, image=self.path + 'offsetCurve.png', label='Soft',  style='iconAndTextVertical', font='tinyBoldLabelFont')
        mc.gridLayout(numberOfRows=2, numberOfColumns=2, cellWidth=44, cellHeight=22)
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Surface',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Volume',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Object',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Global',  style='textOnly', font='tinyBoldLabelFont')
        mc.gridLayout(parent='rowColumnLayout9', numberOfColumns=1, cellWidth=44, cellHeight=22)
        mc.floatField(width=44, precision=3)
        mc.iconTextCheckBox(width=44, label='Color',  style='textOnly', font='tinyBoldLabelFont')
        mc.rowColumnLayout(parent='columnLayout5', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetA.png',  style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetB.png',  style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetC.png',  style='iconOnly', font='tinyBoldLabelFont')


        # build UI : Symmetry

        mc.frameLayout('sym_Layout', parent='columnLayout1', collapsable=True, label='Symmetry')
        mc.columnLayout('columnLayout4')
        mc.rowColumnLayout(height=46, numberOfColumns=2)
        mc.iconTextCheckBox(width=44, height=44, image=self.path + 'polyMirrorCut.png', label='Sym',  style='iconAndTextVertical', font='tinyBoldLabelFont')
        mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Object',  style='textOnly', font='tinyBoldLabelFont', select=True)
        mc.iconTextRadioButton(width=44, height=22, label='World',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Topo',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='X',  style='textOnly', font='tinyBoldLabelFont', select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Y',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Z',  style='textOnly', font='tinyBoldLabelFont')
        mc.rowColumnLayout(parent='columnLayout4', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, label='P.Seam',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, label='Partial',  style='textOnly', font='tinyBoldLabelFont')
        mc.floatField(width=44, height=22, precision=3)


        # build UI : Step Snap

        mc.frameLayout('step_Layout', parent='columnLayout1', collapsable=True, label='Step & Snap')
        mc.columnLayout('columnLayout7')
        mc.rowColumnLayout(height=46, numberOfColumns=2)
        mc.iconTextCheckBox(width=44, height=44, image=self.path + 'snapPixel.png', label='Snap',  style='iconAndTextVertical', font='tinyBoldLabelFont')
        mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Relative',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Absolute',  style='textOnly', font='tinyBoldLabelFont')
        mc.floatField(width=44, precision=3)
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Edge',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Surface',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextButton(width=44, height=22, label='Normals',  style='textOnly', font='tinyBoldLabelFont')
        mc.rowColumnLayout(parent='columnLayout7', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapGrid.png', style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapCurve.png', style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapPoint.png', style='iconOnly', font='tinyBoldLabelFont')

        # mc.showWindow(self.winName)
        # gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow')
        allowedAreas = ['left', 'right']
        mc.toolBar(self.toolBarName, area='right', content=self.winName, allowedArea=allowedAreas) # , parent=gMainWindow)
Esempio n. 51
0
def doImportShaders(arg=None):
    '''
    Button: Import Shader.
    Imports selected shader from library if does not already exist in file and
    assigns shader to selected objects.
    '''
    selectedCategory = cmds.textScrollList("shaderCategoriesSL", query=True, selectItem=True)

    selection = cmds.ls(selection=True, long=True) or []
    tempGrp = "tempImportedGrp"
    if cmds.objExists(tempGrp):
        cmds.delete(tempGrp)
        
    # Get selected swatch.
    swatch = cmds.textField("currentlySelectedTFD", query=True, text=True)
    if not swatch:
        sys.stdout.write("Select a shader\n")
        return
    
    # Get selected category.
    directory = getCategoryFolder()
    
    # Check if selected swatch shader already exists in file.
    shadingEngine = "%s_SG" % swatch
    shader = "%s_SHD" % swatch
    
    validTexture = False
    if cmds.objExists(shadingEngine):
        meshList = [x for x in (cmds.listHistory(shadingEngine) or []) if cmds.nodeType(x) == "mesh"]
        if meshList:
            meshTransform = cmds.listRelatives(meshList[0], path=True, parent=True)[0]
            validTexture = ddCheckTexturePublished.do(nodes=meshTransform, confirm=False, assetCategory=selectedCategory)
        
    if cmds.objExists(shadingEngine) and cmds.objExists(shader) and validTexture:
        if selection:
            # Apply existing shader to selection.
            sys.stdout.write('Shader "%s_SG" already exists. Applying to selection... \n' % swatch)
            for sel in selection:
                selShape = sel
                if not (cmds.nodeType(sel) == "mesh"):
                    selShape = cmds.listRelatives(sel, shapes=True, path=True)
                    if selShape:
                        selShape = selShape[0]
                if selShape:
                    cmds.sets(selShape, forceElement=shadingEngine)
        else:
            sys.stdout.write('Shader "%s_SG" already exists. Skipping... \n' % swatch)
            
    else:
        meshList = list()
        connectedSurfaceShader = None
        # If shader has been deleted from Hypershade, shading engine and other nodes must also be deleted.
        if cmds.objExists(shadingEngine):
            meshList = [x for x in (cmds.listHistory(shadingEngine) or []) if cmds.nodeType(x) == "mesh"]
            connectedSurfaceShader = cmds.listConnections("%s.surfaceShader" % shadingEngine)
            cmds.delete(shadingEngine)
            
        if cmds.objExists(shader):
            connectedShadingEngine = cmds.listConnections("%s.outColor" % shader)
            if connectedShadingEngine:
                meshList = [x for x in (cmds.listHistory(connectedShadingEngine[0]) or []) if cmds.nodeType(x) == "mesh"]
            cmds.delete(shader)
            
        if connectedSurfaceShader and cmds.objExists(connectedSurfaceShader[0]):
            cmds.delete(connectedSurfaceShader[0])
        deleteNodes = cmds.ls("%s_*DIFF*" % swatch, "%s_*SPEC*" % swatch, "%s_*NRML*" % swatch)
        try:
            cmds.delete(deleteNodes)
        except: pass
        
        # Get the path to swatch file.
        fileName = os.path.join(directory, "%s.ma" % swatch)
        if os.path.isfile(fileName):
            # Import swatch file into tempGrp.
            cmds.file(fileName, i=True, groupReference=True, groupName=tempGrp)
            if cmds.objExists(tempGrp):
                # Remove any namespaces from imported nodes.
                tempGrp = ddRemoveNamespaces.doRemoveNamespaces(tempGrp)
                # Children consists of one swatch plane.
                children = cmds.listRelatives(tempGrp, children=True, path=True)
                if children:
                    # Get the connected shading engine.
                    shadingEngine = getConnectedShadingEngine(children[0])
                    meshList.extend(selection)
                    if shadingEngine:
                        # Assign shader to selected objects.
                        for sel in meshList:
                            selShape = sel
                            if not (cmds.nodeType(sel) == "mesh"):
                                selShape = cmds.listRelatives(sel, shapes=True, path=True)
                                if selShape:
                                    selShape = selShape[0]
                            if selShape:
                                cmds.sets(selShape, forceElement=shadingEngine)
                    else:
                        sys.stdout.write("Swatch shader for %s not found. Skipping...\n" % swatch)
                    
                    # Change the button font to oblique for imported shader.
                    try:
                        cmds.iconTextCheckBox("%sBTN" % swatch, edit=True, font = "obliqueLabelFont")
                    except: pass
                else:
                    sys.stdout.write("Swatch mesh for %s not found. Skipping...\n" % swatch)
                    
                cmds.delete(tempGrp)
            else:
                sys.stdout.write("Shader did not load properly. \n" % fileName)
        else:
            sys.stdout.write("Swatch file %s not found. Skipping... \n" % fileName)
    
    # Deselect the shader.
    deselectAll()
    
    # Reselect original selection.
    if selection:
        cmds.select(selection, replace=True)
Esempio n. 52
0
    def createUI(self):
        """Draw the window"""
        if cmds.window(self.window, exists=True):
            cmds.deleteUI(self.window, window=True)
        self.window = cmds.window(self.window, title=self.title)

        # setup = {'panelLayout':[cmds.panelLayout, {configuration:"horizontal2", panelSize:[2,0,1]}]}
        # for k, (class_, kwargs) in setup.iteritems():
        #     self.interface[k] = class_(**kwargs)

        self.interface = {}
        filterSizeButton = 25
        self.interface['panelLayout'] = cmds.paneLayout(configuration='horizontal2', paneSize=[2, 0, 1])
        self.interface['formLayout1'] = cmds.formLayout(numberOfDivisions=100)
        self.interface['sourceButton'] = cmds.button(label='Source', width=50, command=self.getSourceNode)
        self.interface['sourceField'] = cmds.textField(height=24, editable=False)
        self.interface['patternButton'] = cmds.button(label='Pattern', width=50, command=self.getPattern)
        self.interface['patternField'] = cmds.textField(height=24, alwaysInvokeEnterCommandOnReturn=True, enterCommand=self.listNodes, changeCommand=self.listNodes)

        self.interface['filtersLayout'] = cmds.formLayout(numberOfDivisions=100)
        self.interface['mesh'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_polyPlane.png', value=self.preferences['mesh'], changeCommand=functools.partial(self.savePrefs, 'mesh', True))
        self.interface['nurbsCurve'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_nurbsCurve.png', value=self.preferences['nurbsCurve'], changeCommand=functools.partial(self.savePrefs, 'nurbsCurve', True))
        self.interface['nurbsSurface'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_nurbsSurface.png', value=self.preferences['nurbsSurface'], changeCommand=functools.partial(self.savePrefs, 'nurbsSurface', True))
        self.interface['lambert'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_lambert.png', value=self.preferences['lambert'], changeCommand=functools.partial(self.savePrefs, 'lambert', True))
        self.interface['file'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_file.png', value=self.preferences['file'], changeCommand=functools.partial(self.savePrefs, 'file', True))
        self.interface['camera'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_camera.png', value=self.preferences['camera'], changeCommand=functools.partial(self.savePrefs, 'camera', True))
        self.interface['light'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_ambientLight.png', value=self.preferences['light'], changeCommand=functools.partial(self.savePrefs, 'light', True))
        self.interface['particle'] = cmds.iconTextCheckBox(width=filterSizeButton, height=filterSizeButton, image='out_particle.png', value=self.preferences['particle'], changeCommand=functools.partial(self.savePrefs, 'particle', True))

        cmds.setParent('..')

        self.interface['settingsFrame'] = cmds.frameLayout(collapsable=True, collapse=self.preferences['settingsFrame'], label='Settings', expandCommand=functools.partial(self.savePrefs, 'settingsFrame', False), collapseCommand=functools.partial(self.savePrefs, 'settingsFrame', False))
        self.interface['columnLayout'] = cmds.formLayout(numberOfDivisions=100)
        self.interface['selectSource'] = cmds.checkBox(value=self.preferences['selectSource'], label='Select Source', changeCommand=functools.partial(self.savePrefs, 'selectSource', False))
        self.interface['reverseSelection'] = cmds.checkBox(value=self.preferences['reverseSelection'], editable=self.preferences['selectSource'], label='Reverse Selection', changeCommand=functools.partial(self.savePrefs, 'reverseSelection', False))
        self.interface['longNames'] = cmds.checkBox(value=self.preferences['longNames'], label='Long Names', changeCommand=functools.partial(self.savePrefs, 'longNames', False))
        self.interface['regex'] = cmds.checkBox(value=self.preferences['regex'], label='Use Regex', changeCommand=functools.partial(self.savePrefs, 'regex', False))
        # self.interface['high'] = cmds.checkBox(value=self.preferences['high'], label='Use High', changeCommand=functools.partial(self.savePrefs, 'high', False))
        cmds.setParent('..')
        cmds.setParent('..')
        self.interface['listSelector'] = cmds.textScrollList(allowMultiSelection=True, selectCommand=self.selectNodes)

        self.interface['formLayout2'] = cmds.formLayout(numberOfDivisions=100, parent=self.interface['panelLayout'])
        self.interface['shelfLayout'] =  cmds.shelfLayout(height=41)
        self.loadShelf()

        cmds.formLayout(
            self.interface['formLayout1'], edit=True,
            attachForm=(
                [self.interface['sourceButton'], 'top', 5],
                [self.interface['sourceButton'], 'left', 5],
                [self.interface['sourceField'], 'top', 5],
                [self.interface['sourceField'], 'right', 5],
                [self.interface['patternButton'], 'left', 5],
                [self.interface['patternField'], 'right', 5],
                [self.interface['settingsFrame'], 'left', 0],
                [self.interface['settingsFrame'], 'right', 0],
                [self.interface['listSelector'], 'left', 0],
                [self.interface['listSelector'], 'right', 0],
                [self.interface['listSelector'], 'bottom', 0],
            ),
            attachControl=(
                [self.interface['patternButton'], 'top', 5, self.interface['sourceButton']],
                [self.interface['patternField'], 'top', 5, self.interface['sourceButton']],
                [self.interface['listSelector'], 'top', 5, self.interface['settingsFrame']],
                [self.interface['sourceField'], 'left', 5, self.interface['sourceButton']],
                [self.interface['patternField'], 'left', 5, self.interface['patternButton']],
                [self.interface['filtersLayout'], 'top', 5, self.interface['patternButton']],
                [self.interface['settingsFrame'], 'top', 5, self.interface['filtersLayout']],
            )
        )

        cmds.formLayout(
            self.interface['filtersLayout'], edit=True,
            attachControl=(
                [self.interface['light'], 'left', 0, self.interface['camera']],
                [self.interface['mesh'], 'left', 0, self.interface['light']],
                [self.interface['nurbsCurve'], 'left', 0, self.interface['mesh']],
                [self.interface['nurbsSurface'], 'left', 0, self.interface['nurbsCurve']],
                [self.interface['lambert'], 'left', 0, self.interface['nurbsSurface']],
                [self.interface['file'], 'left', 0, self.interface['lambert']],
                [self.interface['particle'], 'left', 0, self.interface['file']],
            )
        )

        cmds.formLayout(
            self.interface['columnLayout'], edit=True,
            attachForm=(
                [self.interface['selectSource'], 'top', 5],
                [self.interface['selectSource'], 'left', 5],
                [self.interface['reverseSelection'], 'top', 5],
                [self.interface['reverseSelection'], 'left', 125],
                [self.interface['longNames'], 'left', 5],
                [self.interface['longNames'], 'bottom', 5],
                [self.interface['regex'], 'left', 125],
                # [self.interface['high'], 'left', 5],
                # [self.interface['high'], 'bottom', 5],
            ),
            attachControl=(
                [self.interface['longNames'], 'top', 5, self.interface['selectSource']],
                [self.interface['regex'], 'top', 5, self.interface['reverseSelection']],
                # [self.interface['high'], 'top', 5, self.interface['longNames']],
            )
        )
        cmds.formLayout(
            self.interface['formLayout2'], edit=True,
            attachForm=(
                [self.interface['shelfLayout'], 'top', 0],
                [self.interface['shelfLayout'], 'left', 0],
                [self.interface['shelfLayout'], 'right', 0],
                [self.interface['shelfLayout'], 'bottom', 0],
            )
        )
        cmds.showWindow()
        self.createAnnotations()
        self.initUI()
Esempio n. 53
0
def main():
    toggleState = mc.iconTextCheckBox("objSelDeformBtn", q=True, v=True)
    mm.eval('setObjectPickMask "Deformer" false;') if toggleState else mm.eval(
        'setObjectPickMask "Deformer" true;')
import maya.cmds as cmds
Esempio n. 55
0
    def uiCreate(self):

        self.onCloseClicked()

        self.window = m.window(
            WIN_NAME,
            title='Maya Window',
            maximizeButton=False
        )

        uiLAY_mainForm = m.formLayout()

        self.uiLAY_mainScroll = m.scrollLayout(childResizable=True)

        mainColumn = m.columnLayout(adjustableColumn=True)  # main column layout with frames

        # --------
        self.uiLAY_frameCheckBoxes = self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1')
        self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame('uiLAY_frameCheckBoxGroups',
                                                            'Check Box Groups (PMCheckBoxGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiCHKGRP_test1 = m.checkBoxGrp(
            'uiCHKGRP_test1',
            numberOfCheckBoxes=1,
            label='PMCheckBoxGrp1',
            label1='test1'
        )
        self.uiCHKGRP_test2 = m.checkBoxGrp(
            'uiCHKGRP_test2',
            numberOfCheckBoxes=2,
            label='PMCheckBoxGrp2',
            labelArray2=('test1', 'test2')
        )
        self.uiCHKGRP_test3 = m.checkBoxGrp(
            'uiCHKGRP_test3',
            numberOfCheckBoxes=3,
            label='PMCheckBoxGrp3',
            labelArray3=('test1', 'test2', 'test3')
        )
        self.uiCHKGRP_test4 = m.checkBoxGrp(
            'uiCHKGRP_test4',
            numberOfCheckBoxes=4,
            label='PMCheckBoxGrp4',
            labelArray4=('test1', 'test2', 'test3', 'test4')
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameColorSliders = self.uiCreateFrame('uiLAY_frameColorSliders',
                                                          'Color Slider Groups (PMColorSliderGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiCLRGRP_test1 = m.colorSliderGrp(
            'uiCLRGRP_test1',
            label='test1'
        )
        self.uiCLRGRP_test2 = m.colorSliderGrp(
            'uiCLRGRP_test2',
            label='test2'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatFields = self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)
        m.separator(width=140, style='none')
        self.uiFLF_test1 = m.floatField('uiFLF_test1')
        self.uiFLF_test2 = m.floatField('uiFLF_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame('uiLAY_frameFloatFieldGroups',
                                                              'Float Field Groups (PMFloatFieldGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiFLFGRP_test1 = m.floatFieldGrp(
            'uiFLFGRP_test1',
            numberOfFields=1,
            label='PMFloatFieldGrp1'
        )
        self.uiFLFGRP_test2 = m.floatFieldGrp(
            'uiFLFGRP_test2',
            numberOfFields=2,
            label='PMFloatFieldGrp2'
        )
        self.uiFLFGRP_test3 = m.floatFieldGrp(
            'uiFLFGRP_test3',
            numberOfFields=3,
            label='PMFloatFieldGrp3'
        )
        self.uiFLFGRP_test4 = m.floatFieldGrp(
            'uiFLFGRP_test4',
            numberOfFields=4,
            label='PMFloatFieldGrp4'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatScrollBars = self.uiCreateFrame('uiLAY_frameFloatScrollBars',
                                                             'Float Scroll Bars (PMFloatScrollBar)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1')
        self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatSliders = self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1')
        self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame('uiLAY_frameFloatSliderGroups',
                                                               'Float Slider Groups (PMFloatSliderGrp)')
        m.columnLayout()
        m.separator(style='none', height=2)
        self.uiFLSGRP_test1 = m.floatSliderGrp(
            'uiFLSGRP_test1',
            label='test1',
            field=True
        )
        self.uiFLSGRP_test2 = m.floatSliderGrp(
            'uiFLSGRP_test2',
            label='test2',
            field=True
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes',
                                                                'Icon Text Check Boxes (PMIconTextCheckBox)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiITCHK_test1 = m.iconTextCheckBox(
            'uiITCHK_test1',
            style='iconAndTextHorizontal',
            label='cube',
            image1='cube'
        )
        self.uiITCHK_test2 = m.iconTextCheckBox(
            'uiITCHK_test2',
            style='iconAndTextHorizontal',
            label='cone',
            image1='cone'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame('uiLAY_frameIconTextRadioButtons',
                                                                  'Icon Text Radio Buttons (PMIconTextRadioButton)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=4)

        m.separator(style='none', width=140)
        m.iconTextRadioCollection()
        self.uiITRAD_test1 = m.iconTextRadioButton(
            'uiITRAD_test1',
            style='iconAndTextHorizontal',
            label='cube',
            image1='cube'
        )
        self.uiITRAD_test2 = m.iconTextRadioButton(
            'uiITRAD_test2',
            style='iconAndTextHorizontal',
            label='cone',
            image1='cone'
        )
        self.uiITRAD_test3 = m.iconTextRadioButton(
            'uiITRAD_test3',
            style='iconAndTextHorizontal',
            label='torus',
            image1='torus'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame('uiLAY_frameIconTextScrollLists',
                                                                 'Icon Text Scroll Lists (PMIconTextScrollList)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiITSLST_test1 = m.iconTextScrollList(
            'uiITSLST_test1',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )
        self.uiITSLST_test2 = m.iconTextScrollList(
            'uiITSLST_test2',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntFields = self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiINF_test1 = m.intField('uiINF_test1')
        self.uiINF_test2 = m.intField('uiINF_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntFieldGroups = self.uiCreateFrame('uiLAY_frameIntFieldGroups',
                                                            'Int Field Groups (PMIntFieldGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiINFGRP_test1 = m.intFieldGrp(
            'uiINFGRP_test1',
            numberOfFields=1,
            label='PMIntFieldGrp1'
        )
        self.uiINFGRP_test2 = m.intFieldGrp(
            'uiINFGRP_test2',
            numberOfFields=2,
            label='PMIntFieldGrp2'
        )
        self.uiINFGRP_test3 = m.intFieldGrp(
            'uiINFGRP_test3',
            numberOfFields=3,
            label='PMIntFieldGrp3'
        )
        self.uiINFGRP_test4 = m.intFieldGrp(
            'uiINFGRP_test4',
            numberOfFields=4,
            label='PMIntFieldGrp4'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntScrollBars = self.uiCreateFrame('uiLAY_frameIntScrollBars',
                                                           'Int Scroll Bars (PMIntScrollBar)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1')
        self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntSliders = self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1')
        self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntSliderGroups = self.uiCreateFrame('uiLAY_frameIntSliderGroups',
                                                             'Int Slider Groups (PMIntSliderGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiINSGRP_test1 = m.intSliderGrp(
            'uiINSGRP_test1',
            label='test1',
            field=True
        )
        self.uiINSGRP_test2 = m.intSliderGrp(
            'uiINSGRP_test2',
            label='test2',
            field=True
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameOptionMenus = self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=110, style='none')
        self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1')
        m.menuItem(label='one')
        m.menuItem(label='two')
        m.menuItem(label='three')
        self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2')
        m.menuItem(label='four')
        m.menuItem(label='five')
        m.menuItem(label='six')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame('uiLAY_frameOptionMenuGroups',
                                                              'Option Menus Groups (PMOptionMenuGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel')
        m.menuItem(label='one')
        m.menuItem(label='two')
        m.menuItem(label='three')
        self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel')
        m.menuItem(label='four')
        m.menuItem(label='five')
        m.menuItem(label='six')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameRadioButtons = self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=4)

        m.separator(style='none', width=140)
        m.radioCollection()
        self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1')
        self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2')
        self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame('uiLAY_frameRadioButtonGroups',
                                                               'Radio Button Groups (PMRadioButtonGrp#)')

        m.columnLayout()
        m.separator(style='none', height=2)
        self.uiRADGRP_test1 = m.radioButtonGrp(
            'uiRADGRP_test1',
            numberOfRadioButtons=1,
            label='PMRadioButtonGrp1',
            label1='test1'
        )
        self.uiRADGRP_test2 = m.radioButtonGrp(
            'uiRADGRP_test2',
            numberOfRadioButtons=2,
            label='PMRadioButtonGrp2',
            labelArray2=('test1', 'test2')
        )
        self.uiRADGRP_test3 = m.radioButtonGrp(
            'uiRADGRP_test3',
            numberOfRadioButtons=3,
            label='PMRadioButtonGrp3',
            labelArray3=('test1', 'test2', 'test3')
        )
        self.uiRADGRP_test4 = m.radioButtonGrp(
            'uiRADGRP_test4',
            numberOfRadioButtons=4,
            label='PMRadioButtonGrp4',
            labelArray4=('test1', 'test2', 'test3', 'test4')
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes',
                                                              'Symbol Check Boxes (PMSymbolCheckBox)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSYMCHK_test1 = m.symbolCheckBox(
            'uiSYMCHK_test1',
            image='polyCube'
        )
        self.uiSYMCHK_test2 = m.symbolCheckBox(
            'uiSYMCHK_test2',
            image='polyCone'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameScriptTables = self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSCRTBL_test1 = m.scriptTable(
            'uiSCRTBL_test1',
            selectionMode=3,
            rows=4,
            columns=2
        )
        self.uiSCRTBL_test2 = m.scriptTable(
            'uiSCRTBL_test2',
            selectionMode=3,
            rows=4,
            columns=2
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameScrollField = self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSCRFLD_test1 = m.scrollField(
            'uiSCRFLD_test1',
            wordWrap=True
        )
        self.uiSCRFLD_test2 = m.scrollField(
            'uiSCRFLD_test2',
            wordWrap=True
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameShelfTabLayout = self.uiCreateFrame('uiLAY_frameShelfTabLayout',
                                                            'Shelf Tab Layout (PMShelfTabLayout)')

        m.columnLayout(adjustableColumn=True)

        self.uiSHLTAB_test1 = m.shelfTabLayout()

        m.shelfLayout('test1')
        m.setParent('..')
        m.shelfLayout('test2')
        m.setParent('..')
        m.shelfLayout('test3')
        m.setParent('..')

        m.setParent('..')

        self.uiSHLTAB_test2 = m.shelfTabLayout()

        m.shelfLayout('test4')
        m.setParent('..')
        m.shelfLayout('test5')
        m.setParent('..')
        m.shelfLayout('test6')
        m.setParent('..')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTabLayout = self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)')

        m.columnLayout(adjustableColumn=True)

        self.uiTAB_test1 = m.tabLayout()

        uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')

        m.setParent('..')

        m.tabLayout(
            self.uiTAB_test1,
            edit=True,
            tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),)
        )

        self.uiTAB_test2 = m.tabLayout()

        uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')

        m.setParent('..')

        m.tabLayout(
            self.uiTAB_test2,
            edit=True,
            tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),)
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFields = self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiTXT_test1 = m.textField('uiTXT_test1')
        self.uiTXT_test2 = m.textField('uiTXT_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups',
                                                                   'Text Field Button Groups (PMTextFieldButtonGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiTXBTGR_test1 = m.textFieldButtonGrp(
            'uiTXBTGR_test1',
            label='test1',
            buttonLabel='button1'
        )
        self.uiTXBTGR_test2 = m.textFieldButtonGrp(
            'uiTXBTGR_test2',
            label='test2',
            buttonLabel='button2'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFieldGroups = self.uiCreateFrame('uiLAY_frameTextFieldGroups',
                                                             'Text Field Groups (PMTextFieldGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiTXTGRP_test1 = m.textFieldGrp(
            'uiTXTGRP_test1',
            label='test1'
        )
        self.uiTXTGRP_test2 = m.textFieldGrp(
            'uiTXTGRP_test2',
            label='test2'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextScrollLists = self.uiCreateFrame('uiLAY_frameTextScrollLists',
                                                             'Text Scroll Lists (PMTextScrollList)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiTXTLST_test1 = m.textScrollList(
            'uiTXTLST_test1',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )
        self.uiTXTLST_test2 = m.textScrollList(
            'uiTXTLST_test2',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )

        # --------
        m.setParent(uiLAY_mainForm)

        self.uiBTN_savePrefs = m.button(
            label='Save Prefs',
            height=MAIN_BUTTONS_HEIGHT,
            command=self.onSavePrefsClicked
        )

        self.uiBTN_loadPrefs = m.button(
            label='Load Prefs',
            height=MAIN_BUTTONS_HEIGHT,
            command=self.onLoadPrefsClicked
        )

        self.uiBTN_resetPrefs = m.button(
            label='Reset Prefs',
            height=MAIN_BUTTONS_HEIGHT,
            command=self.onResetPrefsClicked
        )

        m.setParent('..')  # -> window

        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'top', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'left', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'right', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachControl=[(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)])

        m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_savePrefs, 'top')])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'left', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)])

        m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_loadPrefs, 'top')])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)])

        m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_resetPrefs, 'top')])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'right', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)])

        m.showWindow(self.window)
Esempio n. 56
0
 def setCreateBtnIcon(self):
     """"""
     if cmds.iconTextCheckBox(self.jointCheck, q=1, v=1):
         cmds.iconTextButton(self.createBtn, e=1, i=setup.getBannerJ())
     else:
         cmds.iconTextButton(self.createBtn, e=1, i=setup.getBanner())
	def isAutoRefresh(self):
		return cmds.iconTextCheckBox(self.autoRefreshCkbx, q = 1, value = 1)