예제 #1
0
    def _dropCb(self, dragControl, dropControl, messages, x, y, dragType):
        # Create attribute UI.  We are expecting a node.plug string as the
        # first element of the messages list.
        if not messages or not isinstance(messages[0], basestring):
            return

        attr = messages[0]
        try:
            if not self.item().acceptsDrops(attr):
                cmds.warning(kIncompatibleAttribute % attr)
                return
        except (RuntimeError, TypeError):
            # RuntimeError occurs if 'attr' is not found.
            # TypeError occurs if 'attr' cannot be read as a plug.
            raise RuntimeError(kInvalidAttribute % attr)

        cmds.setParent(self._uiLayout)

        self._createAttributeUI(attr)

        isDropBoxVisible = self._isDropBoxVisible()

        cmds.iconTextStaticLabel(self._dropBox,
                                 edit=True,
                                 visible=isDropBoxVisible)
예제 #2
0
    def createPreviewLayout(self):

        print("ML Log: createPreviewLayout")
        # Create tab layout.
        tabLayout = cmds.tabLayout(borderStyle="full")

        # Add horizontal and vertical flow layouts and
        # spacers to center the image in the preview area.
        flowLayout = cmds.flowLayout("RPRPreviewArea")
        cmds.canvas("RPRHSpacer", width=1, height=1)

        cmds.flowLayout("RPRPreviewFlow", vertical=True)
        cmds.canvas("RPRVSpacer", width=1, height=1)

        cmds.iconTextStaticLabel("RPRPreviewImage",
                                 style='iconOnly',
                                 width=1,
                                 height=1)
        cmds.setParent('..')

        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        # Assign the top flow layout to the tab.
        cmds.tabLayout(tabLayout,
                       edit=True,
                       tabLabel=((flowLayout, 'Preview')))
def cacheFileUsdHierarchyOptions(topForm):
    '''Create controls to insert Maya reference USD cache into USD hierarchy.'''

    cmds.setParent(topForm)
    cmds.frameLayout(label=getMayaUsdLibString("kCacheMayaRefUsdHierarchy"))
    widgetColumn = cmds.columnLayout()

    rl = mel.eval('createRowLayoutforMayaReference("' + widgetColumn +
                  '", "cacheFilePreviewRow", 2)')
    with mayaRefUtils.SetParentContext(rl):
        cmds.iconTextStaticLabel(st="iconAndTextHorizontal",
                                 i1="info.png",
                                 l=getMayaUsdLibString('kCacheFileWillAppear'))
        cmds.textField(text=str(_pulledMayaRefPrim.GetParent().GetPath()),
                       editable=False)

    with mayaRefUtils.SetParentContext(cmds.rowLayout(numberOfColumns=2)):
        cmds.optionMenuGrp(
            'compositionArcTypeMenu',
            label=getMayaUsdLibString('kOptionAsCompositionArc'),
            cc=compositionArcChanged)
        cmds.menuItem(label=getMayaUsdLibString('kMenuPayload'))
        cmds.menuItem(label=getMayaUsdLibString('kMenuReference'))
        cmds.optionMenu('listEditedAsMenu',
                        label=getMayaUsdLibString('kOptionListEditedAs'),
                        cc=listEditChanged)
        cmds.menuItem(label=getMayaUsdLibString('kMenuAppend'))
        cmds.menuItem(label=getMayaUsdLibString('kMenuPrepend'))

    variantRb = cmds.radioButtonGrp('variantRadioBtn',
                                    nrb=1,
                                    label=getMayaUsdLibString('kTextDefineIn'),
                                    l1=getMayaUsdLibString('kTextVariant'))

    rl = mel.eval('createRowLayoutforMayaReference("' + widgetColumn +
                  '", "usdCacheVariantSetRow", 3)')
    with mayaRefUtils.SetParentContext(rl):
        cmds.text(label=getMayaUsdLibString('kMayaRefVariantSetName'))
        cmds.optionMenu('variantSetMenu', cc=variantSetNameChanged)
        cmds.textField(visible=False)

    rl = mel.eval('createRowLayoutforMayaReference("' + widgetColumn +
                  '", "usdCacheVariantNameRow", 3)')
    with mayaRefUtils.SetParentContext(rl):
        cmds.text(label=getMayaUsdLibString('kMayaRefVariantName'))
        cmds.optionMenu('variantNameMenu', cc=variantNameChanged)
        cmds.textField('variantNameText', cc=variantNameTextChanged)

    newChildRb = cmds.radioButtonGrp(
        'newChildPrimRadioBtn',
        nrb=1,
        label='',
        scl=variantRb,
        l1=getMayaUsdLibString('kButtonNewChildPrim'))

    cmds.textFieldGrp('primNameText',
                      label=getMayaUsdLibString('kMayaRefPrimName'),
                      cc=primNameTextChanged)

    cmds.radioButtonGrp(variantRb, edit=True, select=1)
예제 #4
0
    def build(self):
        self.window = cmds.window(title="Matcaps for Maya",
                                  iconName='Short Name',
                                  widthHeight=(505, 315),
                                  tlb=True,
                                  sizeable=False,
                                  bgc=(0.3, 0.3, 0.3))

        cmds.columnLayout(adjustableColumn=True)
        cmds.iconTextStaticLabel(st='textOnly', l='MATCAPS FOR MAYA', h=30)
        cmds.separator(h=10)
        cmds.rowColumnLayout(nc=3)
        cmds.iconTextStaticLabel(st='textOnly', l='Path', w=50)
        self.inputpath = cmds.textField(w=350, bgc=(0.5, 0.5, 0.5))
        cmds.button("Fetch Matcaps", w=100, c=lambda x: self.fetch_files())
        cmds.setParent("..")
        cmds.separator(h=10)
        cmds.rowColumnLayout(nc=2)

        self.matcap_textScrollList = cmds.textScrollList(
            w=300, sc=lambda: self.change_preview())
        self.matcap_iconTextButton = cmds.iconTextButton(style='iconOnly',
                                                         image1=None,
                                                         w=200,
                                                         h=200)
        cmds.setParent('..')
        cmds.separator(h=10)
        cmds.button("Assign Shader", w=250, c=lambda x: self.shader.assign())
예제 #5
0
 def updatePreview(self):
     selected = True
     if self.currentResource is None:
         self.currentResource = "commandButton.png"
         selected = False
     
     cmds.iconTextStaticLabel(self.wItemImage, edit=True,
                              image=self.currentResource, enable=selected)
예제 #6
0
 def previewMode(s):
     s.live = False
     cmds.layout(s.camLayout, e=True, m=False)
     cmds.layout(s.previewLayout, e=True, m=True)
     cmds.iconTextButton(s.thumb, e=True, l=s.i18n["recaptureBtn"])
     cmds.iconTextStaticLabel(s.preview,
                              e=True,
                              image=s.previewImage.name
                              if s.previewImage else "out_snapshot.png")
예제 #7
0
 def addAnim(item):
     row = cmds.rowLayout(
         nc=6,
         adj=2,
         p=listElement)
     cmds.iconTextStaticLabel(
         st="iconOnly",
         i="animCurveTA.svg",
         h=iconSize,
         w=iconSize
     )
     cmds.text(
         l="%s - %s : %s" % (
             item.data["range"][0],
             item.data["range"][1],
             textLimit(item.data["name"])
             ),
         al="left",
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="render.png",
         ann="Export Animation",
         h=iconSize,
         w=iconSize,
         c=lambda: s.performExport(item)
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="traxFrameRange.png",
         ann="Go to frame range %s - %s and set animaton layers." % (
             item.data["range"][0],
             item.data["range"][1]
         ),
         h=iconSize,
         w=iconSize,
         c=lambda: s.setAnimation(item)
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="setEdEditMode.png",
         ann="Edit Animation",
         h=iconSize,
         w=iconSize,
         c=lambda: s.editAnimation(listElement, item)
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="removeRenderable.png",
         ann="Remove this animation.",
         h=iconSize,
         w=iconSize,
         c=lambda: s.removeAnimation(row, item)
     )
     s.displayAnim[item] = row
예제 #8
0
def gui():
    if (cmds.window('dk_pipe_gui_001', ex=True)):
        cmds.deleteUI('dk_pipe_gui_001')
    # This clears any window preferences on our GUI
    if (cmds.windowPref('dk_pipe_gui_001', ex=True)):
        cmds.windowPref('dk_pipe_gui_001', r=True)

    cmds.window('dk_pipe_gui_001', t="Build Pipes")
    cmds.columnLayout('MAIN')
    cmds.rowColumnLayout(nc=2)

    cmds.iconTextStaticLabel(st='textOnly', l='No. Pipes')
    cmds.intField('n_pipes_int', w=150, min=1, max=20, v=8)

    cmds.iconTextStaticLabel(st='textOnly', l='Min Pipe Size')
    cmds.floatSlider('min_pipe_size_int', min=1, max=4, value=1, step=1)

    cmds.iconTextStaticLabel(st='textOnly', l='Max Pipe Size')
    cmds.floatSlider('max_pipe_size_int', min=1, max=4, value=1, step=1)

    cmds.iconTextStaticLabel(st='textOnly', l='Art Radius')
    cmds.intField('main_radius_int', value=3)

    cmds.button(w=150, l='Create Pipes', c=handle_input)

    cmds.setParent('MAIN')
    cmds.columnLayout('SECOND')
    cmds.button(w=300, l='Delete History (All)', c=handle_delete_button)

    cmds.showWindow('dk_pipe_gui_001')
예제 #9
0
    def updatePreview(self):
        'Select a new icon'
        self.info('updatePreview()')

        self.currentResource = self.currentResourceName()
        imageName = self.currentResource
        selected = True
        if imageName is None:
            imageName = "commandButton.png"
            selected = False

        cmds.iconTextStaticLabel(self.wItemImage,
                                 edit=True,
                                 image=imageName,
                                 enable=selected)
    def createInfoLayout(self):

        # Create tab and form layouts.
        tabLayout = cmds.tabLayout(innerMarginWidth=8,
                                   innerMarginHeight=8,
                                   borderStyle="full")
        formLayout = cmds.formLayout(numberOfDivisions=100)
        importButton = cmds.button(label="Import",
                                   command=self.importSelectedMaterial)
        importImagesCheck = cmds.checkBox(
            "RPRImportImagesCheck",
            label="Import images to project",
            value=self.importImagesEnabled(),
            changeCommand=self.importImagesChanged)

        # Add the RPR logo.
        logoBackground = cmds.canvas("RPRLogoBackground", rgbValue=[0, 0, 0])
        logo = cmds.iconTextStaticLabel("RPRLogo",
                                        style='iconOnly',
                                        image="RadeonProRenderLogo.png",
                                        width=1,
                                        height=1)

        # Add material info text.
        columnLayout = cmds.columnLayout(rowSpacing=5)

        cmds.text(label="Category:", font="boldLabelFont")
        cmds.text("RPRCategoryText", recomputeSize=False)
        cmds.canvas(height=10)
        cmds.text(label="Name:", font="boldLabelFont")
        cmds.text("RPRNameText", recomputeSize=False)
        cmds.canvas(height=10)
        cmds.text(label="File name:", font="boldLabelFont")
        cmds.text("RPRFileNameText", recomputeSize=False)
        cmds.canvas(height=10)

        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        # Assign the form to the tab.
        cmds.tabLayout(tabLayout, edit=True, tabLabel=((formLayout, 'Info')))

        # Lay out components within the form.
        cmds.formLayout(formLayout,
                        edit=True,
                        attachControl=[(columnLayout, 'top', 10, logo),
                                       (importImagesCheck, 'bottom', 10,
                                        importButton)],
                        attachForm=[(logo, 'left', 8), (logo, 'right', 8),
                                    (logo, 'top', 8),
                                    (logoBackground, 'left', 8),
                                    (logoBackground, 'right', 8),
                                    (logoBackground, 'top', 8),
                                    (importButton, 'left', 10),
                                    (importButton, 'bottom', 10),
                                    (importButton, 'right', 10),
                                    (columnLayout, 'left', 10),
                                    (columnLayout, 'right', 10),
                                    (importImagesCheck, 'left', 10)])
예제 #11
0
    def postSelector(self):
        cmds.setParent(self._layoutName)

        form = cmds.formLayout(numberOfDivisions=100)

        buttonWidth = 50

        # Buttons to select and to view the selector output.
        selectAllBtn = cmds.button(label=kSelectAll,
                                   width=buttonWidth,
                                   annotation=kSelectAllTooltip,
                                   command=partial(Collection._selectAllCb,
                                                   self))

        viewAllBtn = cmds.button(label=kViewAll,
                                 width=buttonWidth,
                                 annotation=kViewAllTooltip,
                                 command=partial(Collection._viewAllCb, self))

        separator = cmds.separator()

        self._menu = cmds.optionMenu(label=kAddOverride,
                                     width=200,
                                     annotation=kAddOverrideTooltipStr,
                                     changeCommand=partial(
                                         Collection._menuCb, self))
        cmds.menuItem(label=renderSetup.CollectionProxy.NO_OVERRIDE)
        cmds.menuItem(label=renderSetup.CollectionProxy.ABSOLUTE_OVERRIDE)
        cmds.menuItem(label=renderSetup.CollectionProxy.RELATIVE_OVERRIDE)
        cmds.optionMenu(self._menu,
                        edit=True,
                        value=self.item()._getValueOverrideMode())

        self._dropBox = cmds.iconTextStaticLabel(
            style='iconAndTextVertical',
            i1='RS_drop_box.png',
            label=kDragAttributesFromAE,
            dropCallback=partial(Collection._dropCb, self),
            visible=self._isDropBoxVisible())

        cmds.formLayout(form,
                        edit=True,
                        attachForm=[(selectAllBtn, 'top', 0),
                                    (selectAllBtn,
                                     'right', hSpc + buttonWidth),
                                    (viewAllBtn, 'top', 0),
                                    (separator, 'left', hSpc),
                                    (separator, 'right', hSpc),
                                    (self._menu, 'left', hSpc),
                                    (self._dropBox, 'left', hSpc),
                                    (self._dropBox, 'right', hSpc)],
                        attachControl=[
                            (viewAllBtn, 'right', hSpc, selectAllBtn),
                            (separator, 'top', vSpc, selectAllBtn),
                            (self._menu, 'top', vSpc, separator),
                            (self._dropBox, 'top', vSpc, self._menu)
                        ])

        cmds.setParent('..')
예제 #12
0
    def _dropBoxInit(self):
        self._createAttributeUI(None)

        self._dropBox = cmds.iconTextStaticLabel(
            style='iconAndTextVertical',
            i1='RS_drop_box.png',
            label=kDragAttributeFromAE,
            dropCallback=partial(Override._dropCb, self),
            visible=self._isDropBoxVisible())
    def selectMaterial(self, material):

        fileName = material["fileName"]
        imageFileName = self.libraryPath + "/" + fileName + "/" + fileName + ".jpg"

        cmds.iconTextStaticLabel("RPRPreviewImage",
                                 edit=True,
                                 image=imageFileName)
        cmds.text("RPRCategoryText",
                  edit=True,
                  label=material["category"]["name"])
        cmds.text("RPRNameText", edit=True, label=material["name"])
        cmds.text("RPRFileNameText",
                  edit=True,
                  label=material["fileName"] + ".xml")

        self.selectedMaterial = material
        self.updatePreviewLayout()
예제 #14
0
 def addRow(item):
     real = absolutePath(item)
     exists = os.path.isdir(real)
     if exists:
         icon = "navButtonBrowse.png"
     else:
         icon = "vacantCell.png"
     row = cmds.rowLayout(
         nc=4,
         adj=2,
         h=30,
         bgc=(0.2,0.2,0.2) if exists else (1,0.4,0.4),
         p=listElement)
     cmds.iconTextStaticLabel(
         st="iconOnly",
         i=icon,
         h=iconSize,
         w=iconSize
     )
     cmds.text(
         l=textLimit(item),
         al="left",
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="traxOpenLibrary.png",
         ann="Open the folder.",
         en=exists,
         h=iconSize,
         w=iconSize,
         c=lambda: webbrowser.open(real) if os.path.isdir(real) else None
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="removeRenderable.png",
         ann="Remove this folder from the export list.",
         h=iconSize,
         w=iconSize,
         c=lambda: s.removeExportFolder(row, item)
     )
예제 #15
0
 def addSel(item):
     exists = cmds.objExists(item)
     row = cmds.rowLayout(
         nc=4,
         adj=2,
         bgc=(0.2,0.2,0.2) if exists else (1,0.4,0.4),
         p=listElement)
     if exists and cmds.objectType(item) == "joint":
         icon = "joint.svg"
     elif exists:
         icon = "cube.png"
     else:
         icon = "vacantCell.png"
     cmds.iconTextStaticLabel(
         st="iconOnly",
         i=icon,
         h=iconSize,
         w=iconSize,
     )
     cmds.text(
         l=textLimit(item),
         al="left",
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="aselect.png",
         ann="Select the object in the scene.",
         en=exists,
         h=iconSize,
         w=iconSize,
         c=lambda: cmds.select(item, r=True) if cmds.objExists(item) else None
     )
     cmds.iconTextButton(
         st="iconOnly",
         i="removeRenderable.png",
         ann="Remove this object from the export selection.",
         h=iconSize,
         w=iconSize,
         c=lambda: s.removeExportSelection(row, item)
     )
예제 #16
0
    def updatePreviewLayout(self):

        print("ML Log: updatePreviewLayout")
        # Determine the size of the preview area.
        width = cmds.flowLayout("RPRPreviewArea", query=True, width=True)
        height = cmds.flowLayout("RPRPreviewArea", query=True, height=True)

        # Choose the smallest dimension and shrink
        # slightly so the enclosing layouts can shrink.
        size = min(width, height) - 10

        # Calculate the horizontal and vertical
        # offsets required to center the preview image.
        hOffset = max(0, (width - size) / 2.0)
        vOffset = max(0, (height - size) / 2.0)

        # Clamp the size to a minimum of 64.
        newWidth = max(64, width - 10)
        newHeight = max(64, height - 10)
        size = max(64, size)

        # Update the layout and image sizes.
        cmds.flowLayout("RPRPreviewFlow",
                        edit=True,
                        width=newWidth,
                        height=newHeight)
        cmds.iconTextStaticLabel("RPRPreviewImage",
                                 edit=True,
                                 width=size,
                                 height=size)
        cmds.canvas("RPRHSpacer", edit=True, width=hOffset, height=1)
        cmds.canvas("RPRVSpacer", edit=True, width=1, height=vOffset)

        # Update the RPR logo size.
        logoWidth = cmds.iconTextStaticLabel("RPRLogo", query=True, width=True)
        logoHeight = max(min(logoWidth * 0.16, 60), 1)
        cmds.iconTextStaticLabel("RPRLogo", edit=True, height=logoHeight)
        cmds.canvas("RPRLogoBackground", edit=True, height=logoHeight)
예제 #17
0
 def addTarget(item):
     def sendtarget():
         try:
             name = s.requestTarget(item)
             if name:
                 cmds.button(btn, e=True, l=name)
         except RuntimeError as e:
             cmds.confirmDialog(t="uh oh...", m=str(e))
     height = 30
     cmds.text(l=item, p=s.old, h=height)
     cmds.iconTextStaticLabel(
         style="iconOnly",
         image="hsDownStreamCon.png",
         p=s.sep,
         h=height
         )
     btn = cmds.button(
         l=item,
         p=s.new,
         h=height,
         c=lambda x: sendtarget()
         )
     pass
예제 #18
0
    def populateUI(self):
        "Create the resource browser window UI"

        # Get the dialog's formLayout.
        #
        form = cmds.setParent(q=True)

        self.wItemImage = cmds.iconTextStaticLabel(image="commandButton.png")
        self.wFilter = cmds.textFieldGrp(
            label=maya.stringTable['y_resourceBrowser.kFilter'],
            columnAttach=[(1, "right", 5), (2, "both", 0)],
            columnWidth=(1, 75),
            text='',
            changeCommand=self.updateFilter)
        self.wList = cmds.textScrollList(numberOfRows=11,
                                         allowMultiSelection=False,
                                         selectCommand=self.updatePreview)
        b1 = cmds.button(label=maya.stringTable['y_resourceBrowser.kSelect'],
                         command=partial(self.buttonCallback,
                                         dismissMsg="valid"))
        b2 = cmds.button(
            label=maya.stringTable['y_resourceBrowser.kSaveCopy'],
            annotation=maya.stringTable['y_resourceBrowser.kSaveCopyAnn'],
            command=self.saveCopy)
        b3 = cmds.button(label=maya.stringTable['y_resourceBrowser.kCancel'],
                         command=self.buttonCallback)

        cmds.formLayout(form,
                        edit=True,
                        attachForm=[(self.wItemImage, 'top', 6),
                                    (self.wItemImage, 'left', 6),
                                    (self.wItemImage, 'right', 6),
                                    (self.wFilter, 'left', 6),
                                    (self.wFilter, 'right', 6),
                                    (self.wList, 'left', 6),
                                    (self.wList, 'right', 6), (b1, 'left', 6),
                                    (b1, 'bottom', 6), (b2, 'bottom', 6),
                                    (b3, 'right', 6), (b3, 'bottom', 6)],
                        attachPosition=[(b1, 'right', 3, 33),
                                        (b2, 'right', 3, 66)],
                        attachControl=[
                            (self.wFilter, 'top', 6, self.wItemImage),
                            (self.wList, 'top', 6, self.wFilter),
                            (self.wList, 'bottom', 6, b1), (b2, 'left', 6, b1),
                            (b3, 'left', 6, b2)
                        ])

        self.updateFilter('')
	def renderAllLights(self, renderLights=[],useGroups=False):  
		lights = cmds.ls(dag=True,visible=True,lights=True, type='mentalrayIblShape')  
		#Check if there is any lights selected to only do those
		if renderLights == [] or renderLights == None:
			renderLights = cmds.ls( dag=True,  sl=True , lights=True, type='mentalrayIblShape')
		#if there isn't any light selected just get all the lights
		if renderLights == []:
			renderLights = lights

		lightNames = ""
		for light in renderLights:
			lightNames = lightNames + light + '\n' 
				

		windowName = 'ProgressWindow'
		if cmds.window(windowName, exists=True):
			cmds.deleteUI(windowName)
			
		window = cmds.window(windowName,t="Progress Report")
		
		cmds.columnLayout()
		cmds.iconTextStaticLabel( st='textOnly', l='Rendering Lights:' )
		cmds.iconTextStaticLabel( st='textOnly', l=lightNames )
		cmds.iconTextStaticLabel( st='textOnly', l='Process Bar' )
		progressControl = cmds.progressBar(maxValue=len(renderLights), width=300)
		cmds.showWindow( window )    
		
		lights = self.sortLightsByType(lights)
		#-Revised--hide ibl node that is at the end of lights list (sorted previously)
		if cmds.objectType( lights[-1], isType='mentalrayIblShape' ) == True:
			cmds.setAttr('%s.visibleInFinalGather' % lights[-1], 0)
			cmds.setAttr('%s.visibleInEnvironment' % lights[-1], 0)
				
		cmds.hide(lights)
		lightCount = 0

		if useGroups==True:
			renderLightsGroups = self.groupLightsByName(renderLights)
			cmds.progressBar(progressControl,edit=True, maxValue=len(renderLightsGroups.keys()), width=300)
			for group in renderLightsGroups:
				self.renderOnlyThisLight(renderLightsGroups[group]) 
				progressInc = cmds.progressBar(progressControl, edit=True, pr=lightCount+1) 
				lightCount+=1
		else:
			print renderLights
			for light in renderLights:
				self.renderOnlyThisLight(light) 
				progressInc = cmds.progressBar(progressControl, edit=True, pr=lightCount+1) 
				lightCount+=1
					
		cmds.showHidden(lights)  
		#-Revised--since we sorted the lights by type we know that the lastone will be the IBL
		if cmds.objectType( lights[-1], isType='mentalrayIblShape' ) == True:
			cmds.setAttr('%s.visibleInFinalGather' % lights[-1], 1)
			cmds.setAttr('%s.visibleInEnvironment' % lights[-1], 1)
예제 #20
0
 def _buildSelection(s):
     """
     Create Selection UI (main menu)
     """
     s._clearFrame()
     s.GUI["layout1"] = cmds.columnLayout(adjustableColumn=True, w=s.width)
     s.GUI["text1"] = cmds.text(label="Features for %s." % s.title)
     cmds.separator()
     s.GUI["layout2"] = cmds.rowColumnLayout(nc=2)
     s.GUI["layout3"] = cmds.columnLayout(adjustableColumn=True)
     s.GUI["image1"] = cmds.iconTextStaticLabel(image="choice.svg", h=130, w=130)
     cmds.setParent("..")
     s.GUI["layout4"] = cmds.columnLayout(adjustableColumn=True)
     s.GUI["text2"] = cmds.text(label="What would you like to do?", h=50)
     s.GUI["button1"] = cmds.iconTextButton(label="Install Script", h=40, image="cluster.png", st="iconAndTextHorizontal", c=call(s._buildInstall))
     s.GUI["button2"] = cmds.iconTextButton(label="Remove Script", h=40, image="deleteActive.png", st="iconAndTextHorizontal", c=call(s._buildRemove))
     cmds.setParent("..")
     cmds.setParent("..")
     cmds.setParent(s.GUI["wrapper"])
예제 #21
0
    def populateUI(self):
        "Create the resource browser window UI"

        # Get the dialog's formLayout.
        form = cmds.setParent(q=True)

        col = cmds.columnLayout(adj=True)
        self.wFilter = cmds.textFieldGrp(label=stringTable['y_resourceBrowser.kFilter'],
                                         columnAttach=[(1, "right", 5), (2, "both", 0)],
                                         columnWidth=(1, 75),
                                         adjustableColumn=2,
                                         text='',
                                         textChangedCommand=self.updateFilter)
        self.checkRow = cmds.rowLayout(nc=5)
        cmds.checkBox(label='x', cc=self._switchList)
        cmds.checkBox(label='only icon format (32px)')
        cmds.checkBox(label='png')
        cmds.checkBox(label='svg')
        cmds.checkBox(label='match case')
        cmds.setParent('..')
        self.wList = cmds.textScrollList(numberOfRows=11, visible=False,
                                         allowMultiSelection=False,
                                         selectCommand=self.setCurrent_textList)
        
        self.iFrame = cmds.frameLayout(labelVisible=False, marginHeight=6, marginWidth=6)
        cmds.rowLayout(nc=2, rowAttach=[2, 'both', -2], adjustableColumn=1)
        self.iList = cmds.rowColumnLayout(numberOfColumns=self.numIconCol)
        for _i in range(100):
            sb = cmds.symbolButton(h=32, w=32)
            self.symbolButtons.append(sb)
        cmds.setParent('..')
        upDownForm = cmds.formLayout(w=40)
        bUp = cmds.button(label='^', w=40, h=35, c=partial(self._upDownOffset, -40))
        bDn = cmds.button(label='v', w=40, h=35, c=partial(self._upDownOffset, 40))
        cmds.setParent('..')
        cmds.formLayout(upDownForm, edit=True,
                        attachForm=[(bUp, 'top', 1),
                                    (bDn, 'bottom', 1)])
        cmds.setParent('..')
        cmds.setParent('..')
        
        self.wItemImage = cmds.iconTextStaticLabel(image="commandButton.png")
        cmds.setParent('..')
        
        b1 = cmds.button(label=stringTable['y_resourceBrowser.kSelect'],
                         command=partial(self.buttonCallback, dismissMsg="valid"))
        b2 = cmds.button(label=stringTable['y_resourceBrowser.kSaveCopy'],
                         annotation=stringTable['y_resourceBrowser.kSaveCopyAnn'],
                         command=self.saveCopy)
        b3 = cmds.button(label=stringTable['y_resourceBrowser.kCancel'],
                         command=self.buttonCallback)

        cmds.formLayout(form, edit=True,
                        attachForm=[(col, 'top', 6),
                                    (col, 'left', 6),
                                    (col, 'right', 6),

                                    (b1, 'left', 6),
                                    (b1, 'bottom', 6),
                                    (b2, 'bottom', 6),
                                    (b3, 'right', 6),
                                    (b3, 'bottom', 6)],

                        attachPosition=[(b1, 'right', 3, 33),
                                        (b2, 'right', 3, 66)],
                        
                        attachControl=[(b2, 'left', 6, b1),
                                       (b3, 'left', 6, b2)]
                        )

        self.updateFilter('')
 def previewMode(s):
     s.live = False
     cmds.layout(s.camLayout, e=True, m=False)
     cmds.layout(s.previewLayout, e=True, m=True)
     cmds.iconTextButton(s.thumb, e=True, l=s.i18n["recaptureBtn"])
     cmds.iconTextStaticLabel(s.preview, e=True, image=s.previewImage.name if s.previewImage else "out_snapshot.png")
예제 #23
0
파일: kTool.py 프로젝트: 3d-kmax/kTools
    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)
예제 #24
0
def fix_empty_shelves(userprefs_file=None):
    confirm = cmds.confirmDialog(
        title='Fix empty shelves',
        message=
        'This tool will find duplicate shelf entries in userPrefs.mel.\n\n'
        'Maya needs to be closed at the end for the tool to work.\n\n'
        'Please save all work before continuing.',
        button=['Continue', 'Cancel'],
        cancelButton='Cancel',
        dismissString='Cancel')

    if confirm == 'Cancel':
        return

    # if no path is supplied, try to find the default
    if userprefs_file is None:
        prefs_dir = cmds.about(preferences=True)
        userprefs_file = prefs_dir + '/prefs/userPrefs.mel'

    # convert path to platform path style
    userprefs_file = os.path.abspath(userprefs_file)

    if not os.path.isfile(userprefs_file):
        cmds.warning('Could not find userPrefs.mel at %s' % userprefs_file)
        return

    # backup userPrefs.mel
    backup_file = userprefs_file + strftime('.backup-%Y%m%d-%H%M%S', gmtime())
    shutil.copy2(userprefs_file, backup_file)

    # find duplicates
    try:
        with open(userprefs_file, 'r+') as f:
            shelves = []
            indices = []
            names = []

            data = mmap.mmap(f.fileno(), 0)
            matches = re.findall(b'-sv "shelfName([0-9]+)" "(.*?)"', data)
            data.close()

            for shelf in matches:
                if shelf[1] not in shelves:
                    shelves.append(shelf[1])
                else:
                    names.append(shelf[1])
                    indices.append(shelf[0])

            f.seek(0, 0)
            lines = f.readlines()
    except IOError as e:
        cmds.warning('Could not read from file %s (%s)' %
                     (userprefs_file, str(e)))
        return
    except Exception as e:
        cmds.warning(
            'An unknown error occured when trying to read from %s (%s)' %
            (userprefs_file, str(e)))
        return

    if not indices:
        cmds.confirmDialog(
            title='No duplicates found',
            message='No changed were done and you can safely close the tool.',
            button=['OK'],
            cancelButton='OK',
            dismissString='OK')
        os.remove(backup_file)
        return

    # remove duplicates
    log = ''
    count = 0
    try:
        with open(userprefs_file, 'w+') as f:
            for line in lines:
                for i in indices:
                    pattern = re.compile('-.. "shelf(.*?)%s" (".*?"|[0-9+])' %
                                         i)
                    new_line = re.sub(pattern, '', line)
                    if line != new_line:
                        log = log + str(line)
                        count = count + 1
                        line = new_line
                        break

                f.writelines(line)
    except IOError as e:
        cmds.warning('IOError: Could not write to file %s (%s)' %
                     (userprefs_file, str(e)))
        return
    except Exception as e:
        cmds.warning(
            'An unknown error occured when trying to write to %s (%s)' %
            (userprefs_file, str(e)))
        return

    log = 'Removed %s lines with %s duplicate shelves in file "%s":\n\n%s' % (
        count, len(indices), userprefs_file, log)

    # fes_quit(log, len(indices))
    win = cmds.window(title='Fix Empty Shelves',
                      rtf=True,
                      widthHeight=(300, 100))
    form = cmds.formLayout(nd=100)

    m = cmds.iconTextStaticLabel(
        st="iconAndTextHorizontal",
        i="info.xpm",
        align='center',
        fn='plainLabelFont',
        label='Removed %d shelf duplicates in userPrefs.mel.\n'
        'Please quit Maya to apply the changes.\n'
        'If you do not quit, the fixes may not be saved.' % len(indices))
    b1 = cmds.button('Quit Maya', command=lambda *args: fes_quit(win, True))
    b2 = cmds.button('View Log', command=lambda *args: fes_view_log(log))
    b3 = cmds.button('Cancel', command=lambda *args: fes_quit(win, False))

    cmds.formLayout(form,
                    e=True,
                    numberOfDivisions=100,
                    attachForm=[(m, 'top', 8), (m, 'left', 8), (m, 'right', 8),
                                (b1, 'left', 8), (b3, 'right', 8),
                                (b1, 'bottom', 8), (b2, 'bottom', 8),
                                (b3, 'bottom', 8)],
                    attachPosition=[(b1, 'right', 8, 34), (b3, 'left', 8, 66)],
                    attachControl=[(b2, 'left', 8, b1), (b2, 'right', 8, b3)])

    cmds.showWindow(win)
예제 #25
0
    def __init__(s, i18n, char, clip, previewImage, requestThumb,
                 requestCharData, requestClipCapture):
        s.i18n = i18n
        s.char = char
        s.clip = clip
        s.previewImage = previewImage  # Initial preview image
        s.requestThumb = requestThumb  # asking for new thumbnail
        s.requestCharData = requestCharData  # Grab the character data
        s.requestClipCapture = requestClipCapture  # Grab capture information
        s.thumbs = {}  # Captured thumbs
        s.winWidth = 500  # Window width

        # VALIDATE BEFORE DOING ANYTHING
        with warn:
            s.validateObjs()

        s.camName = "TempCam_%s" % int(time.time())
        s.createCam()

        # INIT DATA:
        clip.metadata["name"] = clip.metadata.get("name", "CLIP")
        clip.metadata["range"] = clip.metadata.get("range", [
            cmds.playbackOptions(q=True, min=True),
            cmds.playbackOptions(q=True, max=True)
        ])
        r = clip.metadata["range"]
        s.pose = True if r[0] == r[1] else False  # Is the range a single frame?
        s.range = r
        s.name = clip.metadata["name"]

        s.winName = "ClipNewWin"
        if cmds.window(s.winName, ex=True):
            cmds.deleteUI(s.winName)
        s.window = cmds.window(s.winName, rtf=True, t=s.i18n["title"])
        mainLayout = cmds.columnLayout()
        ## CAMERA CONTROLS
        s.live = False if s.previewImage else True  # Live cam?
        s.camLayout = cmds.paneLayout(h=s.winWidth, w=s.winWidth, p=mainLayout)
        viewer = cmds.modelPanel(
            menuBarVisible=False,
            camera=s.camera,
        )
        cmds.modelEditor(  # Tweak nice default visuals
            viewer,
            e=True,
            grid=False,
            da="smoothShaded",
            allObjects=False,
            nurbsSurfaces=True,
            polymeshes=True,
            subdivSurfaces=True,
            displayTextures=True)
        s.previewLayout = cmds.columnLayout(h=s.winWidth,
                                            w=s.winWidth,
                                            p=mainLayout,
                                            m=False)
        s.preview = cmds.iconTextStaticLabel(style="iconOnly",
                                             h=s.winWidth,
                                             w=s.winWidth,
                                             bgc=[0.2, 0.2, 0.2],
                                             image="out_snapshot.png")
        cmds.columnLayout(w=s.winWidth, p=mainLayout)
        cmds.separator()
        ## DATA CONTROLS
        cmds.rowLayout(nc=2, adj=1)
        cmds.columnLayout(adj=True)
        s.clipname = cmds.textFieldGrp(l=s.i18n["clipname"],
                                       text=clip.metadata["name"],
                                       h=30,
                                       tcc=s.nameChange)

        r = clip.metadata["range"]
        s.clippose = cmds.checkBoxGrp(l=s.i18n["clippose"],
                                      h=30,
                                      v1=r[0] == r[1],
                                      cc=s.poseChange)
        s.cliprange = cmds.intFieldGrp(
            l=s.i18n["cliprange"],
            nf=2,
            v1=r[0],
            v2=r[1],
            en=False
            if cmds.checkBoxGrp(s.clippose, q=True, v1=True) else True,
            h=30,
            cc=s.rangeChange)
        cmds.setParent("..")
        s.thumb = cmds.iconTextButton(l=s.i18n["captureBtn"],
                                      ann=s.i18n["thumbDesc"],
                                      style="iconAndTextVertical",
                                      h=90,
                                      w=90,
                                      bgc=[0.2, 0.2, 0.2],
                                      image="out_snapshot.png",
                                      c=s.captureThumb)
        cmds.columnLayout(w=s.winWidth, p=mainLayout)
        cmds.button(l="CAPTURE CLIP", h=40, w=s.winWidth)
        if s.live:
            s.captureMode()
        else:
            s.previewMode()
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.save], ro=True)
        cmds.scriptJob(e=["quitApplication", s.cleanup], ro=True)
예제 #26
0
파일: tabAbout.py 프로젝트: liudger/May9
 def installBanner(self):
     """"""
     cmds.frameLayout(lv=0, bv=0, cll=False)
     pic = cmds.iconTextStaticLabel(style='iconOnly',
                                    image=setup.getBanner())
     cmds.setParent("..")
예제 #27
0
 def _setDropBoxVisibility(self):
     cmds.iconTextStaticLabel(self._dropBox,
                              edit=True,
                              visible=self._isDropBoxVisible())
예제 #28
0
            hideChildren(mesh)


#hyperRender()

lights = []
meshes = []

typ = "png"
window = mc.window(title="Hyper Render Options",
                   iconName='Short Name',
                   widthHeight=(320, 700))

mc.columnLayout("HyperRender", adj=True, cal="left")

mc.iconTextStaticLabel(st='textOnly', l='Select all the lights to render')

mc.button("selectLightButton",
          label="Load Selected Lights",
          command="lights = loadlights()")

mc.iconTextStaticLabel(st='textOnly', l='Select all the meshes to render')

mc.button("selectMeshButton",
          label="Load Selected Meshes",
          command="meshes = loadmeshes()")

mc.intFieldGrp("Resolution",
               cw=[1, 50],
               ct3=["left", "left", "left"],
               numberOfFields=2,
예제 #29
0
 def installBanner(self):
     """"""
     cmds.frameLayout( lv=0, bv=0, cll=False)
     pic = cmds.iconTextStaticLabel( style='iconOnly', image=setup.getBanner())
     cmds.setParent( ".." )
예제 #30
0
CharRig = AutoRigMS("thisCharacter")
# CharRig.reloadScripts()
if mc.window("Jams Auto Rig", q=1, ex=True):
    mc.deleteUI("Jams Auto Rig")
# Import the Maya commands library
# Create a window using the cmds.window command
# give it a title, icon and dimensions
window = mc.window("Jams Auto Rig",
                   title="Jams Auto Rig",
                   iconName='Short Name',
                   widthHeight=(320, 100))
# As we add contents to the window, align them vertically
#mc.columnLayout( adjustableColumn=True )
mc.columnLayout("SpineIKColumn")
mc.iconTextStaticLabel(st='textOnly',
                       bgc=(0.1, 0.1, 0.1),
                       l='Select the root of the Spine')

siz = 0.5
IKSizeField = mc.floatFieldGrp(numberOfFields=1,
                               label='IK Control Scale',
                               value=(0.5, 0, 0, 0))
shapeType = ''
mc.optionMenu("Shape1Menu", label='Shape')
mc.menuItem(label='circle')
mc.menuItem(label='cube')
mc.menuItem(label='square')
mc.menuItem(label='gear')
mc.menuItem(label='pyramid')
mc.menuItem(label='Arrow')
mc.menuItem(label='Cross')
예제 #31
0
    fr = mc.textFieldButtonGrp("setFile", q=True, tx=True)
    return file


def importFile(fName):
    mc.file(fName, i=True)


window = mc.window(title="Anim Clip Macro",
                   iconName='Short Name',
                   widthHeight=(320, 700))

mc.columnLayout("ClipMacro", adj=True, cal="left")

fr = "c:/"
mc.iconTextStaticLabel(st='textOnly', l='choose Files')
mc.textFieldButtonGrp("setFile",
                      buttonLabel="Explore",
                      cl2=["left", "left"],
                      adj=True,
                      text=fr,
                      buttonCommand="fr=getFiles()")
mc.showWindow(window)

tb = mc.textFieldButtonGrp("tbg",
                           label='Label',
                           text='Text',
                           buttonLabel='Button',
                           p=window)
mc.textFieldButtonGrp("tbg", e=1, bc="test()")
예제 #32
0
 def __init__(s, wrapper, anims):
     s.wrapper = wrapper
     s.anims = anims
     s.img = cmds.iconTextStaticLabel(style="iconOnly")
     s.playing = False
     s.limit = threading.Semaphore(1)  # Limit calls while maya is busy
예제 #33
0
파일: kTool.py 프로젝트: 3d-kmax/kTools
 def setIconTool(self, toolType):
     mc.iconTextStaticLabel(self.lb_tool, edit=True, image=self.path + toolType + '.png')
예제 #34
0
 def __init__(s, wrapper, anims):
     s.wrapper = wrapper
     s.anims = anims
     s.img = cmds.iconTextStaticLabel(style="iconOnly")
     s.playing = False
     s.limit = threading.Semaphore(1) # Limit calls while maya is busy
def createControlPanel():
	window = m.window( title="Train Control Panel", iconName='trainsCP', widthHeight=(320,900))
	#window = m.window( title="Long Name", iconName='Short Name', widthHeight=(500, 550) )
	#m.columnLayout()
 	#initShelf = m.shelfLayout('Initialize', width=480)


#  	m.paneLayout(configuration="horizontal4")
#  	m.shelfLayout(width=400)
# 	sp()
#  	m.shelfLayout(width=400)
# #	m.setParent('..')
# 	sp()
#  	m.shelfLayout(width=400)
# 	sp()
#  	m.shelfLayout(width=400)
	m.scrollLayout()
	m.columnLayout()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Regular Pieces' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)

	#m.rowLayout(numberOfColumns=10)

	#global b1
	#b1 = 
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"shortCurveLeft\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="miniL"
	,image="woodTrainsleftCurve1.xpm"
	,image1="woodTrainsleftCurve1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"shortCurveLeft\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	#print b1
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"shortCurveRight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="miniR"
	,image="woodTrainsrightCurve1.xpm"
	,image1="woodTrainsrightCurve1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"shortCurveRight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveLeft\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="left"
	,image="woodTrainsleft1.xpm"
	,image1="woodTrainsleft1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumCurveLeft\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveRight\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="right"
	,image="woodTrainsright1.xpm"
	,image1="woodTrainsright1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumCurveRight\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton()
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"miniStraight\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="mini"
	,image="woodTrainsstraight1.xpm"
	,image1="woodTrainsstraight1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"miniStraight\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"shortStraight\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="short"
	,image="woodTrainsstraight1.xpm"
	,image1="woodTrainsstraight1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"shortStraight\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumStraight\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="med"
	,image="woodTrainsstraight1.xpm"
	,image1="woodTrainsstraight1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumStraight\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"longStraight\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="long"
	,image="woodTrainsstraight1.xpm"
	,image1="woodTrainsstraight1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"longStraight\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')

	sp()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Track Setup' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="import track\rreload(track)"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="init"
	,image="woodTrainsInit.xpm"
	,image1="woodTrainsInit.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nimport track\r\nreload(track)\r\nif not m.objExists(\"library\"):\r\n\tm.file(\"C:/myDocuments/maya/projects/woodTrains/scenes/woodTrainTrackLibrary.ma\",i=1)\r\n"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
		
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.analyzeTrack2()"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="link2"
	,image="woodTrainslinkTrack.xpm"
	,image1="woodTrainslinkTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.analyzeTrack2()"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	global dirTGL
	
	dirTGL = m.shelfButton()
	#print dirTGL
	m.shelfButton(dirTGL
	,e=1
	,enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track direction toggle"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="drTGL"
	,image="woodTrainsPegMale.xpm"
	,image1="woodTrainsPegMale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nnewVal = not m.getAttr(\"library.femaleToMaleDirection\")\rm.setAttr(\"library.femaleToMaleDirection\",newVal)\rif newVal:\r\tm.shelfButton(\""+dirTGL+"\", e=1,i=\"woodTrainsPegMale.xpm\")\relse:\r\tm.shelfButton(\""+dirTGL+"\", e=1,i=\"woodTrainsPegFemale.xpm\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.makeTestTrack()\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="TEST"
	,image="woodTrainscheckTest.xpm"
	,image1="woodTrainscheckTest.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.makeTestTrack()\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="m.move(0,6.1,0,r=1)\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="mvUP"
	,image="woodTrainsUpArrow.xpm"
	,image1="woodTrainsUpArrow.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="m.move(0,6.1,0,r=1)\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="m.move(0,-6.1,0,r=1)\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="mvDN"
	,image="woodTrainsDownArrow.xpm"
	,image1="woodTrainsDownArrow.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nm.move(0,-6.1,0,r=1)\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="import maya.cmds as m\r\nsel=m.ls(sl=1)\rtrack.attachTrack(sel[0],sel[1])"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="align"
	,image="woodTrains2pegAlign.xpm"
	,image1="woodTrains2pegAlign.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nsel=m.ls(sl=1)\rtrack.attachTrack(sel[0],sel[1])"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton()
	
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="import track\rreload(track)"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="camera"
	,image="woodTrainsrenderCamera.xpm"
	,image1="woodTrainsrenderCamera.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nimport track\r\nreload(track)\r\nif not m.objExists(\"renderCamera1\"):\r\n\tm.file(\"C:/myDocuments/maya/projects/woodTrains/scenes/renderCamera.ma\",i=1)\r\n"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
 	#m.setParent('..')
# 	m.setParent('..')

# 	m.shelfButton(
# 	enableCommandRepeat=1
# 	,enable=1
# 	,width=34
# 	,height=34
# 	,manage=1
# 	,visible=1
# 	,preventOverride=0
# 	,align="center"
# 	,label="Select Surface Toggle"
# 	,labelOffset=0
# 	,font="tinyBoldLabelFont"
# 	,imageOverlayLabel="mesh"
# 	,image="woodTrainspythonFamily.xpm"
# 	,image1="woodTrainspythonFamily.xpm"
# 	,style="iconOnly"
# 	,marginWidth=1
# 	,marginHeight=1
# 	,command="setObjectPickMask(\"Surface\" true;"
# 	,sourceType="mel"
# 	,actionIsSubstitute=0
# 	); 
# 
# 	m.shelfButton(
# 	enableCommandRepeat=1
# 	,enable=1
# 	,width=34
# 	,height=34
# 	,manage=1
# 	,visible=1
# 	,preventOverride=0
# 	,align="center"
# 	,label="Select Surface Toggle"
# 	,labelOffset=0
# 	,font="tinyBoldLabelFont"
# 	,imageOverlayLabel="pegs"
# 	,image="woodTrainsmelFamily.xpm"
# 	,image1="woodTrainsmelFamily.xpm"
# 	,style="iconOnly"
# 	,marginWidth=1
# 	,marginHeight=1
# 	,command="setObjectPickMask \"Other\" true;"
# 	,sourceType="mel"
# 	,actionIsSubstitute=0
# 	); 

	sp()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Train Setup' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="import maya.cmds as m\r\nif not m.objExists(\"trainGroup\"):\r\tm.file(\"C:/myDocuments/maya/p..."
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="train"
	,image="woodTrainsclassicFreightTrain.xpm"
	,image1="woodTrainsclassicFreightTrain.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nif not m.objExists(\"trainsGroup\"):\r\tm.file(\"C:/myDocuments/maya/projects/woodTrains/scenes/trainClassicFreight.ma\",i=1)"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	# Change this to bring trains in as a library, then copy-special "duplicate input graph" to activate them.
	
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.resetTrain()\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="reset"
	,image="woodTrainsresetTrainOnTrack.xpm"
	,image1="woodTrainsresetTrainOnTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.resetTrain()\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.resetTrain(forward=0)\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="teser"
	,image="woodTrainsresetTrainOnTrack.xpm"
	,image1="woodTrainsresetTrainOnTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.resetTrain(forward=0)\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
# 	m.shelfButton(
# 	enableCommandRepeat=1
# 	,enable=1
# 	,width=34
# 	,height=34
# 	,manage=1
# 	,visible=1
# 	,preventOverride=0
# 	,align="center"
# 	,label="track.moveTrainForward(\"trainGroup\")"
# 	,labelOffset=0
# 	,font="tinyBoldLabelFont"
# 	,imageOverlayLabel="drive"
# 	,image="woodTrainsdrive.xpm"
# 	,image1="woodTrainsdrive.xpm"
# 	,style="iconOnly"
# 	,marginWidth=1
# 	,marginHeight=1
# 	,command="track.moveTrainForward(\"trainGroup\")"
# 	,sourceType="python"
# 	,actionIsSubstitute=0
# 	); 
# 	#m.setParent('..')
# 	
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="reverse"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="reverse"
	,image="woodTrainstrainReverse.xpm"
	,image1="woodTrainstrainReverse.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.reverseTrain()"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.moveTrainForward(\"trainGroup\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="slow"
	,image="woodTrainsdriveSlow.xpm"
	,image1="woodTrainsdriveSlow.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nsel = m.ls(sl=1)\rif len(sel) > 0:\r\ttrack.setTrainSpeed(sel[0],speed=0.5,r=0)\relse:\r\ttrack.setTrainSpeed(speed=0.5,r=0)"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.moveTrainForward(\"trainGroup\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="med"
	,image="woodTrainsdriveMedium.xpm"
	,image1="woodTrainsdriveMedium.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nsel = m.ls(sl=1)\rif len(sel) > 0:\r\ttrack.setTrainSpeed(sel[0],speed=1.0,r=0)\relse:\r\ttrack.setTrainSpeed(speed=1.0,r=0)"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.moveTrainForward(\"trainGroup\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="fast"
	,image="woodTrainsdriveFast.xpm"
	,image1="woodTrainsdriveFast.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nsel = m.ls(sl=1)\rif len(sel) > 0:\r\ttrack.setTrainSpeed(sel[0],speed=2.0,r=0)\relse:\r\ttrack.setTrainSpeed(speed=2.0,r=0)"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.moveTrainForward(\"trainGroup\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="slower"
	,image="woodTrainsdriveSlower.xpm"
	,image1="woodTrainsdriveSlower.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nsel = m.ls(sl=1)\rif len(sel) > 0:\r\ttrack.setTrainSpeed(sel[0],speed=0.5,r=1)\relse:\r\ttrack.setTrainSpeed(speed=0.5,r=1)"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.moveTrainForward(\"trainGroup\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="faster"
	,image="woodTrainsdriveFaster.xpm"
	,image1="woodTrainsdriveFaster.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="import maya.cmds as m\r\nsel = m.ls(sl=1)\rif len(sel) > 0:\r\ttrack.setTrainSpeed(sel[0],speed=2.0,r=1)\relse:\r\ttrack.setTrainSpeed(speed=2.0,r=1)"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	sp()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Switch Tracks' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveRightSwitch\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="rSwch"
	,image="woodTrainsrightSwitch1.xpm"
	,image1="woodTrainsrightSwitch1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumCurveRightSwitch\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	);
	##m.setParent('..')	
 	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveLeftSwitch\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="lSwch"
	,image="woodTrainsleftSwitch1.xpm"
	,image1="woodTrainsleftSwitch1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumCurveLeftSwitch\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	);
	#m.setParent('..')
		
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveSwitch\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="crvSw"
	,image="woodTrainscurveSwitch1.xpm"
	,image1="woodTrainscurveSwitch1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumCurveSwitch\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveRightSwitch2\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="rSw2"
	,image="woodTrainsrightSwitch2.xpm"
	,image1="woodTrainsrightSwitch2.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumCurveRightSwitch2\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveLeftSwitch2\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="lSw2"
	,image="woodTrainsleftSwitch2.xpm"
	,image1="woodTrainsleftSwitch2.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"mediumCurveLeftSwitch2\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"mediumCurveLeftSwitch2\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="tJun"
	,image="woodTrainsleftSwitch2.xpm"
	,image1="woodTrainsleftSwitch2.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"TJunction\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	
	
	#m.setParent('..')

	sp()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Bridge Tracks' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"longAscendingStraight\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="up"
	,image="woodTrainsascendingTrack.xpm"
	,image1="woodTrainsascendingTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"longAscendingStraight\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"longDescendingStraight\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="down"
	,image="woodTrainsdescendingTrack.xpm"
	,image1="woodTrainsdescendingTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"longDescendingStraight\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"bridgeSupportSimple\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="suprt"
	,image="woodTrainsbridgeSupport1.xpm"
	,image1="woodTrainsbridgeSupport1.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"bridgeSupportSimple\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"bridgeSupportThinStacking\")\r"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="thin"
	,image="woodTrainsbridgeSupportThinStack.xpm"
	,image1="woodTrainsbridgeSupportThinStack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"bridgeSupportThinStacking\")\r"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"bridgeSupportStacking\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="track"
	,image="woodTrainsbridgeSupportStackTrackB.xpm"
	,image1="woodTrainsbridgeSupportStackTrackB.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"bridgeSupportStacking\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	sp()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Reversing Tracks' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"miniReverseFemaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="mini"
	,image="woodTrainsreverseFemale.xpm"
	,image1="woodTrainsreverseFemale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"miniReverseFemaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"shortReverseFemaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="short"
	,image="woodTrainsreverseFemale.xpm"
	,image1="woodTrainsreverseFemale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"shortReverseFemaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"medReverseFemaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="med"
	,image="woodTrainsreverseFemale.xpm"
	,image1="woodTrainsreverseFemale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"medReverseFemaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"longReverseFemaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="long"
	,image="woodTrainsreverseFemale.xpm"
	,image1="woodTrainsreverseFemale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"longReverseFemaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton()
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"miniReverseMaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="mini"
	,image="woodTrainsreverseMale.xpm"
	,image1="woodTrainsreverseMale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"miniReverseMaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"shortReverseMaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="short"
	,image="woodTrainsreverseMale.xpm"
	,image1="woodTrainsreverseMale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"shortReverseMaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"medReverseMaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="med"
	,image="woodTrainsreverseMale.xpm"
	,image1="woodTrainsreverseMale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"medReverseMaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="track.addTrackToSelected(\"longReverseMaleStraight\")"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="long"
	,image="woodTrainsreverseMale.xpm"
	,image1="woodTrainsreverseMale.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"longReverseMaleStraight\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	#m.setParent('..')
	
	sp()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Special Tracks' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="cross"
	,image="woodTrainscrossTrack.xpm"
	,image1="woodTrainscrossTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"crossTrack\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="three"
	,image="woodTrainssplitThree.xpm"
	,image1="woodTrainssplitThree.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"curveThreeSwitch\")"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton()

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="mStop"
	,image="woodTrainsmStop.xpm"
	,image1="woodTrainsmStop.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"maleStopper\")"
	,sourceType="python"
	,actionIsSubstitute=0
	);
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="fStop"
	,image="woodTrainsfStop.xpm"
	,image1="woodTrainsfStop.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"femaleStopper\")"
	,sourceType="python"
	,actionIsSubstitute=0
	);

	m.shelfButton()

	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="fCarp"
	,image="woodTrainsfemaleCarpetTrack.xpm"
	,image1="woodTrainsfemaleCarpetTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"femaleCarpet\")"
	,sourceType="python"
	,actionIsSubstitute=0
	);
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="mCarp"
	,image="woodTrainsmaleCarpetTrack.xpm"
	,image1="woodTrainsmaleCarpetTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.addTrackToSelected(\"maleCarpet\")"
	,sourceType="python"
	,actionIsSubstitute=0
	);
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="Kldg"
	,image="woodTrainsmaleCarpetTrack.xpm"
	,image1="woodTrainsmaleCarpetTrack.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.buildKludgeTrack()"
	,sourceType="python"
	,actionIsSubstitute=0
	);
	
	sp()
	m.iconTextStaticLabel( height=20, width=300, align="left", st='textOnly',l='Track Budging' )
	m.gridLayout(numberOfColumns=10, cellWidth=32, cellHeight=32)
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="up"
	,image="woodTrainsUpArrow.xpm"
	,image1="woodTrainsUpArrow.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.bumpUp()"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="down"
	,image="woodTrainsDownArrow.xpm"
	,image1="woodTrainsDownArrow.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.bumpDown()"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="left"
	,image="woodTrainsLeftArrow.xpm"
	,image1="woodTrainsLeftArrow.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.bumpLeft()"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	
	m.shelfButton(
	enableCommandRepeat=1
	,enable=1
	,width=34
	,height=34
	,manage=1
	,visible=1
	,preventOverride=0
	,align="center"
	,label="cross track"
	,labelOffset=0
	,font="tinyBoldLabelFont"
	,imageOverlayLabel="right"
	,image="woodTrainsRightArrow.xpm"
	,image1="woodTrainsRightArrow.xpm"
	,style="iconOnly"
	,marginWidth=1
	,marginHeight=1
	,command="track.bumpRight()"
	,sourceType="python"
	,actionIsSubstitute=0
	); 
	

	
	sp()
	m.showWindow( window )
예제 #36
0
    def renderAllLights(self, renderLights=[], useGroups=False):
        lights = cmds.ls(dag=True,
                         visible=True,
                         lights=True,
                         type='mentalrayIblShape')
        #Check if there is any lights selected to only do those
        if renderLights == [] or renderLights == None:
            renderLights = cmds.ls(dag=True,
                                   sl=True,
                                   lights=True,
                                   type='mentalrayIblShape')
        #if there isn't any light selected just get all the lights
        if renderLights == []:
            renderLights = lights

        lightNames = ""
        for light in renderLights:
            lightNames = lightNames + light + '\n'

        windowName = 'ProgressWindow'
        if cmds.window(windowName, exists=True):
            cmds.deleteUI(windowName)

        window = cmds.window(windowName, t="Progress Report")

        cmds.columnLayout()
        cmds.iconTextStaticLabel(st='textOnly', l='Rendering Lights:')
        cmds.iconTextStaticLabel(st='textOnly', l=lightNames)
        cmds.iconTextStaticLabel(st='textOnly', l='Process Bar')
        progressControl = cmds.progressBar(maxValue=len(renderLights),
                                           width=300)
        cmds.showWindow(window)

        lights = self.sortLightsByType(lights)
        #-Revised--hide ibl node that is at the end of lights list (sorted previously)
        if cmds.objectType(lights[-1], isType='mentalrayIblShape') == True:
            cmds.setAttr('%s.visibleInFinalGather' % lights[-1], 0)
            cmds.setAttr('%s.visibleInEnvironment' % lights[-1], 0)

        cmds.hide(lights)
        lightCount = 0

        if useGroups == True:
            renderLightsGroups = self.groupLightsByName(renderLights)
            cmds.progressBar(progressControl,
                             edit=True,
                             maxValue=len(renderLightsGroups.keys()),
                             width=300)
            for group in renderLightsGroups:
                self.renderOnlyThisLight(renderLightsGroups[group])
                progressInc = cmds.progressBar(progressControl,
                                               edit=True,
                                               pr=lightCount + 1)
                lightCount += 1
        else:
            print renderLights
            for light in renderLights:
                self.renderOnlyThisLight(light)
                progressInc = cmds.progressBar(progressControl,
                                               edit=True,
                                               pr=lightCount + 1)
                lightCount += 1

        cmds.showHidden(lights)
        #-Revised--since we sorted the lights by type we know that the lastone will be the IBL
        if cmds.objectType(lights[-1], isType='mentalrayIblShape') == True:
            cmds.setAttr('%s.visibleInFinalGather' % lights[-1], 1)
            cmds.setAttr('%s.visibleInEnvironment' % lights[-1], 1)
    def __init__(s, i18n, char, clip, previewImage, requestThumb, requestCharData, requestClipCapture):
        s.i18n = i18n
        s.char = char
        s.clip = clip
        s.previewImage = previewImage # Initial preview image
        s.requestThumb = requestThumb # asking for new thumbnail
        s.requestCharData = requestCharData # Grab the character data
        s.requestClipCapture = requestClipCapture # Grab capture information
        s.thumbs = {} # Captured thumbs
        s.winWidth = 500 # Window width

        # VALIDATE BEFORE DOING ANYTHING
        with warn:
            s.validateObjs()

        s.camName = "TempCam_%s" % int(time.time())
        s.createCam()

        # INIT DATA:
        clip.metadata["name"] = clip.metadata.get("name", "CLIP")
        clip.metadata["range"] = clip.metadata.get("range", [
            cmds.playbackOptions(q=True, min=True),
            cmds.playbackOptions(q=True, max=True)
            ])
        r = clip.metadata["range"]
        s.pose = True if r[0] == r[1] else False # Is the range a single frame?
        s.range = r
        s.name = clip.metadata["name"]

        s.winName = "ClipNewWin"
        if cmds.window(s.winName, ex=True):
            cmds.deleteUI(s.winName)
        s.window = cmds.window(s.winName, rtf=True, t=s.i18n["title"])
        mainLayout = cmds.columnLayout()
        ## CAMERA CONTROLS
        s.live = False if s.previewImage else True # Live cam?
        s.camLayout = cmds.paneLayout(h=s.winWidth, w=s.winWidth, p=mainLayout)
        viewer = cmds.modelPanel(
            menuBarVisible=False,
            camera=s.camera,
            )
        cmds.modelEditor( # Tweak nice default visuals
            viewer,
            e=True,
            grid=False,
            da="smoothShaded",
            allObjects=False,
            nurbsSurfaces=True,
            polymeshes=True,
            subdivSurfaces=True,
            displayTextures=True
            )
        s.previewLayout = cmds.columnLayout(
            h=s.winWidth,
            w=s.winWidth,
            p=mainLayout,
            m=False
            )
        s.preview = cmds.iconTextStaticLabel(
            style="iconOnly",
            h=s.winWidth,
            w=s.winWidth,
            bgc=[0.2,0.2,0.2],
            image="out_snapshot.png"
        )
        cmds.columnLayout(w=s.winWidth, p=mainLayout)
        cmds.separator()
        ## DATA CONTROLS
        cmds.rowLayout(nc=2, adj=1)
        cmds.columnLayout(adj=True)
        s.clipname = cmds.textFieldGrp(
            l=s.i18n["clipname"],
            text=clip.metadata["name"],
            h=30,
            tcc=s.nameChange
        )

        r = clip.metadata["range"]
        s.clippose = cmds.checkBoxGrp(
            l=s.i18n["clippose"],
            h=30,
            v1=r[0] == r[1],
            cc=s.poseChange
            )
        s.cliprange = cmds.intFieldGrp(
            l=s.i18n["cliprange"],
            nf=2,
            v1=r[0],
            v2=r[1],
            en=False if cmds.checkBoxGrp(s.clippose, q=True, v1=True) else True,
            h=30,
            cc=s.rangeChange
        )
        cmds.setParent("..")
        s.thumb = cmds.iconTextButton(
            l=s.i18n["captureBtn"],
            ann=s.i18n["thumbDesc"],
            style="iconAndTextVertical",
            h=90,
            w=90,
            bgc=[0.2,0.2,0.2],
            image="out_snapshot.png",
            c=s.captureThumb
        )
        cmds.columnLayout(w=s.winWidth, p=mainLayout)
        cmds.button(
            l="CAPTURE CLIP",
            h=40,
            w=s.winWidth
            )
        if s.live:
            s.captureMode()
        else:
            s.previewMode()
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.save], ro=True)
        cmds.scriptJob(e=["quitApplication", s.cleanup], ro=True)
예제 #38
-2
    def __enter__(self):
        '''
        Initialize the UI
        '''
        if mc.window(self.name, exists=True):
            mc.deleteUI(self.name)

        mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu)
        
        
        if self.menu:
            self.createMenu()
        
        self.form = mc.formLayout()
        self.column = mc.columnLayout(adj=True)

        
        mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2, 
                    columnAlign2=('right','left'),
                    columnAttach=[(1, 'both', 0), (2, 'both', 8)] )

        #if we can find an icon, use that, otherwise do the text version
        if self.icon:
            mc.iconTextStaticLabel(style='iconOnly', image1=self.icon)
        else:
            mc.text(label=' _ _ |\n| | | |')
            
        if not self.menu:
            mc.popupMenu(button=1)
            mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name)))
        
        mc.text(label=self.info)
        mc.setParent('..')
        mc.separator(height=8, style='single')
        return self