From 15af75d79e5a25049d901764d5cf99fea8348f41 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Fri, 23 Mar 2018 09:23:08 -0600 Subject: [PATCH 01/11] msvc: Fix msvc2013 new despgraph related build errors. msvc's function.hpp does not like NULL for function pointers. disabled support for this platform. --- source/blender/depsgraph/util/deg_util_function.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/depsgraph/util/deg_util_function.h b/source/blender/depsgraph/util/deg_util_function.h index 63cd1d6f5eb..99625e57f4b 100644 --- a/source/blender/depsgraph/util/deg_util_function.h +++ b/source/blender/depsgraph/util/deg_util_function.h @@ -30,7 +30,7 @@ #pragma once -#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900) #include From a7e4268beeda8e49cd93af375b125c72e6f2ac93 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 23 Mar 2018 17:31:33 +0100 Subject: [PATCH 02/11] UI: restore quit confirmation when dialog disabled --- source/blender/windowmanager/intern/wm_operators.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1c21069879a..814d8823817 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2166,12 +2166,23 @@ static int wm_exit_blender_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } +static int wm_exit_blender_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + if (U.uiflag & USER_QUIT_PROMPT) { + return wm_exit_blender_exec(C, op); + } + else { + return WM_operator_confirm(C, op, event); + } +} + static void WM_OT_quit_blender(wmOperatorType *ot) { ot->name = "Quit Blender"; ot->idname = "WM_OT_quit_blender"; ot->description = "Quit Blender"; + ot->invoke = wm_exit_blender_invoke; ot->exec = wm_exit_blender_exec; } From 357b72e0a7d4a270bf1273102595446ccca16259 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 23 Mar 2018 20:32:58 +0100 Subject: [PATCH 03/11] Theming: Use list-item colors for all un-embossed buttons in list-items E.g. number buttons in the shape key list would use theme colors of text widgets. Addresses T50862. --- source/blender/editors/interface/interface_handlers.c | 5 ++++- source/blender/editors/interface/interface_layout.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 47de598c028..bf39a8d353f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7713,7 +7713,10 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s /* highlight has timers for tooltips and auto open */ if (state == BUTTON_STATE_HIGHLIGHT) { - but->flag &= ~UI_SELECT; + /* for list-items (that are not drawn with regular emboss), don't change selection based on hovering */ + if (((but->flag & UI_BUT_LIST_ITEM) == 0) && (but->dragflag & UI_EMBOSS_NONE)) { + but->flag &= ~UI_SELECT; + } button_tooltip_timer_reset(C, but); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 21dac015f82..ff752ddddba 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1486,7 +1486,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index } /* Mark non-embossed textfields inside a listbox. */ - if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->type == UI_BTYPE_TEXT) && (but->dt & UI_EMBOSS_NONE)) { + if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->dt & UI_EMBOSS_NONE)) { UI_but_flag_enable(but, UI_BUT_LIST_ITEM); } From 19f148d9d0e4c4407ea46b6021e581e26d03c556 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Fri, 23 Mar 2018 20:23:47 -0400 Subject: [PATCH 04/11] PyDoc: Add docutils ref for "registration" This will be used to link to from the manual. --- doc/python_api/rst/info_overview.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/python_api/rst/info_overview.rst b/doc/python_api/rst/info_overview.rst index 721374cd472..4b8df47990c 100644 --- a/doc/python_api/rst/info_overview.rst +++ b/doc/python_api/rst/info_overview.rst @@ -194,10 +194,11 @@ User interface classes are given a context in which to draw, buttons window, fil then they are drawn when that area is displayed so they are never called by Python scripts directly. +.. _info_overview_registration: + Registration ============ - Module Registration ------------------- From 9d1de621e2a7505ef7260df8a34b670e99f94a67 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2018 12:46:25 +0100 Subject: [PATCH 05/11] Cleanup: move undo opcodes out of public header --- source/blender/blenkernel/BKE_text.h | 41 ----------------------- source/blender/blenkernel/intern/text.c | 43 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 41 deletions(-) diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 14d3318e059..b3b1ad23b32 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -135,47 +135,6 @@ enum { TXT_MOVE_LINE_DOWN = 1 }; - -/* Undo opcodes */ - -/* Complex editing */ -/* 1 - opcode is followed by 1 byte for ascii character and opcode (repeat)) */ -/* 2 - opcode is followed by 2 bytes for utf-8 character and opcode (repeat)) */ -/* 3 - opcode is followed by 3 bytes for utf-8 character and opcode (repeat)) */ -/* 4 - opcode is followed by 4 bytes for unicode character and opcode (repeat)) */ -#define UNDO_INSERT_1 013 -#define UNDO_INSERT_2 014 -#define UNDO_INSERT_3 015 -#define UNDO_INSERT_4 016 - -#define UNDO_BS_1 017 -#define UNDO_BS_2 020 -#define UNDO_BS_3 021 -#define UNDO_BS_4 022 - -#define UNDO_DEL_1 023 -#define UNDO_DEL_2 024 -#define UNDO_DEL_3 025 -#define UNDO_DEL_4 026 - -/* Text block (opcode is followed - * by 4 character length ID + the text - * block itself + the 4 character length - * ID (repeat) and opcode (repeat)) */ -#define UNDO_DBLOCK 027 /* Delete block */ -#define UNDO_IBLOCK 030 /* Insert block */ - -/* Misc */ -#define UNDO_INDENT 032 -#define UNDO_UNINDENT 033 -#define UNDO_COMMENT 034 -#define UNDO_UNCOMMENT 035 - -#define UNDO_MOVE_LINES_UP 036 -#define UNDO_MOVE_LINES_DOWN 037 - -#define UNDO_DUPLICATE 040 - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 7c4aa81ee46..db1bbeb0a88 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -121,6 +121,49 @@ * */ + +/* Undo opcodes */ + +enum { + /* Complex editing */ + /* 1 - opcode is followed by 1 byte for ascii character and opcode (repeat)) */ + /* 2 - opcode is followed by 2 bytes for utf-8 character and opcode (repeat)) */ + /* 3 - opcode is followed by 3 bytes for utf-8 character and opcode (repeat)) */ + /* 4 - opcode is followed by 4 bytes for unicode character and opcode (repeat)) */ + UNDO_INSERT_1 = 013, + UNDO_INSERT_2 = 014, + UNDO_INSERT_3 = 015, + UNDO_INSERT_4 = 016, + + UNDO_BS_1 = 017, + UNDO_BS_2 = 020, + UNDO_BS_3 = 021, + UNDO_BS_4 = 022, + + UNDO_DEL_1 = 023, + UNDO_DEL_2 = 024, + UNDO_DEL_3 = 025, + UNDO_DEL_4 = 026, + + /* Text block (opcode is followed + * by 4 character length ID + the text + * block itself + the 4 character length + * ID (repeat) and opcode (repeat)) */ + UNDO_DBLOCK = 027, /* Delete block */ + UNDO_IBLOCK = 030, /* Insert block */ + + /* Misc */ + UNDO_INDENT = 032, + UNDO_UNINDENT = 033, + UNDO_COMMENT = 034, + UNDO_UNCOMMENT = 035, + + UNDO_MOVE_LINES_UP = 036, + UNDO_MOVE_LINES_DOWN = 037, + + UNDO_DUPLICATE = 040, +}; + /***/ static void txt_pop_first(Text *text); From 3f9d5ea0ecc2561ee51be977ffd5ef4cfa0c2b49 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2018 14:14:19 +0100 Subject: [PATCH 06/11] Fix text editor undo w/ 4+ byte utf8 characters --- source/blender/blenkernel/intern/text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index db1bbeb0a88..5de325277ee 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1763,7 +1763,7 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c) text->undo_buf[text->undo_pos] = op_start + 3; text->undo_pos++; - txt_undo_store_cursors(text); + txt_undo_store_cur(text); txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c); text->undo_buf[text->undo_pos] = op_start + 3; @@ -1957,7 +1957,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s unicode = BLI_str_utf8_as_unicode(utf8); break; case 4: /* 32-bit unicode symbol */ - unicode = txt_undo_read_uint32(undo_buf, undo_pos); + unicode = txt_redo_read_uint32(undo_buf, undo_pos); break; default: /* should never happen */ From 977a4e7f5d001e62a9e09dd3a02dc2cb2329f893 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2018 14:18:58 +0100 Subject: [PATCH 07/11] Text: re-allocate exact lengths for undo Undo sometimes reserved too much space in the buffer, now assert when this happens and allocate the exact size needed. Note prepares for moving text editor undo out of the text block (D3113) which will split the undo buffer into a list of undo steps. --- source/blender/blenkernel/intern/text.c | 138 ++++++++++++++---------- 1 file changed, 84 insertions(+), 54 deletions(-) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 5de325277ee..b8307031920 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -191,8 +191,8 @@ int txt_get_undostate(void) static void init_undo_text(Text *text) { text->undo_pos = -1; - text->undo_len = TXT_INIT_UNDO; - text->undo_buf = MEM_mallocN(text->undo_len, "undo buf"); + text->undo_len = 0; + text->undo_buf = NULL; } /** @@ -1466,25 +1466,40 @@ void txt_insert_buf(Text *text, const char *in_buffer) static bool max_undo_test(Text *text, int x) { - while (text->undo_pos + x >= text->undo_len) { - if (text->undo_len * 2 > TXT_MAX_UNDO) { - /* XXX error("Undo limit reached, buffer cleared\n"); */ - MEM_freeN(text->undo_buf); - init_undo_text(text); - return false; - } - else { - void *tmp = text->undo_buf; - text->undo_buf = MEM_callocN(text->undo_len * 2, "undo buf"); - memcpy(text->undo_buf, tmp, text->undo_len); - text->undo_len *= 2; - MEM_freeN(tmp); - } - } + /* Normally over-allocating is preferred, + * however in this case the buffer is small enough and re-allocation + * fast enough for each undo step that it's not a problem to allocate each time. + * This also saves on some memory when we have many text buffers + * that would have an empty undo memory allocated. + */ + /* Add one for the null terminator. */ + text->undo_len = text->undo_pos + x + 1; + if (text->undo_len > TXT_MAX_UNDO) { + /* XXX error("Undo limit reached, buffer cleared\n"); */ + MEM_freeN(text->undo_buf); + init_undo_text(text); + return false; + } + else { + /* Small reallocations on each undo step is fine. */ + text->undo_buf = MEM_recallocN(text->undo_buf, text->undo_len); + } return true; } +static void txt_undo_end(Text *text) +{ + int undo_pos_end = text->undo_pos + 1; + BLI_assert(undo_pos_end + 1 == text->undo_len); + text->undo_buf[undo_pos_end] = '\0'; +} + +/* Call once undo is done. */ +#ifndef NDEBUG + +#endif + #if 0 /* UNUSED */ static void dump_buffer(Text *text) { @@ -1672,21 +1687,21 @@ static void txt_undo_store_uint32(char *undo_buf, int *undo_pos, unsigned int va (*undo_pos)++; } -/* store the cur cursor to the undo buffer */ +/* store the cur cursor to the undo buffer (6 bytes)*/ static void txt_undo_store_cur(Text *text) { txt_undo_store_uint16(text->undo_buf, &text->undo_pos, text->curc); txt_undo_store_uint32(text->undo_buf, &text->undo_pos, txt_get_span(text->lines.first, text->curl)); } -/* store the sel cursor to the undo buffer */ +/* store the sel cursor to the undo buffer (6 bytes) */ static void txt_undo_store_sel(Text *text) { txt_undo_store_uint16(text->undo_buf, &text->undo_pos, text->selc); txt_undo_store_uint32(text->undo_buf, &text->undo_pos, txt_get_span(text->lines.first, text->sell)); } -/* store both cursors to the undo buffer */ +/* store both cursors to the undo buffer (12 bytes) */ static void txt_undo_store_cursors(Text *text) { txt_undo_store_cur(text); @@ -1697,42 +1712,46 @@ static void txt_undo_store_cursors(Text *text) static void txt_undo_add_blockop(Text *text, int op, const char *buf) { unsigned int length = strlen(buf); - - if (!max_undo_test(text, length + 11 + 12)) - return; + if (!max_undo_test(text, 2 + 12 + 4 + length + 4 + 1)) { + return; + } + /* 2 bytes */ text->undo_pos++; text->undo_buf[text->undo_pos] = op; text->undo_pos++; - + /* 12 bytes */ txt_undo_store_cursors(text); - + /* 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, length); - + /* 'length' bytes */ strncpy(text->undo_buf + text->undo_pos, buf, length); text->undo_pos += length; - + /* 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, length); + /* 1 byte */ text->undo_buf[text->undo_pos] = op; - - text->undo_buf[text->undo_pos + 1] = 0; + + txt_undo_end(text); } /* store a regular operator */ void txt_undo_add_op(Text *text, int op) { - if (!max_undo_test(text, 15)) + if (!max_undo_test(text, 2 + 12 + 1)) { return; + } + /* 2 bytes */ text->undo_pos++; text->undo_buf[text->undo_pos] = op; - text->undo_pos++; - + /* 12 bytes */ txt_undo_store_cursors(text); - + /* 1 byte */ text->undo_buf[text->undo_pos] = op; - text->undo_buf[text->undo_pos + 1] = 0; + + txt_undo_end(text); } /* store an operator for a single character */ @@ -1741,35 +1760,41 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c) char utf8[BLI_UTF8_MAX]; size_t i, utf8_size = BLI_str_utf8_from_unicode(c, utf8); - if (!max_undo_test(text, 3 + utf8_size + 12)) - return; - - text->undo_pos++; - - if (utf8_size < 4) { + if (utf8_size < 4 && 0) { + if (!max_undo_test(text, 2 + 6 + utf8_size + 1)) { + return; + } + /* 2 bytes */ + text->undo_pos++; text->undo_buf[text->undo_pos] = op_start + utf8_size - 1; text->undo_pos++; - + /* 6 bytes */ txt_undo_store_cur(text); - + /* 'utf8_size' bytes */ for (i = 0; i < utf8_size; i++) { text->undo_buf[text->undo_pos] = utf8[i]; text->undo_pos++; } - + /* 1 byte */ text->undo_buf[text->undo_pos] = op_start + utf8_size - 1; } else { + if (!max_undo_test(text, 2 + 6 + 4 + 1)) { + return; + } + /* 2 bytes */ + text->undo_pos++; text->undo_buf[text->undo_pos] = op_start + 3; text->undo_pos++; - + /* 6 bytes */ txt_undo_store_cur(text); - + /* 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c); + /* 1 byte */ text->undo_buf[text->undo_pos] = op_start + 3; } - text->undo_buf[text->undo_pos + 1] = 0; + txt_undo_end(text); } /* extends Link */ @@ -1791,30 +1816,35 @@ static void txt_undo_add_unprefix_op( BLI_assert(BLI_listbase_count(line_index_mask) == line_index_mask_len); /* OP byte + UInt32 count + counted UInt32 line numbers + UInt32 count + 12-bytes selection + OP byte */ - if (!max_undo_test(text, 1 + 4 + (line_index_mask_len * 4) + 4 + 12 + 1)) { + if (!max_undo_test(text, 2 + 4 + (line_index_mask_len * 4) + 4 + 12 + 1)) { return; } - /* Opening buffer sequence with OP */ + /* 2 bytes */ text->undo_pos++; text->undo_buf[text->undo_pos] = undo_op; text->undo_pos++; - /* Adding number of line numbers to read */ + /* Adding number of line numbers to read + * 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, line_index_mask_len); - /* Adding linenumbers of lines that shall not be indented if undoing */ + /* Adding linenumbers of lines that shall not be indented if undoing. + * 'line_index_mask_len * 4' bytes */ for (idata = line_index_mask->first; idata; idata = idata->next) { txt_undo_store_uint32(text->undo_buf, &text->undo_pos, idata->value); } - /* Adding number of line numbers to read again */ + /* Adding number of line numbers to read again. + * 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, line_index_mask_len); - /* Adding current selection */ + /* Adding current selection. + * 12 bytes */ txt_undo_store_cursors(text); - /* Closing with OP (same as above) */ + /* Closing with OP (same as above). + * 1 byte */ text->undo_buf[text->undo_pos] = undo_op; /* Marking as last undo operation */ - text->undo_buf[text->undo_pos + 1] = 0; + txt_undo_end(text); } static unsigned short txt_undo_read_uint16(const char *undo_buf, int *undo_pos) From 31bf6edf79999d59962bde34076f6ad20a9d1786 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Mar 2018 17:50:40 +0200 Subject: [PATCH 08/11] Text: line break always returned cancelled Harmless but incorrect. --- source/blender/editors/space_text/text_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 4f0d2c93970..f75cd129f67 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -961,7 +961,7 @@ static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op)) text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text); - return OPERATOR_CANCELLED; + return OPERATOR_FINISHED; } void TEXT_OT_line_break(wmOperatorType *ot) From 0476f8277ad58f99dd1ff213496c870d9c29f5d5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Mar 2018 14:07:19 +0200 Subject: [PATCH 09/11] BLF: Cleanup, indentation inside of preprocessor --- source/blender/blenfont/intern/blf_glyph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index bbbabfb8ba2..24a75d667ef 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -56,7 +56,7 @@ #include "BLF_api.h" #ifndef BLF_STANDALONE -#include "GPU_basic_shader.h" +# include "GPU_basic_shader.h" #endif #include "blf_internal_types.h" From 64e5f83133742c622e9c44b80f86d744a0dab05d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Mar 2018 14:38:47 +0200 Subject: [PATCH 10/11] BLF: Don't use user preferences BLF is a low level module, which might (and is) used without Blender. Thanks Campbell for review! --- source/blender/blenfont/BLF_api.h | 4 ++++ source/blender/blenfont/intern/blf.c | 11 +++++++++++ source/blender/blenfont/intern/blf_glyph.c | 2 +- source/blender/makesrna/intern/rna_userdef.c | 8 +++++++- source/blender/windowmanager/intern/wm_files.c | 4 ++++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 8c8aef3de57..f31c132c973 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -33,6 +33,7 @@ #define __BLF_API_H__ #include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" struct rctf; struct ColorManagedDisplay; @@ -43,6 +44,9 @@ void BLF_exit(void); void BLF_default_dpi(int dpi); void BLF_default_set(int fontid); +void BLF_antialias_set(bool enabled); +bool BLF_antialias_get(void); + void BLF_cache_clear(void); int BLF_load(const char *name) ATTR_NONNULL(); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 5bd62980b6d..b45e52f29fd 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -84,6 +84,7 @@ static FontBLF *global_font[BLF_MAX_FONT] = {NULL}; static int global_font_default = -1; static int global_font_points = 11; static int global_font_dpi = 72; +static bool global_use_antialias = true; /* XXX, should these be made into global_font_'s too? */ int blf_mono_font = -1; @@ -175,6 +176,16 @@ void BLF_default_set(int fontid) } } +void BLF_antialias_set(bool enabled) +{ + global_use_antialias = enabled; +} + +bool BLF_antialias_get(void) +{ + return global_use_antialias; +} + int BLF_load(const char *name) { FontBLF *font; diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 24a75d667ef..c90e60bd6ef 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -218,7 +218,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) GlyphBLF *g; FT_Error err; FT_Bitmap bitmap, tempbitmap; - const bool is_sharp = (U.text_render & USER_TEXT_DISABLE_AA) != 0; + const bool is_sharp = !BLF_antialias_get(); int flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; FT_BBox bbox; unsigned int key; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0496de4dd6a..d813c095589 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -450,6 +450,12 @@ static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P WM_main_add_notifier(NC_WINDOW, NULL); } +static void rna_userdef_text_antialiasing_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + BLF_antialias_set((U.text_render & USER_TEXT_DISABLE_AA) == 0); + rna_userdef_text_update(bmain, scene, ptr); +} + static PointerRNA rna_Theme_space_generic_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data); @@ -4209,7 +4215,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop = RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA); RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased"); - RNA_def_property_update(prop, 0, "rna_userdef_text_update"); + RNA_def_property_update(prop, 0, "rna_userdef_text_antialiasing_update"); prop = RNA_def_property(srna, "select_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gpu_select_method"); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 7df6deaecf6..e0b57effbe9 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -62,6 +62,8 @@ #include "BLT_translation.h" +#include "BLF_api.h" + #include "DNA_mesh_types.h" /* only for USE_BMESH_SAVE_AS_COMPAT */ #include "DNA_object_types.h" #include "DNA_space_types.h" @@ -339,6 +341,8 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory) /* update tempdir from user preferences */ BKE_tempdir_init(U.tempdir); + + BLF_antialias_set((U.text_render & USER_TEXT_DISABLE_AA) == 0); } From 3c45fdd171fa6ebd65f19f9fac9b204865e13136 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Mar 2018 14:51:56 +0200 Subject: [PATCH 11/11] GHOST: Solve compilation error of test programs --- intern/ghost/test/CMakeLists.txt | 3 +++ intern/ghost/test/multitest/MultiTest.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt index fb9ef621ecf..e93832c9b4e 100644 --- a/intern/ghost/test/CMakeLists.txt +++ b/intern/ghost/test/CMakeLists.txt @@ -204,6 +204,7 @@ target_link_libraries(gears_c string_lib ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} + ${CMAKE_DL_LIBS} ${PLATFORM_LINKLIBS} ) @@ -218,6 +219,7 @@ target_link_libraries(gears_cpp string_lib ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} + ${CMAKE_DL_LIBS} ${PLATFORM_LINKLIBS} ) @@ -251,5 +253,6 @@ target_link_libraries(multitest_c ${OPENGL_glu_LIBRARY} ${FREETYPE_LIBRARY} ${ZLIB_LIBRARIES} + ${CMAKE_DL_LIBS} ${PLATFORM_LINKLIBS} ) diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c index a5b5a511cb2..833b5c720a1 100644 --- a/intern/ghost/test/multitest/MultiTest.c +++ b/intern/ghost/test/multitest/MultiTest.c @@ -949,7 +949,7 @@ int main(int argc, char **argv) MultiTestApp *app; #ifndef USE_BMF - BLF_init(11, 72); + BLF_init(); #endif app = multitestapp_new();