这篇教程C++ CTX_wm_area函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CTX_wm_area函数的典型用法代码示例。如果您正苦于以下问题:C++ CTX_wm_area函数的具体用法?C++ CTX_wm_area怎么用?C++ CTX_wm_area使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CTX_wm_area函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例2: file_highlight_invokestatic 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,
示例3: render_view3d_dostatic 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,
示例4: change_frame_seq_preview_beginstatic 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,
示例5: add_feather_vertex_invokestatic 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,
示例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,
示例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,
示例8: select_report_pick_execstatic 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,
示例9: clip_prefetch_modalstatic 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,
示例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,
示例11: ED_animedit_unlink_actionvoid 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,
示例12: toggle_time_execstatic 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,
示例13: do_node_addstatic 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,
示例14: ED_maskedit_mask_pollint 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,
示例15: ED_mask_drawvoid 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,
示例16: reset_recent_execstatic 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,
示例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,
示例18: ED_view3d_smooth_viewvoid 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,
示例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,
示例20: screencast_execstatic 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,
示例21: console_history_cycle_exec/* the python exec operator uses this */static int console_history_cycle_exec(bContext *C, wmOperator *op){ SpaceConsole *sc = CTX_wm_space_console(C); ARegion *ar = CTX_wm_region(C); ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevents crashes when no command line */ const bool reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */ int prev_len = ci->len; /* keep a copy of the line above so when history is cycled * this is the only function that needs to know about the double-up */ if (ci->prev) { ConsoleLine *ci_prev = (ConsoleLine *)ci->prev; if (STREQ(ci->line, ci_prev->line)) console_history_free(sc, ci_prev); } if (reverse) { /* last item in history */ ci = sc->history.last; BLI_remlink(&sc->history, ci); BLI_addhead(&sc->history, ci); } else { ci = sc->history.first; BLI_remlink(&sc->history, ci); BLI_addtail(&sc->history, ci); } { /* add a duplicate of the new arg and remove all other instances */ ConsoleLine *cl; while ((cl = console_history_find(sc, ci->line, ci))) console_history_free(sc, cl); console_history_add(sc, (ConsoleLine *)sc->history.last); } ci = sc->history.last; console_select_offset(sc, ci->len - prev_len); /* could be wrapped so update scroll rect */ console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); console_scroll_bottom(ar); return OPERATOR_FINISHED;}
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:49,
示例22: primitive_add_invokestatic int primitive_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)){ ScrArea *sa = CTX_wm_area(C); float cursor[2]; int width, height; ED_mask_get_size(sa, &width, &height); ED_mask_cursor_location_get(sa, cursor); cursor[0] *= width; cursor[1] *= height; RNA_float_set_array(op->ptr, "location", cursor); return op->type->exec(C, op);}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:16,
示例23: file_filenum_execstatic int file_filenum_exec(bContext *C, wmOperator *op){ SpaceFile *sfile= CTX_wm_space_file(C); ScrArea *sa= CTX_wm_area(C); int inc = RNA_int_get(op->ptr, "increment"); if(sfile->params && (inc != 0)) { BLI_newname(sfile->params->file, inc); ED_area_tag_redraw(sa); file_draw_check_cb(C, NULL, NULL); // WM_event_add_notifier(C, NC_WINDOW, NULL); } return OPERATOR_FINISHED;}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:16,
注:本文中的CTX_wm_area函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CTX_wm_manager函数代码示例 C++ CTX_data_pointer_get_type函数代码示例 |