Exemple #1
0
def ui():
    if pm.window(win, q=True, exists=True ): 
        pm.deleteUI(win)

    with pm.window(win, wh=[300,600], t=title):
        with pm.frameLayout( lv=False, cll=False, mw=1, mh=1):
            with pm.columnLayout(adj=True):
                with pm.tabLayout(tv=False):
                    with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False):
                        with pm.rowLayout(nc=3, adj=2):
                            pm.image( image = shelfIcon )
                            pm.text(l=' %s'%title, fn='boldLabelFont', align='left')
                            pm.image( image = alfredIcon )

                pm.separator( h=8, style='in')
                
                with pm.frameLayout(lv=False, cll=False, mw=0, mh=0, bv=False):
                    with pm.frameLayout(lv=False, cll=False, mw=3, mh=3, bv=False):

    # Scene -----------------------
                        with pm.frameLayout(l='Scene', cll=True, mw=3, mh=3 ):
                            with pm.columnLayout(adj=True):

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Reference Editor 2 : ', align='right', w=150)
                                    pm.button(label='Open UI...', w=180, en=False )   

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='File Traveler : ', align='right', w=150)
                                    pm.button(label='Open UI...', w=180, en=False ) 

    # Camera -----------------------
                        with pm.frameLayout(l='Camera', cll=True, mw=3, mh=3 ):
                            with pm.columnLayout(adj=True):

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Create Camera : ', align='right', w=150)
                                    with pm.columnLayout():
                                        pm.button(label='Create Turntable Camera', w=180, en=False )
                                        pm.button(label='Create Frustum Camera', w=180, en=False )
                                        pm.button(label='Create Stereo Camera', w=180, en=False )   

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Set Camera Playback Range : ', align='right', w=150)
                                    pm.button(label='set', c=pm.Callback( sm.setCamPlaybackRange ), w=180 )  
                                    
                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='HUD : ', align='right', w=150)
                                    pm.button(label='Scene Name HUD', w=180, en=False )

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Export Camera : ', align='right', w=150)
                                    pm.button(label='for After Effect...', w=180, en=False )
                                
    # Asset -----------------------
                        with pm.frameLayout(l='Asset', cll=True, mw=3, mh=3 ):
                            with pm.columnLayout(adj=True):
                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Toggle Display CharacterGeo : ', align='right', w=150)
                                    pm.button(label='( preview / render )', c=pm.Callback( sm.toggleDisplayCharacterGeo ), w=180 )
Exemple #2
0
    def __init__(self):
        if pm.window(win, q=True, exists=True ): 
            pm.deleteUI(win)

        with pm.window(win, wh=[300,600], t=title):
            with pm.frameLayout( lv=False, cll=False, mw=1, mh=1):
                with pm.formLayout() as mainForm:

                    # 상단 
                    with pm.tabLayout(tv=False) as top:
                        with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False):
                            with pm.rowLayout(nc=3, adj=2):
                                pm.image( image = shelf_icon )
                                pm.text(l='  %s'%title, fn='boldLabelFont', align='left')
                                pm.image( image = alfredIcon )
                   
                    #
                    # Contents start ===========================================================
                    # 중단
                    with pm.tabLayout(tv=False, scr=True, childResizable=True) as self.mid:
                        #with pm.columnLayout(adj=True):
                        with pm.frameLayout( lv=False, cll=False, mw=3, mh=3, bv=False):
                            uiContents()

                    #
                    # Contents end =============================================================
                    #
                    
                    # 하단
                    with pm.columnLayout(adj=True) as btm:
                        pm.helpLine()
       
            # 팝업메뉴
            # 왼쪽 마우스 클릭
            pm.popupMenu(button=1, p=top)
            pm.menuItem(l='Add To Shelf',  c=pm.Callback( self.addToShalf ) )

            # 오른쪽 마우스 클릭
            pm.popupMenu(button=3, p=top)
            pm.menuItem(l='Help', en=False )
           
            # 폼조정
            pm.formLayout( mainForm, e=True, 
                attachForm=[
                    (top, 'top', 3), 
                    (top, 'left', 3), 
                    (top, 'right', 3), 

                    (self.mid, 'left', 3), 
                    (self.mid, 'right', 3), 

                    (btm, 'left', 3), 
                    (btm, 'right', 3), 
                    (btm, 'bottom', 3),
                    ], 
                attachControl=[
                    (self.mid, 'top', 3, top), 
                    (self.mid, 'bottom', 0, btm)
                    ],
                )
Exemple #3
0
    def selectNextItem(self):
        '''
        '''
        if self.txt_jntCurrent.getLabel() == 'Select mouth lips loop':

            self.txt_jntCurrent.setLabel('Select left eyelid loop')
            fullRefPath = self.imageRefPath + "LT_eyeLidLoop.jpg"
            pm.image(self.img_jntReference, image=fullRefPath, e=True)

            # assign selection to placement_grp attr
            sel = pm.ls(sl=True, fl=True)
            self.placementGrp.addAttr('mouthLipsLoop', dt='stringArray')
            self.placementGrp.attr('mouthLipsLoop').set(len(sel),
                                                        *sel,
                                                        type='stringArray')
            pm.select(cl=True)

            placementGrp.addMouthLoopPlacements(self.placementGrp)

        elif self.txt_jntCurrent.getLabel() == 'Select left eyelid loop':
            # READY!
            self.txt_jntCurrent.setLabel('Ready to Build!')
            fullRefPath = self.imageRefPath + "default.jpg"
            pm.image(self.img_jntReference, image=fullRefPath, e=True)
            self.btn_jntScrollRt.setEnable(False)
            self.btn_updateLocs.setEnable(True)
            self.btn_buildRig.setEnable(True)
            pm.setToolTo('selectSuperContext')

            # assign selection to placement_grp attr
            sel = pm.ls(sl=True, fl=True)
            self.placementGrp.addAttr('leftEyelidLoop', dt='stringArray')
            self.placementGrp.attr('leftEyelidLoop').set(len(sel),
                                                         *sel,
                                                         type='stringArray')

            placementGrp.addEyeLoopPlacements(self.placementGrp)
            # override for mathilda
            # placementGrp.addEyeLoopPlacements(self.placementGrp, [23,15,9,3])
            # mathilda_override
            # pm.PyNode('LT_innerUpper_eyelid_pLoc').cv_id.set(18)

            placementGrp.addIndependentPlacers(self.placementGrp,
                                               self.indMapping)

            # align jaw pLoc
            cons = mc.aimConstraint('CT__mouthMover_pLoc',
                                    'CT__jaw_pLoc',
                                    aim=[0, 0, 1],
                                    u=[1, 0, 0],
                                    wu=[1, 0, 0])
            mc.delete(cons)

            pm.selectMode(object=True)
            mel.setObjectPickMask("Surface", False)

            placementGrp.snapPlacementsToMesh(self.placementGrp)
            placementGrp.mirrorAllPlacements(self.placementGrp)
            placementGrp.orientAllPlacements(self.placementGrp)
    def update_thumbnail_browser(self):
        self.widgets['thumbnails_brower'].clear()

        path = self.get_thumbnail_path()
        
        if path:
            for image in os.listdir(path):
                pm.image(image=os.path.join(path, image), w=100, h=100, parent=self.widgets['thumbnails_brower'])
                self.widgets['thumbnails_brower'].redistribute()
 def exitContext(self):
     '''
     '''
     pm.select(cl=True)
     pm.setToolTo('polySelectContext')
     fullRefPath = self.ui.imageRefPath + "CT__mouthLipLoop.jpg"
     pm.image(self.ui.img_jntReference, image=fullRefPath, e=True)
     self.ui.txt_jntCurrent.setLabel('Select mouth lips loop')
     
 def nextJoint(self):
     '''
     Calls UI to show the next joint's reference
     '''
     currentJointName, refPath = self.jointsList[self.jointIndex][:2]
     fullRefPath = self.ui.imageRefPath + r"%s.jpg" % refPath
     pm.image(self.ui.img_jntReference, image=fullRefPath, e=True)
     self.ui.txt_jntCurrent.setLabel(currentJointName)
     
     self.jointIndex += 1
Exemple #7
0
def MakeImage(imageFilePath, annotation=None):
    """
    Creates & returns a PyMel image UI component. 
    
    :param imageFilePath: full path to an image file.
    :param annotation: toolTip annotation, or None. 
    """
    if(annotation is None):
        return pm.image(image=imageFilePath)
    else:
        return pm.image(image=imageFilePath, annotation=annotation)
    def mainBody(self, path, mayaFalse):
        try:
            if pm.rowLayout(self.masterRow, exists=True, query=True):
                print 'yes'
                pm.deleteUI(self.masterRow, layout=True)
        except:
            print 'doesnt exist yet'

        print(os.listdir(path))
        self.fileList = [
            i for i in os.listdir(path)
            if os.path.isfile(os.path.join(path, i))
        ]
        self.masterRow = pm.rowLayout(width=600, nc=5, parent=self.masterCol)
        spacerCol = pm.columnLayout(width=25, parent=self.masterRow)
        col = pm.columnLayout(width=600, parent=self.masterRow)
        mainBox = pm.scrollLayout(horizontalScrollBarThickness=16,
                                  verticalScrollBarThickness=16,
                                  parent=col,
                                  width=500,
                                  height=600)
        self.radColle = pm.radioCollection()
        self.path = path
        #creating entry for each file
        for i in self.fileList:
            if '.ma' in i[-3:]:
                row1 = pm.rowLayout(i, nc=5, width=450, parent=mainBox)
                pm.image(image=str(path + '/' + i).rstrip('.ma') + '.png',
                         height=100,
                         width=100)
                column1 = pm.columnLayout(parent=row1)

                #writing a partial for command
                radioButtonChange = partial(self.fillSceneName, i)
                pm.radioButton(i,
                               label=i,
                               parent=column1,
                               onCommand=radioButtonChange,
                               annotation=path)

                radioSpacer = pm.rowLayout(nc=2)
                pm.text(label='',
                        width=16,
                        align='left',
                        parent=radioSpacer,
                        enable=False)
                pm.text('SER export',
                        label=u'comment コメント',
                        width=150,
                        height=20,
                        align='left',
                        parent=radioSpacer,
                        enable=False)
 def selectNextItem(self):
     '''
     '''
     if self.txt_jntCurrent.getLabel() == 'Select mouth lips loop':
         
         self.txt_jntCurrent.setLabel('Select left eyelid loop')
         fullRefPath = self.imageRefPath + "LT_eyeLidLoop.jpg"
         pm.image(self.img_jntReference, image=fullRefPath, e=True)
         
         # assign selection to placement_grp attr
         sel = pm.ls(sl=True, fl=True)
         self.placementGrp.addAttr('mouthLipsLoop', dt='stringArray')
         self.placementGrp.attr('mouthLipsLoop').set(len(sel), *sel, type='stringArray')
         pm.select(cl=True)
         
         placementGrp.addMouthLoopPlacements(self.placementGrp)
         
     elif self.txt_jntCurrent.getLabel() == 'Select left eyelid loop':
         # READY!
         self.txt_jntCurrent.setLabel('Ready to Build!')
         fullRefPath = self.imageRefPath + "default.jpg"
         pm.image(self.img_jntReference, image=fullRefPath, e=True)
         self.btn_jntScrollRt.setEnable(False)
         self.btn_updateLocs.setEnable(True)
         self.btn_buildRig.setEnable(True)
         pm.setToolTo('selectSuperContext')
         
         # assign selection to placement_grp attr
         sel = pm.ls(sl=True, fl=True)
         self.placementGrp.addAttr('leftEyelidLoop', dt='stringArray')
         self.placementGrp.attr('leftEyelidLoop').set(len(sel), *sel, type='stringArray')
         
         placementGrp.addEyeLoopPlacements(self.placementGrp)
         # override for mathilda
         # placementGrp.addEyeLoopPlacements(self.placementGrp, [23,15,9,3])
         # mathilda_override
         # pm.PyNode('LT_innerUpper_eyelid_pLoc').cv_id.set(18)
         
         placementGrp.addIndependentPlacers(self.placementGrp, self.indMapping)
         
         # align jaw pLoc
         cons = mc.aimConstraint('CT__mouthMover_pLoc', 'CT__jaw_pLoc',
                                 aim=[0,0,1], u=[1,0,0], wu=[1,0,0])
         mc.delete(cons)
         
         pm.selectMode(object=True)
         mel.setObjectPickMask("Surface", False)
         
         placementGrp.snapPlacementsToMesh(self.placementGrp)
         placementGrp.mirrorAllPlacements(self.placementGrp)
         placementGrp.orientAllPlacements(self.placementGrp)
Exemple #10
0
	def snapshot_show(index, *args):
		"""doc"""
		imgPath = cls.snapNull
		if cls.linked and os.listdir(cls.vsRepo) and pal_opMenu.getItemListLong() and ver_opMenu.getItemListLong():
			palName = pal_opMenu.getValue()
			version = pm.optionMenu(ver_opMenu, q= 1, v= 1)
			if palName and version:
				imgPath = cls.snapshotImgPath(palName, version, str(index+1))
				imgPath = imgPath if os.path.isfile(imgPath) else cls.snapNull
		pm.image(cls.img_snap, e= 1, i= imgPath)
		pm.button(cls.snapBtnn + str(index+1), e= 1, bgc= cls.snapShow)
		for i in range(5):
			if not i == index:
				pm.button(cls.snapBtnn + str(i+1), e= 1, bgc= cls.snapRest)
Exemple #11
0
def about():
    arutils.ui.generalUI.Generic.windowCheck('arUtilsAboutWin')
    aboutWin = pm.window('arUtilsAboutWin', t = 'arUtils', s = False, mxb = False, mnb = False)
    winLayout = pm.rowColumnLayout(nc = 2)

    text = '\n' + \
       '          arUtils 0.1.3\n\n' + \
       '\n' \
       '\n          Author: Rico Koschmitzky & Arvid Schneider' + \
       '\n          Mail: [email protected]' + \
       '\n          Acknowledgements: Justin Israel, Philipp Oeser' + \
       '\n\n'
    pm.text(al = 'left', l = text, p = winLayout)
    pm.image(p = winLayout, i = os.path.join(ICON_LOCATION, 'arUtilsSmallWhite.png'))
    aboutWin.show()
def ui():
    '''
    update : 2015-04-24
    '''
    if pm.window(win, q=True, exists=True ): 
        pm.deleteUI(win)

    with pm.window(win, wh=[300,600], t=title):
        with pm.frameLayout( lv=False, cll=False, mw=1, mh=1):
            with pm.formLayout() as mainForm:
                #with pm.columnLayout(adj=True)
                with pm.tabLayout(tv=False) as top:
                    with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False):
                        with pm.rowLayout(nc=3, adj=2):
                            pm.image( image = shelfIcon )
                            pm.text(l='  %s'%title, fn='boldLabelFont', align='left')
                            pm.image( image = alfredIcon )
               
                with pm.tabLayout(tv=False, scr=True, childResizable=True) as mid:                  
                    with pm.columnLayout(adj=True):
                        uiContents()

                #with pm.columnLayout(adj=True) as btm:
                #   pm.helpLine()

                with pm.horizontalLayout() as btm:         
                    pm.button()
                    pm.button()
                    pm.button()

    pm.formLayout( mainForm, e=True, 
        attachForm=[
            (top, 'top', 3), 
            (top, 'left', 3), 
            (top, 'right', 3), 

            (mid, 'left', 3), 
            (mid, 'right', 3), 

            (btm, 'left', 3), 
            (btm, 'right', 3), 
            (btm, 'bottom', 3),
            ], 
        attachControl=[
            (mid, 'top', 3, top), 
            (mid, 'bottom', 3, btm)            
            ]          
        )
Exemple #13
0
    def _add_header_image(self, parent_layout):
        """
        """
        # Creat rowLayout to hold out header image. This is done to get the proper
        #logo alignment and response to window size adjustments
        pm.rowLayout(height=50,
                     backgroundColor=[0.2, 0.2, 0.2],
                     numberOfColumns=2,
                     adjustableColumn=1,
                     columnAlign=(2, 'right'),
                     columnAttach=[(2, 'right', 5)],
                     rowAttach=[(2, 'top', 15)])
        pm.text('')
        pm.image(image=self.__LOGO_NAME)

        pm.setParent(parent_layout)
Exemple #14
0
def initPanel(cls):
    """doc"""
    global pal_opMenu
    global brn_opMenu

    if pm.optionMenu(pal_opMenu, q=1, ex=1):
        for item in pm.optionMenu(pal_opMenu, q=1, ill=1):
            pm.deleteUI(item)
    if pm.optionMenu(brn_opMenu, q=1, ex=1):
        for item in pm.optionMenu(brn_opMenu, q=1, ill=1):
            pm.deleteUI(item)

    pm.image(cls.img_snap, e=1, i=cls.snapNull)
    cls.snapshot_clear()

    cls.makePanel(cls.qsb_mode.isChecked())
Exemple #15
0
def guide_gui(filename, **kwargs):
    size_bool = kwargs.setdefault('full', False)
    if size_bool is True:
        image_path = get_file_path('images/'+filename)
        window = 'guide_gui'
        window_title = 'Guide'
        window_size = (450, 472)
        if py.window(window, exists=True):
            py.deleteUI(window, window=True)
        window_obj = py.window(window, title=window_title, widthHeight=window_size, sizeable=False)

        py.frameLayout('full_frame', label='Full Resolution Guide', p=window)
        py.image("full_guide", p='full_frame', w=450, h=472, i=image_path)
        py.showWindow(window)

    else:
        image_path = get_file_path('images/'+filename)
        py.image("guide", e=True, w=150, h=150, i=image_path)
Exemple #16
0
def about():
    arutils.ui.generalUI.Generic.windowCheck('arUtilsAboutWin')
    aboutWin = pm.window('arUtilsAboutWin',
                         t='arUtils',
                         s=False,
                         mxb=False,
                         mnb=False)
    winLayout = pm.rowColumnLayout(nc=2)

    text = '\n' + \
       '          arUtils 0.1.3\n\n' + \
       '\n' \
       '\n          Author: Rico Koschmitzky & Arvid Schneider' + \
       '\n          Mail: [email protected]' + \
       '\n          Acknowledgements: Justin Israel, Philipp Oeser' + \
       '\n\n'
    pm.text(al='left', l=text, p=winLayout)
    pm.image(p=winLayout,
             i=os.path.join(ICON_LOCATION, 'arUtilsSmallWhite.png'))
    aboutWin.show()
Exemple #17
0
def build_mimic_ui():
    """
    Builds main mimic UI and defines relationships between UI buttons/features
    and back-end functions
    :return:
    """
    mimic_win = create_mimic_window('mimic_win')

    # Create Main UI column
    pm.columnLayout(width=244, adj=True)

    # Add UI Header Image.
    robotImage = pm.image(image='mimic_logo.png', width=244, height=60)
    mimic_tab_layout = create_mimic_tabs()
    animate_tab_layout = build_animate_tab(mimic_tab_layout)
    program_tab_layout = build_program_tab(mimic_tab_layout)
    setup_tab_layout = build_setup_tab(mimic_tab_layout)
    external_tab_layout = build_external_tab(mimic_tab_layout)
    prefs_tab_layout = build_prefs_tab(mimic_win)

    tabs = [(animate_tab_layout, "Animate"),
            (program_tab_layout, "Program"),
            (setup_tab_layout, "Setup"),
            (external_tab_layout, "External"),
            (prefs_tab_layout, "Prefs")]

    assign_tabs(tabs, mimic_tab_layout)

    # Create output column
    outputColumn = pm.columnLayout('outputColumn', width=7, adj=True)
    outputForm = pm.formLayout()
    outputScrollField = pm.scrollField('programOutputScrollField',
                                       width=3,
                                       height=610)
    pm.formLayout(outputForm,
                  edit=True,
                  attachForm=[(outputScrollField, "top", 3),
                              (outputScrollField, "bottom", 3),
                              (outputScrollField, "left", 3),
                              (outputScrollField, "right", 3)])
    pm.setParent(mimic_win)
    pm.columnLayout('outputBarColumn', width=7)
    pm.separator(height=1, style='none')
    bullets = '\n'.join([unichr(0x2022) for _ in range(3)])
    pm.text(bullets,
            align='left',
            annotation='Drag edge to view Output Window!')

    # Launch UI window
    pm.window('mimic_win', height=560, width=245, edit=True)
    mimic_win.show()
Exemple #18
0
    def snapshot_take(self, index, *args):
        """
		Take snapshots before export.
		"""
        oriPath = pm.image(self.img_snap, q=1, i=1)
        tmpPath = self.snapshotTmp % (index + 1)
        if not os.path.isfile(tmpPath) or oriPath == tmpPath:
            if not os.path.exists(os.path.dirname(tmpPath)):
                os.mkdir(os.path.dirname(tmpPath))
            pm.refresh(cv=True, fe=self.snapshotExt, fn=tmpPath)
            snapImg = mTex.MQImage(tmpPath)
            snapImg = mTex.resizeImage(snapImg, self.snapSize, True)
            snapImg = mTex.extendImage(snapImg, self.snapSize, self.snapExtn)
            snapImg = mTex.paintTextWatermark(snapImg, str(index + 1),
                                              [20, 40], [10, 10, 10, 255])
            snapImg.save(tmpPath)
            pm.button(self.snapBtnn + str(index + 1), e=1, bgc=self.snapTake)
        else:
            pm.button(self.snapBtnn + str(index + 1), e=1, bgc=self.snapShow)
        pm.image(self.img_snap, e=1, i=tmpPath)
        for i in range(5):
            if not i == index:
                pm.button(self.snapBtnn + str(i + 1), e=1, bgc=self.snapRest)
Exemple #19
0
def initPanel(cls):
	"""doc"""
	global exp_opMenu
	global ver_opMenu
	global pal_opMenu
	global des_opMenu

	if pm.columnLayout(ver_opMenu, q= 1, ex= 1):
		pm.deleteUI(ver_opMenu)
	if pm.columnLayout(exp_opMenu, q= 1, ex= 1):
		pm.deleteUI(exp_opMenu)

	if pm.optionMenu(pal_opMenu, q= 1, ex= 1):
		for item in pm.optionMenu(pal_opMenu, q= 1, ill= 1):
				pm.deleteUI(item)
	if pm.optionMenu(des_opMenu, q= 1, ex= 1):
		for item in pm.optionMenu(des_opMenu, q= 1, ill= 1):
				pm.deleteUI(item)
		pm.menuItem('All descriptions', p= des_opMenu)

	pm.image(cls.img_snap, e= 1, i= cls.snapNull)
	cls.snapshot_clear()

	cls.makePanel(cls.qsb_mode.isChecked())
Exemple #20
0
def locator_placement_gui():
    window = 'locator_placement_prompt'
    window_title = 'ecFaceSetup'
    window_size = (337, 245)
    button_width = 130
    if py.window(window, exists=True):
        py.deleteUI(window, window=True)
    if py.window('guide_gui', exists=True):
        py.deleteUI('guide_gui', window=True)
    if py.window('offset_gui', exists=True):
        py.deleteUI('offset_gui', window=True)

    window_obj = py.window(window, title=window_title, widthHeight=window_size, menuBar=True, sizeable=False)
    menu = py.menu('File', p=window_obj)
    py.menuItem('Reset All', p=menu, command=py.Callback(reset_locators, 'all'))
    py.menuItem(divider=True, p=menu)
    mirror = py.menuItem('Mirroring', p=menu, subMenu=True)
    py.menuItem('Mirror All', p=mirror, command=py.Callback(mirror_locators, filename='all'))
    py.menuItem(divider=True, p=menu)
    py.menuItem('Mirror Upper Eyes', p=mirror, command=py.Callback(mirror_locators, filename='up_eye'))
    py.menuItem('Mirror Lower Eyes', p=mirror, command=py.Callback(mirror_locators, filename='low_eye'))
    py.menuItem('Mirror Cheek', p=mirror, command=py.Callback(mirror_locators, filename='cheek'))
    py.menuItem('Mirror Upper Lip', p=mirror, command=py.Callback(mirror_locators, filename='up_mouth'))
    py.menuItem('Mirror Lower Lip', p=mirror, command=py.Callback(mirror_locators, filename='low_mouth'))
    py.menuItem('Remove Mirroring', p=mirror, command=py.Callback(mirror_locators, unmirror=True))
    py.menuItem(divider=True, p=menu)
    py.menuItem('Delete Everything', p=menu, command=py.Callback(delete_locators))
    py.menuItem(divider=True, p=menu)

    py.columnLayout('god_column', p=window)
    py.rowLayout('master_row', numberOfColumns=5, p='god_column')
    py.columnLayout('master_column', p='master_row', cat=('left', 0))
    py.rowLayout('jaw_row', p='master_column', numberOfColumns=3)
    jaw_btn = py.button('jaw_btn', label='Place Head Locators', w=button_width,  p='jaw_row',
              command=(py.Callback(show_group, 'head_locator_grp')))
    jaw_menu = py.popupMenu('jaw_menu', p=jaw_btn, ctl=False, button=3)
    py.menuItem('Reset Locators', p=jaw_menu, command=py.Callback(reset_locators, 'head_locator_grp'))
    py.button('jaw_guide_button', label='Guide', p='jaw_row', command=py.Callback(guide_gui, 'jaw_head.png', full=True))

    py.rowLayout('u_eye_row', p='master_column', numberOfColumns=3)
    u_eye_btn = py.button('u_eye_btn', label='Place Upper Eye Locators', w=button_width,  p='u_eye_row',
              command=(py.Callback(show_group, 'up_eye_locator_grp')))
    u_eye_menu = py.popupMenu('u_eye_menu', p=u_eye_btn, ctl=False, button=3)
    py.menuItem('Reset Locators', p=u_eye_menu, command=py.Callback(reset_locators, 'up_eye_locator_grp'))
    py.button('u_eye_guide_button', label='Guide', p='u_eye_row', command=py.Callback(guide_gui, 'upeye.png', full=True))

    py.rowLayout('l_eye_row', p='master_column', numberOfColumns=3)
    l_eye_btn = py.button('l_eye_btn', label='Place Lower Eye Locators', w=button_width,  p='l_eye_row',
              command=(py.Callback(show_group, 'low_eye_locator_grp')))
    l_eye_menu = py.popupMenu('l_eye_menu', p=l_eye_btn, ctl=False, button=3)
    py.menuItem('Reset Locators', p=l_eye_menu, command=py.Callback(reset_locators, 'low_eye_locator_grp'))
    py.button('l_eye_guide_button', label='Guide', p='l_eye_row', command=py.Callback(guide_gui, 'loweye.png', full=True))

    py.rowLayout('cheek_row', p='master_column', numberOfColumns=3)
    cheek_btn = py.button('cheek_btn', label='Place Cheek Locators', w=button_width,  p='cheek_row',
              command=(py.Callback(show_group, 'cheek_locator_grp')))
    cheek_menu = py.popupMenu('cheek_menu', p=cheek_btn, ctl=False, button=3)
    py.menuItem('Reset Locators', p=cheek_menu, command=py.Callback(reset_locators, 'cheek_locator_grp'))
    py.button('cheek_guide_button', label='Guide', p='cheek_row', command=py.Callback(guide_gui, 'cheek.png', full=True))

    py.rowLayout('u_lip_row', p='master_column', numberOfColumns=3)
    u_lip_btn = py.button('u_lip_btn', label='Place Upper Lip Locators', w=button_width,  p='u_lip_row',
              command=(py.Callback(show_group, 'up_lip_locator_grp')))
    u_lip_menu = py.popupMenu('u_lip_menu', p=u_lip_btn, ctl=False, button=3)
    py.menuItem('Reset Locators', p=u_lip_menu, command=py.Callback(reset_locators, 'up_lip_locator_grp'))
    py.button('u_guide_btn', label='Guide', p='u_lip_row', command=py.Callback(guide_gui, 'upmouth.png', full=True))

    py.rowLayout('l_lip_row', p='master_column', numberOfColumns=3)
    l_lip_btn = py.button('l_lip_btn', label='Place Lower Lip Locators', w=button_width,  p='l_lip_row',
              command=(py.Callback(show_group, 'low_lip_locator_grp')))
    l_lip_menu = py.popupMenu('l_lip_menu', p=l_lip_btn, ctl=False, button=3)
    py.menuItem('Reset Locators', p=l_lip_menu, command=py.Callback(reset_locators, 'low_lip_locator_grp'))
    py.button('l_guide_button', label='Guide', p='l_lip_row', command=py.Callback(guide_gui, 'lowmouth.png', full=True))

    py.rowLayout('slider_row', p='master_column', numberOfColumns=3)
    py.text('Locator Scale   ', p='slider_row')
    py.floatSlider('locator_scale', min=.5, max=50, value=1, step=1, p='slider_row')

    py.frameLayout('image_frame', label='Guide Preview', p='master_row')
    py.image("guide", p='image_frame', w=150, h=150, dgc=(py.Callback(guide_gui, 'open')))

    py.rowColumnLayout('final_row', p='god_column')
    py.button('show_all_button', label='Show All', p='final_row', width=window_size[0]-5,
              command=py.Callback(show_group, 'all'))
    py.button('confirm_button', label='Confirm', p='final_row', width=window_size[0]-5,
              command=py.Callback(joint_creation))
    con.connect_locators()
    py.showWindow(window)
Exemple #21
0
    def showUI(self):
        """doc"""

        if pm.window(self.uiName, q=1, ex=1):
            pm.deleteUI(self.uiName)

        # make window
        pm.window(self.uiName,
                  t=__uititle__,
                  s=0,
                  mxb=0,
                  mnb=0,
                  cc=self.saveLastStatus)
        # main column
        self.col_main = pm.columnLayout(adj=1)

        # top banner
        # main
        pm.columnLayout(adj=1, bgc=[.22, .22, .22])
        pm.text(l='', h=3)
        self.txt_ban1 = pm.text(l='XGen Hub')
        QBannerTxt1 = mqt.convert(self.txt_ban1)
        QBannerTxt1.setStyleSheet('QObject {font: bold 12px; color: #121212;}')
        pm.text(l='', h=3)
        pm.setParent('..')
        # sub
        pm.rowLayout(nc=5, adj=3)
        pm.text(l='', w=8)
        self.btn_prev = pm.iconTextButton(i='SP_FileDialogBack_Disabled.png',
                                          c=partial(self.switchMode, False))
        pm.columnLayout(adj=1, h=33)
        self.txt_ban2 = pm.text(l=self.MODE)
        QBannerTxt2 = mqt.convert(self.txt_ban2)
        QBannerTxt2.setStyleSheet('QObject {font: bold 22px; color: #666666;}')
        pm.setParent('..')
        self.btn_next = pm.iconTextButton(
            i='SP_FileDialogForward_Disabled.png',
            c=partial(self.switchMode, True))
        pm.text(l='', w=8)
        pm.setParent('..')

        # ----------
        pm.text(l='', h=4)
        pm.separator()
        pm.text(l='', h=2)

        # XGenHub Repository Root
        pm.columnLayout(adj=1, cal='left')
        pm.text(l='  - XGenHub Repository Root', h=22)
        pm.rowLayout(nc=2, adj=1)
        self.txf_repo = pm.textField(text=self.projPath, ed=False)
        self.btn_link = pm.iconTextButton(i='syncOn.png',
                                          w=20,
                                          h=20,
                                          c=self.linkRepoDir)
        pm.setParent('..')

        # Action Mode
        self.col_acts = pm.columnLayout(w=257, h=57)
        pm.setParent('..')

        # ----------
        pm.text(l='', h=6)
        pm.separator()
        pm.text(l='', h=4)

        # operation panel
        self.col_oper = pm.columnLayout(w=257, h=92)
        pm.setParent('..')

        # snapshot panel
        pm.columnLayout(adj=1, cal='center')
        pm.text(l='  [ Snapshots ]  ', h=20)
        pm.columnLayout(adj=1, h=142, cal='center')
        self.img_snap = pm.image(i=self.snapNull)
        pm.setParent('..')
        pm.text(l='', h=2)
        pm.rowLayout(nc=5)
        for i in range(5):
            pm.button(self.snapBtnn + str(i + 1), l=str(i + 1), w=49)
        pm.setParent('..')
        pm.setParent('..')
        pm.setParent('..')

        # ----------
        pm.text(l='', h=4)
        pm.separator()
        pm.text(l='', h=2)

        # execute button
        pm.columnLayout(adj=1)
        self.proc_btn = pm.button(l='P R O C E E D',
                                  h=45,
                                  bgc=[0.25, 0.46, 0.49])
        pm.setParent('..')

        # main column END
        pm.setParent('..')

        self.initMode()

        pm.window(self.uiName, e=1, w=self.uiWidth, h=self.uiHeight)
        pm.showWindow(self.uiName)
Exemple #22
0
 def __init__(self, baseFilePath, placerMapping, indMapping, meshNames):
     '''
     create UI and init vars
     '''
     self.imageRefPath = baseFilePath
     self.placerMapping = placerMapping
     self.indMapping = indMapping
     self.mesh = meshNames['face']
     self.lf_eye = meshNames['leftEye']
     self.rt_eye = meshNames['rightEye']
     self.locTweakWidgets = {}
     self.placementGrp = None
     
     with pm.menu(l='Options') as menuOptions:
         pm.menuItem(l='Refresh')
         pm.menuItem(l='Reset')
     
     with pm.menu(l='Help') as menuHelp:
         pm.menuItem(l='Documentation')
         pm.menuItem(l='About')
     
     with pm.tabLayout() as mainTab:
         
         with pm.columnLayout(adj=True) as geoSelectionLayout:
             pass
         
         with pm.columnLayout(adj=True) as jntPlacementLayout:
         
             with pm.verticalLayout(ratios=(1,10,1), spacing=10) as jntPlacementVertLayout:
                 
                 #self.chk_symmetry = pm.checkBox(l='Symmetry', v=True)
                 with pm.horizontalLayout() as startPlacementLayout:
                     self.btn_startJntPlacement = pm.button(l='Start Joint Placement', 
                                                            c=pm.Callback(self.startJointPlacement),
                                                            w=180)
                 
                 self.img_jntReference = pm.image(image=self.imageRefPath+'default.jpg')
             
                 with pm.rowLayout(numberOfColumns=3, adj=2) as jntRowLayout:
                     self.btn_jntScrollLt = pm.button(l='<<', w=40, en=False)
                     self.txt_jntCurrent = pm.text(label='Click "Start Joint Placement" above to begin.', align='center')
                     self.btn_jntScrollRt = pm.button(l='>>', w=40, c=pm.Callback(self.selectNextItem), en=False)
             
             pm.separator(style='in')
             
             with pm.horizontalLayout(ratios=(1,5), spacing=5):
                 
                 with pm.verticalLayout():
                     # left labels
                     self.locTweakWidgets['txt_position'] = pm.text(label='Position', 
                                                                    align='right', en=False)
                     self.locTweakWidgets['txt_orient'] = pm.text(label='Orient', 
                                                                    align='right', en=False)
                     self.locTweakWidgets['txt_scale'] = pm.text(label='Scale', 
                                                                    align='right', en=False)
                     self.locTweakWidgets['txt_mirror'] = pm.text(label='Mirror', 
                                                                    align='right', en=False)
                 with pm.verticalLayout():
                     # right buttons
                     with pm.horizontalLayout():
                         self.locTweakWidgets['btn_prevCV'] = pm.button(l='Prev CV', en=False,
                                                                        c=pm.Callback(self.stepCV, -1))
                         self.locTweakWidgets['btn_nextCV'] = pm.button(l='Next CV', en=False,
                                                                        c=pm.Callback(self.stepCV, 1))
                         self.locTweakWidgets['btn_snapToVtx'] = pm.button(l='Snap to Vtx', en=False)
                         self.locTweakWidgets['btn_user'] = pm.button(l='User', en=False)
                         
                     with pm.horizontalLayout():
                         self.locTweakWidgets['btn_normal'] = pm.button(l='Normal', en=False)
                         self.locTweakWidgets['btn_normal_yup'] = pm.button(l='Normal + Y-up', en=False)
                         self.locTweakWidgets['btn_world'] = pm.button(l='World', en=False)
                         self.locTweakWidgets['btn_orient_user'] = pm.button(l='User', en=False)
                         
                     with pm.horizontalLayout():
                         self.locTweakWidgets['float_scale'] = pm.floatSliderGrp(f=True,
                                                                 min=0.01, max=1.0, v=0.5,
                                                             pre=2, fmx=10.0, en=False,
                                                             dc=pm.Callback(self.editLocScale))
                     with pm.horizontalLayout():
                         self.locTweakWidgets['btn_mirLtToRt'] = pm.button(l='Left to Right', en=False,
                                                                           c=pm.Callback(self.mirrorLocs))
                         self.locTweakWidgets['btn_mirRtToLt'] = pm.button(l='Right to Left', en=False)
             
             pm.separator(style='in')
             
             
             
             with pm.verticalLayout(spacing=5) as buildRigVertLayout:
                 self.btn_updateLocs = pm.button(l='Update All Locators', en=False)
                 self.btn_buildRig = pm.button(l='Build Rig', c=pm.Callback(self.buildRig), en=False)
         
         with pm.columnLayout(adj=True) as deformationLayout:
             pass
         
         with pm.columnLayout(adj=True) as motionLayout:
             pass
         
         with pm.columnLayout(adj=True) as actionsLayout:
             pass
             
     mainTab.setTabLabel((geoSelectionLayout,'Geometry'))
     mainTab.setTabLabel((jntPlacementLayout,'Joints'))
     mainTab.setTabLabel((deformationLayout,'Deformation'))
     mainTab.setTabLabel((motionLayout,'Motion'))
     mainTab.setTabLabel((actionsLayout,'Action Units'))
     mainTab.setSelectTab(jntPlacementLayout)
     
     self.show()
Exemple #23
0
def UI():
    
    # kill window if it already exists
    if pm.window('varFkUI', exists = True):
        pm.deleteUI('varFkUI')
    
    # build window
    varFkWindow = pm.window('varFkUI', title = 'Variable Fk Rigger', widthHeight=(365.0, 340.0), sizeable=False, minimizeButton=True, maximizeButton=False)
    
    # create tabLayout
    tabs = pm.tabLayout(imw = 5, imh = 5)
    
    # create tabs
    form = pm.formLayout(numberOfDivisions=100, w = 365, h = 340, parent = tabs)
    pm.tabLayout(tabs, edit = True, tabLabel = (form, 'VarFk Rigger'))
    info = pm.formLayout(numberOfDivisions=100, w = 365, h = 340, parent = tabs)
    pm.tabLayout(tabs, edit = True, tabLabel = (info, 'Help'))
    
    # fill info tab
    pm.setParent ( info )
    
    # Creating Element scrollField_info
    infotext = 'Variable FK Autorigger \nVersion: 1.00 \nby Julian "fleity" Oberbeck. \n\nBasic variable FK concept by Jeff Brodsky (https://vimeo.com/72424469). \n\n\nVariable FK Rigs allow moving a FK-control along a joint chain, their influence being based on the distance to the joints. \n\n How to use: \n 1. Insert the name of the input curve. \n 2. Enter a name for the rig. \n 3. Choose number of controls. \n 4. Press "Build."'

    # Creating Element scrollField_infotext
    scrollField_infotext = pm.scrollField ( text = infotext, w = 340, h = 295, editable = False, wordWrap = True )
    pm.formLayout( info, edit=True, attachForm=[( scrollField_infotext, 'top', 10), ( scrollField_infotext, 'left', 10)] )

    # fill main utility tab
    pm.setParent( form )
    
    # Creating Element img_banner
    imagePath = pm.internalVar(upd = True) + '/icons/varFk.png' # old
    imagePath = '/'.join( __file__.split('\\')[:-1] ) + '/varFk.png'
    img_banner = pm.image( w = 365, h = 110, image = imagePath )
    pm.formLayout( form, edit=True, attachForm=[( img_banner, 'top', 0), ( img_banner, 'left', -5)] )
    # =========================================
    # Creating Element layout_curve_tools
    shelfLayout_curveTools = pm.shelfTabLayout( 'shelfCurves', w = 225, h = 50, tabsVisible = False )
    pm.setParent( shelfLayout_curveTools )
    pm.formLayout( form, edit=True, attachForm=[( shelfLayout_curveTools, 'top', 97), ( shelfLayout_curveTools, 'left', 70)] )
    rowLayout_curveTools = pm.rowLayout( 'rowLayout_curveTools', w = 200, h = 45, numberOfColumns = 4, cw4 = [40,40,40,40], ct4 = ['left', 'left', 'left', 'left'], co4 = [10,10,10,10] )
    pm.setParent( rowLayout_curveTools )
    # =========================================
    # Creating Elements curve tool buttons
    button_CVCurveTool = pm.iconTextButton( 'button_CVCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'curveCV.png', command = pm.Callback(pm.runtime.CVCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.CVCurveToolOptions, ) )
    button_EPCurveTool = pm.iconTextButton( 'button_EPCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'curveEP.png', command = pm.Callback(pm.runtime.EPCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.EPCurveToolOptions, ) )
    button_PencilCurveTool = pm.iconTextButton( 'button_PencilCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'pencil.png', command = pm.Callback(pm.runtime.PencilCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.PencilCurveToolOptions, ) )
    button_BezierCurveTool = pm.iconTextButton( 'button_BezierCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'curveBezier.png', command = pm.Callback(pm.runtime.CreateBezierCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.CreateBezierCurveToolOptions, ) )
    # =========================================
    pm.setParent( form )
    # =========================================
    # Creating Element button_insertSelectedCurve
    button_insertSelectedCurve = pm.button( label='>', w=35, h=25, command=pm.Callback(insertFirstSelected, ) )
    pm.formLayout( form, edit=True, attachForm=[( button_insertSelectedCurve, 'top', 155), ( button_insertSelectedCurve, 'left', 55)] )
    # =========================================    
    # Creating Element input_inputCurve
    input_inputCurve = pm.textField('input_inputCurve', text='Draw a curve, 1 Joint per CV.', w=250, h=25)
    pm.formLayout( form, edit=True, attachForm=[( input_inputCurve, 'top', 155), ( input_inputCurve, 'left', 100)] )
    # =========================================
    # Creating Element text_IdName
    text_IdName = pm.text( label='Prefix Name:', align='right', recomputeSize=True, w=80, h=25)
    pm.formLayout( form, edit=True, attachForm=[( text_IdName, 'top', 190), ( text_IdName, 'left', 10)] )
    # =========================================
    # Creating Element input_IdName
    input_IdName = pm.textField('input_IdName', text='varFk', w=250, h=25)
    pm.formLayout( form, edit=True, attachForm=[( input_IdName, 'top', 190), ( input_IdName, 'left', 100)] )    
    # =========================================    
    # Creating Element text_numOfCtrls
    text_numOfCtrls = pm.text( label='# of Controls:', align='right', recomputeSize=True, w=80, h=25)
    pm.formLayout( form, edit=True, attachForm=[( text_numOfCtrls, 'top', 225), ( text_numOfCtrls, 'left', 10)] )
    # =========================================
    # Creating Element slider_numOfCtrls
    slider_numOfCtrls = pm.intSliderGrp('slider_numOfCtrls', f=True, min=1, max=10, fieldMinValue=1,fieldMaxValue=999, value=3, ann='Number of Controls', w=255, h=25)
    pm.formLayout( form, edit=True, attachForm=[( slider_numOfCtrls, 'top', 225), ( slider_numOfCtrls, 'left', 100)] )
    # =========================================
    # Creating Element button_build
    button_build = pm.button( label='Build', w=340, h=40, command = pm.Callback(buildVarFkFromUI, ))
    pm.formLayout( form, edit=True, attachForm=[( button_build, 'top', 265), ( button_build, 'left', 10)] )
    # =========================================
    
    pm.setParent( '..' )    

    # show window
    varFkWindow.show()
Exemple #24
0
    def build_ui(self):
        """builds the ui window"""

        tool_window = pm.window(self.window_id,
                                title="scalist",
                                width=368,
                                height=295,
                                mnb=True,
                                mxb=True,
                                sizeable=True)
        main_layout = pm.rowColumnLayout(w=368, h=295)

        # get the header image from the user's prefs
        imagePath = pm.internalVar(upd=True) + "icons/scalist.png"
        pm.image(w=225, h=75, image=imagePath)

        # scale amount slider
        user_scale = pm.floatSliderGrp(label='Amount',
                                       field=True,
                                       precision=2,
                                       width=363,
                                       minValue=-2.0,
                                       maxValue=5.0,
                                       v=1.0,
                                       fieldMinValue=-10.0,
                                       fieldMaxValue=10.0)

        # scale preset buttons
        btn_layout = pm.rowColumnLayout(nc=11)

        btn_1 = pm.button(label='-1',
                          w=33,
                          bgc=self.rgb([231, 205, 59]),
                          c=pm.Callback(self.update_slider, user_scale, -1))
        btn_2 = pm.button(label='.25',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.25))
        btn_3 = pm.button(label='.50',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.5))
        btn_4 = pm.button(label='.75',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.75))
        btn_5 = pm.button(label='.90',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.9))
        btn_6 = pm.button(label='reset',
                          w=33,
                          bgc=self.rgb([231, 205, 59]),
                          c=pm.Callback(self.update_slider, user_scale, 1.0))
        btn_7 = pm.button(label='1.1',
                          w=33,
                          bgc=self.rgb([215, 215, 215]),
                          c=pm.Callback(self.update_slider, user_scale, 1.1))
        btn_8 = pm.button(label='1.25',
                          w=33,
                          bgc=self.rgb([215, 215, 215]),
                          c=pm.Callback(self.update_slider, user_scale, 1.25))
        btn_9 = pm.button(label='1.5',
                          w=33,
                          bgc=self.rgb([215, 215, 215]),
                          c=pm.Callback(self.update_slider, user_scale, 1.5))
        btn_10 = pm.button(label='1.75',
                           w=33,
                           bgc=self.rgb([215, 215, 215]),
                           c=pm.Callback(self.update_slider, user_scale, 1.75))
        btn_11 = pm.button(label='x2',
                           w=33,
                           bgc=self.rgb([231, 205, 59]),
                           c=pm.Callback(self.update_slider, user_scale, 2.0))

        # headers
        pm.setParent(main_layout)
        pm.separator(style='none', h=5)
        categories = pm.rowColumnLayout(nc=3)
        pm.text(label='Value',
                w=177,
                font='boldLabelFont',
                bgc=self.rgb([231, 205, 59]))
        pm.separator(style='single', w=10)
        pm.text(label='Time',
                w=179,
                font='boldLabelFont',
                bgc=self.rgb([20, 20, 20]))
        pm.separator(style='none', h=5)
        pm.separator(style='single', w=10)
        pm.separator(style='none', h=5)

        # pivot buttons
        pm.setParent('..')
        pivot_buttons = pm.rowColumnLayout(nc=5)
        pb1 = pm.button(label='Mid',
                        w=88,
                        annotation='Scaled from midpoint value of curve',
                        bgc=self.rgb([215, 215, 215]),
                        command=pm.Callback(do_scale, 'pivot_middle_value',
                                            user_scale, 'scale_keys_value'))
        pb2 = pm.button(label='Multi',
                        w=89,
                        annotation='Each curve scaled from its own midpoint',
                        bgc=self.rgb([45, 45, 45]),
                        command=pm.Callback(do_scale, 'pivot_middle_value',
                                            user_scale,
                                            'scale_keys_value_multi'))
        pm.separator(style='single', w=10)
        pb3 = pm.button(label='First',
                        w=87,
                        annotation='Scaled from first frame of selection',
                        bgc=self.rgb([120, 120, 120]),
                        command=pm.Callback(do_scale, 'pivot_first_time',
                                            user_scale, 'scale_keys_time'))
        pb4 = pm.button(label='Multi',
                        w=88,
                        annotation='Each curve scaled from its first frame',
                        bgc=self.rgb([45, 45, 45]),
                        command=pm.Callback(do_scale, 'pivot_first_time',
                                            user_scale,
                                            'scale_keys_time_multi'))
        pb5 = pm.button(
            label='Highest',
            w=87,
            annotation='Scaled from the highest key value selected',
            bgc=self.rgb([215, 215, 215]),
            command=pm.Callback(do_scale, 'pivot_highest_value', user_scale,
                                'scale_keys_value'))
        pb6 = pm.button(
            label='Multi',
            w=88,
            annotation='Each curve scaled from its highest selected key',
            bgc=self.rgb([45, 45, 45]),
            command=pm.Callback(do_scale, 'pivot_highest_value', user_scale,
                                'scale_keys_value_multi'))
        pm.separator(style='single', w=10)
        pb7 = pm.button(label='Last',
                        w=89,
                        annotation='Scaled from last frame of selection',
                        bgc=self.rgb([120, 120, 120]),
                        command=pm.Callback(do_scale, 'pivot_last_time',
                                            user_scale, 'scale_keys_time'))
        pb8 = pm.button(label='Multi',
                        w=88,
                        annotation='Each curve scaled from its last frame',
                        bgc=self.rgb([45, 45, 45]),
                        command=pm.Callback(do_scale, 'pivot_last_time',
                                            user_scale,
                                            'scale_keys_time_multi'))
        pb9 = pm.button(label='Lowest',
                        w=87,
                        annotation='Scaled from the lowest key value selected',
                        bgc=self.rgb([215, 215, 215]),
                        command=pm.Callback(do_scale, 'pivot_lowest_value',
                                            user_scale, 'scale_keys_value'))
        pb10 = pm.button(
            label='Multi',
            w=88,
            annotation='Each curve scaled from its lowest selected key',
            bgc=self.rgb([45, 45, 45]),
            command=pm.Callback(do_scale, 'pivot_lowest_value', user_scale,
                                'scale_keys_value_multi'))
        pm.separator(style='single', w=10)
        pb11 = pm.button(
            label='Current',
            w=89,
            annotation='Scaled from the current frame in timerange',
            bgc=self.rgb([120, 120, 120]),
            command=pm.Callback(do_scale, 'pivot_current_time', user_scale,
                                'scale_keys_time'))
        pm.separator(style='none')
        pb12 = pm.button(label='0',
                         w=87,
                         annotation='Scaled from 0',
                         bgc=self.rgb([215, 215, 215]),
                         command=pm.Callback(do_scale, 'pivot_zero_value',
                                             user_scale, 'scale_keys_value'))
        pm.separator(style='none')
        pm.separator(style='single', w=10)
        pb13 = pm.button(
            label='Last Selected',
            w=89,
            annotation='Scaled in time from the last selected key frame',
            bgc=self.rgb([120, 120, 120]),
            command=pm.Callback(do_scale, 'pivot_last_selected_time',
                                user_scale, 'scale_keys_time'))
        pm.separator(style='none')
        pb14 = pm.button(
            label='Last Selected',
            w=87,
            annotation='Scaled in value from the last selected key',
            bgc=self.rgb([215, 215, 215]),
            command=pm.Callback(do_scale, 'pivot_last_selected_value',
                                user_scale, 'scale_keys_value'))
        pm.separator(style='none')
        pm.separator(style='single', w=10)
        pm.separator(style='in')
        pm.separator(style='in')
        pb15 = pm.button(
            label='First',
            w=87,
            annotation='Each curve selected from its earliest selected key',
            bgc=self.rgb([215, 215, 215]),
            command=pm.Callback(do_scale, 'pivot_first_value', user_scale,
                                'scale_keys_value_multi'))
        pm.separator(style='none')
        pm.separator(style='single', w=10)

        pb16 = pm.button(
            label='Flip Mid',
            w=77,
            annotation='Flip each selected curve along its midpoint value',
            bgc=self.rgb([231, 205, 59]),
            command=pm.Callback(do_scale, 'pivot_flip_curve_value', user_scale,
                                'scale_keys_value_multi'))

        pb17 = pm.button(label='Flip 0',
                         w=77,
                         annotation='Flip each selected curve over 0',
                         bgc=self.rgb([231, 205, 59]),
                         command=pm.Callback(do_scale, 'pivot_flip_zero_value',
                                             user_scale, 'scale_keys_value'))

        pm.setParent('..')
        pm.separator(h=10, style='in')

        pm.showWindow(tool_window)
Exemple #25
0
def UI():

    # kill window if it already exists
    if pm.window('varFkUI', exists=True):
        pm.deleteUI('varFkUI')

    # build window
    varFkWindow = pm.window('varFkUI',
                            title='Variable Fk Rigger',
                            widthHeight=(365.0, 340.0),
                            sizeable=False,
                            minimizeButton=True,
                            maximizeButton=False)

    # create tabLayout
    tabs = pm.tabLayout(imw=5, imh=5)

    # create tabs
    form = pm.formLayout(numberOfDivisions=100, w=365, h=340, parent=tabs)
    pm.tabLayout(tabs, edit=True, tabLabel=(form, 'VarFk Rigger'))
    info = pm.formLayout(numberOfDivisions=100, w=365, h=340, parent=tabs)
    pm.tabLayout(tabs, edit=True, tabLabel=(info, 'Help'))

    # fill info tab
    pm.setParent(info)

    # Creating Element scrollField_info
    infotext = 'Variable FK Autorigger \nVersion: 1.00 \nby Julian "fleity" Oberbeck. \n\nBasic variable FK concept by Jeff Brodsky (https://vimeo.com/72424469). \n\n\nVariable FK Rigs allow moving a FK-control along a joint chain, their influence being based on the distance to the joints. \n\n How to use: \n 1. Insert the name of the input curve. \n 2. Enter a name for the rig. \n 3. Choose number of controls. \n 4. Press "Build."'

    # Creating Element scrollField_infotext
    scrollField_infotext = pm.scrollField(text=infotext,
                                          w=340,
                                          h=295,
                                          editable=False,
                                          wordWrap=True)
    pm.formLayout(info,
                  edit=True,
                  attachForm=[(scrollField_infotext, 'top', 10),
                              (scrollField_infotext, 'left', 10)])

    # fill main utility tab
    pm.setParent(form)

    # Creating Element img_banner
    imagePath = pm.internalVar(upd=True) + '/icons/varFk.png'
    img_banner = pm.image(w=365, h=110, image=imagePath)
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(img_banner, 'top', 0),
                              (img_banner, 'left', -5)])
    # =========================================
    # Creating Element layout_curve_tools
    shelfLayout_curveTools = pm.shelfTabLayout('shelfCurves',
                                               w=225,
                                               h=50,
                                               tabsVisible=False)
    pm.setParent(shelfLayout_curveTools)
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(shelfLayout_curveTools, 'top', 97),
                              (shelfLayout_curveTools, 'left', 70)])
    rowLayout_curveTools = pm.rowLayout('rowLayout_curveTools',
                                        w=200,
                                        h=45,
                                        numberOfColumns=4,
                                        cw4=[40, 40, 40, 40],
                                        ct4=['left', 'left', 'left', 'left'],
                                        co4=[10, 10, 10, 10])
    pm.setParent(rowLayout_curveTools)
    # =========================================
    # Creating Elements curve tool buttons
    button_CVCurveTool = pm.iconTextButton(
        'button_CVCurveTool',
        w=40,
        h=40,
        mw=2,
        mh=2,
        image='curveCV.png',
        command=pm.Callback(pm.runtime.CVCurveTool, ),
        doubleClickCommand=pm.Callback(pm.runtime.CVCurveToolOptions, ))
    button_EPCurveTool = pm.iconTextButton(
        'button_EPCurveTool',
        w=40,
        h=40,
        mw=2,
        mh=2,
        image='curveEP.png',
        command=pm.Callback(pm.runtime.EPCurveTool, ),
        doubleClickCommand=pm.Callback(pm.runtime.EPCurveToolOptions, ))
    button_PencilCurveTool = pm.iconTextButton(
        'button_PencilCurveTool',
        w=40,
        h=40,
        mw=2,
        mh=2,
        image='pencil.png',
        command=pm.Callback(pm.runtime.PencilCurveTool, ),
        doubleClickCommand=pm.Callback(pm.runtime.PencilCurveToolOptions, ))
    button_BezierCurveTool = pm.iconTextButton(
        'button_BezierCurveTool',
        w=40,
        h=40,
        mw=2,
        mh=2,
        image='curveBezier.png',
        command=pm.Callback(pm.runtime.CreateBezierCurveTool, ),
        doubleClickCommand=pm.Callback(
            pm.runtime.CreateBezierCurveToolOptions, ))
    # =========================================
    pm.setParent(form)
    # =========================================
    # Creating Element button_insertSelectedCurve
    button_insertSelectedCurve = pm.button(label='>',
                                           w=35,
                                           h=25,
                                           command=pm.Callback(
                                               insertFirstSelected, ))
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(button_insertSelectedCurve, 'top', 155),
                              (button_insertSelectedCurve, 'left', 55)])
    # =========================================
    # Creating Element input_inputCurve
    input_inputCurve = pm.textField('input_inputCurve',
                                    text='Draw a curve, 1 Joint per CV.',
                                    w=250,
                                    h=25)
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(input_inputCurve, 'top', 155),
                              (input_inputCurve, 'left', 100)])
    # =========================================
    # Creating Element text_IdName
    text_IdName = pm.text(label='Prefix Name:',
                          align='right',
                          recomputeSize=True,
                          w=80,
                          h=25)
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(text_IdName, 'top', 190),
                              (text_IdName, 'left', 10)])
    # =========================================
    # Creating Element input_IdName
    input_IdName = pm.textField('input_IdName', text='varFk', w=250, h=25)
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(input_IdName, 'top', 190),
                              (input_IdName, 'left', 100)])
    # =========================================
    # Creating Element text_numOfCtrls
    text_numOfCtrls = pm.text(label='# of Controls:',
                              align='right',
                              recomputeSize=True,
                              w=80,
                              h=25)
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(text_numOfCtrls, 'top', 225),
                              (text_numOfCtrls, 'left', 10)])
    # =========================================
    # Creating Element slider_numOfCtrls
    slider_numOfCtrls = pm.intSliderGrp('slider_numOfCtrls',
                                        f=True,
                                        min=1,
                                        max=10,
                                        fieldMinValue=1,
                                        fieldMaxValue=999,
                                        value=3,
                                        ann='Number of Controls',
                                        w=255,
                                        h=25)
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(slider_numOfCtrls, 'top', 225),
                              (slider_numOfCtrls, 'left', 100)])
    # =========================================
    # Creating Element button_build
    button_build = pm.button(label='Build',
                             w=340,
                             h=40,
                             command=pm.Callback(buildVarFkFromUI, ))
    pm.formLayout(form,
                  edit=True,
                  attachForm=[(button_build, 'top', 265),
                              (button_build, 'left', 10)])
    # =========================================

    pm.setParent('..')

    # show window
    varFkWindow.show()
Exemple #26
0
def _build_ik_tab(parent_layout):
    # Create column Layout for IK controls
    ik_tab_layout = pm.columnLayout('ikTab', adj=True, width=100)

    pm.separator(height=3, style='none')

    # IK Configuration Icon
    pm.gridLayout(numberOfColumns=1, cellWidth=216, cellHeight=52)

    # Flip robot base button
    pm.image(image='IK_config_icon.png')
    pm.setParent(ik_tab_layout)  # Set parent to IK tab column layout

    pm.gridLayout(numberOfColumns=3, cellWidth=72, cellHeight=126)

    # Flip robot base button
    pm.symbolButton(image='flipBaseIcon.png',
                    command=mimic_utils.flip_robot_base,
                    annotation='Changes IK solution by flipping robot\'s base')
    # Flip robot elbow button
    pm.symbolButton(
        image='flipElbowIcon.png',
        command=mimic_utils.flip_robot_elbow,
        annotation='Changes IK solution by flipping robot\'s elbow')
    # FLip robot wrist button
    pm.symbolButton(
        image='flipWristIcon.png',
        command=mimic_utils.flip_robot_wrist,
        annotation='Changes IK solution by flipping robot\'s wrist')

    pm.setParent(ik_tab_layout)  # Set parent to IK tab column layout

    pm.separator(height=2, style='none')
    pm.separator(height=11, style='out')

    # Key Animation Tool checkbox
    pm.rowLayout(numberOfColumns=1)
    pm.checkBox('cb_keyToolCtrl',
                label="Key tool controller",
                annotation='If checked, Tool Controller\'s Translate ' \
                           'and Rotate attributes will be keyed',
                value=1)

    pm.setParent(ik_tab_layout)  # Set parent to IK tab column layout

    pm.separator(height=5, style='none')

    # Keyframe IK configuration button
    pm.button(label='Set IK Keyframe',
              command=mimic_utils.key_ik,
              annotation='Keyframes Robot\'s IK-FK hierarchy in IK mode:\n' \
                         'target_CTRL:\n' \
                         '    ik = 1\n' \
                         '    visibility = 1\n' \
                         '    IK Solution 1, 2, and 3\n' \
                         'a*FK_CTRL:\n' \
                         '    rotateX, Y, or Z\n' \
                         'FK_CTRLS\n' \
                         '    visibility = 0')

    pm.setParent(parent_layout)
    return ik_tab_layout
Exemple #27
0
    def __init__(self, baseFilePath, placerMapping, indMapping, meshNames):
        '''
        create UI and init vars
        '''
        self.imageRefPath = baseFilePath
        self.placerMapping = placerMapping
        self.indMapping = indMapping
        self.mesh = meshNames['face']
        self.lf_eye = meshNames['leftEye']
        self.rt_eye = meshNames['rightEye']
        self.locTweakWidgets = {}
        self.placementGrp = None

        with pm.menu(l='Options') as menuOptions:
            pm.menuItem(l='Refresh')
            pm.menuItem(l='Reset')

        with pm.menu(l='Help') as menuHelp:
            pm.menuItem(l='Documentation')
            pm.menuItem(l='About')

        with pm.tabLayout() as mainTab:

            with pm.columnLayout(adj=True) as geoSelectionLayout:
                pass

            with pm.columnLayout(adj=True) as jntPlacementLayout:

                with pm.verticalLayout(ratios=(1, 10, 1),
                                       spacing=10) as jntPlacementVertLayout:

                    #self.chk_symmetry = pm.checkBox(l='Symmetry', v=True)
                    with pm.horizontalLayout() as startPlacementLayout:
                        self.btn_startJntPlacement = pm.button(
                            l='Start Joint Placement',
                            c=pm.Callback(self.startJointPlacement),
                            w=180)

                    self.img_jntReference = pm.image(image=self.imageRefPath +
                                                     'default.jpg')

                    with pm.rowLayout(numberOfColumns=3,
                                      adj=2) as jntRowLayout:
                        self.btn_jntScrollLt = pm.button(l='<<',
                                                         w=40,
                                                         en=False)
                        self.txt_jntCurrent = pm.text(
                            label=
                            'Click "Start Joint Placement" above to begin.',
                            align='center')
                        self.btn_jntScrollRt = pm.button(
                            l='>>',
                            w=40,
                            c=pm.Callback(self.selectNextItem),
                            en=False)

                pm.separator(style='in')

                with pm.horizontalLayout(ratios=(1, 5), spacing=5):

                    with pm.verticalLayout():
                        # left labels
                        self.locTweakWidgets['txt_position'] = pm.text(
                            label='Position', align='right', en=False)
                        self.locTweakWidgets['txt_orient'] = pm.text(
                            label='Orient', align='right', en=False)
                        self.locTweakWidgets['txt_scale'] = pm.text(
                            label='Scale', align='right', en=False)
                        self.locTweakWidgets['txt_mirror'] = pm.text(
                            label='Mirror', align='right', en=False)
                    with pm.verticalLayout():
                        # right buttons
                        with pm.horizontalLayout():
                            self.locTweakWidgets['btn_prevCV'] = pm.button(
                                l='Prev CV',
                                en=False,
                                c=pm.Callback(self.stepCV, -1))
                            self.locTweakWidgets['btn_nextCV'] = pm.button(
                                l='Next CV',
                                en=False,
                                c=pm.Callback(self.stepCV, 1))
                            self.locTweakWidgets['btn_snapToVtx'] = pm.button(
                                l='Snap to Vtx', en=False)
                            self.locTweakWidgets['btn_user'] = pm.button(
                                l='User', en=False)

                        with pm.horizontalLayout():
                            self.locTweakWidgets['btn_normal'] = pm.button(
                                l='Normal', en=False)
                            self.locTweakWidgets['btn_normal_yup'] = pm.button(
                                l='Normal + Y-up', en=False)
                            self.locTweakWidgets['btn_world'] = pm.button(
                                l='World', en=False)
                            self.locTweakWidgets[
                                'btn_orient_user'] = pm.button(l='User',
                                                               en=False)

                        with pm.horizontalLayout():
                            self.locTweakWidgets[
                                'float_scale'] = pm.floatSliderGrp(
                                    f=True,
                                    min=0.01,
                                    max=1.0,
                                    v=0.5,
                                    pre=2,
                                    fmx=10.0,
                                    en=False,
                                    dc=pm.Callback(self.editLocScale))
                        with pm.horizontalLayout():
                            self.locTweakWidgets['btn_mirLtToRt'] = pm.button(
                                l='Left to Right',
                                en=False,
                                c=pm.Callback(self.mirrorLocs))
                            self.locTweakWidgets['btn_mirRtToLt'] = pm.button(
                                l='Right to Left', en=False)

                pm.separator(style='in')

                with pm.verticalLayout(spacing=5) as buildRigVertLayout:
                    self.btn_updateLocs = pm.button(l='Update All Locators',
                                                    en=False)
                    self.btn_buildRig = pm.button(l='Build Rig',
                                                  c=pm.Callback(self.buildRig),
                                                  en=False)

            with pm.columnLayout(adj=True) as deformationLayout:
                pass

            with pm.columnLayout(adj=True) as motionLayout:
                pass

            with pm.columnLayout(adj=True) as actionsLayout:
                pass

        mainTab.setTabLabel((geoSelectionLayout, 'Geometry'))
        mainTab.setTabLabel((jntPlacementLayout, 'Joints'))
        mainTab.setTabLabel((deformationLayout, 'Deformation'))
        mainTab.setTabLabel((motionLayout, 'Motion'))
        mainTab.setTabLabel((actionsLayout, 'Action Units'))
        mainTab.setSelectTab(jntPlacementLayout)

        self.show()
Exemple #28
0
def AutoRig_UI():
    
    if pm.window("AutoRig_JT", q=True, exists = True):
            pm.deleteUI("AutoRig_JT")
    
    windowUI = pm.window("AutoRig_JT",titleBarMenu=True, menuBar=True, mxb = False, t="AutoRig_JT", w = 300, h = 500, sizeable = False, bgc=[0.15,0.15,0.15],maximizeButton=False)
	
    pm.menu( label='File', tearOff=True )
    pm.menuItem( label='Quit', c = partial(quit, "AutoRig_JT"))
    pm.menu( label='Help', helpMenu=True )
    pm.menuItem( 'Application..."', label='About Creator', c = about )
    pm.menuItem( 'Instructions', label='Instructions', c = instructions )
	
		
    mainLayout = pm.columnLayout(adj = True, w=300, h=700)

    # unique UI stuff

    imagePath = pm.internalVar(upd = True) + "icons/autoRig_banner.jpg"
    pm.image(w = 300, h = 100,image = imagePath, parent = mainLayout)
    pm.separator(style = 'none', h=20)

    pm.rowColumnLayout(nc = 2, cw = [(1,100),(2,200)],parent = mainLayout, columnOffset = ([(1,"left",10),(2,"left",0)]))

    pm.text(l='    Rig_Prefix : ')

    RigPrefix = pm.textFieldGrp("RigPrefix",tx='Character_',w=80) 

    pm.separator(style = 'none', h=20)
    pm.separator(style = 'none', h=20)
	
    
	
    pm.text(l='Spine Joints : ')
    spineNumberField = pm.intFieldGrp("spineNumberField",numberOfFields=1,v1=3,w=190)
	
    pm.setParent(u=True)
	
	
    pm.separator(style = 'none', h=20)
    pm.separator(style = 'none', h=20)

    pm.separator(style = 'none',h=20)
    pm.button(l='Create Reference Skeleton',c=referenceSkeleton, w=190,h=40,bgc=[0.2,0.2,0.2])

    pm.separator(style = 'none', h=20)

    pm.button(l='Mirror Locators (X+ to -X) (edit)', c=mirrorLocators, w=190, h=40, bgc=[0.2, 0.2, 0.2])

    pm.separator(style='none', h=20)
    
    pm.button(l='Create Joint Skeleton (edit)', c=jointSkeleton, w=190, h=40, bgc=[0.2, 0.2, 0.2])

    pm.separator(style='none', h=20)
    
    pm.radioButtonGrp('ZAxisOption', label='Z Align Axis', labelArray3=['X', 'Y', 'Z'], numberOfRadioButtons=3,cw=[(1,70),(2,35),(3,35)] )

    pm.radioButtonGrp('directionOption', label='+ or -', labelArray2=['+', '-'], numberOfRadioButtons=2,cw=[(1,70),(2,35)] )
    
    pm.button(l='Align Joints (select joints in chain you want to align)', c=alignChain, w=190, h=40, bgc=[0.2, 0.2, 0.2])

    pm.separator(style='none', h=20)

    pm.button(l='Finalize Rig',c=finalize, w=190,h=40,bgc=[0.2,0.2,0.2])

    pm.separator(style = 'none', h=20)


    pm.button(l='Exit',c=partial(quit,"AutoRig_JT"), w=190,h=40,bgc=[0.2,0.2,0.2])	

    print windowUI

    pm.showWindow(windowUI)
	
    pm.window("AutoRig_JT", e=True,w=300,h=600)
Exemple #29
0
    def __init__(self):
        if pm.window(win, q=True, exists=True ): 
            pm.deleteUI(win)

        with pm.window(win, wh=[300,600], t=title):
            with pm.frameLayout( lv=False, cll=False, mw=1, mh=1):
                with pm.formLayout() as mainForm:

                    # 상단 
                    with pm.tabLayout(tv=False) as top:
                        with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False):
                            with pm.rowLayout(nc=3, adj=2):
                                pm.image( image = shelf_icon )
                                pm.text(l='  %s'%title, fn='boldLabelFont', align='left')
                                pm.image( image = alfredIcon )
                   
                    # 중단
                    #with pm.tabLayout(tv=False, scr=True, childResizable=True) as mid:   
                    with pm.tabLayout(tv=True, scr=True, childResizable=True ) as self.mid:  
                        with pm.columnLayout(adj=True) as tab1:
                            uiContents_tab1()
                        
                        with pm.columnLayout(adj=True) as tab2:
                            uiContents_tab2()

                        with pm.columnLayout(adj=True) as tab3:
                            uiContents_tab3()

                    # 하단
                    with pm.columnLayout(adj=True) as btm:
                        pm.helpLine()
       
            # 팝업메뉴
            # 왼쪽 마우스 클릭
            pm.popupMenu(button=1, p=top)
            pm.menuItem(l='Add To Shelf',  c=pm.Callback( self.addToShalf ) )

            # 오른쪽 마우스 클릭
            pm.popupMenu(button=3, p=top)
            pm.menuItem(l='Help', en=False )
            
            # 탭 조정
            pm.tabLayout(self.mid, e=True, 
                sti=pm.optionVar['alfredRigTabSel'] if pm.optionVar.has_key('alfredRigTabSel') else 1, 
                cc=self.tabSelect, 
                tabLabel=[(tab1,'Tools'),(tab2,'Transform'),(tab3,'Deformer')]
                )
            
            # 폼조정
            pm.formLayout( mainForm, e=True, 
                attachForm=[
                    (top, 'top', 3), 
                    (top, 'left', 3), 
                    (top, 'right', 3), 

                    (self.mid, 'left', 3), 
                    (self.mid, 'right', 3), 

                    (btm, 'left', 3), 
                    (btm, 'right', 3), 
                    (btm, 'bottom', 3),
                    ], 
                attachControl=[
                    (self.mid, 'top', 3, top), 
                    (self.mid, 'bottom', 0, btm)
                    ],
                )