Thanks guys :)

Michael Havart wrote:
with this one you can dock the panel wherever you want !

import nuke
import nukescripts

class PrintPath(nukescripts.PythonPanel):
    def __init__(self):
self.reads = nuke.allNodes('Read') nukescripts.PythonPanel.__init__( self, 'PrintPath', 'printpath') self.textKnob = nuke.Multiline_Eval_String_Knob('text') self.textKnob.setValue(str('\n'.join([n['file'].value() for n in self.reads]))) self.refreshButton = nuke.PyScript_Knob('refresh')

        self.addKnob(self.textKnob)
        self.addKnob(self.refreshButton)

    def knobChanged(self, knob):
        if knob == self.refreshButton:
self.textKnob.setValue(str('\n'.join([read['file'].value() for read in nuke.allNodes('Read')])))

def printPath():
    nukescripts.registerPanel( 'printpath', printPath)
    PrintPath().show()

printPath()



On 20 July 2011 09:55, Olivier Jezequel <[email protected] <mailto:[email protected]>> wrote:

    That's definitely better, yesterday i couldn't find how to write
    the correct expression with display.
    Thanks everybody


    Ivan Busquets wrote:

        If it's just for the purpose of displaying that list in a floating
        window you can copy-paste from, why not just use nuke.display() as
        John suggested? You even get an "update" button for free, so
        you can
        leave that floating window open if you want and rerun the
        script any
        time by hitting "update".

        Quick example:

        nuke.display("str('\\n'.join([n['file'].value() for n in
        nuke.allNodes('Read')]))", nuke.root(), "Files of all Reads in
        root...")



        On Tue, Jul 19, 2011 at 11:53 AM, Howard Jones
        <[email protected] <mailto:[email protected]>> wrote:
            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]
            <mailto:[email protected]>>
            To: Nuke Python discussion
            <[email protected]
            <mailto:[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]>
                    <mailto:[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]>>
[mailto:[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]>
<mailto:[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]>
<mailto:[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]>
                       <mailto:[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

Reply via email to