git @ Cat's Eye Technologies kinoje / 0eae7bf
fun_context can be computed in the Renderer. Chris Pressey 5 years ago
2 changed file(s) with 6 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
118118
119119 template = Template(config['template'])
120120
121 fun_context = {}
122 for key, value in config.get('functions', {}).iteritems():
123 fun_context[key] = eval("lambda x: " + value)
124
125121 tempdir = mkdtemp()
126122
127123 duration = options.duration
146142
147143 started_at = datetime.now()
148144
149 renderer = Renderer(tempdir, template, config, fun_context, options, exe)
145 renderer = Renderer(tempdir, template, config, options, exe)
150146
151147 for frame in xrange(num_frames):
152148
55
66
77 class Renderer(object):
8 def __init__(self, dirname, template, config, fun_context, options, exe):
8 def __init__(self, dirname, template, config, options, exe):
99 self.dirname = dirname
1010 self.template = template
1111 self.config = config
12 self.fun_context = fun_context
1312 self.options = options
1413 self.exe = exe
1514
2019 self.cmd_template = "inkscape -z -e {outfile} -w {width} -h {height} {infile}"
2120 else:
2221 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)
2326
2427 def render_frame(self, frame, t):
2528 out_pov = os.path.join(self.dirname, 'out.pov')