The argument slname is the name of the shader source file (*.sl). cpp is the name of the preprocessor to use (default = "cpp") which has to be installed on the system. If the preprocessor doesn't produce any data a PreprocessorNotFound exception is thrown. If cpp is None, then the input file is parsed directly. The error stream of the preprocessor is written to the object that's specified by cpperrstream which must have a write() method (default = sys.stderr). If cpperrstream is None, the error stream is ignored.
The function returns a list of 3-tuples, one for each shader found in the file. The tuple contains the type, the name and the parameters of the shader. The parameters are given as a list of 7-tuples describing each parameter. The tuple contains the following information (in the given order):
output
" or an empty string)
uniform
" or "varying
")
Example (output slightly reformatted for better readability):
>>> import slparams >>> slparams.slparams("plastic.sl") [('surface', 'plastic', [('', 'uniform', 'float', None, 'Ka', None, '1'), ('', 'uniform', 'float', None, 'Kd', None, '0.5'), ('', 'uniform', 'float', None, 'Ks', None, '0.5'), ('', 'uniform', 'float', None, 'roughness', None, '0.1'), ('', 'uniform', 'color', None, 'specularcolor', 'rgb', '1')])]
The parser used inside this function was generated using the parser generator Yapps by Amit Patel.
The RenderMan (R) Interface Procedures and Protocol are:
Copyright 1988, 1989, 2000, Pixar
All Rights Reserved
RenderMan (R) is a registered trademark of Pixar