fun_context can be computed in the Renderer.
Chris Pressey
5 years ago
118 | 118 |
|
119 | 119 |
template = Template(config['template'])
|
120 | 120 |
|
121 | |
fun_context = {}
|
122 | |
for key, value in config.get('functions', {}).iteritems():
|
123 | |
fun_context[key] = eval("lambda x: " + value)
|
124 | |
|
125 | 121 |
tempdir = mkdtemp()
|
126 | 122 |
|
127 | 123 |
duration = options.duration
|
|
146 | 142 |
|
147 | 143 |
started_at = datetime.now()
|
148 | 144 |
|
149 | |
renderer = Renderer(tempdir, template, config, fun_context, options, exe)
|
|
145 |
renderer = Renderer(tempdir, template, config, options, exe)
|
150 | 146 |
|
151 | 147 |
for frame in xrange(num_frames):
|
152 | 148 |
|
5 | 5 |
|
6 | 6 |
|
7 | 7 |
class Renderer(object):
|
8 | |
def __init__(self, dirname, template, config, fun_context, options, exe):
|
|
8 |
def __init__(self, dirname, template, config, options, exe):
|
9 | 9 |
self.dirname = dirname
|
10 | 10 |
self.template = template
|
11 | 11 |
self.config = config
|
12 | |
self.fun_context = fun_context
|
13 | 12 |
self.options = options
|
14 | 13 |
self.exe = exe
|
15 | 14 |
|
|
20 | 19 |
self.cmd_template = "inkscape -z -e {outfile} -w {width} -h {height} {infile}"
|
21 | 20 |
else:
|
22 | 21 |
raise NotImplementedError
|
|
22 |
|
|
23 |
self.fun_context = {}
|
|
24 |
for key, value in self.config.get('functions', {}).iteritems():
|
|
25 |
self.fun_context[key] = eval("lambda x: " + value)
|
23 | 26 |
|
24 | 27 |
def render_frame(self, frame, t):
|
25 | 28 |
out_pov = os.path.join(self.dirname, 'out.pov')
|