It’s good practice to do it all the time, just to help make things clearer and 
avoid the potential for pesky errors.

-Nathan



From: Michael Havart 
Sent: Tuesday, March 08, 2011 10:24 AM
To: Nuke Python discussion 
Subject: Re: [Nuke-python] knob syntax

Ok that's clever, thanks 
When exactly you need to put the curly braces ? maybe it can improve my 
autolabel callbacks...

thanks,
Michael

2011/3/8 Ean Carr <[email protected]>

  That's because you're confusing the tcl interpreter. Try curly braces.

  [python {nuke.thisNode()["size"].value()}]

  -E 



  On Tue, Mar 8, 2011 at 2:45 PM, Michael Havart <[email protected]> 
wrote:

    and also, in autolabel or expressions this will not work:



    [python nuke.thisNode()["size"].getValue()]



    but this will work:



    [python nuke.thisNode().knob("size").getValue()]







    2011/3/8 Alexander Jones <[email protected]> 





      On 8 March 2011 06:19, Ben Dickson <[email protected]> wrote:

        node['blah'].value()

        ..is less typing, so I use that over the functionally identical
        node.knob("blah").value()


      They're not identical -- ["blah"] will raise a KeyError for a missing 
knob, whereas knob("blah") will return None. Subtle!
       

        I use node.knobs() occasionally to iterate over all knobs (or use
        node.knobs().keys() ) 


        Incidentally I use [''] over [""], because the first can be typed
        without shift (on UK/Australian keyboards anyway) - same with ("") which
        can be typed with shift held. Efficiency!...


        John RA Benson wrote:
        > Hey there -
        >
        > Basic question:
        >
        > just curious - if find myself flipping between using syntax like:
        >
        > node.knob('myknob').value()
        > vs:
        > node['myknob'].value()
        >
        > Is there any 'best practices' or preferred way to write that? Sort of 
like, do you always use '"' or "'" for quotes...
        >
        > Cheers
        > JRAB_______________________________________________
        > Nuke-python mailing list
        > [email protected]
        > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
        >


        --
        ben dickson
        2D TD | [email protected]
        rising sun pictures | www.rsp.com.au


        _______________________________________________
        Nuke-python mailing list
        [email protected]
        http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python




      -- 
      Alexander Jones
      Double Negative R&D
      www.dneg.com


      _______________________________________________
      Nuke-python mailing list
      [email protected]
      http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python





    -- 

    Michael Havart | DMP-ENV | MPC-London 
    images: cghub.com | blogspot.com
    cv: linkedin profile | imdb


    _______________________________________________
    Nuke-python mailing list
    [email protected]
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python




  _______________________________________________
  Nuke-python mailing list
  [email protected]
  http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python








--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected]
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected]
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to