From e7cb39b4564a1d180a3f4ca3be7925fb5d8d88a1 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Sat, 14 Apr 2012 22:57:11 -0700 Subject: [PATCH] Fetch defaults when packing interped params --- cuburn/code/interp.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cuburn/code/interp.py b/cuburn/code/interp.py index e868cdd..57ee601 100644 --- a/cuburn/code/interp.py +++ b/cuburn/code/interp.py @@ -2,6 +2,8 @@ from collections import OrderedDict from itertools import cycle import numpy as np +from cuburn.genome import specs +from cuburn.genome.util import resolve_spec from cuburn.genome.use import Wrapper, SplineEval import util @@ -30,7 +32,7 @@ class PackerWrapper(Wrapper): self.packer, self.path = packer, path def wrap_dict(self, path, spec, val): - return type(self)(self.packer, val, spec, path) + return type(self)(self.packer, val or {}, spec, path) def wrap_spline(self, path, spec, val): return PackerSpline(self.packer, path, spec) @@ -209,6 +211,9 @@ class GenomePacker(object): for idx, path in enumerate(self.genome): attr = gnm for name in path: + if name not in attr: + attr = resolve_spec(specs.anim, path).default + break attr = attr[name] attr = SplineEval.normalize(attr) times[idx,:len(attr[0])] = attr[0]