def delete_character_btn_cmd(self, *args):
     """ Delete selected character folder from the text scroll list
     :return: None
     """
     # When it is pressed this condition checks the character is selected or not.
     if self.selectedCharacter is None or len(self.selectedCharacter) < 1:
         pm.confirmDialog(t='Error', b=['OK'], m='Please select the folder to be deleted.')
         return None
     else:
         # if it is selected a confirm dialog appears and give the user a choice for deletion.
         answer = pm.confirmDialog(t='Confirmation', b=['Yes', 'No'],
                                   m="'Do you want to delete " + self.selectedCharacter+" character folder?'",
                                   defaultButton='Yes', cancelButton='No', dismissString='No')
         if answer == 'Yes':
             # if the answer is yes, it also checks the folder is empty or not and gives another confirm dialog if
             # the folder is not empty
             comp_files = os.listdir(self.characterList)
             if comp_files is None or len(comp_files) < 1:
                 pm.confirmDialog(t='Error', b=['OK'], m='this folder is empty.')
                 os.rmdir(self.characterList)
             else:
                 ans = pm.confirmDialog(t='Confirmation', b=['Yes', 'No'],
                                        m="'This " + self.selectedCharacter +
                                          " has files. Do you still want to delete folder and its files?'",
                                        defaultButton='Yes', cancelButton='No', dismissString='No')
                 if ans == 'Yes':
                     for compFile in comp_files:
                         pm.sysFile(str(self.characterList + compFile), delete=True)
                     os.rmdir(self.characterList)
                 else:
                     None
         else:
             None
Beispiel #2
0
def removeIconButton(gName, *Args):
    global globalEyeIndex
    global globalEyeKey  #global eye key is the saved vertex positions

    localNameKey = []

    if globalEyeIndex == 0:
        print('Cant delete the default state')
    else:
        savedNamesRead = open(
            'EqualRealityData\EyeShapes%s.txt' % (globalGender[0]), 'r+')
        for item in savedNamesRead:
            localNameKey.append(item)

        pm.sysFile('icons\EqualReality\%s_%s.iff' %
                   (localNameKey[globalEyeIndex], globalGender[0]),
                   delete=True)
        del localNameKey[globalEyeIndex]
        #created a local list of the eye names sans deleted one, and deleted the associated image

        lastNameOnList = len(localNameKey)
        tempVal = re.sub('\r\n', '', localNameKey[lastNameOnList - 1])
        localNameKey[lastNameOnList - 1] = tempVal
        savedNamesRead.close()
        #removed spaces from last line of global name key

        del globalEyeKey[globalEyeIndex]
        globalEyeIndex = globalEyeIndex - 1
        savedNames = open(
            'EqualRealityData\%sShapes%s.txt' % (gName, globalGender[0]), 'w+')
        savedPositions = open(
            'EqualRealityData\SavedVertexPositions%s%s.txt' %
            (globalGender[0], gName), 'w+')
        lastItemInVtxKey = len(globalEyeKey) - 1
        index = 0
        for item in globalEyeKey:
            if index != lastItemInVtxKey:
                savedPositions.write('%s\r\n\r\n' % (item))
            else:
                savedPositions.write('%s' % (item))
            index = index + 1
        for item in localNameKey:
            savedNames.write('%s' % (item))

        savedNames.close()
        savedPositions.close()

        setVertexPositions(gName)

        rolloutParameters(names=['modellingToolkit', 'EyeShapes'], edit=True)
        createUI('Poly Morph')
 def delete_set_btn_cmd(self, *args):
     """ This function checks if the file is selected from the list and asks the user to delete that item yes or no
     :return: None
     """
     if self.selectedFile is None or len(self.selectedFile) < 1:
         pm.confirmDialog(t='Error', b=['OK'], m='Please select the file to be deleted.')
         return None
     else:
         answer = pm.confirmDialog(t='Confirmation', b=['Yes', 'No'], m='Do you want to delete this selected set?',
                                   defaultButton='Yes', cancelButton='No', dismissString='No')
         if answer == 'Yes':
             pm.sysFile(self.checkList, delete=True)
         else:
             None
         populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile)
def exportCFX(items):
    for tran in items():
        # begin = pm.playbackOptions(q=True, ast=True)
        end = pm.playbackOptions(q=True, aet=True)
        cmd = '-frameRange {} {} -stripNamespaces -uvWrite -root {} -file {}'.format(950, end,
                                                                                     pm.PyNode(tran).name(long=True),
                                                                                     os.path.normpath(
                                                                                         os.path.join(cfx,
                                                                                                      '{}.abc'.format(
                                                                                                          tran.split(
                                                                                                              ':')[
                                                                                                              0]
                                                                                                      ))))
    print cmd
    pm.sysFile(cfx, md=True)
    pm.AbcExport(j=cmd)
Beispiel #5
0
    def modpushButton_genRenderJob(self):

        self.getFileForder()

        pm.sysFile(self.cmdFileLocation, makeDir=True)  # create folder
        ribGenFIleName = self.lineEdit_MayaFile.text().split("/")[-1].split(
            ".")[0]
        print ribGenFIleName

        self.createRibGenCmdJson()
        print self.ribGenCmdList
        for jobNum in range(1, (len(self.ribGenCmdList) + 1)):
            print jobNum

            fileName = self.cmdFileLocation + "/" + ribGenFIleName + "." + "%04d" % (
                jobNum) + ".bat"
            renderBatchFile = open(fileName, 'w')
            renderBatchFile.write(self.ribGenCmdList[(jobNum - 1)])
            renderBatchFile.close
Beispiel #6
0
	BACKUP_FILE = os.path.join(BACKUP_PATH, '/'.join(spath[num_C:])) #'C:/Users/{}/Documents/BackupSH/{}'.format(username, '/'.join(spath[num_C:]))
	DIR = 'C:/Users/{}/Projects/{}'.format(username, '/'.join(spath[num_C:]))
	print('FROM J:')
	print('\tFile Dir C: {}\n\tFile Backup: {}'.format(DIR, BACKUP_FILE))

item, ok = QtGui.QInputDialog.getItem(self, 'Select Action', 'Action File:', item_cb, 0)

try:
    if ok and item:
        fil_nam = os.path.join(os.path.dirname(BACKUP_FILE), datetime.datetime.fromtimestamp(os.stat(DIR).st_mtime).strftime("{} (%m_%d_%Y)".format(get_owner(DIR))))
        #datetime.datetime.fromtimestamp(os.stat(file_).st_mtime).strftime("%d_%m_%Y")
        nam = os.path.join(fil_nam, os.path.basename(BACKUP_FILE))
        if item == 'Replace (Save)':
            if os.path.isfile(DIR):
                cmds.file( save=1)
                pm.sysFile(SC_PATH, cp=DIR)
                print(item, DIR)
        elif item == 'Backup (Save)':
            if not os.path.exists(fil_nam):
                pm.sysFile(fil_nam, md=1)
                
            if os.path.isfile(DIR):
                pm.sysFile(DIR, cp=nam)
                cmds.file( save=1)
                pm.sysFile(SC_PATH, cp=DIR)
                print(item, DIR)
        elif item == 'Backup (No Save)':
            if not os.path.exists(fil_nam):
                pm.sysFile(fil_nam, md=1)
                
            if os.path.isfile(DIR):
Beispiel #7
0
def send_current_file(scene=True,
                      suffix='_vn',
                      lastest=True,
                      render=False,
                      tex=True,
                      extras=['psd', 'uv', 'zbr', 'pattern'],
                      version=1,
                      verbose=True):
    src = pm.sceneName()
    scene_src = src.dirname()
    path_root = ''
    status = []
    todayFolder = pm.date(f='YYMMDD')
    if version > 1:
        todayFolder = "{}_{:02d}".format(todayFolder, int(version))
    status.append('Send File to {}'.format(todayFolder))
    scene_dest = pm.util.path(
        scene_src.replace('Works',
                          'to/{}/Works'.format(todayFolder))).truepath()
    files = scene_src.files('*.mb')
    files.extend(scene_src.files('*.ma'))
    #print files
    files.sort(key=lambda f: f.getmtime())
    lastestfile = files[-1]
    try:
        status.append('Scene Sending status:')
        if lastest:
            src = lastestfile
            status.append('send latest file')
        dest = scene_dest.__div__(src.basename().replace(
            src.ext, '{}{}'.format(suffix, src.ext)))
        if scene:
            check_dir(dest)
            pm.sysFile(src, copy=dest)
            status.append("%s copy to %s" % (src, dest))
        if render:
            render_str = ['rend', 'Render', 'render', 'Rend']
            rend_src = []
            print src.dirname().dirs()
            for test_str in render_str:
                for dir in src.dirname().dirs():
                    if test_str in dir.basename():
                        print dir.basename()
                        rend_src = dir
                        break
                break
            if rend_src:
                rend_dest = dest.dirname().__div__(test_str)
                status.append(sys_cop(rend_src, rend_dest))
    except (IOError, OSError, shutil.Error) as why:
        msg = "Scene Copy Error\n{}".format(','.join(why))
        status.append(msg)
    if tex or extras:
        if all([src.dirname().dirname().dirname().basename() != d for d in ['CH','BG','CP']]) and \
                src.dirname().dirname().basename()!='CP':
            scene_src = scene_src.dirname()
            scene_dest = scene_dest.dirname()
            print scene_src
        tex_src = pm.util.path(scene_src.replace('scenes',
                                                 'sourceimages')).truepath()
        tex_files = tex_src.files('*.jpg')
        tex_extra = {}
        for extra in extras:
            tex_extra[extra] = tex_src.__div__(extra)
        tex_dest = pm.util.path(scene_dest.replace('scenes', 'sourceimages'))
        status.append('Texture Sending status:')
        try:
            if tex:
                for tex_file in tex_files:
                    src = tex_file
                    dest = tex_dest.__div__(tex_file.basename())
                    check_dir(dest)
                    pm.sysFile(src, copy=dest)
                    status.append("%s copy to %s" % (src, dest))
            if extras:
                for name, path in tex_extra.items():
                    status.append('%s Sending status:' % name)
                    dest = tex_dest.__div__(name)
                    status.append(sys_cop(path, dest))
        except (IOError, OSError, shutil.Error) as why:
            msg = "Tex Copy Error:\n{}".format(','.join(why))
            status.append(msg)
    pm.informBox(title='Send File Status', message='\n'.join(status))
Beispiel #8
0
    def createRenderCmdJson(self):
        self.getFileForder()

        pm.sysFile(self.cmdFileLocation, makeDir=True)  # create folder

        # fileName = cmdFileLocation +"/"+ self.lineEdit_filePath_renderCmd.text()
        jsonFileName = self.cmdFileLocation + "/" + self.lineEdit_filePath_renderCmd.text(
        )[0:-3] + "json"
        #renderBatchFile = open(fileName,'w')
        renderJsonFile = open(jsonFileName, 'w')
        parList = self.fileNamePath.split("/")
        print parList

        count = 0
        self.cmdRes = "-res" + " " + self.resX + " " + self.resY
        self.cmdMaxSample = "-maxsamples" + " " + self.maxSample

        self.batchRenderCmdLis = []

        for par in parList:
            #print count
            print parList[count]

            if par == "renderman" and parList[count + 2] == "rib":
                print "go"
                try:
                    #count =8
                    for frameNum in range(int(self.frameStart),
                                          int(self.frameEnd) + 1):
                        print frameNum
                        # renderBatchFile = open(fileName,'a')
                        digiNum = len(parList[count + 3])

                        cmd02 = str(frameNum).zfill(digiNum)
                        cmd01 = parList[count] + "/" + parList[
                            count + 1] + "/" + parList[count + 2]
                        fileNameSplit = parList[-1].split(".")
                        cmd03 = fileNameSplit[0] + "." + cmd02 + "." + "rib"
                        #cmd = self.prmanCMD + self.projectPath+" "+self.cmdLog +" "+ self.cmdRes +" "+self.cmdMaxSample +" " + cmd01 +"/"+ cmd02+"/" +cmd03+"\n"
                        # cmd = self.prmanCMD + self.projectPath +" "+ cmd01 +"/"+ cmd02+"/" + cmd03 +"\n"
                        cmd = "%s" % self.prmanCMD + " " + "%s" % self.projectPath + " " + "%s" % self.cmdLog + " " + "%s" % self.cmdRes + " " + "%s" % self.cmdMaxSample + " " + cmd01 + "/" + cmd02 + "/" + cmd03 + "\n"
                        # print self.cmdLog
                        #  print self.cmdRes
                        # print self.cmdMaxSample
                        #print cmd
                        self.batchRenderCmdLis.append(cmd)
                        #renderBatchFile.write(str(cmd))

                except:
                    print "error path with frame and job number"
            #  print count
            else:
                #pass
                print "unCorrect Command"
            #   print count

            count = count + 1

            #renderBatchFile.close

    # print self.batchRenderCmdLis

        json.dumps(self.batchRenderCmdLis, sort_keys=True,
                   indent=4)  #編譯成json 且賦予格式 控四格

        renderJsonFile.write(
            json.dumps(self.batchRenderCmdLis, sort_keys=True, indent=4))

        renderJsonFile.close
Beispiel #9
0
def icon_batchRender():    
    # 초기 세팅
    if not 'icon_batchRender_ing' in pm.ls():
        # 작업중인 데이터가 있으면, 사용자에게 컨펌 받음.
        _result = pm.confirmDialog( 
            title=u'아이콘 렌더링 화면을 준비합니다', 
            message=u'주의 : 작업중인 데이터가 쑝 날아갑니다.  그래도, 계속 할거에요?', 
            button=['Yes','No'], 
            defaultButton='Yes', 
            cancelButton='No', 
            dismissString='No' 
            )

        # 아니면 중단.
        if _result != "Yes":
            return False
       
        # 새 파일을 만들고
        pm.newFile(f=True)

        pm.setAttr('defaultRenderGlobals.currentRenderer', 'mayaHardware2', type='string')
        pm.setAttr('defaultRenderGlobals.imageFormat', 32) # png
        pm.setAttr('defaultRenderGlobals.enableDefaultLight', 0)

        pm.setAttr('defaultResolution.width',  iconsize)
        pm.setAttr('defaultResolution.height', iconsize)
        pm.setAttr('defaultResolution.deviceAspectRatio', 1)
        
        pm.setAttr('hardwareRenderingGlobals.multiSampleEnable', 1)        
        pm.setAttr('hardwareRenderingGlobals.multiSampleCount', 1 )
        #pm.setAttr('hardwareRenderingGlobals.multiSampleCount', 16 )
        hw = pm.PyNode('hardwareRenderingGlobals')
        #hw.objectTypeFilterNameArray.get()
        #hw.objectTypeFilterValueArray.get()
        hw.objectTypeFilterValueArray.set([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

        persp = pm.PyNode('persp')
        persp.translateX.set(1.381)
        persp.translateY.set(7.395)
        persp.translateZ.set(5.797)
        persp.rotateX.set(-45)
        persp.rotateX.set(-60)
        persp.rotateY.set(45)
        persp.rotateZ.set(0)

        crv = curveShape.create( 'cube' )
        pm.viewFit('perspShape', all=True, f=.8 )
        pm.delete(crv)

    #perspShape
    pm.setAttr('perspShape.filmFit', 1)            # 0:fill, 1:Horizontal, 2:Vertical 3:Overscan
    pm.setAttr('perspShape.displayResolution', 1)
    pm.setAttr('perspShape.displayGateMask', 1)
    pm.setAttr('perspShape.overscan', 1.6)
    pm.setAttr('perspShape.focalLength', 200)
    pm.setAttr('perspShape.horizontalFilmAperture', 1)
    pm.setAttr('perspShape.verticalFilmAperture', 1)

    viewFitVal = 0.8
    result = pm.promptDialog(m='viewFit factor : ', text=viewFitVal)    
    if result:    
        text =  pm.promptDialog(q=True, text=True)
        viewFitVal = float(text)

    for name in curveShape.CURVESHAPE.keys():
        crv = curveShape.create( name )        
        pm.select(crv)

        colIndex = 16 # white
        colIndex = 18 # skyBlue
        colIndex =  3 # lightGray
        #curveShape.setColor(col=18)
        #curveShape.setColor(col='gray')
        crv.overrideColor.set( colIndex )
        crv.overrideEnabled.set( True )

        # pm.viewFit(all=True )
        #pm.viewFit('perspShape', all=True,)
        pm.viewFit('perspShape', f=viewFitVal )

        pm.select(cl=True)

        if pm.objExists('grid'):             
            pm.select('grid')
            pm.setAttr('grid.v', 1)
            pm.viewFit(f=.7)
            pm.select(cl=True)
            pm.setAttr('grid.v', 0)        

        # 필요 변수 설정
        renderIconFile = iconPath + 'ui_thumbnail__%s'%name             # 아이콘 렌더링 경로

        # 렌더글로벌 조정 : 파일 이름
        pm.setAttr('defaultRenderGlobals.imageFilePrefix',renderIconFile, type='string')

        # 아이콘 렌더 : 렌더~
        #pm.Mayatomr( preview=True, camera='perspShape', xResolution=self._iconRenderRes, yResolution=self._iconRenderRes )         # 멘탈레이 
        pm.ogsRender( w=iconsize, h=iconsize, enableMultisample=True, camera='persp' )         
        pm.sysFile( renderIconFile+'_tmp.png', rename = renderIconFile+'.png')

        pm.refresh()
        pm.delete(crv)

    # UI 갱신
    ui()

    if pm.objExists('grid'):
        pm.setAttr('grid.v', 1)

    # 샘플 오브젝트 생성
    if not pm.objExists('icon_batchRender_ing'):    
        pm.group(n='icon_batchRender_ing',em=True)
Beispiel #10
0
	def BakeGeometry( self, deleteAnimatedGeos=True, *args ):	

		# disable timewarps before caching
		self.getTimeWarpStates()


		objs = pm.ls( sl=True )
		bakedGeos = []
		blendNodes = []
		
		fileName = pm.sceneName()
		if not fileName:
			pm.error('Please save the file before baking.')
		
		cacheFolderPath = fileName.replace('.mb', '_cache' )
		cacheFolderPath = cacheFolderPath.replace('.ma', '_cache' )
		
		pm.sysFile( cacheFolderPath , makeDir=True )
		
		for obj in objs:
			if not obj.getShape().type()=='mesh':
				continue
			# create a duplicate for each object
			objName= obj.name()
			pm.rename( obj, '%s_NotBaked'%objName )
			dup = pm.duplicate( obj )[0]
			pm.rename( dup, objName )
			UnlockUnhideAttrs( dup )
			
			# hide animted geometry
			self.removeConnections(  objs = obj )
			obj.visibility.set(0)

			try:
				pm.parent( dup, world=True )
			except:
				pass
			blendNode = pm.blendShape( obj, dup, origin='world')[0]
			pm.blendShape( blendNode, edit=True, w=[(0, 1)] )
			blendNodes.append( blendNode )
			
			bakedGeos.append( dup )
		
		# hide objects before point cache
		IsolateSelected(  state=True, showSelected=False ) 
		
		# create cache
		pm.select( bakedGeos )
		mel.eval( 'doCreateGeometryCache 6 { "2", "1", "10", "OneFile", "1", "%s","1","","0", "add", "1", "1", "1","0","1","mcc","0" } ;' %cacheFolderPath  )
		#cacheFiles = pm.cacheFile( fileName='%s_cache'%obj, st=getTimeRange()[0], et=getTimeRange()[1], points=obj.getShape() , directory=cacheFolderPath )
			
		
		# delete main geometries and blendNode
		pm.delete( blendNodes )

		if deleteAnimatedGeos:
			pm.delete( objs )
		
		
		# group cached geometires
		pm.group( bakedGeos, name='bakedGeos_grp' )
		
		
		# set scene timewarp state to their previous state
		self.restoreTimeWarpStates()
		


		# show all objects
		IsolateSelected( state=False )
Beispiel #11
0
    def setcopy(self, filenode, yetitex, path, tarpaths, filetexname, setv,
                copyv, whole, absolute):
        #(节点名,yeti贴图节点,原始路径,目标路径,属性名,是否设置贴图,是否拷贝贴图,是否启动全局模式)
        if whole == 0:
            tarpath = tarpaths
        else:
            if path.find("sourceimages") != -1:
                tarpath = os.path.dirname(
                    tarpaths) + "/" + path[path.find("sourceimages"):]
            else:
                tarpath = tarpaths
        if pm.nodeType(filenode) == "file":
            if path != tarpath:
                fileudimadj = os.path.splitext(os.path.basename(path))[0][-6:]
                orginalmode = filenode.getAttr("uvTilingMode")
                if fileudimadj.upper() != "<UDIM>":
                    if orginalmode == 0:
                        if os.path.exists(os.path.dirname(path)):
                            if copyv == 1:
                                if os.path.exists(tarpath):
                                    os.remove(tarpath)
                                if os.path.exists(
                                        os.path.dirname(tarpath)) != True:
                                    os.makedirs(os.path.dirname(tarpath),
                                                mode=0777)
                                if os.path.exists(
                                        os.path.dirname(tarpath)) != True:
                                    os.makedirs(os.path.dirname(tarpath),
                                                mode=0777)
                                pm.sysFile(path, copy=tarpath)
                        else:
                            if setv == 1:
                                if absolute == 0:
                                    pm.setAttr(filenode + "." + filetexname,
                                               tarpath,
                                               type="string")
                                else:
                                    if path.find("sourceimages") != -1:
                                        pm.setAttr(
                                            filenode + "." + filetexname,
                                            path[path.find("sourceimages"):],
                                            type="string")
                                    else:
                                        "no sourceimages!!",
                    else:
                        if os.path.exists(os.path.dirname(path)) == True:
                            filelists = os.listdir(os.path.dirname(path))
                            for filelist in filelists:
                                if os.path.splitext(
                                        filelist)[0][:-4] == os.path.splitext(
                                            os.path.basename(path))[0][:-4]:
                                    if os.path.exists(
                                            os.path.dirname(tarpath) + "/" +
                                            filelist):
                                        os.remove(
                                            os.path.dirname(tarpath) + "/" +
                                            filelist)
                                        if os.path.exists(
                                                os.path.dirname(
                                                    tarpath)) != True:
                                            os.makedirs(
                                                os.path.dirname(tarpath),
                                                mode=0777)
                                        pm.sysFile(
                                            os.path.dirname(path) + "/" +
                                            filelist,
                                            copy=os.path.dirname(tarpath) +
                                            "/" + filelist)
                                    else:
                                        if os.path.exists(
                                                os.path.dirname(
                                                    tarpath)) != True:
                                            os.makedirs(
                                                os.path.dirname(tarpath),
                                                mode=0777)
                                        pm.sysFile(
                                            os.path.dirname(path) + "/" +
                                            filelist,
                                            copy=os.path.dirname(tarpath) +
                                            "/" + filelist)
                                else:
                                    if setv == 1:
                                        filenode.setAttr("uvTilingMode", 0)
                                        if absolute == 0:
                                            pm.setAttr(filenode + "." +
                                                       filetexname,
                                                       tarpath,
                                                       type="string")
                                        else:
                                            if path.find("sourceimages") != -1:
                                                pm.setAttr(
                                                    filenode + "." +
                                                    filetexname,
                                                    path[path.find(
                                                        "sourceimages"):],
                                                    type="string")
                                            else:
                                                "no sourceimages!!",
                                        filenode.setAttr(
                                            "uvTilingMode", int(orginalmode))
                        else:
                            if setv == 1:
                                filenode.setAttr("uvTilingMode", 0)
                                if absolute == 0:
                                    pm.setAttr(filenode + "." + filetexname,
                                               tarpath,
                                               type="string")
                                else:
                                    if path.find("sourceimages") != -1:
                                        pm.setAttr(
                                            filenode + "." + filetexname,
                                            path[path.find("sourceimages"):],
                                            type="string")
                                    else:
                                        "no sourceimages!!",
                                filenode.setAttr("uvTilingMode",
                                                 int(orginalmode))
                    if setv == 1:
                        if orginalmode == 0:
                            if absolute == 0:
                                pm.setAttr(filenode + "." + filetexname,
                                           tarpath,
                                           type="string")
                            else:
                                if path.find("sourceimages") != -1:
                                    pm.setAttr(
                                        filenode + "." + filetexname,
                                        path[path.find("sourceimages"):],
                                        type="string")
                                else:
                                    "no sourceimages!!",
                        else:
                            filenode.setAttr("uvTilingMode", 0)
                            if absolute == 0:
                                pm.setAttr(filenode + "." + filetexname,
                                           tarpath,
                                           type="string")
                            else:
                                if path.find("sourceimages") != -1:
                                    pm.setAttr(
                                        filenode + "." + filetexname,
                                        path[path.find("sourceimages"):],
                                        type="string")
                                else:
                                    "no sourceimages!!",
                            filenode.setAttr("uvTilingMode", int(orginalmode))
                else:
                    if os.path.exists(os.path.dirname(path)):
                        filelists = os.listdir(os.path.dirname(path))
                    elif os.path.exists(os.path.dirname(tarpaths)):
                        filelists = os.listdir(os.path.dirname(tarpaths))
                    else:
                        filelists = []
                    if filelists != []:
                        for filelist in filelists:
                            print filelist
                            if os.path.splitext(
                                    filelist)[0][:-4] == os.path.splitext(
                                        os.path.basename(path))[0][:-6]:
                                if copyv == 1:
                                    if os.path.exists(
                                            os.path.dirname(tarpath) + "/" +
                                            filelist):
                                        os.remove(
                                            os.path.dirname(tarpath) + "/" +
                                            filelist)
                                    else:
                                        pass
                                    if os.path.exists(
                                            os.path.dirname(tarpath)) != True:
                                        os.makedirs(os.path.dirname(tarpath),
                                                    mode=0777)
                                    else:
                                        pass
                                    pm.sysFile(
                                        os.path.dirname(path) + "/" + filelist,
                                        copy=os.path.dirname(tarpath) + "/" +
                                        filelist)
                                else:
                                    pass
                            else:
                                if setv == 1:
                                    filenode.setAttr("uvTilingMode", 0)
                                    if absolute == 0:
                                        pm.setAttr(filenode + "." +
                                                   filetexname,
                                                   tarpath,
                                                   type="string")
                                    else:
                                        if path.find("sourceimages") != -1:
                                            pm.setAttr(
                                                filenode + "." + filetexname,
                                                path[path.find("sourceimages"
                                                               ):],
                                                type="string")
                                        else:
                                            "no sourceimages!!",
                                    filenode.setAttr("uvTilingMode",
                                                     int(orginalmode))
                        if setv == 1:
                            if orginalmode == 0:
                                if absolute == 0:
                                    pm.setAttr(filenode + "." + filetexname,
                                               tarpath,
                                               type="string")
                                else:
                                    if path.find("sourceimages") != -1:
                                        pm.setAttr(
                                            filenode + "." + filetexname,
                                            path[path.find("sourceimages"):],
                                            type="string")
                                    else:
                                        "no sourceimages!!",
                            else:
                                filenode.setAttr("uvTilingMode", 0)
                                if absolute == 0:
                                    pm.setAttr(filenode + "." + filetexname,
                                               tarpath,
                                               type="string")
                                else:
                                    if path.find("sourceimages") != -1:
                                        pm.setAttr(
                                            filenode + "." + filetexname,
                                            path[path.find("sourceimages"):],
                                            type="string")
                                    else:
                                        "no sourceimages!!",
                                filenode.setAttr("uvTilingMode",
                                                 int(orginalmode))
        elif pm.nodeType(filenode) == "pgYetiMaya":
            if path != tarpath:
                yetiudimadj = os.path.splitext(os.path.basename(path))[0][-6:]
                if yetiudimadj.upper() != "<UDIM>":
                    if os.path.exists(os.path.dirname(path)):
                        if copyv == 1:
                            if os.path.exists(tarpath):
                                os.remove(tarpath)
                            else:
                                pass
                            if os.path.exists(
                                    os.path.dirname(tarpath)) != True:
                                os.mkdir(os.path.dirname(tarpath))
                            else:
                                pass
                            pm.sysFile(path, copy=tarpath)
                        if setv == 1:
                            pm.pgYetiGraph(filenode,
                                           node=yetitex,
                                           param="file_name",
                                           setParamValueString=str(tarpath))
                    else:
                        if setv == 1:
                            pm.pgYetiGraph(filenode,
                                           node=yetitex,
                                           param="file_name",
                                           setParamValueString=str(tarpath))
                else:
                    if os.path.exists(path) == True:
                        filelists = os.listdir(os.path.dirname(path))
                    else:
                        filelists = os.listdir(os.path.dirname(tarpath))

                    for filelist in filelists:
                        if os.path.splitext(
                                filelist)[0][:-4] == os.path.splitext(
                                    os.path.basename(path))[0][:-6]:
                            if copyv == 1:
                                if os.path.exists(
                                        os.path.dirname(tarpath) + "/" +
                                        filelist):
                                    os.remove(
                                        os.path.dirname(tarpath) + "/" +
                                        filelist)
                                else:
                                    pass
                                if os.path.exists(
                                        os.path.dirname(tarpath)) != True:
                                    os.makedirs(os.path.dirname(tarpath),
                                                mode=0777)
                                else:
                                    pass
                                pm.sysFile(
                                    os.path.dirname(path) + "/" + filelist,
                                    copy=os.path.dirname(tarpath) + "/" +
                                    filelist)
                            else:
                                pass
                        else:
                            if setv == 1:
                                pm.pgYetiGraph(
                                    filenode,
                                    node=yetitex,
                                    param="file_name",
                                    setParamValueString=str(tarpath))

                    if setv == 1:
                        pm.pgYetiGraph(filenode,
                                       node=yetitex,
                                       param="file_name",
                                       setParamValueString=str(tarpath))
                    else:
                        pass
            else:
                pass
        return tarpath