def __init__(self, sequence):
     nukescripts.PythonPanel.__init__(self, 'Batch Renamer')
     
     # Set our window width based on the filename length
     self.file = os.path.basename(sequence)
     self.setMinimumSize( len(self.file)*10+200, 200 )
     
     # Make some knobs!
     self.seq = sequence
     self.shot = nuke.Text_Knob('shot', 'Source: ', '<span style="color:orange">' + self.seq)
     self.div1 = nuke.Text_Knob('break', '')
     self.div2 = nuke.Text_Knob('break', '')
     self.blank1 = nuke.Text_Knob('break', '', ' ')
     self.blank2 = nuke.Text_Knob('break', '', ' ')
     self.find= nuke.String_Knob('find:', 'Find this:', '')
     self.previewFind = nuke.Text_Knob('previewFind', '', self.file)
     self.replace= nuke.String_Knob('replace', 'Replace with:', '')
     self.previewReplace = nuke.Text_Knob('previewReplace', '', self.file)
     
     # Add Knobs
     self.addKnob(self.shot)
     self.addKnob(self.div1)
     self.addKnob(self.find)
     self.addKnob(self.previewFind)
     self.addKnob(self.blank1)
     self.addKnob(self.replace)
     self.addKnob(self.previewReplace)
     self.addKnob(self.div2)
     self.addKnob(self.blank2)
示例#2
0
    def process(self, context, plugin):

        # Get the errored instances
        failed = []
        for result in context.data["results"]:
            if (result["error"] is not None and result["instance"] is not None
                    and result["instance"] not in failed):
                failed.append(result["instance"])

        # Apply pyblish.logic to get the instances for the plug-in.
        instances = pyblish.api.instances_by_plugin(failed, plugin)

        plugin = plugin()
        for instance in instances:

            node = instance[0]
            node.addKnob(nuke.Tab_Knob("Deadline"))

            knob = nuke.Int_Knob("deadlineChunkSize", "Chunk Size")
            knob.setValue(1)
            node.addKnob(knob)

            knob = nuke.Int_Knob("deadlinePriority", "Priority")
            knob.setValue(50)
            node.addKnob(knob)

            knob = nuke.String_Knob("deadlinePool", "Pool")
            node.addKnob(knob)

            knob = nuke.String_Knob("deadlineLimits", "Limits")
            node.addKnob(knob)

            knob = nuke.Int_Knob("deadlineConcurrentTasks", "Concurrent Tasks")
            knob.setValue(1)
            node.addKnob(knob)
示例#3
0
 def __init__(self):
     nukescripts.PythonPanel.__init__(self, 'C1 Login')
     # self.server = smtplib.SMTP('smtp.gmail.com', 587)
     self.status = 'offline'
     # self.server.starttls()
     self.email = None
     self.workingDir = None
     self.scriptDir = {
         'root':
         os.path.join(os.path.join(os.path.realpath(__file__), os.pardir),
                      os.pardir),
         'c1_tools':
         os.path.join(os.path.realpath(__file__), os.pardir)
     }
     #_define knobs
     self.inp_email = nuke.String_Knob('email', 'C1 Initials: ')
     self.inp_workingDir = nuke.String_Knob('workingDir',
                                            'Local Working Directory: ')
     self.btn_workingDir = nuke.PyScript_Knob("Set Working Dir")
     self.loginButton = nuke.PyScript_Knob("Login")
     self.cancelButton = nuke.PyScript_Knob("Cancel")
     #_add knobs
     self.addKnob(self.inp_workingDir)
     self.addKnob(self.btn_workingDir)
     self.addKnob(self.inp_email)
     self.addKnob(self.loginButton)
     self.addKnob(self.cancelButton)
     return
示例#4
0
 def __init__(self, node):
     nukescripts.PythonPanel.__init__(self, 'CustomUI')
     self.rpNode = node
     self.paragraph = nuke.String_Knob('paragraph', 'Paragraph', '4')
     self.write = nuke.String_Knob('write', 'Write', '1')
     self.thread = nuke.String_Knob('thread', 'Thread', '2')
     for k in (self.paragraph, self.write, self.thread):
         self.addKnob(k)
def L_newProject():

    p = nuke.Panel('KLXR NEW PROJECT')
    p.addSingleLineInput('Root', 'K:/_VFX/')
    p.addSingleLineInput('Project', 'L')
    p.addSingleLineInput('Shot', 'sh0100')
    p.addSingleLineInput('Task', 'comp')

    p.show()

    proot = p.value('Root')
    pproject = p.value('Project')
    pshot = p.value('Shot')
    ptask = p.value('Task')

    if proot == '':
        nuke.message('No Root')
        return
    if pproject == '':
        nuke.message('No Project')
        return
    if pshot == '':
        nuke.message('No Shot')
        return
    if ptask == '':
        nuke.message('No Task')
        return

    pfolder = proot + pproject + '/' + pshot + '/'

    pscripts = pfolder + 'scripts/'
    pscriptname = pscripts + pproject + '_' + pshot + '_' + ptask + '_v001.nk'

    if not os.path.isdir(pscripts):
        os.makedirs(pscripts)
    nuke.scriptSaveAs(pscriptname)

    write = nuke.createNode('Write', inpanel=False)

    pnode = nuke.nodes.NoOp(name="L_PROJECT")
    pnode.setXpos(write.xpos() + 300)
    pnode.setYpos(write.ypos() + 200)

    k = nuke.File_Knob("proot", "Root")
    k.setValue(proot)
    pnode.addKnob(k)

    k = nuke.String_Knob("pproject", "Project")
    k.setValue(pproject)
    pnode.addKnob(k)

    k = nuke.String_Knob("pshot", "Shot")
    k.setValue(pshot)
    pnode.addKnob(k)

    k = nuke.String_Knob("ptask", "Task")
    k.setValue(ptask)
    pnode.addKnob(k)
示例#6
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'ZGrade')

        layer_list = ["depth", "depth_extra", "rgba"]
        self.layers = nuke.Enumeration_Knob("layer", "Layers", layer_list)
        self.addKnob(self.layers)

        self.channels_ = ['red', 'green', 'blue', 'alpha']

        self.channel_list = nuke.Enumeration_Knob("channel", "",
                                                  self.channels_)
        self.channel_list.clearFlag(nuke.STARTLINE)
        self.channel_list.setVisible(False)
        self.addKnob(self.channel_list)

        self._viewers = {}
        for n in nuke.allNodes("Viewer", nuke.Root()):
            self._viewers[n.name()] = n
        self._specialRanges = ["input", "global", "custom"]

        self._rangeEnum = nuke.Enumeration_Knob(
            "frame_range", "Frame range",
            self._specialRanges + self._viewers.keys())
        self.addKnob(self._rangeEnum)

        self._frameRange = nuke.String_Knob('frame_range_sting', "",
                                            str(nuke.root().frameRange()))
        self._frameRange.clearFlag(nuke.STARTLINE)
        if self._rangeEnum.value() == "custom":
            self._frameRange.setValue(str(nuke.root().frameRange()))
        else:
            self._setFrameRangeFromSource(self._rangeEnum.value())
        self.addKnob(self._frameRange)

        self.depth_clamp = nuke.String_Knob('number,"inf"or"nan"',
                                            'Depth clamp', '1000000')
        self.addKnob(self.depth_clamp)

        self.warning = nuke.Text_Knob(
            'waring', '<span style="color:red">Not Numbers</span>')
        self.warning.clearFlag(nuke.STARTLINE)
        self.warning.setVisible(False)
        self.addKnob(self.warning)

        self.channels_name = ''
        self.channel_names()

        self.channel_num = 1

        self.frameranges = ''
        self.firstframe = ''
        self.lastframe = ''
        self.frame_ranges()

        self.depth_clamp_value = self.depth_clamp.value()

        self.warning_bool = True
        self.mark = False
示例#7
0
 def __init__(self, node):
     nukescripts.PythonPanel.__init__(self, 'CustomUI')
     self.rpNode = node
     self.paragraph = nuke.String_Knob('paragraph', 'Paragraph',
                                       '%s' % 5)
     self.memory = nuke.String_Knob('memory', 'Memory', '%s' % 4096)
     self.thread = nuke.String_Knob('thread', 'Thread', '2')
     for k in (self.paragraph, self.memory, self.thread):
         self.addKnob(k)
示例#8
0
    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)
示例#9
0
    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', '', ' '))
示例#10
0
def create_child(parent_node):

    parentName = parent_node.knob('name').value()
    parentLabel = parent_node.knob('parentLabel').value()
    parentXpos = parent_node.knob('xpos').value()
    parentYpos = parent_node.knob('ypos').value()

    childName = parentLabel + '_' + str(random.randint(0, 1000000))
    prevChildList = parent_node.knob('childList').value()
    newChildList = prevChildList + childName + '\n'
    parent_node.knob('childList').setValue(newChildList)

    nukescripts.clear_selection_recursive()
    child = nuke.createNode('NoOp', inpanel=False)
    child.setInput(0, nuke.toNode(parentName))
    nuke.toNode(child['name'].value()).setSelected(True)

    child['hide_input'].setValue(
        nuke.toNode(parentName).knob('hideInputTracker').value())
    child['note_font_size'].setValue(20.0)
    child['tile_color'].setValue(3511807)
    child['note_font'].setValue('Verdana Bold Bold Bold')
    child['xpos'].setValue(parentXpos)
    child['ypos'].setValue(parentYpos + 50)
    child['name'].setValue(childName)

    childTabKnob = nuke.Tab_Knob('postalChild', 'postal child')
    child.addKnob(childTabKnob)

    parentIDKnob = nuke.String_Knob('parentID', 'parent ID', parentName)
    child.addKnob(parentIDKnob)

    parentLabelKnob = nuke.String_Knob('parentLabel', 'parent label',
                                       parentLabel)
    child.addKnob(parentLabelKnob)

    CONNECT_TO_PARENT = """
import connect_to_parent
connect_to_parent.connect_to_parent(nuke.thisNode())
"""
    CONNECT_TO_PARENT_TOOLTIP = """
Reconnects this node to its parentID. This button must be pressed to add this child to parent's list of children
	"""
    connectToParentButton = nuke.PyScript_Knob('connectToParent',
                                               'connect to parent',
                                               CONNECT_TO_PARENT)
    connectToParentButton.setFlag(0x0000000000001000)
    connectToParentButton.setTooltip(CONNECT_TO_PARENT_TOOLTIP)
    child.addKnob(connectToParentButton)

    nukescripts.clear_selection_recursive()
    nuke.toNode(child['name'].value()).setSelected(True)
    child['autolabel'].setValue("nuke.thisNode().knob('parentLabel').value()")
    def __init__(self, historyFile='~/.nuke/srhistory.xml', maxSteps=10):
        '''
        Search and Replace panel
        args:
           historyFile  -  file to manage recent search&replace actions
           maxSteps  -  amount of steps to keep in history file
        '''
        nukescripts.PythonPanel.__init__(self, 'Search and Replace',
                                         'com.ohufx.SearchReplace')

        # VARS
        self.historyFile = os.path.expandvars(os.path.expanduser(historyFile))
        self.maxSteps = maxSteps
        self.delimiter = ' |>>| '
        # CREATE KNOBS
        self.nodesChoice = nuke.Enumeration_Knob('nodes', 'Source Nodes',
                                                 ['all', 'selected'])
        self.nodesChoice.setTooltip(
            'Chose to perform action on all nodes with file knobs or only selected ones'
        )
        self.history = nuke.Enumeration_Knob('history', 'Recent Searches',
                                             self.loadHistory())
        self.history.setTooltip(
            'Use the history to quicky access previous search&replace actions.\n By default the history file is stored as "~/.nuke/srhistory.xml" but this can be changed via the "historyFile" argument when creating the panel object. It is also possible to change the size of the history via the "maxSteps" argument to the panel object. Default is 10'
        )
        self.case = nuke.Boolean_Knob('case', 'case sensitive')
        self.case.setFlag(nuke.STARTLINE)
        self.case.setValue(True)
        self.case.setTooltip(
            'Set whether or not the search should be case sensitive')
        self.searchStr = nuke.String_Knob('searchStr', 'Search for:')
        self.searchStr.setTooltip('The text to search for')
        self.update = nuke.PyScript_Knob('update', 'Update')
        self.update.setTooltip(
            'update the search result and preview. This is automaticaly performed and usually should only be required when the node selection has canged'
        )
        self.replaceStr = nuke.String_Knob('replaceStr', 'Replace with:')
        self.replaceStr.setTooltip('Text to replace the found text with')
        self.replace = nuke.PyScript_Knob('replace', 'Replace')
        self.replace.setTooltip(
            'Perform replace action. The preview will update afterwards and the action is added to the history'
        )
        self.info = nuke.Multiline_Eval_String_Knob('info', 'Found')
        self.info.setEnabled(False)
        self.info.setTooltip(
            'See the search results and a preview of the replace action before it is performed'
        )
        # ADD KNOBS
        for k in (self.nodesChoice, self.history, self.case, self.searchStr,
                  self.update, self.replaceStr, self.replace, self.info):
            self.addKnob(k)
        self.matches = None
示例#12
0
    def __init__(self):
        PythonPanel.__init__(self, 'C1 Preferences')
        # C1 Preferences
        self.email = None
        self.localDir = None
        self.projectDir = None
        # custom regex definitions for validation engine
        self.regex = {}
        self.projectStructure = {'root': {}}
        self.scriptDir = {
            'root':
            os.path.join(os.path.join(os.path.realpath(__file__), os.pardir),
                         os.pardir),
            'c1_tools':
            os.path.join(os.path.realpath(__file__), os.pardir)
        }
        # define knobs
        self.inp_email = nuke.String_Knob('email', 'C1 Initials: ')
        self.inp_localDir = nuke.String_Knob('localDir',
                                             'Local Working Directory: ')
        self.btn_localDir = nuke.PyScript_Knob("Set Working Dir")
        self.loginButton = nuke.PyScript_Knob("Login")
        self.cancelButton = nuke.PyScript_Knob("Cancel")
        # Project Map Tab
        self.projectMapTab = nuke.Tab_Knob("Project Map")
        self.setProjectButton = nuke.File_Knob('projectDir',
                                               'Project Location')
        self.inp_projectLocation = nuke.String_Knob(
            'projectDir',
            '<b><font size="3" color="red">Remote Project Directory</font></b>'
        )
        self.inp_projectName = nuke.String_Knob('projectName', 'Project Name')
        self.inp_projectNum = nuke.Int_Knob('projectNum')
        # self.inp_projectNum.clearFlag( nuke.STARTLINE )
        self.inp_projectCode = nuke.String_Knob('projectCode', 'Project Code')
        self.inp_projectCode.clearFlag(nuke.STARTLINE)

        # add knobs
        self.addKnob(self.inp_localDir)
        self.addKnob(self.btn_localDir)
        self.addKnob(self.inp_email)
        self.addKnob(self.loginButton)
        self.addKnob(self.cancelButton)
        # Project Map Tab
        self.addKnob(self.projectMapTab)
        self.addKnob(self.setProjectButton)
        self.addKnob(self.inp_projectName)
        self.addKnob(self.inp_projectNum)
        self.addKnob(self.inp_projectCode)
        # retrieve previous login from login.txt
        self.retrieveLogin()
        return
示例#13
0
def writeNodeFields():
    n = nuke.thisNode()

    if not n.knob('Luke'):
        k = nuke.Tab_Knob("Luke", "Luke")
        n.addKnob(k)

        k = nuke.Boolean_Knob("pre", "Pre Render")
        n.addKnob(k)

        k = nuke.String_Knob("preLabel", "Pre Render Label")
        n.addKnob(k)

        k = nuke.String_Knob("versionOverride", "Render Version Override")
        n.addKnob(k)
示例#14
0
	def __init__(self):
		### Init the panel with a name
		nukescripts.PythonPanel.__init__(self, "hQueue Nuke render submission panel")
		### Gets the absolute file path for the currently open Nuke script, if nothing open then defaults to install directory
		self.absoluteFilePath = os.path.abspath(nuke.value("root.name"))
		### Setup a text box for the server address to be input into
		self.serverAddress = nuke.String_Knob('serverAddress', 'Server Address: ')
		self.addKnob(self.serverAddress)
		### Setup a button to test the server address which will reveal the Connection Successful text
		self.addressTest = nuke.PyScript_Knob("addressTest", "Test the server address", "")
		self.addKnob(self.addressTest)
		### Create addressSuccessFlag flag that is hidden until the server is successfully pinged
		self.addressSuccessFlag = nuke.Text_Knob('addressSuccessFlag', '', '<span style="color:green">Connection Successful</span>')
		self.addressSuccessFlag.setFlag(nuke.STARTLINE)
		self.addressSuccessFlag.setVisible(False)
		self.addKnob(self.addressSuccessFlag)
		### Get the filepath from self.absoluteFilePath and put it into a text box
		self.filePath = nuke.String_Knob('filePath', 'File Path: ', self.absoluteFilePath)
		self.addKnob(self.filePath)
		### Create a button that will test the file path for an nuke script
		self.filePathCheck = nuke.PyScript_Knob("filePathCheck", "Test the File Path", "")
		self.addKnob(self.filePathCheck)
		### Create pathSuccessFlag flag that is hidden until the file path is verified
		self.pathSuccessFlag = nuke.Text_Knob('pathSuccessFlag', '', '<span style="color:green">Connection Successful</span>')
		self.pathSuccessFlag.setFlag(nuke.STARTLINE)
		self.pathSuccessFlag.setVisible(False)
		self.addKnob(self.pathSuccessFlag)
		### Setup the get client list button, which will use hqrop functions
		self.clientGet = nuke.PyScript_Knob("clientGet", "Get client list", "")
		self.addKnob(self.clientGet)
		### Setup the get client groups button, which will use hqrop functions
		self.clientGroupGet = nuke.PyScript_Knob("clientGroupGet", "Get client groups", "")
		self.addKnob(self.clientGroupGet)
		### Setup a save client selection button, this hides the client list and itself
		self.clientSelect = nuke.PyScript_Knob("clientSelect", "Save client selection", "")
		self.clientSelect.setVisible(False)
		self.addKnob(self.clientSelect)
		### Setup a multiline client list that appears when clientGet is run
		self.clientList = nuke.Multiline_Eval_String_Knob('clientList', 'Client List: ')
		self.clientList.setFlag(nuke.STARTLINE)
		self.clientList.setVisible(False)
		self.addKnob(self.clientList)
		### Setup a frame range with the default frame range of the scene
		self.fRange = nuke.String_Knob('fRange', 'Track Range', '%s-%s' % (nuke.root().firstFrame(), nuke.root().lastFrame()))
		self.addKnob(self.fRange)
		
		### Set the minimum size of the python panel
		self.setMinimumSize(500, 600)
示例#15
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Snapshotr',
                                         'uk.co.thefoundry.ssPanel')

        if self.DEV > 0:
            print "\n* Debug mode ON"
            print "* rootDir inside ssPanel __init__ = " + self.rootDir
            print "* snapsDir inside ssPanel __init__ = " + self.snapsDir

        self.btn_snap_fullres = nuke.PyScript_Knob('Full')
        self.btn_snap_instant = nuke.PyScript_Knob('Instant')
        self.btn_open_webview = nuke.PyScript_Knob('Open')
        self.commentField = nuke.String_Knob('Comment:')
        self.divider = nuke.Text_Knob('')
        self.markNode = nuke.Boolean_Knob('Mark node ')
        self.timerValue = nuke.Int_Knob('Autosnap: ')

        self.addKnob(self.commentField)
        self.addKnob(self.btn_snap_instant)
        self.addKnob(self.btn_snap_fullres)
        self.addKnob(self.btn_open_webview)
        self.addKnob(self.timerValue)
        self.addKnob(self.divider)
        self.addKnob(self.markNode)
        self.timerValue.setValue(60)  # 60 minutes by default

        scriptPath = nuke.toNode('root').knob('name').value()
        scriptName = scriptPath.split("/")[-1]

        if cmn.check_script(name=scriptName) is None:
            nuke.message(
                "Please save your script in the following format:\nshot.task.artist.v00.00.nk"
            )
            raise BaseException

        def snapAutosave():
            """
            Create auto snapshot, start timer to trigger this (every 60min by default)
            """
            try:
                c_var = cmn.init_common_vars(snapsDir=self.snapsDir)
                print "\n~ autosaving snapshot..."
                cmn.create_snapshot_dirs(rootDir=self.rootDir,
                                         snapsDir=self.snapsDir,
                                         snapPath=c_var["snapPath"],
                                         markNode=self.markNode)
                cmn.create_snapshot_script(
                    scriptPath=c_var["scriptPath"],
                    snapScriptName=c_var["snapScriptName"],
                    upversion=False)
                cmn.create_snapshot_comment(
                    snapCommentFile=c_var["snapCommentFile"],
                    commentText="#autosnap")
                cmn.create_snapshot_screenshot(
                    DEV=self.DEV, snapImageFile=c_var["snapImageFile"])
            finally:
                timer = int(self.timerValue.value()) * 60000
                QtCore.QTimer.singleShot(timer, snapAutosave)

        snapAutosave()
示例#16
0
 def __init__(self):
     super(WatermarkControlPanel, self).__init__('Watermark Control')
     self.setMinimumSize(600, 260)
     self.sourceKnob = nuke.File_Knob('file', 'Open:')
     self.formatKnob = nuke.Format_Knob('format', 'Format:')
     self.outputKnob = nuke.File_Knob('file', 'Save:')
     self.addKnob(self.sourceKnob)
     self.addKnob(self.formatKnob)
     self.addKnob(self.outputKnob)
     self.formatKnob.setValue('HD_720')
     self.addSourceKnob = nuke.PyScript_Knob('add', 'Add')
     self.addKnob(self.addSourceKnob)
     self.watermarkType = nuke.Enumeration_Knob('type', 'Type:',
                                                ['Text', 'Image'])
     self.watermarkText = nuke.String_Knob('text', 'Text:')
     self.watermarkImage = nuke.File_Knob('image', 'Image:')
     self.watermarkNum = nuke.Enumeration_Knob(
         'num', 'Number:', ['1   ', '2   ', '3   ', '4   ', '6   ', '9   '])
     self.watermarkCreate = nuke.PyScript_Knob('create', 'Create')
     self.watermarkRotate = nuke.Double_Knob('rotate', 'Rotate:')
     self.watermarkScale = nuke.Double_Knob('scale', 'Scale:')
     self.watermarkOpacity = nuke.Double_Knob('opacity', 'Opacity:')
     self.watermarkRotate.setRange(-180, 180)
     self.watermarkOpacity.setDefaultValue([1, 1])
     self.watermarkScale.setRange(0.3, 1.5)
     self.watermarkScale.setDefaultValue([1, 1])
     self.addKnob(self.watermarkType)
     self.addKnob(self.watermarkText)
     self.addKnob(self.watermarkImage)
     self.addKnob(self.watermarkNum)
     self.addKnob(self.watermarkCreate)
     self.addKnob(self.watermarkRotate)
     self.addKnob(self.watermarkScale)
     self.addKnob(self.watermarkOpacity)
     self.controller = WatermarkController(self)
def addFrameioroottab():
    """Adds frame.io settings tab to the nukescript"""
    nukeroot = nuke.root()
    if not 'frameio' in nukeroot.knobs():
        nukeroot.addKnob( nuke.Tab_Knob('frameio' , 'frame.io') )
        nukeroot.addKnob( nuke.String_Knob('frameiousername' , 'Username') )
        nukeroot.addKnob( nuke.Enumeration_Knob('frameioproject' , 'Project' , [] ) )
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Watermark Utility',
                                         'dushyant.info.WatermarkUtility')

        # CREATE PANEL KNOBS
        self.nodesChoice = nuke.Enumeration_Knob('nodes', 'Source Nodes',
                                                 ['selected', 'all'])
        self.optChoice = nuke.Enumeration_Knob('opt_knob', 'Watermark type',
                                               ['text', 'image'])
        self.STRING_Knob = nuke.String_Knob('text', 'text')
        self.FILE_Knob = nuke.File_Knob('file', 'watermark file')
        self.Divider_Knob = nuke.Text_Knob("divName", "", "")
        self.Divider_Knob2 = nuke.Text_Knob("divName2", "", "")
        self.FILE_Knob2 = nuke.File_Knob('out_file', 'Output path')
        self.FILE_Knob2.setTooltip(
            'If this field is left blank, output path will be filled with source Read node\'s path with a directory named watermark on the same level, else this path will be used as the ROOT path for all outputs.'
        )

        self.run = nuke.PyScript_Knob('run', 'Run')
        # ADD PANEL KNOBS
        self.addKnob(self.nodesChoice)
        self.addKnob(self.optChoice)
        self.addKnob(self.STRING_Knob)
        self.addKnob(self.FILE_Knob)
        self.addKnob(self.Divider_Knob)
        self.addKnob(self.FILE_Knob2)

        self.addKnob(self.Divider_Knob2)

        self.addKnob(self.run)

        self.FILE_Knob.setEnabled(False)
示例#19
0
def DeepCollect(mode='collect'):
    '''collects or sets markers
	mode='collect': collects deep from markers
	mode='markers': sets markers
	'''

    if mode == 'collect':
        markers = getMarker()
        node_collector = nuke.nodes.DeepMerge(note_font='bold',
                                              hide_input=True)
        k_tab = nuke.Tab_Knob('tb_user', 'DeepCollector')
        k_text = nuke.Text_Knob(
            'tx_collector', 'Deeps Collected:',
            '\n'.join(['-' + n['tx_deepRead'].value() for n in markers]))
        k_text.setTooltip(
            '<b>Deeps Collected:</b>\n' +
            '\n'.join(['-' + n['tx_deepRead'].value()[:-8] for n in markers]))
        k_markers = nuke.String_Knob('tx_markers', 'DeepMarkers Collected',
                                     ','.join([m.name() for m in markers]))
        node_collector.addKnob(k_tab)
        node_collector.addKnob(k_text)
        node_collector.addKnob(k_markers)
        node_collector.setName('DeepCollector1')
        node_collector['autolabel'].setValue(
            "nuke.thisNode().name()+'\\ninputs: '+str(nuke.thisNode().inputs())"
        )
        node_collector.setXYpos(*nuke.center())

        for i, m in enumerate(markers):
            node_collector.setInput(i, m)

        print "Deep collected for %s" % node_collector.name()
    elif mode == 'markers':
        setMarkers()
示例#20
0
文件: menu.py 项目: Rotomator/noid
def write_addKnobs():
    node = nuke.thisNode()

    # tab
    batch = nuke.Tab_Knob("noid", "NOID")
    node.addKnob(batch)

    # auto
    lock = nuke.Boolean_Knob("lock", "Lock Filename")
    lock.setFlag(nuke.STARTLINE)
    node.addKnob(lock)

    # suffix
    suffix = nuke.String_Knob("suffix", "Suffix")
    suffix.setFlag(nuke.STARTLINE)
    node.addKnob(suffix)

    node.addKnob(nuke.Text_Knob("", ""))

    # batch
    batch = nuke.PyScript_Knob("batch", "Batch", "batch.batch()")
    batch.setFlag(nuke.STARTLINE)
    node.addKnob(batch)

    node['file'].setEnabled(False)
    node['lock'].setValue(1)
示例#21
0
    def __init__(self, node):
        self.n = node

        if not self.n.Class() in ('Tracker4', 'Tracker3','CornerPin2D'):
            nuke.message('The selected node is neither a Tracker or a Cornerpin.')
            return

        self._trackNames = self.getTrackNames(self.n)
        if not self._trackNames:
            nuke.message('No Tracks found in %s' %self.n.name())
            return

        nukescripts.PythonPanel.__init__(self, 'Export Tracks from %s' %self.n.name())

        self.fRange = nuke.String_Knob('fRange', 'Framerange: ', '%s-%s' %(nuke.root().firstFrame(), nuke.root().lastFrame()))

        self.trackEnum = []
        self.trackXY = []
        for i in range(len(self._trackNames)):
            if i > 3:
                break

            self.trackEnum.append(nuke.Enumeration_Knob('track%d' %i, 'Track %d' %(i + 1), self._trackNames))
            self.trackEnum[i].setValue(i)

            self.trackXY.append(nuke.XY_Knob('trackpos%d', ''))
            self.trackXY[i].setExpression('root.%s.tracks.%d.track_x' %(self.n.name(), i + 1), 0)
            self.trackXY[i].setExpression('root.%s.tracks.%d.track_y' %(self.n.name(), i + 1), 1)

        self.addKnob(self.fRange)
        for j, k in enumerate(self.trackEnum):
            self.addKnob(k)
            self.addKnob(self.trackXY[j])
示例#22
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self,"b_procedural_backdrop")

    #CREATE KNOBS
        self.note_size = nuke.Int_Knob("Note Size:")
        self.note_size.clearFlag(nuke.STARTLINE)
        self.frame_display = nuke.String_Knob("Label:")
        self.frame_display.clearFlag(nuke.STARTLINE)
        self.align = nuke.Enumeration_Knob("Align", "Align", ["left","center","right"])
        self.color = nuke.Enumeration_Knob("Color", "Color", ["green","pink","dark","yellow","grey","random"])        
        self.color.clearFlag(nuke.STARTLINE)
        self.axis = nuke.Enumeration_Knob("Axis", "Axis", ["horizontal","vertical"])
        self.multi = nuke.Text_Knob("Multi")
        self.axis.clearFlag(nuke.STARTLINE)    
        self.amount = nuke.Int_Knob("Amount:")
        self.note_size.clearFlag(nuke.STARTLINE)
        self.spacing = nuke.Int_Knob("Spacing:")
        self.spacing.clearFlag(nuke.STARTLINE)
        self.author = nuke.Text_Knob("by Boris Martinez")

    #SET DEFAULTS
        self.set_note_size_default_value()
        self.spacing_default_value()

    #ADD KNOBS
        for i in (self.note_size , self.frame_display,self.align,self.color,self.multi,self.amount,self.axis,self.spacing,self.author):
            self.addKnob(i)
示例#23
0
    def __init__(self, node):

        #get reference of tKey knob
        knob_names = nuke.animations()
        knob_name_with_suffix = knob_names[0]
        #print"knob_name_with_suffix "
        #print knob_name_with_suffix
        knob_name = getKnobName(knob_name_with_suffix)
        k = nuke.thisNode()[knob_name]

        #so that our default frame range can be the length of it's keyframes
        tFirst = first_keyframe_location(k)
        tLast = last_keyframe_location(k)

        nukescripts.PythonPanel.__init__(
            self, 'Reduce keyframes in selected animation?')

        # CREATE KNOBS
        self.tFrameRange = nuke.String_Knob('tFrameRange', 'Frame Range',
                                            '%s-%s' % (tFirst, tLast))
        self.tErrorPercent = nuke.Double_Knob('tErrorPercent',
                                              'Error threshold (%)')
        self.tErrorPercent.setValue(10)
        self.tErrorPercent.setRange(1, 100)

        self.pcText = nuke.Text_Knob('%')
        self.pcText.clearFlag(nuke.STARTLINE)

        # ADD KNOBS
        for k in (self.tFrameRange, self.tErrorPercent):
            self.addKnob(k)
示例#24
0
def save_dag_pos(preset):
    # Save current dag zoom and position as a preset on the active viewer
    zoom = nuke.zoom()
    pos = nuke.center()
    viewer = nuke.activeViewer()
    if not viewer:
        nuke.message(
            'Error: please create a viewer to store the dag positions on...')
        return
    else:
        viewer = viewer.node()
    if 'dagpos' not in viewer.knobs():
        viewer.addKnob(
            nuke.String_Knob(
                'dagpos', 'dagpos',
                '0,0,0:0,0,0:0,0,0:0,0,0:0,0,0:0,0,0:0,0,0:0,0,0:0,0,0:0,0,0'))
        dagpos_knob = viewer['dagpos']
        dagpos_knob.setFlag(nuke.STARTLINE)
        dagpos_knob.setEnabled(False)
    else:
        dagpos_knob = viewer['dagpos']
    dagpos_vals = dagpos_knob.getValue().split(':')
    dagpos_vals.pop(preset - 1)
    new_dagpos = ','.join([str(zoom), str(pos[0]), str(pos[1])])
    dagpos_vals.insert(preset - 1, new_dagpos)
    dagpos_knob.setValue(':'.join(dagpos_vals))
def RestoreHiddenInputs():

    all_hidden = [
        n.name() for n in nuke.allNodes()
        if n['hide_input'].value() == True and n.Class() is not 'Viewer'
    ]

    node_hidden = nuke.nodes.NoOp(name='HiddenInputs',
                                  hide_input=True,
                                  note_font_size=48,
                                  note_font='bold',
                                  note_font_color=4294967295,
                                  tile_color=4278190335)

    nuke.nodes.BackdropNode(tile_color=4278190335,
                            xpos=int(node_hidden.xpos() - 160),
                            ypos=int(node_hidden.ypos() - 60),
                            bdwidth=int(node_hidden.screenWidth() + 320),
                            bdheight=int(node_hidden.screenHeight() + 120))

    cmd_s = "import mod_RestoreHiddenInputs as rhi\nrhi.switch(nuke.thisNode())"
    cmd_u = "import mod_RestoreHiddenInputs as rhi\nrhi.upd(nuke.thisNode())"

    k_tab = nuke.Tab_Knob('tb_user', 'RestoreHiddenInputs')
    k_switch = nuke.PyScript_Knob('bt_switch', 'Hide/Show', cmd_s)
    k_upd = nuke.PyScript_Knob('bt_upd', 'Update Nodes', cmd_u)
    k_store = nuke.String_Knob('tx_store', 'Nodes:', ';'.join(all_hidden))

    k_upd.clearFlag(nuke.STARTLINE)

    node_hidden.addKnob(k_tab)
    node_hidden.addKnob(k_switch)
    node_hidden.addKnob(k_upd)
    node_hidden.addKnob(k_store)
示例#26
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Create ToolSet',
                                         'uk.co.thefoundry.CreateToolset')

        # CREATE KNOBS
        # Loop through and find all user folders
        self.userFolders = []
        for d in nuke.pluginPath():
            if os.path.isdir(d):
                if ".nuke" in d:
                    dircontents = os.listdir(d)
                    if "ToolSets" in dircontents:
                        fullPath = os.path.join(d, "ToolSets")
                        self.buildFolderList(fullPath, '')

        self.menuItemChoice = nuke.CascadingEnumeration_Knob(
            'menuItemChoice', 'ToolSets menu', ['root'] + self.userFolders)
        self.menuItemChoice.setTooltip(
            "The menu location that the ToolSet will appear in. Specify 'root' to place the ToolSet in the main ToolSets 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('create', 'Create')
        #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')

        # ADD KNOBS
        self.addKnob(self.menuItemChoice)
        self.addKnob(self.menuPath)
        self.addKnob(self.okButton)
        self.addKnob(self.cancelButton)
示例#27
0
def KuWrite():
    '''Adding inputs for auto generate output path'''

    node = nuke.createNode('Write')
    node.setName('KuWrite')
    node.knob('file').setEnabled(False)

    k_pipeline = nuke.Text_Knob('kupipeline', 'kuWrite',
                                'kuWrite')  # Ku Pipeline Identifier

    k_tab = nuke.Tab_Knob('tb_KuWrite', 'KuWrite')
    k_title = nuke.Text_Knob('tx_title', '', '<h1><br>KuWrite</h1>')
    k_show = nuke.Text_Knob('tx_show', '<h3>show</h3>',
                            slate.SHOW_CONFIG['kp_show'])
    k_shot = nuke.Text_Knob('tx_shot', '<h3>shot</h3>',
                            slate.SHOT_CONFIG['kp_shot'])
    k_type = nuke.Enumeration_Knob('mu_type', '<h3>type</h3>', RENDER_TYPE)
    k_elements = nuke.String_Knob('tx_passname', '_', 'NewPass')
    k_ver = nuke.Enumeration_Knob('mu_ver', '<h3>version</h3>', [' '])
    k_latest = nuke.Text_Knob('tx_versionLabel', '',
                              VERSION_LABEL['new_version'])
    k_div_title = nuke.Text_Knob('divider', '')
    k_div = nuke.Text_Knob('divider', ' ')
    k_set = nuke.PyScript_Knob('bt_set', '<b>&#11118; Check Versions</b>',
                               'mod_KuWrite.set_write(nuke.thisNode())')
    k_render = nuke.PyScript_Knob('bt_render', '<b>Render</b>',
                                  'mod_KuWrite.render_node(nuke.thisNode())')
    k_scriptcopy = nuke.String_Knob('tx_scriptcopy', 'scriptcopy dir', '')

    k_elements.clearFlag(nuke.STARTLINE)
    k_elements.setVisible(False)
    k_set.setFlag(nuke.STARTLINE)
    k_latest.clearFlag(nuke.STARTLINE)
    k_render.clearFlag(nuke.STARTLINE)
    k_pipeline.setVisible(False)
    k_scriptcopy.setVisible(False)

    for k in [
            k_tab, k_pipeline, k_title, k_div_title, k_show, k_shot, k_type,
            k_elements, k_ver, k_latest, k_div, k_set, k_render, k_scriptcopy
    ]:
        node.addKnob(k)

    mod = os.path.basename(__file__).split('.')[0]
    node['knobChanged'].setValue('%s.onChange()' % mod)

    set_write(node)
示例#28
0
def get_user_name():
    root_knobs = [knob.name() for knob in nuke.root().allKnobs()]

    if not 'user' in root_knobs:
        user_knob = nuke.String_Knob('user')
        nuke.root().addKnob(user_knob)

    return nuke.root()['user'].value()
示例#29
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, "GQ_Tools")

        ## KNOBS ##
        # Node Disable #
        self.classInput = nuke.String_Knob("classInput", "Type")
        self.classSelect = nuke.PyScript_Knob('classSelect', 'Select Type')

        self.enableAll = nuke.PyScript_Knob("enableAll", "Enable All")
        self.enableAll.setFlag(nuke.STARTLINE)

        self.disableHeavy = nuke.PyScript_Knob("disableHeavy", "Disable Heavy")

        self.disableDivider = nuke.Text_Knob("")

        # Read Properties #
        self.readBefore = nuke.Enumeration_Knob(
            'readBefore', "Before", ['hold', "loop", "bounce", "black"])
        self.readAfter = nuke.Enumeration_Knob(
            'readAfter', "Before", ['hold', "loop", "bounce", "black"])
        self.readAfter.clearFlag(nuke.STARTLINE)

        self.setBeforeAfter = nuke.PyScript_Knob("setBeforeAfter",
                                                 "Set Before + After")

        self.readStart = nuke.Int_Knob('readStart', "Start", 100)
        self.readEnd = nuke.Int_Knob('readEnd', "End", 200)
        self.readEnd.clearFlag(nuke.STARTLINE)

        self.setStartEnd = nuke.PyScript_Knob("setStartEnd", "Set Start + End")

        self.startAt = nuke.Int_Knob('startAt', "Start At")
        self.setStartAt = nuke.PyScript_Knob("setStartAt", "Set Start At")

        self.readDivider = nuke.Text_Knob("")

        ## LAYOUT ##
        # Node Disable #
        self.addKnob(self.classInput)
        self.addKnob(self.classSelect)
        self.addKnob(self.enableAll)
        self.addKnob(self.disableHeavy)

        self.addKnob(self.disableDivider)

        # Read Properties #
        self.addKnob(self.readBefore)
        self.addKnob(self.readAfter)
        self.addKnob(self.setBeforeAfter)

        self.addKnob(self.readStart)
        self.addKnob(self.readEnd)
        self.addKnob(self.setStartEnd)
        self.addKnob(self.startAt)
        self.addKnob(self.setStartAt)

        self.readStart.setValue(int(nuke.Root()['first_frame'].getValue()))
        self.readEnd.setValue(int(nuke.Root()['last_frame'].getValue()))
示例#30
0
    def __init__(self):
        '''RV Render UI'''
        log("RvRenderPanel init")
        nukescripts.PythonPanel.__init__(self, 'RvRenderPanel',
                                         'com.tweaksoftware.RenderPanel')

        self.outputNode = nuke.String_Knob('outputNode', 'Output Node')
        self.outputNode.setValue("")
        self.addKnob(self.outputNode)

        self.useSelected = nuke.Boolean_Knob('useSelected', 'Use Selected')
        self.useSelected.setValue(True)
        self.addKnob(self.useSelected)

        minFrame = nuke.root().knob('first_frame').value()
        maxFrame = nuke.root().knob('last_frame').value()
        log("    minf %d maxf %d" % (minFrame, maxFrame))

        n = nuke.toNode(self.outputNode.value())
        log("    n %s" % n)
        if (n):
            minFrame = n.firstFrame()
            maxFrame = n.lastFrame()

        log("    minf %d maxf %d" % (minFrame, maxFrame))
        # self.startFrame = nuke.Int_Knob ('firstFrame', '<img src=":qrc/images/FrameRangeLock.png">', self.__getRange() )
        self.firstFrame = nuke.Int_Knob('firstFrame', 'First Frame')
        self.firstFrame.setTooltip('First frame of range to render')
        self.firstFrame.setValue(int(minFrame))
        self.addKnob(self.firstFrame)

        self.lastFrame = nuke.Int_Knob('lastFrame', 'Last Frame')
        self.lastFrame.setTooltip('Last frame of range to render')
        self.lastFrame.setValue(int(maxFrame))
        self.lastFrame.clearFlag(nuke.STARTLINE)
        self.addKnob(self.lastFrame)

        #    Don't understand this, but nuke on windows complains if this knob is not present
        #
        self.frameRange = nuke.String_Knob('range', 'range')
        self.frameRange.setVisible(False)
        self.addKnob(self.frameRange)

        self.updateFromRoot()
        self.updateFromSelection()