예제 #1
0
def create_node(this_node=''):
    if not this_node: this_node = nuke.thisNode()

    if this_node["customRange"].getValue():
        this_node["frameStart"].setValue(
            int(nuke.Root()['first_frame'].getValue()))
        this_node["frameEnd"].setValue(
            int(nuke.Root()['last_frame'].getValue()))

    this_node["resolutionX"].setValue(this_node.width())
    this_node["resolutionY"].setValue(this_node.height())

    fileName = os.path.basename(nuke.root().name()).split(".")[0]
    renderPath = os.path.dirname(os.path.dirname(
        nuke.root().name())) + "/{render}/{file}/exr/{file}.%04d.exr".format(
            render=Tank().data['rules']['STATUS']['render'], file=fileName)
    renderPath = renderPath.replace('\\', '/')

    # this_node["rootPath"].setValue(renderPath)
    this_node["exrPath"].setValue(renderPath)
    this_node["jpgPath"].setValue(renderPath.replace("exr", "jpg"))
    this_node["tifPath"].setValue(renderPath.replace("exr", "tif"))
    def process(self, context):
        import nuke

        fname = context.data["originMaking"]

        if all(result["success"] for result in context.data["results"]):

            self.log.info("Publish succeed, save script back to workfile.")
            nuke.scriptSaveAs(fname, overwrite=True)
            modified = False

        else:
            # Mark failed if error raised during extraction or integration
            publishing = context.data["currentMaking"]
            script_dir, file_name = os.path.split(publishing)
            file_name = "__failed." + file_name
            modified = True

            os.rename(publishing, script_dir + "/" + file_name)

        nuke.Root()["name"].setValue(fname)
        nuke.Root()["project_directory"].setValue(os.path.dirname(fname))
        nuke.Root().setModified(modified)
예제 #3
0
파일: context.py 프로젝트: parimalvfx/ada
    def run(cls, nodes=None, bake_list=None, pause=None):
        """
        Once the nodes are gathered up then we can iterate over them
        and execute each knob on the tab from the top to the bottom.

        Args:
            nodes (list): Un-sorted nodes either a selection in Nuke.
            bake_list (list): List of nodes to be processed, these
                have already been gathered and sorted.
            pause (int): The queue order which you want to stop at.

        Returns:
            list: all the nodes which were executed successfully.
        """
        # any nuke script can add a __template_class_text knob to its
        # root node and register a callback against it
        cls.template_class = (nuke.Root().knobs().get(
            "__template_class__", nuke.Text_Knob("null", "null")).value())
        cls.template_class = None if cls.template_class == "" else cls.template_class

        # if we are not continuing a previous bake, then we need to
        # gather, sort and validate the nodes.
        if not bake_list:
            cls.input_nodes = nodes or nuke.allNodes(recurseGroups=True)
            gathered_nodes = cls.gather(cls.input_nodes)
            bake_list = cls.alpha_numeric_sort(gathered_nodes)

            getLog().info("Ada: Nodes to bake: {0}".format(bake_list))

        # run validation code / frame work before executing tabs
        cls.validate(bake_list)

        # queue nodes for baking
        queue = cls.queue(bake_list)
        getLog().info("template class: {}".format(cls.template_class))

        # execute registered global/template callbacks before
        cls.execute_callbacks("GLOBAL_BEFORE")
        cls.execute_callbacks("TEMPLATE_BEFORE",
                              template_class=cls.template_class)

        # process the nodes which have ada tabs
        results = cls.process(queue, bake_list, pause)

        # execute registered global/template callbacks after
        cls.execute_callbacks("TEMPLATE_AFTER")
        cls.execute_callbacks("GLOBAL_AFTER",
                              template_class=cls.template_class)

        return results
예제 #4
0
    def loadProjects(self):
        self.projects = self.session.getAllProjects()
        nk_script = nuke.Root()['name'].value()
        self.projectsC.clear()
        for project in self.projects:
            item = QListWidgetItem(project['name'])
            item.setData(Qt.UserRole, project['id'])
            self.projectsC.addItem(item)

            if self.auto_detect:
                prod_match = re.search("^(.*)(" + project['name'] + ")(.*)$",
                                       nk_script)
                if prod_match:
                    self.projectsC.setCurrentItem(item)
예제 #5
0
    def process(self, context):
        assert isinstance(context, pyblish.api.Context)
        footages = set()
        root = nuke.Root()
        for n in nuke.allNodes('Read', nuke.Root()):
            if n.hasError():
                self.log.warning('读取节点出错: %s', n.name())
                continue
            filename = nuke.filename(n)
            mtime = n.metadata('input/mtime')
            if not filename or not mtime:
                continue

            footage = FootageInfo(filename=filename,
                                  mtime=pendulum.from_format(
                                      mtime,
                                      '%Y-%m-%d %H:%M:%S',
                                      tz='Asia/Shanghai'))
            footages.add(footage)
        instance = context.create_instance('{}个 素材'.format(len(footages)),
                                           filename=root['name'].value(),
                                           family='素材')
        instance.extend(footages)
예제 #6
0
    def __init__(self, dest_root):
        """ Initialize packaging worker class.

        Args:
            dest_root (str): Path of destination root folder.

        """
        self.error_nodes = []
        self.single_results = []
        self.sequence_results = {}
        self.copy_files_count = 0
        self.dest_root = dest_root
        self.original_nk = nuke.Root().name()
        self.nodes = filter(self.check_node_error, get_read_nodes())
예제 #7
0
파일: test.py 프로젝트: 785415581/Nuke
def createWriteNode():
    nodes = nuke.allNodes()
    OLMSmootherNode = []
    head = ''
    for i in range(len(nodes)):
        name = nodes[i].name()
        node = nuke.toNode(name)
        projectPath = nuke.Root().name()
        filed = projectPath.split('/')
        filed.remove(filed[-1])

        for i in range(1,len(filed)):
            head = os.path.join(head,filed[i])
        if node.Class() == 'OLMSmoother':
            OLMSmootherNode.append(node)
    if len(OLMSmootherNode):
        if len(OLMSmootherNode) == 1:
            outfilePathDirs = 'D:' + '\\' + head + '\\chAll'
            if not os.path.isdir(outfilePathDirs):
                os.makedirs(outfilePathDirs)
            outfilePath = (outfilePathDirs +'\\chAll'+ '.%04d.png').replace('\\','/')
            inputNodeName = OLMSmootherNode[0].input(0).name()
            inputNode = nuke.toNode(inputNodeName)
            writeNode = nuke.nodes.Write(inputs=[inputNode],file = outfilePath)
            writeNode['channels'].setValue('rgba')
            writeNode['file_type'].setValue('png')

            #此时开始输出渲染

            nuke.exectue(writeNode)
            readNode = createReadNode(outfilePathDirs.replace('\\','/'))
            OLMSmootherNode[0].setInput(0,readNode)
        else:
            n = 1
            for i in range(len(OLMSmootherNode)):
                outfilePathDirs = 'D:' + '\\' + head + '\\chAll' + str(n)
                if not os.path.isdir(outfilePathDirs):
                    os.makedirs(outfilePathDirs)
                outfilePath = (outfilePathDirs  + '\\chAll' + str(n) + '.%04d.png').replace('\\', '/')
                inputNodeName = OLMSmootherNode[i].input(0).name()
                inputNode = nuke.toNode(inputNodeName)
                writeNode = nuke.nodes.Write(inputs=[inputNode],file = outfilePath)
                writeNode['channels'].setValue('rgba')
                writeNode['file_type'].setValue('png')
                #此时开始渲染输出
                nuke.exectue(writeNode)
                readNode = createReadNode(outfilePathDirs.replace('\\','/'))
                OLMSmootherNode[i].setInput(0,readNode)
                n += 1
예제 #8
0
    def _framerange_to_be_published(self, item):
        """
        Since users have the option to render only a subset of frames,
        adding validation to check if the full frame range is being published.

        :param item: Item to process
        :return: True if yes false otherwise
        """
        lss_path = item.properties['node']['cached_path'].value()
        lss_data = frangetools.getSequence(lss_path)

        log_method = item.properties.get("log_method", "warning")

        # Since lss_data will be a list of dictionaries,
        # building a dictionary from key value for the ease of fetching data.
        info_by_path = self._build_dict(lss_data, key="path")
        missing_frames = info_by_path.get(lss_path)['missing_frames']
        root = nuke.Root()

        # If there are no missing frames, then checking if the first and last frames match with root first and last
        # Checking with root because _sync_frame_range() will ensure root is up to date with shotgun
        if log_method == "error":
            log = self.logger.error
        else:
            log = self.logger.warning

        if missing_frames:
            log("Renders Mismatch! Incomplete renders on disk.")
            if log_method == "warning":
                nuke.message("WARNING!\n"+item.properties['node'].name() +
                             "\nRenders Mismatch! Incomplete renders on disk.")
            return False if log_method == "error" else True
        else:
            first_rendered_frame = info_by_path.get(lss_path)['frame_range'][0]
            last_rendered_frame = info_by_path.get(lss_path)['frame_range'][1]

            if (first_rendered_frame > root.firstFrame()) or (last_rendered_frame < root.lastFrame()):
                log("Renders Mismatch! Incomplete renders on disk.")
                if log_method == "warning":
                    nuke.message("WARNING!\n"+item.properties['node'].name() +
                                 "\nRenders Mismatch! Incomplete renders on disk.")
                return False if log_method == "error" else True
            elif (first_rendered_frame < root.firstFrame()) or (last_rendered_frame > root.lastFrame()):
                log("Renders Mismatch! Extra renders on disk.")
                if log_method == "warning":
                    nuke.message("WARNING!\n"+item.properties['node'].name() +
                                 "\nRenders Mismatch! Extra renders on disk.")
                return False if log_method == "error" else True
        return True
예제 #9
0
def read_from_write():
    """
    Create Read node from selected Write node.
    :return: None
    :rtype: None
    """
    selected = nuke.selectedNode()
    if selected.Class() == "Write":
        if selected["use_limit"].value() is True:
            first_frame = selected["first"].value()
            last_frame = selected["last"].value()
        else:
            first_frame = nuke.Root()["first_frame"].value()
            last_frame = nuke.Root()["last_frame"].value()

        write = nuke.nodes.Read(file=selected["file"].value(),
                                first=first_frame,
                                last=last_frame,
                                origfirst=nuke.Root()["first_frame"].value(),
                                origlast=nuke.Root()["last_frame"].value())
        write.setXpos(selected.xpos() + 100)
        write.setYpos(selected.ypos())
    else:
        nuke.message("Please select a Write node.")
예제 #10
0
def buildKnob(name, abr):
    try:
        root = nuke.Root()
        if "Deadline" not in root.knobs():
            tabKnob = nuke.Tab_Knob("Deadline")
            root.addKnob(tabKnob)

        if name in root.knobs():
            return root.knob(name)
        else:
            tKnob = nuke.String_Knob(name, abr)
            root.addKnob(tKnob)
            return tKnob
    except:
        print("Error in knob creation. " + name + " " + abr)
예제 #11
0
    def __init__(self, *_infos):
        nuke.Root().begin()

        if _infos:
            self.infos = _infos[0]
        else:
            self.infos = [['CHM201_029_010', 'Q:/Charmed_S2/CHM201/'],
                          ['CHM201_031_100', 'Q:/Charmed_S2/CHM201/'],
                          ['CHM201_031_110', 'Q:/Charmed_S2/CHM201/'],
                          ['CHM201_029_010', 'Q:/Charmed_S2/CHM201/'],
                          ['CHM201_031_100', 'Q:/Charmed_S2/CHM201/'],
                          ['CHM201_031_110', 'Q:/Charmed_S2/CHM201/']]

        self.base_path = ''
        self.shot_code = ''
예제 #12
0
파일: notify.py 프로젝트: tws0002/Nuke-2
 def _get_mtime_info():
     ret = {}
     for n in nuke.allNodes('Read', nuke.Root()):
         try:
             mtime = time.mktime(
                 time.strptime(n.metadata('input/mtime'),
                               '%Y-%m-%d %H:%M:%S'))
         except TypeError:
             continue
         if mtime > since:
             ret[nuke.filename(n)] = mtime
             ftime = time.strftime('%m-%d %H:%M:%S', time.localtime(mtime))
             throtted_warning('{}: [new footage]{}'.format(
                 u(n.name()), ftime))
     return ret
예제 #13
0
def in_nuke():
    shot_name = os.getenv('SHOT')
    check = False
    cache_dir = os.getenv('CYC_HYDRA_CACHE')
    with open(os.path.join(cache_dir, 'shots.json')) as j:
        shots = json.load(j)
        for shot in shots:
            if shot_name == shot:
                check = True
        if check:
            first = shots.get(shot_name).get('first')
            last = shots.get(shot_name).get('last')
    root = nuke.Root()
    root['first_frame'].setValue(first)
    root['last_frame'].setValue(last)
예제 #14
0
def save_ftrack_ui():

    ui_dict = {}

    knobs = ftrack_default_knobs()
    r = nuke.Root()

    for knob in knobs:

        try:
            ui_dict[knob] = r[knob].value()
        except NameError:
            pass

    return ui_dict
예제 #15
0
    def _sync_frame_range(self, item):
        """
        Checks whether frame range is in sync with shotgun.

        :param item: Item to process
        :return: True if yes false otherwise
        """
        context = item.context
        entity = context.entity

        log_method = item.properties.get("log_method", "warning")

        if log_method == "error":
            log = self.logger.error
        else:
            log = self.logger.warning

        # checking entity validity since it can be invalid/empty in case of Project Level item
        if entity:
            frame_range_app = self.parent.engine.apps.get("tk-multi-setframerange")
            if not frame_range_app:
                # return valid for asset/sequence entities
                self.logger.warning("Unable to find tk-multi-setframerange app. "
                                    "Not validating frame range.")
                return True

            sg_entity_type = entity["type"]
            sg_filters = [["id", "is", entity["id"]]]
            in_field = frame_range_app.get_setting("sg_in_frame_field")
            out_field = frame_range_app.get_setting("sg_out_frame_field")
            fields = [in_field, out_field]

            # get the field information from shotgun based on Shot
            # sg_cut_in and sg_cut_out info will be on Shot entity, so skip in case this info is not present
            data = self.sgtk.shotgun.find_one(sg_entity_type, filters=sg_filters, fields=fields)
            if in_field not in data or out_field not in data:
                return True
            elif data[in_field] is None or data[out_field] is None:
                return True

            # compare if the frame range set at root level is same as the shotgun cut_in, cut_out
            root = nuke.Root()
            if root.firstFrame() != data[in_field] or root.lastFrame() != data[out_field]:
                log("Frame range not synced with Shotgun.")
                if log_method == "warning":
                    nuke.message("WARNING! Frame range not synced with Shotgun.")
                return False if log_method == "error" else True
        return True
예제 #16
0
def show_dialog(app):
    """
    Show the main dialog ui

    :param app: The parent App
    """
    # defer imports so that the app works gracefully in batch modes
    from .dialog import AppDialog

    display_name = sgtk.platform.current_bundle().get_setting("display_name")

    #print "logger item: "
    #print sgtk.custom_debug_handler

    #store publish logs alongside other phosphene logs, enable bug submit
    logger = sgtk.platform.get_logger(__name__)
    #try:
    #    #from .Debug import DebugHandler
    #    #phospheneDebugHandler=DebugHandler()
    #    phospheneDebugHandler=sgtk.custom_debug_handler
    #    print "hooking phosphene logs into "+str(logger)
    #    logger.addHandler(phospheneDebugHandler)
    #except:
    #    print format_exc()

    #start a progress bar if we're in nuke
    if app.engine.instance_name == 'tk-nuke':
        import nuke
        progressBar = nuke.ProgressTask('Publishing ' +
                                        basename(nuke.Root().name()))
        sleep(.25)

    logger.info('Phosphene publish loaded')

    if app.pre_publish_hook.validate():
        # start ui
        if app.modal:
            app.engine.show_modal(display_name, app, AppDialog)
        else:
            app.engine.show_dialog(display_name, app, AppDialog)
    else:
        app.logger.debug("%s validate returned False -- abort publish." %
                         app.pre_publish_hook.__class__.__name__)
    if app.engine.instance_name == 'tk-nuke':
        try:
            del (progressBar)
        except:
            pass
예제 #17
0
def is_locked():
    if _ignore_lock["_"]:
        return False

    def is_publish_source(filename):
        return os.path.dirname(filename).endswith("_published")

    def is_published_script(filename):
        return "/publish/" in filename

    root = nuke.Root()
    filename = root.name()
    if os.path.isfile(filename):
        if is_publish_source(filename) or is_published_script(filename):
            return True
    return False
예제 #18
0
def _RV_write_Frame_Info(INF, _NK_BASENAME):
    info = {}
    framerange = {}
    i = 0
    print "\nSEARCHING WRITE....................."

    writeNodes = RecursiveFindNodes("Write", nuke.Root())

    # deepWriteNodes = RecursiveFindNodes( "DeepWrite", nuke.Root() )
    # writeGeoNodes = RecursiveFindNodes( "WriteGeo", nuke.Root() )
    #
    # writeNodes.extend(deepWriteNodes)
    # writeNodes.extend(writeGeoNodes)

    for node in writeNodes:
        filename = nuke.filename(node)
        filename = filename.replace('\\', '/')
        Mnode = node.fullName()

        print "    RENDERING NODE : %s" % node.fullName()
        framerange['firstframe'] = node.firstFrame()
        framerange['lastframe'] = node.lastFrame()
        framerange['byframe'] = 1

        info[Mnode] = framerange
        print '"    RENDERING NODE : %s---%s-%s"' % (
            node.fullName(), node.firstFrame(), node.lastFrame())

    print "\nSEARCHING RENDER WRITES......."

    if info is not None:

        # Mjsonfile = RVLIB.store(INF,info)
        #
        # data = RVLIB.load(INF)
        # print data
        print "before write to txt \n%s" % (info)
        with open(INF, 'w') as analysefile:
            analysefile.write(str(info))

        with open(INF, 'r') as rfile:
            lines = rfile.readlines()
            for line in lines:
                print line
            print "write success!_____________________________________________"
    else:
        print("Warning: there is not any write in this file!..............")
    def process(self, context):
        import nuke

        root = nuke.Root()
        first_frame = root.firstFrame()
        last_frame = root.lastFrame()
        fps = root.fps()

        context.data["startFrame"] = first_frame
        context.data["endFrame"] = last_frame
        context.data["fps"] = fps

        context.data["label"] += " [%d-%d]" % (first_frame, last_frame)
        context.data["label"] += " %d FPS" % fps

        self.log.info("Global range: %d-%d" % (first_frame, last_frame))
        self.log.info("Global FPS: %d" % fps)
예제 #20
0
파일: Name.py 프로젝트: kuchinal/lamakaha
def NameScanLineWindows():
    import nuke, os, sys, pyperclip
    plat = sys.platform
    nkFullPath = nuke.Root().knob('name').getValue()
    nkPath, nkName = os.path.split(nkFullPath)
    nkPath += "/"

    Name = nkName.rpartition(".")[0]
    print Name
    m = nuke.menu('Nuke')
    m.addMenu(Name).addCommand(
        'Copy Shot',
        'copy2clip(nuke.Root().name().rpartition("/")[2].rpartition("_")[0])',
        icon="my.png")
    m.addMenu(Name).addCommand('Slapcomps',
                               'ReadnamesSlapcomp.ReadnamesSlapcomp()',
                               icon="my.png")
예제 #21
0
def make_relative():
    PD = nuke.Root().knob("project_directory").value() 
    
    def relative():
        This = nuke.thisNode()
        sourceFile = This['file'].getValue()
        tempPath = sourceFile.split(PD)
        readname = tempPath[-1]
        fn = readname.split('./')
        print fn
        This['file'].setValue('./' + fn[-1])
    
    if not PD:
        nuke.message('Empty Project Directory in Project Settings')
    else:
        relative()
        print PD
예제 #22
0
def BGRender():
    write = nuke.selectedNode()
    Name  = write['name'].value()
    first  = nuke.toNode("root")['first_frame'].value()
    first = int(first)
    first = str(first)
    last  = nuke.toNode("root")['last_frame'].value()
    last = int(last)
    last = str(last)
    G = path = nuke.env['ExecutablePath']    # nuke location
    Y = nuke.Root().knob('name').getValue()       # project name
    panel = nuke.Panel("BG Render")
    panel.addSingleLineInput("Run Me:",u"\u0022" +  G + u"\u0022" +  " -X "+ " " + Name+" " + Y + " "  +  first + ","+ last )
    panel.setWidth(700)
    panel.show()
    nuke.scriptSave()
    nukescripts.start("C:\WINDOWS\system32\cmd.exe")
예제 #23
0
파일: base.py 프로젝트: tws0002/Nuke-2
    def output(self, filename):
        """Save .nk file and render .jpg file."""

        LOGGER.info('{:-^30s}'.format('开始 输出'))
        _path = filename.replace('\\', '/')
        _dir = os.path.dirname(_path)
        if not os.path.exists(_dir):
            os.makedirs(_dir)

        # Save nk
        LOGGER.info('保存为:\t%s', _path)
        nuke.Root()['name'].setValue(_path)
        nuke.scriptSave(_path)

        # Render png
        if CONFIG.get('RENDER_JPG'):
            for n in nuke.allNodes('Read'):
                name = n.name()
                if name in ('MP', 'Read_Write_JPG'):
                    continue
                for frame in (n.firstFrame(), n.lastFrame(),
                              int(nuke.numvalue('_Write.knob.frame'))):
                    try:
                        render_png(n, frame)
                        break
                    except RuntimeError:
                        continue

        # Render Single Frame
        n = nuke.toNode('_Write')
        if n:
            n = n.node('Write_JPG_1')
            n['disable'].setValue(False)
            for frame in (int(nuke.numvalue('_Write.knob.frame')),
                          n.firstFrame(), n.lastFrame()):
                try:
                    nuke.execute(n, frame, frame)
                    break
                except RuntimeError:
                    continue
            else:
                self._errors.append('{}:\t渲染出错'.format(
                    os.path.basename(_path)))
                raise RenderError('Write_JPG_1')
            LOGGER.info('{:-^30s}'.format('结束 输出'))
예제 #24
0
def make_relative_Toolbar():
    PD = nuke.Root().knob("project_directory").value() 
    This = nuke.selectedNodes()
    if not PD:
        nuke.message('Empty Project Directory in Project Settings')
    else:
        for each in This:
            if each.Class() in ('Read', 'ReadGeo2'):
                def relative():
                    sourceFile = each['file'].getValue()
                    tempPath = sourceFile.split(PD)
                    readname = tempPath[-1]
                    fn = readname.split('./')
                    print fn
                    each['file'].setValue('./' + fn[-1])
                relative()
            else:
                 pass
예제 #25
0
def makeThumbnail():

    frameFirst = str('%0*d' % (4, int(nuke.Root()['first_frame'].value())))
    for node in nuke.selectedNodes('Write'):
        fileName = node['file'].value()
        FirstFramefileName = fileName.replace("%04d", frameFirst)
        NewFileName = fileName.rsplit(
            '/', 1)[0] + '/.' + node['file'].value().split('/')[-1]
        FirstFrameNewFileName = NewFileName.replace("%04d", "thumbnail")
        ext = FirstFrameNewFileName.split('.')[-1]
        FirstFrameNewFileName = FirstFrameNewFileName.replace(ext, "jpg")
        ThePath = os.getenv("CYC_ENGINE_NUKE") + '/NukeTools_1.01'
        TheNukeVersion = os.getenv('NUKEVERSION')
        IMCmd = (('nuke%s -t %s/Python/convert.py %s %s') %
                 (TheNukeVersion, ThePath, FirstFramefileName,
                  FirstFrameNewFileName))
        os.system(IMCmd)
        print "the file: ", FirstFrameNewFileName, "has been created!"
예제 #26
0
def SmartOffset():
    r = nuke.Root().knob('first_frame').getValue()
    n = nuke.selectedNode()
    o = n.Class()
    if o == "Read":
        t = n['first'].getValue()
        u = n['last'].getValue()
        b = u - t
        b = int(b)
        shot = str(b)
        y = nuke.createNode("TimeOffset")
        y['time_offset'].setValue(-t + r)
        n['postage_stamp'].setValue(0)
        y['postage_stamp'].setValue(0)
        n['label'].setValue(shot + " frames")
        y['label'].setValue(shot + " frames")
    else:
        nuke.createNode("TimeOffset")
예제 #27
0
def setupFromMasterScirpt(keyPrjData, extraJobData, nkFile, masterScriptPath):
    nuke.scriptOpen(masterScriptPath)
    root = nuke.Root()

    metaNode = setupMetadataNode(keyPrjData)
    srcReadNode = setupSrcReadNode(keyPrjData)
    dnsWriteNode = setupDnsWriteNode(keyPrjData)
    setupDnsReadNode(dnsWriteNode)
    setupHresWriteNode(keyPrjData, srcReadNode)
    setupHresReadNode(srcReadNode)
    dliesWriteNode = setupDliesWriteNode(keyPrjData)

    prmReadNode = setupPrmReadNode(keyPrjData)
    setupDliesReadNode(dliesWriteNode, prmReadNode)

    setFrameRange(extraJobData.get('frames'), root,
                  prmReadNode['file'].value(), metaNode)
    saveInitNkScript(nkFile)
예제 #28
0
    def __init__(self, target_dir, Progress_Main=None, show_Progress=None):
        self._read_list = ['Read', 'ReadGeo2', 'Camera2', 'SmartVector', 'DeepRead']
        self.target_dir = target_dir
        self.Progress_Main = Progress_Main
        self.show_Progress = show_Progress
        self.config = config.config
        self.m_dir = self.config["m_dir"]
        self.p_dir = self.config["p_dir"]
        self.g_dir = self.config["g_dir"]
        self._relative_path = '[python {nuke.script_directory()}]'

        # current project path
        current_project = nuke.Root().name()
        proj_path = os.path.splitext(current_project)
        self._nuke_proj = current_project
        self._proj_name = (os.path.split(proj_path[0]))[1]
        self._proj_basename = os.path.basename(current_project)
        self._proj_path = os.path.dirname(current_project)
예제 #29
0
 def __init__(self):
     super(NukeToArchive, self).__init__()
     script_dir = os.path.dirname(__file__)
     profile = joinpath(script_dir, 'profile.ini')
     nuke_file = nuke.Root().name()
     if not nuke_file:
         nuke.message('Please save your nuke script first.')
     self.source_dir = os.path.dirname(nuke_file)
     if os.path.exists(profile):
         cf = ConfigParser.ConfigParser()
         cf.read(profile)
         self.source_dir = cf.get("root", "path")
     self.task = None
     self.base_name = os.path.basename(nuke_file).split('.')[0]
     self.pack_dir = joinpath(self.source_dir, self.base_name)
     self.nuke_version = nuke.NUKE_VERSION_STRING
     if not os.path.exists(self.pack_dir):
         os.makedirs(self.pack_dir)
     self.pack_ = '[file dirname [value root.name]]/'
예제 #30
0
def _add_root_info():
    """add info to root.  """

    artist = nuke.value('preferences.wlf_artist', '')
    if not artist:
        return
    if not nuke.exists('root.wlf'):
        n = nuke.Root()
        k = nuke.Tab_Knob('wlf', b'吾立方')
        k.setFlag(nuke.STARTLINE)
        n.addKnob(k)

        k = nuke.String_Knob('wlf_artist', b'制作人')
        k.setFlag(nuke.STARTLINE)
        k.setValue(artist)
        n.addKnob(k)
    else:
        if nuke.exists('root.wlf_artist') and not nuke.value('root.wlf_artist', ''):
            nuke.knob('root.wlf_artist', artist)