A General scripting format and structure guide
./_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
- Download this entire folder
/_NukeMods
- Copy
init.edit.py
andmenu.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"
- Update Board linked with Trello
- Trello board are sectioned into:
Drafts - Current
: Currently working draftsUpdates
: modules needs updateDebug
: modules is finishing update and currently debugingRelease
: module is updated and debuggedDrafts - OnHold
: Drafts onhold, code not yet workingObsolete
: discarded or replaced modules
- Trello board are sectioned into:
- Files are prefixed with the following with a basename:
dft
: draft versionupt
: version updatesmod
: debug or releasesobs
: obsoleted versions. (also suffix with the version inv#s#
form, ieobs_ThisModule_v#s#.py
)
- Git commenting using the following format
- ThisModBasename: what's changed
- ModBasename-bugfix-Ln888: what bug is fixed
- VSCode desktop
- Gitpod web-IDE
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__
...
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
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()
- UpperCamelCaseClassModule = 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
'''
'''
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()