Coder Social home page Coder Social logo

nuke-py's Introduction

nuke-py

This is my self-curated collection of python tools for Nuke.

I take no author credit for any of these whether I've written them or not. They've come from many different people and morphed over the years into what they are now. They've all been cleaned up to match my own PEP 8 preference for styling python code.

Function Input Conventions

In general when I'm writing a tool that operates on a node, nodes, or all nodes I like to keep it open to what input it takes so alot of the rewrites involve tailoring functions in this manner. An example below:

def eat_my_nodes(nodes=[]):
  if not nodes:
    nodes=nuke.selectedNodes()
  if not nodes:
    nodes=nuke.allNodes()
  if nodes:
    for node in nodes:
      eat_str = 'Eating Node: {0}'.format(node.name())
      nuke.tprint(eat_str)
    return
  else:
    return

This way I can use this function programatically somewhere else, I can pass in a list of nodes using nuke.SelectedNodes() or some other way, or I can let it run on it's own and it will work as well.

Menus

I have another tool called MyNk that I use inside my dotnuke folder to automagically add this or other structures of python scripts to a namespaced python object. As part of that process the tool looks for the menus attribute in each function and uses that to generate my custom menus for me. The syntax is pretty straight forward. Here's an example for the above function.

__menus__ = {
  'Tools/Info/Eat Selected Nodes':  {
    'cmd': 'eat_my_nodes(nuke.selectedNodes())',
    'hotkey': '',
    'icon': ''
  },
  'Tools/Info/Eat All Read Nodes':  {
    'cmd': 'eat_my_nodes(nuke.allNodes('Read'))',
    'hotkey': '',
    'icon': ''
  }
}

So that should make sense, although unless you're using the other tool or code like it you can ignore this.

nuke-py's People

Contributors

rjmoggach avatar

Stargazers

Thomas Volkmann avatar Timothy Halim avatar David Satrio avatar Tony Lyons avatar  avatar  avatar Anthony Scudese avatar Walter Arrighetti avatar yann le paih avatar memputate avatar Matthieu Cadet avatar Deke Kincaid avatar

Watchers

Deke Kincaid avatar  avatar Efrizal Hardiman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.