If you want some more robust and flexible way of finding your file
sequences you can try this:

http://pypi.python.org/pypi/pyfileseq/1.0.1

/Björn

On Wed, Jan 4, 2012 at 12:08 AM, Nathan Rusch <[email protected]>wrote:

>   Only issue with the fromUserText approach is you need to know the frame
> range in advance.
>
> If you need to figure the range out yourself on the fly, something like
> the code below will work. Note that it is written to be extra careful about
> the possibility of other files existing in the same directory as the
> sequence in question, even files with identical names but different
> extensions.
>
>
> # 'newPath' is the new path you want to assign to the Read’s file knob
> # 'node' is the Read node
>
> import glob
> import os
> import re
>
> import nukescripts
>
> cleanPath = nukescripts.replaceHashes(newPath)
> padRE = re.compile('%0(\d+)d')
> padMatch = padRE.search(cleanPath)
>
> if padMatch:
>     padSize = int(padMatch.group(1))
>     frameList = sorted(glob.iglob(padRE.sub('[0-9]' * padSize, cleanPath)))
>     first = os.path.splitext(frameList[0])[0][-padSize:]
>     last = os.path.splitext(frameList[-1])[0][-padSize:]
>     node['file'].fromUserText('%s %s-%s' % (cleanPath, first, last))
>
>
> -Nathan
>
>
>  *From:* Ivan Busquets <[email protected]>
> *Sent:* Tuesday, January 03, 2012 2:20 PM
> *To:* Nuke Python discussion <[email protected]>
> *Subject:* Re: [Nuke-python] How to update Read-Node frame ranges
>
> Hi Vincent,
>
> Use the .fromUserText() method to change the "file" knob, instead of
> .setValue()
>
> This will trigger the same callbacks that are triggered when you change
> the file manually, including setting the framerange and format knobs.
>
>
>
> On Tue, Jan 3, 2012 at 2:16 PM, Vincent Langer <
> [email protected]> wrote:
>
>> hi there,
>>
>> i have a little script which changes the filepath of all the readnodes.
>> (update 3d renderpasses)
>>
>> workes fine - but how can i update the readnode frameranges if these have
>> changed?
>> how can i get the first and last framenumber of a given sequence?
>>
>> hope anyone can help
>>
>> cheers,
>> vincent
>>
>>
>>
>> ------------------------------**------------------------------**----
>> This message was sent using IMP, the Internet Messaging Program.
>>
>> ______________________________**_________________
>> Nuke-python mailing list
>> Nuke-python@support.**thefoundry.co.uk<[email protected]>,
>> http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/>
>> http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/**nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python>
>>
>
>
> ------------------------------
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>


-- 
Björn Fredriksson | Head of 2D | Swiss International AB
Sankt Eriksgatan 48 B, 112 34 Stockholm, Sweden
ph +46 8 662 24 60, cellph: +46 721 666 011
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to