示例#1
0
 def animExport_2(self):
     
     mel.eval('source gameFbxExporter;gameFbxExporter();')#opening game exporter
     pm.tabLayout('gameExporterTabLayout', st = 'gameExporterAnimationTab', edit = True) #switches over to the animation tab
     mel.eval('gameExp_CurrentTabChanged();gameExp_UpdatePrefix;gameExp_PopulatePresetList();gameExp_CreateExportTypeUIComponents();')#updates the window
     x = mel.eval("ls $gGameFbxExporterCurrentNode") #getting the value of the preset
     pm.setAttr(x[0] + '.exportSetIndex', 2)#set export to export selection
     mel.eval('gameExp_CreateExportTypeUIComponents;')#refresh the option
     #mel.eval('setAttr("gameExporterPreset2.exportSetIndex") `optionMenu -q -select anim_gameExporterExportSet`; gameExp_CreateExportTypeUIComponents;') 
     
     try: #spamming delete entry in case there are entries before already
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
     except:
         pass
     mel.eval('gameExp_AddNewAnimationClip 1;') # adds a new clip
     
     mel.eval('setAttr($gGameFbxExporterCurrentNode + ".exportPath") - type "string" "' + self.exportPath.text() + '";') #setting address
     
     formLayout1 = pm.layout('anim_gameExporterExportTypeFormLayout', query = True, childArray = True)[0] #formLayout1, formLayout2, fieldText1 and self.clipNameFieldpy are all 
     formLayout2 = pm.layout('anim_gameFbxExporterScrollLayout', query = True, childArray = True)[0]
     fieldText1 = pm.layout(formLayout2, query = True, childArray = True)[1]
     self.clipNameFieldpy = 'gameExporterWindow|gameExporterTabFormLayout|gameExporterTabLayout|gameExporterAnimationTab|anim_gameExporterMainFormLayout|anim_gameExporterExportTypeFormLayout|' + formLayout1 + '|anim_gameFbxExporterAnimClipFrameLayout|anim_gameFbxExporterAnimClipFormLayout|anim_gameFbxExporterScrollLayout|' + formLayout2 + '|' + fieldText1 
     
     if self.ingameExport.isChecked() == True:#motion export
         mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.exportName.text() + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips
         pm.select('Character_Holder')
     elif self.camExport.isChecked() == True: #aim camera export
         mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.exportName.text() + '_cam' + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips
     mel.eval('gameExp_DoExport();') #this is the point at which it exports
     
     mel.eval('gameExp_DeleteAnimationClipLayout 0;') # delete clip afterward
 def animExport_2(self):
     
     mel.eval('source gameFbxExporter;gameFbxExporter();')#opening game exporter
     pm.tabLayout('gameExporterTabLayout', st = 'gameExporterAnimationTab', edit = True) #switches over to the animation tab
     mel.eval('gameExp_CurrentTabChanged();gameExp_UpdatePrefix;gameExp_PopulatePresetList();gameExp_CreateExportTypeUIComponents();')#updates the window
     mel.eval('setAttr("gameExporterPreset2.exportSetIndex") `optionMenu -q -select anim_gameExporterExportSet`; gameExp_CreateExportTypeUIComponents;') #set export to export selection
     
     try: #spamming delete entry in case there are entries before already
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
         mel.eval('gameExp_DeleteAnimationClipLayout 0;')
     except:
         pass
     
     mel.eval('gameExp_AddNewAnimationClip 1;') # adds a new clip
     mel.eval('setAttr($gGameFbxExporterCurrentNode + ".exportPath") - type "string" "' + self.exportPath.toPlainText() + '";') #setting address
     
     formLayout1 = pm.layout('anim_gameExporterExportTypeFormLayout', query = True, childArray = True)[0]
     formLayout2 = pm.layout('anim_gameFbxExporterScrollLayout', query = True, childArray = True)[0]
     fieldText1 = pm.layout(formLayout2, query = True, childArray = True)[1]
     self.clipNameFieldpy = 'gameExporterWindow|gameExporterTabFormLayout|gameExporterTabLayout|gameExporterAnimationTab|anim_gameExporterMainFormLayout|anim_gameExporterExportTypeFormLayout|' + formLayout1 + '|anim_gameFbxExporterAnimClipFrameLayout|anim_gameFbxExporterAnimClipFormLayout|anim_gameFbxExporterScrollLayout|' + formLayout2 + '|' + fieldText1 
     mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.fileName + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips
     #mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.fileName + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips
     
     
     if self.ingameExport.isChecked() == 1: #forking code for future cutscene export
         pass
     elif self.cutsceneExport.isChecked() == 1:
         pass
     
     mel.eval('gameExp_DoExport();')
     
     mel.eval('gameExp_DeleteAnimationClipLayout 0;') # delete clip afterward
示例#3
0
    def updateChildren(self, nodeName, currentTranslator):
        """
        update the translator UI, which consists of an optionMenuGrp and a frameLayout per translator,
        so that only the frameLayout corresponding to the currently selected translator is visible
        """
        if not pm.layout(self._optionMenu, exists=True):
            # not built yet
            return
        fullpath = pm.layout(self._optionMenu, query=True, fullPathName=True)
        # get the grand-parent columnLayout
        gparent = fullpath.rsplit('|', 2)[0]
        # get the great-grand parent frame layout
        frame = fullpath.rsplit('|', 3)[0]
        try:
            pm.frameLayout(frame, edit=True, collapsable=False, labelVisible=False, borderVisible=False)
        except RuntimeError:
            # this is a little dirty: it will only succeed when attaching to AE
            pass

        children = pm.layout(gparent, query=True, childArray=True)
        # hide all frameLayouts but ours
        assert currentTranslator, "we should have a translator set by now"

        for child in children:
            # is it a frame layout?
            objType = pm.objectTypeUI(child)
            if objType == 'frameLayout':
                label = pm.frameLayout(child, query=True, label=True)
                # turn collapsable and label off
                if showAllTranslators:
                    pm.frameLayout(child, edit=True, collapsable=False, labelVisible=True,
                                     visible=True)
                else:
                    pm.frameLayout(child, edit=True, collapsable=False, labelVisible=False,
                                     visible=(label == currentTranslator))
示例#4
0
def rebuildAE():
    "completely rebuild the attribute editor"
    edForm = pm.melGlobals['gAttributeEditorForm']
    if pm.layout(edForm, q=True, exists=True):
        children = pm.layout(edForm, q=True, childArray=True)
        if children:
            pm.deleteUI(children[0])
            pm.mel.attributeEditorVisibilityStateChange(1, "")
示例#5
0
def rebuildAE():
    "completely rebuild the attribute editor"
    edForm = pm.melGlobals['gAttributeEditorForm']
    if pm.layout(edForm, q=True, exists=True):
        children = pm.layout(edForm, q=True, childArray=True)
        if children:
            pm.deleteUI(children[0])
            pm.mel.attributeEditorVisibilityStateChange(1, "")
示例#6
0
文件: hooks.py 项目: yazici/coconodz
def rebuild_attribute_editor():
    """ rebuilds the attribute editor

    This should be called after removing a AETemplateCustomContent callback

    Returns:

    """
    edForm = pmc.melGlobals['gAttributeEditorForm']
    if pmc.layout(edForm, query=True, exists=True):
        children = pmc.layout(edForm, query=True, childArray=True)
        if children:
            pmc.deleteUI(children[0])
            pmc.mel.attributeEditorVisibilityStateChange(1, "")
示例#7
0
    def update(self):
        if self.nodeName is None or not pm.objExists(self.nodeName) \
            or self.networkCol is None or not pm.layout(self.networkCol, exists=True):
            return

        nodeAttr = pm.Attribute(self.nodeAttr('aiCustomAOVs'))
        self.updateAOVFrame(nodeAttr)
示例#8
0
 def customCreateFlt(self, attr):
     # print "creating %s" % attr
     pname = attr.split('.')[-1]
     ptype = self.params[pname].ptype
     plabel = self.params[pname].label
     pann = self.params[pname].annotation
     presets = self.params[pname].presets
     precision = self.params[pname].precision
     controlName = pname + 'Ctrl'
     l = plabel
     if presets is not None:
         l += ' <span>&#8801;</span>'  # fix unicode problem in Windows using html
     pm.attrFieldSliderGrp(controlName,
                           attribute=attr,
                           label=l,
                           annotation=pann,
                           precision=precision)
     if presets is not None:
         # pm.attrFieldSliderGrp(controlName, edit=True)
         # pm.popupMenu()
         # for k in sorted(presets, key=presets.get):
         #     pm.menuItem(label=k, command=pm.Callback(setPresetFlt, controlName, presets[k]))
         attrChildren = pm.layout(controlName, query=True, childArray=True)
         pm.popupMenu(button=1, parent=attrChildren[0])
         for k in sorted(presets, key=presets.get):
             pm.menuItem(label=k,
                         command=pm.Callback(setPresetFlt, controlName,
                                             presets[k]))
    def update(self):
        if self.nodeName is None or not pm.objExists(self.nodeName) \
            or self.networkCol is None or not pm.layout(self.networkCol, exists=True):
            return

        nodeAttr = pm.Attribute(self.nodeAttr('aiCustomAOVs'))
        self.updateAOVFrame(nodeAttr)
示例#10
0
    def updateChildren(self, nodeName, currentTranslator):
        """
        update the translator UI, which consists of an optionMenuGrp and a frameLayout per translator,
        so that only the frameLayout corresponding to the currently selected translator is visible
        """
        if not pm.layout(self._optionMenu, exists=True):
            # not built yet
            return
        fullpath = pm.layout(self._optionMenu, query=True, fullPathName=True)
        # get the grand-parent columnLayout
        gparent = fullpath.rsplit('|', 2)[0]
        # get the great-grand parent frame layout
        frame = fullpath.rsplit('|', 3)[0]
        try:
            pm.frameLayout(frame,
                           edit=True,
                           collapsable=False,
                           labelVisible=False,
                           borderVisible=False)
        except RuntimeError:
            # this is a little dirty: it will only succeed when attaching to AE
            pass

        children = pm.layout(gparent, query=True, childArray=True)
        # hide all frameLayouts but ours
        assert currentTranslator, "we should have a translator set by now"

        for child in children:
            # is it a frame layout?
            objType = pm.objectTypeUI(child)
            if objType == 'frameLayout':
                label = pm.frameLayout(child, query=True, label=True)
                # turn collapsable and label off
                if showAllTranslators:
                    pm.frameLayout(child,
                                   edit=True,
                                   collapsable=False,
                                   labelVisible=True,
                                   visible=True)
                else:
                    pm.frameLayout(child,
                                   edit=True,
                                   collapsable=False,
                                   labelVisible=False,
                                   visible=(label == currentTranslator))
示例#11
0
    def addOneTabToGlobalsWindow(self, renderer, tabLabel, createProc):
        # no windows no need to call
        if not pm.window('unifiedRenderGlobalsWindow', exists=True):
            return

        displayAllTabs = pm.mel.isDisplayingAllRendererTabs()
        if not displayAllTabs and pm.SCENE.defaultRenderGlobals.currentRenderer.get() != renderer:
            return
        # Set the correct tabLayout parent.
        if displayAllTabs:
            tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName'])
        else:
            tabLayoutName = pm.mel.getRendererTabLayout(renderer)

        # Hide the tabForm while updating.
        tabFormManagedStatus = pm.formLayout('tabForm', q=True, manage=True)
        pm.formLayout('tabForm', edit=True, manage=False)
        pm.setParent('tabForm')

        if displayAllTabs:
            tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName'])
        else:
            tabLayoutName = pm.mel.getRendererTabLayout(renderer)
        pm.setParent(tabLayoutName)
        tabName = pm.mel.rendererTabName(renderer, tabLabel)

        commonTabNames = {
            'Common'             : "m_unifiedRenderGlobalsWindow.kCommon",
            'Passes'             : "m_unifiedRenderGlobalsWindow.kPassesTab",
            'Maya Software'      : "m_unifiedRenderGlobalsWindow.kMayaSoftware",
            'Maya Hardware'      : "m_unifiedRenderGlobalsWindow.kMayaHardware",
            'Maya Vector'        : "m_unifiedRenderGlobalsWindow.kMayaVector",
            'Features'           : "m_unifiedRenderGlobalsWindow.kFeatures",
            'Quality'            : "m_unifiedRenderGlobalsWindow.kQuality",
            'Indirect Lighting'  : "m_unifiedRenderGlobalsWindow.kIndirectLighting",
            'Options'            : "m_unifiedRenderGlobalsWindow.kOptions"
        }
        if commonTabNames.has_key(tabLabel):
            tabLabel = pm.mel.uiRes(commonTabNames[tabLabel])

        if not pm.layout(tabName, exists=True):
            pm.setUITemplate('renderGlobalsTemplate', pushTemplate=True)
            pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)
            pm.formLayout(tabName)
            createProcs = ['createMayaSoftwareCommonGlobalsTab', 'createMayaSoftwareGlobalsTab']
            try:
                createProcs.extend(pm.renderer(renderer, q=True, globalsTabCreateProcNames=True))
            except:
                pass
            if createProc in createProcs:
                pm.mel.eval(createProc)

            pm.setParent('..')
            pm.setUITemplate(popTemplate=True)
            pm.setUITemplate(popTemplate=True)
            pm.tabLayout(tabLayoutName, edit=True, tabLabel=(tabName, tabLabel))
        pm.formLayout('tabForm', edit=True, manage=tabFormManagedStatus)
示例#12
0
 def getDisplayLayers():
     try:
         return [
             pc.PyNode(layer) for layer in pc.layout(
                 'LayerEditorDisplayLayerLayout', q=True, childArray=True)
         ]
     except TypeError:
         pc.warning('Display layers not found in the scene')
         return []
示例#13
0
    def addOneTabToGlobalsWindow(self, renderer, tabLabel, createProc):
        # no windows no need to call
        if not pm.window('unifiedRenderGlobalsWindow', exists=True):
            return

        displayAllTabs = pm.mel.isDisplayingAllRendererTabs()
        if not displayAllTabs and pm.SCENE.defaultRenderGlobals.currentRenderer.get() != renderer:
            return
        # Set the correct tabLayout parent.
        if displayAllTabs:
            tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName'])
        else:
            tabLayoutName = pm.mel.getRendererTabLayout(renderer)
    
        # Hide the tabForm while updating.
        tabFormManagedStatus = pm.formLayout('tabForm', q=True, manage=True)
        pm.formLayout('tabForm', edit=True, manage=False)
        pm.setParent('tabForm')

        if displayAllTabs:
            tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName'])
        else:
            tabLayoutName = pm.mel.getRendererTabLayout(renderer)
        pm.setParent(tabLayoutName)
        tabName = pm.mel.rendererTabName(renderer, tabLabel)

        commonTabNames = {
            'Common'             : "m_unifiedRenderGlobalsWindow.kCommon",
            'Passes'             : "m_unifiedRenderGlobalsWindow.kPassesTab",
            'Maya Software'      : "m_unifiedRenderGlobalsWindow.kMayaSoftware",
            'Maya Hardware'      : "m_unifiedRenderGlobalsWindow.kMayaHardware",
            'Maya Vector'        : "m_unifiedRenderGlobalsWindow.kMayaVector",
            'Features'           : "m_unifiedRenderGlobalsWindow.kFeatures",
            'Quality'            : "m_unifiedRenderGlobalsWindow.kQuality",
            'Indirect Lighting'  : "m_unifiedRenderGlobalsWindow.kIndirectLighting",
            'Options'            : "m_unifiedRenderGlobalsWindow.kOptions"
        }
        if commonTabNames.has_key(tabLabel):
            tabLabel = pm.mel.uiRes(commonTabNames[tabLabel])

        if not pm.layout(tabName, exists=True):
            pm.setUITemplate('renderGlobalsTemplate', pushTemplate=True)
            pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)
            pm.formLayout(tabName)
            createProcs = ['createMayaSoftwareCommonGlobalsTab', 'createMayaSoftwareGlobalsTab']
            try:
                createProcs.extend(pm.renderer(renderer, q=True, globalsTabCreateProcNames=True))
            except:
                pass
            if createProc in createProcs:
                pm.mel.eval(createProc)

            pm.setParent('..')
            pm.setUITemplate(popTemplate=True)
            pm.setUITemplate(popTemplate=True)
            pm.tabLayout(tabLayoutName, edit=True, tabLabel=(tabName, tabLabel))
        pm.formLayout('tabForm', edit=True, manage=tabFormManagedStatus)
示例#14
0
 def get_selected_display_layers(self):
     # Note: we could get all displayLayer nodes but there is no way
     #       to select them without going through the UI so we do it this way
     display_layers = pm.layout("LayerEditorDisplayLayerLayout",
                                query=True,
                                childArray=True) or []
     return [
         pm.PyNode(display_layer) for display_layer in display_layers
         if pm.layerButton(display_layer, query=True, select=True)
     ]
示例#15
0
文件: view.py 项目: bohdon/viewGui
 def buildBody(self):
     self._iconSize = self.gui.iconSize
     self.minSize = 128
     self.maxSize = 512
     self.tempFileName = 'mayaIcon{0}.png'
     self.gui.window.setToolbox(True)
     self.camera = self.newCamera()
     with pm.formLayout() as form:
         with pm.columnLayout():
             kw = dict(w=128, h=128)
             with pm.frameLayout(lv=False, bv=False, **kw) as self.editorFrame:
                 self.panel = pm.modelPanel(cam=self.camera, mbv=False, l='Icon Capture View')
                 self.setupModelEditor(self.panel.getModelEditor())
                 bar = self.panel.getBarLayout()
                 pm.layout(bar, e=True, m=False)
         with pm.formLayout() as form2:
             self.buildFooter()
             utils.layoutForm(form2, 1)
         utils.layoutForm(form, (0, 1), vertical=True)
     self.updateEditorFrame()
     pm.refresh()
示例#16
0
    def makeLctShelf(cls, *args, **kwargs):
        """ """
        src = lcPath.Path.getSrcPath()
        mel = lcPath.Path.getMelPath()
        shelf = os.path.normpath(os.path.join(mel, 'shelf_LCT.mel'))

        file = open(shelf, 'w+')
        opening = 'global proc shelf_LCT () {\n    global string $gBuffStr;\n    global string $gBuffStr0;\n    global string $gBuffStr1;\n\n'
        closing = '\n}'

        file.write(opening)

        initShelfIcon = os.path.normpath(
            os.path.join(src, 'icons', 'shelf.png'))
        initShelfLabel = 'Init Shelf'
        initShelfAnno = 'Initialize LCT Shelf'
        initShelfCommand = 'from lct.src.core.lcShelf import Shelf as shelf\nshelf.makeLctShelf()'

        file.write(closing)

        file.close()

        if not pm.layout('LCT', ex=True):
            if os.name == 'nt':
                shelf = shelf.replace('\\', '/')
            pm.mel.loadNewShelf(shelf)
            pm.shelfButton(label=initShelfLabel,
                           annotation=initShelfAnno,
                           image1=initShelfIcon,
                           command=initShelfCommand)
        else:
            pm.mel.eval(
                'shelfTabLayout -edit -selectTab "LCT" $gShelfTopLevel;')

        list = lcUtility.Utility.buildPublishList(inline=False)
        for item in list:
            if item[3] == 'True':
                label = item[0]
                annotation = item[2]
                icon = os.path.normpath(
                    os.path.join(src, label, item[0] + '.png'))
                runCommand = item[4]

                cls.makeShelfButton(label, runCommand, icon, annotation)
示例#17
0
def getLayerSelection():
    """
    get selected display layers
    :return: `list` selected layers
    """
    gCurrentLayerEditor = pm.melGlobals["gCurrentLayerEditor"]
    type = getLayerDisplayType()
    if type != "Display":
        pm.warning("Unsupported layer type. Works on display layers.")
        return []

    pm.setParent(gCurrentLayerEditor)
    selectionArray = []
    layoutName = "LayerEditor" + type + "LayerLayout"
    buttonArray = pm.layout(layoutName, query=True, childArray=True)
    for button in buttonArray:
        if pm.layerButton(button, query=True, select=True):
            selectionArray.append(button)
    return selectionArray
示例#18
0
    def customCreateRgb(self, attr):
        pname = attr.split('.')[-1]
        ptype = self.params[pname].ptype
        plabel = self.params[pname].label
        pann = self.params[pname].annotation
        presets = self.params[pname].presets
        controlName = pname + 'Ctrl'

        l = plabel
        if presets is not None:
            l += ' <span>&#8801;</span>' # fix unicode problem in Windows using html
        pm.attrColorSliderGrp(controlName, attribute=attr, label=l, annotation=pann)
        if presets is not None:
            # pm.attrColorSliderGrp(controlName, edit=True)
            # pm.popupMenu()
            attrChildren = pm.layout(controlName, query=True, childArray=True)
            pm.popupMenu(button=1, parent=attrChildren[0])
            for k in sorted(presets):
                pm.menuItem(label=k, command=pm.Callback(setPresetRgb, controlName, presets[k]))
示例#19
0
    def mFIZ_node_attribute_changed(self, msg, plug, otherplug, *clientData):
        """
        """

        # Check if the tabLayout attached to the object exists,
        # If not, delete the callbacks as they're unnecessary
        if not pm.layout(self.controls_tab_layout, exists=True):
            # Delete all node Attribute Changed callback IDs
            # pm.evalDeferred(pm.Callback(self._delete_attribute_changed_callbacks))
            return

        # Only run if the message is from an Attribute on the mFIZ ndoe being evaluated
        if msg & OpenMaya.MNodeMessage.kAttributeEval:

            # Get the name of the attribute being evaluate
            attribute_name = str(plug.partialName())

            # Only run if the attribute being evaluated is the 'dataSent' attribute
            if attribute_name == 'dataSent':
                self.set_ui_connection_state()
示例#20
0
 def clickCallBack(self, *args):
     if self.selected:
         pm.layout(self.name, e=True, backgroundColor=self.color)
         self.parentWidget.selectedItem = None
         self.selected = False
     else:
         if self.parentWidget.selectedItem:
             pm.layout(self.parentWidget.selectedItem.name, e=True,
                               backgroundColor=self.parentWidget.selectedItem.color)
             self.parentWidget.selectedItem.selected = False
         pm.layout(self.name, e=True, backgroundColor=(.27, .27, .27))
         self.parentWidget.selectedItem = self
         self.selected = True
         if self.infoWidget:
             self.infoWidget.putInfo(self)
示例#21
0
  def makeLctShelf(cls, *args, **kwargs):
      """ """
      src = path.getSrcPath()
      mel = path.getMelPath()
      shelf = os.path.normpath(os.path.join(mel, 'shelf_LCT.mel'))

      file = open(shelf, 'w+')
      opening = 'global proc shelf_LCT () {\n    global string $gBuffStr;\n    global string $gBuffStr0;\n    global string $gBuffStr1;\n\n'
      closing = '\n}'

      file.write(opening)

      initShelfIcon = os.path.normpath(os.path.join(src, 'icons', 'shelf.png'))
      initShelfLabel = 'Init Shelf'
      initShelfAnno = 'Initialize LCT Shelf'
      initShelfCommand = 'from lct.src.core.lcShelf import Shelf as shelf\nshelf.makeLctShelf()'

      file.write(closing)

      file.close()

      if not pm.layout('LCT', ex=True):
        if os.name == 'nt':
            shelf = shelf.replace('\\','/')
        pm.mel.loadNewShelf(shelf)
        pm.shelfButton(label=initShelfLabel, annotation=initShelfAnno, image1=initShelfIcon, command=initShelfCommand)
      else:
        pm.mel.eval('shelfTabLayout -edit -selectTab "LCT" $gShelfTopLevel;')
        
      list = utility.buildPublishList(inline=False)
      for item in list:
        if item[3] == 'True':
          label = item[0]
          annotation = item[2]
          icon = os.path.normpath(os.path.join(src, label, item[0]+'.png'))
          runCommand = item[4]

          cls.makeShelfButton(label, runCommand, icon, annotation)
示例#22
0
    def buttons(self):
        if self._buttons is not None:
            return self._buttons

        # The shelf needs to be loaded to get this info.
        self.load_shelf()

        try:
            buttons = pm.layout(self.path, q=True, childArray=True)
        except RuntimeError:
            # This raises RuntimeError if the shelf no longer exists.
            return []

        if buttons is None:
            return []

        self._buttons = []
        for shelf_button in buttons:
            if pm.objectTypeUI(shelf_button) == 'shelfButton':
                self.buttons.append(shelf_button)
            elif pm.objectTypeUI(shelf_button) == 'separator':
                self.buttons.append(separator)
        return self._buttons
示例#23
0
def FbxExporterInstall():
    DTag = 'FbxExporter'
    icLab = 'FbxExp'
    ann = 'Click export, Double click UI'
    shelf = 'JAShelf'
    icon = 'fbxReview.png'

    command = """
from FbxExporter import FbxExporter
fbxExp = FbxExporter.FbxExporter.instance()
if len(fbxExp):
	fbxExp.export(True)"""

    command2 = """
from FbxExporter import FbxExporterUI
from FbxExporter import FbxExporter
ui = FbxExporterUI.FbxExporterUI(True)"""

    if not pm.layout(shelf, q=True, ex=True):
        pm.mel.addNewShelfTab(shelf)

    shelfButtons = pm.shelfLayout(shelf, q=True, ca=True)
    print shelfButtons
    if isinstance(shelfButtons, list):
        for button in shelfButtons:
            if pm.shelfButton(button, q=True, docTag=True) == DTag:
                logging.warn('%s is yet in your shelf tab' % icLab)
                return

    pm.shelfButton('FbxExp',
                   ann=ann,
                   iol=icLab,
                   i1=icon,
                   dtg=DTag,
                   c=command,
                   dcc=command2,
                   p=shelf)
示例#24
0
 def clearMultiTarget(self):
     children = layout(self.multiUI, q=True, ca=True)
     if children:
         deleteUI(children)
示例#25
0
文件: view.py 项目: bohdon/viewGui
 def exists(self):
     return pm.layout(self._layout, q=True, ex=True)
示例#26
0
 def update(self, totalLgt,lis, butLayout, *args):
    if pm.layout(butLayout, exists = True):
       pm.deleteUI(butLayout)
    self.lightLst()
def addOneTabToGlobalsWindow(renderer, tabLabel, createProc):
    # Check to see if the unified render globals window existed.
    # If it does not exist, then we don't need to add any tab yet.
    if not pm.window('unifiedRenderGlobalsWindow', exists=True):
        try:
            pm.error(
                pm.mel.uiRes("m_unifiedRenderGlobalsWindow.kCannotAddTabs"))
        except:
            pass
        return

    displayAllTabs = pm.mel.isDisplayingAllRendererTabs()

    # If the current renderer the renderer is not this
    # renderer, then don't add the tab yet.
    if not displayAllTabs and utils.currentRenderer() != renderer:
        return

    pm.setParent('unifiedRenderGlobalsWindow')

    # Hide the tabForm while updating.
    tabFormManagedStatus = pm.formLayout('tabForm', q=True, manage=True)
    pm.formLayout('tabForm', edit=True, manage=False)
    pm.setParent('tabForm')

    # Set the correct tabLayout parent.
    if displayAllTabs:
        tabLayoutName = pm.mel.getRendererTabLayout(
            pm.melGlobals['gMasterLayerRendererName'])
    else:
        tabLayoutName = pm.mel.getRendererTabLayout(renderer)

    pm.setParent(tabLayoutName)

    # The tabName is the tabLabel with the white space removed
    # and the word "Tab" added to the end.
    # "masterLayer" will act as the renderer name if the tab
    # is in the master layer.
    tabName = pm.mel.rendererTabName(renderer, tabLabel)

    # if the tab-control does not exist, define it and add it
    # to the tabLayout
    if not pm.layout(tabName, exists=True):
        pm.setUITemplate('renderGlobalsTemplate', pushTemplate=True)
        pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)

        # Define the tab
        pm.formLayout(tabName)

        # get the content of the tab from the createTabProc

        # Most create procs are now deferred till the tab is selected
        # These two are the default tabs, so we don't defer them
        createProcs = [
            'createMayaSoftwareCommonGlobalsTab',
            'createMayaSoftwareGlobalsTab',
            'createArnoldRendererCommonGlobalsTab',
            'createArnoldRendererGlobalsTab', 'createArnoldRendererSystemTab',
            'createArnoldRendererOverrideTab',
            'createArnoldRendererDiagnosticsTab'
        ]

        if createProc in createProcs:
            pm.mel.eval(createProc)

        # These end off the layouts of the information in the Tab
        pm.setParent('..')

        pm.setUITemplate(popTemplate=True)
        pm.setUITemplate(popTemplate=True)

        # Add the tab to the tabLayout
        pm.tabLayout(tabLayoutName,
                     edit=True,
                     tabLabel=(tabName,
                               renderSettingsTabLabel_melToUI(tabLabel)))

    # Restore the old manage status for the tabForm.
    pm.formLayout('tabForm', edit=True, manage=tabFormManagedStatus)
示例#28
0
def runThis():

    import adb_markingMenu
    adb_markingMenu.markingMenu()
    pm.layout('ShelfLayout', h=100, e=1)
示例#29
0
 def getProject(self):
     shortName = pm.layout(self.widgetName, q=True, ca=True)[1]
     fullName = pm.layout(shortName, q=True, fpn=True)
     projName = pm.textField(fullName, q=True, text=True)
     proj = database.getProjectDict(projName)
     return proj
示例#30
0
    def set_ui_connection_state(self, tab_names=[], connected=None):
        """
        """

        tab_layout = self.controls_tab_layout

        # Check if the window attached to the object exists,
        # If not, delete the callbacks as they're unnecessary
        if not pm.layout(tab_layout, exists=True):
            # If the scriptJob still exists, delete the scriptJob
            if self.time_change_scriptJob_id:
                pm.evalDeferred(
                    'import pymel.core as pm; pm.scriptJob(kill={})'.format(
                        self.time_change_scriptJob_id))
            return

        # If no tab is passed, set the state of every tab
        # Check the connected state by querrying the tab's associated node state
        # This combonation should always be passed together, otherwise, a single
        # tab_name and single connceted state should be passed
        if not tab_names:
            tab_names = pm.tabLayout(tab_layout, query=True, tabLabel=True)
            if 'Setup' in tab_names:
                tab_names.remove('Setup')  # Remove the setup tab

        for tab_name in tab_names:
            tab = self.controls_tab_data[tab_name]

            # If no connection state is passed, check the dataSent attribute on the
            # associated mFIZ node
            if connected is None:
                node = self.controls_tab_data[tab_name][
                    'tab_data'].controller.node

                # Get attribute value using OpenMaya and not getAttr() as the latter
                # causes recursion problems with the callback in some Maya versions
                sel = OpenMaya.MSelectionList()
                sel.add(str(node))
                obj = sel.getDependNode(0)

                node_state = OpenMaya.MFnDependencyNode(obj).findPlug(
                    'dataSent', True).asBool()

            else:
                node_state = connected

            # Get the current state of the tab
            tab_state = tab['connected']

            # If the tab and note state are different, update the tab state
            if tab_state != node_state:
                # Set the connection state in the tab data dict
                tab['connected'] = node_state

                # Set the color of the connection indicator field
                connection_indicator_field = tab[
                    'tab_data'].connection_indicator_field
                pm.textField(
                    connection_indicator_field,
                    edit=True,
                    backgroundColor=CONNECTION_INDICATOR_COLORS[node_state])

                # Set the connect/disconnect icon
                connection_icon = tab['tab_data'].connection_icon
                pm.symbolButton(connection_icon,
                                edit=True,
                                image=CONNECTION_ICON_NAMES[node_state])

                # If the node is disconnected, refresh the list of devices to remove
                # disconnected devices
                if not node_state:
                    self._refresh_port_optionMenus()
def addOneTabToGlobalsWindow(renderer, tabLabel, createProc):
    # Check to see if the unified render globals window existed.
    # If it does not exist, then we don't need to add any tab yet.
    if not pm.window('unifiedRenderGlobalsWindow', exists=True):
        try:
            pm.error(pm.mel.uiRes("m_unifiedRenderGlobalsWindow.kCannotAddTabs"))
        except:
            pass
        return
    
    displayAllTabs = pm.mel.isDisplayingAllRendererTabs()

    # If the current renderer the renderer is not this
    # renderer, then don't add the tab yet.
    if not displayAllTabs and utils.currentRenderer() != renderer:
        return

    pm.setParent('unifiedRenderGlobalsWindow')

    # Hide the tabForm while updating.
    tabFormManagedStatus = pm.formLayout('tabForm', q=True, manage=True)
    pm.formLayout('tabForm', edit=True, manage=False)
    pm.setParent('tabForm')

    # Set the correct tabLayout parent.
    if displayAllTabs:
        tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName'])
    else:
        tabLayoutName = pm.mel.getRendererTabLayout(renderer)

    pm.setParent(tabLayoutName)

    # The tabName is the tabLabel with the white space removed
    # and the word "Tab" added to the end.
    # "masterLayer" will act as the renderer name if the tab
    # is in the master layer.
    tabName = pm.mel.rendererTabName(renderer, tabLabel)

    # if the tab-control does not exist, define it and add it
    # to the tabLayout
    if not pm.layout(tabName, exists=True):
        pm.setUITemplate('renderGlobalsTemplate', pushTemplate=True)
        pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)

        # Define the tab
        pm.formLayout(tabName)

        # get the content of the tab from the createTabProc

        # Most create procs are now deferred till the tab is selected
        # These two are the default tabs, so we don't defer them
        createProcs = ['createMayaSoftwareCommonGlobalsTab',
                          'createMayaSoftwareGlobalsTab',
                          'createArnoldRendererCommonGlobalsTab',
                          'createArnoldRendererGlobalsTab',
                          'createArnoldRendererSystemTab',
                          'createArnoldRendererOverrideTab',
                          'createArnoldRendererDiagnosticsTab']

        if createProc in createProcs:
            pm.mel.eval(createProc)

        # These end off the layouts of the information in the Tab
        pm.setParent('..')

        pm.setUITemplate(popTemplate=True)
        pm.setUITemplate(popTemplate=True)

        # Add the tab to the tabLayout
        pm.tabLayout(tabLayoutName,
                       edit=True,
                       tabLabel=(tabName, renderSettingsTabLabel_melToUI(tabLabel)))

    # Restore the old manage status for the tabForm.
    pm.formLayout('tabForm', edit=True, manage=tabFormManagedStatus)