Пример #1
0
        filename = filename.replace( '//digitalfxserver/CompEnvironment/','/Volumes/CompEnvironment/' ) # comp env



    #conversions form macos to win

    if nuke.env['WIN32']:


        filename = filename.replace( '/Volumes/2018-2019/','Z:/' ) # dfx server
        filename = filename.replace( '/Volumes/2019-2020/','Y:/' ) # dfx server
        filename = filename.replace( '/Volumes/DEFX/','//digitalfxserver/DEFX/' ) # old dfx server
        filename = filename.replace( '/Volumes/StockFootageLibrary/','//digitalfxserver/StockFootageLibrary/' ) # stock footage lib   
        filename = filename.replace( '/Volumes/CompEnvironment/','//digitalfxserver/CompEnvironment/' ) # comp env

        filename = filename.replace( '/Volumes/GraAnim19-TheUnknown/','//AvidISIS/GraAnim19-TheUnknown/' ) # gran anim
        filename = filename.replace( '/Volumes/GraAnim19-Daniel/','//AvidISIS/GraAnim19-Daniel/' ) # gran anim
        filename = filename.replace( '/Volumes/GraFic19-Voce/','//AvidISIS/GraFic19-Voce/' ) # gran fic

        



    return filename



nuke.addFilenameFilter(myFilenameFilter)


Пример #2
0
# -*- coding:utf-8 -*-

import os
import nuke

# create environment variables
from anima import utils
utils.do_db_setup()

# iterate over environment and set it in TCL
for key, value in os.environ.iteritems():
    try:
        nuke.tcl("set", str(key), str(value))
    except RuntimeError:
        pass


def filter_env_vars_in_filepath(filename):
    """Expand variables in path such as ``$PROJECT_ROOT``.
    """
    import os
    expanded_path = os.path.expandvars(filename)
    return expanded_path


# register callback
nuke.addFilenameFilter(filter_env_vars_in_filepath)
Пример #3
0
'''
Filename filters for Nuke
FX Pipe variables apply
'''
import nuke
import fxpipe

def fxPipeFileNameFilter(fileName):
    if nuke.env['LINUX']:
        fileName = fileName.replace(fxpipe.jobPathWin, fxpipe.jobPathLin)
        fileName = fileName.replace(fxpipe.jobPathOsx, fxpipe.jobPathLin)
    if nuke.env['MACOS']:
        fileName = fileName.replace(fxpipe.jobPathLin, fxpipe.jobPathOsx)
        fileName = fileName.replace(fxpipe.jobPathWin, fxpipe.jobPathOsx)        
    if nuke.env['WIN32']:
        fileName = fileName.replace(fxpipe.jobPathLin, fxpipe.jobPathWin)
        fileName = fileName.replace(fxpipe.jobPathOsx, fxpipe.jobPathWin)
    return fileName

nuke.addFilenameFilter(fxPipeFileNameFilter)
Пример #4
0
SearchStrings = ['file ','font ', 'project_directory ']

def pmFilenameFilter( filename):
#	print('FilenameFilter before:\n'+filename)
	# Transfer scene paths to server from all patforms:
	for key in PMaps:
		filename = PMaps[key].toServer( filename)
	# Transfer scene paths from server clinet native patform:
	if PathMap.initialized:
		filename = PMaps[key].toClient( filename)
#	print('FilenameFilter after:\n'+filename)
	return filename

if 'nuke_filenamefilter' in cgruconfig.VARS and cgruconfig.VARS['nuke_filenamefilter']:
	if 'platforms' in cgruconfig.VARS and 'pathsmap' in cgruconfig.VARS:
		nuke.addFilenameFilter( pmFilenameFilter)
		info = 'CGRU filenameFilter added:'
		for key in PMaps: info += ' '+key
		print( info)

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:
Пример #5
0
'''
Filename filters for Nuke
FX Pipe variables apply
'''
import nuke
import fxpipe


def fxPipeFileNameFilter(fileName):
    if nuke.env['LINUX']:
        fileName = fileName.replace(fxpipe.jobPathWin, fxpipe.jobPathLin)
        fileName = fileName.replace(fxpipe.jobPathOsx, fxpipe.jobPathLin)
    if nuke.env['MACOS']:
        fileName = fileName.replace(fxpipe.jobPathLin, fxpipe.jobPathOsx)
        fileName = fileName.replace(fxpipe.jobPathWin, fxpipe.jobPathOsx)
    if nuke.env['WIN32']:
        fileName = fileName.replace(fxpipe.jobPathLin, fxpipe.jobPathWin)
        fileName = fileName.replace(fxpipe.jobPathOsx, fxpipe.jobPathWin)
    return fileName


nuke.addFilenameFilter(fxPipeFileNameFilter)
Пример #6
0
import nuke
import pipelineSetup

def pipelineSetupFileNameFilter(fileName):
    swapped = False
    if nuke.env['LINUX']:
        fileName, swapped = pathSwap(fileName, pipelineSetup.windowsPath, pipelineSetup.linuxPath)
        if swapped == False:
            fileName = pathSwap(fileName, pipelineSetup.macPath, pipelineSetup.linuxPath)
    if nuke.env['MACOS']:
        fileName, swapped = pathSwap(fileName, pipelineSetup.linuxPath, pipelineSetup.macPath)
        if swapped == False:
            fileName, swapped = pathSwap(fileName, pipelineSetup.windowsPath, pipelineSetup.macPath)        
    if nuke.env['WIN32']:
        fileName, swapped = pathSwap(fileName, pipelineSetup.linuxPath, pipelineSetup.windowsPath)
        if swapped == False:
            fileName, swapped = pathSwap(fileName, pipelineSetup.macPath, pipelineSetup.windowsPath)
    return fileName

def pathSwap(inFile, pathA, pathB):
    swapped = False
    for pathCount in range(min(len(pathA),len(pathB))):
        if swapped == False:
            fileName = inFile.replace(pathA[pathCount],pathB[pathCount])
            if fileName != inFile:
                swapped = True
                continue
    return fileName, swapped

nuke.addFilenameFilter(pipelineSetupFileNameFilter)
Пример #7
0
# -*- coding: utf-8 -*-

###########################################################################################
#
# Author: astips - (animator.well)
#
# Date: 2017.03
#
# Url: https://github.com/astips
#
# Description: nuke url resolver
#
###########################################################################################
import nuke
from studiourl import StudioUrl


nuke.addFilenameFilter(nurl_resolver)


def nurl_resolver(url) :
    studio_url = StudioUrl(url)
    real_path = studio_url.real_path
    """
    do get the real path
    """
    return real_path
Пример #8
0
import nuke
import gsv

## add callback
nuke.addFilenameFilter(gsv.expand_vars)
Пример #9
0
                nuke.thisKnob().name())


nuke.addOnUserCreate(_cb, ("onUserCreate"))

nuke.addOnCreate(_cb, ("onCreate"))

nuke.addOnScriptLoad(_cb, ("onScriptLoad"))

nuke.addOnScriptSave(_cb, ("onScriptSave"))

nuke.addOnScriptClose(_cb, ("onScriptClose"))

nuke.addOnDestroy(_cb, ("onDestroy"))

nuke.addKnobChanged(_cbk, ("knobChanged"))

nuke.addUpdateUI(_cb, ("updateUI"))

nuke.addAutolabel(_cb, ("autolabel"))

nuke.addBeforeRender(_cb, ("beforeRender"))

nuke.addBeforeFrameRender(_cb, ("beforeFrameRender"))

nuke.addAfterFrameRender(_cb, ("afterFrameRender"))

nuke.addAfterRender(_cb, ("afterRender"))

nuke.addFilenameFilter(lambda s: nuke.tprint("filenameFilter('" + s + "')"))
Пример #10
0
## Create output directories automatically
## Taken from the Nuke Python Dev Guide
def createWriteDir():
  import nuke, os, errno
  file = nuke.filename(nuke.thisNode())
  dir = os.path.dirname( file )
  osdir = nuke.callbacks.filenameFilter( dir )
  # cope with the directory existing already by ignoring that exception
  try:
    os.makedirs( osdir )
  except OSError, e:
    if e.errno != errno.EEXIST:
      raise
nuke.addBeforeRender(createWriteDir)


# Make all filepaths load without errors regardless of OS (No Linux support and no C: support)
# Big thanks to Fredrik Averpil: http://fredrik.averpil.com/post/17033531721
def myFilenameFilter(filename):
  if nuke.env['MACOS']:
    filename = filename.replace( 'X:', '/Volumes/Work/jobs/phos' )
  if nuke.env['WIN32']:
    filename = filename.replace( '/Volumes/Work/jobs/phos', 'X:' )

  return filename


# Use the filenameFilter(s)
nuke.addFilenameFilter(myFilenameFilter)
def registerFilters():

    nuke.addFilenameFilter(filters.assetAPIFilenameFilter)

    ## @todo Presently, this doesn't work as it gets called after filenameFilter
    nuke.addValidateFilename(filters.assetAPIFilenameValidator)