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)
Exemple #2
0
    def __init__(self, sg_version_name):
        super(CommentsPanel, self).__init__("Shotgun: Quick Dailies")

        self.addKnob(
            nuke.Text_Knob(
                "info1", "",
                "This will render a quicktime and send it to Shotgun for review."
            ))

        self.addKnob(nuke.Text_Knob("div1", ""))

        self.addKnob(
            nuke.Text_Knob("info1", "<b>Shotgun Name:</b>",
                           "%s" % sg_version_name))

        self.addKnob(nuke.Text_Knob("div1", ""))
        self._comments = nuke.Multiline_Eval_String_Knob(
            "comment", "<b>Comments:</b>", "")
        self.addKnob(self._comments)

        self.addKnob(nuke.Text_Knob("div1", ""))

        # finally some buttons
        self.okButton = nuke.Script_Knob("Create Daily")
        self.addKnob(self.okButton)
        self.cancelButton = nuke.Script_Knob("Cancel")
        self.addKnob(self.cancelButton)
    def __init__(self):
        """
        Adding knobs to UI panel.
        """
        nukescripts.PythonPanel.__init__(self, "Shuffle EXR Passes", "com.parimalvfx.ShufflePassesPanel")

        self.node = nuke.selectedNode()
        self.nodeLayers = find_node_layers(self.node)
        self.layerKnobs = []

        for layer in self.nodeLayers:
            self.layer = nuke.Boolean_Knob(layer, layer, True)
            self.layer.setFlag(nuke.STARTLINE)
            self.addKnob(self.layer)
            self.layerKnobs.append(self.layer)
            if layer == "rgba":
                self.layer.setValue(False)

        self.div1 = nuke.Text_Knob("div1", " ", "")
        self.all = nuke.PyScript_Knob("select_all", " Select All ")
        self.invert = nuke.PyScript_Knob("invert_selection", " Invert Selection ")
        self.clear = nuke.PyScript_Knob("clear_selection", " Clear Selection ")
        self.div2 = nuke.Text_Knob("div2", " ", "")

        height = 125 + len(self.layerKnobs) * 20
        width = 330
        if height > 700:
            width = 350
            height = 700
        self.setMinimumSize(width, height)
        self.setMaximumSize(500, 900)

        for each in (self.div1, self.all, self.invert, self.clear, self.div2):
            self.addKnob(each)
Exemple #4
0
def initOFXhdrPlugin():
    n = nuke.thisNode()
    mdTab = nuke.Tab_Knob('MetaData', 'MetaData')
    mdBtn = nuke.PyScript_Knob('metadata', 'Retrieve MetaData')
    mdDivCamera = nuke.Text_Knob('md_div_camera', 'Camera', '')
    mdCamera = nuke.Text_Knob('md_camera', '', ' ')
    mdDivExif = nuke.Text_Knob('md_div_exif', 'Exif Tags', '')
    mdIso = nuke.Multiline_Eval_String_Knob(
        'md_iso', 'ISO', 'raw/image/iso_speed\nexif/2/ISOSpeedRatings')
    mdAp = nuke.Multiline_Eval_String_Knob(
        'md_ap', 'Aperture',
        'raw/image/aperture\ninput/fnumber\nexif/2/FNumber\nexif/2/ApertureValue'
    )
    mdSh = nuke.Multiline_Eval_String_Knob(
        'md_sh', 'Shutter',
        'raw/image/shutter_speed\ninput/exposure_time\nexif/2/ExposureTime')

    n.addKnob(mdTab)
    n.addKnob(mdBtn)
    n.addKnob(mdDivCamera)
    n.addKnob(mdCamera)
    n.addKnob(mdDivExif)
    n.addKnob(mdIso)
    n.addKnob(mdAp)
    n.addKnob(mdSh)

    mdBtn.setValue('metaDataAction()')
Exemple #5
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)
Exemple #6
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'DiskCache',
                                         'uk.co.thefoundry.DiskCache')

        # CREATE KNOBS
        self.diskCachePrefText = nuke.Text_Knob('disk_cache_pref_GB',
                                                'Disk cache limit:')
        self.addKnob(self.diskCachePrefText)
        self.diskCachePrefText.setValue('?GB')
        self.diskCachePercUsed = nuke.Double_Knob('disk_cache_pref_GB',
                                                  '% used:')
        self.addKnob(self.diskCachePercUsed)
        self.diskCachePercUsed.setValue(50)
        self.diskCachePercUsed.setRange(0, 100)
        self.diskCachePercUsed.setEnabled(False)

        totalCacheGB = nuke.toNode('preferences').knob('diskCacheGB').value()

        self.diskCachePrefText.setValue(str(totalCacheGB) + 'GB')

        # Check if Major Version is 6 or later...
        if nuke.env['NukeVersionMajor'] >= 6:
            self.paintCachePrefText = nuke.Text_Knob('paint_cache_pref_GB',
                                                     'Paint cache limit:')
            self.addKnob(self.paintCachePrefText)
            self.paintCachePrefText.setValue('?GB')
            self.paintCachePercUsed = nuke.Double_Knob('paint_cache_pref_GB',
                                                       '% used:')
            self.addKnob(self.paintCachePercUsed)
            self.paintCachePercUsed.setValue(50)
            self.paintCachePercUsed.setRange(0, 100)
            self.paintCachePercUsed.setEnabled(False)
            self.paintCachePercUsed.setFlag(0x00002000)

            paintCacheGB = nuke.toNode('preferences').knob(
                'PaintCacheGB').value()
            self.paintCachePrefText.setValue(str(paintCacheGB) + 'GB')

        # Update Cache usage button
        self.updateButton = nuke.Script_Knob('update', 'Update')
        self.addKnob(self.updateButton)

        # Clear DiskCacheButton
        self.clearCacheButton = nuke.Script_Knob('clearCache',
                                                 'Clear Disk Cache')
        self.addKnob(self.clearCacheButton)

        self.addKnob(nuke.Text_Knob('', ''))

        # Clear Buffer Button
        self.clearBuffers = nuke.Script_Knob('clearBuffers', 'Clear Buffers')
        self.addKnob(self.clearBuffers)

        self.bufferReport = nuke.nuke.Multiline_Eval_String_Knob(
            "bufferReport", "Buffer Report")
        self.addKnob(self.bufferReport)
        self.bufferReport.setValue(str(nukescripts.cache_report(str())))

        # Initially populate the Sliders...
        updateSliders(self)
Exemple #7
0
    def __init__(self):

        nukescripts.PythonPanel.__init__(self, "error report", "error report")

        if nuke.errors_lenErrors == 0:
            col = "green"
        else:
            col = "red"
        countErrors = '<span style="color:{col}">{countErr}</span>'.format(
            col=col, countErr=nuke.errors_lenErrors)
        #create elements
        self.errorCount = nuke.Text_Knob('', 'errors found: ',
                                         '%s' % countErrors)
        self.div = nuke.Text_Knob("", "", "")
        self.errorCount.setFlag(nuke.STARTLINE)
        self.outputPath = nuke.File_Knob('output to: ', '')
        self.write = nuke.PyScript_Knob('write', 'write')
        self.update = nuke.PyScript_Knob('update', 'update')
        self.outputPath = nuke.File_Knob('', 'outputPath')
        #add elements
        self.addKnob(self.errorCount)
        self.addKnob(self.outputPath)
        self.addKnob(self.write)
        self.addKnob(self.update)
        self.addKnob(self.div)
        #error node knobs
        for errorNode in nuke.errors_nodes:
            self.en = nuke.PyScript_Knob(errorNode.name(), errorNode.name())
            self.addKnob(self.en)
            nuke.errors_footageBtn.append(self.en)
Exemple #8
0
def tool_ver_tag():
    toolNodes = []
    for node in nuke.selectedNodes():
        toolNodes.append(node)

    k_dict = {}

    from datetime import date
    k_dict['l_DATE'] = date.today()

    try:
        k_dict['l_VERSION'] = toolNodes[0]['l_VERSION'].value()
        k_dict['btn_CHANGELOG'] = re.split(
            'log = "|"', toolNodes[0]['btn_CHANGELOG'].value())[1].replace(
                '<br>', '\n').replace('&nbsp;', ' ')
        k_dict['l_DEV'] = toolNodes[0]['l_DEV'].value()
    except NameError:
        k_dict['l_VERSION'] = ''
        k_dict['btn_CHANGELOG'] = ''
        k_dict['l_DEV'] = ''

    p = nuke.Panel('Version Tag')
    p.addSingleLineInput('Version', k_dict['l_VERSION'])
    p.addSingleLineInput('Date Modified', k_dict['l_DATE'])
    p.addMultilineTextInput('Changelog', k_dict['btn_CHANGELOG'])
    p.addSingleLineInput('Developed by', k_dict['l_DEV'])
    p.setWidth(700)

    if p.show() == 1:
        new_ver = p.value('Version')
        new_date = p.value('Date Modified')
        new_clog = p.value('Changelog')
        new_dev = p.value('Developed by')

        if new_clog.find('\n') > 0:
            new_clog = new_clog.replace(' ', '&nbsp;')
        new_clog = new_clog.replace('\n', '<br>').replace('\"', '\'')

        for toolNode in toolNodes:
            try:
                toolNode['l_VERSION'].setValue(new_ver)
                toolNode['l_DATE'].setValue(new_date)
                toolNode['btn_CHANGELOG'].setValue(
                    'log = "{0}"\nnuke.message( log )'.format(new_clog))
                toolNode['l_DEV'].setValue(new_dev)
            except NameError:
                make_tag = nuke.Tab_Knob('t_VERSION', 'Version')
                make_ver = nuke.Text_Knob('l_VERSION', 'Version', new_ver)
                make_date = nuke.Text_Knob('l_DATE', 'Date Modified', new_date)
                make_clog = nuke.PyScript_Knob(
                    'btn_CHANGELOG', 'Changelog',
                    'log = "{0}"\nnuke.message( log )'.format(new_clog))
                make_dev = nuke.Text_Knob('l_DEV', 'Developed by', new_dev)
                toolNode.addKnob(make_tag)
                toolNode.addKnob(make_ver)
                toolNode.addKnob(make_date)
                toolNode.addKnob(make_clog)
                toolNode.addKnob(make_dev)
                toolNode['btn_CHANGELOG'].setFlag(0x0000000000001000)
Exemple #9
0
def _add_sync_knobs(viewer):
    """Adds the sync option knobs to the given given viewer node.

    If this gets called on a node that already has viewerSync knobs, those
    knobs will sync instead of being added again.

    Args:
        viewer : (<nuke.nodes.Viewer>)
            The Viewer node to add viewerSync knobs to.

    Returns:
        None

    Raises:
        N/A

    """
    if 'vs_options' in viewer.knobs():
        # This node already has a settings pane- we'll reset the settings to
        # default.
        for knob in SYNC_DEFAULTS:
            viewer['vs_' + knob].setValue(SYNC_DEFAULTS[knob])
        return

    tab = nuke.Tab_Knob('vs_options', 'Viewer Sync')
    viewer.addKnob(tab)

    def add_knobs(knob_list):
        """For every knob in the list, adds that knob to the current tab"""
        for knob in knob_list:
            new_knob = nuke.Boolean_Knob('vs_' + knob, KNOB_TITLES[knob])
            new_knob.setTooltip(KNOB_TOOLTIPS[knob])
            new_knob.setValue(SYNC_DEFAULTS[knob])
            new_knob.setFlag(nuke.STARTLINE)
            viewer.addKnob(new_knob)

    input_options = nuke.Text_Knob('vs_input_options', 'Input Options')
    viewer.addKnob(input_options)
    add_knobs(['inputs', 'input_number', 'channels'])

    display_options = nuke.Text_Knob('vs_display_options', 'Display Options')
    viewer.addKnob(display_options)
    add_knobs([
        'viewerProcess', 'rgb_only', 'input_process', 'input_process_node',
        'viewerInputOrder', 'gain', 'gamma', 'ignore_pixel_aspect',
        'zoom_lock', 'show_overscan', 'overscan'
    ])

    overlay_options = nuke.Text_Knob('vs_overlay_options', 'Overlay Options')
    viewer.addKnob(overlay_options)
    add_knobs([
        'masking_mode', 'masking_ratio', 'safe_zone', 'format_center',
        'cliptest'
    ])

    process_options = nuke.Text_Knob('vs_process_options',
                                     'Processing Options')
    viewer.addKnob(process_options)
    add_knobs(['downrez', 'roi'])
    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()))
Exemple #11
0
	def __init__( self ):
        
		nukescripts.PythonPanel.__init__(self, "PluginManager", "PluginManager")       
        
		scripts.reverse()

		#plugins
		for script in scripts:
			self.sc = nuke.Boolean_Knob(script, script ,"1") 
			self.sc.setFlag(nuke.STARTLINE)
			self.addKnob(self.sc)
			nuke.pluginList.append(self.sc)
		
		#other knobs
		self.div=nuke.Text_Knob("","","")
		self.div.setFlag(nuke.STARTLINE)
		self.div2=nuke.Text_Knob("","","")
		self.div2.setFlag(nuke.STARTLINE)
		self.div3=nuke.Text_Knob("","","")
		self.div3.setFlag(nuke.STARTLINE)
		self.selectDeselectAll = nuke.Script_Knob("select/deselect all", "select/deselect all")
		self.openPrefDir = nuke.Script_Knob("open pref dir", "open pref dir")
		self.openScriptsDir = nuke.Script_Knob("open scripts dir", "open scripts dir")
		self.loadSave = nuke.Script_Knob("loadSave", "load/save")
		self.update = nuke.Script_Knob("update", "<span style='color:green'>update<span>")
		#add other knobs
		self.addKnob(self.div)
		self.addKnob(self.selectDeselectAll)
		self.addKnob(self.openPrefDir)
		self.addKnob(self.openScriptsDir)
		self.addKnob(self.loadSave)
		self.addKnob(self.update)
		self.addKnob(self.div2)

		#deselect excluded knobs
		excludeList = openFileReturnArr(currentPref)
		for pl in nuke.pluginList:
			if pl.name() in excludeList:
				pl.setValue(0)

		#prefs
		self.prefsName = nuke.String_Knob('name', '')
		self.prefsName.setFlag(nuke.STARTLINE)
		self.savePrefs = nuke.Script_Knob("save list", "save list")
		self.deletePrefs = nuke.Script_Knob("delete list", "delete list")
        
		#prefsBtn
		i=0
		for p in prefs:
			self.pknob = nuke.Script_Knob(p,p)
			if i%5==0:
				self.pknob.setFlag(nuke.STARTLINE)
			prefsBtn.append(self.pknob)
			i+=1
    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)
Exemple #13
0
    def __init__(self, prefix=('PuzzleMatte', 'ID'), node=None):
        def _pannel_order(name):
            return (
                name.endswith('.alpha'),
                name.startswith(prefix),
                name.split('.')[0],
                name.endswith('.blue'),
                name.endswith('.green'),
                name.endswith('.red'),
            )

        def _stylize(text):
            ret = text
            repl = {'.red': '.<span style=\"color:#FF4444\">red</span>',
                    '.green':  '.<span style=\"color:#44FF44\">green</span>',
                    '.blue': '.<span style=\"color:#4444FF\">blue</span>'}
            for k, v in repl.iteritems():
                ret = ret.replace(k, v)
            return ret

        super(ChannelsRename, self).__init__(b'重命名通道', self.widget_id)

        viewer = CurrentViewer()
        n = node or nuke.selectedNode()
        self._channels = sorted((channel for channel in n.channels()
                                 if channel.startswith(prefix)),
                                key=_pannel_order) + ['rgba.alpha']
        self._node = n
        self._viewer = viewer

        nuke.Undo.disable()

        n = nuke.nodes.LayerContactSheet(inputs=[n], showLayerNames=1)
        self._layercontactsheet = n

        viewer.link(n)
        viewer.node['channels'].setValue('rgba')

        for channel in self._channels:
            self.addKnob(nuke.String_Knob(
                channel, _stylize(channel), ''))
            if channel.endswith('.blue'):
                self.addKnob(nuke.Text_Knob(''))
        self.addKnob(nuke.Text_Knob(''))
        k = nuke.Script_Knob('ok', 'OK')
        k.setFlag(nuke.STARTLINE)
        self.addKnob(k)
        k = nuke.Script_Knob('cancel', 'Cancel')
        self.addKnob(k)

        nuke.Undo.enable()

        self.add_callbacks()
Exemple #14
0
    def showModalDialog(self, parser):
        """Called to display the dialogue to the user."""

        self.parser = parser

        self.cdlcorrectionid = nuke.Enumeration_Knob(
            "cdlcorrectionid", "ID",
            sorted(self.parser.cdlcorrectionvalues.keys()))
        self.addKnob(self.cdlcorrectionid)

        self.dividerone = nuke.Text_Knob("dividerone", "")
        self.addKnob(self.dividerone)

        self.cdlcorrectiondesc = nuke.Multiline_Eval_String_Knob(
            "cdlcorrectiondesc", "Description", "")
        self.addKnob(self.cdlcorrectiondesc)
        self.cdlcorrectiondesc.setFlag(nuke.DISABLED)

        self.dividertwo = nuke.Text_Knob("dividertwo", "")
        self.addKnob(self.dividertwo)

        self.extrefsearchpath = nuke.Enumeration_Knob("extrefsearchpath", "Ref Search", \
                                    ["Same Name, Same Dir", "Any Name, Same Dir", "Specified"])
        self.addKnob(self.extrefsearchpath)

        self.extrefpath = nuke.File_Knob("extrefpath", "Ref Path")
        self.addKnob(self.extrefpath)

        self.dividerthree = nuke.Text_Knob("dividerthree", "")
        self.addKnob(self.dividerthree)

        self.cdloffset = nuke.Color_Knob("cdloffset", "Offset")
        self.addKnob(self.cdloffset)
        self.cdloffset.setFlag(nuke.DISABLED)

        self.cdlslope = nuke.Color_Knob("cdlslope", "Slope")
        self.addKnob(self.cdlslope)
        self.cdlslope.setFlag(nuke.DISABLED)

        self.cdlpower = nuke.Color_Knob("cdlpower", "Power")
        self.addKnob(self.cdlpower)
        self.cdlpower.setFlag(nuke.DISABLED)

        self.cdlsaturation = nuke.Double_Knob("cdlsaturation", "Saturation")
        self.addKnob(self.cdlsaturation)
        self.cdlsaturation.setFlag(nuke.DISABLED)

        self.dividerfour = nuke.Text_Knob("dividerfour", "")
        self.addKnob(self.dividerfour)

        self.updateDesc()
        return nukescripts.PythonPanel.showModalDialog(
            self), self.cdlcorrectionid.value()
    def __init__(self):
        '''
            init values
            '''
        global uniqueLayers
        global layerCheckboxes
        global panelHeight

        panelHeight = 160

        nukescripts.PythonPanel.__init__(self, "MultichannelSplit",
                                         "MultiChannelSplit")
        self.setMinimumSize(450, panelHeight)

        self.autoCrop = nuke.Boolean_Knob("autoCrop", "autocrop", 0.0)
        self.autoCrop.setFlag(nuke.STARTLINE)
        self.prepareForOutput = nuke.Boolean_Knob("prepareForOutput",
                                                  "prepare for output", 0.0)
        self.prepareForOutput.setFlag(nuke.STARTLINE)
        self.outputPath = nuke.File_Knob('outputPath', 'output path')
        self.outputPath.setVisible(False)
        self.div = nuke.Text_Knob("", "", "")
        self.which = nuke.Enumeration_Knob("which", "",
                                           ["all AOVs", "individual AOVs"])
        self.addKnob(self.autoCrop)
        self.addKnob(self.prepareForOutput)
        self.addKnob(self.outputPath)
        self.addKnob(self.div)
        self.addKnob(self.which)

        # Layer checkboxes
        uniqueLayers = getUniqueChannelLayerList(nuke.selectedNode())
        layerCheckboxes = []
        self.allLayer = nuke.Script_Knob("allLayer", "select all")
        self.allLayer.setVisible(False)
        self.noLayer = nuke.Script_Knob("noLayer", "deselect all")
        self.noLayer.setVisible(False)
        self.div2 = nuke.Text_Knob("", "available AOVs", "")
        self.div2.setVisible(False)
        self.addKnob(self.div2)
        self.addKnob(self.allLayer)
        self.addKnob(self.noLayer)

        for layer in uniqueLayers:
            self.layer = nuke.Boolean_Knob(layer, layer, 0)
            self.layer.setFlag(nuke.STARTLINE)
            self.layer.setVisible(False)
            self.addKnob(self.layer)
            layerCheckboxes.append(self.layer)

        self.div3 = nuke.Text_Knob("", "", "")
        self.addKnob(self.div3)
Exemple #16
0
def selectNodesPanel():
    p = nukescripts.PythonPanel('Conform file paths to Project Directory')
    p.nodesSelection = newUserKnob(
        nuke.Enumeration_Knob(
            'nodesSel', 'Nodes selections',
            ['All nodes', 'Selected nodes only', 'Exclude selected nodes']), 2)
    p.checkReadGeo = newUserKnob(
        nuke.Boolean_Knob('checkReadGeo', 'Exclude ReadGeo nodes', '0'), 0)
    p.readGeoText = nuke.Text_Knob(
        'readGeoText', '', 'Will affect configured alembic scenegraph')
    p.div1 = nuke.Text_Knob('div1', '')
    p.recurseGroups = newUserKnob(
        nuke.Boolean_Knob('checkRecurse', 'Exclude groups/gizmos', '0'), 1)
    p.tclPath = newUserKnob(
        nuke.Boolean_Knob('checkTCL', 'Exclude TCL knobs', '0'), 1)
    for k in (p.checkReadGeo, p.readGeoText, p.div1, p.recurseGroups):
        k.setFlag(0x1000)
    for k in (p.nodesSelection, p.checkReadGeo, p.readGeoText, p.div1,
              p.recurseGroups, p.tclPath):
        p.addKnob(k)

    if p.showModalDialog():
        # check if recurseGroups is true
        if p.recurseGroups.value():
            allNodes = nodeWithFile(False)
        else:
            allNodes = nodeWithFile(True)

        # check if selectedNodes
        if p.nodesSelection.value() == 'Selected nodes only':
            for node in allNodes:
                if node not in nuke.selectedNodes():
                    allNodes.remove(node)
        elif p.nodesSelection.value() == 'Exclude selected nodes':
            for node in allNodes:
                if node in nuke.selectedNodes():
                    allNodes.remove(node)

        # remove nodes with TCL
        if p.tclPath.value():
            for node in allNodes:
                hasTCL = bool(re.search(r'\[*\]', node['file'].value()))
                if hasTCL:
                    allNodes.remove(node)

        # remove readGeos node if necessary
        if p.checkReadGeo.value():
            for n in allNodes:
                if n.Class() == 'ReadGeo2':
                    allNodes.remove(n)

        return allNodes
Exemple #17
0
def addGizmoCopyright(n):
    '''add gizmo copyright'''

    c_str = """
    
    <p style="color: gray"><b>%s</b> &#169; 2020 Tianlun Jiang - jiangovfx.com

    """ % n.name()
    k_div = nuke.Text_Knob('div','','')
    k_copyright = nuke.Text_Knob('copyright', ' ',c_str)

    n.addKnob(k_div)
    n.addKnob(k_copyright)
def initialiseNode(node, max_num=4):

    node.knob(node.name()).setLabel('Appearance')

    knob_names = [x for x in list(node.knobs().keys()) if x.startswith('pt')]
    knob_names.sort(key=lambda x: int(x[2:]))

    # Add new Tab for points
    start_knob = node.knobs()['Start']
    node.removeKnob(start_knob)
    node.addKnob(nuke.Tab_Knob('Points'))
    text = "Insert adds a point between its adjacent and previous point\nDelete removes the adjacent point\nAdd adds a point at the end"
    node.addKnob(nuke.Text_Knob('info', '', text))
    node.addKnob(nuke.Text_Knob('', ''))
    node.addKnob(start_knob)

    # Remove and store all pt knobs
    knobs = []
    for name in knob_names:
        knob = node.knobs()[name]
        knobs.append(knob)
        node.removeKnob(knob)

    # Add each back along with their delete and insert buttons
    for knob in knobs:
        num = knob.name()[2:]

        delete = nuke.PyScript_Knob('delete' + num, 'Delete',
                                    "Lines_Callbacks.delete_pt()")
        insert = nuke.PyScript_Knob('insert' + num, 'Insert',
                                    "Lines_Callbacks.insert_pt()")

        # Hide knobs greater than the max value
        if int(num) >= max_num:
            knob.setVisible(False)
            delete.setVisible(False)
            insert.setVisible(False)

        node.addKnob(knob)
        node.addKnob(delete)
        node.addKnob(insert)

    # Add the Add knob
    add_knob = nuke.PyScript_Knob('add_pt', 'Add', "Lines_Callbacks.add_pt()")
    add_knob.setFlag(nuke.STARTLINE)
    node.addKnob(add_knob)

    node.knob('Max PTS').setValue(max_num)
    node.knobs()['Max PTS'].setVisible(False)
    node.knobs()['Max Limit'].setVisible(False)
Exemple #19
0
def SequenceLoader():
    '''main function'''

    dir_renderVersion = nuke.getFilename(
        "Select Render Version", pattern='*/', default=getLightingPath()
    )  # /Users/Tianlun/Desktop/_NukeTestScript/elems/image_group/TIO_orbit_1k_v001/
    if dir_renderVersion == None:
        nuke.message("Import Canceled")
    else:
        name_renderVersion = os.path.basename(
            dir_renderVersion[:-1])  # TIO_orbit_1k_v001
        RGBA = 'beauty'

        # Building Image Group
        ls_aov = getAOVs(dir_renderVersion)
        for p in ls_aov[ls_aov.keys()[0]]:
            nuke.Layer(
                p,
                ['%s.red' % p,
                 '%s.green' % p,
                 '%s.blue' % p,
                 '%s.alpha' % p])
        nodeLabel = '%s\nv%s' % (name_renderVersion.split('_v')[0],
                                 name_renderVersion.split('_v')[1])
        for l in ls_aov.keys():
            imgGroup = nuke.nodes.Group(name=l,
                                        label=nodeLabel,
                                        postage_stamp=1)
            t_tab = nuke.Tab_Knob('tb_user', 'ku_ImageGroup')
            t_renderVersion = nuke.Text_Knob('tx_version', '<b>render: </b>',
                                             name_renderVersion)
            t_renderLayer = nuke.Text_Knob('tx_layer', '<b>layer: </b>', l)
            t_path = nuke.Text_Knob('tx_dir', '<b>path: </b>',
                                    dir_renderVersion)
            t_aov = nuke.Text_Knob('tx_aov', '<b>aovs: </b>',
                                   '\n'.join(ls_aov[l]))
            for k in [t_tab, t_renderVersion, t_renderLayer, t_path, t_aov]:
                imgGroup.addKnob(k)

            with imgGroup:
                aov_beauty = None
                aov_rest = []
                for p in ls_aov[l]:
                    path = os.path.join(dir_renderVersion, l, p)
                    createRead(path.replace('\\', '/'))
                aov_beauty = nuke.toNode(RGBA)
                aov_rest = [
                    n for n in nuke.allNodes('Read') if n != aov_beauty
                ]
                shuffling(aov_beauty, aov_rest)
Exemple #20
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', '', ' '))
Exemple #21
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)
Exemple #22
0
def logrgb_lookup():
    """Build a ColorLookup using the logrgb data."""

    note_message = """
    Blackbody color lookup with input in degrees Kelvin (data ranges from 1000
    to 40000 degrees) mapped to logrithmic RGB color values.

    Note: This lookup requires a bit of massaging pre- and post-lookup. Your
    input heat map (which is probably in the 0-1 range) will need to be
    remapped to your desired heat level in Kelvin. The lookup outputs in some
    weird logrithmic RGB colorspace, so you may need to do some massaging to
    make things look right.
    
    Data sourced from this excellent datafile:
    http://www.vendian.org/mncharity/dir3/blackbody/
    """

    data = load_data()
    logrgb = build_lookup(filter_logrgb(data))
    logrgb.setName('Blackbody_logRGB_Lookup')
    a = nuke.Text_Knob('note', 'Note')
    logrgb.addKnob(a)
    logrgb.knob('note').setValue(note_message)

    return logrgb
Exemple #23
0
def srgb_lookup():
    """Build a ColorLookup using the srgb data."""

    note_message = """
    Blackbody color lookup with input in degrees Kelvin (data ranges from 1000
    to 40000 degrees) mapped to sRGB color values.

    Note: This lookup requires a bit of massaging pre- and post-lookup. Your
    input heat map (which is probably in the 0-1 range) will need to be
    remapped to your desired heat level in Kelvin. The lookup outputs in 
    sRGB colorspace and will need to be converted back to your working
    colorspace. 
    
    Data sourced from this excellent datafile:
    http://www.vendian.org/mncharity/dir3/blackbody/
    """

    data = load_data()
    srgb = build_lookup(filter_srgb(data))
    srgb.setName('Blackbody_sRGB_Lookup')
    a = nuke.Text_Knob('note', 'Note')
    srgb.addKnob(a)
    srgb.knob('note').setValue(note_message)

    return srgb
Exemple #24
0
def yxy_lookup():
    """Build a ColorLookup using the chromaticity and power data."""

    note_message = """
    Blackbody color lookup with input in degrees Kelvin (data ranges from 1000
    to 40000 degrees) mapped to chromaticity data (Y is power in semi-arbitrary
    units, x and y are chromaticity coordinates.

    Note: This lookup requires a bit of massaging pre- and post-lookup. Your
    input heat map (which is probably in the 0-1 range) will need to be
    remapped to your desired heat level in Kelvin. The lookup outputs in the
    CIE-Yxy colorspace and will need to be converted back to your working
    colorspace. It is also likely to be massively overexposed (50 stops or so --
    yikes!)
    
    Data sourced from this excellent datafile:
    http://www.vendian.org/mncharity/dir3/blackbody/
    """

    data = load_data()
    yxy = build_lookup(filter_yxy(data))
    yxy.setName('Blackbody_Yxy_Lookup')
    a = nuke.Text_Knob('note', 'Note')
    yxy.addKnob(a)
    yxy.knob('note').setValue(note_message)

    return yxy
    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)
Exemple #26
0
def node_timer():
    node = nuke.selectedNode()
    if [
            knobname for knobname in node.allKnobs()
            if knobname.name() == 'mix' or knobname.name() == 'which'
    ]:
        if node.knob('User2'):
            pass
        else:
            knob_tk = nuke.Tab_Knob('User2', 'Timer')
            node.addKnob(knob_tk)
        if node.knob('MyWidget'):
            pass
        else:
            knob = nuke.PyCustom_Knob("MyWidget", "",
                                      "MyWidget(nuke.thisNode(),%s)" % (100))
            node.addKnob(knob)
        if node.knob('Notes'):
            pass
        else:
            knob_tk2 = nuke.Text_Knob('Notes', 'Info:')
            knob_tk2.setValue(
                "Adjust the knob to change the switching frequency")
            node.addKnob(knob_tk2)
    else:
        nuke.message('This node does not have a "mix" button.')
Exemple #27
0
def preferencesCreatedCallback():
    p = nuke.toNode('preferences')
    
    #Setup J_Ops prefs knobs if they don't exist.
    try:
        jopsKnobsPresent = p["J_Ops"]
    except (SyntaxError, NameError):
        k = nuke.Tab_Knob("J_Ops")
        k.setFlag(nuke.ALWAYS_SAVE)
        p.addKnob(k)

        v = nuke.Double_Knob("j_ops_ver", "j_ops_ver")
        v.setFlag(nuke.ALWAYS_SAVE)
        v.setFlag(nuke.INVISIBLE)
        v.setValue(2.0101)
        p.addKnob(v)
        
        k = nuke.Boolean_Knob("j_ops_enable_drop", "Improved drag and drop")
        k.setFlag(nuke.ALWAYS_SAVE)
        k.setFlag(nuke.STARTLINE)
        k.setValue(1.0)
        k.setTooltip("Enable/disable a somewhat improved drag and drop behaviour. Requires Nuke restart to take effect. Adds creation of geo, camera, light and vectorfield nodes based on incoming file extensions, as well as support for sequences when dropping folders onto DAG.")
        p.addKnob(k)

        k = nuke.Boolean_Knob("j_ops_enable_bookmark", "DAG bookmarks")
        k.setFlag(nuke.ALWAYS_SAVE)
        k.setFlag(nuke.STARTLINE)
        k.setValue(1.0)
        k.setTooltip("Enable/disable DAG bookmarks, allowing storing and recalling of particular DAG locations and zoom settings, for easy navigation around a script. Requires Nuke restart to take effect. Adds Python-DAG Bookmarks menu to J_Ops toolbar, offering access via mouse, tab menu, or hotkeys.")
        p.addKnob(k)

        k = nuke.Text_Knob("j_ops_dropdivider_label", "Drag And Drop")
        k.setFlag(nuke.ALWAYS_SAVE)
        p.addKnob(k)

        k = nuke.Boolean_Knob("j_ops_drop_recurse", "Recurse directories")
        k.setFlag(nuke.ALWAYS_SAVE)
        k.setValue(1.0)
        k.setTooltip("Enable/disable recursion into directories dropped on DAG. When enabled will result in entire directory structure being imported into DAG, when disabled only the directory dropped will be imported (ie none of its sub directories)")
        p.addKnob(k)
        
    #Check for preference setting, and if drop enabled add its callback/
    dropEnabled = False
    try:
        dropEnabled = nuke.toNode('preferences')["j_ops_enable_drop"].getValue()
    except (SyntaxError, NameError):
        pass

    if dropEnabled == True:
        nukescripts.drop.addDropDataCallback(jopsDropHandler)

    #Check for preference setting, and if drop enabled add its callback/
    bookmarkEnabled = False
    try:
        bookmarkEnabled = nuke.toNode('preferences')["j_ops_enable_bookmark"].getValue()
    except (SyntaxError, NameError):
        pass

    if bookmarkEnabled == True:
        jopsBookmarkAddMenus()
 def __init__(self, data):
     nukescripts.PythonPanel.__init__(self, 'Submit Shot')
     self.gladiator = data.gladiator
     self.dialogueText = data.dialogueText
     self.validated = data.validated
     self.user = c1_user
     # filename fragments
     self.filepath = data.filepath
     self.filename = data.filename
     self.showCode = data.showCode
     self.shotName = data.shotName
     self.fileversion = data.fileversion
     # folders
     self.versionFolder = data.versionFolder
     self.shotFolder = data.shotFolder
     self.showFolder = data.showFolder
     # knobs
     self.emailBool = nuke.Boolean_Knob('emailBool', 'Send Email to VFX')
     # self.addKnob(self.emailBool)
     self.emailBool.setValue(False)
     self.emailMsg = nuke.Multiline_Eval_String_Knob(
         'Type your shot notes here(if enabled).', '')
     # self.addKnob(self.emailMsg)
     self.emailMsg.setEnabled(False)
     self.sep = nuke.Text_Knob('', '')
     # self.addKnob(self.sep)
     self.cancelButton = nuke.PyScript_Knob("Cancel")
     self.addKnob(self.dialogueText)
     self.button1 = nuke.PyScript_Knob(
         "submit", self.shotName + '_v' +
         str(self.versionFolder.ver.remote + 1).zfill(3))
     self.button2 = nuke.PyScript_Knob(
         "submit", self.shotName + '_v' + str(self.fileversion).zfill(3))
Exemple #29
0
def get_master_driver():
    """Get Master Driver Node, create one if not in DAG
	return: (obj) Master Driver Node
	"""

    node = nuke.toNode('MASTER_DRIVER')

    if not node:
        node = nuke.nodes.NoOp(name='MASTER_DRIVER')
        # Tab
        k_id = nuke.Tab_Knob('tb_id', 'MASTER_DRIVER')
        node.addKnob(k_id)
        # Driver Buttons
        build_driver_types('SLIDER', node, newline=True)
        build_driver_types('RGBA', node)
        build_driver_types('XY', node)
        build_driver_types('XYZ', node)
        build_driver_types('INT', node)
        build_driver_types('BOOL', node)
        k_sync = nuke.PyScript_Knob('sync', STR_SYNC)
        k_sync.clearFlag(nuke.STARTLINE)
        k_sync.setCommand(STR_CMD_SETUP.format('sync_list_driven()'))
        node.addKnob(k_sync)
        # Divider
        node.addKnob(nuke.Text_Knob('', ''))

    node['note_font'].setValue('bold')
    node['note_font_size'].setValue(100)
    node['tile_color'].setValue(2047999)
    node['hide_input'].setValue(True)

    node.showControlPanel(forceFloat=True)
    return node
Exemple #30
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()