本文整理汇总了C++中CTX_wm_window_set函数的典型用法代码示例。如果您正苦于以下问题:C++ CTX_wm_window_set函数的具体用法?C++ CTX_wm_window_set怎么用?C++ CTX_wm_window_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CTX_wm_window_set函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rna_Area_type_update
static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win;
bScreen *sc = (bScreen *)ptr->id.data;
ScrArea *sa = (ScrArea *)ptr->data;
/* XXX this call still use context, so we trick it to work in the right context */
for (win = wm->windows.first; win; win = win->next) {
if (sc == win->screen) {
wmWindow *prevwin = CTX_wm_window(C);
ScrArea *prevsa = CTX_wm_area(C);
ARegion *prevar = CTX_wm_region(C);
CTX_wm_window_set(C, win);
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, NULL);
ED_area_newspace(C, sa, sa->butspacetype, true);
ED_area_tag_redraw(sa);
/* It is possible that new layers becomes visible. */
if (sa->spacetype == SPACE_VIEW3D) {
DAG_on_visible_update(CTX_data_main(C), false);
}
CTX_wm_window_set(C, prevwin);
CTX_wm_area_set(C, prevsa);
CTX_wm_region_set(C, prevar);
break;
}
}
}
开发者ID:wchargin,项目名称:blender,代码行数:33,代码来源:rna_screen.c
示例2: rna_Area_type_update
static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win;
bScreen *sc = (bScreen *)ptr->id.data;
ScrArea *sa = (ScrArea *)ptr->data;
/* XXX this call still use context, so we trick it to work in the right context */
for (win = wm->windows.first; win; win = win->next) {
if (sc == win->screen) {
wmWindow *prevwin = CTX_wm_window(C);
ScrArea *prevsa = CTX_wm_area(C);
ARegion *prevar = CTX_wm_region(C);
CTX_wm_window_set(C, win);
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, NULL);
ED_area_newspace(C, sa, sa->butspacetype);
ED_area_tag_redraw(sa);
CTX_wm_window_set(C, prevwin);
CTX_wm_area_set(C, prevsa);
CTX_wm_region_set(C, prevar);
break;
}
}
}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:28,代码来源:rna_screen.c
示例3: wm_draw_update
void wm_draw_update(bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win;
int drawmethod;
GPU_free_unused_buffers();
for (win = wm->windows.first; win; win = win->next) {
#ifdef WIN32
if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY)) {
GHOST_TWindowState state = GHOST_GetWindowState(win->ghostwin);
if (state == GHOST_kWindowStateMinimized) {
/* do not update minimized windows, it gives issues on intel drivers (see [#33223])
* anyway, it seems logical to skip update for invisible windows
*/
continue;
}
}
#endif
if (win->drawmethod != U.wmdrawmethod) {
wm_draw_window_clear(win);
win->drawmethod = U.wmdrawmethod;
}
if (wm_draw_update_test_window(win)) {
CTX_wm_window_set(C, win);
/* sets context window+screen */
wm_window_make_drawable(wm, win);
/* notifiers for screen redraw */
if (win->screen->do_refresh)
ED_screen_refresh(wm, win);
drawmethod = wm_automatic_draw_method(win);
if (win->drawfail)
wm_method_draw_overlap_all(C, win, 0);
else if (drawmethod == USER_DRAW_FULL)
wm_method_draw_full(C, win);
else if (drawmethod == USER_DRAW_OVERLAP)
wm_method_draw_overlap_all(C, win, 0);
else if (drawmethod == USER_DRAW_OVERLAP_FLIP)
wm_method_draw_overlap_all(C, win, 1);
else // if (drawmethod == USER_DRAW_TRIPLE)
wm_method_draw_triple(C, win);
win->screen->do_draw_gesture = false;
win->screen->do_draw_paintcursor = false;
win->screen->do_draw_drag = false;
wm_window_swap_buffers(win);
CTX_wm_window_set(C, NULL);
}
}
}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:59,代码来源:wm_draw.c
示例4: wm_window_match_init
/* To be able to read files without windows closing, opening, moving
* we try to prepare for worst case:
* - active window gets active screen from file
* - restoring the screens from non-active windows
* Best case is all screens match, in that case they get assigned to proper window
*/
static void wm_window_match_init(bContext *C, ListBase *wmlist)
{
wmWindowManager *wm;
wmWindow *win, *active_win;
*wmlist = G.main->wm;
BLI_listbase_clear(&G.main->wm);
active_win = CTX_wm_window(C);
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
for (wm = wmlist->first; wm; wm = wm->id.next) {
WM_jobs_kill_all(wm);
for (win = wm->windows.first; win; win = win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
ED_screen_exit(C, win, win->screen);
}
}
/* reset active window */
CTX_wm_window_set(C, active_win);
/* XXX Hack! We have to clear context menu here, because removing all modalhandlers above frees the active menu
* (at least, in the 'startup splash' case), causing use-after-free error in later handling of the button
* callbacks in UI code (see ui_apply_but_funcs_after()).
* Tried solving this by always NULL-ing context's menu when setting wm/win/etc., but it broke popups refreshing
* (see T47632), so for now just handling this specific case here. */
CTX_wm_menu_set(C, NULL);
ED_editors_exit(C);
/* just had return; here from r12991, this code could just get removed?*/
#if 0
if (wm == NULL) return;
if (G.fileflags & G_FILE_NO_UI) return;
/* we take apart the used screens from non-active window */
for (win = wm->windows.first; win; win = win->next) {
BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
if (win != wm->winactive) {
BLI_remlink(&G.main->screen, win->screen);
//BLI_addtail(screenbase, win->screen);
}
}
#endif
}
开发者ID:jonntd,项目名称:blender,代码行数:58,代码来源:wm_files.c
示例5: WM_init_splash
void WM_init_splash(bContext *C)
{
if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *prevwin = CTX_wm_window(C);
if (wm->windows.first) {
CTX_wm_window_set(C, wm->windows.first);
WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
CTX_wm_window_set(C, prevwin);
}
}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:13,代码来源:wm_init_exit.c
示例6: WM_window_open_temp
void WM_window_open_temp(bContext *C, rcti *position, int type)
{
wmWindow *win;
ScrArea *sa;
/* changes rect to fit within desktop */
wm_window_check_position(position);
/* test if we have a temp screen already */
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
if (win->screen->temp)
break;
/* add new window? */
if (win == NULL) {
win = wm_window_new(C);
win->posx = position->xmin;
win->posy = position->ymin;
}
win->sizex = position->xmax - position->xmin;
win->sizey = position->ymax - position->ymin;
if (win->ghostwin) {
wm_window_set_size(win, win->sizex, win->sizey);
wm_window_raise(win);
}
/* add new screen? */
if (win->screen == NULL)
win->screen = ED_screen_add(win, CTX_data_scene(C), "temp");
win->screen->temp = 1;
/* make window active, and validate/resize */
CTX_wm_window_set(C, win);
WM_check(C);
/* ensure it shows the right spacetype editor */
sa = win->screen->areabase.first;
CTX_wm_area_set(C, sa);
if (type == WM_WINDOW_RENDER) {
ED_area_newspace(C, sa, SPACE_IMAGE);
}
else {
ED_area_newspace(C, sa, SPACE_USERPREF);
}
ED_screen_set(C, win->screen);
if (sa->spacetype == SPACE_IMAGE)
GHOST_SetTitle(win->ghostwin, IFACE_("Blender Render"));
else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
GHOST_SetTitle(win->ghostwin, IFACE_("Blender User Preferences"));
else if (sa->spacetype == SPACE_FILE)
GHOST_SetTitle(win->ghostwin, IFACE_("Blender File View"));
else
GHOST_SetTitle(win->ghostwin, "Blender");
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:60,代码来源:wm_window.c
示例7: WM_read_homefile
/* op can be NULL */
int WM_read_homefile(bContext *C, wmOperator *op)
{
ListBase wmbase;
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
char *home= BLI_gethome();
int from_memory= op?RNA_boolean_get(op->ptr, "factory"):0;
int success;
BLI_clean(home);
free_ttfont(); /* still weird... what does it here? */
G.relbase_valid = 0;
if (!from_memory) {
BLI_make_file_string(G.sce, tstr, home, ".B25.blend");
}
strcpy(scestr, G.sce); /* temporary store */
/* prevent loading no UI */
G.fileflags &= ~G_FILE_NO_UI;
/* put aside screens to match with persistant windows later */
wm_window_match_init(C, &wmbase);
if (!from_memory && BLI_exists(tstr)) {
success = BKE_read_file(C, tstr, NULL, NULL);
} else {
success = BKE_read_file_from_memory(C, datatoc_B_blend, datatoc_B_blend_size, NULL, NULL);
if (wmbase.first == NULL) wm_clear_default_size(C);
}
/* match the read WM with current WM */
wm_window_match_do(C, &wmbase);
wm_check(C); /* opens window(s), checks keymaps */
strcpy(G.sce, scestr); /* restore */
wm_init_userdef();
/* When loading factory settings, the reset solid OpenGL lights need to be applied. */
GPU_default_lights();
/* XXX */
G.save_over = 0; // start with save preference untitled.blend
G.fileflags &= ~G_FILE_AUTOPLAY; /* disable autoplay in .B.blend... */
// mainwindow_set_filename_to_title(""); // empty string re-initializes title to "Blender"
// refresh_interface_font();
// undo_editmode_clear();
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
CTX_wm_window_set(C, NULL); /* exits queues */
return OPERATOR_FINISHED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:59,代码来源:wm_files.c
示例8: wm_window_match_init
/* To be able to read files without windows closing, opening, moving
* we try to prepare for worst case:
* - active window gets active screen from file
* - restoring the screens from non-active windows
* Best case is all screens match, in that case they get assigned to proper window
*/
static void wm_window_match_init(bContext *C, ListBase *wmlist)
{
wmWindowManager *wm;
wmWindow *win, *active_win;
*wmlist = G.main->wm;
BLI_listbase_clear(&G.main->wm);
active_win = CTX_wm_window(C);
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
for (wm = wmlist->first; wm; wm = wm->id.next) {
WM_jobs_kill_all(wm);
for (win = wm->windows.first; win; win = win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
ED_screen_exit(C, win, win->screen);
}
}
/* reset active window */
CTX_wm_window_set(C, active_win);
ED_editors_exit(C);
/* just had return; here from r12991, this code could just get removed?*/
#if 0
if (wm == NULL) return;
if (G.fileflags & G_FILE_NO_UI) return;
/* we take apart the used screens from non-active window */
for (win = wm->windows.first; win; win = win->next) {
BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
if (win != wm->winactive) {
BLI_remlink(&G.main->screen, win->screen);
//BLI_addtail(screenbase, win->screen);
}
}
#endif
}
开发者ID:ChunHungLiu,项目名称:blender,代码行数:51,代码来源:wm_files.c
示例9: WM_redraw_windows
void WM_redraw_windows(bContext *C)
{
wmWindow *win_prev = CTX_wm_window(C);
ScrArea *area_prev = CTX_wm_area(C);
ARegion *ar_prev = CTX_wm_region(C);
wm_draw_update(C);
CTX_wm_window_set(C, win_prev);
CTX_wm_area_set(C, area_prev);
CTX_wm_region_set(C, ar_prev);
}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:12,代码来源:wm_draw.c
示例10: wm_window_close
/* this is event from ghost, or exit-blender op */
void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
{
wmWindow *tmpwin;
bool do_exit = false;
/* first check if we have to quit (there are non-temp remaining windows) */
for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) {
if (tmpwin == win)
continue;
if (tmpwin->screen->temp == 0)
break;
}
if (tmpwin == NULL)
do_exit = 1;
if ((U.uiflag & USER_QUIT_PROMPT) && !wm->file_saved) {
if (do_exit) {
if (!GHOST_confirmQuit(win->ghostwin))
return;
}
}
/* let WM_exit do all freeing, for correct quit.blend save */
if (do_exit) {
WM_exit(C);
}
else {
bScreen *screen = win->screen;
BLI_remlink(&wm->windows, win);
wm_draw_window_clear(win);
CTX_wm_window_set(C, win); /* needed by handlers */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
/* for regular use this will _never_ be NULL,
* however we may be freeing an improperly initialized window. */
if (win->screen) {
ED_screen_exit(C, win, win->screen);
}
wm_window_free(C, wm, win);
/* if temp screen, delete it after window free (it stops jobs that can access it) */
if (screen && screen->temp) {
Main *bmain = CTX_data_main(C);
BKE_libblock_free(bmain, screen);
}
}
}
开发者ID:hendradarwin,项目名称:blender,代码行数:54,代码来源:wm_window.c
示例11: wm_window_close
/* this is event from ghost, or exit-blender op */
void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
{
wmWindow *tmpwin;
bScreen *screen = win->screen;
/* first check if we have any non-temp remaining windows */
if ((U.uiflag & USER_QUIT_PROMPT) && !wm->file_saved) {
if (wm->windows.first) {
for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) {
if (tmpwin == win)
continue;
if (tmpwin->screen->temp == 0)
break;
}
if (tmpwin == NULL) {
if (!GHOST_confirmQuit(win->ghostwin))
return;
}
}
}
BLI_remlink(&wm->windows, win);
wm_draw_window_clear(win);
CTX_wm_window_set(C, win); /* needed by handlers */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
ED_screen_exit(C, win, win->screen);
wm_window_free(C, wm, win);
/* if temp screen, delete it after window free (it stops jobs that can access it) */
if (screen->temp) {
Main *bmain = CTX_data_main(C);
BKE_libblock_free(&bmain->screen, screen);
}
/* check remaining windows */
if (wm->windows.first) {
for (win = wm->windows.first; win; win = win->next)
if (win->screen->temp == 0)
break;
/* in this case we close all */
if (win == NULL)
WM_exit(C);
}
else
WM_exit(C);
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:50,代码来源:wm_window.c
示例12: WM_read_file
void WM_read_file(bContext *C, char *name, ReportList *reports)
{
int retval;
/* first try to append data from exotic file formats... */
/* it throws error box when file doesnt exist and returns -1 */
/* note; it should set some error message somewhere... (ton) */
retval= BKE_read_exotic(CTX_data_scene(C), name);
/* we didn't succeed, now try to read Blender file */
if (retval== 0) {
ListBase wmbase;
/* put aside screens to match with persistant windows later */
/* also exit screens and editors */
wm_window_match_init(C, &wmbase);
retval= BKE_read_file(C, name, NULL, reports);
G.save_over = 1;
/* match the read WM with current WM */
wm_window_match_do(C, &wmbase);
wm_check(C); /* opens window(s), checks keymaps */
// XXX mainwindow_set_filename_to_title(G.main->name);
if(retval==2) wm_init_userdef(); // in case a userdef is read from regular .blend
if (retval!=0) {
G.relbase_valid = 1;
writeBlog();
}
// XXX undo_editmode_clear();
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
// refresh_interface_font();
CTX_wm_window_set(C, NULL); /* exits queues */
}
else if(retval==1)
BKE_write_undo(C, "Import file");
else if(retval == -1) {
if(reports && reports->list.first == NULL)
BKE_report(reports, RPT_ERROR, "Cannot read file.");
}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:49,代码来源:wm_files.c
示例13: wm_window_free
/* including window itself, C can be NULL.
* ED_screen_exit should have been called */
void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
{
wmTimer *wt, *wtnext;
/* update context */
if (C) {
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
if (CTX_wm_window(C) == win)
CTX_wm_window_set(C, NULL);
}
/* always set drawable and active to NULL,
* prevents non-drawable state of main windows (bugs #22967 and #25071, possibly #22477 too) */
wm->windrawable = NULL;
wm->winactive = NULL;
/* end running jobs, a job end also removes its timer */
for (wt = wm->timers.first; wt; wt = wtnext) {
wtnext = wt->next;
if (wt->win == win && wt->event_type == TIMERJOBS)
wm_jobs_timer_ended(wm, wt);
}
/* timer removing, need to call this api function */
for (wt = wm->timers.first; wt; wt = wtnext) {
wtnext = wt->next;
if (wt->win == win)
WM_event_remove_timer(wm, win, wt);
}
if (win->eventstate) MEM_freeN(win->eventstate);
wm_event_free_all(win);
wm_subwindows_free(win);
wm_draw_data_free(win);
wm_ghostwindow_destroy(win);
MEM_freeN(win->stereo3d_format);
MEM_freeN(win);
}
开发者ID:JasonWilkins,项目名称:blender-viewport_fx,代码行数:47,代码来源:wm_window.c
示例14: CTX_wm_window
/**
* new window, no screen yet, but we open ghostwindow for it,
* also gets the window level handlers
* \note area-rip calls this.
* \return the window or NULL.
*/
wmWindow *WM_window_open(bContext *C, const rcti *rect)
{
wmWindow *win_prev = CTX_wm_window(C);
wmWindow *win = wm_window_new(C);
win->posx = rect->xmin;
win->posy = rect->ymin;
win->sizex = BLI_rcti_size_x(rect);
win->sizey = BLI_rcti_size_y(rect);
win->drawmethod = U.wmdrawmethod;
WM_check(C);
if (win->ghostwin) {
return win;
}
else {
wm_window_close(C, CTX_wm_manager(C), win);
CTX_wm_window_set(C, win_prev);
return NULL;
}
}
开发者ID:hendradarwin,项目名称:blender,代码行数:29,代码来源:wm_window.c
示例15: wm_window_match_init
/* To be able to read files without windows closing, opening, moving
we try to prepare for worst case:
- active window gets active screen from file
- restoring the screens from non-active windows
Best case is all screens match, in that case they get assigned to proper window
*/
static void wm_window_match_init(bContext *C, ListBase *wmlist)
{
wmWindowManager *wm= G.main->wm.first;
wmWindow *win;
*wmlist= G.main->wm;
G.main->wm.first= G.main->wm.last= NULL;
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
for(wm= wmlist->first; wm; wm= wm->id.next) {
WM_jobs_stop_all(wm);
for(win= wm->windows.first; win; win= win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
ED_screen_exit(C, win, win->screen);
}
}
ED_editors_exit(C);
return;
if(wm==NULL) return;
if(G.fileflags & G_FILE_NO_UI) return;
/* we take apart the used screens from non-active window */
for(win= wm->windows.first; win; win= win->next) {
BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
if(win!=wm->winactive) {
BLI_remlink(&G.main->screen, win->screen);
//BLI_addtail(screenbase, win->screen);
}
}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:42,代码来源:wm_files.c
示例16: wm_stereo3d_set_exec
int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win_src = CTX_wm_window(C);
wmWindow *win_dst = NULL;
const bool is_fullscreen = WM_window_is_fullscreen(win_src);
char prev_display_mode = win_src->stereo3d_format->display_mode;
Stereo3dData *s3dd;
bool ok = true;
if (G.background)
return OPERATOR_CANCELLED;
if (op->customdata == NULL) {
/* no invoke means we need to set the operator properties here */
wm_stereo3d_set_init(C, op);
wm_stereo3d_set_properties(C, op);
}
s3dd = op->customdata;
*win_src->stereo3d_format = s3dd->stereo3d_format;
if (prev_display_mode == S3D_DISPLAY_PAGEFLIP &&
prev_display_mode != win_src->stereo3d_format->display_mode)
{
/* in case the hardward supports pageflip but not the display */
if ((win_dst = wm_window_copy_test(C, win_src))) {
/* pass */
}
else {
BKE_report(op->reports, RPT_ERROR,
"Failed to create a window without quad-buffer support, you may experience flickering");
ok = false;
}
}
else if (win_src->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
/* ED_screen_duplicate() can't handle other cases yet T44688 */
if (win_src->screen->state != SCREENNORMAL) {
BKE_report(op->reports, RPT_ERROR,
"Failed to switch to Time Sequential mode when in fullscreen");
ok = false;
}
/* pageflip requires a new window to be created with the proper OS flags */
else if ((win_dst = wm_window_copy_test(C, win_src))) {
if (wm_stereo3d_quadbuffer_supported()) {
BKE_report(op->reports, RPT_INFO, "Quad-buffer window successfully created");
}
else {
wm_window_close(C, wm, win_dst);
win_dst = NULL;
BKE_report(op->reports, RPT_ERROR, "Quad-buffer not supported by the system");
ok = false;
}
}
else {
BKE_report(op->reports, RPT_ERROR,
"Failed to create a window compatible with the time sequential display method");
ok = false;
}
}
if (wm_stereo3d_is_fullscreen_required(s3dd->stereo3d_format.display_mode)) {
if (!is_fullscreen) {
BKE_report(op->reports, RPT_INFO, "Stereo 3D Mode requires the window to be fullscreen");
}
}
MEM_freeN(op->customdata);
if (ok) {
if (win_dst) {
wm_window_close(C, wm, win_src);
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
else {
/* without this, the popup won't be freed freed properly T44688 */
CTX_wm_window_set(C, win_src);
win_src->stereo3d_format->display_mode = prev_display_mode;
return OPERATOR_CANCELLED;
}
}
开发者ID:Rojuinex,项目名称:Blender,代码行数:84,代码来源:wm_stereo.c
示例17: WM_exit_ext
/**
* \note doesn't run exit() call #WM_exit() for that.
*/
void WM_exit_ext(bContext *C, const bool do_python)
{
wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
/* first wrap up running stuff, we assume only the active WM is running */
/* modal handlers are on window level freed, others too? */
/* note; same code copied in wm_files.c */
if (C && wm) {
wmWindow *win;
if (!G.background) {
struct MemFile *undo_memfile = wm->undo_stack ? ED_undosys_stack_memfile_get_active(wm->undo_stack) : NULL;
if ((U.uiflag2 & USER_KEEP_SESSION) || (undo_memfile != NULL)) {
/* save the undo state as quit.blend */
char filename[FILE_MAX];
bool has_edited;
int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_HISTORY);
BLI_make_file_string("/", filename, BKE_tempdir_base(), BLENDER_QUIT_FILE);
has_edited = ED_editors_flush_edits(C, false);
if ((has_edited && BLO_write_file(CTX_data_main(C), filename, fileflags, NULL, NULL)) ||
(undo_memfile && BLO_memfile_write_file(undo_memfile, filename)))
{
printf("Saved session recovery to '%s'\n", filename);
}
}
}
WM_jobs_kill_all(wm);
for (win = wm->windows.first; win; win = win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
ED_screen_exit(C, win, win->screen);
}
}
BKE_addon_pref_type_free();
wm_operatortype_free();
wm_dropbox_free();
WM_menutype_free();
WM_uilisttype_free();
/* all non-screen and non-space stuff editors did, like editmode */
if (C)
ED_editors_exit(C);
ED_undosys_type_free();
// XXX
// BIF_GlobalReebFree();
// BIF_freeRetarget();
BIF_freeTemplates(C);
free_openrecent();
BKE_mball_cubeTable_free();
/* render code might still access databases */
RE_FreeAllRender();
RE_engines_exit();
ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
if (C && wm)
wm_free_reports(C); /* before BKE_blender_free! - since the ListBases get freed there */
BKE_sequencer_free_clipboard(); /* sequencer.c */
BKE_tracking_clipboard_free();
BKE_mask_clipboard_free();
BKE_vfont_clipboard_free();
#ifdef WITH_COMPOSITOR
COM_deinitialize();
#endif
BKE_blender_free(); /* blender.c, does entire library and spacetypes */
// free_matcopybuf();
ANIM_fcurves_copybuf_free();
ANIM_drivers_copybuf_free();
ANIM_driver_vars_copybuf_free();
ANIM_fmodifiers_copybuf_free();
ED_gpencil_anim_copybuf_free();
ED_gpencil_strokes_copybuf_free();
BKE_node_clipboard_clear();
BLF_exit();
#ifdef WITH_INTERNATIONAL
BLF_free_unifont();
BLF_free_unifont_mono();
BLT_lang_free();
#endif
//.........这里部分代码省略.........
开发者ID:Ichthyostega,项目名称:blender,代码行数:101,代码来源:wm_init_exit.c
示例18: WM_init_game
bool WM_init_game(bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win;
ScrArea *sa;
ARegion *ar = NULL;
Scene *scene = CTX_data_scene(C);
if (!scene) {
/* XXX, this should not be needed. */
Main *bmain = CTX_data_main(C);
scene = bmain->scene.first;
}
win = wm->windows.first;
/* first to get a valid window */
if (win)
CTX_wm_window_set(C, win);
sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0);
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
/* if we have a valid 3D view */
if (sa && ar) {
ARegion *arhide;
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* disable quad view */
if (ar->alignment == RGN_ALIGN_QSPLIT)
WM_operator_name_call(C, "SCREEN_OT_region_quadview", WM_OP_EXEC_DEFAULT, NULL);
/* toolbox, properties panel and header are hidden */
for (arhide = sa->regionbase.first; arhide; arhide = arhide->next) {
if (arhide->regiontype != RGN_TYPE_WINDOW) {
if (!(arhide->flag & RGN_FLAG_HIDDEN)) {
ED_region_toggle_hidden(C, arhide);
}
}
}
/* full screen the area */
if (!sa->full) {
ED_screen_state_toggle(C, win, sa, SCREENMAXIMIZED);
}
/* Fullscreen */
if ((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) {
WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL);
wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax);
ar->winx = ar->winrct.xmax + 1;
ar->winy = ar->winrct.ymax + 1;
}
else {
GHOST_RectangleHandle rect = GHOST_GetClientBounds(win->ghostwin);
ar->winrct.ymax = GHOST_GetHeightRectangle(rect);
ar->winrct.xmax = GHOST_GetWidthRectangle(rect);
ar->winx = ar->winrct.xmax + 1;
ar->winy = ar->winrct.ymax + 1;
GHOST_DisposeRectangle(rect);
}
WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL);
BKE_sound_exit();
return true;
}
else {
ReportTimerInfo *rti;
BKE_report(&wm->reports, RPT_ERROR, "No valid 3D View found, game auto start is not possible");
/* After adding the report to the global list, reset the report timer. */
WM_event_remove_timer(wm, NULL, wm->reports.reporttimer);
/* Records time since last report was added */
wm->reports.reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER, 0.02);
rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
wm->reports.reporttimer->customdata = rti;
return false;
}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:89,代码来源:wm_init_exit.c
示例19: ghost_event_proc
//.........这里部分代码省略.........
if (type != GHOST_kEventWindowSize) {
printf("win move event pos %d %d size %d %d\n",
win->posx, win->posy, win->sizex, win->sizey);
}
}
wm_window_make_drawable(wm, win);
wm_draw_window_clear(win);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
#if defined(__APPLE__) || defined(WIN32)
/* OSX and Win32 don't return to the mainloop while resize */
wm_event_do_handlers(C);
wm_event_do_notifiers(C);
wm_draw_update(C);
#endif
}
}
break;
}
case GHOST_kEventOpenMainFile:
{
PointerRNA props_ptr;
wmWindow *oldWindow;
const char *path = GHOST_GetEventData(evt);
if (path) {
wmOperatorType *ot = WM_operatortype_find("WM_OT_open_mainfile", false);
/* operator needs a valid window in context, ensures
* it is correctly set */
oldWindow = CTX_wm_window(C);
CTX_wm_window_set(C, win);
WM_operator_properties_create_ptr(&props_ptr, ot);
RNA_string_set(&props_ptr, "filepath", path);
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr);
WM_operator_properties_free(&props_ptr);
CTX_wm_window_set(C, oldWindow);
}
break;
}
case GHOST_kEventDraggingDropDone:
{
wmEvent event;
GHOST_TEventDragnDropData *ddd = GHOST_GetEventData(evt);
int wx, wy;
/* entering window, update mouse pos */
wm_get_cursor_position(win, &wx, &wy);
win->eventstate->x = wx;
win->eventstate->y = wy;
wm_event_init_from_window(win, &event); /* copy last state, like mouse coords */
/* activate region */
event.type = MOUSEMOVE;
event.prevx = event.x;
event.prevy = event.y;
wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */
win->active = 1;
wm_event_add(win, &event);
开发者ID:JasonWilkins,项目名称:blender-viewport_fx,代码行数:67,代码来源:wm_window.c
示例20: WM_init
//.........这里部分代码省略.........
#ifdef WITH_INPUT_NDOF
/* sets 3D mouse deadzone */
WM_ndof_deadzone_set(U.ndof_deadzone);
#endif
GPU_init();
GPU_set_mipmap(G_MAIN, !(U.gameflags & USER_DISABLE_MIPMAP));
GPU_set_linear_mipmap(true);
GPU_set_anisotropic(G_MAIN, U.anisotropic_filter);
GPU_set_gpu_mipmapping(G_MAIN, U.use_gpu_mipmap);
#ifdef WITH_OPENSUBDIV
BKE_subsurf_osd_init();
#endif
UI_init();
}
else {
/* Note: Currently only inits icons, which we now want in background mode too
* (scripts could use those in background processing...).
* In case we do more later, we may need to pass a 'background' flag.
* Called from 'UI_init' above */
BKE_icons_init(1);
}
ED_spacemacros_init();
/* note: there is a bug where python needs initializing before loading the
* startup.blend because it may contain PyDrivers. It also needs to be after
* initializing space types and other internal data.
*
* However cant redo this at the moment. Solution is to load python
* before wm_homefile_read() or make py-drivers check if python is running.
* Will try fix when the crash can be repeated. - campbell. */
#ifdef WITH_PYTHON
BPY_context_set(C); /* necessary evil */
BPY_python_start(argc, argv);
BPY_python_reset(C);
#else
(void)argc; /* unused */
(void)argv; /* unused */
#endif
if (!G.background && !wm_start_with_console)
GHOST_toggleConsole(3);
clear_matcopybuf();
ED_render_clear_mtex_copybuf();
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
wm_history_file_read();
/* allow a path of "", this is what happens when making a new file */
#if 0
if (BKE_main_blendfile_path_from_global()[0] == '\0')
BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend");
#endif
BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib));
#ifdef WITH_COMPOSITOR
if (1) {
extern void *COM_linker_hack;
COM_linker_hack = COM_execute;
}
#endif
/* load last session, uses regular file reading so it has to be in end (after init py etc) */
if (U.uiflag2 & USER_KEEP_SESSION) {
/* calling WM_recover_last_session(C, NULL) has been moved to creator.c */
/* that prevents loading both the kept session, and the file on the command line */
}
else {
Main *bmain = CTX_data_main(C);
/* note, logic here is from wm_file_read_post,
* call functions that depend on Python being initialized. */
/* normally 'wm_homefile_read' will do this,
* however python is not initialized when called from this function.
*
* unlikely any handlers are set but its possible,
* note that recovering the last session does its own callbacks. */
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST);
wm_file_read_report(C, bmain);
if (!G.background) {
CTX_wm_window_set(C, NULL);
}
}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:101,代码来源:wm_init_exit.c
注:本文中的CTX_wm_window_set函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论