def create_send_folder(version=1): ws = pm.workspace todayFolder = pm.date(f='YYMMDD') if version > 1: todayFolder = "{}_{:02d}".format(todayFolder, int(version)) ws.path.makedirs( ws.path.join( [ws.path.replace('Works', '%s/Works' % todayFolder), 'scenes']))
def __init__(self): """ Initialize required data """ self.AnimatorName = "Daniel" self.Date = pm.date(format="DD/MM/YYYY") self.SceneName = "PYMHUD" self.activesHuds = [] self.__init_window__()
def __init__(self, name='', hikName='CH'): super(FacialRigMeta, self).__init__(hikname, **kws) self.setascurrentcharacter() self.select() self.hikProperty = self.getHIKPropertyStateNode() self.hikControl = self.getHIKControlSetNode() # self.character.lockState = False # pm.lockNode(hikName,lock=False) self.addAttr('CharacterName', name) self.addAttr( 'BuildBy', '{} {}'.format(os.environ.get('COMPUTERNAME'), os.environ.get('USERNAME'))) self.addAttr('Branch', os.environ.get('USERDOMAIN')) self.addAttr('BuildDate', pm.date()) self.addAttr('FacialRig', attrType='messageSimple') self.addAttr('HairRig', attrType='messageSimple') self.addAttr('SecondaryRig', attrType='messageSimple') log.info('%s Initilize' % self.__str__)
def __bindData__(self): ''' build Attribute ''' ###### MetaNode information Attributes self.addAttr('RigType', 'SecondaryRig', l=True) self.addAttr('CharacterName', '') self.addAttr('BuildBy', '{} {}'.format(os.environ.get('COMPUTERNAME'), os.environ.get('USERNAME')), l=True) self.addAttr('Branch', os.environ.get('USERDOMAIN'), l=True) self.addAttr('BuildDate', pm.date(), l=True) ###### Model information Attributes self.addAttr('secSkinDeformGp', attrType='messageSimple') ###### Bone Information Attributes self.addAttr('HairControlSet', attrType='messageSimple') self.addAttr('ClothControlSet', attrType='messageSimple') ###### Control Hook self.addAttr('ctlGp', attrType='messageSimple') self.addAttr('bonGp', attrType='message') self.addAttr('miscGp', attrType='messageSimple')
def __bindData__(self): ''' bind our default attrs to this node ''' self.addAttr('RigType','FacialRig', l=True) self.addAttr('CharacterName','') self.addAttr('BuildBy','{} {}'.format(os.environ.get('COMPUTERNAME'), os.environ.get('USERNAME')), l=True) self.addAttr('Branch',os.environ.get('USERDOMAIN'), l=True) self.addAttr('BuildDate',pm.date(), l=True) #self.addAttr('Models','-'*50, l=True) self.addAttr('FaceGp','') self.addAttr('EyeGp','') self.addAttr('FaceDeformGp','') self.addAttr('FacialTargetPath','') #self.addAttr('Bones','-'*100, l=True) self.addAttr('HeadBone', 'CH_Head') self.addAttr('FacialBoneGp','') self.addAttr('EyeBoneGp','') self.addAttr('BlendshapeCtl','') self.addAttr('FacialCtl','') self.addAttr('EyeCtl','') self.addAttr('TongueCtl','') self.addAttr('JawCtl','')
def __bindData__(self): ''' build Attribute ''' ###### MetaNode information Attributes self.addAttr('RigType', 'FacialRig', l=True) self.addAttr('CharacterName', '') self.addAttr('BuildBy', '{} {}'.format(os.environ.get('COMPUTERNAME'), os.environ.get('USERNAME')), l=True) self.addAttr('Branch', os.environ.get('USERDOMAIN'), l=True) self.addAttr('BuildDate', pm.date(), l=True) ###### Model information Attributes self.addAttr('FaceGp', attrType='messageSimple') self.addAttr('EyeGp', attrType='messageSimple') self.addAttr('FaceRigGp', attrType='messageSimple') self.addAttr('FaceDeformGp', attrType='message') self.addAttr('FacialTargetPath', "") ###### Bone Information Attributes self.addAttr('HeadBone', attrType='messageSimple') self.addAttr('FacialBone', attrType='messageSimple') self.addAttr('EyeBone', attrType='messageSimple')
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))
def makePlayblast(self, item=None, sound=None, hd=False, local=False): if not item: item = self.__item__ if not item: pc.warning('Item not set: cannot make playblast') if sound: sound = exportutils.getAudioNode() if not sound: sound = [''] else: sound = [''] itemName = imaya.getNiceName(item.name) tempFilePath = osp.join(self.tempPath, itemName) pc.playblast(format='qt', fo=1, st=item.getInFrame(), et=item.getOutFrame(), f=tempFilePath, s=str(sound[0]), sequenceTime=0, clearCache=1, viewer=0, showOrnaments=1, fp=4, percent=100, compression='H.264', quality=100, widthHeight=exportutils.getDefaultResolution(), offScreen=1) tempFilePath += '.mov' if hd: depth = 4 path = osp.join(self.path, 'HD') try: os.mkdir(path) except: pass else: depth = 3 path = self.path infoFilePath = osp.join(osp.dirname(tempFilePath), itemName + '.json') infoFileOrigPath = osp.join(path, itemName + '.json') data = '' if osp.exists(infoFileOrigPath): with open(infoFileOrigPath) as (ifr): data = json.loads(ifr.read()) with open(infoFilePath, 'a') as (infoFile): newData = [{ 'user': getUsername(), 'time': pc.date(format='DD/MM/YYYY hh:mm'), 'inOut': ('-').join([str(item.inFrame), str(item.outFrame)]), 'name': itemName, 'focalLength': item.camera.focalLength.get() }] if data: if isinstance(data, list): newData[0]['user'] = data[0]['user'] newData.extend(data) if isinstance(data, dict): newData[0]['user'] = data['user'] newData.append(data) infoFile.write(json.dumps(newData)) if local: path = exportutils.getLocalDestination(path, depth) exportutils.copyFile(infoFilePath, self.path, depth=3) exportutils.copyFile(tempFilePath, path, depth=depth)