def create(self, *args, **kwargs):
        ''' '''
        if pm.control(self.windowName, exists=True):
            pm.deleteUI(self.windowName)
        if pm.control(self.dockName, exists=True):
            pm.deleteUI(self.dockName)

        if self.dockable:
            self.mainWindow = pm.window(self.windowName,
                                        t=self.windowName,
                                        menuBar=self.menuBar)
        else:
            self.mainWindow = pm.window(self.windowName,
                                        t=self.windowName,
                                        widthHeight=[self.width, self.height],
                                        menuBar=self.menuBar,
                                        rtf=self.rtf,
                                        mnb=self.mnb,
                                        mxb=self.mxb,
                                        s=self.sizeable)

        if self.menuBar:
            pm.menu(l='Help', helpMenu=True)
            pm.menuItem(l='blog.leocov.com',
                        command=lambda *args: webbrowser.open(
                            'http://blog.leocov.com', new=2))
            pm.menu(l='Tools')
            pm.menuItem(l='Make Shelf Icon',
                        command=lambda *args: shelf.makeShelfButton(
                            self.windowName, self.shelfCommand, self.icon, self
                            .annotation))
示例#2
0
 def create(self, *args, **kwargs):
   ''' '''
   if pm.control(self.windowName, exists = True):
     pm.deleteUI(self.windowName)
   if pm.control(self.dockName, exists = True):
     pm.deleteUI(self.dockName)
     
   if self.dockable:
     self.mainWindow = pm.window(self.windowName, t=self.windowName, menuBar=self.menuBar)
   else:
     self.mainWindow = pm.window(self.windowName, t=self.windowName, widthHeight=[self.width, self.height], menuBar=self.menuBar, rtf=self.rtf, mnb=self.mnb, mxb=self.mxb, s=self.sizeable)
   
   if self.menuBar:
     pm.menu(l='Help', helpMenu=True)
     pm.menuItem(l='blog.leocov.com', command=lambda *args: webbrowser.open('http://blog.leocov.com', new=2) )
     pm.menu(l='Tools')
     pm.menuItem(l='Make Shelf Icon', command=lambda *args: shelf.makeShelfButton(self.windowName, self.shelfCommand, self.icon, self.annotation) )
def lcTextureToolsUI(dockable=False, *args, **kwargs):
    ''' '''
    ci = 0  #color index iterator
    windowName = 'lcTextureTools'
    shelfCommand = 'import lct.src.lcTextureTools.lcTextureTools as lcTxT\nreload(lcTxT)\nlcTxT.lcTextureToolsUI()'
    icon = basePath + 'lcTextureTools.png'
    winWidth = 204
    winHeight = 174

    mainWindow = lcWindow(windowName=windowName,
                          width=winWidth,
                          height=winHeight,
                          icon=icon,
                          shelfCommand=shelfCommand,
                          annotation=annotation,
                          dockable=dockable,
                          menuBar=True)
    mainWindow.create()

    #
    pm.columnLayout(prefix + '_columLayout_main')

    #
    pm.rowColumnLayout(nc=1, cw=([1, 201]))
    pm.iconTextButton(
        w=200,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'renameNodes.png',
        annotation=
        'Renames all file nodes based on the attached file name with a tx_ suffix',
        command=lambda *args: texture.renameAllTextureNodes())
    pm.setParent('..')
    pm.separator(style='in', h=5)

    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.rowColumnLayout(nc=2, cw=([1, 75], [2, 25]))
    pm.iconTextButton(w=100,
                      h=25,
                      style='iconOnly',
                      image=iconBasePath + 'reloadAll.png',
                      annotation='Reloads all the file texture nodes',
                      command=lambda *args: texture.reloadTextures())
    pm.iconTextButton(
        w=25,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'addToShelf.png',
        highlightImage=iconBasePath + 'addToShelf_over.png',
        annotation='Add to Shelf',
        command=lambda *args: shelf.makeShelfButton(
            'Reload Textures',
            'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadTextures()',
            iconBasePath + 'reloadAllTextures.png', 'Reload All Textures'))
    pm.setParent('..')
    pm.rowColumnLayout(nc=2, cw=([1, 75], [2, 25]))
    pm.iconTextButton(
        w=100,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'reloadChanged.png',
        annotation=
        'Reloads only the changed file texture nodes based on timestamp',
        command=lambda *args: texture().reloadChangedTextures())
    pm.iconTextButton(
        w=25,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'addToShelf.png',
        highlightImage=iconBasePath + 'addToShelf_over.png',
        annotation='Add to Shelf',
        command=lambda *args: shelf.makeShelfButton(
            'Reload Changed Textures',
            'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadChangedTextures()',
            iconBasePath + 'reloadChangedTextures.png',
            'Reload Changed Textures'))
    pm.setParent('..')
    pm.setParent(prefix + '_columLayout_main')
    pm.separator(style='in', h=5)

    #
    pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50]))
    pm.textField(prefix + '_textField_new_path', w=150)
    pm.button(prefix + '_button_browse_path',
              l='Browse',
              bgc=colorWheel.getColorRGB(ci),
              annotation='Choose a new directory',
              w=50,
              command=lambda *args: path.browsePathTextField(
                  prefix + '_textField_new_path', '',
                  'Browse New Texture Directory'))
    ci += 1
    pm.setParent(prefix + '_columLayout_main')

    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(w=100,
                      h=25,
                      style='iconOnly',
                      image=iconBasePath + 'pathAll.png',
                      annotation='Repath all file texture nodes',
                      command=lambda *args: lcTxT_repath_all())
    pm.iconTextButton(w=100,
                      h=25,
                      style='iconOnly',
                      image=iconBasePath + 'pathSelected.png',
                      annotation='Repath selected file texture nodes',
                      command=lambda *args: lcTxT_repath_selected())
    pm.setParent(prefix + '_columLayout_main')
    pm.separator(style='in', h=5)

    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(
        w=100,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'openAll.png',
        annotation='Open all file texture nodes in default associated program',
        command=lambda *args: lcTxT_open_all())
    pm.iconTextButton(
        w=100,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'openSelected.png',
        annotation=
        'Open selected file texture nodes in default associated program',
        command=lambda *args: lcTxT_open_selected())
    pm.setParent(prefix + '_columLayout_main')
    pm.separator(style='in', h=5)

    #
    mainWindow.show()
示例#4
0
def lcTextureToolsUI(dockable=False, *args, **kwargs):
  ''' '''
  ci = 0 #color index iterator
  windowName = 'lcTextureTools'
  shelfCommand = 'import lct.src.lcTextureTools.lcTextureTools as lcTxT\nreload(lcTxT)\nlcTxT.lcTextureToolsUI()'
  icon = basePath+'lcTextureTools.png'
  winWidth  = 204
  winHeight = 174

  mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True)
  mainWindow.create()

  #
  pm.columnLayout(prefix+'_columLayout_main')

  #
  pm.rowColumnLayout(nc=1, cw=([1,201]) )
  pm.iconTextButton(w=200, h=25, style='iconOnly', image=iconBasePath+'renameNodes.png', annotation='Renames all file nodes based on the attached file name with a tx_ suffix', command=lambda *args: texture.renameAllTextureNodes() )
  pm.setParent('..')
  pm.separator(style='in', h=5)

  #
  pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) )
  pm.rowColumnLayout(nc=2, cw=([1,75], [2,25]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'reloadAll.png', annotation='Reloads all the file texture nodes', command=lambda *args: texture.reloadTextures() )
  pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Reload Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadTextures()', iconBasePath+'reloadAllTextures.png', 'Reload All Textures') )
  pm.setParent('..')
  pm.rowColumnLayout(nc=2, cw=([1,75], [2,25]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'reloadChanged.png', annotation='Reloads only the changed file texture nodes based on timestamp', command=lambda *args: texture().reloadChangedTextures() )
  pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Reload Changed Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadChangedTextures()', iconBasePath+'reloadChangedTextures.png', 'Reload Changed Textures') )
  pm.setParent('..')
  pm.setParent(prefix+'_columLayout_main')
  pm.separator(style='in', h=5)

  #
  pm.rowColumnLayout(nc=2, cw=([1,150], [2,50]) )
  pm.textField(prefix+'_textField_new_path', w=150)
  pm.button(prefix+'_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose a new directory', w=50, command=lambda *args: path.browsePathTextField(prefix+'_textField_new_path', '', 'Browse New Texture Directory') )
  ci+=1
  pm.setParent(prefix+'_columLayout_main')

  #
  pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'pathAll.png', annotation='Repath all file texture nodes', command=lambda *args: lcTxT_repath_all() )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'pathSelected.png', annotation='Repath selected file texture nodes', command=lambda *args: lcTxT_repath_selected() )
  pm.setParent(prefix+'_columLayout_main')
  pm.separator(style='in', h=5)

  #
  pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'openAll.png', annotation='Open all file texture nodes in default associated program', command=lambda *args: lcTxT_open_all() )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'openSelected.png', annotation='Open selected file texture nodes in default associated program', command=lambda *args: lcTxT_open_selected() )
  pm.setParent(prefix+'_columLayout_main')
  pm.separator(style='in', h=5)

  #
  mainWindow.show()
def lcCameraToolsUI(dockable=False, *args, **kwargs):
  ''' '''
  ci = 0 #color index iterator
  windowName = 'lcCameraTools'
  shelfCommand = 'import lct.src.lcCameraTools.lcCameraTools as lcCam\nreload(lcCam)\nlcCam.lcCameraToolsUI()'
  icon = basePath+'lcCameraTools.png'
  winWidth  = 204
  winHeight = 209
  
  mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True)
  mainWindow.create()
  pm.menu(l='Options', helpMenu=True)
  pm.menuItem(l='Reset Gradient Colors', command=lambda *args: cam_set_default_colors() )

  #
  pm.columnLayout(prefix+'_columLayout_main')
  
  #
  pm.rowColumnLayout(nc=2, cw=([1,50], [2,150]) )
  pm.text(l='Edit:', al='right')
  cameraListDropdown = pm.optionMenu(prefix+'_optionMenu_camera_list', bgc=colorWheel.getColorRGB(ci), w=150, h=25 )
  ci+=1
  cameraListDropdown.changeCommand(lambda *args: cam_get_cam_attrs(cameraListDropdown) )
  pm.setParent(prefix+'_columLayout_main')
  
  #  
  pm.rowColumnLayout(nc=2, cw=([1,125], [2,75]) )
  pm.text(l='Focal Length:', al='right')
  pm.floatField(prefix+'_floatField_focal_length', min=0.0, v=0.0, pre=1, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Near Clip Plane:', al='right')
  pm.floatField(prefix+'_floatField_near_clip_plane', min=0.0, v=0.0, pre=4, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Far Clip Plane:', al='right')
  pm.floatField(prefix+'_floatField_far_clip_plane', min=0.0, v=0.0, pre=0, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Overscan:', al='right')
  pm.floatField(prefix+'_floatField_overscan', min=0.0, v=0.0, pre=3, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Background Color:', al='right')
  pm.colorSliderGrp(prefix+'_colorSliderGrp_background_color', cw1=50, rgb=(0.0,0.0,0.0), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Gradient Top:', al='right')
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_top', cw1=50, rgb=(0.54,0.62,0.70), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Gradient Bottom:', al='right')
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_bottom', cw1=50, rgb=(0.1,0.1,0.1), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.setParent(prefix+'_columLayout_main')
  
  #
  pm.rowColumnLayout(nc=2, cw=([1,175], [2,25]) )
  pm.button(prefix+'_button_toggle_bkgd', l='Toggle Background', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Toggle between flat color and gradient background', command=lambda *args: camera.toggleBackground() )
  ci+=1
  pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Toggle Camera Background', 'from lct.src.core.lcUtility import Camera as camera\ncamera.toggleBackground()', iconBasePath+'toggleBackground.png', "Toggle Camera's Viewport Background") )

  #
  mainWindow.show()
  
  cam_populate_camera_list(cameraListDropdown)  
  cam_get_cam_attrs(cameraListDropdown)