A third option would be to walk your node tree until you hit the node that’s 
setting the format for the node in question.

-Nathan



From: Ivan Busquets 
Sent: Thursday, February 24, 2011 2:27 PM
To: Nuke Python discussion 
Subject: Re: [Nuke-python] Getting format

Also, in 6.1v5 there's a <node>.format() method that returns a Format object. 
Not in 6.2 yet, but I'm sure it will make it for the next release.

So you could get the name (if there is already a named format) like this:

nuke.selectedNode().format().name()



On Thu, Feb 24, 2011 at 2:15 PM, chris <[email protected]> wrote:

  well, you could still use hugo's solution, no?

  - get width and height of selected node, store it
  - reformat to custom format
  - reformat to original format using "to box" and "distort"

  like (please excuse my crude scripting)

  n = nuke.selectedNode()
  w = nuke.selectedNode().width()
  h = nuke.selectedNode().height()
  pA = nuke.selectedNode().pixelAspect
  reformat1 = nuke.nodes.Reformat()
  reformat1.knob("format").setValue("PAL")
  reformat1.setInput(0, n)
  reformat2 = nuke.nodes.Reformat()
  reformat2.knob("type").setValue("to box")
  reformat2.knob("resize").setValue("distort")
  reformat2.knob("box_width").setValue(w)
  reformat2.knob("box_height").setValue(h)
  reformat2.setInput(0, reformat1)


  you probably could also compare the width/height/pixel
  aspect to a list of all your formats using a script and then
  use this info, but unless you want to do something fancy the
  simple approach above should work just as well.

  ++ chris 





  On 2/24/11 at 1:10 PM, [email protected] (Adam Wierzchowski) wrote:


    Actually I need a name of the format. I'm doing reformat to custom format 
and then I create next Reformat node which should return to original format. 
Something like this:

    reformat1 = nuke.nodes.Reformat()
    reformat1.knob("format").setValue(customFormat)
    reformat2 = nuke.nodes.Reformat()
    reformat2.knob("format").setValue(origFormat)

    Adam
    _______________________________________________
    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