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


C++ CTX_wm_region函数代码示例

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


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

示例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,代码来源:wm_dragdrop.c

示例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,代码来源:gpencil_convert.c

示例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,代码来源:interface_region_popup.c

示例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,代码来源:mat_livedb_edit.c

示例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,代码来源:mat_livedb_edit.c

示例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,代码来源:mat_livedb_edit.c

示例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,代码来源:paint_stroke.c

示例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,代码来源:outliner_tools.c

示例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,代码来源:paint_curve.c

示例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,代码来源:anim_ops.c

示例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,代码来源:paint_mask.c

示例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,代码来源:clip_graph_ops.c

示例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,代码来源:clip_ops.c

示例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,代码来源:clip_ops.c


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