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

C++ CTX_wm_area函数代码示例

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

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



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

示例1: pose_slide_init

/* operator init */
static int pose_slide_init(bContext *C, wmOperator *op, short mode)
{
	tPoseSlideOp *pso;
	bAction *act = NULL;
	
	/* init slide-op data */
	pso = op->customdata = MEM_callocN(sizeof(tPoseSlideOp), "tPoseSlideOp");
	
	/* get info from context */
	pso->scene = CTX_data_scene(C);
	pso->ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
	pso->arm = (pso->ob) ? pso->ob->data : NULL;
	pso->sa = CTX_wm_area(C); /* only really needed when doing modal() */
	pso->ar = CTX_wm_region(C); /* only really needed when doing modal() */
	
	pso->cframe = pso->scene->r.cfra;
	pso->mode = mode;
	
	/* set range info from property values - these may get overridden for the invoke() */
	pso->percentage = RNA_float_get(op->ptr, "percentage");
	pso->prevFrame = RNA_int_get(op->ptr, "prev_frame");
	pso->nextFrame = RNA_int_get(op->ptr, "next_frame");
	
	/* check the settings from the context */
	if (ELEM(NULL, pso->ob, pso->arm, pso->ob->adt, pso->ob->adt->action))
		return 0;
	else
		act = pso->ob->adt->action;
	
	/* for each Pose-Channel which gets affected, get the F-Curves for that channel 
	 * and set the relevant transform flags...
	 */
	poseAnim_mapping_get(C, &pso->pfLinks, pso->ob, act);
	
	/* set depsgraph flags */
	/* make sure the lock is set OK, unlock can be accidentally saved? */
	pso->ob->pose->flag |= POSE_LOCKED;
	pso->ob->pose->flag &= ~POSE_DO_UNLOCK;
	
	/* do basic initialize of RB-BST used for finding keyframes, but leave the filling of it up 
	 * to the caller of this (usually only invoke() will do it, to make things more efficient).
	 */
	BLI_dlrbTree_init(&pso->keys);
	
	/* initialise numeric input */
	initNumInput(&pso->num);
	pso->num.idx_max = 0; /* one axis */
	pso->num.val_flag[0] |= NUM_NO_NEGATIVE;
	pso->num.unit_type[0] = B_UNIT_NONE; /* percentages don't have any units... */
	
	/* return status is whether we've got all the data we were requested to get */
	return 1;
}
开发者ID:UPBGE,项目名称:blender,代码行数:54,代码来源:pose_slide.c


示例2: file_highlight_invoke

static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
	ARegion *ar= CTX_wm_region(C);
	SpaceFile *sfile= CTX_wm_space_file(C);

	if(!file_hilight_set(sfile, ar, event->x, event->y))
		return OPERATOR_CANCELLED;

	ED_area_tag_redraw(CTX_wm_area(C));
	
	return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:12,代码来源:file_ops.c


示例3: render_view3d_do

static void render_view3d_do(RenderEngine *engine, const bContext *C)
{
	wmJob *wm_job;
	RenderPreview *rp;
	Scene *scene = CTX_data_scene(C);
	ARegion *ar = CTX_wm_region(C);
	int width = ar->winx, height = ar->winy;
	int divider = 1;
	int resolution_threshold = scene->r.preview_start_resolution *
	                           scene->r.preview_start_resolution;

	if (CTX_wm_window(C) == NULL)
		return;
	if (!render_view3d_flag_changed(engine, C))
		return;

	wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), CTX_wm_region(C), "Render Preview",
	                     WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
	rp = MEM_callocN(sizeof(RenderPreview), "render preview");
	rp->job = wm_job;

	while (width * height > resolution_threshold) {
		width = max_ii(1, width / 2);
		height = max_ii(1, height / 2);
		divider *= 2;
	}

	/* customdata for preview thread */
	rp->scene = scene;
	rp->engine = engine;
	rp->sa = CTX_wm_area(C);
	rp->ar = CTX_wm_region(C);
	rp->v3d = rp->sa->spacedata.first;
	rp->rv3d = CTX_wm_region_view3d(C);
	rp->bmain = CTX_data_main(C);
	rp->resolution_divider = divider;
	rp->start_resolution_divider = divider;
	rp->has_freestyle = (scene->r.mode & R_EDGE_FRS) != 0;
	copy_m4_m4(rp->viewmat, rp->rv3d->viewmat);
	
	/* clear info text */
	engine->text[0] = '\0';
	
	/* setup job */
	WM_jobs_customdata_set(wm_job, rp, render_view3d_free);
	WM_jobs_timer(wm_job, 0.1, NC_SPACE | ND_SPACE_VIEW3D, NC_SPACE | ND_SPACE_VIEW3D);
	WM_jobs_callbacks(wm_job, render_view3d_startjob, NULL, NULL, NULL);
	
	WM_jobs_start(CTX_wm_manager(C), wm_job);
	
	engine->flag &= ~RE_ENGINE_DO_UPDATE;
}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:52,代码来源:render_internal.c


示例4: change_frame_seq_preview_begin

static void change_frame_seq_preview_begin(bContext *C, const wmEvent *event)
{
	ScrArea *sa = CTX_wm_area(C);
	bScreen *screen = CTX_wm_screen(C);
	if (sa && sa->spacetype == SPACE_SEQ) {
		SpaceSeq *sseq = sa->spacedata.first;
		if (ED_space_sequencer_check_show_strip(sseq)) {
			ED_sequencer_special_preview_set(C, event->mval);
		}
	}
	if (screen)
		screen->scrubbing = true;
}
开发者ID:UPBGE,项目名称:blender,代码行数:13,代码来源:anim_ops.c


示例5: add_feather_vertex_invoke

static int add_feather_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	ScrArea *sa = CTX_wm_area(C);
	ARegion *ar = CTX_wm_region(C);

	float co[2];

	ED_mask_mouse_pos(sa, ar, event->mval, co);

	RNA_float_set_array(op->ptr, "location", co);

	return add_feather_vertex_exec(C, op);
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:13,代码来源:mask_add.c


示例6: change_frame_poll

/* Check if the operator can be run from the current context */
static int change_frame_poll(bContext *C)
{
    ScrArea *curarea= CTX_wm_area(C);

    /* XXX temp? prevent changes during render */
    if(G.rendering) return 0;

    /* as long as there is an active area, and it isn't a Graph Editor
     * (since the Graph Editor has its own version which does extra stuff),
     * we're fine
     */
    return ((curarea) && (curarea->spacetype != SPACE_IPO));
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:14,代码来源:anim_ops.c


示例7: CTX_wm_area

/* Temporary wrapper for driver operators for buttons to make it easier to create
 * such drivers by rerouting all paths through the active object instead so that
 * they will get picked up by the dependency system.
 *
 * < C: context pointer - for getting active data 
 * <> ptr: RNA pointer for property's datablock. May be modified as result of path remapping.
 * < prop: RNA definition of property to add for
 *
 * > returns: MEM_alloc'd string representing the path to the property from the given PointerRNA
 */
static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
	ID *id = (ID *)ptr->id.data;
	ScrArea *sa = CTX_wm_area(C);
	
	/* get standard path which may be extended */
	char *basepath = RNA_path_from_ID_to_property(ptr, prop);
	char *path = basepath; /* in case no remapping is needed */
	
	
	/* Remapping will only be performed in the Properties Editor, as only this 
	 * restricts the subspace of options to the 'active' data (a manageable state)
	 */
	// TODO: watch out for pinned context?
	if ((sa) && (sa->spacetype == SPACE_BUTS)) {
		Object *ob = CTX_data_active_object(C);
		
		if (ob && id) {
			/* only id-types which can be remapped to go through objects should be considered */
			switch (GS(id->name)) {
				case ID_TE: /* textures */
				{
					Material *ma = give_current_material(ob, ob->actcol);
					Tex *tex = give_current_material_texture(ma);
					
					/* assumes: texture will only be shown if it is active material's active texture it's ok */
					if ((ID *)tex == id) {
						/* create new path */
						// TODO: use RNA path functions to construct step by step instead?
						// FIXME: maybe this isn't even needed anymore...
						path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s", 
						                    ma->id.name + 2, tex->id.name + 2, basepath);
							
						/* free old one */
						MEM_freeN(basepath);
					}
				}
				break;
			}
			
			/* fix RNA pointer, as we've now changed the ID root by changing the paths */
			if (basepath != path) {
				/* rebase provided pointer so that it starts from object... */
				RNA_pointer_create(&ob->id, ptr->type, ptr->data, ptr);
			}
		}
	}
	
	/* the path should now have been corrected for use */
	return path;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:61,代码来源:drivers.c


示例8: 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


示例9: clip_prefetch_modal

static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
	/* no running blender, remove handler and pass through */
	if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_CLIP_PREFETCH))
		return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;

	/* running render */
	switch (event->type) {
		case ESCKEY:
			return OPERATOR_RUNNING_MODAL;
	}

	return OPERATOR_PASS_THROUGH;
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:14,代码来源:clip_ops.c


示例10: ANIM_headerUI_standard_buttons

/* standard header buttons for Animation Editors */
short ANIM_headerUI_standard_buttons (const bContext *C, bDopeSheet *ads, uiBlock *block, short xco, short yco)
{
    Main *mainptr= CTX_data_main(C);
    ScrArea *sa= CTX_wm_area(C);
    short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));

    /* check if the DopeSheet data exists, just in case... */
    if (ads) {
        /* more 'generic' filtering options */
        if (nlaActive) uiBlockBeginAlign(block);
        uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Only display selected Objects");
        if (nlaActive) uiDefIconButBitI(block, TOGN, ADS_FILTER_NLA_NOACT, B_REDR, ICON_ACTION,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Include AnimData blocks with no NLA Data");
        if (nlaActive) uiBlockEndAlign(block);
        xco += 5;

        /* datatype based - only available datatypes are shown */
        uiBlockBeginAlign(block);
        uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
        uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display World Animation");
        if (mainptr && mainptr->key.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
        if (mainptr && mainptr->mat.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Material Data");
        if (mainptr && mainptr->lamp.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Lamp Data");
        if (mainptr && mainptr->camera.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Camera Data");
        if (mainptr && mainptr->curve.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Curve Data");
        if (mainptr && mainptr->mball.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display MetaBall Data");
        if (mainptr && mainptr->armature.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Armature Data");
        if (mainptr && mainptr->particle.first)
            uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA,	(short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Particle Data");
        uiBlockEndAlign(block);
        xco += 30;
    }
    else {
        // XXX this case shouldn't happen at all... for now, just pad out same amount of space
        printf("ERROR: dopesheet data not available when drawing Animation Editor header \n");
        xco += 11*XIC + 30;
    }

    // TODO: include auto-snapping menu here too...

    /* return the width of the buttons */
    return xco;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:50,代码来源:anim_draw.c


示例11: ED_animedit_unlink_action

void ED_animedit_unlink_action(bContext *C, ID *id, AnimData *adt, bAction *act, ReportList *reports)
{
	ScrArea *sa = CTX_wm_area(C);
	
	/* If the old action only has a single user (that it's about to lose),
	 * warn user about it
	 *
	 * TODO: Maybe we should just save it for them? But then, there's the problem of
	 *       trying to get rid of stuff that's actually unwanted!
	 */
	if (act->id.us == 1) {
		BKE_reportf(reports, RPT_WARNING,
		            "Action '%s' will not be saved, create Fake User or Stash in NLA Stack to retain",
		            act->id.name + 2);
	}
	
	/* If in Tweak Mode, don't unlink. Instead, this 
	 * becomes a shortcut to exit Tweak Mode instead
	 */
	if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
		/* Exit Tweak Mode */
		BKE_nla_tweakmode_exit(adt);
		
		/* Flush this to the Action Editor (if that's where this change was initiated) */
		if (sa->spacetype == SPACE_ACTION) {
			actedit_change_action(C, NULL);
		}
	}
	else {
		/* Unlink normally - Setting it to NULL should be enough to get the old one unlinked */
		if (sa->spacetype == SPACE_ACTION) {
			/* clear action editor -> action */
			actedit_change_action(C, NULL);
		}
		else {
			/* clear AnimData -> action */
			PointerRNA ptr;
			PropertyRNA *prop;
			
			/* create AnimData RNA pointers */
			RNA_pointer_create(id, &RNA_AnimData, adt, &ptr);
			prop = RNA_struct_find_property(&ptr, "action");
			
			/* clear... */
			RNA_property_pointer_set(&ptr, prop, PointerRNA_NULL);
			RNA_property_update(C, &ptr, prop);
		}
	}
}
开发者ID:kujira70,项目名称:Blender,代码行数:49,代码来源:action_data.c


示例12: toggle_time_exec

static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op))
{
    ScrArea *curarea= CTX_wm_area(C);

    if (curarea == NULL)
        return OPERATOR_CANCELLED;

    /* simply toggle draw frames flag in applicable spaces */
    // XXX or should relevant spaces define their own version of this?
    switch (curarea->spacetype) {
    case SPACE_TIME: /* TimeLine */
    {
        SpaceTime *stime= CTX_wm_space_time(C);
        stime->flag ^= TIME_DRAWFRAMES;
    }
    break;
    case SPACE_ACTION: /* Action Editor */
    {
        SpaceAction *saction= CTX_wm_space_action(C);
        saction->flag ^= SACTION_DRAWTIME;
    }
    break;
    case SPACE_IPO: /* Graph Editor */
    {
        SpaceIpo *sipo= CTX_wm_space_graph(C);
        sipo->flag ^= SIPO_DRAWTIME;
    }
    break;
    case SPACE_NLA: /* NLA Editor */
    {
        SpaceNla *snla= CTX_wm_space_nla(C);
        snla->flag ^= SNLA_DRAWTIME;
    }
    break;
    case SPACE_SEQ: /* Sequencer */
    {
        SpaceSeq *sseq= CTX_wm_space_seq(C);
        sseq->flag ^= SEQ_DRAWFRAMES;
    }
    break;

    default: /* editor doesn't show frames */
        return OPERATOR_CANCELLED; // XXX or should we pass through instead?
    }

    ED_area_tag_redraw(curarea);

    return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:49,代码来源:anim_ops.c


示例13: do_node_add

static void do_node_add(bContext *C, bNodeTemplate *ntemp)
{
	Main *bmain = CTX_data_main(C);
	Scene *scene = CTX_data_scene(C);
	SpaceNode *snode = CTX_wm_space_node(C);
	ScrArea *sa = CTX_wm_area(C);
	ARegion *ar;
	bNode *node, *node_new;
	
	/* get location to add node at mouse */
	for (ar = sa->regionbase.first; ar; ar = ar->next) {
		if (ar->regiontype == RGN_TYPE_WINDOW) {
			wmWindow *win = CTX_wm_window(C);
			int x = win->eventstate->x - ar->winrct.xmin;
			int y = win->eventstate->y - ar->winrct.ymin;
			
			if (y < 60) y += 60;
			UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);
		}
	}
	
	/* store selection in temp test flag */
	for (node = snode->edittree->nodes.first; node; node = node->next) {
		if (node->flag & NODE_SELECT) node->flag |= NODE_TEST;
		else node->flag &= ~NODE_TEST;
	}
	
	node_new = node_add_node(snode, bmain, scene, ntemp, snode->cursor[0], snode->cursor[1]);
	
	/* select previous selection before autoconnect */
	for (node = snode->edittree->nodes.first; node; node = node->next) {
		if (node->flag & NODE_TEST) node->flag |= NODE_SELECT;
	}
	
	/* deselect after autoconnection */
	for (node = snode->edittree->nodes.first; node; node = node->next) {
		if (node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;
	}

	/* once this is called from an operator, this should be removed */
	if (node_new) {
		char undostr[BKE_UNDO_STR_MAX];
		BLI_snprintf(undostr, sizeof(undostr), "Add Node %s", nodeLabel(node_new));
		BKE_write_undo(C, undostr);
	}

	snode_notify(C, snode);
	snode_dag_update(C, snode);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:49,代码来源:node_header.c


示例14: ED_maskedit_mask_poll

int ED_maskedit_mask_poll(bContext *C)
{
	ScrArea *sa = CTX_wm_area(C);
	if (sa) {
		switch (sa->spacetype) {
			case SPACE_CLIP:
				return ED_space_clip_maskedit_mask_poll(C);
			case SPACE_SEQ:
				return ED_space_sequencer_maskedit_mask_poll(C);
			case SPACE_IMAGE:
				return ED_space_image_maskedit_mask_poll(C);
		}
	}
	return FALSE;
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:15,代码来源:mask_edit.c


示例15: ED_mask_draw

void ED_mask_draw(const bContext *C,
                  const char draw_flag, const char draw_type)
{
	ScrArea *sa = CTX_wm_area(C);

	Mask *mask = CTX_data_edit_mask(C);
	int width, height;

	if (!mask)
		return;

	ED_mask_get_size(sa, &width, &height);

	draw_masklays(C, mask, draw_flag, draw_type, width, height);
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:15,代码来源:mask_draw.c


示例16: reset_recent_exec

static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op))
{
	ScrArea *sa = CTX_wm_area(C);
	char name[FILE_MAX];
	struct FSMenu *fsmenu = fsmenu_get();
	
	while (fsmenu_get_entry(fsmenu, FS_CATEGORY_RECENT, 0) != NULL) {
		fsmenu_remove_entry(fsmenu, FS_CATEGORY_RECENT, 0);
	}
	BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
	fsmenu_write_file(fsmenu, name);
	ED_area_tag_redraw(sa);
		
	return OPERATOR_FINISHED;
}
开发者ID:manwapastorelli,项目名称:blender-git,代码行数:15,代码来源:file_ops.c


示例17: CTX_wm_area

/* matches logic with ED_operator_posemode_context() */
Object *ED_pose_object_from_context(bContext *C)
{
	ScrArea *sa = CTX_wm_area(C);
	Object *ob;

	/* since this call may also be used from the buttons window, we need to check for where to get the object */
	if (sa && sa->spacetype == SPACE_BUTS) {
		ob = ED_object_context(C);
	}
	else {
		ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
	}

	return ob;
}
开发者ID:Moguri,项目名称:blender,代码行数:16,代码来源:pose_edit.c


示例18: ED_view3d_smooth_view

void ED_view3d_smooth_view(
        bContext *C,
        View3D *v3d, ARegion *ar, Object *oldcamera, Object *camera,
        const float *ofs, const float *quat, const float *dist, const float *lens,
        const int smooth_viewtx)
{
	wmWindowManager *wm = CTX_wm_manager(C);
	wmWindow *win = CTX_wm_window(C);
	ScrArea *sa = CTX_wm_area(C);

	ED_view3d_smooth_view_ex(
	        wm, win, sa,
	        v3d, ar, oldcamera, camera,
	        ofs, quat, dist, lens, smooth_viewtx);
}
开发者ID:greg100795,项目名称:blender-git,代码行数:15,代码来源:view3d_view.c


示例19: graphop_editable_keyframes_poll

/* Check if there are any visible + editable keyframes (for editing tools) */
int graphop_editable_keyframes_poll(bContext *C)
{
	bAnimContext ac;
	bAnimListElem *ale;
	ListBase anim_data = {NULL, NULL};
	ScrArea *sa = CTX_wm_area(C);
	size_t items;
	int filter;
	short found = 0;
	
	/* firstly, check if in Graph Editor */
	// TODO: also check for region?
	if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
		return 0;
		
	/* try to init Anim-Context stuff ourselves and check */
	if (ANIM_animdata_get_context(C, &ac) == 0)
		return 0;
	
	/* loop over the editable F-Curves, and see if they're suitable
	 * stopping on the first successful match
	 */
	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
	items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
	if (items == 0) 
		return 0;
	
	for (ale = anim_data.first; ale; ale = ale->next) {
		FCurve *fcu = (FCurve *)ale->data;
		
		/* editable curves must fulfill the following criteria:
		 *	- it has bezier keyframes
		 *	- it must not be protected from editing (this is already checked for with the foredit flag
		 *	- F-Curve modifiers do not interfere with the result too much 
		 *	  (i.e. the modifier-control drawing check returns false)
		 */
		if (fcu->bezt == NULL)
			continue;
		if (fcurve_is_keyframable(fcu)) {
			found = 1;
			break;
		}
	}
	
	/* cleanup and return findings */
	BLI_freelistN(&anim_data);
	return found;
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:49,代码来源:graph_utils.c


示例20: screencast_exec

static int screencast_exec(bContext *C, wmOperator *op)
{
    wmWindowManager *wm = CTX_wm_manager(C);
    wmWindow *win = CTX_wm_window(C);
    bScreen *screen = CTX_wm_screen(C);
    wmJob *wm_job;
    ScreenshotJob *sj;

    /* if called again, stop the running job */
    if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
        WM_jobs_stop(wm, screen, screenshot_startjob);

    wm_job = WM_jobs_get(wm, win, screen, "Screencast", 0, WM_JOB_TYPE_SCREENCAST);
    sj = MEM_callocN(sizeof(ScreenshotJob), "screenshot job");

    /* setup sj */
    if (RNA_boolean_get(op->ptr, "full")) {
        sj->x = 0;
        sj->y = 0;
        sj->dumpsx = WM_window_pixels_x(win);
        sj->dumpsy = WM_window_pixels_y(win);
    }
    else {
        ScrArea *curarea = CTX_wm_area(C);
        sj->x = curarea->totrct.xmin;
        sj->y = curarea->totrct.ymin;
        sj->dumpsx = curarea->totrct.xmax - sj->x;
        sj->dumpsy = curarea->totrct.ymax - sj->y;
    }
    sj->bmain = CTX_data_main(C);
    sj->scene = CTX_data_scene(C);
    sj->wm = wm;

    BKE_reports_init(&sj->reports, RPT_PRINT);

    /* setup job */
    WM_jobs_customdata_set(wm_job, sj, screenshot_freejob);
    WM_jobs_timer(wm_job, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
    WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, screenshot_endjob);

    WM_jobs_start(sj->wm, wm_job);

    screencast_cursor_toggle(sj->wm, 1);

    WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);

    return OPERATOR_FINISHED;
}
开发者ID:caomw,项目名称:blender-ui,代码行数:48,代码来源:screendump.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CTX_wm_manager函数代码示例发布时间:2022-05-30
下一篇:
C++ CTX_data_pointer_get_type函数代码示例发布时间: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