Ejemplo n.º 1
0
def k_check(p, j, o, s):
    import json as ss
    import sys
    import maya.cmds as cc
    import maya.mel as mm
    import os
    import time
    import datetime

    k_fantabox = 'O:/hq_tool/Maya/hq_maya/scripts'
    k_json = k_fantabox + '/fantabox'
    k_python_sp = 'O:/hq_tool/programs/python_site-packages'
    #k_python_mod= u'//10.99.1.12/数码电影/临时交换/08技术/个人文件夹/L练月标/HqFtp/release/init'

    #j = 'E:/work/7_0314_wenti'
    #o = 'D:/work/7_0314_wenti'
    op = o + '/ftbox_otherfile'

    #mongoDB的路径
    #path='D:/ziliao/201707/python_site-packages'
    if not k_python_sp in sys.path:
        sys.path.append(k_python_sp)
    import datetime
    from bson.objectid import ObjectId
    import pymongo
    client = pymongo.MongoClient('10.99.40.10', 27017)
    db = client['k_text']
    kpost = db['check']

    #maya后台检查脚本路径
    #path2='D:/ziliao/201708/check'
    #if not k_python_mod in sys.path:
    #sys.path.append(k_python_mod)

    import socket
    checkIP = ('127.0.0.1', 998)
    ksocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ksocket.connect(checkIP)

    #插件模块地址
    #sys.path.append('C:/Users/dengtao/Documents/maya/2015-x64/scripts')
    if not k_fantabox in sys.path:
        sys.path.append(k_fantabox)

    reload(sys)
    sys.setdefaultencoding('gbk')
    import fantabox

    #json文件地址
    #k_envpath='E:/work/7_0327_mayapy/text5/release/json/'
    k_enablefiles = ss.loads(open(r'%sFantaBox_mayacheck.json' %
                                  k_json).read(),
                             encoding='gbk')
    k_enables = ss.loads(s, encoding='gbk')
    cc.file(p, f=1, op="v=0;", esn=0, ignoreVersion=1, typ="mayaBinary", o=1)

    mm.eval('setProject "%s";' % j)

    k_Treturn = {}

    module = {
        'modeling': 'mod',
        'rendering': 'ren',
        'fx': 'fx',
        'common': 'com',
        'animation': 'ani',
        'rigging': 'rig'
    }

    k_enablesize = 0
    for i in k_enables.keys():
        if k_enables[i][0]:
            k_enablesize += 1

    kpercent = 100. / k_enablesize
    kprogres = 0
    for k_enable in k_enables:
        if k_enables[k_enable][0]:
            kType = 1

            kmod = k_enablefiles[k_enable][3]
            print kmod
            new_k_enable = (module[kmod] + '.' + k_enable)
            print new_k_enable
            print 'fantaTexClass.%s()' % new_k_enable
            k_return = 'fantaTexClass.%s()' % new_k_enable
            k_returna = eval(k_return)
            if k_returna:
                kType = 2
            #k_update={k_enable:k_returna}
            k_update = {k_enablefiles[k_enable][2]: k_returna}
            k_Treturn.update(k_update)

            kprogres = kprogres + kpercent
            if kprogres >= 99.9:
                kprogres = 100
            ksend = {kprogres: kType}
            ksend = ss.dumps(ksend)
            ksocket.send(ksend)
            kreply = ksocket.recv(1024)
            #time.sleep(.1)

    #k_outputs=ss.dumps(k_Treturn)
    import k_checkOutSideFile
    check_outsidefile = k_checkOutSideFile.k_cachefinder()
    outsidefile = check_outsidefile.k_checkit()
    kNodedate = check_outsidefile.kNodedate

    import k_editOutsidePath

    k_updata = k_editOutsidePath.k_editPath(j, o, outsidefile)
    k_updata.k_checkPath()
    k_pathUpdate = k_updata.kupdate

    mayaplugin_version = check_outsidefile.mayaplugin_version
    check_post = {
        u"检查人": "k",
        u"上传时间": datetime.datetime.now(),
        "maya_check": k_Treturn,
        "Nodedate": kNodedate,
        "outsidefile": outsidefile,
        "update": k_pathUpdate,
        u'插件版本': mayaplugin_version,
        u'工程目录': check_outsidefile.projectDir
    }
    kpost_id = kpost.insert(check_post)
    #print kpost_id
    ksend = {"_id": str(kpost_id)}
    ksend = ss.dumps(ksend)
    ksocket.send(ksend)
    ksocket.close()
Ejemplo n.º 2
0
def k_check(p, j, o, s):
    #maya脚本地址
    k_fantabox = '//10.99.1.13/hq_tool/Maya/hq_maya/scripts'
    k_json = k_fantabox + '/fantabox'

    o = o + '/'
    #特殊文件夹路径
    op = o + 'ftbox_otherfile'
    #联接mongoDB
    client = pymongo.MongoClient('10.99.40.10', 27017)
    db = client['hqft_film']
    kpost = db['check']
    #联接TCP
    checkIP = ('127.0.0.1', 998)
    ksocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ksocket.connect(checkIP)
    #插件模块地址
    if not k_fantabox in sys.path:
        sys.path.append(k_fantabox)
    #不reload不行
    reload(sys)
    sys.setdefaultencoding('gbk')
    #import maya脚本模块
    import fantabox

    #解析json文件
    k_enablefiles = ss.loads(open(r'%s/FantaBox_mayacheck.json' %
                                  k_json).read(),
                             encoding='gbk')
    k_enables = ss.loads(s, encoding='gbk')
    #maya后台打开文件
    cc.file(p, f=1, op="v=0;", esn=0, ignoreVersion=1, typ="mayaBinary", o=1)
    #maya设置工程目录
    mm.eval('setProject "%s";' % j)

    #定义威猛先生检查出来的内容
    k_Treturn = {}

    #设置 进度条
    k_enablesize = 0
    for i in k_enables.keys():
        if k_enables[i][0]:
            k_enablesize += 1

    kpercent = 100. / k_enablesize

    kprogres = 0

    #执行具体脚本
    for k_enable in k_enables:
        if k_enables[k_enable][0]:
            kType = 1
            k_split = k_enable.split('.')
            k_mod = k_split[0]
            k_py = k_split[1]
            k_return = 'fantabox.%s()' % k_enable
            #特殊模块需要给参数 参数为模块的数字代码
            k_return2 = 'fantabox.%s(%d)' % (k_enable, -1)
            try:
                k_returna = eval(k_return)
            except:
                k_returna = eval(k_return2)
            #如果检查出有问题 type改变为不通过状态
            if k_returna:
                kType = 2
            #k_update={k_enable:k_returna}

            k_update = {k_enablefiles[k_mod][k_py][0]: k_returna}
            k_Treturn.update(k_update)

            kprogres = kprogres + kpercent
            if kprogres >= 99.9:
                kprogres = 100
        #发送进度条数值 及 检查通过状态
            ksend = {kprogres: kType}
            #包装成json
            ksend = ss.dumps(ksend)
            #TCP发送
            ksocket.send(ksend)
            #接收回应
            kreply = ksocket.recv(1024)
            #time.sleep(.1)

    #k_outputs=ss.dumps(k_Treturn)
    #执行 检查maya外部文件 脚本
    import k_checkOutSideFile
    check_outsidefile = k_checkOutSideFile.k_cachefinder()
    outsidefile = check_outsidefile.k_checkit()
    kNodedate = check_outsidefile.kNodedate

    #执行 修改外部文件路径 脚本 (本地匹配o盘)
    import k_editOutsidePath
    k_updata = k_editOutsidePath.k_editPath(j, o, op, outsidefile)
    k_updata.k_checkPath()
    k_pathUpdate = k_updata.kupdate

    #调取maya文件内用到的插件版本
    mayaplugin_version = check_outsidefile.mayaplugin_version

    #上传数据到数据库
    check_post = {
        u"检查人": "k",
        u"上传时间": datetime.datetime.now(),
        "maya_check": k_Treturn,
        "Nodedate": kNodedate,
        "outsidefile": outsidefile,
        "update": k_pathUpdate,
        u'插件版本': mayaplugin_version,
        'mayaPath': p,
        'mayaProject': j,
        'Opath': o
    }
    kpost_id = kpost.insert(check_post)
    #print kpost_id
    #发送数据库 新增表格的id
    ksend = {"_id": str(kpost_id)}
    ksend = ss.dumps(ksend)
    ksocket.send(ksend)
    ksocket.close()
Ejemplo n.º 3
0
def k_check(p, j, o, s):

    k_fantabox = '//10.99.1.13/hq_tool/Maya/hq_maya/scripts'
    k_json = k_fantabox + '/fantabox'

    #k_python_mod= u'//10.99.1.12/数码电影/临时交换/08技术/个人文件夹/L练月标/HqFtp/release/init'

    #j = 'E:/work/7_0314_wenti'
    #o = 'D:/work/7_0314_wenti'
    o = o + '/'
    op = o + '/ftbox_otherfile'

    client = pymongo.MongoClient('10.99.40.10', 27017)
    db = client['hqft_film']
    kpost = db['check']

    #maya后台检查脚本路径
    #path2='D:/ziliao/201708/check'
    #if not k_python_mod in sys.path:
    #sys.path.append(k_python_mod)

    checkIP = ('127.0.0.1', 998)
    ksocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ksocket.connect(checkIP)

    #插件模块地址
    #sys.path.append('C:/Users/dengtao/Documents/maya/2015-x64/scripts')
    if not k_fantabox in sys.path:
        sys.path.append(k_fantabox)

    reload(sys)
    sys.setdefaultencoding('gbk')
    import fantabox

    #json文件地址
    #k_envpath='E:/work/7_0327_mayapy/text5/release/json/'
    k_enablefiles = ss.loads(open(r'%s/FantaBox_mayacheck.json' %
                                  k_json).read(),
                             encoding='gbk')
    k_enables = ss.loads(s, encoding='gbk')
    cc.file(p, f=1, op="v=0;", esn=0, ignoreVersion=1, typ="mayaBinary", o=1)

    mm.eval('setProject "%s";' % j)

    k_Treturn = {}

    k_enablesize = 0
    for i in k_enables.keys():
        if k_enables[i][0]:
            k_enablesize += 1

    kpercent = 100. / k_enablesize

    kprogres = 0
    for k_enable in k_enables:
        if k_enables[k_enable][0]:
            kType = 1

            k_split = k_enable.split('.')

            k_mod = k_split[0]
            k_py = k_split[1]

            #kmod=k_enablefiles[k_enable][3]
            #print kmod
            #new_k_enable=(module[kmod]+'.'+k_enable)
            #print new_k_enable
            #print 'fantaTexClass.%s()' %new_k_enable
            k_return = 'fantabox.%s()' % k_enable
            #特殊模块需要给参数 参数为模块的数字代码
            k_return2 = 'fantabox.%s(%d)' % (k_enable, -1)

            try:
                k_returna = eval(k_return)
            except:
                k_returna = eval(k_return2)
            if k_returna:
                kType = 2
            #k_update={k_enable:k_returna}

            k_update = {k_enablefiles[k_mod][k_py][0]: k_returna}
            k_Treturn.update(k_update)

            kprogres = kprogres + kpercent
            if kprogres >= 99.9:
                kprogres = 100
            ksend = {kprogres: kType}
            ksend = ss.dumps(ksend)
            ksocket.send(ksend)
            kreply = ksocket.recv(1024)
            #time.sleep(.1)

    #k_outputs=ss.dumps(k_Treturn)
    import k_checkOutSideFile
    check_outsidefile = k_checkOutSideFile.k_cachefinder()
    outsidefile = check_outsidefile.k_checkit()
    kNodedate = check_outsidefile.kNodedate

    import k_editOutsidePath

    k_updata = k_editOutsidePath.k_editPath(j, o, op, outsidefile)
    k_updata.k_checkPath()
    k_pathUpdate = k_updata.kupdate

    mayaplugin_version = check_outsidefile.mayaplugin_version
    check_post = {
        u"检查人": "k",
        u"上传时间": datetime.datetime.now(),
        "maya_check": k_Treturn,
        "Nodedate": kNodedate,
        "outsidefile": outsidefile,
        "update": k_pathUpdate,
        u'插件版本': mayaplugin_version,
        'mayaPath': p,
        'mayaProject': j,
        'Opath': o
    }
    kpost_id = kpost.insert(check_post)
    #print kpost_id
    ksend = {"_id": str(kpost_id)}
    ksend = ss.dumps(ksend)
    ksocket.send(ksend)
    ksocket.close()
Ejemplo n.º 4
0
def k_check(p, j, o, n, r, s):
    k_fantabox = '//10.99.1.13/hq_tool/Maya/hq_maya/scripts'
    k_json = k_fantabox + '/fantabox'
    departments = [
        'CAM', 'LAY', 'CHR', 'MOD', 'MOD_rig', 'ANI', 'RIG', 'RIG_clu',
        'RIG_moc', 'FX', 'FX_ani', 'REN'
    ]
    n = int(n)
    if not o[-1] == '/':
        o = o + '/'

    client = pymongo.MongoClient('10.99.40.240', 27017)
    db = client['hqft_film']
    kpost = db['check']
    checkIP = ('127.0.0.1', 998)
    ksocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ksocket.connect(checkIP)
    if not k_fantabox in sys.path:
        sys.path.append(k_fantabox)
    reload(sys)
    sys.setdefaultencoding('gbk')
    import fantabox

    k_enablefiles = ss.loads(open(r'%s/FantaBox_mayacheck_ftp.json' %
                                  k_json).read(),
                             encoding='gbk')
    k_enables = ss.loads(s, encoding='gbk')
    cc.file(p, f=1, op="v=0;", esn=0, ignoreVersion=1, typ="mayaBinary", o=1)

    kproj = j
    if kproj[-1] == '/':
        kproj = os.path.dirname(kproj)

    mm.eval('setProject "%s";' % kproj)

    k_mayaname = os.path.basename(p)

    k_customname = []

    for department in departments:
        if ('_' + department + '_') in k_mayaname:
            k_customname = k_mayaname.split('_' + department + '_')[-1]
            k_customname = os.path.splitext(k_customname)[0]

    oimage = o + 'sourceimages/' + k_customname

    op = o + 'ftbox_otherfile/' + k_customname

    k_Treturn = {}

    k_enablesize = 0
    for i in k_enables.keys():
        if k_enables[i][0]:
            k_enablesize += 1

    kpercent = 100. / k_enablesize

    kprogres = 0

    for k_enable in k_enables:
        if k_enables[k_enable][0]:
            kType = 1
            k_split = k_enable.split('.')
            k_mod = k_split[0]
            k_py = k_split[1]
            k_return = 'fantabox.%s()' % k_enable
            k_return2 = 'fantabox.%s(%d)' % (k_enable, n)
            try:
                k_returna = eval(k_return2)
            except:
                k_returna = eval(k_return)
            if k_returna:
                kType = 2
                modzw = k_enablefiles[k_mod][k_py][0]
                print '***  ' + modzw.encode('utf-8') + '  *** 检查不通过'

            k_update = {k_enablefiles[k_mod][k_py][0]: k_returna}
            k_Treturn.update(k_update)

            kprogres = kprogres + kpercent
            if kprogres >= 99.9:
                kprogres = 100

            ksend = {kprogres: kType}
            ksend = ss.dumps(ksend)
            ksocket.send(ksend)
            kreply = ksocket.recv(1024)

    import k_checkOutSideFile
    check_outsidefile = k_checkOutSideFile.k_cachefinder()
    outsidefile = check_outsidefile.k_checkit()
    kNodedate = check_outsidefile.kNodedate

    import k_editOutsidePath
    k_updata = k_editOutsidePath.k_editPath(j, o, op, oimage, outsidefile)
    k_updata.k_checkPath()
    k_pathUpdate = k_updata.kupdate

    mayaplugin_version = check_outsidefile.mayaplugin_version

    check_post = {
        u"检查人": r,
        u"上传时间": datetime.datetime.now(),
        "maya_check": k_Treturn,
        "Nodedate": kNodedate,
        "outsidefile": outsidefile,
        "update": k_pathUpdate,
        u'插件版本': mayaplugin_version,
        'mayaPath': p,
        'mayaProject': j,
        'Opath': o,
        'customname': k_customname
    }
    kpost_id = kpost.insert(check_post)
    ksend = {"_id": str(kpost_id)}
    ksend = ss.dumps(ksend)
    ksocket.send(ksend)
    ksocket.close()