示例#1
0
 def getSceneName(self):
     if "Nuke" in self.interpreter:
         import nuke
         root = nuke.toNode("root")
         self.scenePath = os.path.dirname(root.name())
         self.sceneName, self.ext = os.path.splitext(
             os.path.basename(root.name()))
     elif "maya" in self.interpreter:
         import pymel.core as pm
         self.sceneName = pm.Env().sceneName().namebase
         self.scenePath = "%s" % pm.Env().sceneName().dirname()
         self.ext = pm.Env().sceneName().ext
     else:
         pass
示例#2
0
def startReplaceL2H():
    projDic = {
        'XFTL': ['_l_', '_h_'],
        'SENBA': ['_l_', '_h_'],
        'ROCK': ['_l_', '_h_']
    }
    fromto = []
    env = pm.Env()
    fileName = env.sceneName().namebase
    projMatch = lightRenderData.ProjNameMatch()
    projMatch.setFileName(fileName)
    projName = projMatch.getPorjName()
    if projName and projName in projDic:
        fromto = projDic[projName]
        replaceL2H(fromto[0], fromto[1])
def saveFile(describe):
    #按照描述保存文件
    #
    #参数describe: 需要输入描述字符串, 如: 'CHRcolor'等, 保存文件时加入到文件名中.
    #
    pnm = ProjNameMatch()
    fileName = pm.Env().sceneName().namebase
    dir = pnm.setFileName(fileName)
    dir = pm.Path(pnm.getProjDirectorys()[-1] + pnm.getProjDirectorys()[0] +
                  '/scenes')
    project_name = pnm.getResults('project_name')
    episode_number = pnm.getResults('episode_number')
    session_number = pnm.getResults('session_number')
    scene_number = pnm.getResults('scene_number')
    scene_describe = LAYER_FILENAME[describe]
    process_name = 'lr'
    version_number = 'c001'
    newFileName = '_'.join([
        project_name, episode_number, session_number, scene_number,
        scene_describe, process_name, version_number
    ])
    filePrefix = '_'.join([
        project_name, episode_number, session_number, scene_number,
        scene_describe, process_name
    ])
    versions = []
    for f in dir.files():
        subpnm = ProjNameMatch()
        if filePrefix in f.name:
            subpnm.setFileName(f.name)
            versions.append(subpnm.getResults('version_number'))
    if versions:
        versions.sort()
        version_number = 'c' + str(int(versions[-1][1:]) + 1).zfill(3)
    newFileName = '_'.join([
        project_name, episode_number, session_number, scene_number,
        scene_describe, process_name, version_number
    ])
    try:
        pm.saveAs("{0}/{1}.mb".format(dir, newFileName))
        return newFileName
    except:
        raise "save this file failure!!!"
示例#4
0
def get_env():
    maya_env = pm.Env()
    end_time = maya_env.getAnimEndTime()
    start_time = maya_env.getAnimStartTime()
    return start_time, end_time
示例#5
0
    u'Skel_90001_L_rig:spline5_jnt_skin',
    u'Skel_90001_L_rig:Lf_clavicle1_jnt_skin',
    u'Skel_90001_L_rig:Lf_Arm1_jnt_skin',
    u'Skel_90001_L_rig:Lf_Arm6_jnt_skin',
    u'Skel_90001_L_rig:Lf_Arm9_jnt_skin',
    u'Skel_90001_L_rig:Rt_clavicle1_jnt_skin',
    u'Skel_90001_L_rig:Rt_Arm1_jnt_skin',
    u'Skel_90001_L_rig:Rt_Arm6_jnt_skin',
    u'Skel_90001_L_rig:Rt_Arm9_jnt_skin',
    u'Skel_90001_L_rig:neck1_jnt1_skin',
    u'Skel_90001_L_rig:head_jnt_skin',
]
# jnt_crv = {jnt:jnt.history(type="animCurve") for jnt in pm.ls(jnt_list)}
# jnt_crv_list = [jnt.history(type="animCurve") for jnt in pm.ls('Skel_90001_L_rig:root',dag=1,type="joint")]
jnt_crv_list = [jnt.history(type="animCurve") for jnt in pm.ls(jnt_list)]
env = pm.Env()
frame_range = env.getTime()
frame_start = env.getMinTime()

range_list = []
for curr_frame in range(int(frame_range)):
    next_frame = curr_frame + 1
    for crv_list in jnt_crv_list:
        for crv in crv_list:
            curr_value = crv.getValue(curr_frame)
            next_value = crv.getValue(next_frame)
            # NOTE 用不等于存在轻微的数值误差
            if not -0.001 < (curr_value - next_value) < 0.001:
                break
        else:
            continue