コード例 #1
0
    def exportHotboxArchive(self):

        #create zip
        archiveLocation = os.getenv('HOME') + '/.nuke/hotboxArchive_%s'%datetime.datetime.now().strftime('%Y%m%d%H%M') + '.tar.gz'


        with tarfile.open(archiveLocation, "w:gz") as tar:
            tar.add(self.rootLocation, arcname=os.path.basename(self.rootLocation))

        #encode
        archive = open(archiveLocation)
        archiveContent = archive.read()
        archive.close()

        if self.clipboardArchive.isChecked():
            encodedArchive = base64.b64encode(archiveContent)
            #save to clipboard
            QtGui.QApplication.clipboard().setText(encodedArchive)

        else:
            #save to file
            exportFileLocation = nuke.getFilename('Export Archive', '*.hotbox')
            if exportFileLocation == None:
                return

            if not exportFileLocation.endswith('.hotbox'):
                exportFileLocation += '.hotbox'

            shutil.copy(archiveLocation, exportFileLocation)

        #delete archive
        os.remove(archiveLocation)
コード例 #2
0
ファイル: setProjDir.py プロジェクト: jeangjenq/setProjDir
def setProjDir(var):
    # launch selectNodesPanel first to acquire list of nodes to affect, if any
    changeNodes = selectNodesPanel()
    if changeNodes is not None:
        if var == 0:
            try:
                filepath = os.path.dirname(
                    nuke.getFilename('Set Project Directory'))
            except (TypeError, ValueError):
                nuke.message('Project directory not set!')
        elif var == 1:
            filepath = '[join [lrange [split [file dirname [knob root.name]] "/"] 0 end-0] "/"]'
        elif var == 2:
            filepath = '[join [lrange [split [file dirname [knob root.name]] "/"] 0 end-1] "/"]'
        elif var == 3:
            filepath = '[join [lrange [split [file dirname [knob root.name]] "/"] 0 end-2] "/"]'
        elif var == 4:
            filepath = '[join [lrange [split [file dirname [knob root.name]] "/"] 0 end-3] "/"]'
        else:
            filepath = '[join [lrange [split [file dirname [knob root.name]] "/"] 0 end-4] "/"]'
        newPath = nuke.tcl('return ' + filepath)

        # replace file paths in list of nodes acquired above to relative file paths
        for n in changeNodes:
            searchReplaceProjDir(newPath, n)
        # set project directory to selected path as above
        nuke.root().knob("project_directory").setValue(filepath)
コード例 #3
0
ファイル: nkPsdTo25.py プロジェクト: kybin/nuke-script
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)
コード例 #4
0
ファイル: _load.py プロジェクト: gobomus/toolset
 def __init__(self):
         global rootPath
         pLoc = UI_enumerationSelect(['web','local'], '_load.json file location?' )
         if pLoc.showModalDialog():
             selectedLocationLabel = pLoc.typeKnob.value()
         if selectedLocationLabel=='local':
             rootPath = os.path.split(nuke.getFilename('Select _load.json', '_load.json'))[0]
コード例 #5
0
ファイル: marvel.py プロジェクト: hellozee/nuke-scripts
def main():
    images = nuke.getFilename("Select Images",
                              '*.png *.jpg *.jpeg',
                              multiple=True)

    length = len(images)
    if length < 2:
        nuke.warning("At least 2 images required to create the effect")
        nuke.message("At least 2 images required to create the effect")
        return

    merge = manipulate_node(images[0], 0)
    i = 1

    while i < length:
        node = manipulate_node(images[i], i)
        merge = nuke.nodes.Merge(inputs=[merge, node])
        i += 1

    # A generic touch to make it similar to the original one,
    # a trick which really makes difference, have to play with
    # the shutter samples for more accuracy
    motionblur = nuke.nodes.MotionBlur()
    motionblur.setInput(0, merge)

    # For keeping track of the nodegraph if you have too many pictures
    motionblur.setSelected(True)
コード例 #6
0
ファイル: ingest.py プロジェクト: sashaouellet/NukeIngest
	def handleEDLImport(self):
		file = nuke.getFilename('Import EDL', pattern='*.edl')
		fps = self.ui.CMB_fps.currentText()
		parser = Parser(fps)

		if not file or not os.path.exists(file) or os.path.isdir(file):
			return

		with open(file) as f:
			edl = parser.parse(f)

			for event in edl.events:
				start, end = event.src_start_tc.frame_number, event.src_end_tc.frame_number
				clip = event.reel
				eventFootage = None

				for root, dirnames, filenames in os.walk(self.baseDir):
					for filename in fnmatch.filter(filenames, clip + '.*'):
						eventFootage = os.path.join(root, filename)

				if not eventFootage:
					nuke.message('Unable to find matching footage in specified base directory (or any of its children), aborting.')
					return

				self.handleFootageImport(files=[eventFootage])

				shots = self.shotConfig.get(eventFootage, [])
				_, frameOffset = self.reads.get(eventFootage, (None, 0))

				shots.append(ShotListItemWidget(int(event.num) * 100, startFrame=start-frameOffset, endFrame=end-frameOffset)) # TODO configuration for shot number padding

				self.shotConfig[eventFootage] = shots
コード例 #7
0
def save_versioned():
    try:
        filename = nuke.scriptName()
    except:
        filename = nuke.getFilename('Save As script', '*.nk')

    SaveVersion_Publish(filename, save_nuke)
コード例 #8
0
ファイル: cdl.py プロジェクト: rexbron/OpenColorIO
def import_multiple_from_ccc(filename=None):
    """Import a ColorCorrectionCollection file (.ccc) into multiple
    OCIOCDLTransform nodes. Also creates a single node for a .cc file
    """

    if filename is None:
        filename = nuke.getFilename("Color Correction XML file",
                                    pattern="*.cc *.ccc")
        if filename is None:
            # User clicked cancel
            return

    xml = open(filename).read()
    allcc = _xml_to_cdltransforms(xml)

    def _make_node(cdl):
        newnode = nuke.nodes.OCIOCDLTransform(inputs=nuke.selectedNodes()[:1])
        _cdltransform_to_node(cdl, newnode)
        newnode['label'].setValue("id: [value cccid]")

    if len(allcc) > 0:
        for cc in allcc:
            _make_node(cc)
    else:
        nuke.message("The supplied file (%r) contained no ColorCorrection's" %
                     filename)
コード例 #9
0
def main():
    cam = nuke.getFilename('select Maya File', '*.ma')
    #cam='E:/Desktop/trash/testAnim.ma'
    fileObject = open(cam, "r")
    contents = fileObject.read()
    fileObject.close()

    sceneData = {}
    currentObj = ''
    currentAttr = ''
    chunkStart = 0
    chunk = ''
    for line in contents.split('\n'):
        if 'createNode' in line:
            cmd, typ, fl, name = line.split(" ")[:4]
            name = name.strip("\";")
            nameparts = name.split("_")
            if len(nameparts) > 1:
                obj = "_".join(nameparts[:-1])
                attr = nameparts[-1]
                if attr in transformAttrs:
                    currentObj = obj
                    currentAttr = attr
        if "ktv[" in line and currentAttr:
            chunkStart = 1
        if chunkStart:
            lineFiltered = line.strip("\t;")
            chunk += lineFiltered
        if chunkStart and ";" in line:
            if not currentObj in sceneData.keys():
                sceneData[currentObj] = {}
            if not currentAttr in sceneData[currentObj].keys():
                sceneData[currentObj][currentAttr] = []
            keys = chunk.split("]\"  ")[1]
            keys = keys.split(" ")
            for i, k in enumerate(keys):
                if i % 2 == 0:
                    sceneData[currentObj][currentAttr].append(k + ":" +
                                                              keys[i + 1])
            chunk = ''
            chunkStart = 0
            currentAttr = ''

    transforms = sceneData.keys()
    transforms.sort()
    p = nuke.Panel('import transforms', scrollable=True)
    p.addEnumerationPulldown('transform1', ' '.join(transforms))
    p.addEnumerationPulldown('transform2', ' '.join(transforms))
    p.addEnumerationPulldown('transform3', ' '.join(transforms))
    p.addEnumerationPulldown('transform4', ' '.join(transforms))
    p.addEnumerationPulldown('transform5', ' '.join(transforms))
    ret = p.show()

    if ret:
        createTransform(p.value('transform1'), sceneData)
        createTransform(p.value('transform2'), sceneData)
        createTransform(p.value('transform3'), sceneData)
        createTransform(p.value('transform4'), sceneData)
        createTransform(p.value('transform5'), sceneData)
    '''
コード例 #10
0
ファイル: ingest.py プロジェクト: sashaouellet/NukeIngest
	def handleFootageImport(self, files=[]):
		if not files:
			files = nuke.getFilename('Import footage', pattern=' '.join(IngestPanel.FOOTAGE_FORMATS), multiple=True)

		if not files:
			return

		for file in files:
			if file in self.footage:
				return

			self.footage.append(file)
			self.ui.LST_files.addItem(file)

			read = nuke.nodes.Read()

			read['file'].fromUserText(file)

			fps = self.ui.CMB_fps.currentText()
			viewerNode = nuke.activeViewer().node()
			viewerStart, viewerEnd = viewerNode.knob('frame_range').value().split('-')

			viewerNode.knob('frame_range').setValue('0-{}'.format(viewerEnd)) # Set viewer so start frame is 0
			nuke.activeViewer().frameControl(-6) # Set it so the viewer is actually at 0 prior to querying the timecode metadata

			frameOffset = Timecode(fps, read.metadata().get('r3d/absolute_time_code', '00:00:00:00')).frame_number

			self.reads[file] = (read, frameOffset)
コード例 #11
0
	def getNkFile(self):
		sw1 = 0
		self.nkFile = nuke.getFilename('Select exported group nodes .nk files','*.nk',multiple=True)																			# get list of .nk
		if ((self.nkFile[0] == "") or isinstance(self.nkFile[0] ,NoneType) or not (os.path.isfile(self.nkFile[0] ))):
#			print 'Select File ( multiple ) ...'
			sw1 = 1
		return sw1
コード例 #12
0
 def __data(self):
     # nuke.message("File better be jpg file")
     path = nuke.getFilename("File better be jpg file")
     limit = nuke.getInput("set the width to scale")
     if not int(limit):
         nuke.message("Wrong Type")
     self.adult_dict = {}
     img = QImage(path)
     img = img.scaledToWidth(int(limit))
     width, height = img.width(), img.height()
     scale = 255
     id = 0
     for y in range(0, height):
         for x in range(0, width):
             id += 1
             c = img.pixel(x, y)
             r, g, b, a = QColor(c).getRgbF()
             r, g, b, a = r * scale, g * scale, b * scale, a * scale
             color = int('%02x%02x%02x%02x' % (r, g, b, a), 16)
             xa = x * 10
             ya = y * 10
             self.adult_dict[id] = {"pos": (xa, ya), "color": color}
         id = id + 1
         self.adult_dict[id] = None
     print(self.adult_dict)
コード例 #13
0
def Mocha_AE_Import():

  #Open textfile with tracking data
  
  textfile = nuke.getFilename('Open Mocha File', '*.txt')
  
  if textfile:
      text = open(textfile, 'r')
  
  
      #Create CornerPin node
  
      myNode = nuke.createNode('CornerPin2D')
      myNode.knob('label').setValue('Mocha Track')
  
  
      #Initialize variables
  
      corner_number = 0
  
  
      #Work through textfile
  
      for line in text:
          line = re.split(r'[ \t\n]', line.rstrip('\n'))
  
          if len(line) > 2:
  
  
              #Use tracking data for animation
  
              if str(line[1]).isdigit():
                  time = float(line[1])
                  x_value = float(line[2])
                  y_value = height - float(line[3])
  
                  myNode.knob(corner).setValueAt(x_value, time, 0)
                  myNode.knob(corner).setValueAt(y_value, time, 1)
  
  
              #Get height of tracked video
  
              elif str(line[2]) == 'Height':
                  height = float(line[3])
  
  
              #Pick corner
  
              elif str(line[1]) == 'ADBE':
                  corner_number = corner_number + 1
                  corner = 'to' + str(corner_number)
  
                  if corner == 'to3':
                      corner = 'to4'
  
                  elif corner == 'to4':
                      corner = 'to3'
  
                  myNode.knob(corner).setAnimated()
コード例 #14
0
def lutCheck():
    lutPath = outputPath(lutDestFolder)
    try:
        lutDest = nuke.getFilename('Select Latest LUT', default=lutPath)
        if isinstance(lutDest, str) is True:
            nuke.thisNode()['lutFile'].setValue(lutDest)
    except TypeError:
        pass
コード例 #15
0
ファイル: tools.py プロジェクト: Wizard-collab/Wizard
def getFilePath():

    path = nuke.getFilename("Aov's path", '*.exr', 'D:/')
    path = path.split('/')
    path.pop(-1)
    path = ('/').join(path) + '/'

    return path
コード例 #16
0
ファイル: mocha_import.py プロジェクト: z199416/nuke.env
def _getfilename():
    """
    Asks user for the filename to be imported.  Filters the import routine to just the acceptable file types.
    """
    filename = nuke.getFilename(
        "Mocha Tracking Export (Nuke ASCII or Shake Format)",
        "*_Tracker?.txt;*.shk")
    return filename
コード例 #17
0
ファイル: Organize.py プロジェクト: l690170170/QC_vfx_nuke
def addIcons():
    if not nuke.selectedNodes():
        mynodes = nuke.allNodes()
    else:  
        mynodes = nuke.selectedNodes()
    path = nuke.getFilename('file name string', '*.png;*.jpg;*.jpeg;*.tif;*.tiff')
    for i in mynodes:
        i.knob('icon').setValue(path)
コード例 #18
0
def lutCheck():
    lutPath = outputPath(lutDestFolder)
    try:  
        lutDest = nuke.getFilename('Select Latest LUT', default= lutPath)
        if isinstance(lutDest, str) is True:
            nuke.thisNode()['lutFile'].setValue(lutDest)
    except TypeError:
        pass
コード例 #19
0
ファイル: _load.py プロジェクト: sandrohenriques/toolset
 def __init__(self):
     global rootPath
     pLoc = UI_enumerationSelect(['web', 'local'],
                                 '_load.json file location?')
     if pLoc.showModalDialog():
         selectedLocationLabel = pLoc.typeKnob.value()
     if selectedLocationLabel == 'local':
         rootPath = os.path.split(
             nuke.getFilename('Select _load.json', '_load.json'))[0]
コード例 #20
0
	def getfbxCam(self):
		'''
		get fbx camera file from user and validate
		'''
		sw1 = 0
		self.fbxCamFile = nuke.getFilename('Camera Node will appear on top of network ...','cam*.fbx')																											 # camera
		if ((self.fbxCamFile == "") or isinstance(self.fbxCamFile ,NoneType) or not (os.path.isfile(self.fbxCamFile))):
			sw1 = 1
		return sw1
コード例 #21
0
 def getNkFile(self):
     sw1 = 0
     self.nkFile = nuke.getFilename('fg bg mg .nk file',
                                    '*.nk',
                                    multiple=True)  # get list of .nk
     if ((self.nkFile[0] == "") or isinstance(self.nkFile[0], NoneType)
             or not (os.path.isfile(self.nkFile[0]))):
         sw1 = 1
     return sw1
コード例 #22
0
    def importScriptEditor(self):
        '''
        Set the current content of the script editor by importing an existing file. 
        '''

        if self.loadedScript != None:

            importFile = nuke.getFilename('select file to  import','*.py *.json')
            self.scriptEditorScript.setPlainText(open(importFile).read())
コード例 #23
0
def Change():
    ''' Changes the repository path from user input. '''

    #prompt user for repository path
    repoPath = nuke.getFilename('Locate Tapp repository.')

    #changes repository path
    if repoPath != None:
        __change__(repoPath)
コード例 #24
0
ファイル: repository.py プロジェクト: leandropim/Tapp
def Change():
    ''' Changes the repository path from user input. '''
    
    #prompt user for repository path
    repoPath=nuke.getFilename('Locate Tapp repository.')
    
    #changes repository path
    if repoPath!=None:
        __change__(repoPath)
コード例 #25
0
	def getfbxGroup(self):
		'''
		get fbx group files from user and validate
		'''
		sw1 = 0
		self.fbxFile = nuke.getFilename('fg bg mg .fbx file', '*g.fbx',multiple=True)
		if ((self.fbxFile[0] == "") or isinstance(self.fbxFile[0] ,NoneType) or not (os.path.isfile(self.fbxFile[0] ))):
			sw1 = 1
		return sw1
コード例 #26
0
 def _browse_gizmo(self):
     import nuke
     title = 'Please select a Gizmo file...'
     file = nuke.getFilename(title, default=self._browser_edit.text())
     if file != None:
         if os.path.isfile(file):
             self._browser_edit.blockSignals(True)
             self._browser_edit.setText(file)
             self._browser_edit.blockSignals(False)
             self.set_gizmo_file(file)
コード例 #27
0
	def getfbxCam(self):
		'''
		get fbx camera file from user and validate
		'''
		sw1 = 0
		self.fbxCamFile = nuke.getFilename('Get Fbx Camera File ...','cam*.fbx')																				# camera
		print 'self.fbxCamFile : ',self.fbxCamFile,'\n'
		if ((self.fbxCamFile == "") or isinstance(self.fbxCamFile ,NoneType) or not (os.path.isfile(self.fbxCamFile))):
			sw1 = 1
		return sw1
コード例 #28
0
def tcl_file():
    try:
        s = nuke.getFilename("Source Script", "*.tcl;*.nk;*.py", "", "script")
        (root, ext) = os.path.splitext(s)
        if ext == ".py":
            execfile(s)
        else:
            nuke.tcl('source', s)
    except:
        pass
コード例 #29
0
 def getNkFile(self):
     sw1 = 0
     self.nkFile = nuke.getFilename('Select exported group nodes .nk files',
                                    '*.nk',
                                    multiple=True)  # get list of .nk
     if ((self.nkFile[0] == "") or isinstance(self.nkFile[0], NoneType)
             or not (os.path.isfile(self.nkFile[0]))):
         #			print 'Select File ( multiple ) ...'
         sw1 = 1
     return sw1
コード例 #30
0
 def knobChanged(self, knob):
     if knob.name() == 'Login':
         self.email = self.inp_email.value()
         self.localDir = self.inp_localDir.value()
         # write login.txt
         self.createLogin()
         self.status = 'online'
         self.ok()
     elif knob.name() == 'Set Working Dir':
         self.inp_localDir.setValue(
             os.path.abspath(
                 nuke.getFilename(
                     'Navigate to Local Working Directory...')))
     elif knob.name() == 'Project Location':
         self.inp_projectLocation.setValue(
             os.path.abspath(
                 nuke.getFilename(
                     'Navigate to Remote \'Root\' Project Directory...')))
     return
コード例 #31
0
ファイル: importexport.py プロジェクト: sgadsden/_NukeStudio
def import_script():
    try:
        if nuke.env['nc']:
            spec = "*.nk; *.nknc; *.gizmo; *.gznc"
        else:
            spec = "*.nk; *.gizmo"
        s = nuke.getFilename("Import Script", spec, "", "script")
        nuke.nodePaste(s)
    except:
        pass
コード例 #32
0
def setPath():
    gizmosPath=nuke.getFilename('Locate Gizmos directory.')
    
    if gizmosPath:
        data={}
        data['gizmosPath']=gizmosPath
        f=open(os.path.dirname(__file__)+'/'+'config.yml','w')
        uy.dump(data, f)
        f.close()
        
        gizmoMenuItems(gizmosPath)
コード例 #33
0
def export_framecurve_from_this_knob():
    fc_path = nuke.getFilename("Name the framecurve file to write to", "*.framecurve.txt", default="shot.framecurve.txt", favorites="", type="", multiple=False)
    fc = framecurve.Curve()
    
    curve_name_with_suffix = nuke.animations()[0]
    knob_name = curve_name_with_suffix.split(".")[0]
    this_knob = nuke.thisNode()[knob_name]
    with open(fc_path, "w") as fc_file:
        for curve in nuke.animations():
            for frame in all_script_frames():
                fc.append(framecurve.FrameCorrelation(at=frame, value=this_knob.getValueAt(frame)))
            framecurve.serialize(fc_file, framecurve.simplify(fc))
コード例 #34
0
def saveFrame(filePath = ""):
    viewer = nuke.activeViewer()
    inputNode = nuke.ViewerWindow.activeInput(viewer)
    viewNode = nuke.activeViewer().node()

    if inputNode != None:
        selInput = nuke.Node.input(viewNode, inputNode)

        if filePath == "":
            filePath = nuke.getFilename('Save File', "*.png *.jpg *.tga *.exr *.dpx", type = 'save')
        
        filePath = os.path.normpath(filePath)
コード例 #35
0
    def getfbxCam(self):
        '''
		get fbx camera file from user and validate
		'''
        sw1 = 0
        self.fbxCamFile = nuke.getFilename('Get Fbx Camera File ...',
                                           'cam*.fbx')  # camera
        print 'self.fbxCamFile : ', self.fbxCamFile, '\n'
        if ((self.fbxCamFile == "") or isinstance(self.fbxCamFile, NoneType)
                or not (os.path.isfile(self.fbxCamFile))):
            sw1 = 1
        return sw1
コード例 #36
0
    def browseDir(self):
        '''open file browser for draft module location'''

        dir_browse = nuke.getFilename("Pick direcory for modules",
                                      pattern='*/', default=self.path.text())
        if dir_browse:
            self.path.setText(dir_browse)
            self.file.clear()
            self.file.addItems(listFiles(dir_browse))
        else:
            self.path
        self.raise_()
コード例 #37
0
def assembleScript(dstPath=None):
    
    log = ""
    
    if not dstPath:
        dstPath = nuke.getFilename("Select Destination Path")
    
    
    
    addLogLine(log, "--[ Und Los! ]--")
    
    # copy Files
    
    # Selected Outs
    for node in nuke.selectedNodes():
        if node.Class() == "Write":
            log = addLogLine(log, copyNodeFileTo(node, dstPath, "outs"))
    
    
    # Reads
    for node in nuke.allNodes():
        if node.Class() != "Write":
            log = addLogLine(log, copyNodeFileTo(node, dstPath, "source"))
    
    for group in nuke.allNodes('Group'):
        with group:
            for node in nuke.allNodes():
                if node.Class() != "Write":
                    log = addLogLine(log, copyNodeFileTo(node, dstPath, "source"))
    

    # Save Script
    nr = nuke.root()
    
    nr["project_directory"].setValue("[python {nuke.script_directory()}]")
    
    scriptpath, scriptname = os.path.split(nr["name"].getValue())
    
    if scriptname =="":
        scriptname = "shotscript_v01.nk"
    
    try:
        os.makedirs(os.path.join(dstPath, "setup"))
    except:
        pass
    
    nuke.scriptSaveAs(os.path.join(dstPath, "setup", scriptname) )
    
    # Fettig
    
    log = addLogLine(log, "--[ fin ]--")
    
    nuke.message(log)
コード例 #38
0
    def getfbxGroup(self):
        '''
		get fbx group files from user and validate
		'''
        sw1 = 0
        self.fbxFile = nuke.getFilename('fg bg mg .fbx file',
                                        '*g.fbx',
                                        multiple=True)
        if ((self.fbxFile[0] == "") or isinstance(self.fbxFile[0], NoneType)
                or not (os.path.isfile(self.fbxFile[0]))):
            sw1 = 1
        return sw1
コード例 #39
0
    def getfbxCam(self):
        '''
		get fbx camera file from user and validate
		'''
        sw1 = 0
        self.fbxCamFile = nuke.getFilename(
            'Camera Node will appear on top of network ...',
            'cam*.fbx')  # camera
        if ((self.fbxCamFile == "") or isinstance(self.fbxCamFile, NoneType)
                or not (os.path.isfile(self.fbxCamFile))):
            sw1 = 1
        return sw1
コード例 #40
0
ファイル: nukeGraph.py プロジェクト: lbmk27/maya_python
def generateNukeScript():
    """
    Main initialization of the program starts here.
    Pops up with a Open file dialog to browse the JSON file and then creates all the necessary nodes
    :return:
    """
    fileName = nuke.getFilename("Open JSON file", '*.json')
    if fileName:
        output = readJSON(fileName)

    dirPath = os.path.dirname(os.path.abspath(fileName))

    createNukeNodesFromPasses(output, dirPath)
コード例 #41
0
ファイル: dag.py プロジェクト: cheekynie/nuke-config
def export_selected_nodes():
    path = nuke.getFilename("Export Selected To:")
    if not path:
        return
    nuke.nodeCopy(path)
    root = nuke.root()
    rootstring = root.writeKnobs(nuke.TO_SCRIPT | nuke.WRITE_USER_KNOB_DEFS)
    rootstring = "%s\nfirst_frame %d\nlast_frame %d" % (rootstring, root['first_frame'].value(), root['last_frame'].value())
    rootstring = "%s\nproxy_format \"%s\"" % (rootstring, root['proxy_format'].toScript())
    rootstring = "Root {\n%s\n}" % rootstring
    noroot = open(path).read()
    with open(path, "w+") as f:
        f.write((rootstring + "\n" + noroot))
コード例 #42
0
ファイル: lookup.py プロジェクト: jjgalloway/colour-nuke
def import_curves_data_csv_file():
    """
    Import user curves data CSV file as a *Nuke* *ColorLookup* node.

    Returns
    -------
    ColorLookup
        ColorLookup node.
    """

    file = nuke.getFilename('Choose ColorLookup Node Curves Data CSV File',
                            '*.csv')
    if file is not None:
        if os.path.exists(file):
            return color_lookup_node(file)
コード例 #43
0
def combineImagesWithUVsShellsIdentifiers():
	"""
	This definition combines images with UVs shells identifiers.

	:return: Definition success. ( Boolean )
	"""

	directory = nuke.getFilename("Choose a directory containing images with UVs shells identifiers to combine!", multiple=False)
	if not directory: return
	if not os.path.exists(directory): return

	directory = os.path.isfile(directory) and os.path.dirname(directory) or directory
	files = glob.glob("{0}/*{1}".format(directory, GLOB_FILTER))

	return getUVsShellsSiblingsTrees(files, directory, OUTPUT_FILE_FORMAT) and True or False
コード例 #44
0
ファイル: pathmap.py プロジェクト: AlbertR/cgru170
def pmOpenTranslated():
	print('Opening scene with paths map...')

	# Get scene name:
	scenename_server = nuke.getFilename('Select a scene','*.nk')
	if scenename_server is None: return

	tmp_scenes = []
	last_scene = scenename_server
	# Transfer scene paths to server from all patforms:
	for key in PMaps:
		tmp_scenes.append( scenename_server+'.'+key)
		print('Transfering from "%s" to "%s"' % ( key, os.path.basename( tmp_scenes[-1])))
		PMaps[key].toServerFile( last_scene, tmp_scenes[-1], SearchStrings, Verbose = True)
		last_scene = tmp_scenes[-1]

	error_msg = ''
	# Transfer scene paths from server clinet native patform:
	scenename_client = scenename_server + '.' + socket.gethostname() + '.nk'
	if PathMap.initialized:
		print('Transfering from server to "%s"' %  os.path.basename( scenename_client))
		PathMap.toClientFile( last_scene, scenename_client, SearchStrings, Verbose = True)
	else:
		print('No paths map preset. Just copying scene to:')
		print( scenename_client)
		try:
			shutil.copy( last_scene, scenename_client)
		except:
			error_msg = str(sys.exc_info()[1])
			print('File copied with error:')
			print( error_msg)
			error_msg = '\n' + error_msg

	# Remove temp scenes:
	for scene in tmp_scenes:
		try:
			os.remove( scene)
		except:
			print( str(sys.exc_info()[1]))
			print('Error removing "%s"' % scene)

	# Check if new scene exists:
	if not os.path.isfile(scenename_client):
		nuke.message('Client scene was not created.' + error_msg)
		return

	# Open client scene:
	nuke.scriptOpen( scenename_client)
コード例 #45
0
 def importCameraData(self, *args):
     fileLocation = nuke.getFilename('Import kCamera', '*.kCamera')
     
     try:
         f = open(fileLocation, 'rb')
     except TypeError:
         nuke.warning("No file selected..")
         return
     
     kCamData = []
     
     for i in range(2):
         kCamData.append(cPickle.load(f))
     f.close()    
     
     self.buildCamera(kCamData)
コード例 #46
0
ファイル: cdl.py プロジェクト: Br3nda/OpenColorIO
def export_multiple_to_ccc(filename = None):
    """Exported all selected OCIOCDLTransform nodes to a
    ColorCorrectionCollection XML file (.ccc)
    """

    if filename is None:
        filename = nuke.getFilename("Color Correction XML file", pattern = "*.cc *.ccc")
        if filename is None:
            # User clicked cancel
            return

    allcc = []
    for node in nuke.selectedNodes("OCIOCDLTransform"):
        allcc.append(_node_to_cdltransform(node))

    xml = _cdltransforms_to_xml(allcc)
    print "Writing %r, contents:\n%s" % (filename, xml)
    open(filename, "w").write(xml)
コード例 #47
0
ファイル: pathmap.py プロジェクト: Spudster3/cgru
def pmOpenFromServer():
   print 'Opening scene with server paths...'
   pm = PathMap( UnixSeparators = True, Verbose = True)

   # Get server scene name:
   scenename_server = nuke.getFilename('Select a scene with server paths','*.nk')
   if scenename_server is None: return

   # Get client scene name
   scenename_client = scenename_server
   clientname = CLIENT_PATHS_SUFFIX
   clientname += '-' + socket.gethostname()
   if scenename_client.find( SERVER_PATHS_SUFFIX) != -1:
      scenename_client = scenename_client.replace( SERVER_PATHS_SUFFIX, clientname)
   else:
      scenename_client += '.' + clientname + '.nk'

   # Map paths from server to client:
   error_msg = ''
   if pm.initialized:
      pm.toClientFile( scenename_server, scenename_client, SearchStrings, Verbose = True)
   else:
      print 'No paths map preset. Just copying scene to:'
      print scenename_client
      try:
         shutil.copy( scenename_server, scenename_client)
      except:
         error_msg = str(sys.exc_info()[1])
         print 'File copied with error:'
         print error_msg
         error_msg = '\n' + error_msg

   # Check if new scene exists:
   if not os.path.isfile(scenename_client):
      nuke.message('Client scene was not created.' + error_msg)
      return

   # Open client scene:
   nuke.scriptOpen( scenename_client)
コード例 #48
0
ファイル: cdl.py プロジェクト: Br3nda/OpenColorIO
def export_as_cc(node = None, filename = None):
    """Export a OCIOCDLTransform node as a ColorCorrection XML file
    (.cc)

    If node is None, "nuke.thisNode()" will be used. If filename is
    not specified, the user will be prompted.
    """

    if node is None:
        node = nuke.thisNode()

    cdl = _node_to_cdltransform(node)

    if filename is None:
        ccfilename = nuke.getFilename("Color Correction filename", pattern = "*.cc")
        if ccfilename is None:
            # User clicked cancel
            return

    xml = cdl.getXML()
    print "Writing to %s - contents:\n%s" % (ccfilename, xml)
    open(ccfilename, "w").write(xml)
コード例 #49
0
ファイル: python_applet.py プロジェクト: Southpaw-TACTIC/Team
    def open_file_browser(my, current_dir, select_dir=False):
        # FIXME: this is very specific to nuke.  Should have some kind of an
        # environment
        try:
            import nuke
            file_path = nuke.getFilename('Get File Contents')
        except ImportError:
            #from QtCore.QObject import tr

            # default to select files
            if not select_dir:
                caption = "Select File"
                file_paths = QtGui.QFileDialog.getOpenFileName(None,caption,current_dir)
                file_path = file_paths[0]

            else:
                caption = "Select Directory"
                file_path = QtGui.QFileDialog.getExistingDirectory(None,caption,current_dir)

            if not file_path.strip():
                return None

        return json.dumps([file_path])
コード例 #50
0
ファイル: cdl.py プロジェクト: Br3nda/OpenColorIO
def import_cc_from_xml(node = None, filename = None):
    """Import a ColorCorrection XML (.cc) into a OCIOCDLTransform node.

    If node is None, "nuke.thisNode()" will be used. If filename is
    not specified, the user will be prompted.
    """

    if node is None:
        node = nuke.thisNode()

    if filename is None:
        ccfilename = nuke.getFilename("Color Correction filename", pattern = "*.cc *.ccc")
        if ccfilename is None:
            # User clicked cancel
            return

    xml = open(ccfilename).read()

    allcc = _xml_to_cdltransforms(xml)

    if len(allcc) == 1:
        _cdltransform_to_node(allcc[0], node)
    elif len(allcc) > 1:
        do_selectcccid = nuke.ask(
            "Selected a ColorCorrectionCollection, do you wish to select a ColorCorrection from this file?")
        if do_selectcccid:
            sel = SelectCCCIDPanel(allcc)
            okayed = sel.showModalDialog()
            if okayed:
                cc = sel.selected()
                _cdltransform_to_node(cc, node)
        else:
            return
    else:
        nuke.message("The supplied file (%r) contained no ColorCorrection's" % ccfilename)
        return
コード例 #51
0
ファイル: cdl.py プロジェクト: Br3nda/OpenColorIO
def import_multiple_from_ccc(filename = None):
    """Import a ColorCorrectionCollection file (.ccc) into multiple
    OCIOCDLTransform nodes. Also creates a single node for a .cc file
    """

    if filename is None:
        filename = nuke.getFilename("Color Correction XML file", pattern = "*.cc *.ccc")
        if filename is None:
            # User clicked cancel
            return

    xml = open(filename).read()
    allcc = _xml_to_cdltransforms(xml)

    def _make_node(cdl):
        newnode = nuke.nodes.OCIOCDLTransform(inputs = nuke.selectedNodes()[:1])
        _cdltransform_to_node(cdl, newnode)
        newnode['label'].setValue("id: [value cccid]")

    if len(allcc) > 0:
        for cc in allcc:
            _make_node(cc)
    else:
        nuke.message("The supplied file (%r) contained no ColorCorrection's" % filename)
コード例 #52
0
ファイル: nk_gui.py プロジェクト: adrianloh/nk_module
def nk_read_nodes():
	"""
	Read nodes from file
	"""
	f = nuke.getFilename("Select nuke script to source nodes")
	nuke.scriptReadFile(f)
コード例 #53
0
ファイル: fcnuke.py プロジェクト: guerilla-di/framecurve_nuke
def grab_file():
    return nuke.getFilename(
        "Select the framecurve file", "*.framecurve.txt", default="/", favorites="", type="", multiple=False
    )
コード例 #54
0
ファイル: nukeConvertGUI.py プロジェクト: utsdab/usr
        def knobChanged(self,knob):

            if (knob == self.ok):
                #check all input boxes are valid
                allValid = False
                try:
                    #get values from the panel
                    source = self.sourceBox.value()
                    dest = self.destBox.value()
                    
                    if source != "" and dest != "" and os.path.isdir(source) and os.path.isdir(dest):
                        allValid = True

                except:
                    pass

                #cancel if values weren't valid
                if allValid == True:
    
                    #OK BUTTON PRESSED
                    self.result = 1
                    self.finishModalDialog(True)

                    if self.subfolders.value() == True:
                        sub = "-sub"
                    else:
                        sub = ""

                    if self.overwrite.value() == True:
                        overwrite = "-overwrite"
                    else:
                        overwrite = ""


                    #create terminal string
                    #eg:
                    #"gnome-terminal -x nuke -t /mnt/home/myUserName/.nuke/python/nukeConvert.py /mnt/home/myUserName/Desktop/origImages /mnt/home/myUserName/Desktop/convertedImages jpg -sub -overwrite -keepOpen"                    

                    theString = "gnome-terminal -x nuke -t %s %s %s %s %s %s -keepOpen" %(scriptPath,source,dest,self.formatChoice.value(),sub,overwrite)

                    #run it in a subprocess
                    #brings up a terminal and shows the output to the user
                    subprocess.Popen(theString, shell=True)
                    


                else:
                    nuke.message("Please check you have a valid source and destination.")

                
            elif (knob == self.cancel):
                #CANCEL BUTTON PRESSED
                self.result = 0
                self.finishModalDialog(True)



            elif (knob == self.findDir1):
                #findDir1 BUTTON PRESSED
                
                path = nuke.getFilename('Choose source folder', '*.*')
                path = os.path.dirname(path)
                self.sourceBox.setText(path)
              

            elif (knob == self.findDir2):
                pass
                #findDir2 BUTTON PRESSED
                
                path = nuke.getFilename('Choose destination folder', '*.*')
                path = os.path.dirname(path)
                self.destBox.setText(path)
コード例 #55
0
		self.am.setInput(0,self.rGeo)
		self.am.setInput(1,self.p3d)

		self.sNoteB = nuke.createNode('StickyNote', inpanel=False)
		self.sNoteB['label'].setValue('fbx export loads here')
		self.sNoteB.setXYpos( (bdN_Val_X + self.Incr + 50), (bdN_Val_Y + 440) )

		self.dotB = nuke.createNode("Dot", inpanel=False)
		self.dotB.setXYpos( (bdN_Val_X + self.Incr - 60)  , (bdN_Val_Y + 500) )
		self.dotB.setInput(0,self.am)
		self.scene.setInput(sCount,self.dotB)

		self.Incr = self.Incr + 500

# put validation for viewer
		curViewer = nuke.activeViewer()
		if not isinstance(curViewer,NoneType):
			viewerNode = curViewer.node()
			viewer = viewerNode.name()                                          # viewer node
			viewerNode.setInput(0,self.scene)                                   # connect scene to viewer
			viewerNode.setXYpos( -85, 20 )
			
		return 1			

ooc = assembleNodes()
ogffu = ooc.getFilesAndVerify()
# call window to select nk files
if (ogffu == 0):
	ooc.nkNodeList = nuke.getFilename('This is your complete set of .fbx files','*.fbx',multiple=True)																			# get list of .nk
	ooc.levelDistinction()
コード例 #56
0
ファイル: mocha_import.py プロジェクト: RonThomas/nuke.env
def _getfilename():
    """
    Asks user for the filename to be imported.  Filters the import routine to just the acceptable file types.
    """
    filename = nuke.getFilename("Mocha Tracking Export (Nuke ASCII or Shake Format)", "*_Tracker?.txt;*.shk")
    return filename
コード例 #57
0
	def getNkFile(self):
		sw1 = 0
		self.nkFile = nuke.getFilename('fg bg mg .nk file','*.nk',multiple=True)																			# get list of .nk
		if ((self.nkFile[0] == "") or isinstance(self.nkFile[0] ,NoneType) or not (os.path.isfile(self.nkFile[0] ))):
			sw1 = 1
		return sw1