Skip to content

keymixcookbook/_NukeMods

Repository files navigation

Python modules to use in a VFX Studio environment

A General scripting format and structure guide

Tool Documentation Page

Main Components

  • ./_pkg_KuFunc
    • __int__.py
    • mod_KuUtility.py
  • ./_pkg_KuStudio
    • __int__.py
    • mod_KuStudio.py
  • ./_mod_Drafts
  • ./_mod_Community
  • menu.py
  • menu_items.py
  • menu_defaults.py
  • kputl.py
  • init.py
  • Qt.py

Installation

  • Download this entire folder /_NukeMods
  • Copy init.edit.py and menu.edit.py to ~/$HOME/.nuke
  • In init.edit.py
    • os.environ['KU_PKG_PATH'] = "Where /_NukeMods is in abs path"
    • os.environ['KU_STUDIO_ENV'] = "Studio Name"

Version Control

  • Update Board linked with Trello
    • Trello board are sectioned into:
      • Drafts - Current: Currently working drafts
      • Updates: modules needs update
      • Debug: modules is finishing update and currently debuging
      • Release: module is updated and debugged
      • Drafts - OnHold: Drafts onhold, code not yet working
      • Obsolete: discarded or replaced modules
  • Files are prefixed with the following with a basename:
    • dft: draft version
    • upt: version updates
    • mod: debug or releases
    • obs: obsoleted versions. (also suffix with the version in v#s# form, ie obs_ThisModule_v#s#.py)
  • Git commenting using the following format
    • ThisModBasename: what's changed
    • ModBasename-bugfix-Ln888: what bug is fixed

IDE

Title

section includes description, author, copyright, current os, etc

'''

Oneline description of the module

'''


import platform


__VERSION__		= '1.0'
__OS__			  = platform.system()
__AUTHOR__		= "Tianlun Jiang"
__WEBSITE__		= "jiangovfx.com"
__COPYRIGHT__	= "copyright (c) %s - %s" % (__AUTHOR__, __WEBSITE__)

__TITLE__		  = "MODULENAME v%s" % __VERSION__


...

Version Control

Defined at the beginning of the module, at module level

def _version_():
    ver='''

    version 1.1
    - feature bug fix
    - feature refine/optimization

    version 1.0
    - new feature added

    version 0
    - Basic features

    '''
    return ver

Formatting Guide for python

Following briefly with Python PEP 8 guidelines, except:

  • Utility Function
    • utilityFunction() - lowerCamelCase
  • Methods and Regular Functions
    • function_and_methods() - lower_case
  • Module's main function
    • mod_ThisModule.ThisModule() - UpperCamelCase
    • module name keeps the same
  • Module with Class when instance
    • mod_ClassModule.ClassModule.run() - UpperCamelCase
      • ClassModule = Core_ClassModule()
    • get_thisMethod(), set_thisMethod() - lower_lowerCamelCase

also includes:

  • <> for variable in comments:
    • <var>
  • _ for space in filenames and variables, or Folders (if as prefix):
    • this_file.ext, this_var, ./this_folder
  • __ for other Folders that is not part of the package:
    • ./__misc
  • "s" for multiword strings, 's' for keywords or attributes,'''str''' for doc string:
    • string = 'word', nuke.thisNode()['attributes'].value(), ThisFunction(argument='keywords')
    • "More than one word"
    • '''for one/more line function description'''

doc strings

def func(args, kargs):
  '''oneline description of the function
  @args: (type) description of this arg
  @kargs='value': descripon of this karg's value
  return: (type) description of what is returned
  '''

Script General Format

'''

Oneline description of the module

'''


import platform


__VERSION__		= '1.0'
__OS__			  = platform.system()
__AUTHOR__		= "Tianlun Jiang"
__WEBSITE__		= "jiangovfx.com"
__COPYRIGHT__	= "copyright (c) %s - %s" % (__AUTHOR__, __WEBSITE__)

__TITLE__		  = "MODULENAME v%s" % __VERSION__


def _version_():
    ver='''

    version 0
    - Basic features

    '''
    return ver




#------------------------------------------------------------------------------
#-Section Title 4 Space up and Down (Capital Letters) 
#-( '#' x 1, '-' x 78 )
#------------------------------------------------------------------------------




def this_function(args, kargs):
  '''oneline description of the function
  @args: (type) description of this arg
  @kargs='value': descripon of this karg's value
  return: (type) description of what is returned
  '''

  # What does the lines below do
  sec_subSec = 'Variable'
  GLOBAL_CONSTANT = "Constant Variable"

  # have 1 space between group of lines
  if quotes: ## comment for one line
    print "String or Messages" ## use double quote
  else:
    print 'properties' ## use single quote

  
  def another_function():
    print("2 spaces between functions and classes")


this_function( one_space_margin )


class Core_ThisClass(Inheritance):
  '''Class Object contain core functions'''
  def __init__(self):
    super(ThisClass, self).__int__()

    self.set_default()

  def set_default(self):
    '''set default values when initializing'''

  def its_method(self):
    print "1 space between Methods..."
    print "...from last line of the previous"

  def run(self):
    '''Main method for running the class'''
    self.show()


class Core_ThisClass:
  '''Class Object as a container for core class'''
  def __init__(self):
      super(Core_ThisClass, self).__init__()

      self.core = Core_ThisClass()




#------------------------------------------------------------------------------
#-Section Title 4 Space up and Down (Capital Letters)
#------------------------------------------------------------------------------




ThisClass = Core_ThisClass()

About

pipeline tools for home and studio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages