Skip to content
This repository was archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
update module format and versioning guidlines
Browse files Browse the repository at this point in the history
  • Loading branch information
keymixcookbook committed Apr 15, 2021
1 parent ddc1a94 commit 1ed6e88
Show file tree
Hide file tree
Showing 27 changed files with 1,461 additions and 949 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ Oneline description of the module
import platform


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

__TITLE__ = "MODENAME v%s" % __VERSION__

__TITLE__=__file__.split('_')[1].split('.')[0]

...
```
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 32 additions & 13 deletions _pkg_KuFunc/mod_AOVContactSheet.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
'''
- Filtering chanel layers with keywords
Filtering chanel layers with keywords
'''




#------------------------------------------------------------------------------
#-Module Import
#------------------------------------------------------------------------------




import platform
import os
from Qt import QtWidgets, QtGui, QtCore
import nuke, nukescripts
import re




__VERSION__='1.0'
__OS__=platform.system()
__AUTHOR__="Tianlun Jiang"
__COPYRIGHT__="copyright %s" % __AUTHOR__

__TITLE__=__file__.split('_')[1].split('.')[0]
#------------------------------------------------------------------------------
#-Header
#------------------------------------------------------------------------------




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

__TITLE__ = "AOVContactSheet v%s" % __VERSION__


def _version_():
Expand All @@ -28,17 +53,12 @@ def _version_():


#------------------------------------------------------------------------------
#-Module Import
#-Main Functions
#------------------------------------------------------------------------------




import nuke, nukescripts
import re



def AOVContactSheet():
'''main function'''
if not nuke.selectedNode():
Expand All @@ -53,7 +73,6 @@ def AOVContactSheet():
node.setInput(0, nuke.selectedNode())
filtering(node)



def button_filter():
'''filter with keywords with button pressed'''
Expand Down
195 changes: 115 additions & 80 deletions _pkg_KuFunc/mod_BackdropResize.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,50 @@
'''
Resize Backdrops
'''




#------------------------------------------------------------------------------
#-Module Import
#------------------------------------------------------------------------------




import platform
import os
from Qt import QtWidgets, QtGui, QtCore
import nuke, nukescripts




#------------------------------------------------------------------------------
#-Header
#------------------------------------------------------------------------------




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

__TITLE__ = "BackdropResize v%s" % __VERSION__


def _version_():
ver='''
version 3.0
version 2.0
- Fit to selection
- Select which `Backdrop` node to resize
version 2.0 (with mod_ColorCode)
- add color palatte, with html special characters and pyScript buttom
version 1.0
- Select Backdrop
- Enter Width and Height
Expand All @@ -17,12 +54,84 @@ def _version_():
return ver


import nuke, nukescripts


#-------------------------------------------------------------------------------
#-Main Functions
#-------------------------------------------------------------------------------




def BackdropResize():
'''main function'''

nodes = nuke.selectedNodes()

if len(nodes) <= 0:
nuke.message("Select some nodes goddamnit")
print "Abort"
elif len([b for b in nodes if b.Class() == 'BackdropNode']) <= 0:
nuke.message("Gotta include a Backdrop Node, man")
print "Abort"
else:

# Prompt
p=nuke.Panel("Resize %s" % bdFind(nodes).name())
p.addEnumerationPulldown('Mode', '"Fit to Selection" "Manual Scaling"')
# p.addBooleanCheckBox('Fit to Selection', True)
p.addButton('Cancel')
p.addButton('Resize!')

p.setWidth(len(p.title())*12)

if p.show():

mode_sel = p.value('Mode')

# Find Biggest Backdrop node to resize
node_bd = bdFind(nodes)

# Fit to Selection
if mode_sel == "Fit to Selection":

new_size = bdSizeFit(nodes, node_bd)

resize(node_bd, new_size)
print "%s Resized to Fit Selection" % node_bd.name()

# Manual Scaling
elif mode_sel == "Manual Scaling":

# Second Prompt
psub = nuke.Panel("Resize %s" % bdFind(nodes).name())
psub.addExpressionInput('Width',1) # average node width: 80
psub.addExpressionInput('Height',1) #average node height: 74
psub.addBooleanCheckBox('From Center', True)
psub.addButton('Cancel')
psub.addButton('Resize!')

psub.setWidth(len(p.title())*12)

if psub.show():

input_w = psub.value('Width')
input_h = psub.value('Height')
input_c = psub.value('From Center')

new_size = bdSizeScale(node_bd, input_w, input_h, input_c)

resize(node_bd, new_size)
print "%s Resized with input values" % node_bd.name()
else:
print "Operation Cancelled"




########## Supporting Functions ##########
#-------------------------------------------------------------------------------
#-Supporting Functions
#-------------------------------------------------------------------------------



Expand Down Expand Up @@ -50,7 +159,6 @@ def bdFind(nodes):
return node_bd



def bdSizeFit(nodes, node_bd):
'''Filter out Backdrop node and calculate new size
@nodes: selecteds nodes (list of objs)
Expand All @@ -77,7 +185,6 @@ def bdSizeFit(nodes, node_bd):
return [new_x, new_y, new_w, new_h]



def bdSizeScale(node_bd, input_w, input_h, center):
'''Resize with manual input values
@node_bd: backdrop node (obj)
Expand Down Expand Up @@ -110,7 +217,6 @@ def bdSizeScale(node_bd, input_w, input_h, center):
return [new_x, new_y, new_w, new_h]



def resize(node, new_size):
'''Resize the Backdrop
@node: backdrop node to resize (obj)
Expand All @@ -119,74 +225,3 @@ def resize(node, new_size):
knobs = ['xpos', 'ypos', 'bdwidth', 'bdheight']
for k in knobs:
node[k].setValue(new_size[knobs.index(k)])




########## Main Function ##########




def BackdropResize():
'''main function'''

nodes = nuke.selectedNodes()

if len(nodes) <= 0:
nuke.message("Select some nodes goddamnit")
print "Abort"
elif len([b for b in nodes if b.Class() == 'BackdropNode']) <= 0:
nuke.message("Gotta include a Backdrop Node, man")
print "Abort"
else:

# Prompt
p=nuke.Panel("Resize %s" % bdFind(nodes).name())
p.addEnumerationPulldown('Mode', '"Fit to Selection" "Manual Scaling"')
# p.addBooleanCheckBox('Fit to Selection', True)
p.addButton('Cancel')
p.addButton('Resize!')

p.setWidth(len(p.title())*12)

if p.show():

mode_sel = p.value('Mode')

# Find Biggest Backdrop node to resize
node_bd = bdFind(nodes)

# Fit to Selection
if mode_sel == "Fit to Selection":

new_size = bdSizeFit(nodes, node_bd)

resize(node_bd, new_size)
print "%s Resized to Fit Selection" % node_bd.name()

# Manual Scaling
elif mode_sel == "Manual Scaling":

# Second Prompt
psub = nuke.Panel("Resize %s" % bdFind(nodes).name())
psub.addExpressionInput('Width',1) # average node width: 80
psub.addExpressionInput('Height',1) #average node height: 74
psub.addBooleanCheckBox('From Center', True)
psub.addButton('Cancel')
psub.addButton('Resize!')

psub.setWidth(len(p.title())*12)

if psub.show():

input_w = psub.value('Width')
input_h = psub.value('Height')
input_c = psub.value('From Center')

new_size = bdSizeScale(node_bd, input_w, input_h, input_c)

resize(node_bd, new_size)
print "%s Resized with input values" % node_bd.name()
else:
print "Operation Cancelled"
Loading

0 comments on commit 1ed6e88

Please sign in to comment.