diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-07-08 02:02:11 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-07-08 02:02:11 +0300 |
commit | db28e2deb9d154ed50600542e37828867d0148e5 (patch) | |
tree | 279612479f5a0052d4a189af6e36b3dbff1e231c /source/blender | |
parent | e960cecdf8d1cef32f8c42e633ad05a08a97972b (diff) | |
parent | 7dc3ad22873e08de11172757066bb2b3a27f7203 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 2 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 13 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 13 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 1 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 16 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 17 |
12 files changed, 47 insertions, 41 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 1b967f889c0..22559edad22 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -41,7 +41,7 @@ struct rctf; struct ColorManagedDisplay; struct ResultBLF; -int BLF_init(int points, int dpi); +int BLF_init(void); void BLF_exit(void); void BLF_default_dpi(int dpi); void BLF_default_set(int fontid); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 55c08361a47..24347d57917 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -97,15 +97,16 @@ static FontBLF *blf_get(int fontid) return NULL; } -int BLF_init(int points, int dpi) +int BLF_init(void) { int i; for (i = 0; i < BLF_MAX_FONT; i++) global_font[i] = NULL; - global_font_points = points; - global_font_dpi = dpi; + global_font_points = 11; + global_font_dpi = 72; + return blf_font_init(); } diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index d55926ffb1e..ec0bfa6f5fa 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -50,7 +50,6 @@ void BKE_blender_version_string( void BKE_blender_userdef_set_data(struct UserDef *userdef); void BKE_blender_userdef_free_data(struct UserDef *userdef); -void BKE_blender_userdef_refresh(void); void BKE_blender_userdef_set_app_template(struct UserDef *userdef); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 6475e5c8acd..3b3dff21206 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1521,7 +1521,8 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val } case PROP_INT: { - const int value_coerce = (int)value; + int value_coerce = (int)value; + RNA_property_int_clamp(ptr, prop, &value_coerce); if (array_index != -1) { if (RNA_property_int_get_index(ptr, prop, array_index) != value_coerce) { RNA_property_int_set_index(ptr, prop, array_index, value_coerce); @@ -1538,15 +1539,17 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val } case PROP_FLOAT: { + float value_coerce = value; + RNA_property_float_clamp(ptr, prop, &value_coerce); if (array_index != -1) { - if (RNA_property_float_get_index(ptr, prop, array_index) != value) { - RNA_property_float_set_index(ptr, prop, array_index, value); + if (RNA_property_float_get_index(ptr, prop, array_index) != value_coerce) { + RNA_property_float_set_index(ptr, prop, array_index, value_coerce); written = true; } } else { - if (RNA_property_float_get(ptr, prop) != value) { - RNA_property_float_set(ptr, prop, value); + if (RNA_property_float_get(ptr, prop) != value_coerce) { + RNA_property_float_set(ptr, prop, value_coerce); written = true; } } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index ebb10c02683..1f75c85291d 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -230,19 +230,6 @@ void BKE_blender_userdef_free_data(UserDef *userdef) } /** - * Handle changes in settings that need refreshing. - */ -void BKE_blender_userdef_refresh(void) -{ - /* prevent accidents */ - if (U.pixelsize == 0) U.pixelsize = 1; - - BLF_default_dpi(U.pixelsize * U.dpi); - U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72; - -} - -/** * Write U from userdef. * This function defines which settings a template will override for the user preferences. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 006358ea9e1..384dbc628ba 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1480,6 +1480,19 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje /* type-specific node/links */ switch (ob->type) { case OB_MESH: + /* NOTE: This is compatibility code to support particle systems + * + * for viewport being properly rendered in final render mode. + * This relation is similar to what dag_object_time_update_flags() + * was doing for mesh objects with particle system/ + * + * Ideally we need to get rid of this relation. + */ + if (ob->particlesystem.first != NULL) { + TimeSourceKey time_key; + OperationKey obdata_ubereval_key(&ob->id, DEG_NODE_TYPE_GEOMETRY, DEG_OPCODE_GEOMETRY_UBEREVAL); + add_relation(time_key, obdata_ubereval_key, "Legacy particle time"); + } break; case OB_MBALL: diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index c97b52ae1cd..3e4b4b501ce 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -923,6 +923,7 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) winrct.ymax = winsize_y - 1; /* header size depends on DPI, let's verify */ + WM_window_set_dpi(win); screen_refresh_headersizes(); screen_test_scale(screen, winsize_x, winsize_y); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b20781052cd..42cef07205c 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4658,14 +4658,22 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * index= (dob)? dob->persistent_id[0]: 0; + /* It seems that we may generate psys->renderdata recursively in some nasty intricated cases of + * several levels of bupliobject (see T51524). + * For now, basic rule is, do not restore psys if it was already in 'render state'. + * Another, more robust solution could be to add some reference counting to that renderdata... */ + bool psys_has_renderdata = false; + /* the emitter has to be processed first (render levels of modifiers) */ /* so here we only check if the emitter should be rendered */ if (ob->particlesystem.first) { show_emitter= 0; for (psys=ob->particlesystem.first; psys; psys=psys->next) { show_emitter += psys->part->draw & PART_DRAW_EMITTER; - if (!(re->r.scemode & R_VIEWPORT_PREVIEW)) + if (!(re->r.scemode & R_VIEWPORT_PREVIEW)) { + psys_has_renderdata |= (psys->renderdata != NULL); psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, timeoffset); + } } /* if no psys has "show emitter" selected don't render emitter */ @@ -4701,12 +4709,6 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * if (ob->particlesystem.first) { psysindex= 1; for (psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) { - /* It seems that we may generate psys->renderdata recursively in some nasty intricated cases of - * several levels of bupliobject (see T51524). - * For now, basic rule is, do not restore psys if it was already in 'render state'. - * Another, more robust solution could be to add some reference counting to that renderdata... */ - const bool psys_has_renderdata = (psys->renderdata != NULL); - if (!psys_check_enabled(ob, psys, G.is_rendering)) continue; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 3501105d404..a8c67a296af 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -125,6 +125,7 @@ enum { struct wmWindow *WM_window_open(struct bContext *C, const struct rcti *rect); struct wmWindow *WM_window_open_temp(struct bContext *C, int x, int y, int sizex, int sizey, int type); +void WM_window_set_dpi(wmWindow *win); /* returns true if draw method is triple buffer */ bool WM_is_draw_triple(struct wmWindow *win); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 522c68d73e7..5631a0108fd 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -350,8 +350,6 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory) /* update tempdir from user preferences */ BKE_tempdir_init(U.tempdir); - - BKE_blender_userdef_refresh(); } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 6ae41ab3917..a96ddb7368a 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -185,7 +185,7 @@ void WM_init(bContext *C, int argc, const char **argv) ED_file_init(); /* for fsmenu */ ED_node_init_butfuncs(); - BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ + BLF_init(); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ BLT_lang_init(); /* Enforce loading the UI for the initial homefile */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 66df41e5b84..8068b048d10 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -414,7 +414,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } } -static void wm_window_set_dpi(wmWindow *win) +void WM_window_set_dpi(wmWindow *win) { int auto_dpi = GHOST_GetDPIHint(win->ghostwin); @@ -445,8 +445,10 @@ static void wm_window_set_dpi(wmWindow *win) U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin) * pixelsize; U.dpi = dpi / pixelsize; U.virtual_pixel = (pixelsize == 1) ? VIRTUAL_PIXEL_NATIVE : VIRTUAL_PIXEL_DOUBLE; + U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72; - BKE_blender_userdef_refresh(); + /* update font drawing */ + BLF_default_dpi(U.pixelsize * U.dpi); } /* belongs to below */ @@ -522,7 +524,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm } /* needed here, because it's used before it reads userdef */ - wm_window_set_dpi(win); + WM_window_set_dpi(win); wm_window_swap_buffers(win); @@ -1011,7 +1013,7 @@ void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win) immActivate(); /* this can change per window */ - wm_window_set_dpi(win); + WM_window_set_dpi(win); } } @@ -1211,7 +1213,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr WM_jobs_stop(wm, WM_window_get_active_screen(win), NULL); } - wm_window_set_dpi(win); + WM_window_set_dpi(win); /* win32: gives undefined window size when minimized */ if (state != GHOST_kWindowStateMinimized) { @@ -1301,11 +1303,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr case GHOST_kEventWindowDPIHintChanged: { - wm_window_set_dpi(win); + WM_window_set_dpi(win); /* font's are stored at each DPI level, without this we can easy load 100's of fonts */ BLF_cache_clear(); - BKE_blender_userdef_refresh(); WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */ break; @@ -1391,7 +1392,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr { // only update if the actual pixel size changes float prev_pixelsize = U.pixelsize; - wm_window_set_dpi(win); + WM_window_set_dpi(win); if (U.pixelsize != prev_pixelsize) { BKE_icon_changed(WM_window_get_active_screen(win)->id.icon_id); |