Merge branch 'master' into blender2.8

This commit is contained in:
2017-08-25 20:45:16 +10:00
7 changed files with 66 additions and 43 deletions

View File

@@ -224,7 +224,7 @@ ccl_device_inline bool isfinite_safe(float f)
{ {
/* By IEEE 754 rule, 2*Inf equals Inf */ /* By IEEE 754 rule, 2*Inf equals Inf */
unsigned int x = __float_as_uint(f); unsigned int x = __float_as_uint(f);
return (f == f) && (x == 0 || (f != 2.0f*f)) && !((x << 1) > 0xff000000u); return (f == f) && (x == 0 || x == (1 << 31) || (f != 2.0f*f)) && !((x << 1) > 0xff000000u);
} }
ccl_device_inline float ensure_finite(float v) ccl_device_inline float ensure_finite(float v)

View File

@@ -21,7 +21,7 @@
Subject to the provisions of the GNU GPL license, BF grants You a Subject to the provisions of the GNU GPL license, BF grants You a
non-exclusive right to use the Software at any computer You own or use. non-exclusive right to use the Software at any computer You own or use.
Artwork you create with the Software - whether it is images, movies, Artwork you create with the Software - whether it is images, movies,
scripts, exported 3d files or the .blend files themselves - is your sole exported 3d files or the .blend files themselves - is your sole
property, and can be licensed or sold under any conditions you prefer. property, and can be licensed or sold under any conditions you prefer.
2. Permitted copying and electronic distribution of Software 2. Permitted copying and electronic distribution of Software

View File

@@ -703,6 +703,7 @@ void ED_view3d_draw_depth(
const EvaluationContext *eval_ctx, struct Depsgraph *graph, const EvaluationContext *eval_ctx, struct Depsgraph *graph,
ARegion *ar, View3D *v3d, bool alphaoverride) ARegion *ar, View3D *v3d, bool alphaoverride)
{ {
struct bThemeState theme_state;
Scene *scene = DEG_get_evaluated_scene(graph); Scene *scene = DEG_get_evaluated_scene(graph);
RegionView3D *rv3d = ar->regiondata; RegionView3D *rv3d = ar->regiondata;
@@ -716,6 +717,10 @@ void ED_view3d_draw_depth(
U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */ U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */
U.obcenter_dia = 0; U.obcenter_dia = 0;
/* Tools may request depth outside of regular drawing code. */
UI_Theme_Store(&theme_state);
UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
ED_view3d_draw_setup_view(NULL, eval_ctx, scene, ar, v3d, NULL, NULL, NULL); ED_view3d_draw_setup_view(NULL, eval_ctx, scene, ar, v3d, NULL, NULL, NULL);
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
@@ -751,6 +756,8 @@ void ED_view3d_draw_depth(
U.glalphaclip = glalphaclip; U.glalphaclip = glalphaclip;
v3d->flag = flag; v3d->flag = flag;
U.obcenter_dia = obcenter_dia; U.obcenter_dia = obcenter_dia;
UI_Theme_Restore(&theme_state);
} }
/* ******************** background plates ***************** */ /* ******************** background plates ***************** */

View File

@@ -135,7 +135,7 @@ static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag)
else { else {
BM_elem_flag_set(self->ele, hflag, param); BM_elem_flag_set(self->ele, hflag, param);
} }
return -1; return 0;
} }
PyDoc_STRVAR(bpy_bm_elem_index_doc, PyDoc_STRVAR(bpy_bm_elem_index_doc,

View File

@@ -497,6 +497,10 @@ void wm_close_and_free_all(bContext *C, ListBase *wmlist)
void WM_main(bContext *C) void WM_main(bContext *C)
{ {
/* Single refresh before handling events.
* This ensures we don't run operators before the depsgraph has been evaluated. */
wm_event_do_refresh_wm_and_depsgraph(C);
while (1) { while (1) {
/* get events from ghost, handle window events, add to window queues */ /* get events from ghost, handle window events, add to window queues */

View File

@@ -264,13 +264,61 @@ static void wm_notifier_clear(wmNotifier *note)
memset(((char *)note) + sizeof(Link), 0, sizeof(*note) - sizeof(Link)); memset(((char *)note) + sizeof(Link), 0, sizeof(*note) - sizeof(Link));
} }
/**
* Was part of #wm_event_do_notifiers, split out so it can be called once before entering the #WM_main loop.
* This ensures operators don't run before the UI and depsgraph are initialized.
*/
void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
uint64_t win_combine_v3d_datamask = 0;
/* combine datamasks so 1 win doesn't disable UV's in another [#26448] */
for (wmWindow *win = wm->windows.first; win; win = win->next) {
const Scene *scene = WM_window_get_active_scene(win);
const bScreen *screen = WM_window_get_active_screen(win);
win_combine_v3d_datamask |= ED_view3d_screen_datamask(scene, screen);
}
/* cached: editor refresh callbacks now, they get context */
for (wmWindow *win = wm->windows.first; win; win = win->next) {
const bScreen *screen = WM_window_get_active_screen(win);
Scene *scene = WM_window_get_active_scene(win);
ScrArea *sa;
CTX_wm_window_set(C, win);
for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->do_refresh) {
CTX_wm_area_set(C, sa);
ED_area_do_refresh(C, sa);
}
}
/* XXX make lock in future, or separated derivedmesh users in scene */
if (G.is_rendering == false) {
/* depsgraph & animation: update tagged datablocks */
Main *bmain = CTX_data_main(C);
/* copied to set's in scene_update_tagged_recursive() */
scene->customdata_mask = win_combine_v3d_datamask;
/* XXX, hack so operators can enforce datamasks [#26482], gl render */
scene->customdata_mask |= scene->customdata_mask_modal;
BKE_scene_update_tagged(bmain->eval_ctx, bmain, scene);
}
}
CTX_wm_window_set(C, NULL);
}
/* called in mainloop */ /* called in mainloop */
void wm_event_do_notifiers(bContext *C) void wm_event_do_notifiers(bContext *C)
{ {
wmWindowManager *wm = CTX_wm_manager(C); wmWindowManager *wm = CTX_wm_manager(C);
wmNotifier *note, *next; wmNotifier *note, *next;
wmWindow *win; wmWindow *win;
uint64_t win_combine_v3d_datamask = 0;
if (wm == NULL) if (wm == NULL)
return; return;
@@ -397,44 +445,7 @@ void wm_event_do_notifiers(bContext *C)
MEM_freeN(note); MEM_freeN(note);
} }
/* combine datamasks so 1 win doesn't disable UV's in another [#26448] */ wm_event_do_refresh_wm_and_depsgraph(C);
for (win = wm->windows.first; win; win = win->next) {
const Scene *scene = WM_window_get_active_scene(win);
const bScreen *screen = WM_window_get_active_screen(win);
win_combine_v3d_datamask |= ED_view3d_screen_datamask(scene, screen);
}
/* cached: editor refresh callbacks now, they get context */
for (win = wm->windows.first; win; win = win->next) {
const bScreen *screen = WM_window_get_active_screen(win);
Scene *scene = WM_window_get_active_scene(win);
ScrArea *sa;
CTX_wm_window_set(C, win);
for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->do_refresh) {
CTX_wm_area_set(C, sa);
ED_area_do_refresh(C, sa);
}
}
/* XXX make lock in future, or separated derivedmesh users in scene */
if (G.is_rendering == false) {
/* depsgraph & animation: update tagged datablocks */
Main *bmain = CTX_data_main(C);
/* copied to set's in scene_update_tagged_recursive() */
scene->customdata_mask = win_combine_v3d_datamask;
/* XXX, hack so operators can enforce datamasks [#26482], gl render */
scene->customdata_mask |= scene->customdata_mask_modal;
BKE_scene_update_tagged(bmain->eval_ctx, bmain, scene);
}
}
CTX_wm_window_set(C, NULL);
} }
static int wm_event_always_pass(const wmEvent *event) static int wm_event_always_pass(const wmEvent *event)

View File

@@ -88,7 +88,8 @@ void wm_event_do_handlers (bContext *C);
void wm_event_add_ghostevent (wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata); void wm_event_add_ghostevent (wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata);
void wm_event_do_notifiers (bContext *C); void wm_event_do_refresh_wm_and_depsgraph(bContext *C);
void wm_event_do_notifiers(bContext *C);
/* wm_keymap.c */ /* wm_keymap.c */