Hooks: add node in batch

Author: Stefan
update: 2019/02/17
Flame 2019.2 and up (pyside2)

A little UI to type in the node you want to add.

This first version just adds the node ‘loose’ in the schematic, no auto-connect.

It shows up in the Main Menu (bottom right) and you can assign a shortcut to open it. (i use shift+cmd+’number’)
You can keep the mini window open as long as you need.
The entry field is predictive, using a list of all available batch nodes available in the python api (reading from it).
It is not case sensitive, whatever case you prefer.

add_node QT UI

Hope you’ll like it.

6 Replies to “Hooks: add node in batch”

  1. Hey Joel,

    Sorry for the delay.

    This is in a hook form, not console.
    If you’re interested, you can read about how it works in the Getting Started article:
    https://www.flamepy.com/category/getting-started/

    Anyway, the following should work in the console, it’s case sensitive.

    This is for 2019.1
    If have an older version (2018 …) you probably have to change the first line:
    from tank.platform.qt import QtGui, QtCore
    with the following one:
    from PySide import QtGui, QtCore

    Cheers,
    Stefan

    from tank.platform.qt import QtGui, QtCore
     
     
    def Window():
     
        import flame
     
        def addNode():
            # import flame
            createnodeType = str(nodeTypeEntry.text())
            flame.batch.create_node(createnodeType)
     
        # Entry field/line
        nodeTypeEntry = QtGui.QLineEdit('')
        nodeTypeEntry.setPlaceholderText('Enter Node Type')
        nodeTypeEntry.returnPressed.connect(addNode)
        nodeTypeEntry.setGeometry(0, 0, 130, 30)
        nodeTypeEntry.move(10, 10)
        nodeTypeEntry.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        nodeTypeEntry.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     
        # Predictive typing. Fed with the list of available nodes in batch.
        strList = []
        for nt in flame.batch.node_types:
            strList.append(nt)
        completer = QtGui.QCompleter(strList, nodeTypeEntry)
        nodeTypeEntry.setCompleter(completer)
     
        nodeTypeEntry.show()
    
    Window()
    
    
  2. Also, check out the new hook for appending setups in the current one (like your own modules). It looks similar at first (one typing dialog window, predictive typing …) but it ‘s for batch setups, not just nodes. You can customize where Flame should look (your collection(s) of useful setups) and see a list of setups per path …

    https://www.flamepy.com/2018/10/27/hooks-append-batch-setup-v03/?fbclid=IwAR2G4UBGlmKfHhtr02AQEtMA-D1ZwVgpWO54h139tMu1gFnRTraNYEZ32T4

  3. I had a bit of fun with this one. I set the hot key to TAB and showed some of the Nuke boys who are learning Flame.
    We really like it. It does leave the little windows open in the background and it drops the node a little off the edge of the screen but still better than anything I could code up.
    Nice work!

    1. Cool! I’m glad you guys liked it!
      Thanks for the nice feedback!
      I haven’t had a look at it in a looong time but it might be missing the ‘deleteOnClose’ flag or something.
      Cheers

Leave a Reply