예제 #1
0
// used to be recalc_*_ipos() where * was object or action
void ANIM_editkeyframes_refresh(bAnimContext *ac)
{
	ListBase anim_data = {NULL, NULL};
	bAnimListElem *ale;
	int filter;
	/* when not in graph view, don't use handles */
	SpaceIpo *sipo = (ac->spacetype == SPACE_IPO) ? (SpaceIpo *)ac->sl : NULL;
	const short use_handle = sipo ? !(sipo->flag & SIPO_NOHANDLES) : FALSE;
	
	/* filter animation data */
	filter = ANIMFILTER_DATA_VISIBLE;
	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
	
	/* loop over F-Curves that are likely to have been edited, and check them */
	for (ale = anim_data.first; ale; ale = ale->next) {
		FCurve *fcu = ale->key_data;
		
		/* make sure keyframes in F-Curve are all in order, and handles are in valid positions */
		sort_time_fcurve(fcu);
		testhandles_fcurve(fcu, use_handle);
	}
	
	/* free temp data */
	BLI_freelistN(&anim_data);
}
예제 #2
0
/* update callback for active keyframe properties - base updates stuff */
static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, void *UNUSED(bezt_ptr))
{
	FCurve *fcu = (FCurve *)fcu_ptr;
	
	/* make sure F-Curve and its handles are still valid after this editing */
	sort_time_fcurve(fcu);
	calchandles_fcurve(fcu);
}
예제 #3
0
/* update callback for active keyframe properties - base updates stuff */
static void graphedit_activekey_update_cb(bContext *C, void *fcu_ptr, void *UNUSED(bezt_ptr))
{
	SpaceIpo *sipo = CTX_wm_space_graph(C);
	const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
	FCurve *fcu = (FCurve *)fcu_ptr;
	
	/* make sure F-Curve and its handles are still valid after this editing */
	sort_time_fcurve(fcu);
	testhandles_fcurve(fcu, use_handle);
}
예제 #4
0
// used to be recalc_*_ipos() where * was object or action
void ANIM_editkeyframes_refresh(bAnimContext *ac)
{
	ListBase anim_data = {NULL, NULL};
	bAnimListElem *ale;
	int filter;
	
	/* filter animation data */
	filter= ANIMFILTER_CURVESONLY; 
	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
	
	/* loop over F-Curves that are likely to have been edited, and check them */
	for (ale= anim_data.first; ale; ale= ale->next) {
		FCurve *fcu= ale->key_data;
		
		/* make sure keyframes in F-Curve are all in order, and handles are in valid positions */
		sort_time_fcurve(fcu);
		testhandles_fcurve(fcu);
	}
	
	/* free temp data */
	BLI_freelistN(&anim_data);
}
예제 #5
0
void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
{
	bAnimListElem *ale;

	if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
#ifdef DEBUG
		/* quiet assert */
		for (ale = anim_data->first; ale; ale = ale->next) {
			ale->update = 0;
		}
#endif
		return;
	}

	for (ale = anim_data->first; ale; ale = ale->next) {
		FCurve *fcu = ale->key_data;

		if (ale->update & ANIM_UPDATE_ORDER) {
			ale->update &= ~ANIM_UPDATE_ORDER;
			if (fcu)
				sort_time_fcurve(fcu);
		}

		if (ale->update & ANIM_UPDATE_HANDLES) {
			ale->update &= ~ANIM_UPDATE_HANDLES;
			if (fcu)
				calchandles_fcurve(fcu);
		}

		if (ale->update & ANIM_UPDATE_DEPS) {
			ale->update &= ~ANIM_UPDATE_DEPS;
			ANIM_list_elem_update(ac->scene, ale);
		}

		BLI_assert(ale->update == 0);
	}
}