本文整理匯總了Python中nukescripts.PythonPanel方法的典型用法代碼示例。如果您正苦於以下問題:Python nukescripts.PythonPanel方法的具體用法?Python nukescripts.PythonPanel怎麽用?Python nukescripts.PythonPanel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nukescripts
的用法示例。
在下文中一共展示了nukescripts.PythonPanel方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def __init__(self):
nukescripts.PythonPanel.__init__(self, 'Shotgun notes', 'mlavoy')
# CREATE KNOBS
#open page in shotgun
self.openShotgunButton= nuke.PyScript_Knob('openShotgun','openShotgun')
#button for getting notes
self.getNotesButton= nuke.PyScript_Knob('getNotes','getNotes')
#update shotgun note status
self.updateShotgunButton= nuke.PyScript_Knob('updateShotgun','updateShotgun')
# ADD KNOBS
self.addKnob(self.openShotgunButton)
self.addKnob(self.getNotesButton)
self.addKnob(self.updateShotgunButton)
self.addKnob(nuke.Text_Knob('Notes','Notes'))
self.notes=[]
self.checkKnobs={}
示例2: getAssets
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def getAssets():
selectedAssets=[]
class TestPanel(nukescripts.PythonPanel):
def __init__(self):
super(TestPanel,self).__init__('select assetGizmos to import' )
#list of assets
assets=os.listdir(assetGizmos)
assets.sort()
for asset in assets:
b=nuke.Boolean_Knob(asset)
b.setFlag(nuke.STARTLINE)
self.addKnob(b)
self._makeOkCancelButton()
p = TestPanel()
result=p.showModalDialog()
if result:
for k in p.knobs():
if p.knobs()[k].Class()=='Boolean_Knob':
if p.knobs()[k].value():
selectedAssets.append(k)
return selectedAssets
示例3: __init__
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def __init__( self ):
nukescripts.PythonPanel.__init__( self, 'Shot assembler', 'panel')
self.reel = nuke.String_Knob("REEL","REEL","REEL_01")
self.addKnob(self.reel)
self.seq = nuke.String_Knob("SEQ","SEQ","010")
self.addKnob(self.seq)
self.shot = nuke.String_Knob("SHOT","SHOT","010")
self.addKnob(self.shot)
self.push = nuke.PyScript_Knob("ASSEMBLE","ASSEMBLE")
self.addKnob(self.push)
示例4: ShowDialog
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def ShowDialog( self ):
return nukescripts.PythonPanel.showModalDialog( self )
示例5: __init__
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def __init__( self, nodes ):
nukescripts.PythonPanel.__init__( self, 'adjust all Knobs' )
if not nodes:
nuke.message('Nothing selected')
return
#GET KNOBS
commonKnobNames=nodes[0].knobs()
for n in nodes:
commonKnobNames=set(commonKnobNames).intersection(n.knobs())
commonKnobNames=set(commonKnobNames)
print commonKnobNames
commonKnobs=[]
for ck in commonKnobNames:
commonKnobs.append(nodes[0][ck])
#ADD KNOBS
availKnobs=[ 'ChannelMask_Knob','File_Knob', 'String_Knob', 'Int_Knob', 'Format_Knob', 'Tab_Knob', 'Script_Knob', 'PyScript_Knob', 'Text_Knob', 'WH_Knob', 'BBox_Knob', 'XYZ_Knob', 'Double_Knob', 'IArray_Knob', 'XY_Knob', 'Transform2d_Knob', 'MultiView_Knob', 'AColor_Knob', 'FrameExtentKnob', 'Menu_Knob', 'UV_Knob', 'Axis_Knob', 'Scale_Knob', 'MetaKeyFrame_Knob', 'RotoToolboxKnob', 'Radio_Knob', 'RotoKnob', 'Pulldown_Knob', 'LookupCurves_Knob', 'Color_Knob','Channel_Knob', 'Array_Knob', 'Boolean_Knob','GeoSelect_Knob', 'MultiArray_Knob','Multiline_Eval_String_Knob','Eval_String_Knob','Disable_Knob']
omit=['icon','knobChanged','name','xpos','ypos','dopesheet','selected','note_font_size','indicators','matrix']
exist=[]
for ak in availKnobs:
for knob in commonKnobs:
k=''
if knob.Class()==ak and not knob.name() in omit and knob.visible() and not knob.name() in exist:
methodToCall = getattr(nuke,ak)
k=methodToCall(knob.name(),knob.name())
k.setName(knob.name())
print knob.name(),knob.value()
k.setValue(knob.value())
#print k.name(),knob.Class()
if knob.Class()=='Enumeration_Knob' and not knob.name() in exist:
k=nuke.Enumeration_Knob(knob.name(),knob.name(),knob.values())
k.setName(knob.name())
k.setValue(knob.value())
if k:
print knob.name(),knob.Class()
self.addKnob(k)
k.setFlag(nuke.STARTLINE)
exist.append(knob.name())
示例6: checkMultiOverwrite
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def checkMultiOverwrite(file_names):
"""Asks the user if they want to overwrite an individual file, and supplies a "yes/no to all" box.
If one or fewer file names is supplied, the dialog is skipped entirely. Callers of this function
will still need to check for files that are not in this set in case the underlying file system
changes while the dialog is visible.
@rtype: (set(str), set(str))
@return: A set of the file names to overwrite, and a set of those to leave
@raise: CancelledError if the user cancelled the operation
"""
import nukescripts
class OverwritePanel(nukescripts.PythonPanel):
def __init__(self, file_names):
super(OverwritePanel, self).__init__()
self.text = nuke.Text_Knob('name', '', 'Overwrite files?')
self.all = nuke.Boolean_Knob('all', 'check/uncheck all', True)
self.all.setFlag(nuke.ENDLINE)
self.div = nuke.Text_Knob('divider', '')
self.file_knobs = []
for fname in file_names:
name = os.path.split(fname)[1]
fknob = nuke.Boolean_Knob(fname, name, True)
fknob.setFlag(nuke.ENDLINE)
self.file_knobs.append(fknob)
knobs = [self.text, self.all, self.div]
knobs.extend(self.file_knobs)
[self.addKnob(k) for k in knobs]
def knobChanged(self, knob):
if knob.name() == 'all':
val = knob.value()
[fknob.setValue(val) for fknob in self.file_knobs]
# Don't do anything if there are one or fewer files
if len(file_names) < 2:
return set(), set()
panel = OverwritePanel(file_names)
if not panel.showModalDialog():
raise CancelledError("Overwrite cancelled")
overwrites = set()
leaves = set()
for fknob in panel.file_knobs:
if fknob.value():
overwrites.add(fknob.name())
else:
leaves.add(fknob.name())
return overwrites, leaves
#-------------------------------------------------------------------------------
示例7: __init__
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def __init__(self, sequences):
nukescripts.PythonPanel.__init__(self, 'Batch Renamer')
self.seqs = sequences.values()
# Try to set our window size based on our contents
self.height = 270 + (len(self.seqs) * 40)
self.length = 400
for s in self.seqs:
if 130 + len(s) * 7 > self.length:
self.length = 130 + len(s) * 7
self.setMinimumSize(self.length, self.height)
# Create our header
self.addKnob(nuke.Text_Knob('break', ''))
self.addKnob(nuke.Text_Knob('header', 'Files to be modified:', ' '))
# Dynamically add our source filepath text
c = 1
for s in self.seqs:
self.addKnob(nuke.Text_Knob(str(c), '', s))
c += 1
# Create a string knob for our "Find" field
self.addKnob(nuke.Text_Knob('break', ''))
self.addKnob(nuke.String_Knob('find', 'Find this:', ''))
# Dynamically add our preview "Find" text
c = 1
self.original_finds = {}
for s in self.seqs:
self.addKnob(nuke.Text_Knob('previewFind%s' % c, '', os.path.basename(s)))
self.original_finds['previewFind%s' % c] = os.path.basename(s)
c += 1
# Create a string knob for our "Replace" field
self.addKnob(nuke.Text_Knob('break', '', ' '))
self.addKnob(nuke.String_Knob('replace', 'Replace with:', ''))
# Dynamically add our preview "Replace" text
c = 1
self.original_replaces = {}
for s in self.seqs:
self.addKnob(nuke.Text_Knob('previewReplace%s' % c, '', os.path.basename(s)))
self.original_replaces['previewReplace%s' % c] = os.path.basename(s)
c += 1
# Finally, create some dividers for the footer
self.addKnob(nuke.Text_Knob('break', ''))
self.addKnob(nuke.Text_Knob('break', '', ' '))
示例8: __init__
# 需要導入模塊: import nukescripts [as 別名]
# 或者: from nukescripts import PythonPanel [as 別名]
def __init__(self, fullFilePath, rename):
self.rename = rename
self.fullFilePath = fullFilePath
if rename == False:
self.namePanel = 'Create ToolSet'
self.nameOkButton = 'Create'
else:
self.namePanel = 'Rename ToolSet'
self.nameOkButton = 'Rename'
nukescripts.PythonPanel.__init__( self, self.namePanel, 'uk.co.thefoundry.Toolset')
# CREATE KNOBS
self.userFolders = []
fullPath = SHARED_TOOLSET_PATH
self.buildFolderList(fullPath, '')
self.menuItemChoice = nuke.CascadingEnumeration_Knob('menuItemChoice','SharedToolSets menu', ['root'] + self.userFolders )
self.menuItemChoice.setTooltip("The menu location that the ToolSet will appear in. Specify 'root' to place the SharedToolSets in the main SharedToolSets menu.")
self.menuPath = nuke.String_Knob('itemName', 'Menu item:')
self.menuPath.setFlag(0x00001000)
self.menuPath.setTooltip("ToolSet name. Use the '/' character to create a new submenu for this ToolSet, eg to create a ToolSet named 'Basic3D' and place it in a new submenu '3D', type '3D/Basic3D'. Once created the 3D menu will appear in the ToolSet menu.")
self.okButton = nuke.PyScript_Knob (self.nameOkButton.lower(), self.nameOkButton)
#self.okButton.setToolTip("Create a ToolSet from the currently selected nodes with the given name")
self.okButton.setFlag(0x00001000)
self.cancelButton = nuke.PyScript_Knob ('cancel', 'Cancel')
self.space = nuke.Text_Knob("space", "", "")
self.infoText = nuke.Text_Knob('infoText', '<span style="color:orange">/ - create submenus,</span>', '<span style="color:orange">example: newMenu/myNewToolSet</span>')
# ADD KNOBS
self.addKnob(self.menuItemChoice)
self.addKnob(self.menuPath)
self.addKnob(self.okButton)
self.addKnob(self.cancelButton)
self.addKnob(self.space)
self.addKnob(self.infoText)
if rename == True:
toolSetPath = fullFilePath.replace(SHARED_TOOLSET_PATH + "/", '')
toolSetPath = toolSetPath.replace(".nk", '')
self.menuPath.setValue(toolSetPath)
#COMMENT: BUILD A LIST Of PRE_CREATED FOLDER LOCATIONS