Merge branch 'master' into blender2.8
This commit is contained in:
commit
db28e2deb9
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,19 +229,6 @@ void BKE_blender_userdef_free_data(UserDef *userdef)
|
|||
#undef U
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -517,7 +517,7 @@ int main(
|
|||
#endif
|
||||
|
||||
// Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c)
|
||||
BLF_init(11, U.dpi);
|
||||
BLF_init();
|
||||
BLT_lang_init();
|
||||
BLT_lang_set("");
|
||||
|
||||
|
|
Loading…
Reference in New Issue