Here's one I wrote earlier - adds line numbers and puts it in the shell and
script editor but having the script editor then open would be nice.
Only draw back with it is the script editor adds formatting and on you need to
remember its ctl+shift+c to copy in a linux shell otherwise you kill Nuke.
Looking at it the result bit was to get something to print in nuke.message but
I
found it clunky - needed a way to set a larger width which may exist.
import sys
def listReadNodes():
result=''
line=0
# sort out nodes to find
sn=nuke.selectedNodes()
an=nuke.allNodes()
if not len(sn):
print 'nothing selected - listing all reads'
nodes2use=an
else:
print 'listing selected reads'
nodes2use=sn
# iterate through nodes and print the file path
for i in nodes2use:
if 'Read' in i.Class():
line+=1
t= str(line)+') '+i['file'].value()
#print to shell and script editor
print >> sys.stderr, t
result+=t+'\n'
nuke.message('The list has been printed to the Shell and to the Script
Editor.\nCopy and paste from there.')
________________________________
From: Olivier Jezequel <[email protected]>
To: Nuke Python discussion <[email protected]>
Sent: Tue, 19 July, 2011 19:12:28
Subject: Re: [Nuke-python] forcing nuke to show the script editor
Nice one,
Thanks
Nathan Rusch wrote:
> readPaths = [n['file'].value() for n in nuke.allNodes('Read')]
> nuke.message('\n'.join(readPaths))
>
>
> -Nathan
>
> -----Original Message----- From: Olivier Jezequel
> Sent: Tuesday, July 19, 2011 10:58 AM
> To: Nuke Python discussion
> Subject: Re: [Nuke-python] forcing nuke to show the script editor
>
> I like the idea of the nuke.message() but the problem is it shows 1 path
> at a time and show the next one when you click ok, because it is a loop.
> I want the path in one message. Is that possible ??
>
> thanks
>
> Michael Havart wrote:
>> you can use the nuke.message(str(n['file'].value()))
>>
>>
>> On 19 July 2011 18:19, Olivier Jezequel
>> <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Can use show me an exemple ? I tried few way of writing that they
>> all return an error or a missing argument, the doc is quiet short
>> on that.
>> that's what i am tring to show up :
>>
>> for n in nuke.allNodes ( "Read" ) :
>> print n['file'].value()
>>
>>
>> cheers
>> O
>>
>>
>> John Vanderbeck wrote:
>>
>> Have you looked at nuke.display() ?
>>
>> -----Original Message-----
>> From: [email protected]
>> <mailto:[email protected]>
>> [mailto:[email protected]
>> <mailto:[email protected]>] On
>> Behalf Of
>> Olivier Jezequel
>> Sent: Tuesday, July 19, 2011 12:42 PM
>> To: Nuke Python discussion
>> Subject: [Nuke-python] forcing nuke to show the script editor
>>
>> Hiya,
>> I am writing a little utility tool to print out the path of
>> input files.
>>
>> Is there a way to force nuke to open a script editor to show
>> the result (for exemple popping as a floating window), if the
>> script editor is not in the GUI already ??
>>
>> thanks
>> Olivier
>> _______________________________________________
>> Nuke-python mailing list
>> [email protected]
>> <mailto:[email protected]>,
>> http://forums.thefoundry.co.uk/
>>
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>> _______________________________________________
>> Nuke-python mailing list
>> [email protected]
>> <mailto:[email protected]>,
>> http://forums.thefoundry.co.uk/
>>
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>>
>> _______________________________________________
>> Nuke-python mailing list
>> [email protected]
>> <mailto:[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
>>
>
> _______________________________________________
> 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
_______________________________________________
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