Package nukescripts :: Module renderman
[hide private]
[frames] | no frames]

Source Code for Module nukescripts.renderman

 1  import os 
 2  import subprocess 
 3  import shlex 
 4  # filter a RIB file 
 5   
 6  # The function should take the input RIB filename 
 7  # filter it and write the modified version to a file called out_RIB_file 
 8  # 
 9  # This function should return true if the RIB file is filtered or throw an exception if unmodified 
10  # 
11  # args specifies extra arguments field on the prmanRender RIB tab 
12  # 
13  # the default version tries to call catrib to filter the RIB 
14   
15   
16 -def filterRIB( in_RIB_file, out_RIB_file, argsStr ):
17 18 catRibPath = os.environ['RMANTREE'] + '/bin/catrib' 19 args = [ catRibPath ] 20 args.extend( shlex.split(argsStr) ) 21 args.append( "-o" ) 22 args.append( out_RIB_file) 23 args.append( in_RIB_file) 24 25 process = subprocess.Popen( args, shell=False, stdout=subprocess.PIPE) 26 output = process.communicate() 27 28 if process.returncode != 0: 29 raise Exception( "Error running RIB filter (" + str(process.returncode) + ")" )
30