Beispiel #1
0
def checkFrameRange(framefirst, framelast, frameinc, framespertask, string=''):
	if string != '':
		string = ' on "%s"' % string
	if framefirst > framelast:
		nuke.message('First frame > Last frame' + string)
		return False
	if frameinc < 1:
		nuke.message('Frame increment must be >= 1' + string)
		return False
	if framespertask < 1:
		nuke.message('Frames per task must be >= 1' + string)
		return False

	tasksnum = \
		(1.0 + framelast - framefirst) / (1.0 * frameinc * framespertask)

	if tasksnum > 10000.0:
		if not nuke.ask('Tasks number over 10 000%s\nAre you sure?' % string):
			return False

	if tasksnum > 100000.0:
		if not nuke.ask('Tasks number over 100 000%s\nAre you sure?' % string):
			return False

	if tasksnum > 1000000.0:
		nuke.message(
			'Tasks number over 1 000 000%s\nPlease contact your supervisor, '
			'administrator or TD.' % string
		)
		return False

	return True
Beispiel #2
0
    def copyIt(self,movPath):### COPIED FROM nxWrite
            nx_artist = nuke.root()['nx_artist'].getValue()                #edited by rmk 3/9/15
            if nx_artist.find(' ')>0:                                     #edited by rmk 3/9/15
                artistShort = nx_artist.replace(' ','_')
                artistShort = artistShort[0:artistShort.index('_')+4]         #edited by rmk 3/9/15
            else: #edited by rmk 3/9/15
                artistShort = nx_artist #edited by rmk 3/9/15
            todaysdate = datetime.date.today().strftime('%y%m%d')
            #WIPPath = nxPipeline.nxStudioRootDir() + get_project() + '/' + 'WIP' + '/' + todaysdate
            WIPPath = os.path.join(nxPipeline.nxStudioRootDir(), get_project(), 'WIP', todaysdate,artistShort).replace('\\', '/') #edited by rmk 3/9/15
            i = True

            if os.path.exists(str(WIPPath + '/' + movPath.rsplit('/')[-1])): #edited by rmk 3/9/15
                i = nuke.ask('WARNING.\n\nWIP Folder contains this version already.\n\nDo you want to overwrite it?')

            if i:
                self.createWIPDir(WIPPath)
            movPath=movPath.replace('/','\\')
            try:
                shutil.copy2(movPath, WIPPath) #edited by rmk 3/9/15
            except:
                nuke.message('Push failed! Sorry...')
            else:
                if nuke.ask('Success!\n\nDo you want to open the WIP Folder?'):
                    nxProject.openProjectFolders('wip')
Beispiel #3
0
 def getReadNodes(self):
     #try:
     if self.readNodes == 0:
         sNodes = nuke.selectedNodes()
         self.readNodes = sNodes
     else:
         sNodes = self.readNodes
     len(sNodes)
     if len(sNodes) >= 2:
         for node in sNodes:
             node.autoplace()
             if node.Class() == "Read":
                 nodeName = node
                 self.lista.append(nodeName)
             else:
                 pass  #nuke.message("One of your nodes is not a read node: %s, it will be excluded." % node.self.name())
         self.mainBeauty()
         if self.mainBeautyLayer == '0':
             nuke.ask('err broken.. sorry')
         else:
             beautyIndex = self.lista.index(self.mainBeautyLayer)
         self.lista[beautyIndex], self.lista[0] = self.lista[0], self.lista[
             beautyIndex]
         self.node = self.lista[0]
         self.node.knob("selected").setValue(False)
     else:
         nuke.message("Please select more than 1 node__")
Beispiel #4
0
def main(*args):
    select = nuke.ask("是否使用所选创建任务?")
    if select:
        nodes = nuke.selectedNodes("Read")
    else:
        select_all = nuke.ask("使用所有节点创建任务?")
        if select_all:
            nodes = nuke.allNodes("Read")
        else:
            nuke.message("任务创建取消")
            return
    current_project_id = StrackGlobals.current_project.get("id")
    for read in nodes:
        user = read["name"].getValue().split("_")[0]
        user_id = st.user.find("name=%s" % user).get("id")
        shot_path = read["file"].getValue()
        shot_name = shot_path.split("/elements")[0].split("/")[-1]
        shot_id = st.shot.find("code=%s" % shot_name).get("id")
        project_id = st.shot.find("code=%s" % shot_name).get("project_id")
        if current_project_id == project_id:
            print "project id Confirm %s %s" % (current_project_id, project_id)
        paint_task = st.task.find(
            "item_id=%s and project_id=%s and code=paint" %
            (shot_id, project_id))
        if paint_task:
            paint_task_id = paint_task.get("id")
            st.task.update(id=paint_task_id, fields={"assignee": user_id})
            continue
        data = {
            "approved_version": 001,
            "assignee": user_id,
            "cc_id": "",
            "code": "paint",
            "current_version": 001,
            "delivered_version": 001,
            "due_date": "",
            "item_id": shot_id,
            "json": "",
            "level": "",
            "lock": 0,
            "milestone": 0,
            "name": "paint",
            "priority": 30,
            "project_id": project_id,
            "status_id": 24,
            "step_id": 41,
            "sub_date": "",
            "tag_ids": ""
        }
        st.task.create(data)
    nuke.message("任务创建完成")
def restartNuke():

    if nuke.ask('Are you sure you want to restart Nuke?'):

        scriptName = nuke.root().knob('name').getValue()

        subprocess_options = {"shell": True}

        separate_terminal_options = {
            "close_fds": True,
            "preexec_fn": os.setsid
        }

        if nuke.env['nukex'] == True:
            session = '--nukex'
        else:
            session = '--nuke'

        if 'REZ_VOLT_SESSION_ROOT' in os.environ:
            subprocess_options.update(separate_terminal_options)

        if os.path.isfile(scriptName):
            nuke.scriptSave()
            launch_cmd = '{} {} {}'.format(sys.executable, session, scriptName)
            subprocess.Popen(launch_cmd, **subprocess_options)
            nuke.modified(False)
            nuke.scriptExit()
        else:
            nuke.scriptNew('')
            nuke.modified(False)
            nuke.scriptExit()
Beispiel #6
0
def advancedSubmission():
    nuke.scriptSave()
    DeadlineNukeClient.main()
    createArtifact()
    if nuke.ask('Do you want to version up your script?'):
        incrementalSave()
    return
Beispiel #7
0
def run(found_file):
    #check if scene is modified
    if nuke.Root().modified() == True:
        #prompt user to save
        if nuke.ask('Unsaved script\n\nWould you like to save?'):
            if nuke.Root().name() == 'Root':
                #run up the save_as module as this script hasnt been saved yet, then clear and open
                import jnuke.pipeline.save_as
                jnuke.pipeline.save_as.run()

                nuke.scriptClear()
                nuke.scriptOpen(found_file)
            else:
                #save the script, clear and open selected script
                nuke.scriptSave("")
                nuke.scriptClear()
                nuke.scriptOpen(found_file)
        else:
            #they dont want to save, so just clear the script and open the selected script
            nuke.scriptClear()
            nuke.scriptOpen(found_file)

    else:
        #not modified, simply clear and open
        nuke.scriptClear()
        nuke.scriptOpen(found_file)
Beispiel #8
0
def sb_revealInFileBrowser():

	n = nuke.selectedNodes("Read") + nuke.selectedNodes("Write")

	if len(n) == 0:
		nuke.message("Select at least one Read or Write node.")
		return

	if len(n) > 3:
		makeSure = nuke.ask("Are you sure you want to open {0} file browser windows?".format(len(n)))
		if not makeSure:
			return

	for i in n:
		try:
			getPath = i["file"].evaluate().split("/")[:-1]
			folderPath = "/".join(getPath)

			if platform.system() == "Windows":
				subprocess.Popen('explorer "{0}"'.format(folderPath.replace("/", "\\")))
			elif platform.system() == "Darwin":
				subprocess.Popen(["open", folderPath])
			elif platform.system() == "Linux":
				subprocess.Popen(["xdg-open", folderPath])
		except:
			continue
Beispiel #9
0
def sb_revealInFileBrowser():

	n = nuke.selectedNodes("Read") + nuke.selectedNodes("Write")

	if len(n) == 0:
		nuke.message("Select at least one Read or Write node.")
		return

	if len(n) > 3:
		makeSure = nuke.ask("Are you sure you want to open {0} file browser windows?".format(len(n)))
		if not makeSure:
			return

	for i in n:
		try:
			getPath = i["file"].evaluate().split("/")[:-1]
			folderPath = "/".join(getPath)

			if platform.system() == "Windows":
				subprocess.Popen('explorer "{0}"'.format(folderPath.replace("/", "\\")))
			elif platform.system() == "Darwin":
				subprocess.Popen(["open", folderPath])
			elif platform.system() == "Linux":
				subprocess.Popen(["xdg-open", folderPath])
		except:
			continue
Beispiel #10
0
def create_precomp(path):
	path = re.sub("file:\/\/", "", path)
	if nuke.ask("Create precomp? [Yes] Import nodes [No]"):
		nuke.nodes.Precomp(file=path)
		return True
	else:
		return None
Beispiel #11
0
def bookmarkthis( desc=True, ask=True ):
    
    '''Bookmarks a node for quick navigation'''

    try:
        sn = nuke.selectedNodes()[-1]
    except:
        nuke.message('Please select a node')
        sn = None
    
    if sn is not None:

        if sn['icon'].value() != 'bookmark.png' and desc == True:
            l=sn['label'].value()
            panel = nuke.Panel ('Bookmark This',300)     
            panel.addSingleLineInput('add description',l)
            result=panel.show()
            d = panel.value('add description')

            if result:
                sn['icon'].setValue('bookmark.png')
                sn['label'].setValue(d)
        else:
            if ask:
                clear=nuke.ask('Clear Bookmark and Label?')
                if clear:
                    sn['icon'].setValue('')
                    sn['label'].setValue('')
            else:
                if desc:
                    sn['icon'].setValue('')
                    sn['label'].setValue('')
                else:
                    sn['icon'].setValue('')
def renderDPX(node=nuke.thisNode()):
    verCheck(node)
    if verCheck(node) == "pass" and dpxPath(node) != 'break':
        # Assign values
        renDPX = nuke.toNode("Final_RenderNode")
        renderNode = node
        xPos = renderNode['xpos'].value()
        yPos = renderNode['ypos'].value()
        renFolder = os.path.dirname(dpxPath(node))
        # If a previous render exists, asks the user whether they would like to delete the files
        if os.path.exists(renFolder):
            if nuke.ask("Would you like to remove the previously rendered files?"):
                shutil.rmtree(renFolder)
        # Render the comp
        """ This part needs a callback to stop the function if the render is canceled """
        renDPX['Render'].execute()
        # Create the read node
        nuke.root().begin()
        if renderNode.input(1):
            readNode = renderNode.input(1)
            readNode['file'].fromUserText(dpxPath(node) + ".####.exr" + ' ' + str(nuke.root().firstFrame() - startFrame) + '-' + str(nuke.root().lastFrame()))
            readNode['reload'].execute()
            nuke.root().end()
        else:
            readNode = nuke.nodes.Read(colorspace = dpxImportColor)
            readNode['file'].fromUserText(dpxPath(node) + ".####.exr" + ' ' + str(nuke.root().firstFrame() - startFrame) + '-' + str(nuke.root().lastFrame()))
            # Place the read node
            readNode.setXYpos(int(xPos - 170), int(yPos - 36))
            # nuke.autoplaceSnap(readNode)
            renderNode.setInput(1, readNode)
            nuke.root().end()
    else:
        pass
Beispiel #13
0
    def confirm(self):
        if self.checkFakeEnter() == False:
            self.answerList = [self.in1.lineEdit.text(), self.out1.lineEdit.text(), self.in2.lineEdit.text(), self.out2.lineEdit.text()]
            self.createList = []
            for x in self.answerList:
                if not x in nuke.layers() and not x in self.extras:
                    self.createList.append(x)
            if not self.createList == []:
                self.hide()
                if nuke.ask('''<font left>The following layers don't exist. Do you want to create them?

<i>%s</i>''' %'''
'''.join(self.createList)):
                    for l in self.createList:
                        nuke.Layer(l, ['%s.red' %l, '%s.green' %l, '%s.blue' %l, '%s.alpha' %l])
                self.show()
            if self.node == None or not self.modifyNodeCheckBox.isChecked():
                with self.context:
                    if self.typeCheckbox.isChecked():
                        node = nuke.createNode('ShuffleCopy')
                    else:
                        node = nuke.createNode('Shuffle')
            else:
                node = self.node
            node['in'].setValue(self.answerList[0])
            node['out'].setValue(self.answerList[1])
            node['in2'].setValue(self.answerList[2])
            node['out2'].setValue(self.answerList[3])
            self.close()
Beispiel #14
0
def bookmarkthis(desc=True, ask=True):
    '''Bookmarks a node for quick navigation'''

    try:
        sn = nuke.selectedNodes()[-1]
    except:
        nuke.message('Please select a node')
        sn = None

    if sn is not None:

        if sn['icon'].value() != 'bookmark.png' and desc == True:
            l = sn['label'].value()
            panel = nuke.Panel('Bookmark This', 300)
            panel.addSingleLineInput('add description', l)
            result = panel.show()
            d = panel.value('add description')

            if result:
                sn['icon'].setValue('bookmark.png')
                sn['label'].setValue(d)
        else:
            if ask:
                clear = nuke.ask('Clear Bookmark and Label?')
                if clear:
                    sn['icon'].setValue('')
                    sn['label'].setValue('')
            else:
                if desc:
                    sn['icon'].setValue('')
                    sn['label'].setValue('')
                else:
                    sn['icon'].setValue('')
    def __doStuf(self):
        # LAUNCH MAIN PROCEDURE
        srcNodes = {'all': nuke.allNodes(), 'selected': nuke.selectedNodes()}
        self.w_type = self.optChoice.value()
        self.w_text = self.STRING_Knob.value() or "None"
        self.w_file = self.FILE_Knob.value() or "None"
        self.w_path = self.FILE_Knob2.value() or "None"
        if self.w_type == 'text' and self.w_text == 'None':
            nuke.message('no watermark text found, exiting here')
            return 1
        if self.w_type == 'image' and self.w_file == 'None':
            nuke.message('no watermark image found, exiting here')
            return 1
        elif self.w_type == 'image' and not os.path.isfile(self.w_file):
            nuke.message('no watermark image found, exiting here')
            return 1

        if self.w_path == 'None':
            if nuke.ask(
                    'If "Output path" 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.\n\n '
            ):
                print 'All good, continuing...'
            else:
                return 1
        elif not os.path.isdir(self.w_path):
            nuke.message(
                'the output path specified doesn\'t exists, exiting now')
            return 1

        self.matches = watermark_main(srcNodes[self.nodesChoice.value()],
                                      self.w_type, self.w_text, self.w_file,
                                      self.w_path)
 def _source_roto_template(self, step_name, proj_format):
     """
     Prompts user if they want to import the set Roto template for the New File.
     """
     if step_name == "Roto":
         roto_template = nuke.ask(
             "Source the default Nuke template for the <i style='color:magenta'><b><br>SSVFX Roto</b></i> workflow?"
         )
         if not roto_template:
             pass
         else:
             tk = self.parent.engine.sgtk
             roto_template_script = tk.templates["workfile_templates"]
             fields = {}
             roto_template_script_path = os.path.normpath(
                 roto_template_script.apply_fields(fields) +
                 "\\pipeline_task\\roto\\roto_rgb_template.nk")
             roto_template_script_path = roto_template_script_path.replace(
                 "/", os.path.sep)
             if os.path.exists(roto_template_script_path):
                 nuke.tprint("Importing Roto template:",
                             roto_template_script_path)
                 nuke.scriptSource(roto_template_script_path)
                 nuke.zoom(0.0)
                 try:
                     nuke.Root().knob('format').setValue(proj_format)
                 except:
                     nuke.tprint("!!! No proj_format called %s" %
                                 proj_format)
Beispiel #17
0
def breakoutLayers(node):
	if not node:
		return
	use_targa = nuke.ask('tga파일로 뽑을까요?')
	if use_targa:
		writedir = nuke.getFilename('tga를 저장할 디렉토리를 선택해주세요')
		if not writedir:
			return
	# geodir = nuke.getFilename('geometry를 읽을 디렉토리를 선택해주세요')
	# if not geodir:
	# 	return
	# use_targa=False
	geodir='c:/tmp/'
	# nuke.Undo().begin()

	nodepos = (node.xpos(), node.ypos()+100)
	sketch = _parseLayers(node, items=['alpha','sketch'], renderlayer='sketch', extractposition=nodepos, geodir='c:/tmp/data/scene_cache', use_targa=False)
	nodepos = (node.xpos(), node.ypos()+1300)
	tone = _parseLayers(node, items=['alpha','tone'], renderlayer='tone', extractposition=nodepos, geodir='c:/tmp/data/scene_cache', use_targa=False)
	nodepos = (node.xpos(), node.ypos()+2600)
	etc = _parseLayers(node, items='*', exceptlayer=['alpha', 'sketch', 'tone'], extractposition=nodepos, geodir='c:/tmp/data/scene_cache', use_targa=False)

	merge = nuke.nodes.PSDMerge()
	x = tone.xpos()+600
	y = tone.ypos()
	merge.setXYpos(x, y)
	merge.setInput(0, sketch)
	merge.setInput(1, tone)
Beispiel #18
0
    def __call__(self):
        """ Start the capture.
    """
        writePath = self._customWritePath or self._defaultWritePath
        self._viewer['file'].setValue(writePath)

        # _performCleanup will remove whatever filepath is set in the self._viewer['file'] knob.
        # So if this changes between runs then the old files wont get cleaned up, probably
        # a bug.
        if self._doCleanup:
            self._performCleanup()

        try:
            nuke.executeMultiple((self._viewer, ), self._frameRange,
                                 self._selectedViews, False)
        except RuntimeError, msg:
            if msg.args[0][0:9] == "Cancelled":
                splitMsg = string.split(msg.args[0])
                msg = """ Render did not complete, do you want to show the completed range ?
                Frame range %s contains %s frames but only %s finished.
            """ % (self._frameRange, splitMsg[3], splitMsg[1])
                self._doFlipbook = nuke.ask(msg)
            else:
                nuke.message("Flipbook render failed:\n%s" % (msg.args[0], ))
                self._doFlipbook = False
    def __doStuf( self ):
        # LAUNCH MAIN PROCEDURE
        srcNodes = { 'all': nuke.allNodes(), 'selected': nuke.selectedNodes() }
        self.w_type = self.optChoice.value()
        self.w_text = self.STRING_Knob.value() or "None"
        self.w_file = self.FILE_Knob.value() or "None"
        self.w_path = self.FILE_Knob2.value() or "None"
        if self.w_type == 'text' and self.w_text == 'None':
            nuke.message('no watermark text found, exiting here')
            return 1
        if self.w_type == 'image' and self.w_file == 'None':
            nuke.message('no watermark image found, exiting here')
            return 1
        elif self.w_type == 'image' and not os.path.isfile(self.w_file):
            nuke.message('no watermark image found, exiting here')
            return 1

        if self.w_path == 'None':
            if nuke.ask('If "Output path" 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.\n\n '):
                print 'All good, continuing...'
            else:
                return 1
        elif not os.path.isdir(self.w_path):
            nuke.message('the output path specified doesn\'t exists, exiting now')
            return 1
        
        self.matches = watermark_main( srcNodes[self.nodesChoice.value()], self.w_type, self.w_text, self.w_file, self.w_path )
Beispiel #20
0
    def createFlattenedTrackFromActiveSequence(self):

        """
        Creates a new Video track for the active Sequence with all visible Video Tracks flattened to a single Track
        """

        view = hiero.ui.activeView()

        if not hasattr(view, 'sequence'):
            return

        sequence = view.sequence()
        tracksToHide = sequence.videoTracks()

        selection = view.selection()
        includedItems = None
        if len(selection)>1:
            flattenSelection = nuke.ask("Flatten Selection Only?")
            if flattenSelection:
                includedItems = selection

        if sequence:
            proj = sequence.project()

            flattenedVideoTrack = self.makeFlattenedVideoTrackFromSequence(sequence, includedItems=includedItems)

            if flattenedVideoTrack:
                with proj.beginUndo("Add Flattened Track"):
                    sequence.addTrack(flattenedVideoTrack)

                    for track in tracksToHide:
                        track.setEnabled(False)
Beispiel #21
0
def split_by_backdrop():
    # TODO: need refactor and test.
    """Split workfile to multiple file by backdrop."""

    text_saveto = '保存至:'
    text_ask_if_create_new_folder = '目标文件夹不存在, 是否创建?'

    # Panel
    panel = nuke.Panel('splitByBackdrop')
    panel.addFilenameSearch(text_saveto, os.getenv('TEMP'))
    panel.show()

    # Save splited .nk file
    save_path = panel.value(text_saveto).rstrip('\\/')
    noname_count = 0
    for i in nuke.allNodes('BackdropNode'):
        label = repr(i['label'].value()).strip("'").replace('\\', '_').replace(
            '/', '_')
        if not label:
            noname_count += 1
            label = 'noname_{0:03d}'.format(noname_count)
        if not os.path.exists(save_path):
            if not nuke.ask(text_ask_if_create_new_folder):
                return False
        dir_ = save_path + '/splitnk/'
        dir_ = os.path.normcase(dir_)
        if not os.path.exists(dir_):
            os.makedirs(dir_)
        filename = dir_ + label + '.nk'
        i.selectOnly()
        i.selectNodes()
        nuke.nodeCopy(filename)
    os.system('explorer "' + dir_ + '"')
    return True
Beispiel #22
0
    def createFlattenedTrackFromActiveSequence(self):
        """
        Creates a new Video track for the active Sequence with all visible Video Tracks flattened to a single Track
        """

        view = hiero.ui.activeView()

        if not hasattr(view, 'sequence'):
            return

        sequence = view.sequence()
        tracksToHide = sequence.videoTracks()

        selection = view.selection()
        includedItems = None
        if len(selection) > 1:
            flattenSelection = nuke.ask("Flatten Selection Only?")
            if flattenSelection:
                includedItems = selection

        if sequence:
            proj = sequence.project()

            flattenedVideoTrack = self.makeFlattenedVideoTrackFromSequence(
                sequence, includedItems=includedItems)

            if flattenedVideoTrack:
                with proj.beginUndo("Add Flattened Track"):
                    sequence.addTrack(flattenedVideoTrack)

                    for track in tracksToHide:
                        track.setEnabled(False)
Beispiel #23
0
    def submit_checks(self):
        """Check current settings and raise errors for anything that

    could cause problems when submitting the job.

    Raises:
      zync.ZyncError for any issues found
    """
        if not self.zync_conn.has_user_login():
            raise zync.ZyncError('Please login before submitting a job.')

        if self.existing_project.value().strip(
        ) == '' and self.new_project.value().strip() == '':
            raise zync.ZyncError(
                'Project name cannot be blank. Please either choose ' +
                'an existing project from the dropdown or enter the desired ' +
                'project name in the New Project field.')

        if self.skip_check.value():
            skip_answer = nuke.ask(
                'You\'ve asked Zync to skip the file check ' +
                'for this job. If you\'ve added new files to your script this '
                +
                'job WILL error. Your nuke script will still be uploaded. Are '
                + 'you sure you want to continue?')
            if not skip_answer:
                raise zync.ZyncError('Job submission canceled.')
Beispiel #24
0
  def askUserForOptions(self):
    p = PrecompOptionsDialog()
    result = p.showModalDialog()
    if result:
      self.scriptPath = p.scriptPath.value()
      self.renderPath = p.renderPath.value()
      self.channels = p.channels.value()
      if p.origNodes.value() == "delete":
        self.delete = True
      elif p.origNodes.value() == "add backdrop":
        self.addBackdrop = True

      if nuke.env['nc']:
        nukeExt = ".nknc"
      else:
        nukeExt = ".nk"

      (root, ext) = os.path.splitext(self.scriptPath)
      if not ext:
        self.scriptPath += nukeExt
      elif ext == ".nk" and ext != nukeExt:
        self.scriptPath = self.scriptPath[0:-3] + nukeExt

      (root,ext) = os.path.splitext(self.renderPath)
      if not ext:
        self.renderPath += ".exr"

      if os.path.exists(self.scriptPath):
        if not nuke.ask("Overwrite existing " + self.scriptPath + " ?"):
          return False
      return True
    else:
      return False
Beispiel #25
0
    def renameCreateSharedToolset(self, name, rename):
        ret = False
        nameList = name.split('/')
        fileName = nameList[-1]
        del nameList[-1]
        dirs = '/'.join(nameList)
        fullPath = posixpath.join(SHARED_TOOLSET_PATH, dirs)

        try:
            if not os.path.isdir(fullPath):
                os.makedirs( fullPath )
            filePath = posixpath.join(fullPath, fileName + '.nk')
            if not os.path.exists(filePath):
                if self.rename == True:
                    os.rename(self.fullFilePath, filePath)
                else:
                    # create way
                    nuke.nodeCopy(filePath)
            elif nuke.ask('Overwrite existing \n %s?' % filePath):
                if self.rename == True:
                    os.remove(filePath)
                    os.rename(self.fullFilePath, filePath)
                else:
                    # create way
                    nuke.nodeCopy(filePath)
            ret = True
        except:
            ret = False
        return ret
Beispiel #26
0
def submitToDeadlines():
    message = "是否提交deadline渲染?"
    Sub = nuke.ask(message)
    print Sub
    if Sub:
        print Sub
        import SubmitToDeadline
        SubmitToDeadline.SubmitToDeadline()
def deleteToolset(rootPath, fileName):
  if nuke.ask('Are you sure you want to delete ToolSet %s?' %fileName):
    os.remove(fileName)
    #COMMENT: if this was the last file in this directory, the folder will need to be deleted.
    # Walk the directory tree from the root and recursively delete empty directories
    checkForEmptyToolsetDirectories(rootPath)
    #COMMENT: now force a rebuild of the menu
    refreshToolsetsMenu()
Beispiel #28
0
    def _checkOverwriteSafety(self, path):
        
        basic = not os.path.exists(path)
        if basic:
            return True

        message = "%s already exists.\nDo you want to replace it?" % os.path.basename(path)
        return nuke.ask(message)
def deleteToolset(rootPath, fileName):
    if nuke.ask('Are you sure you want to delete ToolSet %s?' % fileName):
        os.remove(fileName)
        #COMMENT: if this was the last file in this directory, the folder will need to be deleted.
        # Walk the directory tree from the root and recursively delete empty directories
        checkForEmptyToolsetDirectories(rootPath)
        #COMMENT: now force a rebuild of the menu
        refreshToolsetsMenu()
Beispiel #30
0
def stampCreateAnchor(node=None, extra_tags=[], no_default_tag=False):
    '''
    Create a stamp from any nuke node.
    Returns: extra_tags list is success, None if cancelled
    '''
    ns = nuke.selectedNodes()
    for n in ns:
        n.setSelected(False)

    if node is not None:
        node.setSelected(True)
        default_title = getDefaultTitle(node)
        default_tag = nodeType(node)
        node_type = nodeType(node)
        window_title = "New Stamp: " + str(node.name())
    else:
        default_title = ""
        default_tag = ""
        node_type = "2D"
        window_title = "New Stamp"

    panel = nuke.Panel(window_title)
    panel.setWidth(240)
    panel.addSingleLineInput("Title:", default_title)
    if no_default_tag:
        default_tags = ", ".join(extra_tags)
    else:
        default_tags = default_tag + ", " + ", ".join(extra_tags)
    panel.addSingleLineInput("Tags:", default_tags)

    while True:
        if panel.show():
            anchor_title = panel.value("Title:").strip()
            anchor_tags = panel.value("Tags:")
            if not titleIsLegal(anchor_title):
                nuke.message("Please set a valid title.")
                continue
            elif len(findAnchorsByTitle(anchor_title)):
                if not nuke.ask("There is already a Stamp titled " +
                                anchor_title +
                                ".\nDo you still want to use this title?"):
                    continue
            na = anchor(title=anchor_title,
                        tags=anchor_tags,
                        input_node=node,
                        node_type=node_type)
            na.setYpos(na.ypos() + 20)
            stampCreateWired(na)
            for n in ns:
                n.setSelected(True)
                node.setSelected(False)
            extra_tags = re.split(" *, *", anchor_tags.strip())
            extra_tags = [t for t in extra_tags if t != default_tag]
            break
        else:
            break

    return extra_tags
Beispiel #31
0
    def _checkOverwriteSafety(self, path):

        basic = not os.path.exists(path)
        if basic:
            return True

        message = "%s already exists.\nDo you want to replace it?" % os.path.basename(
            path)
        return nuke.ask(message)
Beispiel #32
0
 def handleFileChange(self, path):
   if self.dirty:
     return
   if not self.file_changed:
     self.file_changed = True
     if nuke.ask('The clip file has changed outside of nuke. Would you like to load the updated version ?'):
       self._xml = ET.parse(self.filename)
       self.xml_model.dataChanged.emit()
     self.file_changed = False
Beispiel #33
0
def writeAfterPipeline():
    try:
        ScriptVersionTest()
    except ValueError:
        print 'skipping pipeline'
    else:
        if nuke.ask('Do you want to version up your script?'):
            incrementalSave()
    return
Beispiel #34
0
def Scan_for_missing_frames():
    try:
        # node = nuke.toNode('_render')
        node = nuke.selectedNode()
        file = node.knob('file').getValue()
        filepath = os.path.dirname(nuke.root().name()) + os.sep + 'Prerenders' + os.sep
        arr = []
        missing = []
        i = 0

        for img in os.listdir(filepath):
            n = int(img.split('.')[1])
            # n = int(re.search(r'\d+', img).group(0))
            arr.append(n)
            if len(arr) > 1:
                difference = arr[i] - arr[i-1]
                if difference > 1:
                    #print(range(arr[i-1]+1, arr[i]))
                    missing.append(range(arr[i-1]+1, arr[i]))
            i+=1
        if len(missing) > 0:
            string = ''
            # hyphenate list...
            i = 1
            for span in missing:
                if len(span) > 2:
                    string = string + str(span[0]) + '-' + str(span[-1])
                else:
                    string = string + str(span[0])
                if i < len(missing):
                    string = string + ', '
                i+=1
            if nuke.ask('Found missing frames: ' + string + '\n' + 'Render these frames now?'):
                ranges = nuke.FrameRanges()
                for s in string.split(', '):
                    fr = nuke.FrameRange(s)
                    ranges.add(fr)
                if node.knob('use_limit').getValue == True:
                    node.knob('use_limit').setValue(False)
                    nuke.render(node, ranges)
                    node.knob('use_limit').setValue(True)
                else:
                    nuke.render(node, ranges)
    except:
        raise
        return nuke.message('Must have a write node selected!')
        # return nuke.message('Must have a write node named \'_render\' in your network!')
    # if type(node) == type(nuke.root()):
    #     return nuke.message('Must have a write node selected!')

            # node.knob('Render').execute()

            # node.knob('frame_range_string').setValue(string)

    # tempNode = nuke.createNode('Write')
    # nuke.render(tempNode, ranges)
    return nuke.message( 'No Missing frame-ranges found!')
Beispiel #35
0
def check_saved():
    if nuke.root().name() == 'Root':
        r = nuke.ask("Script must be saved to continue.\nSave now?")
        if r:
            nuke.scriptSaveAs()
            save_render_file()
            return 1
        else:
            return 0
    elif nuke.root().modified():
        r = nuke.ask("There are unchanged changes to the script.\nSave now?")
        if r:
            save_render_file()
            return 1
        else:
            return 0
    else:
        return 1
Beispiel #36
0
def inforMation(model):
    import OCT_showInformation
    informat = OCT_showInformation.OCT_ReformatTexts()
    rs = informat.reformatText(model)
    if rs:
        message = "是否提交deadline渲染?"
        Sub = nuke.ask(message)
        if Sub:
            import SubmitToDeadline
Beispiel #37
0
def render_node(node):
    '''launch render'''
    out_path = node['file'].value()
    out_scriptcopy = node['tx_scriptcopy'].value()
    startFrame = int(nuke.Root()['first_frame'].value())
    endFrame = int(nuke.Root()['last_frame'].value())

    def _soloWrite(sel_node, all_enabled_write, mode='solo'):
        if mode == 'solo':
            for s in all_enabled_write:
                if s != sel_node.name():
                    print('node disabled---' + s)
                    nuke.toNode(s)['disable'].setValue(True)
        elif mode == 'reverse':
            for s in all_enabled_write:
                nuke.toNode(s)['disable'].setValue(False)
                print('node enabled---' + s)

    askMessage = "Render Node: %s\nFile: %s\nFramerage: %s-%s\n" % (
        node.name(), os.path.basename(
            node['file'].value()), startFrame, endFrame)
    c = nuke.ask(askMessage)
    if c:
        if not os.path.exists(os.path.dirname(out_path)):
            p = os.path.dirname(out_path)
            os.makedirs(p)
            print("out path created --- %s" % p)
        if not os.path.exists(os.path.dirname(out_scriptcopy)):
            s = os.path.dirname(out_scriptcopy)
            os.makedirs(s)
            print("out scriptcopy created --- %s" % s)

        all_enabled_write = [
            n.name() for n in nuke.allNodes('Write')
            if n['disable'].value() == False
        ]
        _soloWrite(node, all_enabled_write, mode='solo')
        nuke.scriptSave()
        thisScript_path = nuke.scriptName()
        shutil.copy2(thisScript_path, out_scriptcopy)

        # nuke.render(node, startFrame, endFrame)

        exe = joinPath(nuke.EXE_PATH).replace('/', '\\')

        cmd_str = """start cmd /k "{exe}" -t -m 22 -xi {script} {start}-{end}""".format(
            exe=exe,
            node=node.name(),
            script=thisScript_path,
            start=startFrame,
            end=endFrame)

        subprocess.Popen(cmd_str, shell=True)
        _soloWrite(node, all_enabled_write, mode='reverse')
    else:
        print("user cancelled")
Beispiel #38
0
def Documentation():
	for search in nuke.pluginPath():
		path = os.path.dirname(search) + "/documentation/Pr_Suite v1.0 Documentation.html"
		if os.path.exists(path):
			webbrowser.open("file:///" + path)
			break
		else:
			if nuke.ask("Pr_Suite documentation not found in expected installation directory. Click 'Yes' to access online Pr_Suite documentation."):
				webbrowser.open("http://www.parimalvfx.com/rnd/pr_suite/documentation/")
			break
Beispiel #39
0
    def dropEvent(self, event):
        mimeText = event.mimeData().text()
        p = urlparse.urlparse(mimeText)
        finalPath = os.path.abspath(os.path.join(p.netloc, p.path))
        print "File dropped:\n" + finalPath

        askResult = nuke.ask("Detect cuts for Clip: %s" % finalPath)
        if askResult:
            self.clipPath = finalPath.replace('\n','')
            self.createTimelineFromDroppedClip(self.clipPath)
Beispiel #40
0
def deleteReads():
    for n in nuke.selectedNodes():

        file = n['file'].getValue()
        basename = os.path.basename(file).split('.')[0]
        dirname = os.path.dirname(file)
        ext = os.path.splitext(file)[-1]
        cmd = "rm %s/%s*%s" % (dirname, basename, ext)
        if nuke.ask('Are you sure: \n {}'.format(cmd)):
            os.system(cmd)
Beispiel #41
0
    def dropEvent(self, event):
        mimeText = event.mimeData().text()
        p = urlparse.urlparse(mimeText)
        finalPath = os.path.abspath(os.path.join(p.netloc, p.path))
        print "File dropped:\n" + finalPath

        askResult = nuke.ask("Detect cuts for Clip: %s" % finalPath)
        if askResult:
            self.clipPath = finalPath.replace('\n', '')
            self.createTimelineFromDroppedClip(self.clipPath)
Beispiel #42
0
    def confirm(self):
        """ Obtain confirmation to proceed with operation if the current file
			is not saved.
		"""
        if nuke.Root().modified():
            return nuke.ask(
                "The current script has been modified. Do you want to continue?"
            )
        else:
            return True
Beispiel #43
0
def assemble(): # Run assemble procedure: check if NK file exists
    if checkVersion() > 0: 
        if nuke.ask('{}\nEXISTS!\nSave next version?'.format(sceneName)):
            buildNameNk(codePart, codeSequence, codeShot, versionCurrent+1)
            saveNK()
        else:
            saveNK()
    else:
        buildNameNk(codePart, codeSequence, codeShot, 1)
        saveNK()
Beispiel #44
0
def assemble():  # Run assemble procedure: check if NK file exists
    if checkVersion() > 0:
        if nuke.ask('{}\nEXISTS!\nSave next version?'.format(sceneName)):
            buildNameNk(codePart, codeSequence, codeShot, versionCurrent + 1)
            saveNK()
        else:
            saveNK()
    else:
        buildNameNk(codePart, codeSequence, codeShot, 1)
        saveNK()
def main():
    only_selected = nuke.ask("Consider only selected nodes? Select No to consider all nodes.")
    with_expression = nuke.ask("Include nodes with expression?")

    if only_selected:
        nodes = nuke.selectedNodes()
    else:
        nodes = nuke.root().nodes() # all nodes

    for node in nodes:
        node['selected'].setValue(False) # make sure no node is selected at the beginning
        for knob in node.allKnobs():
            if knob.isAnimated():
                if with_expression or not knob.hasExpression():
                    node['selected'].setValue(True)
                    if knob.hasExpression():
                        print node.name() + " is animated with expression"
                    else:
                        print node.name() + " is animated"
                    break
    def frame_info(self, node, knob_value, knob_eval):
        """Returns all information required to create a Read node"""
        filepath = self.filepath_from_disk(node, knob_value, knob_eval)
        if isinstance(filepath, type(None)):
            not_found = 'Filepath does not exist and/or cannot be' + \
                        'translated:\n' + node + ': ' + knob_eval + \
                        '\n\nCreate Read node anyway and guess framerange?'
            if nuke.ask(not_found):
                limit_to_range = self.get_knob_value(node, 'use_limit')
                if (not isinstance(limit_to_range, type(None)) and
                        int(limit_to_range) == 1):
                    # Use explicit framerange set on Write node
                    firstframe = int(self.get_knob_value(node, 'first'))
                    lastframe = int(self.get_knob_value(node, 'last'))
                else:
                    # Look at the framerange coming into the Write node
                    firstframe = int(nuke.toNode(node).frameRange().first())
                    lastframe = int(nuke.toNode(node).frameRange().last())

                filepath_processed = self.determine_relativity(knob_eval)
                node_options = self.node_options(node)
                frame_data = {
                            'filepath': filepath_processed,
                            'firstframe': firstframe,
                            'lastframe': lastframe,
                            'node_options': node_options
                            }
                return frame_data

        else:
            filepath = os.path.abspath(filepath)
            filepath = filepath.replace('\\', '/')
            current_frame = re.findall(r'\d+', filepath)[-1]
            padding = len(current_frame)
            basename = filepath[: filepath.rfind(current_frame)]
            filetype = filepath.split('.')[-1]
            firstframe, lastframe = self.get_framerange(node,
                                                        basename,
                                                        filetype)
            filepath_processed = self.process_filepath(filepath,
                                                       filetype,
                                                       basename,
                                                       padding,
                                                       knob_value)
            node_options = self.node_options(node)
            frame_data = {
                        'filepath': filepath_processed,
                        'firstframe': firstframe,
                        'lastframe': lastframe,
                        'node_options': node_options
                        }
            return frame_data
 def readNodes(self):
         #try:
         sNodes = nuke.selectedNodes()
         len(sNodes)
         if len(sNodes) >= 2:
             for node in sNodes:
                 node.autoplace()
                 if node.Class()  == "Read":
                    nodeName = node 
                    self.lista.append(nodeName)         
                 else:
                      nuke.message("One of your nodes is not a read node: %s, it will be excluded." % node.self.name()) 
             self.mainBeauty()
             if self.mainBeautyLayer=='0':
                 nuke.ask('err broken.. sorry')
             else:
                 beautyIndex = self.lista.index(self.mainBeautyLayer)
             self.lista[beautyIndex], self.lista[0] = self.lista[0], self.lista[beautyIndex]   
             self.node = self.lista[0]  
             self.node.knob("selected").setValue(False)
         else:
             nuke.message ("Please select more than 1 node")
 def knobChanged(self, knob):
     if knob is self.execute:
         # If no box is checked, verify that this is correct.
         if self.isChecked() == False:
             query = nuke.ask(
                 "No boxes selected.\nA roto node with a tracked pivot will be created.\nIs that what you want?")
             print query
             if query == True:
                 self.create_RotoNode()
                 # close panel
                 self.finishModalDialog(True)
         else:
             self.create_RotoNode()
             # close panel
             self.finishModalDialog(True)
Beispiel #49
0
def smartSetter():
    p=createPanel()
    
    if p.show(): 
       
        inp = open(smartSettingsInputPath,'r')
        smartOn=p.value("enable smart on start") 
        projectPath=p.value("project path: ")
        #delete last /
        if projectPath!="" and projectPath[-1]=="/":
            projectPath = projectPath[:-1]
            
        artist=p.value("default artist: ")
        scriptPath=p.value("script path inside a project: ")
        renderPath=p.value("render path inside a project: ")
        overwirteSaveWithSmartSave=p.value("always smartSave")
        showRecentFiles=p.value("show recent files")
        
        #read in settingsdocument and save per line
        settingsCont=[]
        for line in inp:
            settingsCont.append(line)
    
        #change settings
        updateSettings(settingsCont,"smartOn",smartOn)
        updateSettings(settingsCont,"projectPath",projectPath) 
        updateSettings(settingsCont,"artist",artist)
        updateSettings(settingsCont,"scriptPath",scriptPath)
        updateSettings(settingsCont,"renderPath",renderPath)    
        updateSettings(settingsCont,"overwirteSaveWithSmartSave",overwirteSaveWithSmartSave) 
        updateSettings(settingsCont,"showRecentFiles",showRecentFiles)
    
        #write settings in string for output
        outputSettings=""
        i=0
        for i in range(0,len(settingsCont)):
              outputSettings=outputSettings+ settingsCont[i]
    
        #update smartSettings
        outp = open(smartSettingsOutputPath,'w')
        outp.write(outputSettings)
        outp.close()
        
        #rename to original in order to overwrite
        os.rename('/Users/%s/.nuke/smart/smartSettings_w.txt'%User, '/Users/%s/.nuke/smart/smartSettings.txt'%User)
        
        if nuke.ask("Your nuke must be restarted before the updated settings work. restart now?"):
            nuke.scriptClose()
Beispiel #50
0
  def clearLooksFromProject(self):
    """Removes Looks from Project and thumbnails from ~/.nuke/Looks/thumbnail dir"""

    clearYesNo = nuke.ask("Are you sure you wish to clear all Project Looks and thumbnails?")

    if clearYesNo:
      project = hiero.ui.activeSequence().project()
      tagsBin = self.getLooksTagBinForProject(project)
      tagItems = tagsBin.items()
      for tag in tagItems:
        tagsBin.removeItem(tag)
        thumbnailPath = tag.icon()
        try:
          os.remove(thumbnailPath)
        except OSError:
          pass
Beispiel #51
0
def tri_create_write_path(fileData):
    root = nuke.root()
    resolution = fileData.find('size').get('width') + "x" + fileData.find('size').get('height')
    
    path = tri_path() + "/" + root['tri_' + fileData.tag].value()
    if fileData.tag == "result":
        path = path + "/" + resolution
    
    try:
        if not os.path.exists(path):
            if nuke.ask("Dir: " + path + "/ not exists. Create?"):
                pass
                os.makedirs(path)
    except:
        nuke.message("Cannot create PROJ_PATH/" + root['tri_' + fileData.tag].value() + "/" \
            + root['tri_project_scene_id'].value() + "/" + resolution)
Beispiel #52
0
    def clearSequenceManager(self):

        confirm = nuke.ask('Are you sure ?')
        
        if confirm:
            
            self.node.knob('sceneList').setValues(['n/a'])
            self.node.knob('sceneList').setValue(0)
            self.node.knob('shotlist').setValues(['n/a'])
            self.node.knob('shotlist').setValue(0)
            self.node.knob('jobname').setValue('n/a')
            self.node.knob('label').setValue('')
            #self.node.knob('cameraName').setValue(' ')
            shots = self.node.knob('shotList').values()
            
            self.removeAllShots(shots)
Beispiel #53
0
def createWriteDirs(nodes=[]):
  '''
  create write directories for selected write nodes
  supports stereo view notation with %v or %V
  '''
  # if no nodes are specified then look for selected nodes
  if not nodes:
    nodes = nuke.selectedNodes()

  # if nodes is still empty no nodes are selected
  if not nodes:
    nuke.message('ERROR: No node(s) selected.')
    return

  EXISTING = []

  for entry in nodes:
    _class = entry.Class()
    if _class == "Write":
      path = nuke.filename(entry)
      output_paths = []
      if path is None:
        continue
      all_views = curnode.knob('views').value() # look for views in the write node
      all_views = all_views.split() # split them out
      for view in all_views:
        if '%v' in path:
          output_paths.append(path.replace('%v',view[:1]))
        if '%V' in path:
          output_paths.append(path.replace('%V',view))
        if not len(output_paths):
          output_paths.append(path)
        for output_path in output_paths:
          root_path = os.path.dirname(output_path)
          if os.path.exists(root_path) == True:
            nuke.tprint('Path Exists: {0}'.format(root_path))
            return
          try:
            os.mkdir(root_path)
            os.chmod(root_path,0775)
          except:
            if nuke.ask('Create Path? \n{0}'.format(root_path)):
              os.makedirs(root_path)
              os.chmod(root_path,0775)
            else:
              return
  return
Beispiel #54
0
def nk_break_fbx():
	"""
	Break FBX
	"""
	n = nuke.selectedNode()
	if n.knobs().has_key("fbx_node_name"):
		source = n.dependencies()[0] if n.dependencies() else None
		_scale = " ".join(["%0f" % i for i in n['scaling'].value()])
		_file = n['file'].value()
		enum_string = n["fbx_node_name"].value().split(" ")
		nodes = enum_string[1:]
		if nuke.ask("Create %i nodes?" % len(nodes)):
			for (i,node_name) in enumerate(nodes):
				enum_string[0] = "{%i}" % i
				v = " ".join(enum_string)
				g = nuke.nodes.ReadGeo2(file=_file, fbx_node_name=v, read_from_file=False, scaling=_scale)
				g.setInput(0, randomColorConstant())
def showInputDir(nodes=[]):
  print "TEST"
  '''
  function that shows a file browser window
  for the directory in a read or write node
  '''
  # if no nodes are specified then look for selected nodes
  if not nodes:
    nodes = nuke.selectedNodes("Read") + nuke.selectedNodes("Write")

  # if nodes is still empty no nodes are selected
  if not nodes:
    nuke.message('ERROR: No node(s) selected.')
    return

  if len(nodes) > MAX_NODES:
    confirm = nuke.ask("Are you sure you want to open {0} {1} windows?".format(len(nodes), BROWSER))
    if not confirm:
      return

  for node in nodes:
    _class = node.Class()
    if not _class == 'Write' or not _class == 'Read':
      continue
    else:
      path = nuke.filename(node)
      if path is None:
        continue
      if path[-1:] is '/':
        path = path[:-1]
      root_path = os.path.dirname(os.path.dirname(path))
    node['selected'].setValue(False)

    try:
      path = i["file"].evaluate().split("/")[:-1]
      root_path = "/".join(getPath)
      if platform.system() == "Windows":
        root_path = root_path.replace("/", "\\")
        print '{0} "{1}"'.format(BROWSER_CMD, root_path)
        subprocess.Popen('{0} "{1}"'.format(BROWSER_CMD, root_path))
      else:
        subprocess.Popen([BROWSER_CMD, root_path])
    except:
      continue

  return
Beispiel #56
0
def writeFolderCreator():
	'''
	Checks if selected write node's folder exists and create them if does not
	'''
	import os
	
	nodes = nuke.selectedNodes('Write')
	if nodes == []:
		nuke.message('select some write node')
		return None
	
	for node in nodes:
		file = nuke.filename(node)
		path = os.path.dirname(file)
		if not os.path.isdir(path):
			if nuke.ask(node.knob('name').getValue() + '\n\n' + path +\
						'\n\nthis path does not exist. would like to create it?'):
				os.makedirs(path)
Beispiel #57
0
def collectThisComp():
	panelResult = _collectPanel()

	# If they hit OK...
	if panelResult[0] == 1 and panelResult[1] != '...':
		targetPath = panelResult[1]
		
		# Check to make sure a file path is not passed through
		if os.path.isfile(targetPath):
			targetPath = os.path.dirname(targetPath)

		# Make sure target path ends with a slash (for consistency)
		if not targetPath.endswith('/'):
			targetPath += '/'

		# Check if local directory already exists. Ask to create it if it doesn't
		if not os.path.exists(targetPath):
			if nuke.ask("Directory does not exist. Create now?"):
				try:
					os.makedirs(targetPath)
				except:
					raise Exception, "Something's cloggin' the tubes!"
					return False
			else:
				nuke.message("Cannot proceed without valid target directory.")
				return False

		# Call the actual archiving function. Rreturn True if the function exited cleanly, False otherwise
		if _collect(targetPath):
			nuke.message("Collect complete")
			return True
		else:
			nuke.message("Nothing to Collect... canceling")
			return False

	# If they just hit OK on the default ellipsis...
	elif panelResult[0] == 1 and panelResult[1] == '...':
		nuke.message("That's not a path")
		return False

	# If they hit CANCEL...
	else:
		nuke.message("Canceled by user")
		return False
def decryptomatte_nodes(nodes, ask):
    gizmos = []

    for node in nodes:
        if node.Class() == "Cryptomatte":
            gizmos.append(node)
    if not gizmos:
        return

    if not ask or nuke.ask(('Replace %s Cryptomatte gizmos with expression nodes? '
        'Replaced Gizmos will be disabled and selected.') % (len(gizmos))):

        for gizmo in gizmos:
            _decryptomatte(gizmo)

        for node in nuke.selectedNodes():
            node.knob("selected").setValue(False)

        for gizmo in gizmos:
            gizmo.knob("selected").setValue(True)
Beispiel #59
0
  def submit_checks(self):
    """Check current settings and raise errors for anything that

    could cause problems when submitting the job.

    Raises:
      zync.ZyncError for any issues found
    """
    if not self.zync_conn.has_user_login():
      raise zync.ZyncError('Please login before submitting a job.')

    if self.existing_project.value().strip() == '' and self.new_project.value().strip() == '':
      raise zync.ZyncError(
          'Project name cannot be blank. Please either choose ' + 'an existing project from the dropdown or enter the desired ' + 'project name in the New Project field.')

    if self.skip_check.value():
      skip_answer = nuke.ask(
          'You\'ve asked Zync to skip the file check ' + 'for this job. If you\'ve added new files to your script this ' + 'job WILL error. Your nuke script will still be uploaded. Are ' + 'you sure you want to continue?')
      if not skip_answer:
        raise zync.ZyncError('Job submission canceled.')