• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CTX_wm_reports函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ui_but_anim_autokey

void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
{
	ID *id;
	bAction *action;
	FCurve *fcu;
	bool driven;
	bool special;

	fcu = ui_but_get_fcurve(but, NULL, &action, &driven, &special);
	
	if (fcu == NULL)
		return;
	
	if (special) {
		/* NLA Strip property */
		if (IS_AUTOKEY_ON(scene)) {
			ReportList *reports = CTX_wm_reports(C);
			ToolSettings *ts = scene->toolsettings;
			
			insert_keyframe_direct(reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, 0);
			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
		}
	}
	else if (driven) {
		/* Driver - Try to insert keyframe using the driver's input as the frame,
		 * making it easier to set up corrective drivers
		 */
		if (IS_AUTOKEY_ON(scene)) {
			ReportList *reports = CTX_wm_reports(C);
			ToolSettings *ts = scene->toolsettings;
			
			insert_keyframe_direct(reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, INSERTKEY_DRIVER);
			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
		}
	}
	else {
		id = but->rnapoin.id.data;
		
		/* TODO: this should probably respect the keyingset only option for anim */
		if (autokeyframe_cfra_can_key(scene, id)) {
			ReportList *reports = CTX_wm_reports(C);
			ToolSettings *ts = scene->toolsettings;
			short flag = ANIM_get_keyframing_flags(scene, 1);
			
			fcu->flag &= ~FCURVE_SELECTED;
			
			/* Note: We use but->rnaindex instead of fcu->array_index,
			 *       because a button may control all items of an array at once.
			 *       E.g., color wheels (see T42567). */
			BLI_assert((fcu->array_index == but->rnaindex) || (but->rnaindex == -1));
			insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
			                fcu->rna_path, but->rnaindex, cfra, ts->keyframe_type, flag);
			
			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
		}
	}
}
开发者ID:UPBGE,项目名称:blender,代码行数:57,代码来源:interface_anim.c


示例2: ui_but_anim_autokey

void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
{
	ID *id;
	bAction *action;
	FCurve *fcu;
	bool driven;
	bool special;

	fcu = ui_but_get_fcurve(but, NULL, &action, &driven, &special);
	
	if (fcu == NULL)
		return;
	
	if (special) {
		/* NLA Strip property */
		if (IS_AUTOKEY_ON(scene)) {
			ReportList *reports = CTX_wm_reports(C);
			PointerRNA ptr = {{NULL}};
			PropertyRNA *prop = NULL;
			int index;
			
			UI_context_active_but_prop_get(C, &ptr, &prop, &index);
			
			insert_keyframe_direct(reports, ptr, prop, fcu, cfra, 0);
			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
		}
	}
	else if (!driven) {
		id = but->rnapoin.id.data;

		/* TODO: this should probably respect the keyingset only option for anim */
		if (autokeyframe_cfra_can_key(scene, id)) {
			ReportList *reports = CTX_wm_reports(C);
			short flag = ANIM_get_keyframing_flags(scene, 1);

			fcu->flag &= ~FCURVE_SELECTED;

			/* Note: We use but->rnaindex instead of fcu->array_index,
			 *       because a button may control all items of an array at once.
			 *       E.g., color wheels (see T42567). */
			BLI_assert((fcu->array_index == but->rnaindex) || (but->rnaindex == -1));
			insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
			                fcu->rna_path, but->rnaindex, cfra, flag);

			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
		}
	}
}
开发者ID:DrangPo,项目名称:blender,代码行数:48,代码来源:interface_anim.c


示例3: do_mat_livedb_item_rename

/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
static int do_mat_livedb_item_rename(bContext *C, ARegion *ar, SpaceLDB *slivedb, LiveDbTreeElement *te, const float mval[2])
{	
    ReportList  *reports;
    int         CUR_UNIT_Y;

    if(TE_GET_TYPE(te->item->type) == MAT_LDB_TREE_ITEM_TYPE_CATEGORY)
        CUR_UNIT_Y = UI_UNIT_Y;
    else
        CUR_UNIT_Y = MAT_LIVEDB_UI_UNIT_Y;

    reports = CTX_wm_reports(C);
    
    if (mval[1] > te->ys && mval[1] < te->ys + CUR_UNIT_Y) {
        /* click on name */
        if (mval[0] > te->xs + UI_UNIT_X * 2 && mval[0] < te->xend) {
            do_item_rename(ar, te, reports);
            return 1;
        }
        return 0;
    }
    for (te = te->subtree.first; te; te = te->next) {
        if (do_mat_livedb_item_rename(C, ar, slivedb, te, mval)) return 1;
    }
    return 0;
} /* do_mat_livedb_item_rename() */
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:26,代码来源:mat_livedb_edit.c


示例4: BPY_execute_string_as_number

/**
 * \return success
 */
bool BPY_execute_string_as_number(bContext *C, const char *expr, double *value, const bool verbose)
{
	PyGILState_STATE gilstate;
	bool ok = true;

	if (!value || !expr) return -1;

	if (expr[0] == '\0') {
		*value = 0.0;
		return ok;
	}

	bpy_context_set(C, &gilstate);

	ok = PyC_RunString_AsNumber(expr, value, "<blender button>");

	if (ok == false) {
		if (verbose) {
			BPy_errors_to_report_ex(CTX_wm_reports(C), false, false);
		}
		else {
			PyErr_Clear();
		}
	}

	bpy_context_clear(C, &gilstate);

	return ok;
}
开发者ID:UPBGE,项目名称:blender,代码行数:32,代码来源:bpy_interface.c


示例5: reports_to_text_exec

static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
{
	ReportList *reports = CTX_wm_reports(C);
	Text *txt;
	char *str;
	
	/* create new text-block to write to */
	txt = add_empty_text("Recent Reports");
	
	/* convert entire list to a display string, and add this to the text-block
	 *	- if commandline debug option enabled, show debug reports too
	 *	- otherwise, up to info (which is what users normally see)
	 */
	str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO);

	if (str) {
		write_text(txt, str);
		MEM_freeN(str);

		return OPERATOR_FINISHED;
	}
	else {
		return OPERATOR_CANCELLED;
	}
}
开发者ID:mik0001,项目名称:Blender,代码行数:25,代码来源:interface_ops.c


示例6: report_delete_exec

static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
	SpaceInfo *sinfo = CTX_wm_space_info(C);
	ReportList *reports = CTX_wm_reports(C);
	int report_mask = info_report_mask(sinfo);


	Report *report, *report_next;

	for (report = reports->list.first; report; ) {

		report_next = report->next;

		if ((report->type & report_mask) && (report->flag & SELECT)) {
			BLI_remlink(&reports->list, report);
			MEM_freeN((void *)report->message);
			MEM_freeN(report);
		}

		report = report_next;
	}

	ED_area_tag_redraw(CTX_wm_area(C));

	return OPERATOR_FINISHED;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:26,代码来源:info_report.c


示例7: ED_armature_enter_posemode

/* This function is used to process the necessary updates for */
void ED_armature_enter_posemode(bContext *C, Base *base)
{
	ReportList *reports = CTX_wm_reports(C);
	Object *ob = base->object;
	
	if (ob->id.lib) {
		BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
		return;
	}
	
	switch (ob->type) {
		case OB_ARMATURE:
			ob->restore_mode = ob->mode;
			ob->mode |= OB_MODE_POSE;
			
			WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
			
			break;
		default:
			return;
	}
	
	/* XXX: disabled as this would otherwise cause a nasty loop... */
	//ED_object_toggle_modes(C, ob->mode);
}
开发者ID:Moguri,项目名称:blender,代码行数:26,代码来源:pose_edit.c


示例8: report_copy_exec

static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
	SpaceInfo *sinfo = CTX_wm_space_info(C);
	ReportList *reports = CTX_wm_reports(C);
	int report_mask = info_report_mask(sinfo);

	Report *report;

	DynStr *buf_dyn = BLI_dynstr_new();
	char *buf_str;

	for (report = reports->list.first; report; report = report->next) {
		if ((report->type & report_mask) && (report->flag & SELECT)) {
			BLI_dynstr_append(buf_dyn, report->message);
			BLI_dynstr_append(buf_dyn, "\n");
		}
	}

	buf_str = BLI_dynstr_get_cstring(buf_dyn);
	BLI_dynstr_free(buf_dyn);

	WM_clipboard_text_set(buf_str, 0);

	MEM_freeN(buf_str);
	return OPERATOR_FINISHED;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:26,代码来源:info_report.c


示例9: wm_file_read_report

void wm_file_read_report(bContext *C)
{
	ReportList *reports = NULL;
	Scene *sce;

	for (sce = G.main->scene.first; sce; sce = sce->id.next) {
		if (sce->r.engine[0] &&
		    BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
		{
			if (reports == NULL) {
				reports = CTX_wm_reports(C);
			}

			BKE_reportf(reports, RPT_ERROR,
			            "Engine '%s' not available for scene '%s' "
			            "(an addon may need to be installed or enabled)",
			            sce->r.engine, sce->id.name + 2);
		}
	}

	if (reports) {
		if (!G.background) {
			WM_report_banner_show();
		}
	}
}
开发者ID:ChunHungLiu,项目名称:blender,代码行数:26,代码来源:wm_files.c


示例10: report_select_all_toggle_exec

static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
	SpaceInfo *sinfo = CTX_wm_space_info(C);
	ReportList *reports = CTX_wm_reports(C);
	int report_mask = info_report_mask(sinfo);
	int deselect = 0;

	Report *report;

	for (report = reports->list.last; report; report = report->prev) {
		if ((report->type & report_mask) && (report->flag & SELECT)) {
			deselect = 1;
			break;
		}
	}


	if (deselect) {
		for (report = reports->list.last; report; report = report->prev)
			if (report->type & report_mask)
				report->flag &= ~SELECT;
	}
	else {
		for (report = reports->list.last; report; report = report->prev)
			if (report->type & report_mask)
				report->flag |= SELECT;
	}

	ED_area_tag_redraw(CTX_wm_area(C));

	return OPERATOR_FINISHED;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:32,代码来源:info_report.c


示例11: wm_init_reports

static void wm_init_reports(bContext *C)
{
	ReportList *reports = CTX_wm_reports(C);

	BLI_assert(!reports || BLI_listbase_is_empty(&reports->list));

	BKE_reports_init(reports, RPT_STORE);
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:8,代码来源:wm_init_exit.c


示例12: mat_livedb_item_rename_cb

/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
void mat_livedb_item_rename_cb(bContext *C, LiveDbTreeElement *te)
{
    ARegion     *ar         = CTX_wm_region(C);
    ReportList  *reports    = CTX_wm_reports(C);

    if(*te->flag & TE_ACTIVE) {
        *te->flag &= ~TE_ACTIVE;
        do_item_rename(ar, te, reports);
    }
} /* mat_livedb_item_rename_cb() */
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:11,代码来源:mat_livedb_edit.c


示例13: select_report_pick_exec

static int select_report_pick_exec(bContext *C, wmOperator *op)
{
	int report_index = RNA_int_get(op->ptr, "report_index");
	Report *report = BLI_findlink(&CTX_wm_reports(C)->list, report_index);

	if (!report)
		return OPERATOR_CANCELLED;

	report->flag ^= SELECT; /* toggle */

	ED_area_tag_redraw(CTX_wm_area(C));

	return OPERATOR_FINISHED;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:14,代码来源:info_report.c


示例14: driver_remove_cb

/* callback to remove the active driver */
static void driver_remove_cb(bContext *C, void *ale_v, void *UNUSED(arg))
{
	bAnimListElem *ale = (bAnimListElem *)ale_v;
	ID *id = ale->id;
	FCurve *fcu = ale->data;
	ReportList *reports = CTX_wm_reports(C);
	
	/* try to get F-Curve that driver lives on, and ID block which has this AnimData */
	if (ELEM(NULL, id, fcu))
		return;
	
	/* call API method to remove this driver  */	
	ANIM_remove_driver(reports, id, fcu->rna_path, fcu->array_index, 0);
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:15,代码来源:graph_buttons.c


示例15: select_report_pick_invoke

static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
	SpaceInfo *sinfo = CTX_wm_space_info(C);
	ARegion *ar = CTX_wm_region(C);
	ReportList *reports = CTX_wm_reports(C);
	Report *report;

	/* uses opengl */
	wmSubWindowSet(CTX_wm_window(C), ar->swinid);
	
	report = info_text_pick(sinfo, ar, reports, event->mval[1]);

	RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));

	return select_report_pick_exec(C, op);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:16,代码来源:info_report.c


示例16: BKE_report

static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_driver)
{
	/* verify that we've got a driver to duplicate */
	if (ELEM(NULL, src_driver, src_driver->driver)) {
		BKE_report(CTX_wm_reports(C), RPT_ERROR, "No valid driver data to create copy of");
		return NULL;
	}
	else {
		/* just make a copy of the existing one and add to self */
		FCurve *new_fcu = copy_fcurve(src_driver);
		
		/* XXX: if we impose any ordering on these someday, this will be problematic */
		BLI_addtail(&adt->drivers, new_fcu);
		return new_fcu;
	}
}
开发者ID:244xiao,项目名称:blender,代码行数:16,代码来源:rna_animation.c


示例17: ED_editors_init

void ED_editors_init(bContext *C)
{
	wmWindowManager *wm = CTX_wm_manager(C);
	Main *bmain = CTX_data_main(C);
	Scene *sce = CTX_data_scene(C);
	Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
	ID *data;

	if (wm->undo_stack == NULL) {
		wm->undo_stack = BKE_undosys_stack_create();
	}

	/* This is called during initialization, so we don't want to store any reports */
	ReportList *reports = CTX_wm_reports(C);
	int reports_flag_prev = reports->flag & ~RPT_STORE;

	SWAP(int, reports->flag, reports_flag_prev);

	/* toggle on modes for objects that were saved with these enabled. for
	 * e.g. linked objects we have to ensure that they are actually the
	 * active object in this scene. */
	for (ob = bmain->object.first; ob; ob = ob->id.next) {
		int mode = ob->mode;

		if (!ELEM(mode, OB_MODE_OBJECT, OB_MODE_POSE)) {
			ob->mode = OB_MODE_OBJECT;
			data = ob->data;

			if (ob == obact && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data)))
				ED_object_mode_toggle(C, mode);
		}
	}

	/* image editor paint mode */
	if (sce) {
		ED_space_image_paint_update(bmain, wm, sce);
	}

	SWAP(int, reports->flag, reports_flag_prev);
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:40,代码来源:ed_util.c


示例18: ui_but_anim_autokey

void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
{
	ID *id;
	bAction *action;
	FCurve *fcu;
	bool driven;

	fcu = ui_but_get_fcurve(but, &action, &driven);

	if (fcu && !driven) {
		id = but->rnapoin.id.data;

		/* TODO: this should probably respect the keyingset only option for anim */
		if (autokeyframe_cfra_can_key(scene, id)) {
			ReportList *reports = CTX_wm_reports(C);
			short flag = ANIM_get_keyframing_flags(scene, 1);

			fcu->flag &= ~FCURVE_SELECTED;
			insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
		}
	}
}
开发者ID:floored,项目名称:blender,代码行数:23,代码来源:interface_anim.c


示例19: reports_to_text_poll

static int reports_to_text_poll(bContext *C)
{
	return CTX_wm_reports(C) != NULL;
}
开发者ID:mik0001,项目名称:Blender,代码行数:4,代码来源:interface_ops.c


示例20: borderselect_exec

/* borderselect operator */
static int borderselect_exec(bContext *C, wmOperator *op)
{
	SpaceInfo *sinfo = CTX_wm_space_info(C);
	ARegion *ar = CTX_wm_region(C);
	ReportList *reports = CTX_wm_reports(C);
	int report_mask = info_report_mask(sinfo);
	int extend = RNA_boolean_get(op->ptr, "extend");
	Report *report_min, *report_max, *report;

	//View2D *v2d = UI_view2d_fromcontext(C);


	rcti rect;
	//rctf rectf, rq;
	short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
	//int mval[2];

	WM_operator_properties_border_to_rcti(op, &rect);

#if 0
	mval[0] = rect.xmin;
	mval[1] = rect.ymin;
	UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin);
	mval[0] = rect.xmax;
	mval[1] = rect.ymax;
	UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
#endif

	if (!extend) {
		for (report = reports->list.first; report; report = report->next) {

			if ((report->type & report_mask) == 0)
				continue;

			report->flag &= ~SELECT;
		}
	}

	report_min = info_text_pick(sinfo, ar, reports, rect.ymax);
	report_max = info_text_pick(sinfo, ar, reports, rect.ymin);

	/* get the first report if none found */
	if (report_min == NULL) {
		// printf("find_min\n");
		for (report = reports->list.first; report; report = report->next) {
			if (report->type & report_mask) {
				report_min = report;
				break;
			}
		}
	}

	if (report_max == NULL) {
		// printf("find_max\n");
		for (report = reports->list.last; report; report = report->prev) {
			if (report->type & report_mask) {
				report_max = report;
				break;
			}
		}
	}

	if (report_min == NULL || report_max == NULL)
		return OPERATOR_CANCELLED;

	for (report = report_min; (report != report_max->next); report = report->next) {

		if ((report->type & report_mask) == 0)
			continue;

		if (selecting)
			report->flag |= SELECT;
		else
			report->flag &= ~SELECT;
	}

	ED_area_tag_redraw(CTX_wm_area(C));

	return OPERATOR_FINISHED;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:81,代码来源:info_report.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CTX_wm_screen函数代码示例发布时间:2022-05-30
下一篇:
C++ CTX_wm_region_view3d函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap