当前位置: 首页>>代码示例>>C++>>正文


C++ ANIM_animdata_get_context函数代码示例

本文整理汇总了C++中ANIM_animdata_get_context函数的典型用法代码示例。如果您正苦于以下问题:C++ ANIM_animdata_get_context函数的具体用法?C++ ANIM_animdata_get_context怎么用?C++ ANIM_animdata_get_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ANIM_animdata_get_context函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: actkeys_paste_exec

static int actkeys_paste_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;

	const eKeyPasteOffset offset_mode= RNA_enum_get(op->ptr, "offset");
	const eKeyMergeMode merge_mode= RNA_enum_get(op->ptr, "merge");
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
	
	if(ac.reports==NULL) {
		ac.reports= op->reports;
	}
	
	/* paste keyframes */
	if (ac.datatype == ANIMCONT_GPENCIL) {
		// FIXME...
	}
	else {
		if (paste_action_keys(&ac, offset_mode, merge_mode)) {
			BKE_report(op->reports, RPT_ERROR, "No keyframes to paste");
			return OPERATOR_CANCELLED;
		}
	}
	
	/* validate keyframes after editing */
	ANIM_editkeyframes_refresh(&ac);
	
	/* set notifier that keyframes have changed */
	WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:34,代码来源:action_edit.c

示例2: graph_panel_context

static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **fcu)
{
	bAnimContext ac;
	bAnimListElem *elem = NULL;
	
	/* for now, only draw if we could init the anim-context info (necessary for all animation-related tools) 
	 * to work correctly is able to be correctly retrieved. There's no point showing empty panels?
	 */
	if (ANIM_animdata_get_context(C, &ac) == 0) 
		return 0;
	
	/* try to find 'active' F-Curve */
	elem = get_active_fcurve_channel(&ac);
	if (elem == NULL) 
		return 0;
	
	if (fcu)
		*fcu = (FCurve *)elem->data;
	if (ale)
		*ale = elem;
	else
		MEM_freeN(elem);
	
	return 1;
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:25,代码来源:graph_buttons.c

示例3: graphop_selected_fcurve_poll

/* has selected F-Curve that's editable */
int graphop_selected_fcurve_poll(bContext *C)
{
	bAnimContext ac;
	ListBase anim_data = {NULL, NULL};
	ScrArea *sa = CTX_wm_area(C);
	size_t items;
	int filter;
	
	/* firstly, check if in Graph Editor */
	// TODO: also check for region?
	if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
		return 0;
		
	/* try to init Anim-Context stuff ourselves and check */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return 0;
	
	/* get the editable + selected F-Curves, and as long as we got some, we can return 
	 * NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome
	 */
	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
	items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
	if (items == 0) 
		return 0;
	
	/* cleanup and return findings */
	BLI_freelistN(&anim_data);
	return 1;
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:30,代码来源:graph_utils.c

示例4: actkeys_paste_exec

static int actkeys_paste_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
	
	/* paste keyframes */
	if (ac.datatype == ANIMCONT_GPENCIL) {
		// FIXME...
	}
	else {
		if (paste_action_keys(&ac)) {
			BKE_report(op->reports, RPT_ERROR, "No keyframes to paste");
			return OPERATOR_CANCELLED;
		}
	}
	
	/* validate keyframes after editing */
	ANIM_editkeyframes_refresh(&ac);
	
	/* set notifier that keyframes have changed */
	WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:27,代码来源:action_edit.c

示例5: graphop_active_fcurve_poll

/* has active F-Curve that's editable */
int graphop_active_fcurve_poll(bContext *C)
{
	bAnimContext ac;
	bAnimListElem *ale;
	ScrArea *sa = CTX_wm_area(C);
	bool has_fcurve = 0;
	
	/* firstly, check if in Graph Editor */
	// TODO: also check for region?
	if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
		return 0;
		
	/* try to init Anim-Context stuff ourselves and check */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return 0;
		
	/* try to get the Active F-Curve */
	ale = get_active_fcurve_channel(&ac);
	if (ale == NULL)
		return 0;
		
	/* free temp data... */
	has_fcurve = ((ale->data) && (ale->type == ANIMTYPE_FCURVE));
	if (has_fcurve) {
		FCurve *fcu = (FCurve *)ale->data;
		has_fcurve = (fcu->flag & FCURVE_VISIBLE) != 0;
	}
	
	MEM_freeN(ale);
	
	/* return success */
	return has_fcurve;
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:34,代码来源:graph_utils.c

示例6: actkeys_clickselect_invoke

/* handle clicking */
static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	bAnimContext ac;
	/* ARegion *ar; */ /* UNUSED */
	short selectmode;
	bool column, channel;
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
		
	/* get useful pointers from animation context data */
	/* ar = ac.ar; */ /* UNUSED */

	/* select mode is either replace (deselect all, then add) or add/extend */
	if (RNA_boolean_get(op->ptr, "extend"))
		selectmode = SELECT_INVERT;
	else
		selectmode = SELECT_REPLACE;
		
	/* column selection */
	column = RNA_boolean_get(op->ptr, "column");
	channel = RNA_boolean_get(op->ptr, "channel");
	
	/* select keyframe(s) based upon mouse position*/
	mouse_action_keys(&ac, event->mval, selectmode, column, channel);
	
	/* set notifier that keyframe selection (and channels too) have changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
	WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
	
	/* for tweak grab to work */
	return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:35,代码来源:action_select.c

示例7: action_circle_select_exec

static int action_circle_select_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;
	const bool select = !RNA_boolean_get(op->ptr, "deselect");
	const short selectmode = select ? SELECT_ADD : SELECT_SUBTRACT;
	
	KeyframeEdit_CircleData data = {0};
	rctf rect_fl;
	
	float x = RNA_int_get(op->ptr, "x");
	float y = RNA_int_get(op->ptr, "y");
	float radius = RNA_int_get(op->ptr, "radius");

	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
	
	data.mval[0] = x;
	data.mval[1] = y;
	data.radius_squared = radius * radius;
	data.rectf_view = &rect_fl;
	
	rect_fl.xmin = x - radius;
	rect_fl.xmax = x + radius;
	rect_fl.ymin = y - radius;
	rect_fl.ymax = y + radius;
	
	/* apply region select action */
	region_select_action_keys(&ac, &rect_fl, BEZT_OK_CHANNEL_CIRCLE, selectmode, &data);
	
	/* send notifier that keyframe selection has changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:35,代码来源:action_select.c

示例8: nlaedit_clickselect_invoke

/* handle clicking */
static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	bAnimContext ac;
	/* Scene *scene; */ /* UNUSED */
	/* ARegion *ar; */ /* UNUSED */
	// View2D *v2d; /*UNUSED*/
	short selectmode;

	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
		
	/* get useful pointers from animation context data */
	/* scene= ac.scene; */ /* UNUSED */
	/* ar= ac.ar; */ /* UNUSED */
	// v2d= &ar->v2d;

	/* select mode is either replace (deselect all, then add) or add/extend */
	if (RNA_boolean_get(op->ptr, "extend"))
		selectmode = SELECT_INVERT;
	else
		selectmode = SELECT_REPLACE;
		
	/* select strips based upon mouse position */
	mouse_nla_strips(C, &ac, event->mval, selectmode);
	
	/* set notifier that things have changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
	
	/* for tweak grab to work */
	return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
开发者ID:wisaac407,项目名称:blender,代码行数:33,代码来源:nla_select.c

示例9: actkeys_keytype_exec

static int actkeys_keytype_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;
	short mode;
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
		
	if (ac.datatype == ANIMCONT_MASK) {
		BKE_report(op->reports, RPT_ERROR, "Not implemented for Masks");
		return OPERATOR_PASS_THROUGH;
	}
		
	/* get handle setting mode */
	mode = RNA_enum_get(op->ptr, "type");
	
	/* set handle type */
	if (ac.datatype == ANIMCONT_GPENCIL) {
		setkeytype_gpencil_keys(&ac, mode);
	}
	else {
		setkeytype_action_keys(&ac, mode);
	}
	
	/* set notifier that keyframe properties have changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:30,代码来源:action_edit.c

示例10: actkeys_viewall

static int actkeys_viewall(bContext *C, const short onlySel)
{
	bAnimContext ac;
	View2D *v2d;
	float extra;
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
	v2d= &ac.ar->v2d;
	
	/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
	get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel);
	
	extra= 0.1f * (v2d->cur.xmax - v2d->cur.xmin);
	v2d->cur.xmin -= extra;
	v2d->cur.xmax += extra;
	
	/* set vertical range */
	v2d->cur.ymax= 0.0f;
	v2d->cur.ymin= (float)-(v2d->mask.ymax - v2d->mask.ymin);
	
	/* do View2D syncing */
	UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
	
	/* just redraw this view */
	ED_area_tag_redraw(CTX_wm_area(C));
	
	return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:30,代码来源:action_edit.c

示例11: nlaedit_add_tracks_exec

static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;
	bool above_sel = RNA_boolean_get(op->ptr, "above_selected");
	bool op_done = false;
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
		
	/* perform adding in two passes - existing first so that we don't double up for empty */
	op_done |= nlaedit_add_tracks_existing(&ac, above_sel);
	op_done |= nlaedit_add_tracks_empty(&ac);
	
	/* done? */
	if (op_done) {
		/* set notifier that things have changed */
		WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
		
		/* done */
		return OPERATOR_FINISHED;
	}
	else {
		/* failed to add any tracks */
		BKE_report(op->reports, RPT_WARNING,
		           "Select an existing NLA Track or an empty action line first");
		
		/* not done */
		return OPERATOR_CANCELLED;
	}
}
开发者ID:diekev,项目名称:blender,代码行数:31,代码来源:nla_channels.c

示例12: actkeys_clean_exec

static int actkeys_clean_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;
	float thresh;
	bool clean_chan;
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
		
	if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
		BKE_report(op->reports, RPT_ERROR, "Not implemented");
		return OPERATOR_PASS_THROUGH;
	}
		
	/* get cleaning threshold */
	thresh = RNA_float_get(op->ptr, "threshold");
	clean_chan = RNA_boolean_get(op->ptr, "channels");
	
	/* clean keyframes */
	clean_action_keys(&ac, thresh, clean_chan);
	
	/* set notifier that keyframes have changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:27,代码来源:action_edit.c

示例13: graphview_curves_reveal_exec

static int graphview_curves_reveal_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;
	ListBase anim_data = {NULL, NULL};
	ListBase all_data = {NULL, NULL};
	bAnimListElem *ale;
	int filter;
	const bool select = RNA_boolean_get(op->ptr, "select");
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
		
	/* get list of all channels that selection may need to be flushed to 
	 * - hierarchy must not affect what we have access to here...
	 */
	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
	ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
	
	/* filter data
	 * - just go through all visible channels, ensuring that everything is set to be curve-visible
	 */
	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
	ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
	
	for (ale = anim_data.first; ale; ale = ale->next) {
		/* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
		/* TODO: find out why this is the case, and fix that */
		if (ale->type == ANIMTYPE_OBJECT)
			continue;
		
		/* select if it is not visible */
		if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0) {
			ANIM_channel_setting_set(
			        &ac, ale, ACHANNEL_SETTING_SELECT,
			        select ? ACHANNEL_SETFLAG_ADD : ACHANNEL_SETFLAG_CLEAR);
		}
		
		/* change the visibility setting */
		ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
		
		/* now, also flush selection status up/down as appropriate */
		ANIM_flush_setting_anim_channels(&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, true);
	}
	
	/* cleanup */
	ANIM_animdata_freelist(&anim_data);
	BLI_freelistN(&all_data);
	
	/* send notifier that things have changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:wisaac407,项目名称:blender,代码行数:54,代码来源:graph_ops.c

示例14: actkeys_viewall

static int actkeys_viewall(bContext *C, const bool only_sel)
{
	bAnimContext ac;
	View2D *v2d;
	float extra, min, max;
	bool found;
	
	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;
	v2d = &ac.ar->v2d;
	
	/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
	found = get_keyframe_extents(&ac, &min, &max, only_sel);

	if (only_sel && (found == false))
		return OPERATOR_CANCELLED;

	v2d->cur.xmin = min;
	v2d->cur.xmax = max;

	extra = 0.1f * BLI_rctf_size_x(&v2d->cur);
	v2d->cur.xmin -= extra;
	v2d->cur.xmax += extra;
	
	/* set vertical range */
	if (only_sel == false) {
		/* view all -> the summary channel is usually the shows everything, and resides right at the top... */
		v2d->cur.ymax = 0.0f;
		v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask);
	}
	else {
		/* locate first selected channel (or the active one), and frame those */
		float ymin = v2d->cur.ymin;
		float ymax = v2d->cur.ymax;
		
		if (actkeys_channels_get_selected_extents(&ac, &ymin, &ymax)) {
			/* recenter the view so that this range is in the middle */
			float ymid = (ymax - ymin) / 2.0f + ymin;
			float x_center;
			
			UI_view2d_center_get(v2d, &x_center, NULL);
			UI_view2d_center_set(v2d, x_center, ymid);
		}
	}
	
	/* do View2D syncing */
	UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
	
	/* just redraw this view */
	ED_area_tag_redraw(CTX_wm_area(C));
	
	return OPERATOR_FINISHED;
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:54,代码来源:action_edit.c

示例15: graph_circle_select_exec

static int graph_circle_select_exec(bContext *C, wmOperator *op)
{
	bAnimContext ac;
	const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
	short selectmode;
	bool incl_handles;
	rctf rect_fl;
	struct KeyframeEdit_CircleData data;
	float x = RNA_int_get(op->ptr, "x");
	float y = RNA_int_get(op->ptr, "y");
	float radius = RNA_int_get(op->ptr, "radius");

	/* get editor data */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return OPERATOR_CANCELLED;

	data.mval[0] = x;
	data.mval[1] = y;
	data.radius_squared = radius * radius;
	data.rectf_view = &rect_fl;
	
	if (gesture_mode == GESTURE_MODAL_SELECT)
		selectmode = SELECT_ADD;
	else
		selectmode = SELECT_SUBTRACT;

	rect_fl.xmin = x - radius;
	rect_fl.xmax = x + radius;
	rect_fl.ymin = y - radius;
	rect_fl.ymax = y + radius;
	
	if (ac.spacetype == SPACE_IPO) {
		SpaceIpo *sipo = (SpaceIpo *)ac.sl;
		if (selectmode == SELECT_ADD) {
			incl_handles = ((sipo->flag & SIPO_SELVHANDLESONLY) ||
			                (sipo->flag & SIPO_NOHANDLES)) == 0;
		}
		else {
			incl_handles = (sipo->flag & SIPO_NOHANDLES) == 0;
		}
	}
	else {
		incl_handles = false;
	}

	/* apply borderselect action */
	borderselect_graphkeys(&ac, &rect_fl, BEZT_OK_REGION_CIRCLE, selectmode, incl_handles, &data);
	
	/* send notifier that keyframe selection has changed */
	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:akonneker,项目名称:blensor,代码行数:53,代码来源:graph_select.c


注:本文中的ANIM_animdata_get_context函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。