Esempio n. 1
0
void SimpleCameraModel::plotKeyframe(float t) {
	// Iterate over list of model properties
	PropertyList* props = properties.getProperties();
	for (PropertyList::iterator iter = props->begin();
		iter != props->end();
		iter++) {

		// Cast property to a range property
		RangeProperty* rp = dynamic_cast<RangeProperty*>(*iter);
		if (!rp) { continue; }

		// Get the curve, and add a control point
		Curve* pCurve = ModelerUserInterface::getInstance()->
			graph->curve(rp->getCurveIndex());
        pCurve->addControlPoint( Animator::Point(t, rp->getValue()) );
	}

	// Redraw the curves
	ModelerUserInterface::getInstance()->graph->redraw();
}
Esempio n. 2
0
void SimpleCameraModel::clearKeyframe(float t) {
	// Iterate over list of model properties
	PropertyList* props = properties.getProperties();
	for (PropertyList::iterator iter = props->begin();
		iter != props->end();
		iter++) {

		// Attempt to cast property to a range property
		RangeProperty* rp = dynamic_cast<RangeProperty*>(*iter);
		if (!rp) { continue; }

		// Get the curve
		Curve* pCurve = ModelerUserInterface::getInstance()->
			graph->curve(rp->getCurveIndex());

		// Remove all control points in a small range around the current time.
		pCurve->removeControlPointsInRange(
			t-REMOVE_KEYFRAME_RANGE/2, t+REMOVE_KEYFRAME_RANGE/2 );
	}

	// Redraw the curves
	ModelerUserInterface::getInstance()->graph->redraw();
}