zoukankan      html  css  js  c++  java
  • 写了一个hiero中添加自定义Token的脚本

    Hiero自带Token往往不够用,shotname中自带版本号的情况下要升级版本会很麻烦,比如Shot_0001_v001这样一个序列名,要升级为Shot_0001_v002就必须把_v001之前的部分单独分离出来再添加{version}才行,而hiero中现有的token都不具备分离shotname的功能,所以我单独写了一个{splitshot},注入原程序。
     
    用法很简单,保存为一个脚本,并在__init__中引用即可。
     
    Talk is cheap,show you the code:
     
    ###################################################################################################################################################################
     

    import hiero.core
    import getpass

    def addDefaultResolveEntries_add(self, resolver):
        """addDefaultResolveEntries(self, resolver)
        Create resolve entries for default resolve tokens shared by all task types.
        @param resolver : ResolveTable object"""
        #'002_CS_0600_comp_kaifeng_v001'
        
        resolver.addResolver("{version}", "Version string 'v#', defined by the number (#) set in the Version section of the export dialog", lambda keyword, task: task.versionString())
        resolver.addResolver("{project}", "Name of the parent project of the item being processed", lambda keyword, task: task.projectName())
        resolver.addResolver("{projectroot}", "Project root path specified in the Project Settings", lambda keywork, task: task.projectRoot())
        resolver.addResolver("{hierotemp}", "Hiero temp directory as specified in the Application preferences", lambda keyword, task: hiero.core.ApplicationSettings().value("cacheFolder") )
        
        resolver.addResolver("{splitshot_VHQ}", "show the split name by keyword 'comp' or '_v'", lambda keyword, task: '_'.join(task._item.name().split('_v')[0].split('_')[:-1]))

        resolver.addResolver("{timestamp}", "Export start time in 24-hour clock time (HHMM)", lambda keyword, task: task.timeStamp().strftime("%H%M") )
        resolver.addResolver("{hour24}", "Export start time hour (24-hour clock)", lambda keyword, task: task.timeStamp().strftime("%H") )
        resolver.addResolver("{hour12}", "Export start time hour (12-hour clock)", lambda keyword, task: task.timeStamp().strftime("%I") )
        resolver.addResolver("{ampm}", "Locale's equivalent of either AM or PM.", lambda keyword, task: task.timeStamp().strftime("%p") )
        resolver.addResolver("{minute}", "Export start time minute [00,59]", lambda keyword, task: task.timeStamp().strftime("%M") )
        resolver.addResolver("{second}", "Export start time second [00,61] - '61' accounts for leap/double-leap seconds", lambda keyword, task: task.timeStamp().strftime("%S") )
        resolver.addResolver("{day}", "Locale's abbreviated weekday name, [Mon-Sun]", lambda keyword, task: task.timeStamp().strftime("%a") )
        resolver.addResolver("{fullday}", "Locale's full weekday name", lambda keyword, task: task.timeStamp().strftime("%A") )
        resolver.addResolver("{month}", "Locale's abbreviated month name, [Jan-Dec]", lambda keyword, task: task.timeStamp().strftime("%b") )
        resolver.addResolver("{fullmonth}", "Locale's full month name", lambda keyword, task: task.timeStamp().strftime("%B") )
        resolver.addResolver("{DD}", "Day of the month as a decimal number, [01,31]", lambda keyword, task: task.timeStamp().strftime("%d") )
        resolver.addResolver("{MM}", "Month as a decimal number, [01,12]", lambda keyword, task: task.timeStamp().strftime("%m") )
        resolver.addResolver("{YY}", "Year without century as a decimal number [00,99]", lambda keyword, task: task.timeStamp().strftime("%y") )
        resolver.addResolver("{YYYY}", "Year with century as a decimal number", lambda keyword, task: task.timeStamp().strftime("%Y") )
            
        resolver.addResolver("{user}", "Current username", lambda keyword, task: getpass.getuser() )

    hiero.core.FnExporterBase.TaskPresetBase.addDefaultResolveEntries = addDefaultResolveEntries_add

  • 相关阅读:
    03-java实现双向链表
    04-java实现循环链表
    02-java实现单链表
    01-java实现动态数组
    安装mpi的那些坑
    gotoblas,mpich,hpl,hpcg的安装
    centos之hadoop的安装
    公告
    AFO之后……
    Codeforces Round #599 (Div. 2)的简单题题解
  • 原文地址:https://www.cnblogs.com/hksac/p/4867967.html
Copyright © 2011-2022 走看看