+ add("slopes", &Loader::slopes);
+}
+
+void Animation::Loader::finish()
+{
+ obj.create_curves();
+}
+
+void Animation::Loader::check_slopes_and_control(bool s, bool c)
+{
+ if(s && c)
+ throw logic_error("can't use both slopes and control keyframes in same segment");
+}
+
+void Animation::Loader::add_kf(const KeyFrame *kf, bool c, bool owned)
+{
+ if(slopes_set && !c)
+ obj.add_keyframe(current_time, kf, start_slope, end_slope, owned);
+ else
+ obj.add_keyframe(current_time, kf, c, owned);
+
+ start_slope = end_slope;
+ end_slope = 1;
+ slopes_set = (slopes_set<<1)&3;
+}
+
+void Animation::Loader::load_kf(const string &n, bool c)
+{
+ add_kf(&get_collection().get<KeyFrame>(n), c, false);
+}
+
+void Animation::Loader::load_kf_inline(bool c)
+{
+ RefPtr<KeyFrame> kf = new KeyFrame;
+ if(coll)
+ load_sub(*kf, get_collection());
+ else
+ load_sub(*kf);
+
+ add_kf(kf.get(), c, true);
+ kf.release();
+}
+
+void Animation::Loader::control_keyframe(const string &n)
+{
+ slopes_set &= 1;
+ check_slopes_and_control(slopes_set, true);
+ load_kf(n, true);
+}
+
+void Animation::Loader::control_keyframe_inline()
+{
+ slopes_set &= 1;
+ check_slopes_and_control(slopes_set, true);
+ load_kf_inline(true);