Exemplo n.º 1
0
    def __init__(self, *args):
        win = 'cloth_snapshot_win'
        version = '0.1'

        if pm.window(win, exists=1, *args):
            pm.deleteUI(win, window=1)

        pm.window(win, rtf=1, title='Cloth Snapshot UI v%s' % version)

        pm.columnLayout()
        pm.rowLayout(nc=2)
        pm.text('Working Directory')
        self.dirFld = pm.textFieldButtonGrp(bl='Browse')
        pm.textFieldButtonGrp(self.dirFld,
                              e=1,
                              bc=partial(self.get_dir, self.dirFld))
        pm.setParent('..')

        pm.rowLayout(nc=3, cw3=(150, 150, 150))
        pm.button(l='Snapshot Selected', c=self.snapshot)
        pm.button(l='Diff Snapshots', c=self.diff_snapshot)
        pm.button(l='Apply Snapshot', c=self.implement_snapshot)
        pm.setParent('..')

        pm.showWindow(win)
 def press_vdb_path(param_name):
     basic_filter = "OpenVDB File(*.vdb)"
     project_dir = pm.workspace(query=True, directory=True)
     vdb_path = pm.fileDialog2(fileFilter=basic_filter, cap="Select OpenVDB File", okc="Load", fm=1, startingDirectory=project_dir)
     if vdb_path is not None and len(vdb_path) > 0:
         vdb_path = vdb_path[0]
         # inspect file and try to figure out the padding and such
         try:
             dirname, filename = os.path.split(vdb_path)
             if re.match(".*[\._][0-9]+[\._]vdb", filename):
                 m = re.findall("[0-9]+", filename)
                 frame_number = m[-1]
                 padding = len(frame_number)
                 cache_start = int(frame_number)
                 cache_end = int(frame_number)
                 frame_location = filename.rfind(frame_number)
                 check_file_re = re.compile((filename[:frame_location] + "[0-9]{%i}" % padding + filename[frame_location + padding:]).replace(".", "\\."))
                 for each in os.listdir(dirname):
                     if os.path.isfile(os.path.join(dirname, each)):
                         if check_file_re.match(each):
                             current_frame_number = int(each[frame_location : frame_location + padding])
                             cache_start = min(cache_start, current_frame_number)
                             cache_end = max(cache_end, current_frame_number)
                 frame_location = vdb_path.rfind(frame_number)
                 vdb_path = vdb_path[:frame_location] + "#" * padding + vdb_path[frame_location + padding:]
                 node_name = param_name.split(".")[0]
                 pm.setAttr("%s.cache_playback_start" % node_name, cache_start)
                 pm.setAttr("%s.cache_playback_end" % node_name, cache_end)
         except:
             print "[openvdb] Error while trying to figure out padding, and frame range!"
             import sys, traceback
             traceback.print_exc(file=sys.stdout)
         pm.textFieldButtonGrp("OpenVDBPathGrp", edit=True, text=vdb_path)
         pm.setAttr(param_name, vdb_path, type="string")
Exemplo n.º 3
0
 def createLayout(self, *args):
     #creates the layout and attaches the controls to the given field the class has been called in
     self.disabler = pm.optionMenu( l='Auto-detect Proxy', cc=self._disableButton )
     for option in self.o:
         pm.menuItem( label=option )
     self.button = pm.textFieldButtonGrp( adj=1, ad2=1, ad3=1 , cw=[2, self.w/2], w=self.w, label = self.n, text='', buttonLabel=self.b, buttonCommand = self._buttonAction )
     self.textField = pm.textFieldButtonGrp(self.button, e=True, cw=[1, self.w/4])
Exemplo n.º 4
0
    def set_json_location(self):
        json_location = pm.fileDialog2(dialogStyle=2,
                                       fileFilter="JSON File (*.json);;",
                                       fileMode=0,
                                       okc=u"选择文件",
                                       cc=u"取消")
        if os.path.isfile(json_location[0]):
            pm.textFieldButtonGrp("ARFileLocationField",
                                  e=True,
                                  text=json_location[0])
            self.ar_file_location = json_location[0]

        else:
            dict_data = {}
            mode = pm.radioButtonGrp(self.work_mode_control, q=True, sl=True)
            if mode == 1:
                dict_data = channel.face_unity_channels
            elif mode == 2:
                dict_data = channel.arkit_channels
            write_json(dict_data=dict_data, file_path=json_location[0])
            pm.textFieldButtonGrp("ARFileLocationField",
                                  e=True,
                                  text=json_location[0])
            self.ar_file_location = json_location[0]

        self.init_ar_channel_options(json_file=json_location[0])
        pm.optionVar(sv=('ARFaceEditor_jsonFileLocation',
                         self.ar_file_location))

        if pm.textScrollList(self.ar_item_scroll, q=True, ni=True) > 1:
            pm.textScrollList(self.ar_item_scroll, e=True, sii=1)
            self.selected_ar_item_in_scroll()

        return
Exemplo n.º 5
0
def gui():
    # Creating a window.
    win = pm.window(w=150, h=100)
    main = pm.columnLayout()
    
    # Here a three examples of interface components
    # EVERY interface element is named. Just like geometry in Maya.
    # You are given access to this name when a object is created in Maya.
    
    # 1) Maya names the textFieldButtonGrp.
    #    User chooses not to catch the name of the interface comp.
    pm.textFieldButtonGrp( label='Separator Attribute',
                          buttonLabel='Apply',
                          buttonCommand=work)
    # 2) User desides to catch the name of the textFieldButtonGrp.
    #    But it is local scope.  Only visible inside of this function.
    float_text = pm.textFieldButtonGrp( label='Float Attribute',
                          buttonLabel='Apply',
                          buttonCommand=work)    

    # 3) User catches interface name and makes it global to the script.
    global int_text
    int_text = pm.textFieldButtonGrp( label='Integer Attribute',
                          buttonLabel='Apply',
                          buttonCommand=work)
    
    # Showing a window
    win.show()
Exemplo n.º 6
0
 def _set_output_location(self):
     output_location = pm.fileDialog2(
         dialogStyle=2, fileMode=3, okc=u"选择文件夹")
     if output_location:
         pm.textFieldButtonGrp('ARExporterOutputPath', e=True, text=output_location[0])
         self.output_path = output_location[0]
     return
 def press_vdb_path(param_name):
     basic_filter = "OpenVDB File(*.vdb)"
     project_dir = pm.workspace(query=True, directory=True)
     vdb_path = pm.fileDialog2(fileFilter=basic_filter, cap="Select OpenVDB File", okc="Load", fm=1, startingDirectory=project_dir)
     if vdb_path is not None and len(vdb_path) > 0:
         vdb_path = vdb_path[0]
         # inspect file and try to figure out the padding and such
         try:
             dirname, filename = os.path.split(vdb_path)
             if re.match(".*[\._][0-9]+[\._]vdb", filename):
                 m = re.findall("[0-9]+", filename)
                 frame_number = m[-1]
                 padding = len(frame_number)
                 cache_start = int(frame_number)
                 cache_end = int(frame_number)
                 frame_location = filename.rfind(frame_number)
                 check_file_re = re.compile((filename[:frame_location] + "[0-9]{%i}" % padding + filename[frame_location + padding:]).replace(".", "\\."))
                 for each in os.listdir(dirname):
                     if os.path.isfile(os.path.join(dirname, each)):
                         if check_file_re.match(each):
                             current_frame_number = int(each[frame_location : frame_location + padding])
                             cache_start = min(cache_start, current_frame_number)
                             cache_end = max(cache_end, current_frame_number)
                 frame_location = vdb_path.rfind(frame_number)
                 vdb_path = vdb_path[:frame_location] + "#" * padding + vdb_path[frame_location + padding:]
                 node_name = param_name.split(".")[0]
                 pm.setAttr("%s.cache_playback_start" % node_name, cache_start)
                 pm.setAttr("%s.cache_playback_end" % node_name, cache_end)
         except:
             print "[openvdb] Error while trying to figure out padding, and frame range!"
             import sys, traceback
             traceback.print_exc(file=sys.stdout)
         pm.textFieldButtonGrp("OpenVDBPathGrp", edit=True, text=vdb_path)
         pm.setAttr(param_name, vdb_path, type="string")
Exemplo n.º 8
0
 def fileBrowser(self, *args):
     erg = pm.fileDialog2(dialogStyle=2, fileMode=2)
     print "Result", erg
     if len(erg) > 0:
         if len(erg[0]) > 0:
             exportPath = erg[0]
             pm.textFieldButtonGrp(self.pathUI, edit=True, text=exportPath)
Exemplo n.º 9
0
 def _buttonAction(self):
     #inputs the first object in the selection as the textfield text upon button press
     if not self.disabler.getSelect()-1:
         file = pm.fileDialog2( ds=2, fm=1, cap='Select a binary proxy', ff='*.mib', dir=( self.project_path+"/export/GEO/RENDERPROXY/"+self.user ) )
     else:
         file = pm.fileDialog2( ds=2, fm=3, cap='Select a binary proxy folder', dir=( self.project_path+"/export/GEO/RENDERPROXY/"+self.user ) )
     pm.textFieldButtonGrp( self.button, e=True, text=file[0] )
Exemplo n.º 10
0
 def loadDriven(self, *args): 
     """
      Load object name for driven object in text field
     """
     sel = pm.ls(sl=True, fl=True)
     pm.textFieldButtonGrp(self.drivenField, edit=True, text=sel[0])  
     
     # Clear the menu items so list doesn't grow
     items = pm.optionMenu(self.drivenAttField, q=True, ill=True)
     if(items):
             pm.setParent(self.drivenAttField, menu=True)
             for each in items:
                     pm.deleteUI(each)
     
     # Check if blendshape
     if 'BlendShape' in str(type(sel[0])):  
         bs = sel[0]
     
         temp = pm.aliasAttr(bs, q=1)
         temp.sort()
         targets = []
         for each in temp:
             if each.startswith('weight'): continue
             targets.append(each)
     
         for tgt in targets:
             try:
                 pm.menuItem(parent=self.drivenAttField, label=tgt)
             except Exception, e:
                 print e
                 pm.warning('%s failed to create / connect' % tgt)
    def test_rowGroupLayout(self):
        self.assertEqual(pm.currentParent(), self.win)
        self.assertEqual(pm.currentMenuParent(), None)
        with pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' ) as tfbg:
            self.assertEqual(pm.currentParent(), tfbg)
            self.assertEqual(pm.currentMenuParent(), None)
            cmds.button()
            with pm.popupMenu() as m:
                self.assertEqual(pm.currentParent(), tfbg)
                self.assertEqual(pm.currentMenuParent(), m)
                with pm.menuItem(subMenu=1) as sm:
                    self.assertEqual(pm.currentParent(), tfbg)
                    self.assertEqual(pm.currentMenuParent(), sm)
                self.assertEqual(pm.currentParent(), tfbg)
                self.assertEqual(pm.currentMenuParent(), m)
            self.assertEqual(pm.currentParent(), tfbg)
        self.assertEqual(pm.currentParent(), self.win)

        fl = pm.formLayout()
        tfbg2 = pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' )
        self.assertEqual(pm.currentParent(), fl)
        with pm.columnLayout() as cl:
            cmds.button()
            with pm.popupMenu() as m:
                self.assertEqual(pm.currentParent(), cl)
                self.assertEqual(pm.currentMenuParent(), m)
                with pm.menuItem(subMenu=1) as sm:
                    self.assertEqual(pm.currentParent(), cl)
                    self.assertEqual(pm.currentMenuParent(), sm)
                self.assertEqual(pm.currentParent(), cl)
                self.assertEqual(pm.currentMenuParent(), m)
            self.assertEqual(pm.currentParent(), cl)
        self.assertEqual(pm.currentParent(), fl)
Exemplo n.º 12
0
 def create_vdb_path(self, param_name):
     pm.setUITemplate("attributeEditorPresetsTemplate", pushTemplate=True)
     pm.textFieldButtonGrp("OpenVDBPathGrp",
                           label="VDB Path",
                           buttonLabel="...")
     self.update_vdb_path(param_name)
     pm.setUITemplate(popTemplate=True)
Exemplo n.º 13
0
def gui():
    # Creating a window.
    win = pm.window(w=150, h=100)
    main = pm.columnLayout()

    # Here a three examples of interface components
    # EVERY interface element is named. Just like geometry in Maya.
    # You are given access to this name when a object is created in Maya.

    # 1) Maya names the textFieldButtonGrp.
    #    User chooses not to catch the name of the interface comp.
    pm.textFieldButtonGrp(label='Separator Attribute',
                          buttonLabel='Apply',
                          buttonCommand=work)
    # 2) User desides to catch the name of the textFieldButtonGrp.
    #    But it is local scope.  Only visible inside of this function.
    float_text = pm.textFieldButtonGrp(label='Float Attribute',
                                       buttonLabel='Apply',
                                       buttonCommand=work)

    # 3) User catches interface name and makes it global to the script.
    global int_text
    int_text = pm.textFieldButtonGrp(label='Integer Attribute',
                                     buttonLabel='Apply',
                                     buttonCommand=work)

    # Showing a window
    win.show()
Exemplo n.º 14
0
 def fileBrowser(self, *args):
     erg = pm.fileDialog2(dialogStyle=2, fileMode=2)
     print "Result", erg
     if len(erg) > 0:
         if len(erg[0]) > 0:
             exportPath = erg[0]
             pm.textFieldButtonGrp(self.pathUI, edit=True, text=exportPath)
Exemplo n.º 15
0
    def gui(self, *args):

        if CreateStretchSplineClass.win is not None:
            try:
                pm.deleteUI(CreateStretchSplineClass.win)
            except RuntimeError:
                pass

        with pm.window(
            menuBar=True, menuBarVisible=True,
            width=200, title='Create Stretch Spline'
        ) as w:

            CreateStretchSplineClass.win = w
            # start the template block
            with pm.columnLayout(rowSpacing=5, width=500):
                self.tFBG = pm.textFieldButtonGrp(
                    label='Load Spine Curve: ', buttonLabel='Load Curve',
                    buttonCommand=pm.Callback(self.loadSelectionToTextField)
                )
                pm.button(label='Execute', command=pm.Callback(self.execute))
                self.myCheckbox = pm.checkBox(
                    label='Maintain Scale', changeCommand=pm.Callback(self.toggleMainScale)
                )

            with pm.columnLayout(rowSpacing=5, width=500, enable=False) as self.globalControlLayout:
                self.sTFBG = pm.textFieldButtonGrp(
                    label='Load Main Controller: ', buttonLabel='Load Controller',
                    buttonCommand=pm.Callback(self.loadMainController)
                )
Exemplo n.º 16
0
    def loadSelectionToTextField(self, *args):

        try:
            self.myCurve = pm.selected()[0]
            pm.textFieldButtonGrp(self.tFBG, edit=True, tx=self.myCurve.name())
        except:
            pm.textFieldButtonGrp(self.tFBG, edit=True, placeholderText='Select your Spine Curve!')
Exemplo n.º 17
0
 def _set_rig_file(self):
     rig_location = pm.fileDialog2(dialogStyle=2, fileMode=1, okc=u"选择绑定文件")
     if rig_location:
         pm.textFieldButtonGrp('rig_file_setter',
                               e=True,
                               text=rig_location[0])
         self.rig_file = rig_location[0]
     return
Exemplo n.º 18
0
 def selectGeoFile(self):
     print "Select file"
     startDir = r"C:\daten\3dprojects\mantra\data\fluidGeo"
     # fileFilter="*.geo;;*.bgeo" seems not to work correctly...
     self.fileName = pm.fileDialog2(cap="Select Geo File", dir=startDir, fm=1)
     if len(self.fileName) > 0:
         self.fileName = self.fileName[0]
         pm.textFieldButtonGrp("stdingfilename", edit=True, text=self.fileName)
Exemplo n.º 19
0
 def loadMainCtrl(self, *args):
     try:
         self.mainCtrl = pm.selected()[0]
         pm.textFieldButtonGrp(self.sTFBG, edit=True, tx=self.mainCtrl.name())
     except IndexError:
         pm.textFieldButtonGrp(
             self.sTFBG, edit=True, placeholderText='Select your main Controller!'
         )
Exemplo n.º 20
0
 def addImage(self, field):
     self.file = pm.fileDialog()
     self.newFile = os.path.basename(self.file)
     pm.textFieldButtonGrp('%s' % field,
                           edit=True,
                           text='%s' % self.newFile)
     self.imageList.append(self.file)
     self.nameList.append(self.newFile)
Exemplo n.º 21
0
 def createRig(self, *args):
     BlendSineRig.BlendSineRig(
         control=pm.textFieldButtonGrp(self.cnt_fld, q=1, text=1),
         name=pm.textFieldGrp(self.name_fld, q=1, text=1),
         numJnts=pm.textFieldGrp(self.numJnts_fld, q=1, text=1),
         curve=pm.textFieldButtonGrp(self.crv_fld, q=1, text=1),
         fwdBackCrvs=pm.textScrollList(self.fwd_sFld, q=1, ai=1),
         sideToSideCrvs=pm.textScrollList(self.side_sFld, q=1, ai=1),
     )
Exemplo n.º 22
0
 def update_vdb_path(self, param_name):
     vdb_path = pm.getAttr(param_name)
     pm.textFieldButtonGrp(
         "OpenVDBPathGrp",
         edit=True,
         text="" if vdb_path is None else vdb_path,
         changeCommand=lambda val: pm.setAttr(param_name, val),
         buttonCommand=lambda: AEvdb_visualizerTemplate.press_vdb_path(
             param_name))
Exemplo n.º 23
0
    def create(self, *args):
	a = pm.PyNode(pm.textFieldButtonGrp(self.aFld, q=1, text=1))
	b = pm.PyNode(pm.textFieldButtonGrp(self.bFld, q=1, text=1))
	name = a+'midJnt'
	num = pm.textFieldGrp(self.numFld, q=1, text=1)
	
	jnts, crv = self.makeJoints(a=a, b=b, name=name, num=num)
	self.constrainJoints(a=a, b=b, jnts=jnts)
	pm.delete(crv)
Exemplo n.º 24
0
 def child_tab_import(self):
     layout = pm.formLayout(numberOfDivisions=100)
     import_atom_frame = pm.frameLayout(label=u"数据文件列表:",
                                        mw=10,
                                        mh=10,
                                        bgs=True)
     pm.columnLayout(adj=1)
     pm.textFieldButtonGrp('rig_file_setter',
                           label=u"绑定文件",
                           bl=u"指定",
                           adj=2,
                           cw3=[52, 100, 60],
                           cat=[(2, "left", 5), (3, "left", 5)],
                           text=self.rig_file,
                           bc=lambda *args: self._set_rig_file())
     pm.textFieldButtonGrp('atom_file_setter',
                           label=u"动画数据",
                           bl=u"指定",
                           adj=2,
                           cw3=[52, 100, 60],
                           cat=[(2, "left", 5), (3, "left", 5)],
                           text=self.atom_file,
                           bc=lambda *args: self._set_atom_file())
     pm.checkBoxGrp('unitToNTSC',
                    label=u"NTSC制式",
                    value1=self.changeNTSC,
                    cw2=[60, 30],
                    cat=[(2, "left", 5)],
                    cc=lambda *args: self._set_change_unit_check())
     pm.setParent("..")
     pm.setParent("..")
     execute_button = pm.button(label=u"读取!",
                                c=lambda *args: self.start_import_work())
     pm.formLayout(
         layout,
         edit=True,
         attachForm=[
             (import_atom_frame, 'top', 10),
             (import_atom_frame, 'left', 10),
             (import_atom_frame, 'right', 10),
             # (export_options_frame, 'left', 10),
             # (export_options_frame, 'right', 10),
             (execute_button, 'left', 10),
             (execute_button, 'right', 10),
             (execute_button, 'bottom', 10)
         ],
         attachControl=[
             # (file_export_list_frame, 'top', 5, project_store_path_frame),
             # (file_export_list_frame, 'bottom', 5, export_options_frame),
             (import_atom_frame, 'bottom', 5, execute_button)
         ],
         # attachPosition=[(b1, 'right', 5, 75),
         #                                 (column, 'left', 0, 75)],
         #                 attachNone=(b2, 'top'))
     )
     return layout
Exemplo n.º 25
0
 def _get_ui_location():
     ui_location = pm.fileDialog2(dialogStyle=2,
                                  fileFilter="Ui File (*.ui);;",
                                  fileMode=1,
                                  okc=u"选择文件")
     if ui_location:
         pm.textFieldButtonGrp(ui_file_location_field,
                               e=True,
                               text=ui_location[0])
     return True
Exemplo n.º 26
0
 def load_template_file(self):
     json_location = pm.fileDialog2(dialogStyle=2,
                                    fileMode=1,
                                    okc=u"选择模板配置文件")
     if json_location:
         pm.textFieldButtonGrp('templateTextField',
                               e=True,
                               text=json_location[0])
         self.template_path = json_location[0]
     return
Exemplo n.º 27
0
 def _select_end_loc(self, *args):
     """This stores the selected end locator's name and shows in text field
     :param args:
     :return: None
     """
     self.end_loc = pm.ls(sl=1)[0]
     pm.textFieldButtonGrp(self.select_eloc_field,
                           e=True,
                           tx=str(self.end_loc))
     self.ik_ctrl_e_scale = transformation_info(self.end_loc)['s']
Exemplo n.º 28
0
 def _set_template_file(self):
     template_location = pm.fileDialog2(dialogStyle=2,
                                        fileMode=1,
                                        okc=u"选择模板文件")
     if template_location:
         pm.textFieldButtonGrp('template_file_setter',
                               e=True,
                               text=template_location[0])
         self.template_file = template_location[0]
     return
Exemplo n.º 29
0
 def _set_output_path():
     output_path = pm.fileDialog2(dialogStyle=2,
                                  fileFilter="Python File (*.py);;",
                                  fileMode=0,
                                  okc=u"选择目录")
     if output_path:
         pm.textFieldButtonGrp(py_store_path_field,
                               e=True,
                               text=output_path[0])
     return True
Exemplo n.º 30
0
 def _set_atom_file(self):
     atom_location = pm.fileDialog2(dialogStyle=2,
                                    fileMode=1,
                                    okc=u"选择Atom动画文件")
     if atom_location:
         pm.textFieldButtonGrp('atom_file_setter',
                               e=True,
                               text=atom_location[0])
         self.atom_file = atom_location[0]
     return
Exemplo n.º 31
0
def ui_enable( btn=False, status=True ):
    global UI_name
    for ui in UI_name[:-2]:
        pm.textFieldButtonGrp( ui, edit=True, en=status )
    
    #// check if inclde button
    if( btn ):
        pm.button( UI_name[-2], edit=True, en=status )
    
    return 1
Exemplo n.º 32
0
 def set_output_location(self):
     output_path = pm.fileDialog2(dialogStyle=2,
                                  fileFilter="JSON File (*.json);;",
                                  fileMode=0,
                                  okc=u"保存文件")
     if output_path:
         pm.textFieldButtonGrp("outputPathField",
                               e=True,
                               text=output_path[0])
         self.output_path = output_path[0]
     return
Exemplo n.º 33
0
def gui():
    # Creating a window.
    win = pm.window(w=150, h=100)
    main = pm.columnLayout()

    # Interface components go after the main layout,
    # Different components simular flags
    # They all have a rectangle bounding box!
    pm.textFieldButtonGrp(label='Float Attribute', buttonLabel='Apply')

    # Showing a window
    win.show()
Exemplo n.º 34
0
 def selectGeoFile(self):
     print "Select file"
     startDir = r"C:\daten\3dprojects\mantra\data\fluidGeo"
     # fileFilter="*.geo;;*.bgeo" seems not to work correctly...
     self.fileName = pm.fileDialog2(cap="Select Geo File",
                                    dir=startDir,
                                    fm=1)
     if len(self.fileName) > 0:
         self.fileName = self.fileName[0]
         pm.textFieldButtonGrp("stdingfilename",
                               edit=True,
                               text=self.fileName)
Exemplo n.º 35
0
def placeHighLight(*args):
    ### UI setup 
    global UI_name
    UI_name = [ 'txtBtn_light', 'txtBtn_camera', 'txtBtn_object', 'txtBtn_HLitPoint', 'btn_placeHLit', 'chk_interaction' ]
    
    if pm.window( 'winPlaceHLit', exists=True ):
        pm.deleteUI( 'winPlaceHLit', window=True )
        
    ui_layout['window'] = pm.window( 'winPlaceHLit', title='Place Highlight', sizeable=False, h=100, w=250 )
    ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] )
    
    #// get active camera
    activeViewCamera = getActiveCam()
    
    '''loc_light_probe = pm.createNode('locator', name='light_probe')
    pm.lockNode(loc_light_probe, lock=False)'''

    #// sub layout
    #// sub1
    ui_layout['ui_sub1'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )
    pm.textFieldButtonGrp( UI_name[0], label='Light: ', text='', buttonLabel='Pick',editable=False, buttonCommand='pickLit()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub1'] )
    pm.button( 'btn_sel_light' ,label='Sel', command=pm.Callback( doSelItem, UI_name[0] ), p=ui_layout['ui_sub1'] )
    
    #// sub2
    ui_layout['ui_sub2'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )
    pm.textFieldButtonGrp( UI_name[1], label='Camera: ', text=activeViewCamera, buttonLabel='Pick', editable=False, buttonCommand='pickCam()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub2'] )
    pm.button( 'btn_sel_camera' ,label='Sel', command=pm.Callback( doSelItem, UI_name[1] ), p=ui_layout['ui_sub2'] )
    
    #// sub3
    ui_layout['ui_sub3'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )
    pm.textFieldButtonGrp( UI_name[2], label='Object: ', text='', buttonLabel='Pick', editable=False, buttonCommand='pickTgtObj()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub3'] )
    pm.button( 'btn_sel_obj' ,label='Sel', command=pm.Callback( doSelItem, UI_name[2] ), p=ui_layout['ui_sub3'] )
    
    #// sub4
    ui_layout['ui_sub4'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )    
    pm.textFieldButtonGrp( UI_name[3], label='Point: ', text='', buttonLabel='Pick', editable=False, buttonCommand='pickHLitPt()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub4'] )
    pm.button( 'btn_sel_point' ,label='Sel', command=pm.Callback( doSelItem, UI_name[3] ), p=ui_layout['ui_sub4'] )
    
    #// sub5
    ui_layout['ui_sub5'] = pm.rowLayout(nc=2, cw=[(1, 70), (2, 50)], p=ui_layout['mainLayout'] )
    pm.button( UI_name[4] ,label='Place Light!', command='doPlaceHLight()', p=ui_layout['ui_sub5'] )    
    pm.checkBox( UI_name[5], label='interactive mode', onCommand=pm.Callback( doInteractionON ), offCommand=pm.Callback( doInteractionOFF ), p=ui_layout['ui_sub5'] )
    
    
    pm.showWindow( ui_layout['window'] )
    
    pm.spaceLocator( name='light_probe' )
    pm.lockNode( 'light_probe', lock=True )
    pm.textFieldButtonGrp( 'txtBtn_HLitPoint', edit=True, text='light_probe' )
    
    #// clean make live and scriptJob after exit script
    pm.scriptJob( uiDeleted=[ ui_layout['window'], pm.Callback( flushScript ) ] )
Exemplo n.º 36
0
    def on_browse_btn(self, *args):
        # Image browse button callback handler
        impFile = ''
        impFile = pm.fileDialog2(fileMode=1)
        if impFile is None or len(impFile) < 1: return
        else:
            print('ipm: importing new image plane %s ' %
                  cmds.file(impFile, query=True, type=True))

            currentCamera = pm.optionMenu(self.cameraOptionMenu, q=1, v=1)

            #get name for new imageplane
            impName = self.nameFromFile(pathname=impFile)

            self.currentImgPath = impFile[0]

            self.currentImgPlane = (pm.imagePlane(width=100,
                                                  height=50,
                                                  name=impName))[1]
            _logger.debug('Imported. file name is %s ' % impFile)

            pm.imagePlane(self.currentImgPlane, e=True, camera=currentCamera)
            _logger.debug('Set camera to  %s ' % currentCamera)
            try:
                pm.imagePlane(self.currentImgPlane,
                              e=True,
                              fileName=self.currentImgPath)
            except:
                pass
            _logger.debug('Imp file has mov is %s ' %
                          impFile[0].rsplit('.')[-1] == "mov")
            if impFile[0].rsplit('.')[-1] == 'mov':
                _logger.debug('Setting to .mov %s ' % self.currentImgPlane)
                pm.setAttr('%s.type' % self.currentImgPlane, 2)

            self.imp_option_list()  #update option menu
            pm.textFieldButtonGrp(self.ImpPathTxt,
                                  e=True,
                                  text=self.currentImgPath)

            #update edit image plane frame

            try:
                #close import window
                pm.deleteUI(self.importWindow, window=True)
                #rebuild parent window
                self.create()

            except:
                sys.stderr.write(
                    'Error rebuilding Interface after image file import. Check name and file type of image.'
                )
Exemplo n.º 37
0
def pickLit(*args):
    light = pm.ls( sl=True )
    if ( len( light ) != 1 ):
        pm.confirmDialog( t='Error', message= 'Selct only One light!' , button = 'OK' )
        return 0

    if( light[0].getShape().nodeType() != 'aiAreaLight' ):
        if ( light[0].getShape().classification()[-1] != 'light' ):
            pm.confirmDialog( t='Error', message= 'Not a valid light!' , button = 'OK' )
            return 0
            
    pm.textFieldButtonGrp( 'txtBtn_light', edit=True, text=str( light[0] ) ) 
    return 1
Exemplo n.º 38
0
def gui():
    # Creating a window.
    win = pm.window(w=150, h=100)
    main = pm.columnLayout()
    
    # Interface components go after the main layout,
    # Different components simular flags
    # They all have a rectangle bounding box!
    pm.textFieldButtonGrp( label='Float Attribute', buttonLabel='Apply' )
    
    
    # Showing a window
    win.show()
Exemplo n.º 39
0
 def createRig(self, *args):
     BlendSineRig.BlendSineRig(control=pm.textFieldButtonGrp(
                               self.cnt_fld, q=1, text=1),
                               name=pm.textFieldGrp(
                               self.name_fld, q=1, text=1),
                               numJnts=pm.textFieldGrp(
                               self.numJnts_fld, q=1, text=1),
                               curve=pm.textFieldButtonGrp(
                               self.crv_fld, q=1, text=1),
                               fwdBackCrvs=pm.textScrollList(
                                   self.fwd_sFld, q=1, ai=1),
                               sideToSideCrvs=pm.textScrollList(
                                   self.side_sFld, q=1, ai=1),)
Exemplo n.º 40
0
    def changeProjectCallBack(self, projName):
        pm.textFieldButtonGrp(self.widgetName, e=True, text=projName)

        if self.projectName != projName:
            self.projectName = projName
            database.setCurrentProject(self.projectName)

            if self.folderTreeWidget:
                self.folderTreeWidget.projectName = self.projectName
                self.folderTreeWidget.getFolderTree()

            if self.itemListWidget:
                self.itemListWidget.projectName = self.projectName
                self.itemListWidget.refreshList(path=[], task=self.itemListWidget.task)
Exemplo n.º 41
0
def pickHLitPt(*args):
    hLitPt = pm.ls( sl=True )
    
    if ( len( hLitPt) != 1 ):
        pm.confirmDialog( t='Error', message= 'Selct one reference point!' , button = 'OK' )
        return 0;
       
    pm.textFieldButtonGrp( 'txtBtn_HLitPoint', edit=True, text=str( hLitPt[0] ) )
    
    #// store the initial point position
    global pos_hLitPt
    pos_hLitPt = pm.ls(sl=True)[0].getTranslation(space='world')
    
    return 1
Exemplo n.º 42
0
    def _compile_ui_file(*args):
        import sys, pprint
        from pyside2uic import compileUi

        py_file = pm.textFieldButtonGrp(py_store_path_field, q=True, text=True)
        ui_file = pm.textFieldButtonGrp(ui_file_location_field,
                                        q=True,
                                        text=True)
        output_file = open(py_file, 'w')
        compileUi(ui_file, output_file, False, 4, False)
        output_file.close()

        print("Compile Done!")
        return True
Exemplo n.º 43
0
    def putProjectSettings(self):
        self.projDict['projectName'] = pm.textFieldGrp(self.projNameTxt,
                                                       q=True,
                                                       text=True)
        self.projDict['prefix'] = pm.textFieldGrp(self.prefixTxt,
                                                  q=True,
                                                  text=True)
        self.projDict['status'] = pm.optionMenuGrp(self.statusOpt,
                                                   q=True,
                                                   v=True)
        self.projDict['workLocation'] = pm.textFieldButtonGrp(self.workLocTxt,
                                                              q=True,
                                                              text=True)
        self.projDict['publishLocation'] = pm.textFieldButtonGrp(
            self.publishLocTxt, q=True, text=True)
        self.projDict['imagesWorkLocation'] = pm.textFieldButtonGrp(
            self.imgWorkLocTxt, q=True, text=True)
        self.projDict['imagesPublishLocation'] = pm.textFieldButtonGrp(
            self.imgPublishLocTxt, q=True, text=True)
        self.projDict['cacheLocation'] = pm.textFieldButtonGrp(
            self.cacheLocTxt, q=True, text=True)
        self.projDict[
            'assetCollection'] = self.projDict['projectName'] + '_asset'
        self.projDict[
            'shotCollection'] = self.projDict['projectName'] + '_shot'
        nameTemplateString = pm.textFieldGrp(self.nameTemplTxt,
                                             q=True,
                                             text=True)
        self.projDict['assetNameTemplate'] = nameTemplateString.split(',')
        cacheTemplateString = pm.textFieldGrp(self.cacheTemplTxt,
                                              q=True,
                                              text=True)
        self.projDict['cacheNameTemplate'] = cacheTemplateString.split(',')
        self.projDict['fps'] = pm.textFieldGrp(self.fpsTxt, q=True, text=True)
        self.projDict['mayaVersion'] = pm.optionMenuGrp(self.mayaVersionOpt,
                                                        q=True,
                                                        v=True)
        self.projDict['renderer'] = pm.optionMenuGrp(self.rendererOpt,
                                                     q=True,
                                                     v=True)

        res = pm.optionMenuGrp(self.resolutionOpt, q=True, v=True)
        self.projDict['resolution'] = [
            int(res.split('x')[0]),
            int(res.split('x')[1])
        ]

        self.projDict['assetFolders'] = self.assetTreeView.putFolderTree()
        self.projDict['shotFolders'] = self.shotTreeView.putFolderTree()
Exemplo n.º 44
0
def MakeObjectSelectorField(objectAttribute, annotation=None):
    """
    Creates & returns a composite UI component, for the given MayaObjectAttribute, which allows 
    the user to select from objects in the Maya scene of a given type. 
    
    :param objectAttribute: MayaObjectAttribute instance. 
    :param annotation: toolTip annotation, or None. 
    """
    if(not isinstance(objectAttribute, at.MayaObjectAttribute)):
        raise TypeError("Attempted to make object selector (expected:%s, got:%s)" % 
                        (at.MayaObjectAttribute, type(objectAttribute)))
     
    rowLayout = MakeRowLayout(2)
     
    MakeText(objectAttribute.attributeLabel, annotation)
    
    nameField = pm.textFieldButtonGrp(editable=False, buttonLabel="...", 
                                      adjustableColumn=1, columnWidth2=(150, 50))
    if(annotation is not None):
        nameField.setAnnotation(annotation)
    elif(objectAttribute.annotation is not None):
        nameField.setAnnotation(objectAttribute.annotation)
        
    objectAttribute.updateUiCommand = (lambda val: nameField.setText(val.name() if(val is not None) else "<None>"))
    objectAttribute._updateInputUiComponents()
    nameField.buttonCommand(lambda *args: _MakeObjectSelectionList(objectAttribute)) 

    SetAsChildLayout(rowLayout)
    
    return rowLayout
Exemplo n.º 45
0
 def createFunctions(self, windowObj):
     
     if windowObj is None:
         print "UI Element does not exist: %s" % UIpath
         return 
     else:
         mel.setParent(windowObj._wName)
         mel.columnLayout('funcCol',adj=False,height=self._optionFuncHeight)
         self._FuncFrame = mel.frameLayout( self._FuncFrame, l='Function Frame' ,lv=True, bv=True )
         mel.columnLayout('fileCol',adj=True)
         mel.rowColumnLayout( 'funcRowColumn', numberOfColumns=2)
         self._recButton = mel.button( label="RECORD", command = mel.Callback( self._buttonRecord, self._FuncFrame ) )
         self._playButton = mel.button( label="EXECUTE", command = mel.Callback( self._buttonPlay, self._FuncFrame ) )
         mel.setParent('..') 
         mel.columnLayout('fileCol',adj=True)
         mel.textFieldButtonGrp( label='File Name:', fileName='Path/file.txt', buttonLabel='Import/Export' )  
Exemplo n.º 46
0
 def create(self):
     
     self.main_layout = pm.columnLayout(adjustableColumn= True, width= 400)
     main_frame = pm.frameLayout( label='%s' % (self.obj), collapsable= True)
     pm.columnLayout(adjustableColumn= False, width= 400)
     self.mapping_menu = pm.optionMenu( label='Mapping', width= 150,
             changeCommand= pm.Callback(self.mapping_type, self.obj))
     pm.menuItem( label='Spherical')
     pm.menuItem( label='Angular')
     
     pm.setParent(main_frame)
     self.type_menu = pm.optionMenu( label='Type', width= 150,
             changeCommand= pm.Callback(self.file_type, self.obj))
     pm.menuItem( label='Image File')
     pm.menuItem( label='Texture')
     
     self.image_field = pm.textFieldButtonGrp(label= 'Image Name', editable= False, columnWidth3= [100,200,100],
             buttonLabel= '<<<', buttonCommand= pm.Callback(self.load_image, self.obj))
     
     
     self.list_field = pm.textScrollList(allowMultiSelection= False ,
                 width= 100, height= 100)
     pm.attrColorSliderGrp( at='%s.color' % (self.obj),
                           columnWidth4= [100, 75, 175, 50])
     
     pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 200], [2, 200]))
     pm.button(label= 'List Ramps', command= pm.Callback(self.list_textures))
     pm.button(label= 'Link Ramps', command= pm.Callback(self.link_texture, self.obj))
     pm.button(label= 'Edit Ramps', command= pm.Callback(self.edit_ramp))
     pm.button(label= 'Create Ramps', command= pm.Callback(self.create_ramp))
Exemplo n.º 47
0
def doAddAOVAttr(*args):
    if( ( isSelEmpty() and isObjType() ) == False ):
        return 0
        
    aovName = pm.textFieldButtonGrp( 'txtBtnAddAttr', query=True, text=True )
    if( len(aovName) == 0 ):
        pm.confirmDialog( t='warning', message='AOV name field is empty!', icon='warning' )
        return 0
    
    for obj in sel:                  
       if( not( obj.hasAttr(prefixAOV+'Id') ) ):
           addUserAttr( obj, 'string' )
                   
       # add AOV name as Attribute
       pm.PyNode( obj + '.' + prefixAOV + 'Id' ).set( 'id_'+aovName )
    
       # skip loop if the input textfield is empty
       if( len(aovName) == 0 ): continue
            
       # add AOV render pass
       # check if AOV already existing
       if( len( pm.ls('aiAOV_id_'+aovName) ) == 0 ):
           addAOV( aovName )
           
    return 1
Exemplo n.º 48
0
 def __init__(self, debug=0):
     title="TransferBlendShapes"
     if(pm.windowPref(title, q=True, ex=True)):
         pm.windowPref(title, remove=True)
     if(pm.window(title, q=True, ex=True)):
         pm.deleteUI(title)
         
     self.win = pm.window(title, title="Transfer BlendShapes Tool")
     self.rowColumnLayoutA = pm.rowColumnLayout()
     self.intro = pm.text( label='complete the following steps in order' )
     self.frameLayoutA = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 1   Load Target Mesh', borderStyle='in' )
     self.columnlayoutA = pm.columnLayout()
     self.frameLayoutB = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 2   Import Mask', borderStyle='in' )
     self.columnlayoutA = pm.columnLayout()
     self.frameLayoutC = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True,  label='Step 3   Manipulate Match Mesh', borderStyle='in' )
     self.columnlayoutB = pm.columnLayout()
     self.frameLayoutD = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 4   Transfer Blends', borderStyle='in' )
     self.columnlayoutC = pm.columnLayout()
     #self.dockControl = pm.dockControl(label=title, area='right', content=title, allowedArea=['right', 'left'], sizeable=True)
     
     # fameA content
     self.names = {'Target':None}
     
     # Generating x number of fields based on dictionary keys of self.names
     for name in self.names:
         self.names[name] = pm.textFieldButtonGrp(cw = ((1, 76), (2, 176)), parent=self.frameLayoutA,
                                                  label = name, 
                                                  placeholderText = 'Enter Name Here   or   >>>> ',
                                                  buttonLabel = 'load selected', tcc= self.prepTargetMeshOn,
                                                  buttonCommand = pm.Callback(self.nameField_load, name))
     self.btn_prepTgt = pm.button(parent=self.frameLayoutA, enable=False, w=40, h=20, label="Prep Target", command=self.prepTargetMesh)
     self.fA_fillText = pm.text(parent=self.frameLayoutA, label='    ' )
         
     # fameB content
     self.importText = pm.text(parent=self.frameLayoutB, label='Import the desired facial mask' )
     self.manipulateText = pm.text(parent=self.frameLayoutB, label='Use the avalable controls to manipulate the mask' )
     self.fitText = pm.text(parent=self.frameLayoutB, label='Roughly fit the mask to the target mesh' )
     self.btn_trueHuman = pm.button(parent=self.frameLayoutB, enable=True, w=40, h=20, label="Human Anatomy", command=self.humanAnatomyImport)  
     self.btn_trueMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Anatomy", command=self.muzzleAnatomyImport)
     self.btn_toonHuman = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Human Toon", command=self.humanToonImport)  
     self.btn_toonMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Toon", command=self.muzzleToonImport)
     self.fB_fillText = pm.text(parent=self.frameLayoutB, label='    ' )
     
     # fameC content
     self.matchMeshText = pm.text(parent=self.frameLayoutC, label='activate match mesh and refine your geometry to better match the target' )
     self.btn_trueHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="Activate Match Mesh", command=self.matchMesh)
     self.btn_templateHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="template Target Mesh", command=self.tempTgt)
     self.btn_referenceHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="reference Target Mesh", command=self.refTgt)
     self.sldr_smooth = pm.intSliderGrp(parent=self.frameLayoutC, field=True, label='Match Mesh Divisions', minValue=-0, maxValue=4, fieldMinValue=-0, fieldMaxValue=4, value=0, cc=self.div_Slider_change)
     self.fC_fillText = pm.text(parent=self.frameLayoutC, label='    ' )
     
     # fameD content
     self.btn_go = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="Transfer Shapes", command=self.execute)  
     self.btn_no = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="NO DONT DO IT!", command=self.close)
     self.fE_fillText = pm.text(parent=self.frameLayoutD, label='    ' )
     self.win.show()
     if debug:
         test = ['mask_blendPipe_GEO', 'mask_hiRes_GEO']
         for name, test_val in zip(self.names, test):
             self.names[name].setText(test_val)
Exemplo n.º 49
0
    def initUI(self):
        pm.setUITemplate("DefaultTemplate", pushTemplate=True)
        form = pm.formLayout()

        binMeshExportPath = pm.optionVar.get('mtap_binMeshExportPath', pm.workspace.path + "/geo/export.binarymesh")
        prefix = pm.optionVar.get('mtap_binMeshExportPathPrefix', "prefix")
        createProxy = pm.optionVar.get('mtap_binMeshCreateProxy', True)
        percentage = pm.optionVar.get('mtap_binMeshPercentage', 0.1)
        createStandin = pm.optionVar.get('mtap_binMeshCreateStandin', True)
        oneFilePerMesh = pm.optionVar.get('mtap_binMeshOneFilePerMesh', False)
        useTransform = pm.optionVar.get('mtap_binMeshUseTransform', False)

        with pm.columnLayout('StandinLayout') as StandinLayout:
            with pm.frameLayout('StandinLayout', label="Standin export options", collapsable=False):
                with pm.columnLayout('StandinColumnLayout'):
                    self.pathUI = pm.textFieldButtonGrp(label="Standin directory", text=binMeshExportPath, buttonLabel="File", buttonCommand=self.fileBrowser)
                    self.prefixUI = pm.textFieldGrp(label="Prefix", text=prefix)
                    self.createProxyUI = pm.checkBoxGrp(label="Create proxy", value1=createProxy)
                    self.percentageUI = pm.floatFieldGrp(label="Percentage", value1=percentage)
                    self.createStdInUI = pm.checkBoxGrp(label="Create StandIn", value1=createStandin)
                    self.oneFilePerMeshUI = pm.checkBoxGrp(label="One File Per Mesh", value1=oneFilePerMesh)
                    self.doTransformUI = pm.checkBoxGrp(label="Use Transform", value1=useTransform)
            with pm.rowColumnLayout(numberOfColumns=2):
                pm.button(label="Create BinaryMesh", c=self.doit)
                pm.button(label="Cancel", c=self.cancel)

        pm.formLayout(form, edit=True, attachForm=[(StandinLayout, 'top', 5), (StandinLayout, 'bottom', 5), (StandinLayout, 'right', 5), (StandinLayout, 'left', 5)])
        pm.setUITemplate("DefaultTemplate", popTemplate=True)
Exemplo n.º 50
0
def doSelItem( name ):
    _obj = pm.textFieldButtonGrp( name, query=True, text=True )
    if( pm.ls(_obj) == [] ):
        print 'no object selected!'
        return 0
        
    pm.select(_obj, r=True )
    return 1
Exemplo n.º 51
0
def pickCam(*args):
    cam = []  
    cam = pm.ls( sl=True )
    if ( len( cam ) == 0 ):
        cam.append( getActiveCam() )
    
    else:
        if ( len( cam ) > 1 ):
            pm.confirmDialog( t='Error', message= 'Selct only One Camera!' , button = 'OK' )
            return 0;
        
        if ( pm.nodeType( cam[0].getShape() ) != 'camera' ):
            pm.confirmDialog( t='Error', message= 'Selct object is NOT Camera!' , button = 'OK' )
            return 0
       
    pm.textFieldButtonGrp( 'txtBtn_camera', edit=True, text=str( cam[0] ) )
    return 1
Exemplo n.º 52
0
def pickTgtObj(*args):
    tgtObj = pm.ls( sl=True )
    
    if ( len( tgtObj) != 1 ):
        pm.confirmDialog( t='Error', message= 'Selct only One Mesh Object!' , button = 'OK' )
        return 0
    
    if ( pm.nodeType( tgtObj[0].getShape() ) != 'mesh' ):
        pm.confirmDialog( t='Error', message= 'Selct object is NOT Mesh' , button = 'OK' )
        return 0
       
    pm.textFieldButtonGrp( 'txtBtn_object', edit=True, text=str( tgtObj[0] ) )
    
    #// initialize make live objet
    pm.makeLive( none=True )
    pm.makeLive( str(tgtObj[0]) )
    
    return 1
Exemplo n.º 53
0
 def setValue(self, value):
     if value == "stdingfilename":
         self.fileName = pm.textFieldButtonGrp("stdingfilename", query=True, text=True)
     if value == "stdinshowpoints":
         self.showPoints = pm.checkBoxGrp("stdinshowpoints", query=True, value1=True)
     if value == "stdinptdensity":
         self.density = pm.floatFieldGrp("stdinptdensity", query=True, value1=True)          
     if value == "stdinptsize":
         self.pointSize = pm.intFieldGrp("stdinptsize", query=True, value1=True)
Exemplo n.º 54
0
 def __init__(self, opts):
     self.opts = opts
     with pm.frameLayout(l='UV Snapshot:', cll=True, cl=False, bs='out'):
         with pm.columnLayout(width=162):
             self.path = pm.textFieldButtonGrp(l='Path:', bl='...', cw3=[28, 104, 32], bc=self.set_path)
             self.col = pm.colorSliderGrp(l='Color:', cw3=[32, 48, 74])
             with pm.rowLayout(nc=2):
                 self.of = pm.checkBox(l='Open File')
                 self.aa = pm.checkBox(l='Anti-Alias', v=True)
             pm.button(l='Save Snapshot', width=156, c=self.snap_shot)
Exemplo n.º 55
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Define Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout()

        #=======================================================================
        # Define PSD Create Layout
        #=======================================================================
        pm.setParent(self.widgets['top_level_layout'])
        self.widgets["blend_shaper_column"] = pm.columnLayout(adj=True, rowSpacing=1, columnAttach = ['both', 5])
        self.widgets["object_textField"] = pm.textFieldButtonGrp(label="Object :",
                                                                 adj=2,
                                                                 cw=[[1,100],[2,60],[3,30]],
                                                                 bc=self.load_selected_object)
        self.widgets["blendShapeNode_textField"] = pm.textFieldButtonGrp(label='BlendShape Node :',
                                                                         adj=2,
                                                                         cw=[[1,100],[2,60],[3,30]],                                                                         
                                                                         bc=self.load_blendShapeNode)
                
        
        pm.setParent(self.widgets['blend_shaper_column'])
        self.widgets["blendShape_textScroll"] = pm.textScrollList(selectCommand=pm.Callback( self.select_shape, 'blendShape' ))
        self.widgets["mask_textScroll"] = pm.textScrollList(selectCommand=pm.Callback( self.select_shape, 'mask' ))

        buttonsHL = pm.horizontalLayout(h=40)
        self.widgets['new_weight_button'] = pm.button(label='New', c=self.newWeight)
                
        self.widgets['invert_weight_button'] = pm.button(label='Invert', c=self.invertWeight)
        self.widgets['multiply_weight_button'] = pm.button(label='Multiply', c=self.multiplyWeight)

        self.widgets['copy_weight_button'] = pm.button(label='Copy', c=self.copyWeight)
        self.widgets['paste_weight_button'] = pm.button(label='Paste', c=self.pasteWeight)


        buttonsHL.redistribute()
        #=======================================================================
        # Redistribute
        #=======================================================================

        self.widgets['top_level_layout'].redistribute()
Exemplo n.º 56
0
def gui():
    # Creating a window.
    win = pm.window(w=150, h=100)
    main = pm.columnLayout()
    
    # Interface components go after the main layout,
    # Different components simular flags
    # They all have a rectangle bounding box!
    pm.button(w=150, command=work)
    
    pm.textFieldButtonGrp( label='Float Attribute',
                          buttonLabel='Apply',
                          buttonCommand=work)
    
    pm.intField(w=150, changeCommand=work)
    pm.floatSliderGrp(changeCommand=work)

    pm.floatSliderGrp(cc=work, dc=work)
    
    # Showing a window
    win.show()
Exemplo n.º 57
0
 def __init__(self):
     self.title = "Mantra Standin"
     self.fileName = ""
     self.density = .3
     self.pointSize = 1
     self.showPoints = False
     self.boundingBox = [-.5, -.5, -.5, .5, .5, .5]
     
     pm.setUITemplate("DefaultTemplate", pushTemplate=True)
     self.height = 500
     with pm.frameLayout(collapsable=False, labelVisible=False) as frame:
         pm.textFieldButtonGrp("stdingfilename", label="GeoFileName", text="", buttonLabel="Select", bc=pm.Callback(self.selectGeoFile), cc=pm.Callback(self.setValue, "stdingfilename"))
         #string $b = `symbolButton -image "navButtonBrowse.xpm" browser`;
         with pm.frameLayout(collapsable=False, label="Points"):
             pm.checkBoxGrp("stdinshowpoints", label="Show Points", value1=False, cc=pm.Callback(self.setValue, "stdinshowpoints"))
             pm.floatFieldGrp("stdinptdensity", label="PointDensity", value1=0.3, cc=pm.Callback(self.setValue, "stdinptdensity"))
             pm.intFieldGrp("stdinptsize", label="PointSize", value1=1, cc=pm.Callback(self.setValue, "stdinptsize"))
         with pm.rowLayout(nc=2):
             pm.button(label="Create Standin", c=pm.Callback(self.createStandin))            
             pm.button(label="Cancel", c=pm.Callback(self.delete))        
     self.show()
Exemplo n.º 58
0
def checkItems( *args ):
    global item_list
    item_list = []
    
    _light = pm.textFieldButtonGrp( 'txtBtn_light', query=True, text=True )
    _camera = pm.textFieldButtonGrp( 'txtBtn_camera', query=True, text=True )
    _object = pm.textFieldButtonGrp( 'txtBtn_object', query=True, text=True )
    _point = pm.textFieldButtonGrp( 'txtBtn_HLitPoint', query=True, text=True )
    item_list = [ _light, _camera, _object, _point ]
    

    for index, item in enumerate(item_list, 1):
        if( item == '' ):
            pm.confirmDialog( t='Error', message= ( 'Please specify item ' + str(index) ) , button = 'OK' )
            return 0
        if( len(pm.ls(item)) == 0 ):
            pm.confirmDialog( t='Error', message= ( '%s is not existing in scene!' % item ) , button = 'OK' )
            return 0
    
    #// all items are valid !
    return 1