Thread: Help to complete this.....

Reply to Thread
Results 1 to 3 of 3

Hybrid View

  1. #1 Help to complete this..... 
    Join Date
    Aug 2006
    Location
    India
    Posts
    246
    Hi friends, Currently i'm learning python scripting. I got on idea to create a tool for my convenience.

    idea is.... extracting a single frame using "FrameHold" function. I created below .py file with my knowledge. Cant make it work what i expect. My panel result (what ever value i given as a input ) will print on to the "FrameHold" "first_frame" field.

    some one please help me to complete this script.

    HTML Code:
    '''
    Created on 26-Feb-2012
    
    @author: satheesh
    '''
    import nuke
    
    def extractFrame():
        ef = nuke.Panel("extractFrame", 200)
        ef.addSingleLineInput("frame:","")
        ef.addButton("cancel")
        ef.addButton("ok")
        result = ef.show()
        
        if result == 1:
            print "ok"
        
        else:
            print "canceled"
        
    def singleFrame():
        fh = nuke.createNode("FrameHold")
        fh.setName('singleFrame')
        
    singleFrame()
        
    def mainFunc():
        extractFrame()
    mainFunc()
    Failure is not an option.. But failure has to be an option...
    ____________________
    My Nuke Tutorial page
    Reply With Quote  

  2. #2  
    Join Date
    Aug 2006
    Location
    India
    Posts
    246
    fixed it myself...
    Failure is not an option.. But failure has to be an option...
    ____________________
    My Nuke Tutorial page
    Reply With Quote  

  3. #3  
    Join Date
    Aug 2006
    Location
    India
    Posts
    246
    Here is the final code:
    http://www.nukepedia.com/gizmos/pyth.../extractframe/

    '''
    Created on 01-Mar-2012

    @author: satheesh.R
    contact: satheesrev@gmail.com
    '''
    import nuke
    ## creating panel
    def extractFrame():
    ef = nuke.Panel("extractFrame", 20)
    ef.addSingleLineInput("which frame you want to extract:","")
    ef.addButton("cancel")
    ef.addButton("ok")
    ef.show()

    result=ef.value("which frame you want to extract:")
    frame = nuke.frame()
    if result =="":
    result=frame
    ## create framehold and modify
    fh = nuke.createNode("FrameHold")
    fh.setName("singleFrame")
    fh['first_frame'].setValue(int(result))
    fh['postage_stamp'].setValue(1)


    Manu py:
    import extractFrame
    n = nuke.toolbar('Nodes')
    menu.addCommand('Edit/extractFrame', 'extractFrame.extractFrame()', "F2")


    ( you can change the shortcut from "F2" to what ever you want )
    Failure is not an option.. But failure has to be an option...
    ____________________
    My Nuke Tutorial page
    Reply With Quote  

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     
Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts