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

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

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

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

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

示例1: render_view3d_disprect

static int render_view3d_disprect(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rcti *disprect){	/* copied code from view3d_draw.c */	rctf viewborder;	int draw_border;		if (rv3d->persp == RV3D_CAMOB)		draw_border = (scene->r.mode & R_BORDER) != 0;	else		draw_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0;	if (draw_border) {		if (rv3d->persp == RV3D_CAMOB) {			ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false);						disprect->xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);			disprect->ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);			disprect->xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder);			disprect->ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder);		}		else {			disprect->xmin = v3d->render_border.xmin * ar->winx;			disprect->xmax = v3d->render_border.xmax * ar->winx;			disprect->ymin = v3d->render_border.ymin * ar->winy;			disprect->ymax = v3d->render_border.ymax * ar->winy;		}				return 1;	}		BLI_rcti_init(disprect, 0, 0, 0, 0);	return 0;}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:33,


示例2: draw_scope_end

static void draw_scope_end(const rctf *rect, GLint *scissor){	float scaler_x1, scaler_x2;		/* restore scissortest */	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);		/* scale widget */	scaler_x1 = rect->xmin + BLI_rctf_size_x(rect) / 2 - SCOPE_RESIZE_PAD;	scaler_x2 = rect->xmin + BLI_rctf_size_x(rect) / 2 + SCOPE_RESIZE_PAD;		glColor4f(0.f, 0.f, 0.f, 0.25f);	fdrawline(scaler_x1, rect->ymin - 4, scaler_x2, rect->ymin - 4);	fdrawline(scaler_x1, rect->ymin - 7, scaler_x2, rect->ymin - 7);	glColor4f(1.f, 1.f, 1.f, 0.25f);	fdrawline(scaler_x1, rect->ymin - 5, scaler_x2, rect->ymin - 5);	fdrawline(scaler_x1, rect->ymin - 8, scaler_x2, rect->ymin - 8);		/* outline */	glColor4f(0.f, 0.f, 0.f, 0.5f);	uiSetRoundBox(UI_CNR_ALL);	uiDrawBox(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f);}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:25,


示例3: view3d_winmatrix_set

/** * /param rect optional for picking (can be NULL). */void view3d_winmatrix_set(ARegion *ar, View3D *v3d, const rctf *rect){	RegionView3D *rv3d = ar->regiondata;	rctf viewplane;	float clipsta, clipend;	bool is_ortho;		is_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);	rv3d->is_persp = !is_ortho;#if 0	printf("%s: %d %d %f %f %f %f %f %f/n", __func__, winx, winy,	       viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax,	       clipsta, clipend);#endif	if (rect) {  /* picking */		rctf r;		r.xmin = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmin / (float)ar->winx));		r.ymin = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymin / (float)ar->winy));		r.xmax = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmax / (float)ar->winx));		r.ymax = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymax / (float)ar->winy));		viewplane = r;	}	if (is_ortho) {		wmOrtho(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);	}	else {		wmFrustum(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);	}	/* update matrix in 3d view region */	glGetFloatv(GL_PROJECTION_MATRIX, (float *)rv3d->winmat);}
开发者ID:greg100795,项目名称:blender-git,代码行数:38,


示例4: logic_view_all_exec

static int logic_view_all_exec(bContext *C, wmOperator *UNUSED(op)){    ARegion *ar = CTX_wm_region(C);    rctf cur_new = ar->v2d.tot;    float aspect = BLI_rctf_size_y(&ar->v2d.cur) / BLI_rctf_size_x(&ar->v2d.cur);    /* force the view2d code to zoom to width, not height */    cur_new.ymin = cur_new.ymax - BLI_rctf_size_x(&cur_new) * aspect;    UI_view2d_smooth_view(C, ar, &cur_new);    return OPERATOR_FINISHED;}
开发者ID:244xiao,项目名称:blender,代码行数:13,


示例5: ED_fileselect_layout_numfiles

int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar){	int numfiles;	/* Values in pixels.	 *	 * - *_item: size of each (row|col), (including padding)	 * - *_view: (x|y) size of the view.	 * - *_over: extra pixels, to take into account, when the fit isnt exact	 *   (needed since you may see the end of the previous column and the beginning of the next).	 *	 * Could be more clever and take scrolling into account,	 * but for now don't bother.	 */	if (layout->flag & FILE_LAYOUT_HOR) {		const int x_item = layout->tile_w + (2 * layout->tile_border_x);		const int x_view = (int)(BLI_rctf_size_x(&ar->v2d.cur));		const int x_over = x_item - (x_view % x_item);		numfiles = (int)((float)(x_view + x_over) / (float)(x_item));		return numfiles * layout->rows;	}	else {		const int y_item = layout->tile_h + (2 * layout->tile_border_y);		const int y_view = (int)(BLI_rctf_size_y(&ar->v2d.cur));		const int y_over = y_item - (y_view % y_item);		numfiles = (int)((float)(y_view + y_over) / (float)(y_item));		return numfiles * layout->columns;	}}
开发者ID:bitfusionio,项目名称:blender,代码行数:29,


示例6: curvemapping_changed

/* note; only does current curvemap! */void curvemapping_changed(CurveMapping *cumap, int rem_doubles){	CurveMap *cuma = cumap->cm + cumap->cur;	CurveMapPoint *cmp = cuma->curve;	rctf *clipr = &cumap->clipr;	float thresh = 0.01f * BLI_rctf_size_x(clipr);	float dx = 0.0f, dy = 0.0f;	int a;	cumap->changed_timestamp++;	/* clamp with clip */	if (cumap->flag & CUMA_DO_CLIP) {		for (a = 0; a < cuma->totpoint; a++) {			if (cmp[a].flag & CUMA_SELECT) {				if (cmp[a].x < clipr->xmin)					dx = min_ff(dx, cmp[a].x - clipr->xmin);				else if (cmp[a].x > clipr->xmax)					dx = max_ff(dx, cmp[a].x - clipr->xmax);				if (cmp[a].y < clipr->ymin)					dy = min_ff(dy, cmp[a].y - clipr->ymin);				else if (cmp[a].y > clipr->ymax)					dy = max_ff(dy, cmp[a].y - clipr->ymax);			}		}		for (a = 0; a < cuma->totpoint; a++) {			if (cmp[a].flag & CUMA_SELECT) {				cmp[a].x -= dx;				cmp[a].y -= dy;			}		}	}			qsort(cmp, cuma->totpoint, sizeof(CurveMapPoint), sort_curvepoints);		/* remove doubles, threshold set on 1% of default range */	if (rem_doubles && cuma->totpoint > 2) {		for (a = 0; a < cuma->totpoint - 1; a++) {			dx = cmp[a].x - cmp[a + 1].x;			dy = cmp[a].y - cmp[a + 1].y;			if (sqrtf(dx * dx + dy * dy) < thresh) {				if (a == 0) {					cmp[a + 1].flag |= CUMA_VECTOR;					if (cmp[a + 1].flag & CUMA_SELECT)						cmp[a].flag |= CUMA_SELECT;				}				else {					cmp[a].flag |= CUMA_VECTOR;					if (cmp[a].flag & CUMA_SELECT)						cmp[a + 1].flag |= CUMA_SELECT;				}				break;  /* we assume 1 deletion per edit is ok */			}		}		if (a != cuma->totpoint - 1)			curvemap_remove(cuma, 2);	}	curvemap_make_table(cuma, clipr);}
开发者ID:scorpion81,项目名称:blender-voro,代码行数:61,


示例7: ED_space_image_get_size

void ED_space_image_get_size(SpaceImage *sima, int *width, int *height){	Scene *scene = sima->iuser.scene;	ImBuf *ibuf;	void *lock;	ibuf = ED_space_image_acquire_buffer(sima, &lock);	if (ibuf && ibuf->x > 0 && ibuf->y > 0) {		*width = ibuf->x;		*height = ibuf->y;	}	else if (sima->image && sima->image->type == IMA_TYPE_R_RESULT && scene) {		/* not very important, just nice */		*width = (scene->r.xsch * scene->r.size) / 100;		*height = (scene->r.ysch * scene->r.size) / 100;		if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {			*width  *= BLI_rctf_size_x(&scene->r.border);			*height *= BLI_rctf_size_y(&scene->r.border);		}	}	/* I know a bit weak... but preview uses not actual image size */	// XXX else if (image_preview_active(sima, width, height));	else {		*width  = IMG_SIZE_FALLBACK;		*height = IMG_SIZE_FALLBACK;	}	ED_space_image_release_buffer(sima, ibuf, lock);}
开发者ID:Moguri,项目名称:blender,代码行数:32,


示例8: blf_font_width_and_height

void blf_font_width_and_height(        FontBLF *font, const char *str, size_t len,        float *r_width, float *r_height, struct ResultBLF *r_info){	float xa, ya;	rctf box;	if (font->flags & BLF_ASPECT) {		xa = font->aspect[0];		ya = font->aspect[1];	}	else {		xa = 1.0f;		ya = 1.0f;	}	if (font->flags & BLF_WORD_WRAP) {		blf_font_boundbox__wrap(font, str, len, &box, r_info);	}	else {		blf_font_boundbox(font, str, len, &box, r_info);	}	*r_width  = (BLI_rctf_size_x(&box) * xa);	*r_height = (BLI_rctf_size_y(&box) * ya);}
开发者ID:Ichthyostega,项目名称:blender,代码行数:25,


示例9: dopesheet_view_all_exec

static int dopesheet_view_all_exec(bContext *C, wmOperator *UNUSED(op)){	SpaceClip *sc = CTX_wm_space_clip(C);	ARegion *ar = CTX_wm_region(C);	View2D *v2d = &ar->v2d;	MovieClip *clip = ED_space_clip_get_clip(sc);	MovieTracking *tracking = &clip->tracking;	MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;	MovieTrackingDopesheetChannel *channel;	int frame_min = INT_MAX, frame_max = INT_MIN;	for (channel = dopesheet->channels.first; channel; channel = channel->next) {		frame_min = min_ii(frame_min, channel->segments[0]);		frame_max = max_ii(frame_max, channel->segments[channel->tot_segment]);	}	if (frame_min < frame_max) {		float extra;		v2d->cur.xmin = frame_min;		v2d->cur.xmax = frame_max;		/* 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;		ED_region_tag_redraw(ar);	}	return OPERATOR_FINISHED;}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:33,


示例10: node_circleselect_exec

static int node_circleselect_exec(bContext *C, wmOperator *op){	SpaceNode *snode = CTX_wm_space_node(C);	ARegion *ar = CTX_wm_region(C);	bNode *node;	int x, y, radius, gesture_mode;	float offset[2];	float zoom  = (float)(BLI_rcti_size_x(&ar->winrct)) / (float)(BLI_rctf_size_x(&ar->v2d.cur));	gesture_mode = RNA_int_get(op->ptr, "gesture_mode");	/* get operator properties */	x = RNA_int_get(op->ptr, "x");	y = RNA_int_get(op->ptr, "y");	radius = RNA_int_get(op->ptr, "radius");	UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]);	for (node = snode->edittree->nodes.first; node; node = node->next) {		if (BLI_rctf_isect_circle(&node->totr, offset, radius / zoom)) {			nodeSetSelected(node, (gesture_mode == GESTURE_MODAL_SELECT));		}	}	WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL);	return OPERATOR_FINISHED;}
开发者ID:bitfusionio,项目名称:blender,代码行数:30,


示例11: BLI_rcti_rctf_copy

void BLI_rcti_rctf_copy(rcti *dst, const rctf *src){	dst->xmin = floorf(src->xmin + 0.5f);	dst->xmax = dst->xmin + floorf(BLI_rctf_size_x(src) + 0.5f);	dst->ymin = floorf(src->ymin + 0.5f);	dst->ymax = dst->ymin + floorf(BLI_rctf_size_y(src) + 0.5f);}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:7,


示例12: TargetSnapOffset

static void TargetSnapOffset(TransInfo *t, TransData *td){	if (t->spacetype == SPACE_NODE && td != NULL) {		bNode *node = td->extra;		char border = t->tsnap.snapNodeBorder;		float width  = BLI_rctf_size_x(&node->totr);		float height = BLI_rctf_size_y(&node->totr);		#ifdef USE_NODE_CENTER		if (border & NODE_LEFT)			t->tsnap.snapTarget[0] -= 0.5f * width;		if (border & NODE_RIGHT)			t->tsnap.snapTarget[0] += 0.5f * width;		if (border & NODE_BOTTOM)			t->tsnap.snapTarget[1] -= 0.5f * height;		if (border & NODE_TOP)			t->tsnap.snapTarget[1] += 0.5f * height;#else		if (border & NODE_LEFT)			t->tsnap.snapTarget[0] -= 0.0f;		if (border & NODE_RIGHT)			t->tsnap.snapTarget[0] += width;		if (border & NODE_BOTTOM)			t->tsnap.snapTarget[1] -= height;		if (border & NODE_TOP)			t->tsnap.snapTarget[1] += 0.0f;#endif	}}
开发者ID:diekev,项目名称:blender,代码行数:29,


示例13: draw_seq_strips

/* draw the contents of the sequencer strips view */static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar){	Scene *scene = CTX_data_scene(C);	View2D *v2d = &ar->v2d;	Sequence *last_seq = BKE_sequencer_active_get(scene);	int sel = 0, j;	float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);		/* loop through twice, first unselected, then selected */	for (j = 0; j < 2; j++) {		Sequence *seq;		int outline_tint = (j) ? -60 : -150; /* highlighting around strip edges indicating selection */				/* loop through strips, checking for those that are visible */		for (seq = ed->seqbasep->first; seq; seq = seq->next) {			/* boundbox and selection tests for NOT drawing the strip... */			if ((seq->flag & SELECT) != sel) continue;			else if (seq == last_seq) continue;			else if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) continue;			else if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue;			else if (seq->machine + 1.0f < v2d->cur.ymin) continue;			else if (seq->machine > v2d->cur.ymax) continue;						/* strip passed all tests unscathed... so draw it now */			draw_seq_strip(scene, ar, seq, outline_tint, pixelx);		}				/* draw selected next time round */		sel = SELECT;	}		/* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */	if (last_seq)		draw_seq_strip(scene, ar, last_seq, 120, pixelx);}
开发者ID:ideasman42,项目名称:blender-wayland,代码行数:36,


示例14: gp_strokepoint_convertcoords

/* convert the coordinates from the given stroke point into 3d-coordinates *	- assumes that the active space is the 3D-View */static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoint *pt, float p3d[3], rctf *subrect){	Scene *scene = CTX_data_scene(C);	View3D *v3d = CTX_wm_view3d(C);	ARegion *ar = CTX_wm_region(C);		if (gps->flag & GP_STROKE_3DSPACE) {		/* directly use 3d-coordinates */		copy_v3_v3(p3d, &pt->x);	}	else {		const float *fp = ED_view3d_cursor3d_get(scene, v3d);		float mvalf[2];				/* get screen coordinate */		if (gps->flag & GP_STROKE_2DSPACE) {			View2D *v2d = &ar->v2d;			UI_view2d_view_to_region_fl(v2d, pt->x, pt->y, &mvalf[0], &mvalf[1]);		}		else {			if (subrect) {				mvalf[0] = (((float)pt->x / 100.0f) * BLI_rctf_size_x(subrect)) + subrect->xmin;				mvalf[1] = (((float)pt->y / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin;			}			else {				mvalf[0] = (float)pt->x / 100.0f * ar->winx;				mvalf[1] = (float)pt->y / 100.0f * ar->winy;			}		}				ED_view3d_win_to_3d(ar, fp, mvalf, p3d);	}}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:36,


示例15: square_rctf

static float square_rctf(rctf *rf){	float x, y;	x = BLI_rctf_size_x(rf);	y = BLI_rctf_size_y(rf);	return x * y;}
开发者ID:wisaac407,项目名称:blender,代码行数:8,


示例16: drawPropCircle

/* called from drawview.c, as an extra per-window draw option */void drawPropCircle(const struct bContext *C, TransInfo *t){  if (t->flag & T_PROP_EDIT) {    RegionView3D *rv3d = CTX_wm_region_view3d(C);    float tmat[4][4], imat[4][4];    int depth_test_enabled;    if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {      copy_m4_m4(tmat, rv3d->viewmat);      invert_m4_m4(imat, tmat);    }    else {      unit_m4(tmat);      unit_m4(imat);    }    GPU_matrix_push();    if (t->spacetype == SPACE_VIEW3D) {      /* pass */    }    else if (t->spacetype == SPACE_IMAGE) {      GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]);    }    else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) {      /* only scale y */      rcti *mask = &t->ar->v2d.mask;      rctf *datamask = &t->ar->v2d.cur;      float xsize = BLI_rctf_size_x(datamask);      float ysize = BLI_rctf_size_y(datamask);      float xmask = BLI_rcti_size_x(mask);      float ymask = BLI_rcti_size_y(mask);      GPU_matrix_scale_2f(1.0f, (ysize / xsize) * (xmask / ymask));    }    depth_test_enabled = GPU_depth_test_enabled();    if (depth_test_enabled) {      GPU_depth_test(false);    }    uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);    immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);    immUniformThemeColor(TH_GRID);    set_inverted_drawing(1);    imm_drawcircball(t->center_global, t->prop_size, imat, pos);    set_inverted_drawing(0);    immUnbindProgram();    if (depth_test_enabled) {      GPU_depth_test(true);    }    GPU_matrix_pop();  }}
开发者ID:dfelinto,项目名称:blender,代码行数:59,


示例17: ED_clip_graph_center_current_frame

void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar){	View2D *v2d = &ar->v2d;	float extra = BLI_rctf_size_x(&v2d->cur) / 2.0f;	/* set extents of view to start/end frames */	v2d->cur.xmin = (float)CFRA - extra;	v2d->cur.xmax = (float)CFRA + extra;}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:9,


示例18: ED_space_image_get_zoom

void ED_space_image_get_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float *zoomy){	int width, height;	ED_space_image_get_size(sima, &width, &height);	*zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / (float)(BLI_rctf_size_x(&ar->v2d.cur) * width);	*zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / (float)(BLI_rctf_size_y(&ar->v2d.cur) * height);}
开发者ID:Moguri,项目名称:blender,代码行数:9,


示例19: BLI_rctf_scale

void BLI_rctf_scale(rctf *rect, const float scale){	const float cent_x      = BLI_rctf_cent_x(rect);	const float cent_y      = BLI_rctf_cent_y(rect);	const float size_x_half = BLI_rctf_size_x(rect) * (scale * 0.5f);	const float size_y_half = BLI_rctf_size_y(rect) * (scale * 0.5f);	rect->xmin = cent_x - size_x_half;	rect->ymin = cent_y - size_y_half;	rect->xmax = cent_x + size_x_half;	rect->ymax = cent_y + size_y_half;}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:11,


示例20: 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,


示例21: gp_point_to_xy_fl

/** * Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screenspace (2D) * * Just like gp_point_to_xy(), except the resulting coordinates are floats not ints. * Use this version to solve "stair-step" artifacts which may arise when roundtripping the calculations. * * /param r_x: [out] The screen-space x-coordinate of the point * /param r_y: [out] The screen-space y-coordinate of the point * * /warning This assumes that the caller has already checked whether the stroke in question can be drawn */void gp_point_to_xy_fl(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,                       float *r_x, float *r_y){	ARegion *ar = gsc->ar;	View2D *v2d = gsc->v2d;	rctf *subrect = gsc->subrect;	float xyval[2];	/* sanity checks */	BLI_assert(!(gps->flag & GP_STROKE_3DSPACE) || (gsc->sa->spacetype == SPACE_VIEW3D));	BLI_assert(!(gps->flag & GP_STROKE_2DSPACE) || (gsc->sa->spacetype != SPACE_VIEW3D));	if (gps->flag & GP_STROKE_3DSPACE) {		if (ED_view3d_project_float_global(ar, &pt->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {			*r_x = xyval[0];			*r_y = xyval[1];		}		else {			*r_x = 0.0f;			*r_y = 0.0f;		}	}	else if (gps->flag & GP_STROKE_2DSPACE) {		float vec[3] = {pt->x, pt->y, 0.0f};		int t_x, t_y;		mul_m4_v3(gsc->mat, vec);		UI_view2d_view_to_region_clip(v2d, vec[0], vec[1], &t_x, &t_y);		if ((t_x == t_y) && (t_x == V2D_IS_CLIPPED)) {			/* XXX: Or should we just always use the values as-is? */			*r_x = 0.0f;			*r_y = 0.0f;		}		else {			*r_x = (float)t_x;			*r_y = (float)t_y;		}	}	else {		if (subrect == NULL) {			/* normal 3D view (or view space) */			*r_x = (pt->x / 100.0f * ar->winx);			*r_y = (pt->y / 100.0f * ar->winy);		}		else {			/* camera view, use subrect */			*r_x = ((pt->x / 100.0f) * BLI_rctf_size_x(subrect)) + subrect->xmin;			*r_y = ((pt->y / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin;		}	}}
开发者ID:bdancer,项目名称:blender-for-vray,代码行数:64,


示例22: clipx_rctf

static float clipx_rctf(rctf *rf, float x1, float x2){	float size;	size = BLI_rctf_size_x(rf);	if (rf->xmin<x1) {		rf->xmin = x1;	}	if (rf->xmax>x2) {		rf->xmax = x2;	}	if (rf->xmin > rf->xmax) {		rf->xmin = rf->xmax;		return 0.0;	}	else if (size != 0.0f) {		return BLI_rctf_size_x(rf) / size;	}	return 1.0;}
开发者ID:wisaac407,项目名称:blender,代码行数:21,


示例23: blf_font_width

float blf_font_width(FontBLF *font, const char *str, size_t len){	float xa;	rctf box;	if (font->flags & BLF_ASPECT)		xa = font->aspect[0];	else		xa = 1.0f;	blf_font_boundbox(font, str, len, &box);	return BLI_rctf_size_x(&box) * xa;}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:13,


示例24: drawPropCircle

/* called from drawview.c, as an extra per-window draw option */void drawPropCircle(const struct bContext *C, TransInfo *t){	if (t->flag & T_PROP_EDIT) {		RegionView3D *rv3d = CTX_wm_region_view3d(C);		float tmat[4][4], imat[4][4];		int depth_test_enabled;		UI_ThemeColor(TH_GRID);		if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {			copy_m4_m4(tmat, rv3d->viewmat);			invert_m4_m4(imat, tmat);		}		else {			unit_m4(tmat);			unit_m4(imat);		}		glPushMatrix();		if (t->spacetype == SPACE_VIEW3D) {			/* pass */		}		else if (t->spacetype == SPACE_IMAGE) {			glScalef(1.0f / t->aspect[0], 1.0f / t->aspect[1], 1.0f);		}		else if (ELEM(t->spacetype, SPACE_IPO, SPACE_ACTION)) {			/* only scale y */			rcti *mask = &t->ar->v2d.mask;			rctf *datamask = &t->ar->v2d.cur;			float xsize = BLI_rctf_size_x(datamask);			float ysize = BLI_rctf_size_y(datamask);			float xmask = BLI_rcti_size_x(mask);			float ymask = BLI_rcti_size_y(mask);			glScalef(1.0f, (ysize / xsize) * (xmask / ymask), 1.0f);		}		depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);		if (depth_test_enabled)			glDisable(GL_DEPTH_TEST);		set_inverted_drawing(1);		drawcircball(GL_LINE_LOOP, t->center_global, t->prop_size, imat);		set_inverted_drawing(0);		if (depth_test_enabled)			glEnable(GL_DEPTH_TEST);		glPopMatrix();	}}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:52,


示例25: drawWalkPixel

static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg){  /* draws an aim/cross in the center */  WalkInfo *walk = arg;  const int outter_length = 24;  const int inner_length = 14;  int xoff, yoff;  rctf viewborder;  if (ED_view3d_cameracontrol_object_get(walk->v3d_camera_control)) {    ED_view3d_calc_camera_border(        walk->scene, walk->depsgraph, ar, walk->v3d, walk->rv3d, &viewborder, false);    xoff = viewborder.xmin + BLI_rctf_size_x(&viewborder) * 0.5f;    yoff = viewborder.ymin + BLI_rctf_size_y(&viewborder) * 0.5f;  }  else {    xoff = walk->ar->winx / 2;    yoff = walk->ar->winy / 2;  }  GPUVertFormat *format = immVertexFormat();  uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);  immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);  immUniformThemeColor(TH_VIEW_OVERLAY);  immBegin(GPU_PRIM_LINES, 8);  /* North */  immVertex2i(pos, xoff, yoff + inner_length);  immVertex2i(pos, xoff, yoff + outter_length);  /* East */  immVertex2i(pos, xoff + inner_length, yoff);  immVertex2i(pos, xoff + outter_length, yoff);  /* South */  immVertex2i(pos, xoff, yoff - inner_length);  immVertex2i(pos, xoff, yoff - outter_length);  /* West */  immVertex2i(pos, xoff - inner_length, yoff);  immVertex2i(pos, xoff - outter_length, yoff);  immEnd();  immUnbindProgram();}
开发者ID:dfelinto,项目名称:blender,代码行数:49,


示例26: ED_fileselect_layout_numfiles

int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar){	int numfiles;	if (layout->flag & FILE_LAYOUT_HOR) {		int width = (int)(BLI_rctf_size_x(&ar->v2d.cur) - 2 * layout->tile_border_x);		numfiles = (int)((float)width / (float)layout->tile_w + 0.5f);		return numfiles * layout->rows;	}	else {		int height = (int)(BLI_rctf_size_y(&ar->v2d.cur) - 2 * layout->tile_border_y);		numfiles = (int)((float)height / (float)layout->tile_h + 0.5f);		return numfiles * layout->columns;	}}
开发者ID:danielmarg,项目名称:blender-main,代码行数:15,


示例27: blf_font_width_and_height

void blf_font_width_and_height(FontBLF *font, const char *str, size_t len, float *width, float *height){	float xa, ya;	rctf box;	if (font->flags & BLF_ASPECT) {		xa = font->aspect[0];		ya = font->aspect[1];	}	else {		xa = 1.0f;		ya = 1.0f;	}	blf_font_boundbox(font, str, len, &box);	*width  = (BLI_rctf_size_x(&box) * xa);	*height = (BLI_rctf_size_y(&box) * ya);}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:18,


示例28: blf_font_width

float blf_font_width(FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info){	float xa;	rctf box;	if (font->flags & BLF_ASPECT)		xa = font->aspect[0];	else		xa = 1.0f;	if (font->flags & BLF_WORD_WRAP) {		blf_font_boundbox__wrap(font, str, len, &box, r_info);	}	else {		blf_font_boundbox(font, str, len, &box, r_info);	}	return BLI_rctf_size_x(&box) * xa;}
开发者ID:Ichthyostega,项目名称:blender,代码行数:18,



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


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