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


C++ CTX_wm_reports函数代码示例

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


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


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