Пример #1
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)
Пример #2
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)