您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CTX_wm_region函数代码示例

51自学网 2021-06-01 20:06:56
  C++
这篇教程C++ CTX_wm_region函数代码示例写得很实用,希望能帮到您。

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

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

示例1: node_find_call_cb

static void node_find_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2){	SpaceNode *snode = CTX_wm_space_node(C);	bNode *active = arg2;		if (active) {		ARegion *ar = CTX_wm_region(C);		node_select_single(C, active);				/* is note outside view? */		if (active->totr.xmax < ar->v2d.cur.xmin || active->totr.xmin > ar->v2d.cur.xmax ||		    active->totr.ymax < ar->v2d.cur.ymin || active->totr.ymin > ar->v2d.cur.ymax)		{			space_node_view_flag(C, snode, ar, NODE_SELECT, U.smooth_viewtx);		}	}}
开发者ID:bitfusionio,项目名称:blender,代码行数:18,


示例2: CTX_wm_window

/* return active operator name when mouse is in box */static const char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event){	wmWindow *win= CTX_wm_window(C);	ScrArea *sa= CTX_wm_area(C);	ARegion *ar= CTX_wm_region(C);	const char *name;		name= dropbox_active(C, &win->handlers, drag, event);	if(name) return name;		name= dropbox_active(C, &sa->handlers, drag, event);	if(name) return name;		name= dropbox_active(C, &ar->handlers, drag, event);	if(name) return name;	return NULL;}
开发者ID:BHCLL,项目名称:blendocv,代码行数:19,


示例3: gp_camera_view_subrect

static int gp_camera_view_subrect(bContext *C, rctf *subrect){	View3D *v3d = CTX_wm_view3d(C);	ARegion *ar = CTX_wm_region(C);		if (v3d) {		RegionView3D *rv3d = ar->regiondata;				/* for camera view set the subrect */		if (rv3d->persp == RV3D_CAMOB) {			Scene *scene = CTX_data_scene(C);			ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, true); /* no shift */			return 1;		}	}		return 0;}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:18,


示例4: ui_popup_block_remove

static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle){  wmWindow *win = CTX_wm_window(C);  bScreen *sc = CTX_wm_screen(C);  ui_region_temp_remove(C, sc, handle->region);  /* reset to region cursor (only if there's not another menu open) */  if (BLI_listbase_is_empty(&sc->regionbase)) {    ED_region_cursor_set(win, CTX_wm_area(C), CTX_wm_region(C));    /* in case cursor needs to be changed again */    WM_event_add_mousemove(C);  }  if (handle->scrolltimer) {    WM_event_remove_timer(CTX_wm_manager(C), win, handle->scrolltimer);  }}
开发者ID:dfelinto,项目名称:blender,代码行数:18,


示例5: mat_livedb_item_openclose

/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */static int mat_livedb_item_openclose(bContext *C, wmOperator *op, const wmEvent *event){    ARegion             *ar         = CTX_wm_region(C);    SpaceLDB            *slivedb    = CTX_wm_space_mat_livedb(C);    int                 all         = RNA_boolean_get(op->ptr, "all");    LiveDbTreeElement   *te;    float               fmval[2];        UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);        for (te = slivedb->tree.first; te; te = te->next) {        if (do_mat_livedb_item_openclose(C, slivedb, te, all, fmval))             break;    }    ED_region_tag_redraw(ar);        return OPERATOR_FINISHED;} /* mat_livedb_item_openclose() */
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:19,


示例6: mat_livedb_toggle_selected_exec

/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */static int mat_livedb_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op)){    SpaceLDB    *slivedb    = CTX_wm_space_mat_livedb(C);    ARegion     *ar         = CTX_wm_region(C);    Scene       *scene      = CTX_data_scene(C);        if (mat_livedb_has_one_flag(slivedb, &slivedb->tree, TE_SELECTED, 1))        mat_livedb_set_flag(slivedb, &slivedb->tree, TE_SELECTED, 0);    else         mat_livedb_set_flag(slivedb, &slivedb->tree, TE_SELECTED, 1);        slivedb->storeflag |= LDB_TREESTORE_REDRAW;        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);    ED_region_tag_redraw(ar);        return OPERATOR_FINISHED;} /* mat_livedb_toggle_selected_exec() */
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:19,


示例7: mat_livedb_item_rename

/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */static int mat_livedb_item_rename(bContext *C, wmOperator *UNUSED(op), const wmEvent *event){    ARegion             *ar         = CTX_wm_region(C);    SpaceLDB            *slivedb    = CTX_wm_space_mat_livedb(C);    bool                change      = false;    LiveDbTreeElement   *te;    float               fmval[2];        UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);        for (te = slivedb->tree.first; te; te = te->next) {        if (do_mat_livedb_item_rename(C, ar, slivedb, te, fmval)) {            change = true;            break;        }    }    return change ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;} /* mat_livedb_item_rename() */
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:19,


示例8: paint_draw_smooth_stroke

/*** Cursor ***/static void paint_draw_smooth_stroke(bContext *C, int x, int y, void *customdata) {	Brush *brush = paint_brush(paint_get_active(CTX_data_scene(C)));	PaintStroke *stroke = customdata;	glColor4ubv(paint_get_active(CTX_data_scene(C))->paint_cursor_col);	glEnable(GL_LINE_SMOOTH);	glEnable(GL_BLEND);	if(stroke && brush && (brush->flag & BRUSH_SMOOTH_STROKE)) {		ARegion *ar = CTX_wm_region(C);		sdrawline(x, y, (int)stroke->last_mouse_position[0] - ar->winrct.xmin,			  (int)stroke->last_mouse_position[1] - ar->winrct.ymin);	}	glDisable(GL_BLEND);	glDisable(GL_LINE_SMOOTH);}
开发者ID:mik0001,项目名称:Blender,代码行数:19,


示例9: outliner_operation

static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent *event){	Scene *scene = CTX_data_scene(C);	ARegion *ar = CTX_wm_region(C);	SpaceOops *soops = CTX_wm_space_outliner(C);	TreeElement *te;	float fmval[2];	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);		for (te = soops->tree.first; te; te = te->next) {		if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) {			break;		}	}		return OPERATOR_FINISHED;}
开发者ID:244xiao,项目名称:blender,代码行数:18,


示例10: paintcurve_slide_modal

static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *event){	PointSlideData *psd = op->customdata;	if (event->type == psd->event && event->val == KM_RELEASE) {		MEM_freeN(psd);		ED_paintcurve_undo_push_begin(op->type->name);		ED_paintcurve_undo_push_end();		return OPERATOR_FINISHED;	}	switch (event->type) {		case MOUSEMOVE:		{			ARegion *ar = CTX_wm_region(C);			wmWindow *window = CTX_wm_window(C);			float diff[2] = {				event->mval[0] - psd->initial_loc[0],				event->mval[1] - psd->initial_loc[1]};			if (psd->select == 1) {				int i;				for (i = 0; i < 3; i++)					add_v2_v2v2(psd->pcp->bez.vec[i], diff, psd->point_initial_loc[i]);			}			else {				add_v2_v2(diff, psd->point_initial_loc[psd->select]);				copy_v2_v2(psd->pcp->bez.vec[psd->select], diff);				if (psd->align) {					char opposite = (psd->select == 0) ? 2 : 0;					sub_v2_v2v2(diff, psd->pcp->bez.vec[1], psd->pcp->bez.vec[psd->select]);					add_v2_v2v2(psd->pcp->bez.vec[opposite], psd->pcp->bez.vec[1], diff);				}			}			WM_paint_cursor_tag_redraw(window, ar);			break;		}		default:			break;	}	return OPERATOR_RUNNING_MODAL;}
开发者ID:wchargin,项目名称:blender,代码行数:43,


示例11: frame_from_event

/* Get frame from mouse coordinates */static int frame_from_event(bContext *C, const wmEvent *event){	ARegion *region = CTX_wm_region(C);	Scene *scene = CTX_data_scene(C);	float viewx;	int frame;	/* convert from region coordinates to View2D 'tot' space */	viewx = UI_view2d_region_to_view_x(&region->v2d, event->mval[0]);		/* round result to nearest int (frames are ints!) */	frame = iroundf(viewx);		if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {		CLAMP(frame, PSFRA, PEFRA);	}		return frame;}
开发者ID:UPBGE,项目名称:blender,代码行数:20,


示例12: mask_flood_fill_exec

static int mask_flood_fill_exec(bContext *C, wmOperator *op){	ARegion *ar = CTX_wm_region(C);	struct Scene *scene = CTX_data_scene(C);	Object *ob = CTX_data_active_object(C);	struct MultiresModifierData *mmd = sculpt_multires_active(scene, ob);	PaintMaskFloodMode mode;	float value;	DerivedMesh *dm;	PBVH *pbvh;	PBVHNode **nodes;	int totnode, i;#ifdef _OPENMP	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;#endif	mode = RNA_enum_get(op->ptr, "mode");	value = RNA_float_get(op->ptr, "value");	ED_sculpt_mask_layers_ensure(ob, mmd);	dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);	pbvh = dm->getPBVH(ob, dm);	ob->sculpt->pbvh = pbvh;	BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);	sculpt_undo_push_begin("Mask flood fill");#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)	for (i = 0; i < totnode; i++) {		PBVHVertexIter vi;		sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);		BKE_pbvh_vertex_iter_begin(pbvh, nodes[i], vi, PBVH_ITER_UNIQUE) {			mask_flood_fill_set_elem(vi.mask, mode, value);		} BKE_pbvh_vertex_iter_end;				BKE_pbvh_node_mark_redraw(nodes[i]);		if (BKE_pbvh_type(pbvh) == PBVH_GRIDS)			multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);	}
开发者ID:ilent2,项目名称:Blender-Billboard-Modifier,代码行数:43,


示例13: view_all_exec

static int view_all_exec(bContext *C, wmOperator *UNUSED(op)){	Scene *scene = CTX_data_scene(C);	ARegion *ar = CTX_wm_region(C);	SpaceClip *sc = CTX_wm_space_clip(C);	View2D *v2d = &ar->v2d;	ViewAllUserData userdata;	float extra;	userdata.max = -FLT_MAX;	userdata.min = FLT_MAX;	clip_graph_tracking_values_iterate(sc,	                                   (sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0,	                                   (sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,	                                   &userdata, view_all_cb, NULL, NULL);	/* set extents of view to start/end frames */	v2d->cur.xmin = (float) SFRA;	v2d->cur.xmax = (float) EFRA;	if (userdata.min < userdata.max) {		v2d->cur.ymin = userdata.min;		v2d->cur.ymax = userdata.max;	}	else {		v2d->cur.ymin = -10;		v2d->cur.ymax = 10;	}	/* we need an extra "buffer" factor on either side so that the endpoints are visible */	extra = 0.01f * BLI_rctf_size_x(&v2d->cur);	v2d->cur.xmin -= extra;	v2d->cur.xmax += extra;	extra = 0.01f * BLI_rctf_size_y(&v2d->cur);	v2d->cur.ymin -= extra;	v2d->cur.ymax += extra;	ED_region_tag_redraw(ar);	return OPERATOR_FINISHED;}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:43,


示例14: view_zoom_apply

static void view_zoom_apply(bContext *C,                            ViewZoomData *vpd,                            wmOperator *op,                            const wmEvent *event){	float factor;	if (U.viewzoom == USER_ZOOM_CONT) {		SpaceClip *sclip = CTX_wm_space_clip(C);		double time = PIL_check_seconds_timer();		float time_step = (float)(time - vpd->timer_lastdraw);		float fac;		float zfac;		if (U.uiflag & USER_ZOOM_HORIZ) {			fac = (float)(event->x - vpd->x);		}		else {			fac = (float)(event->y - vpd->y);		}		if (U.uiflag & USER_ZOOM_INVERT) {			fac = -fac;		}		zfac = 1.0f + ((fac / 20.0f) * time_step);		vpd->timer_lastdraw = time;		factor = (sclip->zoom * zfac) / vpd->zoom;	}	else {		float delta = event->x - vpd->x + event->y - vpd->y;		if (U.uiflag & USER_ZOOM_INVERT) {			delta *= -1;		}		factor = 1.0f + delta / 300.0f;	}	RNA_float_set(op->ptr, "factor", factor);	sclip_zoom_set(C, vpd->zoom * factor, vpd->location);	ED_region_tag_redraw(CTX_wm_region(C));}
开发者ID:pawkoz,项目名称:dyplom,代码行数:43,


示例15: sclip_zoom_set

static void sclip_zoom_set(const bContext *C, float zoom, float location[2]){	SpaceClip *sc = CTX_wm_space_clip(C);	ARegion *ar = CTX_wm_region(C);	float oldzoom = sc->zoom;	int width, height;	sc->zoom = zoom;	if (sc->zoom < 0.1f || sc->zoom > 4.0f) {		/* check zoom limits */		ED_space_clip_get_size(sc, &width, &height);		width *= sc->zoom;		height *= sc->zoom;		if ((width < 4) && (height < 4))			sc->zoom = oldzoom;		else if (BLI_rcti_size_x(&ar->winrct) <= sc->zoom)			sc->zoom = oldzoom;		else if (BLI_rcti_size_y(&ar->winrct) <= sc->zoom)			sc->zoom = oldzoom;	}	if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {		float dx, dy;		ED_space_clip_get_size(sc, &width, &height);		dx = ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;		dy = ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;		if (sc->flag & SC_LOCK_SELECTION) {			sc->xlockof += dx;			sc->ylockof += dy;		}		else {			sc->xof += dx;			sc->yof += dy;		}	}}
开发者ID:pawkoz,项目名称:dyplom,代码行数:43,


示例16: node_border_select_invoke

static int node_border_select_invoke(bContext *C, wmOperator *op, const wmEvent *event){	const bool tweak = RNA_boolean_get(op->ptr, "tweak");		if (tweak) {		/* prevent initiating the border select if the mouse is over a node */		/* this allows border select on empty space, but drag-translate on nodes */		SpaceNode *snode = CTX_wm_space_node(C);		ARegion *ar = CTX_wm_region(C);		float mx, my;		UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &mx, &my);				if (node_under_mouse_tweak(snode->edittree, mx, my))			return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;	}		return WM_border_select_invoke(C, op, event);}
开发者ID:bitfusionio,项目名称:blender,代码行数:19,


示例17: ANIM_center_frame

void ANIM_center_frame(struct bContext *C, int smooth_viewtx){	ARegion *ar = CTX_wm_region(C);	Scene *scene = CTX_data_scene(C);	float w = BLI_rctf_size_x(&ar->v2d.cur);	rctf newrct;	int nextfra, prevfra;	switch (U.view_frame_type) {		case ZOOM_FRAME_MODE_SECONDS:		{			const float fps = FPS;			newrct.xmax = scene->r.cfra + U.view_frame_seconds * fps + 1;			newrct.xmin = scene->r.cfra - U.view_frame_seconds * fps - 1;			newrct.ymax = ar->v2d.cur.ymax;			newrct.ymin = ar->v2d.cur.ymin;			break;		}		/* hardest case of all, look for all keyframes around frame and display those */		case ZOOM_FRAME_MODE_KEYFRAMES:			if (find_prev_next_keyframes(C, &nextfra, &prevfra)) {				newrct.xmax = nextfra;				newrct.xmin = prevfra;				newrct.ymax = ar->v2d.cur.ymax;				newrct.ymin = ar->v2d.cur.ymin;				break;			}			/* else drop through, keep range instead */			ATTR_FALLTHROUGH;		case ZOOM_FRAME_MODE_KEEP_RANGE:		default:			newrct.xmax = scene->r.cfra + (w / 2);			newrct.xmin = scene->r.cfra - (w / 2);			newrct.ymax = ar->v2d.cur.ymax;			newrct.ymin = ar->v2d.cur.ymin;			break;	}	UI_view2d_smooth_view(C, ar, &newrct, smooth_viewtx);}
开发者ID:mgschwan,项目名称:blensor,代码行数:42,


示例18: knifeproject_exec

static int knifeproject_exec(bContext *C, wmOperator *op){	ARegion *ar = CTX_wm_region(C);	Scene *scene = CTX_data_scene(C);	Object *obedit = CTX_data_edit_object(C);	BMEditMesh *em = BKE_editmesh_from_object(obedit);	const bool cut_through = RNA_boolean_get(op->ptr, "cut_through");	LinkNode *polys = NULL;	CTX_DATA_BEGIN (C, Object *, ob, selected_objects)	{		if (ob != obedit) {			polys = knifeproject_poly_from_object(ar, scene, ob, polys);		}	}	CTX_DATA_END;	if (polys) {		EDBM_mesh_knife(C, polys, true, cut_through);		/* select only tagged faces */		BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);		/* not essential, but switch out of vertex mode since the		 * selected regions wont be nicely isolated after flushing.		 * note: call after de-select to avoid selection flushing */		EDBM_selectmode_disable(scene, em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);		BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, false, BM_ELEM_TAG);		BM_mesh_select_mode_flush(em->bm);		BLI_linklist_freeN(polys);		return OPERATOR_FINISHED;	}	else {		BKE_report(op->reports, RPT_ERROR, "No other selected objects found to use for projection");		return OPERATOR_CANCELLED;	}}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:42,


示例19: walk_modal

static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event){	int exit_code;	bool do_draw = false;	WalkInfo *walk = op->customdata;	RegionView3D *rv3d = walk->rv3d;	Object *walk_object = ED_view3d_cameracontrol_object_get(walk->v3d_camera_control);	walk->redraw = false;	walkEvent(C, op, walk, event);	if (walk->ndof) { /* 3D mouse overrules [2D mouse + timer] */		if (event->type == NDOF_MOTION) {			walkApply_ndof(C, walk);		}	}	else if (event->type == TIMER && event->customdata == walk->timer) {		walkApply(C, op, walk);	}	do_draw |= walk->redraw;	exit_code = walkEnd(C, walk);	if (exit_code != OPERATOR_RUNNING_MODAL)		do_draw = true;	if (do_draw) {		if (rv3d->persp == RV3D_CAMOB) {			WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, walk_object);		}		// puts("redraw!"); // too frequent, commented with NDOF_WALK_DRAW_TOOMUCH for now		ED_region_tag_redraw(CTX_wm_region(C));	}	if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED))		ED_area_headerprint(CTX_wm_area(C), NULL);	return exit_code;}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:42,


示例20: ED_mask_draw

void ED_mask_draw(const bContext *C,                  const char draw_flag, const char draw_type){	ScrArea *sa = CTX_wm_area(C);	ARegion *ar = CTX_wm_region(C);	Mask *mask = CTX_data_edit_mask(C);	int width, height;	float aspx, aspy;	float xscale, yscale;	if (!mask)		return;	ED_mask_get_size(sa, &width, &height);	ED_mask_get_aspect(sa, ar, &aspx, &aspy);	UI_view2d_scale_get(&ar->v2d, &xscale, &yscale);	draw_masklays(C, mask, draw_flag, draw_type, width, height, xscale * aspx, yscale * aspy);}
开发者ID:wisaac407,项目名称:blender,代码行数:20,


示例21: sample_invoke

static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event){	ARegion *ar = CTX_wm_region(C);	SpaceSeq *sseq = CTX_wm_space_seq(C);	ImageSampleInfo *info;	if (sseq->mainb != SEQ_DRAW_IMG_IMBUF)		return OPERATOR_CANCELLED;	info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");	info->art = ar->type;	info->draw_handle = ED_region_draw_cb_activate(ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL);	op->customdata = info;	sample_apply(C, op, event);	WM_event_add_modal_handler(C, op);	return OPERATOR_RUNNING_MODAL;}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:20,



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


C++ CTX_wm_region_set函数代码示例
C++ CTX_wm_manager函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。