#NEWLINE# def parse( input_filename = 'default.effect' , output_filename = 'default.json' , asset_url = '' , asset_root = '.' , infiles = None , options = None ) : #NEWLINE# #INDENT# '\n    Untility function to convert a Effect Yaml (.effect) into a JSON file.\n    Known built-in textures are: default, quadratic, white, nofalloff, black, flat\n    ' #NEWLINE# try : #NEWLINE# #INDENT# with open ( input_filename , 'r' ) as source : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# effects = yaml . load ( source ) #NEWLINE# #UNINDENT# except yaml . scanner . ScannerError as e : #NEWLINE# #INDENT# LOG . error ( 'Failed processing: %s' , input_filename ) #NEWLINE# LOG . error ( '  >> %s' , e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# json_asset = JsonAsset ( ) #NEWLINE# for ( effect_name , effect_parameters ) in effects . iteritems ( ) : #NEWLINE# #INDENT# effect_type = effect_parameters . pop ( 'type' , None ) #NEWLINE# shader = effect_parameters . pop ( 'shader' , None ) #NEWLINE# meta = effect_parameters . pop ( 'meta' , None ) #NEWLINE# json_asset . attach_effect ( effect_name , effect_type , effect_parameters , shader , meta ) #NEWLINE# #UNINDENT# standard_json_out ( json_asset , output_filename , options ) #NEWLINE# return json_asset #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except IOError as e : #NEWLINE# #INDENT# LOG . error ( 'Failed processing: %s' , output_filename ) #NEWLINE# LOG . error ( '  >> %s' , e ) #NEWLINE# return None