nukescripts.frame

Package nukescripts :: Module frame |
[hide private]
[frames] | no frames]

# Source Code for Module nukescripts.frame

     1  # Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved.
     2
     3  import nuke
     4
     5 -def goto_frame():
     6    f = nuke.frame()
     7    p = nuke.Panel("Goto Frame")
     8    p.addSingleLineInput("Frame:", f)
     9    result = p.show()
    10    if result == 1:
    11      nuke.frame(int(nuke.expression(p.value("Frame:"))))
    12
    13
    14  import re
    15 -def replaceHashes(filename):
    16    '''replaceHashes(filename) -> string
    17    Replace any sequences of 1 or more hash marks (#) with a printf-style %0nd specifier.'''
    18    def _hashRepl(matchobj):
    19        return "%%0%dd" % len(matchobj.group(0))
    20    _pat = re.compile(r'(\#+)')
    21    return re.sub(_pat, _hashRepl, filename)
    22