CG 流程 之Shotgun上传模型文件时自动生成一个不带版本号的文件

在做绑定时, 由于设置的特殊性,不用频繁的改maya reference的文件, 需要一个不带版本号的模型文件参考,需要扩展toolkit开发插件,触发事件在publish完成后的finalize上来执行

def finalize(self, settings, item):
        work_file = item.properties["path"]
        work_filename = os.path.basename(work_file)
        work_path = os.path.dirname(work_file)
        mode = item.context.task['name'].lower()
        # print(work_path, dirpath,filename,mode)
        if 'model' in mode and 'environment' not in work_file.lower():
            #角色道具同时生成一个不带版本号和人名的文件
            filenamelist = work_filename.split('_')
            extension = os.path.splitext(work_filename)[1]
            newfile = "%s_%s_%s%s" % (filenamelist[0], filenamelist[1], filenamelist[2],extension)

            publish_folder = work_path.replace('work','publish')
            publish_file = os.path.join(publish_folder,newfile)

            publish_folder = os.path.dirname(publish_file)
            ensure_folder_exists(publish_folder)
            copy_file(work_file, publish_file)
            print('%s to %s' % (work_file,publish_file))
            #####################################
            #写入shotgun
            publisher = self.parent
            publish_dependencies = self.get_publish_dependencies(settings, item)
            self.logger.info("Registering publish...")
            publish_data = {
                "tk": publisher.sgtk,
                "context": item.context,
                "comment": item.description,
                "path": publish_file,
                "name": newfile,

finalize 事件写代码

写成界面

在rig里引用述

qq:316853809 欢迎CG同行交流

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值