示例#1
2
def lcObj_exportObjs(*args, **kwargs):
  ''' Export .obj files from selected geometry, either as one combined file or as individual files per object.  Will recognize and convert poly smooth preview to geometry for export '''
  global prefix
  path = pm.textField(prefix+'_textField_export_path', query=True, text=True)
  objPrefix = pm.textField(prefix+'_textField_prefix', query=True, text=True)
  if objPrefix:
    objPrefix+='_'

  if path:

    sel = pm.ls(sl=True)

    if sel:
      sel = geometry.filterForGeometry(sel)
      print sel

      #undo is the easiest way to work on geometry temporarily
      pm.undoInfo(openChunk=True)

      if pm.checkBox(prefix+'_checkBox_use_smooth', query=True, v=True):
        for obj in sel:
          pm.select(obj)
          #find the objects currently displayed as smooth and create converted poly copies
          if pm.displaySmoothness(q=True, polygonObject=True)[0] == 3:
            pm.mel.performSmoothMeshPreviewToPolygon()

      if pm.checkBox(prefix+'_checkBox_export_indi', query=True, v=True):
        #export objects individually
        for obj in sel:
          pm.select(obj)
          name = str(obj)
          exportString = path+'/'+objPrefix+name+'.obj'
          pm.exportSelected(exportString, force=True, options='groups=1;ptgroups=1;materials=0;smoothing=1;normals=1', type='OBJexport', pr=True, es=True)

      else:
        #export as one object
        pm.select(sel)
        name = ''
        while name == '':
          dialog = pm.promptDialog(title='OBJ Name', message='Enter Name:', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
          if dialog == 'OK':
            name = pm.promptDialog(query=True, text=True)
            if name:
              exportString = path+'/'+objPrefix+name+'.obj'
              pm.exportSelected(exportString, force=True, options='groups=1;ptgroups=1;materials=0;smoothing=1;normals=1', type='OBJexport', pr=True, es=True)
            else:
              pm.warning("You didn't type a name for your obj")
          if dialog == 'Cancel':
            break

      pm.undoInfo(closeChunk=True)
      pm.undo()
      pm.select(clear=True)

  else:
    pm.warning('Did you specify a path?')
示例#2
0
def createRigStructure():

	pm.promptDialog (m='Enter character name:', title='Autorig')
	characterName = pm.promptDialog(query=True, text=True)

	# create group structre for the rig
	mainGrp = pm.group(name=characterName, em=True)
	pm.group(name='mesh_grp', em=True, p=mainGrp)
	rigGrp = pm.group(name='rig_grp', em=True, p=mainGrp)

	# create main ctrl for the rig
	mainCtrlGrp = rigUtils.createRigControl('cross')
	mainCtrlGrp = pm.rename(mainCtrlGrp, 'main_ctrl')
	rigUtils.setControlColor(mainCtrlGrp)
	"""
	pm.group(name='m_head_grp', em=True, p=mainCtrlGrp)
	pm.group(name='m_spine_grp', em=True, p=mainCtrlGrp)
	pm.group(name='l_leg_grp', em=True, p=mainCtrlGrp)
	pm.group(name='l_leg_grp', em=True, p=mainCtrlGrp)
	pm.group(name='l_arm_grp', em=True, p=mainCtrlGrp)
	pm.group(name='r_arm_grp', em=True, p=mainCtrlGrp)
	pm.group(name='l_foot_grp', em=True, p=mainCtrlGrp)
	pm.group(name='r_foot_grp', em=True, p=mainCtrlGrp)
	"""
	pm.parent(mainCtrlGrp, rigGrp)
示例#3
0
 def create_new_pose_prompt(self):
     if not pm.selected():
         pm.warning ("Please Select an Object")
         return
     
     namespace = pm.selected()[0].split(":")[0]
     targetObj = "%s:geo"%(namespace)           
             
     result = pm.promptDialog(
         title='Create New Pose',
         message='Enter Pose Name:',
         button=['OK', 'Cancel'],
         defaultButton='OK',
         cancelButton='Cancel',
         dismissString='Cancel')
     
     if result == 'OK':
         name = pm.promptDialog(query=True, text=True)
         directory = self.get_active_directory()
         
         path = os.path.join(directory, "%s.pose" %name)
         pose_obj = Pose(path)
         pose_obj.create()
         
         pose_obj.save_pose()
         pose_obj.update_thumbnail(targetObj)
         
         self.populate_library_layout()
示例#4
0
 def _addClicked(self, *args):
     result = _pmCore.promptDialog(title='New Category', message="Enter Name: ", button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
     if result == 'OK':
         newCategory = _pmCore.promptDialog(query=True, text=True)
         _Database.addCategory(newCategory)
         _pmCore.textScrollList(self._textScrollList, edit=True, append=newCategory)
         self._updateCallback(newCategory)
示例#5
0
文件: pyMel.py 项目: lovejunjie1/jun
def mel2pyDialog():
    """ this convert mel to python file.
   
    how to use:
    from rigWorkshop.ws_user.jun.utils import pyMel
    #mel to pymel convertor.
    pyMel.mel2pyDialog()
    """

    result = pm.promptDialog(title='mel2py convertor',
                             message='Enter Name:',
                             button=['OK', 'Cancel'],
                             defaultButton='OK',
                             cancelButton='Cancel',
                             dismissString='Cancel')

    if result == 'OK':
        text = pm.promptDialog(query=True, text=True)

        # Get the PyMel equivalent
        pmAnswer = mel2py.mel2pyStr(text, pymelNamespace='pm')

        # Get rid of the old way
        pmCode = pmAnswer.replace("pymel.all", "pymel.core")
        print(pmCode)
def saveShaders():
    # Prompt user with a string to search shader by names
    dialog = pc.promptDialog(title='Search joker',
                    message='Enter joker to find specific shaders :',
                    button=['OK', 'Cancel'],
                    defaultButton='OK',
                    cancelButton='Cancel',
                    dismissString='Cancel')
    
    joker = pc.promptDialog(query=True, text=True)
    
    # List shaders named that way
    listShaders = pc.ls(joker, exactType='aiStandard')
    
    
    for shader in listShaders:
         
        # This variable will contain all shape that have the current shader assigned
        shapeList = []
        
        # Select shapes with the current shader
        pc.hyperShade(o=shader)
        selectedShapes = pc.ls(sl=1)
        
        # Clear selection, just for clarity
        pc.select(cl=1)
        
        # Append the shape to the list
        for shape in selectedShapes:
            shapeList.append(str(shape))
        
        # Assign the list to the dictionnary with the key set to the shader name
        infos[str(shader)] = shapeList
        
    print "Saved informations :\n %s" % infos
示例#7
0
def orderedRename( objects=[], name=None, prompt=True ):
    """Renames selected objects in order of selection."""
    result = 'OK'

    if prompt:
        opt_name = 'orderedRename_name'

        result = pm.promptDialog( title='Ordered Rename',
                              message='Enter name:',
                              text=pm.optionVar.get( opt_name, 'object0' ),
                              button=( 'OK', 'Cancel' ),
                              defaultButton='OK',
                              cancelButton='Cancel',
                              dismissString='Cancel'
                              )
        if result == 'OK':
            name = pm.promptDialog( query=True, text=True )
            pm.optionVar[opt_name] = name

    if result == 'OK':
        if not prompt and name is None:
            assert False, r"'name' needs to be set when using 'prompt=False'"
        else:
            if len( objects ) is 0:
                objects = pm.ls( selection=True, type='transform' )

            i = 0
            for obj in objects:
                pm.rename( obj, name )
                i += 1

            print '// Results: %i objects renamed as "%s" //' % ( i, name )
示例#8
0
    def _renamePose( self ):
        group = self._poseGroups[ self.groupOM.getValueStr() ]

        try:
            poseName = self.poseListTSL.getSelectItem()[0]
            pose = group[poseName]
        except:
            assert False, 'No pose selected for rename.'

        result = pm.promptDialog( title='Rename Pose',
                               message='Pose Name:',
                               text=poseName,
                               button=['OK', 'Cancel'],
                               defaultButton='OK',
                               cancelButton='Cancel',
                               dismissString='Cancel')
        if result == 'OK':
            newPoseName = re.sub('\W', '_', pm.promptDialog(query=True, text=True) )

            if not group.has_key( newPoseName ):
                group.pop( poseName )
                group[ newPoseName ] = pose
                self._poseGroups[ self.groupOM.getValueStr() ] = group

                self._updatePoseList()
                self._savePrefs()

                self.poseListTSL.setSelectItem(newPoseName)
            else:
                assert False, 'Pose named "%s" already exists in group.' % newPoseName

        else:
            pass #mel.warning('Process Canceled.')
示例#9
0
    def _newPose( self ):
        assert len( pm.ls( selection=True, type=("transform","objectSet") ) ), 'Select objects to capture pose of'

        #if len( ls( selection=True ) ) == 0:
            #mel.warning('Select objects to capture pose of')
        #else:

        result = pm.promptDialog( title='Create New Pose',
                               message='Pose Name:',
                               button=['OK', 'Cancel'],
                               defaultButton='OK',
                               cancelButton='Cancel',
                               dismissString='Cancel')
        if result == 'OK':
            poseName = re.sub('\W', '_', pm.promptDialog(query=True, text=True) )
            pose = Pose( poseName, [] ) #empty braces needed due to weirdness with python
            pose.capture()

            _g = self._poseGroups[ self.groupOM.getValueStr() ]
            _g[ poseName ] = pose
            self._poseGroups[ self.groupOM.getValueStr() ] = _g


            self._updatePoseList()
            self.poseListTSL.setSelectItem( poseName )

            self._savePrefs()
示例#10
0
文件: previs.py 项目: eoyilmaz/anima
    def set_sequencer_name(self):
        """set sequencer name for publish
        """
        from anima.exc import PublishError
        import anima.env.mayaEnv.publish as oy_publish

        try:
            oy_publish.check_sequence_name()
            oy_publish.check_sequence_name_format()
        except:
            seq_name = None
            if self.current_type == self.prev_type:
                seq_name = '_'.join(self.current_version.nice_name.split('_Previs')[0].split('_')[-3:]).upper()
            if self.current_type == self.anim_type:
                seq_name = '_'.join(self.current_version.nice_name.split('_')[:3]).upper()
            self.sequencer.set_sequence_name(seq_name)

            message = 'Scene Task name is Wrong.\n'
            # message += '%s\n' % seq_name
            message += '\n'
            message += 'Enter Seq Name Manually below like:\n'
            message += 'EP001_001_TEMP  or SEQ001_001_TEMP\n'
            message += '<Episode Num>_<Scene Num>_<Env>'
            pd = pm.promptDialog(title='Error', message=message, button='SET Seq Name')

            if pd == 'SET Seq Name':
                seq_name = pm.promptDialog(q=1, text=1)
                self.sequencer.set_sequence_name(seq_name)

            try:
                oy_publish.check_sequence_name_format()
            except PublishError as e:
                raise RuntimeError(e)
示例#11
0
def makeLightSelectSet(sel=None):
    try:
        lgt = select.shapes(sel, xf=True, do=True)
    except:
        pass

    _go = pm.promptDialog(title='New Light Group:',
                          message='Enter Name:',
                          button=['OK', 'Cancel'],
                          tx='lg_',
                          defaultButton='OK',
                          cancelButton='Cancel',
                          dismissString='Cancel')

    if _go == 'OK':
        name = pm.promptDialog(query=True, text=True)
        _lg = pm.PyNode(pm.Mel.eval(
            'vrayAddRenderElement LightSelectElement;'))  # make the light grou

        pm.rename(_lg, name)
        _lg.vray_name_lightselect.set(name)
    else:
        return None

    if sel:
        for obj in sel:
            pm.sets(_lg, edit=True, forceElement=obj)

    return _lg
示例#12
0
def suffixName( objects=[], suffix=None, dag=True, prompt=True ):
    """Add a suffix to all hierarchy names."""
    result = 'OK'

    if prompt:
        opt_suffix = 'suffixNames_suffix'

        result = pm.promptDialog( title='Suffix Name',
                              message='Enter suffix:',
                              text=pm.optionVar.get( opt_suffix, '_suffix' ),
                              button=( 'OK', 'Cancel' ),
                              defaultButton='OK',
                              cancelButton='Cancel',
                              dismissString='Cancel'
                              )
        if result == 'OK':
            suffix = pm.promptDialog( query=True, text=True )
            pm.optionVar[opt_suffix] = suffix

    if result == 'OK':
        if not prompt and suffix is None:
            assert False, r"'suffix' needs to be set when using 'prompt=False'"
        else:
            if len( objects ) is 0:
                objects = pm.ls( selection=True, type='transform', dag=dag )
            else:
                objects = pm.ls( objects, type='transform', dag=dag )

            i = 0
            for obj in objects:
                pm.rename( obj, obj.split( '|' )[-1] + suffix )
                i += 1

            print '// Results: %i objects rename with suffix "%s" //' % ( i, suffix )
示例#13
0
    def _renameGroup( self ):
        selPose = self.poseListTSL.getSelectItem()

        groupName = self.groupOM.getValueStr()
        group = self._poseGroups[ groupName ]

        assert (groupName != self._default), 'Cannot rename \'%s\' group' % self._default.rstrip()

        #if groupname == self._default:
            #mel.warning( 'cannot rename \'%s\' group' % self._default.rstrip() )
        #else:
        result = pm.promptDialog( title='Rename Pose',
                               message='Pose Name:',
                               text=groupName,
                               button=['OK', 'Cancel'],
                               defaultButton='OK',
                               cancelButton='Cancel',
                               dismissString='Cancel')
        if result == 'OK':
            newGroupName = str( re.sub('\W', '_', pm.promptDialog(query=True, text=True) ) )

            self._poseGroups.pop( groupName )
            self._poseGroups[newGroupName] = group

            self._updateGroupList()
            OptionMenu( self.groupOM, edit=True, select=self._sortedGroupList().index(newGroupName) + 1 )
            self._updatePoseList()
            if selPose is not None:
                self.poseListTSL.setSelectItem( selPose )
            self._savePrefs()
示例#14
0
def User_inputDialog(title, message):
        
    result = pc.promptDialog(title=title, message=message, button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
    if result == 'OK':
        text = pc.promptDialog(query=True, text=True)
        return text
    elif result == 'Cancel':
        exit('User abort.')
示例#15
0
文件: ui.py 项目: kyuhoChoi/mayaTools
def btn_loadJoint():
    reload(tmp)

    result = pm.promptDialog(m='password : '******'********')
    if result=='Confirm':
        password = pm.promptDialog(q=True, text=True)
        if password == 'alfred66':
            tmp.loadJoint()
示例#16
0
文件: ui.py 项目: kyuhoChoi/mayaTools
def btn_createTwoPointArcCrv():
    import rig.curve as crv

    result = pm.promptDialog(m='Prefix : ', text=uiMem[3])
    if result=='Confirm':
        prefix = pm.promptDialog(q=True, text=True)
        uiMem[4] = prefix
        crv.twoPointArcRig( prefix=prefix )
示例#17
0
文件: ui.py 项目: kyuhoChoi/mayaTools
def btn_jointChain():

    result = pm.promptDialog(m='ctrlNum : ', text=uiMem[2])
    if result=='Confirm':
        num = int( pm.promptDialog(q=True, text=True) )
        uiMem[2] = num

        jnt.jointChain( ctrlNum=num )
	def createRig(self):
		pm.currentTime(0, e=True)

		global sel_objects
		sel_objects = pm.ls(sl=True, tr=True)
		if sel_objects == []:
			print '\n# Error: Please select an object first'
			pm.confirmDialog(title = 'Error: Nothing Selected', 
					m = 'Please select an object to create the light rig around.', 
					button = 'Ok', 
					db = 'Ok')
			self.close()
			gui(dock=False)
		else:
			global light_name
			light_name = 'light1'
			name_request = pm.promptDialog(
				t='Light Name', 
				m='Enter Your New Light\'s Name', 
				ma='left',
				tx='Ex: key_light',
				st='text', 
				b=['Ok', 'Cancel'], 
				db='Ok', 
				cb='Cancel',
				ds='Cancel')
			if name_request == 'Ok':
				light_name = pm.promptDialog(query=True, text=True)

			global sel_center
			sel_center = command.averageCoords(sel_objects)

			global rigOrbit, rigInterv, rigLight
			rigOrbit = pm.group(n='olp_orbitsGrp1', em=True)
			rigInterv = pm.group(n='olp_intervalsGrp1', em=True)
			rigLight = self.createLight(sel_center)
			self.setExpression()
			pm.createRenderLayer([sel_objects, rigOrbit, rigInterv, rigLight], noRecurse=True, name='{0}_layer'.format(light_name))
			self.createVis()

			pm.xform(rigOrbit, a=True, t=sel_center)
			pm.xform(rigInterv, a=True, t=sel_center)

			pm.parent(rigLight, rigInterv)
			pm.parent(rigInterv, rigOrbit)

			pm.select(sel_objects, r=True)

			# GUI Components enable/disable
			self.enableDisable_component(self.createRig_btn, enabled=False)
			self.enableDisable_component(self.deleteRig_btn, enabled=True)
			self.enableDisable_component(self.distance_label, enabled=True)
			self.enableDisable_component(self.distance_float, enabled=True)
			self.enableDisable_component(self.orbit_label, enabled=True)
			self.enableDisable_component(self.orbit_int, enabled=True)
			self.enableDisable_component(self.interv_label, enabled=True)
			self.enableDisable_component(self.interv_int, enabled=True)
			self.enableDisable_component(self.showVis_ckbx, enabled=True)
示例#19
0
文件: ui.py 项目: kyuhoChoi/mayaTools
def btn_rigTwistHelper():
    import rig.rigTwistHelper as tw
    reload(tw)

    result = pm.promptDialog(m='Prefix : ', text=uiMem[3])
    if result=='Confirm':
        prefix = pm.promptDialog(q=True, text=True)
        uiMem[3] = prefix
        tw.rigTwistHelper( prefix=prefix, divide=4 )
示例#20
0
文件: ui.py 项目: kyuhoChoi/mayaTools
def btn_createReverseTransform():
    import rig.transform as tr
    reload(tr)

    result = pm.promptDialog(m='Prefix : ', text=uiMem[2])
    if result=='Confirm':
        prefix = pm.promptDialog(q=True, text=True)
        uiMem[1] = prefix
        tr.createReverseTransform( prefix=prefix )
示例#21
0
文件: ui.py 项目: kyuhoChoi/mayaTools
def btn_crvToJnt( **kwargs ):
    global uiMem

    if 'div' in kwargs.keys():
        result = pm.promptDialog(m='Divide Num', text=uiMem[0])
        if result=='Confirm':
            kwargs['div'] = int( pm.promptDialog(q=True, text=True) )      
            uiMem[0] = kwargs['div']
            jnt.crvToJnt( **kwargs )
示例#22
0
def bless(obj=False):
    """ Creates and fills out an asset's custom metadata attributes.  
        Asset Path is determined on first export."""
    if not obj:
        obj = select.single()
        if not obj:
            return False
    # Create the attributes if necessary
    try:
        #if pm.addAttr(obj.assetName, q=True, exists=True):
        #    pass
        pm.PyNode(obj).attr('assetName')
    except:
        pm.addAttr(obj, ln='assetName', dt='string')
    try:
        #if pm.addAttr(obj.assetPath, q=True, exists=True):
        #    pass
        pm.PyNode(obj).attr('assetPath')
    except:
        pm.addAttr(obj, ln='assetPath', dt='string')
    try:
        #if pm.addAttr(obj.assetVersion, q=True, exists=True):
        #    pass
        pm.PyNode(obj).attr('assetVersion')
    except:
        pm.addAttr(obj, ln='assetVersion')        


    # Auto-fill values on first bless
    if obj.assetVersion.get() == 0.000:
        obj.assetVersion.set(1.000)
    if obj.assetName.get() == '' or obj.assetName.get() == None:
        query = pm.promptDialog(title='New Asset Name',
                                   message='Confirm name for asset >> ',
                                   text=str(obj),
                                   b=['OK', 'Cancel'],
                                   db='OK',
                                   cb='Cancel',
                                   ds='Cancel'
                                   )
        if query == 'OK':
            obj.assetName.set(pm.promptDialog(q=True, text=True))
            pm.rename(obj, obj.assetName.get())
        else:
            pm.delete(obj)
            return False

    # Fill out bless values
    name = obj.assetName.get()
    path = obj.assetPath.get()
    version = obj.assetVersion.get()

    # NOTE: path will return None on first run, by design
    return (name, version, path)
示例#23
0
文件: pbUV.py 项目: aaronfang/pbUV
 def dup_set(self, *args):
     uvset = self.uvs.getSelectItem()[0].split(' | ')
     bdialog = pm.promptDialog(title='Duplicate UVSet',
                               message='Enter New UVSet Name:',
                               button=['OK', 'Cancel'],
                               defaultButton='OK',
                               cancelButton='Cancel',
                               dismissString='Cancel')
     if bdialog == 'OK':
         pm.polyUVSet(uvset[0], copy=True, uvSet=uvset[1], newUVSet=pm.promptDialog(q=True, text=True))
         self.update_sets()
示例#24
0
	def addAnimBranch(*args):
		"""doc"""
		if not brn_optMenu.getValue() == 'Add New..':
			return
		result = pm.promptDialog(title= "New Anim Branch", message= "Enter Name:",
			button= ["OK", "Cancel"], defaultButton= "OK", cancelButton= "Cancel",
			dismissString= "Cancel")
		if result == "OK":
			branch = pm.promptDialog(query= 1, text= 1)
			pm.menuItem(branch, ia= '', p= brn_optMenu)
			brn_optMenu.setValue(branch)
def create_extrudes_UI():
    """ Runs the UI for the functions (just a dialog prompt)
    Args: (None)
    Returns: (None)
    """
    transforms = pm.ls(sl=True)
    result = pm.promptDialog(t='extrude rig',
                             m='Please enter a transform\'s name you want to use as a control\nIf it doesn\'t exist, it will be created anyways,\nif you have run it before it will use the object named grow_CTRL')
    if result == 'Confirm':
        text = pm.promptDialog(query=True, text=True)
        create_extrudes_and_connect(transforms, control=text)
示例#26
0
 def add_custom_aov(self, *args):
     if self.renderer == "arnold":
         st.newAOVPrompt()
     elif self.renderer == "mentalRay":
         result = pm.promptDialog(button=[u'创建', u'取消'],
                                  defaultButton='Create',
                                  message=u'mentalRay aov',
                                  title=u'创建aov')
         if result == u'创建':
             new_aov = pm.promptDialog(query=1, text=1)
             self.add_mr_aov(new_aov)
示例#27
0
def make_dialog(text="Name?", default=""):
    """Pop open a Maya dialog for naming shit"""
    input = pmc.promptDialog(message=text,
                             button=["OK", "Cancel"],
                             text=default,
                             defaultButton="OK",
                             cancelButton="Cancel")
    if input == "Cancel":
        return None

    return pmc.promptDialog(q=True, text=True)
示例#28
0
 def setMinDeltaLengthDialog(self):
     result = pm.promptDialog(
         title='minDeltaLength',
         message='Enter new minimum delta length value:\n'
         'default = "{0}"'.format(self.minDeltaLengthDefault),
         button=['OK', 'Cancel'],
         defaultButton='OK',
         cancelButton='Cancel',
         dismissString='Cancel',
         text=self.getMinDeltaLength())
     if result == 'OK':
         self.setMinDeltaLength(pm.promptDialog(query=True, text=True))
示例#29
0
def getSpaceName(prevName=''):
    # &&& This needs to prompt for a name
    name = ''
    msg = 'Enter a name'
    while not name:
        res = promptDialog(m=msg, t='Space Name', tx=prevName, b=['Enter', 'Cancel'])
        if res == 'Cancel':
            return None
        
        name = promptDialog(q=True, text=True)
    
    return name
示例#30
0
def main():
    result = pm.promptDialog(
        title="Create Master",
        message="Enter Asset Name:",
        button=["OK", "Cancel"],
        defaultButton="OK",
        cancelButton="Cancel",
        dismissString="Cancel",
    )

    if result == "OK":
        name = pm.promptDialog(query=True, text=True)
        utils.create_master(assetName=name)
示例#31
0
    def new(self, *args):
        """
        Callback function for button "New".
        Create a new preset.
        """
        result = pm.promptDialog(title='New Preset', message='Enter Name:',
                                 button=['OK', 'Cancel'], defaultButton='OK',
                                 cancelButton='Cancel', dismissString='Cancel')

        if result == 'OK':
            preset_name = pm.promptDialog(q=True, text=True)
            model.set_preset(preset_name)
            self.update(target=preset_name)
示例#32
0
    def doIt(self, args):

        result = pm.promptDialog(title='Kraken: Build Biped',
                                 message='Rig Name',
                                 button=['OK', 'Cancel'],
                                 defaultButton='OK',
                                 cancelButton='Cancel',
                                 text='Biped')

        if result == 'OK':
            guideName = pm.promptDialog(query=True, text=True)
            guideName.replace(' ', '')
            guideName += '_guide'

            guideRig = BipedGuideRig(guideName)

            builder = plugins.getBuilder()

            OpenMaya.MGlobal.displayInfo('Kraken: Building Guide Rig: ' +
                                         guideName)

            try:
                main_window = pm.ui.Window(pm.MelGlobals.get('gMainWindow'))
                main_win_width = pm.window(main_window, query=True, width=True)

                buildMsgWin = pm.window("KrakenBuildBipedWin",
                                        title="Kraken: Build Biped",
                                        width=200,
                                        height=100,
                                        sizeable=False,
                                        titleBar=False,
                                        leftEdge=(main_win_width / 2) - 100)

                buildMsglayout = pm.verticalLayout(spacing=10)
                buildMsgText = pm.text('Kraken: Building Biped')
                buildMsglayout.redistribute()
                buildMsgWin.show()

                pm.refresh()

                builtRig = builder.build(guideRig)

                return builtRig

            finally:
                if pm.window("KrakenBuildBipedWin", exists=True) is True:
                    pm.deleteUI(buildMsgWin)

        else:
            OpenMaya.MGlobal.displayWarning(
                'Kraken: Build Guide Rig Cancelled!')
示例#33
0
 def storePrefix(self, *args):
     self.prefix = self.uniquePrefixField.getText()
     self.setupGui.setCollapse(True)
     if self.meshes and self.keyable and self.parentItem and self.prefix and self.parentVisItem:
         self.setupFunc(
             item=self.parentItem,
             parentVis=self.parentVisItem.name(),  # only send string
             meshes=self.meshes,
             keyable=self.keyable,
             prefix=self.prefix)
     else:
         pm.promptDialog(title="Setup Incomplete",
                         message="Please Fill all sections first",
                         button=["OK"])
示例#34
0
    def add_file_to_maya(self, file_path, shotgun_data):
        """
        Load file into Maya.
        
        This implementation creates a standard maya reference file for any item.
        """
        
        import pymel.core as pm
        import maya.cmds as cmds
        
        # get the slashes right
        file_path = file_path.replace(os.path.sep, "/")
        
        fileName=os.path.basename(file_path)

        (name, ext) = os.path.splitext(fileName)
        
        texture_extensions = [".png", ".jpg", ".jpeg", ".exr", ".cin", ".dpx",
                              ".psd", ".tiff", ".tga"]
        
        name=fileName.split('.')[0]
        
        if ext in [".abc"]:
            name = (name + 'Abc')
        
        result = pm.promptDialog(
            title='Namespace',
            message='Choose Namespace',
            text=name,
            button=['OK', 'Cancel'],
            cancelButton='Cancel',
            defaultButton='OK')

        name = pm.promptDialog(query=True, text=True)
        
        if result == 'OK':
        
            if ext in [".ma", ".mb", ".abc"]:
                # maya file - load it as a reference
                pm.system.createReference(file_path, namespace=name)
     
                
            elif ext in texture_extensions:
                # create a file texture read node
                x = cmds.shadingNode('file', asTexture=True)
                cmds.setAttr( "%s.fileTextureName" % x, file_path, type="string" )
    
            else:
                self.parent.log_error("Unsupported file extension for %s! Nothing will be loaded." % file_path)
示例#35
0
    def doIt(self, args):

        result = pm.promptDialog(title='Kraken: Build Biped',
                                 message='Rig Name',
                                 button=['OK', 'Cancel'],
                                 defaultButton='OK',
                                 cancelButton='Cancel',
                                 text='Biped')

        if result == 'OK':
            guideName = pm.promptDialog(query=True, text=True)
            guideName.replace(' ', '')
            guideName += '_guide'

            guideRig = BipedGuideRig(guideName)

            builder = plugins.getBuilder()

            OpenMaya.MGlobal.displayInfo('Kraken: Building Guide Rig: ' + guideName)

            try:
                main_window = pm.ui.Window(pm.MelGlobals.get('gMainWindow'))
                main_win_width = pm.window(main_window, query=True, width=True)

                buildMsgWin = pm.window("KrakenBuildBipedWin",
                                        title="Kraken: Build Biped",
                                        width=200,
                                        height=100,
                                        sizeable=False,
                                        titleBar=False,
                                        leftEdge=(main_win_width / 2) - 100)

                buildMsglayout = pm.verticalLayout(spacing=10)
                buildMsgText = pm.text('Kraken: Building Biped')
                buildMsglayout.redistribute()
                buildMsgWin.show()

                pm.refresh()

                builtRig = builder.build(guideRig)

                return builtRig

            finally:
                if pm.window("KrakenBuildBipedWin", exists=True) is True:
                    pm.deleteUI(buildMsgWin)

        else:
            OpenMaya.MGlobal.displayWarning('Kraken: Build Guide Rig Cancelled!')
def run():
    if pm.nodeType(pm.ls(sl=True)[0]) == 'reference':
        result = pm.promptDialog(title='Rename Object',
                                 message='Enter Name:',
                                 button=['OK', 'Cancel'],
                                 defaultButton='OK',
                                 cancelButton='Cancel',
                                 dismissString='Cancel')

        if result == 'OK':
            name = pm.promptDialog(query=True, text=True)
            if name != '':
                pm.lockNode(pm.ls(sl=True)[0], l=False)
                pm.rename(pm.ls(sl=True)[0], name)
                pm.lockNode(pm.ls(sl=True)[0])
示例#37
0
 def _addTab(self,*args):
     #--- Prompt for name
     result = pm.promptDialog(
                 title='Tab Name',
                 message='Enter Name:',
                 button=['Ok', 'Cancel'],
                 defaultButton='Ok',
                 cancelButton='Cancel',
                 dismissString='Cancel')
     #--- Create the tab
     if result == 'Ok':
         text = pm.promptDialog(query=True, text=True)
         sTab = pm.shelfLayout( text, h=SHELFTAB_HEIGHT, parent=self.mainLayout )
         self.shelfTabs.append( sTab )
         self._createDeleteTabButton(shelfTab=sTab)
示例#38
0
def scaleControl(x=True,y=True,z=True):
	'''
	Usage:
		scaleControl()
	'''
	if len(pm.ls(sl=True))==0:
		pm.error('select something numbnuts!')
	pm.promptDialog(m='Enter new scale value')
	val = float(pm.promptDialog(q=True))
	for transform in pm.ls(sl=True,type='transform'):
		shapes = transform.getShapes()
		cvs = []
		for shape in shapes:
			cvs = cvs + pm.ls(shape.cv[0:], fl=True)
		pm.scale(cvs, val*x, val*y, val*z, pivot=transform.getRotatePivot(ws=True), r=True)
示例#39
0
    def MakeMaterial(self, *args):

        result = pm.promptDialog(title='Name Material',
                                 message='Enter Name:',
                                 button=['OK', 'Cancel'],
                                 defaultButton='OK',
                                 cancelButton='Cancel',
                                 dismissString='Cancel')
        if result == 'OK':
            Name = pm.promptDialog(query=True, text=True)

        self.MaterialList['MAT_' + Name] = ShaderTree(Name)
        ShaderTree(Name).createShader()
        pm.textScrollList("MaterialList",
                          e=True,
                          append=self.MaterialList['MAT_' + Name].Shader)
示例#40
0
 def updateLayerName(self):
     '''change layer name'''
     currentText = self.widgets['layerName'].getLabel()
     if currentText == 'defaultRenderLayer':
         return
     result = pm.promptDialog(title='Update layer Name', message='New name:', text = currentText, button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
     if result == 'OK':
         newName = pm.promptDialog(query = True, text = True)
         if not self.checkName(newName):
             print "Crap name mate. Try again"
             
         else:
             #self.widgets['layerName'].setLabel(newName)
             for sibling in self.siblings:
                 sibling.widgets['layerName'].setLabel(newName)
             self.layer.rename(newName)
示例#41
0
def newAOVPrompt(default=''):
    result = pm.cmds.promptDialog(button=['Create', 'Cancel'],
                                  defaultButton='Create',
                                  cancelButton='Cancel',
                                  message='AOV Name',
                                  title='New AOV',
                                  text=default)
    if result == 'Create':
        core.createOptions()
        newAOV = pm.promptDialog(
            query=True, text=True
        )  #[0:29] # channel names in the exr driver are limited to 29 characterss
        if len(newAOV) > 29:
            oldAOV = newAOV
            newAOV = newAOV[0:29]
            cmds.confirmDialog(
                message=
                "The name %s is longer than 29 characters, truncated to : %s" %
                (oldAOV, newAOV))
        if str(newAOV).replace("_", "").isalnum():
            return newAOV, aovs.AOVInterface().addAOV(newAOV)
        else:
            print "Invalid AOV Name"
            return None, None
    else:
        print "AOV creation canceled"
        return None, None
示例#42
0
    def _newGroup( self ):
        result = pm.promptDialog( title='Create New Group',
                               message='Group Name:',
                               button=['OK', 'Cancel'],
                               defaultButton='OK',
                               cancelButton='Cancel',
                               dismissString='Cancel'
                               )

        if result == 'OK':
            groupName = re.sub('\W', '_', pm.promptDialog(query=True, text=True) )
            self._poseGroups[ str(groupName) ] = {}
            self._updateGroupList()
            OptionMenu( self.groupOM, edit=True, select=self._sortedGroupList().index(groupName) + 1 )
            self._updatePoseList()
            self._savePrefs()
示例#43
0
 def _addTab(self, *args):
     #--- Prompt for name
     result = pm.promptDialog(title='Tab Name',
                              message='Enter Name:',
                              button=['Ok', 'Cancel'],
                              defaultButton='Ok',
                              cancelButton='Cancel',
                              dismissString='Cancel')
     #--- Create the tab
     if result == 'Ok':
         text = pm.promptDialog(query=True, text=True)
         sTab = pm.shelfLayout(text,
                               h=SHELFTAB_HEIGHT,
                               parent=self.mainLayout)
         self.shelfTabs.append(sTab)
         self._createDeleteTabButton(shelfTab=sTab)
示例#44
0
def addControlsAtSelectedXfos():
    '''
    add controls at the same world matrix as selected xfo
    '''
    selXfos = pm.ls(sl=True, type='transform')
    
    for xfo in selXfos:
        pdResult = pm.promptDialog(title='Add Control',
                                   message='Control: '+xfo.nodeName(),
                                   text=xfo.nodeName()+'_ctl',
                                   button=['OK', 'Cancel'])
        if pdResult =='OK':
            ctlName = pm.promptDialog(q=True, text=True)
            ctl = createControl(ctlName)
            mat = xfo.getMatrix(ws=True)
            cth = ctl.homeGroup.inputs()[0]
            cth.setMatrix(mat, ws=True)
示例#45
0
def _exportCurvesFile():
    
    pymelLogger.debug('Starting: _exportCurvesFile()...') 
    result = pm.promptDialog(title='Curves Files Name',message='Enter Name:',button=['OK', 'Cancel'],
                                defaultButton='OK',cancelButton='Cancel',dismissString='Cancel')
    if result == 'OK': fileName = pm.promptDialog(query=True, text=True)
    else: raise 'Curves not exported because No name was passed'             
    
    if os.path.exists(curvesFolder):
        pm.select('curvesExport', r=1)
        pm.exportSelected(curvesFolder + fileName, type='mayaAscii', f=1)
        pm.delete('curvesExport')
    else: raise 'Path to curves folder does no exist!'
    pymelLogger.debug('Starting: _exportCurvesFile()...') 

    
    
示例#46
0
def main():
    logger.info( "Creating Radian Trigger..." )
    try:
        result = pm.promptDialog(   title='Create Radian Trigger',
                                    message='Enter Prefix:',
                                    button=['OK', 'Cancel'],
                                    defaultButton='OK',
                                    cancelButton='Cancel',
                                    dismissString='Cancel'
                                )
    
        if result == 'OK':
            prefix = pm.promptDialog(query=True, text=True)
            create_radian_trigger( prefix = prefix )
        
    except Exception as e:
        logger.error( "Failed... Aborting", exc_info=True)
示例#47
0
 def _renameClicked(self, *args):
     current = _pmCore.textScrollList(self._textScrollList, query=True, selectItem=True)
     if not current:
         raise RuntimeError('Must select a category to rename.')
     
     result = _pmCore.promptDialog(title='Rename Category', message="Enter Name: ", button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
     if result != 'OK':
         return
     newName = _pmCore.promptDialog(query=True, text=True)
     _Database.renameCategory(current[0], newName)
     
     index = _pmCore.textScrollList(self._textScrollList, query=True, selectIndexedItem=True)[0]
     _pmCore.textScrollList(self._textScrollList, edit=True, removeIndexedItem=index)
     _pmCore.textScrollList(self._textScrollList, edit=True, appendPosition=[index, newName])
     _pmCore.textScrollList(self._textScrollList, edit=True, selectIndexedItem=index)
     
     self._updateCallback(None, (current[0], newName))
示例#48
0
def createNewTab(tab, name=None):

    if not name:
        user_inp = pm.promptDialog(m="Tab Name")
        if user_inp != "Confirm":
            return
        name = pm.promptDialog(q=1, tx=1)
        if not name:
            name = "name set#"
    lay = pm.formLayout(name, p=tab)
    add_btn_pfx = pm.button("pfxAddBtn", p=lay, l="+")
    rm_btn_pfx = pm.button("pfxRmBtn", p=lay, l="-")
    add_btn_sfx = pm.button("sfxAddBtn", p=lay, l="+")
    rm_btn_sfx = pm.button("sfxRmBtn", p=lay, l="-")
    lay1 = pm.rowColumnLayout(adj=1)
    # txf = pm.textField()
    txf = pm.textField(sf=1, h=25)
    okbtn = pm.button("Rename", p=lay)

    # align controls
    lay.attachForm(add_btn_pfx, "left", 5)
    lay.attachControl(rm_btn_pfx, "left", 5, add_btn_pfx)
    lay.attachControl(lay1, "left", 5, rm_btn_pfx)
    lay.attachForm(add_btn_sfx, "right", 5)
    lay.attachControl(rm_btn_sfx, "right", 5, add_btn_sfx)
    lay.attachControl(lay1, "right", 5, rm_btn_sfx)
    lay.attachForm(lay1, "top", 0)
    lay.attachForm(okbtn, "left", 5)
    lay.attachControl(okbtn, "top", 5, lay1)
    pm.formLayout(lay, e=1, aoc=(okbtn, "right", 0, add_btn_sfx))

    # assign commands
    add_btn_pfx.setCommand(
        pm.Callback(addBtnPress, rm_btn_pfx, rm_btn_sfx, lay1, 0))
    rm_btn_pfx.setCommand(
        pm.Callback(rmBtnPress, rm_btn_pfx, rm_btn_sfx, lay1, 0))
    add_btn_sfx.setCommand(
        pm.Callback(addBtnPress, rm_btn_pfx, rm_btn_sfx, lay1))
    rm_btn_sfx.setCommand(
        pm.Callback(rmBtnPress, rm_btn_pfx, rm_btn_sfx, lay1, -1))
    txf.enterCommand(pm.Callback(addBtnPress, rm_btn_pfx, rm_btn_sfx, lay1))
    okbtn.setCommand(pm.Callback(okCmd, lay1))

    # update controls
    updateButtons(rm_btn_pfx, rm_btn_sfx, lay1)
    pm.dimWhen("SomethingSelected", okbtn, f=1)
示例#49
0
def addControlsAtSelectedXfos():
    '''
    add controls at the same world matrix as selected xfo
    '''
    selXfos = pm.ls(sl=True, type='transform')

    for xfo in selXfos:
        pdResult = pm.promptDialog(title='Add Control',
                                   message='Control: ' + xfo.nodeName(),
                                   text=xfo.nodeName() + '_ctl',
                                   button=['OK', 'Cancel'])
        if pdResult == 'OK':
            ctlName = pm.promptDialog(q=True, text=True)
            ctl = createControl(ctlName)
            mat = xfo.getMatrix(ws=True)
            cth = ctl.homeGroup.inputs()[0]
            cth.setMatrix(mat, ws=True)
示例#50
0
def getNodeAttrFromPromptDialog():
    """
    Show a prompt dialog where node.attr can be entered.
    To be used with a hotkey or shelf button.
    If a node is selected, nodeName will be added to text.
    """
    selNode = pm.ls(os=True)[0]

    pdResult = pm.promptDialog(title='Add Attribute to HUD',
                               message='Attribute: ' + selNode.nodeName(),
                               text=selNode.nodeName() + '.',
                               button=['OK', 'Cancel'])

    if pdResult == 'OK':
        nodeAttr = pm.promptDialog(q=True, text=True)
        node = nodeAttr.split('.')[0]
        attr = '.'.join(nodeAttr.split('.')[1:])
        return node, attr
示例#51
0
def getAnimPath(filetype, message, use_maya_subfolder, folder_only=False, override_name=False):

    # check that the scene is controlled by the pipeline
    try: scene_controller = pm.PyNode('sceneControlObject')
    except: pass

    if override_name:
        folder_name = override_name
    else:
        folder_name = filetype

    # set up export paths
    scene       = project.Scene()
    # The use_maya_subfolder flag determines whether this export goes into a folder
    # below the main project folder or below the maya folder instead.
    anim_folder = {0: scene.project_folder, 1: scene.maya_project_folder}[use_maya_subfolder] + '\\{0}\\'.format(folder_name)
    anim_file   = scene.scene_name

    # If exporting (i.e. determining a full destination file name)
    if not folder_only:
        if override_name:
            anim_file += '.{0}'.format(override_name)

        else:
            custom_string = pm.promptDialog(
                title='Custom name tag?',
                message=message,
                text='',
                b=['OK', 'No'],
                db='OK',
                cb='No',
                ds='No'
                )
            if custom_string == 'OK':
                custom_string = pm.promptDialog(q=True, text=True)
            else:
                custom_string = ''
            anim_file += '_{}.{}'.format(custom_string, filetype)

        return anim_folder + anim_file

    # i.e., if import (just returning a path)
    elif folder_only:
        return anim_folder
示例#52
0
 def ExportSelection(self, *args):
     singleFilter = "All Files (*.*)"
     Path = pm.fileDialog2(fileFilter=singleFilter, dialogStyle=2, fm=2)
     # list selection in array
     list = pm.ls(sl=True)
     # get filename from user
     result = pm.promptDialog(title='Rename Object',
                              message='Enter Name:',
                              button=['OK', 'Cancel'],
                              defaultButton='OK',
                              cancelButton='Cancel',
                              dismissString='Cancel')
     if result == 'OK':
         fileName = pm.promptDialog(query=True, text=True)
         print fileName
         # export file
         pm.exportSelected(Path[0] + '/' + fileName + '.mb')
     else:
         pm.warning('export canceled!')
示例#53
0
def _exportCurvesFile():

    pymelLogger.debug('Starting: _exportCurvesFile()...')
    result = pm.promptDialog(title='Curves Files Name',
                             message='Enter Name:',
                             button=['OK', 'Cancel'],
                             defaultButton='OK',
                             cancelButton='Cancel',
                             dismissString='Cancel')
    if result == 'OK': fileName = pm.promptDialog(query=True, text=True)
    else: raise 'Curves not exported because No name was passed'

    if os.path.exists(curvesFolder):
        pm.select('curvesExport', r=1)
        pm.exportSelected(curvesFolder + fileName, type='mayaAscii', f=1)
        pm.delete('curvesExport')
    else:
        raise 'Path to curves folder does no exist!'
    pymelLogger.debug('Starting: _exportCurvesFile()...')
示例#54
0
    def rename(self, name=None, save=True):
        x = isScene()
        if not (x):
            return

        if not (name):
            prompt = pm.promptDialog(
                title='Rename Scene',
                message='Enter new descriptor tag (i.e. PRIMETIME)',
                text='',
                button=['OK', 'Cancel'],
                db='OK',
                cb='Cancel',
                ds='Cancel')

            if prompt == 'OK':
                self.custom_string = pm.promptDialog(q=True, text=True)
            else:
                return

        elif (name):
            self.custom_string = name

        else:
            return

        self._nameScene()
        self.version = 1.0
        self._pushPull()

        if save and os.path.exists(self.project_folder) and os.path.exists(
                self.maya_project_folder):
            self.save()
            return
        else:
            if save:
                pm.warning(
                    'SAVE SCENE  ERROR One or more destination folders does not exist.'
                )
                return
            else:
                return
示例#55
0
def saveToTab_feet(target_feetShelf):
    #Clear out old data to store clean new data
    storeCmds_feet = ""

    #List selected
    selPose = pm.ls(sl=True)

    #Error window if nothing selected
    #List keyable, readable, writable, connectable, and unlocked attributes in selected
    #Grab values of selected and concatenates keyable channels
    if len(selPose) < 1:
        pm.warning("Nothing Selected.  Please select at least one object.")
    else:
        for all in selPose:
            keyable = pm.listAttr(all, k=True, r=True, w=True, c=True, u=True)
            print keyable
            for vals in keyable:
                findVal = pm.getAttr(all + "." + vals)
                print findVal
                starterCiph = "setAttr "
                enderCiph = ";\n"
                shelfSave = (starterCiph +
                             (all + "." + vals) + " %f" + enderCiph) % findVal
                storeCmds_feet += shelfSave
                print storeCmds_feet

        #prompt dialog for artist to enter a name of the pose and button to save to shelf
        pd_feet = pm.promptDialog(t="Feet Pose",
                                  m="Name of Pose?",
                                  b="Save to Shelf")

        if pd_feet == "Save to Shelf":

            pd_feet_name = pm.promptDialog(q=True, text=True)
            #pm.internalVar(usd = True)
            pm.shelfButton(l=pd_feet_name,
                           ann=pd_feet_name,
                           imageOverlayLabel=pd_feet_name,
                           i1="zenRemember_feetIcon.png",
                           command=storeCmds_feet,
                           p=target_feetShelf,
                           sourceType="mel")
示例#56
0
def makeObjectProperties(sel=None):
    """ A Layer creation widget that includes custom layer attributes """
    def _getLast(
    ):  # stupid hacks.  (python does not return a string when using the vray command.)
        _filter = pm.itemFilter(byType='VRayObjectProperties')
        _list = pm.lsThroughFilter(_filter, sort='byTime', reverse=False)
        _result = _list[len(_list) - 1]
        return _result

    go = pm.promptDialog(title='Create New Sort Group',
                         message='Enter Name:',
                         button=['OK', 'Cancel'],
                         tx='sg_',
                         defaultButton='OK',
                         cancelButton='Cancel',
                         dismissString='Cancel')
    if go == 'OK':

        name = pm.promptDialog(query=True, text=True)  # set name via a prompt

        if not sel:
            sel = pm.ls(sl=True)  # store selection for later restorationg
            select.shapes(sel, xf=True,
                          do=True)  # convert selection to meshes only

        pm.Mel.eval('vray objectProperties add_single;'
                    )  # make the obj properties group

        try:
            _sg = _getLast(
            )  # have to do it this way because python and v-ray don't always get along
            pm.rename(_sg, name)
            pm.select(sel)  # restore original selection
            if _sg.nodeType() == 'VRayObjectProperties':
                return _sg
            else:
                return None
        except:
            pm.warning(
                "You're required to have a selection in order to create a V-ray partition (no idea why)."
            )
            return None
示例#57
0
def getTeamList(*a):

    prompt = pm.promptDialog(
        title='Enter List of Tricodes',
        message='Enter team tricodes, separated by commas >>',
        text='',
        b=['OK', 'Cancel'],
        db='OK',
        cb='Cancel',
        ds='Cancel')

    if prompt == 'OK':
        raw_list = pm.promptDialog(q=True, text=True)
        raw_list = raw_list.replace(" ", "")
        team_list = raw_list.split(',')
        print team_list
        return team_list

    else:
        return None
示例#58
0
def profileNamePrompt(msg='Enter a name', name='', validator=lambda x: True):
    '''
    validator is a function that takes the name and returns a string of the new message to display.
    '''

    while True:
        res = promptDialog(m=msg,
                           t='Enter a profile name',
                           tx=name,
                           b=['Enter', 'Cancel'])
        if res == 'Cancel':
            return None

        name = promptDialog(q=True, text=True)

        temp = validator(name)
        if temp is not None:
            msg = temp
        else:
            return name
示例#59
0
文件: main.py 项目: leocadaval/lcPipe
    def checkProjects(self):
        all = database.getAllProjects()
        allProjects = [x for x in all]
        print allProjects

        if not allProjects:
            print 'no project found!!'

            result = pm.promptDialog(
                title='No project',
                message='No project Found! Enter Name for a new one:',
                button=['OK', 'Cancel'],
                defaultButton='OK',
                cancelButton='Cancel',
                dismissString='Cancel')

            if result == 'OK':
                text = pm.promptDialog(query=True, text=True)
                print text
                database.addProject(projectName=text, prefix=text[:2])